diff options
author | Karl Berry <karl@freefriends.org> | 2009-10-03 18:49:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-10-03 18:49:59 +0000 |
commit | b5d732b5920ac3f1cf3a2d53344c03d540559b4a (patch) | |
tree | 613f30a0dac4e461b24915c6f9c56dce749298b6 /Master/texmf-dist/doc/latex/fmtcount | |
parent | 9fb4054c488dbb42bf7d597e7a72bc916136b5af (diff) |
interim fmtcount update
git-svn-id: svn://tug.org/texlive/trunk@15620 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/fmtcount')
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/CHANGES (renamed from Master/texmf-dist/doc/latex/fmtcount/doc/CHANGES) | 9 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/doc/fc-samp.tex | 98 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount.pdf | bin | 147903 -> 0 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex (renamed from Master/texmf-dist/doc/latex/fmtcount/doc/fc-lang.tex) | 123 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex | 141 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fmtcount-manual.html (renamed from Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount-manual.html) | 84 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf | bin | 0 -> 144823 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl | 2670 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fmtcount/latex2html/fmtcount.perl | 2670 |
10 files changed, 293 insertions, 5506 deletions
diff --git a/Master/texmf-dist/doc/latex/fmtcount/doc/CHANGES b/Master/texmf-dist/doc/latex/fmtcount/CHANGES index ea92a56993a..2bf2c037047 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/doc/CHANGES +++ b/Master/texmf-dist/doc/latex/fmtcount/CHANGES @@ -1,5 +1,14 @@ fmtcount package versions: +Version 1.31: + + * fixed unwanted space in \decimalnum + + * fixed bug that ignores spaces after commands like + \ordinalnum. + + * added Italian support (translations provided by Edoardo Pasca) + Version 1.3: * no longer loads xspace package (was causing extraneous diff --git a/Master/texmf-dist/doc/latex/fmtcount/README b/Master/texmf-dist/doc/latex/fmtcount/README index 9efe57f814a..fa6dd14ad0c 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/README +++ b/Master/texmf-dist/doc/latex/fmtcount/README @@ -1,6 +1,6 @@ -LaTeX Package : fmtcount v 1.3 +LaTeX Package : fmtcount v 1.31 -Last Modified : 20 Aug 2007 +Last Modified : 2 October 2009 Author : Nicola Talbot diff --git a/Master/texmf-dist/doc/latex/fmtcount/doc/fc-samp.tex b/Master/texmf-dist/doc/latex/fmtcount/doc/fc-samp.tex deleted file mode 100644 index 7ca4d1c57f5..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/doc/fc-samp.tex +++ /dev/null @@ -1,98 +0,0 @@ -\documentclass[a4paper]{article} - -\usepackage{fmtcount} -\newcounter{N} - -\padzeroes[5] - -\newcommand{\printrow}[1]{% -\newline -\setcounter{N}{#1} -\makebox[0.75in][r]{\decimal{N}\quad} -\makebox[0.75in][r]{\hexadecimal{N}\quad} -\makebox[0.75in][r]{\ordinal{N}\quad} -\makebox[2in][l]{\numberstring{N}} -} - -\renewcommand{\thesection}{\ordinal{section}} - -\begin{document} - -\section{Displaying the value of a counter} -\label{ex} - -\begin{ttfamily} -\noindent -\makebox[0.75in][c]{decimal} -\makebox[0.75in][c]{hexadecimal} -\makebox[0.75in][c]{ordinal} -numberstring -\printrow{0} -\printrow{1} -\printrow{2} -\printrow{3} -\printrow{4} -\printrow{5} -\printrow{6} -\printrow{7} -\printrow{8} -\printrow{9} -\printrow{10} -\printrow{11} -\printrow{12} -\printrow{13} -\printrow{14} -\printrow{15} -\printrow{16} -\printrow{17} -\printrow{18} -\printrow{19} -\printrow{20} -\printrow{21} -\printrow{22} -\printrow{23} -\printrow{24} -\printrow{25} -\printrow{30} -\printrow{40} -\printrow{50} -\printrow{60} -\printrow{70} -\printrow{71} -\printrow{75} -\printrow{80} -\printrow{81} -\printrow{85} -\printrow{90} -\printrow{91} -\printrow{95} -\printrow{100} -\printrow{101} -\printrow{110} -\printrow{125} -\printrow{150} -\printrow{170} -\printrow{180} -\printrow{190} -\printrow{200} -\printrow{250} -\printrow{300} -\printrow{400} -\printrow{500} -\printrow{600} -\printrow{700} -\printrow{800} -\printrow{900} -\printrow{1000} -\printrow{99999} -\end{ttfamily} - -\section{Cross-Referencing} - -Referencing a label: \ref{ex}. - -Passing numbers explicitly: \ordinalnum{10}, -\Numberstringnum{10}, \NUMBERstringnum{10}, \Ordinalstringnum{10}, -\ORDINALstringnum{10}. - -\end{document} diff --git a/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount.pdf b/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount.pdf Binary files differdeleted file mode 100644 index 84132f07fb4..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/latex/fmtcount/doc/fc-lang.tex b/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex index a084c7290a9..68925e045b2 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/doc/fc-lang.tex +++ b/Master/texmf-dist/doc/latex/fmtcount/fc-lang.tex @@ -1,10 +1,50 @@ +%% +%% This is file `fc-lang.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% fmtcount.dtx (with options: `fc-lang.tex,package') +%% +%% fmtcount.dtx +%% Copyright 2009 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files fmtcount.sty, fc-british.def, fc-english.def, fc-french.def, fc-german.def, fc-italian.def, fc-portuges.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def, fmtcount.perl, fc-lang.tex, fc-samp.tex. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} % This is an interactive script. Run it through \LaTeX - % and enter appropriate responses. (This won't work with + % and enter appropriate responses. (This won't work with % LaTeX2HTML \documentclass[a4paper]{article} -\usepackage[french,english,spanish,portuges,ngerman]{babel} +\usepackage[french,english,spanish,portuges,ngerman,italian]{babel} \usepackage{fmtcount} \newcounter{startval} @@ -31,6 +71,7 @@ \typeout{[5] French (Swiss)} \typeout{[6] French (Belgium)} \typeout{[7] German} +\typeout{[8] Italian} \typein[\response]{} @@ -40,9 +81,10 @@ \ifthenelse{\equal{\response}{4}}{\langid=4\fmtcountsetoptions{french}}{ \ifthenelse{\equal{\response}{5}}{\langid=5\fmtcountsetoptions{french=swiss}}{ \ifthenelse{\equal{\response}{6}}{\langid=6\fmtcountsetoptions{french=belgian}} -{\ifthenelse{\equal{\response}{7}}{\langid=7}{ +{\ifthenelse{\equal{\response}{7}}{\langid=7}{% +\ifthenelse{\equal{\response}{8}}{\langid=8}{% \langid=-1 -\typeout{Invalid response '\response', please select a number from 1 to 6}}}}}}}} +\typeout{Invalid response '\response', please select a number from 1 to 6}}}}}}}}} \ifnum\langid=-1 \repeat @@ -61,6 +103,8 @@ Current language: French (Swiss). Current language: French (Belgium). \or \selectlanguage{ngerman} Current language: German. +\or \selectlanguage{italian} +Current language: Italian. \fi \def\startval{-1} @@ -144,22 +188,38 @@ Current language: German. \or\def\stringtype{NUMBERstring} \fi -\ifthenelse{\langid>3 \and \langid < 7}{% -\myctr=-1 -\loop -\typeout{Ordinal type?^^J} -\typeout{[1] eme} -\typeout{[2] e} -\typein[\response]{Default: 1} -\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default -\ifthenelse{\equal{\response}{1}}{% -\fmtcountsetoptions{abbrv=false}\myctr=1}{% -\ifthenelse{\equal{\response}{2}}{% -\fmtcountsetoptions{abbrv}\myctr=2}{% -\myctr=-1}} -\ifnum\myctr=-1 -\repeat -}{} +\ifnum\langid>3\relax + \ifnum\langid<7\relax + \myctr=-1\relax + \loop + \typeout{Ordinal type?^^J} + \typeout{[1] eme} + \typeout{[2] e} + \typein[\response]{Default: 1} + \ifthenelse{\equal{\response}{}}% + {% + \def\response{1}% default + \myctr=1\relax + }% + {% + \ifthenelse{\equal{\response}{1}}% + {% + \fmtcountsetoptions{abbrv=false}\myctr=1\relax + }% + {% + \ifthenelse{\equal{\response}{2}}% + {% + \fmtcountsetoptions{abbrv}\myctr=2\relax + }% + {% + \myctr=-1\relax + }% + }% + }% + \ifnum\myctr=-1 + \repeat + \fi +\fi \myctr=-1 \loop @@ -182,15 +242,19 @@ Current language: German. \loop \ifnum\langid=7 \typein[\response]{Gender? (m, f or n) [Default: m]} - \ifthenelse{\equal{\response}{m}\or\equal{\response}{}}{\myctr=1}{ + \ifthenelse{\equal{\response}{m}}{\myctr=1}{ \ifthenelse{\equal{\response}{f}}{\myctr=2}{ - \ifthenelse{\equal{\response}{n}}{\myctr=3}{\myctr=-1 - \typeout{Invalid response '\response'}}}} + \ifthenelse{\equal{\response}{n}}{\myctr=3}{ + \ifthenelse{\equal{\response}{}}{\myctr=1}{% + \myctr=-1 + \typeout{Invalid response '\response'}}}}} \else \typein[\response]{Gender? (m or f) [Default: m]} - \ifthenelse{\equal{\response}{m}\or\equal{\response}{}}{\myctr=1}{ - \ifthenelse{\equal{\response}{f}}{\myctr=2}{\myctr=-1 - \typeout{Invalid response '\response'}}} + \ifthenelse{\equal{\response}{m}}{\myctr=1}{ + \ifthenelse{\equal{\response}{f}}{\myctr=2}{% + \ifthenelse{\equal{\response}{}}{\myctr=1}{% + \myctr=-1 + \typeout{Invalid response '\response'}}}} \fi \ifnum\myctr=-1 \repeat @@ -232,14 +296,14 @@ Current language: German. \stepcounter{endval} \begin{ttfamily} -\noindent +\noindent \makebox[0.25in][c]{N} \makebox[0.5in][c]{ordinal}\quad \stringtype \par \myctr=\value{startval} \loop -\noindent +\noindent \setcounter{N}{\myctr} \makebox[0.25in][r]{\arabic{N}} \makebox[0.5in][r]{\ordinal{N}[\gender]}\quad @@ -252,3 +316,6 @@ Current language: German. \end{ttfamily} \end{document} +\endinput +%% +%% End of file `fc-lang.tex'. diff --git a/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex b/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex new file mode 100644 index 00000000000..1faa491666d --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/fc-samp.tex @@ -0,0 +1,141 @@ +%% +%% This is file `fc-samp.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% fmtcount.dtx (with options: `fc-samp.tex,package') +%% +%% fmtcount.dtx +%% Copyright 2009 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files fmtcount.dtx and fmtcount.ins and the derived files fmtcount.sty, fc-british.def, fc-english.def, fc-french.def, fc-german.def, fc-italian.def, fc-portuges.def, fc-spanish.def, fc-UKenglish.def, fc-USenglish.def, fmtcount.perl, fc-lang.tex, fc-samp.tex. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\documentclass[a4paper]{article} + +\usepackage{fmtcount} +\newcounter{N} + +\padzeroes[5] + +\newcommand{\printrow}[1]{% +\newline +\setcounter{N}{#1} +\makebox[0.75in][r]{\decimal{N}\quad} +\makebox[0.75in][r]{\hexadecimal{N}\quad} +\makebox[0.75in][r]{\ordinal{N}\quad} +\makebox[2in][l]{\numberstring{N}} +} + +\renewcommand{\thesection}{\ordinal{section}} + +\begin{document} + +\section{Displaying the value of a counter} +\label{ex} + +\begin{ttfamily} +\noindent +\makebox[0.75in][c]{decimal} +\makebox[0.75in][c]{hexadecimal} +\makebox[0.75in][c]{ordinal} +numberstring +\printrow{0} +\printrow{1} +\printrow{2} +\printrow{3} +\printrow{4} +\printrow{5} +\printrow{6} +\printrow{7} +\printrow{8} +\printrow{9} +\printrow{10} +\printrow{11} +\printrow{12} +\printrow{13} +\printrow{14} +\printrow{15} +\printrow{16} +\printrow{17} +\printrow{18} +\printrow{19} +\printrow{20} +\printrow{21} +\printrow{22} +\printrow{23} +\printrow{24} +\printrow{25} +\printrow{30} +\printrow{40} +\printrow{50} +\printrow{60} +\printrow{70} +\printrow{71} +\printrow{75} +\printrow{80} +\printrow{81} +\printrow{85} +\printrow{90} +\printrow{91} +\printrow{95} +\printrow{100} +\printrow{101} +\printrow{110} +\printrow{125} +\printrow{150} +\printrow{170} +\printrow{180} +\printrow{190} +\printrow{200} +\printrow{250} +\printrow{300} +\printrow{400} +\printrow{500} +\printrow{600} +\printrow{700} +\printrow{800} +\printrow{900} +\printrow{1000} +\printrow{99999} +\end{ttfamily} + +\section{Cross-Referencing} + +Referencing a label: \ref{ex}. + +Passing numbers explicitly: \ordinalnum{10}, +\Numberstringnum{10}, \NUMBERstringnum{10}, \Ordinalstringnum{10}, +\ORDINALstringnum{10}. + +\end{document} +\endinput +%% +%% End of file `fc-samp.tex'. diff --git a/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount-manual.html b/Master/texmf-dist/doc/latex/fmtcount/fmtcount-manual.html index 2d7fd1c0d6e..6b9887eafde 100644 --- a/Master/texmf-dist/doc/latex/fmtcount/doc/fmtcount-manual.html +++ b/Master/texmf-dist/doc/latex/fmtcount/fmtcount-manual.html @@ -7,9 +7,9 @@ original version by: Nikos Drakos, CBLU, University of Leeds Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> -<TITLE>fmtcount.sty v1.3: Displaying the Values of LaTeX Counters</TITLE> -<META NAME="description" CONTENT="fmtcount.sty v1.3: Displaying the Values of LaTeX Counters"> -<META NAME="keywords" CONTENT="manual"> +<TITLE>fmtcount.sty v1.31: Displaying the Values of LaTeX Counters</TITLE> +<META NAME="description" CONTENT="fmtcount.sty v1.31: Displaying the Values of LaTeX Counters"> +<META NAME="keywords" CONTENT="fmtcount-manual"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> @@ -24,7 +24,7 @@ original version by: Nikos Drakos, CBLU, University of Leeds <P> - <H1 ALIGN="CENTER">fmtcount.sty v1.3: Displaying the Values of + <H1 ALIGN="CENTER">fmtcount.sty v1.31: Displaying the Values of LaTeX Counters</H1> <P ALIGN="CENTER"><STRONG>Nicola L.C. Talbot <BR> @@ -38,7 +38,7 @@ Norwich. NR4 7TJ. United Kingdom. <BR> <TT><A NAME="tex2html1" HREF="http://theoval.cmp.uea.ac.uk/~nlct/">http://theoval.cmp.uea.ac.uk/~nlct/</A></TT></STRONG></P> -<P ALIGN="CENTER"><STRONG>20 Aug 2007</STRONG></P> +<P ALIGN="CENTER"><STRONG>2nd October 2009</STRONG></P> <BR> <H2><A NAME="SECTION00010000000000000000"> @@ -47,24 +47,24 @@ Contents</A> <!--Table of Contents--> <UL> -<LI><A NAME="tex2html16" - HREF="manual.html#SECTION00020000000000000000">Introduction</A> <LI><A NAME="tex2html17" - HREF="manual.html#SECTION00030000000000000000">Installation</A> + HREF="fmtcount-manual.html#SECTION00020000000000000000">Introduction</A> <LI><A NAME="tex2html18" - HREF="manual.html#SECTION00040000000000000000">Available Commands</A> + HREF="fmtcount-manual.html#SECTION00030000000000000000">Installation</A> <LI><A NAME="tex2html19" - HREF="manual.html#SECTION00050000000000000000">Package Options</A> + HREF="fmtcount-manual.html#SECTION00040000000000000000">Available Commands</A> <LI><A NAME="tex2html20" - HREF="manual.html#SECTION00060000000000000000">Multilingual Support</A> + HREF="fmtcount-manual.html#SECTION00050000000000000000">Package Options</A> <LI><A NAME="tex2html21" - HREF="manual.html#SECTION00070000000000000000">Configuration File fmtcount.cfg</A> + HREF="fmtcount-manual.html#SECTION00060000000000000000">Multilingual Support</A> <LI><A NAME="tex2html22" - HREF="manual.html#SECTION00080000000000000000">LaTeX2HTML style</A> + HREF="fmtcount-manual.html#SECTION00070000000000000000">Configuration File fmtcount.cfg</A> <LI><A NAME="tex2html23" - HREF="manual.html#SECTION00090000000000000000">Acknowledgements</A> + HREF="fmtcount-manual.html#SECTION00080000000000000000">LaTeX2HTML style</A> <LI><A NAME="tex2html24" - HREF="manual.html#SECTION000100000000000000000">Troubleshooting</A> + HREF="fmtcount-manual.html#SECTION00090000000000000000">Acknowledgements</A> +<LI><A NAME="tex2html25" + HREF="fmtcount-manual.html#SECTION000100000000000000000">Troubleshooting</A> </UL> <!--End of Table of Contents--> <H1><A NAME="SECTION00020000000000000000"> @@ -75,7 +75,8 @@ the values of LaTeX counters in a variety of formats. It also provides equivalent commands for actual numbers rather than counter names. Limited multilingual support is available. Currently, there is only support for English, French (including -Belgian and Swiss variations), Spanish, Portuguese and German. +Belgian and Swiss variations), Spanish, Portuguese, German and +Italian. <P> @@ -194,7 +195,7 @@ upper case. Note that <code>\MakeUppercase{\NUMBERstring{</code><I>counter</I><code>}}</code> doesn't work, due to the way that <TT>\MakeUppercase</TT> expands its argument<A NAME="tex2html2" - HREF="#foot515"><SUP>1</SUP></A>. + HREF="#foot518"><SUP>1</SUP></A>. <P> @@ -508,10 +509,10 @@ The following options can be passed to this package: <P> <TABLE CELLPADDING=3> -<TR><TD ALIGN="LEFT">raise</TD> +<TR><TD ALIGN="LEFT"><TT>raise</TT></TD> <TD ALIGN="LEFT">make ordinal st,nd,rd,th appear as superscript</TD> </TR> -<TR><TD ALIGN="LEFT">level</TD> +<TR><TD ALIGN="LEFT"><TT>level</TT></TD> <TD ALIGN="LEFT">make ordinal st,nd,rd,th appear level with rest of text</TD> </TR> @@ -539,13 +540,13 @@ Version 1.02 of the <TT>fmtcount</TT> package now has limited multilingual support. The following languages are implemented: English, Spanish, Portuguese, French, French (Swiss) and French (Belgian). German support was added in version -1.1<A NAME="tex2html3" - HREF="#foot461"><SUP>2</SUP></A>. - +1.1.<A NAME="tex2html3" + HREF="#foot463"><SUP>2</SUP></A>Italian support was added in version 1.31.<A NAME="tex2html4" + HREF="#foot464"><SUP>3</SUP></A> <P> The package checks to see if the command <TT>\l@</TT><I>language</I> is -defined<A NAME="tex2html4" - HREF="#foot516"><SUP>3</SUP></A>, +defined<A NAME="tex2html5" + HREF="#foot519"><SUP>4</SUP></A>, and will load the code for those languages. The commands <TT>\ordinal</TT>, <TT>\ordinalstring</TT> and <TT>\numberstring</TT> (and their variants) will then be formatted in the currently selected language. @@ -653,7 +654,8 @@ Acknowledgements</A> I would like to thank my mother for the French and Portuguese support and my Spanish dictionary for the Spanish support. Thank you to K. H. Fricke for providing me with the German -translations. +translations and to Edoardo Pasca for providing me with the +Italian translations. <P> @@ -663,38 +665,44 @@ Troubleshooting</A> <P> There is a FAQ available at: -<TT><A NAME="tex2html5" +<TT><A NAME="tex2html6" HREF="http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/faq/">http://theoval.cmp.uea.ac.uk/~nlct/latex/packages/faq/</A></TT>. <P> <BR><HR><H4>Footnotes</H4> <DL> -<DT><A NAME="foot515">... +<DT><A NAME="foot518">... argument</A><A - HREF="manual.html#tex2html2"><SUP>1</SUP></A></DT> + HREF="fmtcount-manual.html#tex2html2"><SUP>1</SUP></A></DT> <DD>See all the various postings to <TT>comp.text.tex</TT> about <TT>\MakeUppercase</TT> </DD> -<DT><A NAME="foot461">... -1.1</A><A - HREF="manual.html#tex2html3"><SUP>2</SUP></A></DT> -<DD>Thanks to K. H. Fricke for supplying the information +<DT><A NAME="foot463">... +1.1.</A><A + HREF="fmtcount-manual.html#tex2html3"><SUP>2</SUP></A></DT> +<DD>Thanks to K. H. Fricke for supplying the information. + +</DD> +<DT><A NAME="foot464">... 1.31.</A><A + HREF="fmtcount-manual.html#tex2html4"><SUP>3</SUP></A></DT> +<DD>Thanks to +Edoardo Pasca for supplying the information. </DD> -<DT><A NAME="foot516">... +<DT><A NAME="foot519">... defined</A><A - HREF="manual.html#tex2html4"><SUP>3</SUP></A></DT> + HREF="fmtcount-manual.html#tex2html5"><SUP>4</SUP></A></DT> <DD>this will be true if you have loaded <TT>babel</TT> </DD> </DL> <BR><HR> <ADDRESS> -<A href=http://theoval.cmp.uea.ac.uk/~nlct/>Nicola L. C. Talbot</A>. -<A HREF=http://www.cmp.uea.ac.uk/>School of Computing Sciences</A>. -<A HREF=http://www.uea.ac.uk/>University of East Anglia.</A> -Last Modified: 2007-08-20 +<A href="http://theoval.cmp.uea.ac.uk/~nlct/">Nicola L. C. Talbot</A>. +<A HREF="http://www.cmp.uea.ac.uk/">School of Computing Sciences</A>. +<A HREF="http://www.uea.ac.uk/">University of East Anglia.</A> +Last Modified: 2009-10-02 </ADDRESS> </BODY> </HTML> diff --git a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf Binary files differnew file mode 100644 index 00000000000..8448794662c --- /dev/null +++ b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.pdf diff --git a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl b/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl deleted file mode 100644 index bc7d3b9fb4e..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/fmtcount.perl +++ /dev/null @@ -1,2670 +0,0 @@ -# File : fmtcount.perl -# Author : Nicola Talbot -# Date : 26 May 2007 -# Version : 1.05 -# Description : LaTeX2HTML implementation of fmtcount package - -package main; - -sub do_fmtcount_raise{ - local($tmp)=""; - - $tmp .= 'sub do_cmd_fmtord{'; - $tmp .= 'local($_) = @_;'; - $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);'; - $tmp .= 'join("", "<SUP>",$suffix,"</SUP>",$_);'; - $tmp .='}'; - - eval($tmp); -} - -sub do_fmtcount_level{ - local($tmp)=""; - - $tmp .= 'sub do_cmd_fmtord{'; - $tmp .= 'local($_) = @_;'; - $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);'; - $tmp .= 'join("", $suffix,$_);'; - $tmp .='}'; - - eval($tmp); -} - -if (not defined &do_cmd_fmtord) -{ - &do_fmtcount_raise(@_); -} - -$frenchdialect = 'france'; -$ordinalabbrv = 0; - -sub get_ordinal_suffix_english{ - local($num,$gender) = @_; - local($suffix); - - if ((($num % 10) == 1) && ($num%100 != 11)) - { - $suffix = 'st'; - } - elsif ((($num % 10) == 2) && ($num%100 != 12)) - { - $suffix = 'nd'; - } - elsif ((($num % 10) == 3) && ($num%100 != 13)) - { - $suffix = 'rd'; - } - else - { - $suffix = 'th'; - } - - $suffix; -} - -sub get_ordinal_suffix_french{ - local($num,$gender) = @_; - local($_); - - if ($ordinalabbrv > 0) - { - $_ = 'e'; - } - else - { - if ($num == 1) - { - $_ = ($gender eq 'f' ? 'ere' : 'er'); - } - else - { - $_ = 'eme'; - } - } -} - -sub get_ordinal_suffix_spanish{ - local($num,$gender) = @_; - - ($gender eq 'f' ? 'a' : 'o'); -} - -sub get_ordinal_suffix_portuges{ - local($num,$gender) = @_; - - ($gender eq 'f' ? 'a' : 'o'); -} - -sub get_ordinal_suffix_german{ - local($num,$gender) = @_; - - ''; -} - -sub get_ordinal_suffix_ngerman{ - local($num,$gender) = @_; - - ''; -} - -sub get_ordinal_suffix{ - local($num,$gender) = @_; - local($suffix,$suffixsub); - - $suffixsub = "get_ordinal_suffix_$default_language"; - - if (defined ($suffixsub)) - { - $suffix = &$suffixsub($num,$gender); - } - else - { - $suffix = &get_ordinal_suffix_english($num,$gender); - } - - $suffix; -} - -sub getordinal{ - local($num,$gender) = @_; - local($suffix) = &get_ordinal_suffix($num,$gender); - local($text)=''; - - if ($suffix eq '') - { - $text = $num; - } - else - { - local($br_id) = ++$global{'max_id'}; - $text = $num . "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}"; - } - - $text; -} - -sub do_cmd_ordinalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - my($gender)='m'; - local($suffix)=''; - - if (s/\[([mfn])\]//) - { - $gender = $1; - } - - $suffix = &get_ordinal_suffix($num,$gender); - - local($br_id) = ++$global{'max_id'}; - join('', $num, "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}", $_); -} - -sub do_cmd_FCordinal{ - &do_cmd_ordinal; -} - -sub do_cmd_ordinal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $str eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{ORDINAL{', $ctr, '}}', $_[0]); - } - else - { - join('', &getordinal($val, $gender), $_[0]); - } -} - -sub do_cmd_storeordinal{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{ORDINAL{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = &getordinal($val, $gender); - } - - $_; -} - -sub do_cmd_storeordinalnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = &getordinal($val, $gender); - - $_; -} - -@unitthstring = ('zeroth', - 'first', - 'second', - 'third', - 'fourth', - 'fifth', - 'sixth', - 'seventh', - 'eighth', - 'ninth'); - -@tenthstring = ('', - 'tenth', - 'twentieth', - 'thirtieth', - 'fortieth', - 'fiftieth', - 'sixtieth', - 'seventieth', - 'eightieth', - 'ninetieth'); - -@teenthstring = ('tenth', - 'eleventh', - 'twelfth', - 'thirteenth', - 'fourteenth', - 'fifteenth', - 'sixteenth', - 'seventeenth', - 'eighteenth', - 'nineteenth'); - -@unitstring = ('zero', - 'one', - 'two', - 'three', - 'four', - 'five', - 'six', - 'seven', - 'eight', - 'nine'); - -@teenstring = ('ten', - 'eleven', - 'twelve', - 'thirteen', - 'fourteen', - 'fifteen', - 'sixteen', - 'seventeen', - 'eighteen', - 'nineteen'); -@tenstring = ('', - 'ten', - 'twenty', - 'thirty', - 'forty', - 'fifty', - 'sixty', - 'seventy', - 'eighty', - 'ninety'); - -$hundredname = "hundred"; -$hundredthname = "hundredth"; -$thousandname = "thousand"; -$thousandthname = "thousandth"; - -sub get_numberstringenglish{ - local($num) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = &get_numberstringenglish($num/1000); - $name .= $thousands . " $thousandname"; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = &get_numberstringenglish($num/100); - $name .= $hundreds . " $hundredname"; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } - - if ($num >= 20) - { - $name .= $tenstring[$num/10]; - - if ($num%10 > 0) { $name .= '-'; } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstring[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstring[$num%10]; - } - } - - $name; -} - -@unitthstringfrench = ('zeroi\`eme', - 'uni\`eme', - 'deuxi\`eme', - 'troisi\`eme', - 'quatri\`eme', - 'cinqui\`eme', - 'sixi\`eme', - 'septi\`eme', - 'huiti\`eme', - 'neuvi\`eme'); - -@tenthstringfrench = ('', - 'dixi\`eme', - 'vingti\`eme', - 'trentri\`eme', - 'quaranti\`eme', - 'cinquanti\`eme', - 'soixanti\`eme', - 'septenti\`eme', - 'huitanti\`eme', - 'nonenti\`eme'); - -@teenthstringfrench = ('dixi\`eme', - 'onzi\`eme', - 'douzi\`eme', - 'treizi\`eme', - 'quatorzi\`eme', - 'quinzi\`eme', - 'seizi\`eme', - 'dix-septi\`eme', - 'dix-huiti\`eme', - 'dix-neuvi\`eme'); - -@unitstringfrench = ('zero', - 'un', - 'deux', - 'trois', - 'quatre', - 'cinq', - 'six', - 'sept', - 'huit', - 'neuf'); - -@teenstringfrench = ('dix', - 'onze', - 'douze', - 'treize', - 'quatorze', - 'quinze', - 'seize', - 'dix-sept', - 'dix-huit', - 'dix-neuf'); - -@tenstringfrench = ('', - 'dix', - 'vingt', - 'trente', - 'quarante', - 'cinquante', - 'soixante', - 'septente', - 'huitante', - 'nonente'); - -$hundrednamefrench = "cent"; -$hundredthnamefrench = "centi\\`eme"; -$thousandnamefrench = "mille"; -$thousandthnamefrench = "mili\\`eme"; - -@unitthstringspanish = ('cero', - 'primero', - 'segundo', - 'tercero', - 'cuarto', - 'quinto', - 'sexto', - 's\\\'eptimo', - 'octavo', - 'noveno'); - -@tenthstringspanish = ('', - 'd\\\'ecimo', - 'vig\\\'esimo', - 'trig\\\'esimo', - 'cuadrag\\\'esimo', - 'quincuag\\\'esimo', - 'sexag\\\'esimo', - 'septuag\\\'esimo', - 'octog\\\'esimo', - 'nonag\\\'esimo'); - -@teenthstringspanish = ('d\\\'ecimo', - 'und\\\'ecimo', - 'duod\\\'ecimo', - 'decimotercero', - 'decimocuarto', - 'decimoquinto', - 'decimosexto', - 'decimos\\\'eptimo', - 'decimoctavo', - 'decimonoveno'); - -@hundredthstringspanish = ('', - 'cent\\\'esimo', - 'ducent\\\'esimo', - 'tricent\\\'esimo', - 'cuadringent\\\'esimo', - 'quingent\\\'esimo', - 'sexcent\\\'esimo', - 'septing\\\'esimo', - 'octingent\\\'esimo', - 'noningent\\\'esimo'); - -@unitstringspanish = ('cero', - 'uno', - 'dos', - 'tres', - 'cuatro', - 'cinco', - 'seis', - 'siete', - 'ocho', - 'nueve'); - -@teenstringspanish = ('diez', - 'once', - 'doce', - 'trece', - 'catorce', - 'quince', - 'diecis\\\'eis', - 'diecisiete', - 'dieciocho', - 'diecinueve'); - -@twentystringspanish = ('viente', - 'vientiuno', - 'vientid\\\'os', - 'vientitr\\\'es', - 'vienticuatro', - 'vienticinco', - 'vientis\\\'eis', - 'vientisiete', - 'vientiocho', - 'vientinueve'); - -@tenstringspanish = ('', - 'diez', - 'viente', - 'treinta', - 'cuarenta', - 'cincuenta', - 'sesenta', - 'setenta', - 'ochenta', - 'noventa'); - -@hundredstringspanish = ('', - 'ciento', - 'doscientos', - 'trescientos', - 'cuatrocientos', - 'quinientos', - 'seiscientos', - 'setecientos', - 'ochocientos', - 'novecientos'); - -$hundrednamespanish = "cien"; -$hundredthnamespanish = "centi\\`eme"; -$thousandnamespanish = "mil"; -$thousandthnamespanish = "mil\\'esimo"; - -@unitthstringportuges = ('zero', - 'primeiro', - 'segundo', - 'terceiro', - 'quatro', - 'quinto', - 'sexto', - 's\\\'etimo', - 'oitavo', - 'nono'); - -@tenthstringportuges = ('', - 'd\\\'ecimo', - 'vig\\\'esimo', - 'trig\\\'esimo', - 'quadrag\\\'esimo', - 'q\"uinquag\\\'esimo', - 'sexag\\\'esimo', - 'setuag\\\'esimo', - 'octog\\\'esimo', - 'nonag\\\'esimo'); - -@hundredthstringportuges = ('', - 'cent\\\'esimo', - 'ducent\\\'esimo', - 'trecent\\\'esimo', - 'quadringent\\\'esimo', - 'q\"uingent\\\'esimo', - 'seiscent\\\'esimo', - 'setingent\\\'esimo', - 'octingent\\\'esimo', - 'nongent\\\'esimo'); - -@unitstringportuges = ('zero', - 'um', - 'dois', - 'tr\^es', - 'quatro', - 'cinco', - 'seis', - 'sete', - 'oito', - 'nove'); - -@teenstringportuges = ('dez', - 'onze', - 'doze', - 'treze', - 'quatorze', - 'quinze', - 'dezesseis', - 'dezessete', - 'dezoito', - 'dezenove'); - -@tenstringportuges = ('', - 'dez', - 'vinte', - 'trinta', - 'quaranta', - 'cinq\"uenta', - 'sessenta', - 'setenta', - 'oitenta', - 'noventa'); - -@hundredstringportuges = ('', - 'cento', - 'duzentos', - 'trezentos', - 'quatrocentos', - 'quinhentos', - 'seiscentos', - 'setecentos', - 'oitocentos', - 'novecentos'); - -$hundrednameportuges = "cem"; -$thousandnameportuges = "mil"; -$thousandthnameportuges = "mil\\'esimo"; - -sub get_numberstringfrench{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringfrench[1] = 'une'; - } - else - { - $unitstringfrench[1] = 'un'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringfrench($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnamefrench; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num >= 200) - { - $hundreds = &get_numberstringfrench($num/100,$gender).' '; - } - - $name .= $hundreds . $hundrednamefrench; - $num = $num%100; - - if (($_[0]%100 == 0) && ($_[0]/100 > 1)) - { - $name .= 's'; - } - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - if ($num >= 20) - { - if ($frenchdialect eq 'france' and $num >= 70) - { - if ($num < 80) - { - $name .= $tenstringfrench[6]; - - if ($num%10 == 1) - { - $name .= ' et '; - } - else - { - $name .= '-'; - } - - $num = 10+($num%10); - } - else - { - $name .= 'quatre-vingt' . ($num==80?'s':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - } - elsif ($frenchdialect eq 'belgian' - && ($num >= 80) && ($num < 90)) - { - $name .= 'quatre-vingt' . ($num==80?'s':'-'); - } - else - { - $name .= $tenstringfrench[$num/10]; - - if ($num%10 == 1) { $name .= ' et ';} - elsif ($num%10 > 0) { $name .= '-'; } - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstringfrench[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringfrench[$num%10]; - } - } - - $name; -} - -sub get_numberstringspanish{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringspanish[1] = 'una'; - } - else - { - $unitstringspanish[1] = 'uno'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringspanish($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnamespanish; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num > 100) - { - $hundreds = $hundredstringspanish[$num/100]; - } - else - { - $hundreds = 'cien'; - } - - $name .= $hundreds; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " y "; } - - if ($num >= 30) - { - $name .= $tenstringspanish[$num/10]; - - if ($num%10 > 0) { $name .= ' y '; } - } - - if (($num >=20) && ($num < 30)) - { - $name .= $twentystringspanish[$num%10]; - } - elsif (($num >= 10) && ($num < 20)) - { - $name .= $teenstringspanish[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringspanish[$num%10]; - } - } - - $name; -} - -sub get_numberstringportuges{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringportuges[0] = 'zera'; - $unitstringportuges[1] = 'uma'; - $unitstringportuges[2] = 'duas'; - } - else - { - $unitstringportuges[0] = 'zero'; - $unitstringportuges[1] = 'um'; - $unitstringportuges[2] = 'dois'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringportuges($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnameportuges; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num > 100) - { - $hundreds = $hundredstringportuges[$num/100]; - - if ($gender eq 'f' and $num >= 200) - { - $hundreds =~s/o(s?)$/a\1/; - } - } - else - { - $hundreds = $hundrednameportuges; - } - - $name .= $hundreds; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " e "; } - - if ($num >= 20) - { - $name .= $tenstringportuges[$num/10]; - - if ($num%10 == 1) { $name .= ' e ';} - elsif ($num%10 > 0) { $name .= ' '; } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstringportuges[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringportuges[$num%10]; - } - } - - $name; -} - -@unitthstringMgerman = ('nullter', - 'erster', - 'zweiter', - 'dritter', - 'vierter', - 'f\\"unter', - 'sechster', - 'siebter', - 'achter', - 'neunter'); - -@tenthstringMgerman = ('', - 'zehnter', - 'zwanzigster', - 'drei\\ss igster', - 'vierzigster', - 'f\\"unfzigster', - 'sechzigster', - 'siebzigster', - 'achtzigster', - 'neunzigster'); - -@teenthstringMgerman = ('zehnter', - 'elfter', - 'zw\\"olfter', - 'dreizehnter', - 'vierzehnter', - 'f\\"unfzehnter', - 'sechzehnter', - 'siebzehnter', - 'achtzehnter', - 'neunzehnter'); - -@unitthstringFgerman = ('nullte', - 'erste', - 'zweite', - 'dritte', - 'vierte', - 'f\\"unfte', - 'sechste', - 'siebte', - 'achte', - 'neunte'); - -@tenthstringFgerman = ('', - 'zehnte', - 'zwanzigste', - 'drei\\ss igste', - 'vierzigste', - 'f\\"unfzigste', - 'sechzigste', - 'siebzigste', - 'achtzigste', - 'neunzigste'); - -@teenthstringFgerman = ('zehnte', - 'elfte', - 'zw\\"olfte', - 'dreizehnte', - 'vierzehnte', - 'f\\"unfzehnte', - 'sechzehnte', - 'siebzehnte', - 'achtzehnte', - 'neunzehnte'); - -@unitthstringNgerman = ('nulltes', - 'erstes', - 'zweites', - 'drittes', - 'viertes', - 'f\\"unte', - 'sechstes', - 'siebtes', - 'achtes', - 'neuntes'); - -@tenthstringNgerman = ('', - 'zehntes', - 'zwanzigstes', - 'drei\\ss igstes', - 'vierzigstes', - 'f\\"unfzigstes', - 'sechzigstes', - 'siebzigstes', - 'achtzigstes', - 'neunzigstes'); - -@teenthstringNgerman = ('zehntes', - 'elftes', - 'zw\\"olftes', - 'dreizehntes', - 'vierzehntes', - 'f\\"unfzehntes', - 'sechzehntes', - 'siebzehntes', - 'achtzehntes', - 'neunzehntes'); - -@unitstringgerman = ('null', - 'ein', # eins dealt with separately (this is for prefixes) - 'zwei', - 'drei', - 'vier', - 'f\\"unf', - 'sechs', - 'sieben', - 'acht', - 'neun'); - -@teenstringgerman = ('zehn', - 'elf', - 'zw\\"olf', - 'dreizehn', - 'vierzehn', - 'f\\"unfzehn', - 'sechzehn', - 'siebzehn', - 'achtzehn', - 'neunzehn'); - -@tenstringgerman = ('', - 'zehn', - 'zwanzig', - 'drei\\ss ig', - 'vierzig', - 'f\\"unfzig', - 'sechzig', - 'siebzig', - 'achtzig', - 'neunzig'); - -sub do_cmd_einhundert{ - local($_) = @_; - - "einhundert$_"; -} - -sub do_cmd_eintausend{ - local($_) = @_; - - "eintausend$_"; -} - -sub get_numberunderhundredgerman{ - local($num)=@_; - local($name)=''; - - if ($num == 1) - { - $name = 'eins'; - } - elsif ($num < 10) - { - $name = $unitstringgerman[$num]; - } - elsif ($num%10 == 0) - { - $name = $tenstringgerman[$num/10]; - } - else - { - $name = join('und', $unitstringgerman[$num%10], - $tenstringgerman[$num/10]); - } - - $name; -} - -sub get_numberstringgerman{ - local($orgnum,$gender) = @_; - local($name)=""; - - local($num) = $orgnum; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000 and $num < 2000) - { - $name = &translate_commands("\\eintausend "); - } - elsif ($num >= 2000) - { - $name = &get_numberunderhundredgerman($num/1000) - . "tausend"; - } - - $num = $orgnum%1000; - - if ($num >= 100 and $num < 200) - { - if ($orgnum > 1000) - { - $name .= "einhundert"; - } - else - { - $name = &translate_commands("\\einhundert "); - } - } - elsif ($num >= 200) - { - $name .= $unitstringgerman[$num/100]."hundert"; - } - - $num = $num%100; - - if ($orgnum == 0) - { - $name = 'null'; - } - elsif ($num > 0) - { - $name .= &get_numberunderhundredgerman($num); - } - } - - $name; -} - -sub get_numberstring{ - local($val,$gender) = @_; - - if ($default_language eq 'french') - { - &get_numberstringfrench($val,$gender); - } - elsif ($default_language eq 'spanish') - { - &get_numberstringspanish($val,$gender); - } - elsif ($default_language eq 'portuges') - { - &get_numberstringportuges($val,$gender); - } - elsif ($default_language eq 'german' - or $default_language eq 'ngerman') - { - &get_numberstringgerman($val,$gender); - } - else - { - &get_numberstringenglish($val); - } -} - -sub do_cmd_numberstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces unless - s/$next_pair_pr_rx/$num=$2;''/eo; - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_numberstring($num,$gender), $_); -} - -sub do_cmd_numberstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{NUMBERSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_numberstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storenumberstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{NUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storenumberstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); - - $_; -} - -sub get_Numberstring{ - local($val,$gender) = @_; - local($string) = &get_numberstring($val,$gender); - - if ($default_language=~m/german/) - { - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/; - } - else - { - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/g; - - if ($default_language eq 'french') - { - $string =~ s/ Et / et /g; - } - elsif ($default_language eq 'spanish') - { - $string =~ s/ Y / y /g; - } - elsif ($default_language eq 'portuges') - { - $string =~ s/ E / e /g; - } - else - { - $string =~ s/ And / and /g; - } - } - - $string; -} - -sub do_cmd_Numberstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_Numberstring($num,$gender), $_); -} - -sub do_cmd_Numberstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{NNUMBERSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_Numberstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storeNumberstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{NNUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeNumberstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); - - $_; -} - -sub do_cmd_NUMBERstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', uc(&get_numberstring($num,$gender)), $_); -} - -sub do_cmd_NUMBERstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{CAPNUMBERSTRING{', $ctr, '}}', $_); - } - else - { - join('', uc(&get_numberstring($val, $gender)), $_); - } -} - -sub do_cmd_storeNUMBERstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{CAPNUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeNUMBERstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); - - $_; -} - -sub get_ordinalstringenglish{ - local($num) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = &get_numberstring($num/1000); - $name .= $thousands; - - if ($num%1000 > 0) - { - $name .= " $thousandname"; - } - else - { - $name .= " $thousandthname"; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = &get_numberstring($num/100); - $name .= $hundreds; - - if ($num%100 > 0) - { - $name .= " $hundredname"; - } - else - { - $name .= " $hundredthname"; - } - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } - - if ($num >= 20) - { - if ($num%10 > 0) - { - $name .= $tenstring[$num/10] . '-'; - } - else - { - $name .= $tenthstring[$num/10]; - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenthstring[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitthstring[$num%10]; - } - } - - $name; -} - -sub get_ordinalstringfrench{ - local($num,$gender) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringfrench($num/1000,$gender).' '; - } - - $num = $num%1000; - - if ($num > 0) - { - $name .= $thousands . $thousandnamefrench; - } - else - { - $name .= $thousands . $thousandthnamefrench; - } - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num >= 200) - { - $hundreds = &get_numberstringfrench($num/100,$gender).' '; - } - - $num = $num%100; - - if ($num > 0) - { - $name .= $hundreds . $hundrednamefrench; - } - else - { - $name .= $hundreds . $hundredthnamefrench; - } - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - if ($num >= 20) - { - if ($frenchdialect eq 'france' and $num >= 70) - { - if ($num < 80) - { - if ($num%10 > 0) - { - $name .= $tenstringfrench[6]; - } - else - { - $name .= $tenthstringfrench[6]; - } - - if ($num%10 == 1) - { - $name .= ' et '; - } - else - { - $name .= '-'; - } - - $num = 10+($num%10); - } - else - { - $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - } - elsif ($frenchdialect eq 'belgian' and $num >= 80) - { - $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - else - { - if ($num%10 > 0) - { - $name .= $tenstringfrench[$num/10]; - } - else - { - $name .= $tenthstringfrench[$num/10]; - } - - if ($num%10 == 1) { $name .= ' et ';} - elsif ($num%10 > 0) { $name .= '-'; } - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenthstringfrench[$num%10]; - } - elsif ($_[0] == 1) - { - $name = 'premi\`ere'; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitthstringfrench[$num%10]; - } - } - - $name; -} - -sub get_ordinalstringspanish{ - local($num,$gender) = @_; - local($name)=""; - local($str); - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - if ($num >= 2000) - { - local($thousands) = &get_ordinalstringspanish($num/1000); - - if ($gender eq 'f') - { - $thousands =~s/o(s?)$/a\1/; - } - - $name .= $thousands. " "; - } - else - { - $name = ""; - } - - $name .= "$thousandthnamespanish"; - - if ($gender eq 'f') - { - $name =~s/o$/a/; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = $hundredthstringspanish[$num/100]; - - if ($gender eq 'f') - { - $hundreds =~s/o$/a/; - } - - $name .= $hundreds; - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - local($lastbit)=""; - - if ($num >= 20) - { - $lastbit = $tenthstringspanish[$num/10]; - - if ($num%10 > 0) - { - $lastbit .= ' '; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - - $lastbit = ""; - } - - if (($num >= 10) && ($num < 20)) - { - $lastbit = $teenthstringspanish[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $lastbit = $unitthstringspanish[$num%10]; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - } - - $name; -} - -sub get_ordinalstringportuges{ - local($num,$gender) = @_; - local($name)=""; - local($str); - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - if ($num >= 2000) - { - local($thousands) = &get_ordinalstringportuges($num/1000); - - if ($gender eq 'f') - { - $thousands =~s/o(s?)$/a\1/; - } - - $name .= $thousands. " "; - } - else - { - $name = ""; - } - - $name .= "$thousandthnameportuges"; - - if ($gender eq 'f') - { - $name =~s/o$/a/; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = $hundredthstringportuges[$num/100]; - - if ($gender eq 'f') - { - $hundreds =~s/o$/a/; - } - - $name .= $hundreds; - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= "-"; } - - local($lastbit)=""; - - if ($num >= 10) - { - $lastbit = $tenthstringportuges[$num/10]; - - if ($num%10 > 0) - { - $lastbit .= '-'; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - - $lastbit = ""; - } - - if (($num%10 > 0) || ($_[0] == 0)) - { - $lastbit = $unitthstringportuges[$num%10]; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - } - - $name; -} - -sub get_numberunderhundredthgerman{ - local($num,$gender)=@_; - local($name)=''; - - if ($num < 10) - { - if ($gender eq 'F') - { - $name = $unitthstringFgerman[$num]; - } - elsif ($gender eq 'N') - { - $name = $unitthstringNgerman[$num]; - } - else - { - $name = $unitthstringMgerman[$num]; - } - } - elsif ($num%10 == 0) - { - if ($gender eq 'F') - { - $name = $tenthstringFgerman[$num/10]; - } - elsif ($gender eq 'N') - { - $name = $tenthstringNgerman[$num/10]; - } - else - { - $name = $tenthstringMgerman[$num/10]; - } - } - else - { - local($tenth); - if ($gender eq 'F') - { - $tenth = $tenthstringFgerman[$num/10]; - } - elsif ($gender eq 'N') - { - $tenth = $tenthstringNgerman[$num/10]; - } - else - { - $tenth = $tenthstringMgerman[$num/10]; - } - - $name = join('und', $unitstringgerman[$num%10], $tenth); - } - - $name; -} - -sub get_ordinalstringgerman{ - local($orgnum,$gender) = @_; - local($name)=""; - local($suffix)=''; - - $gender = uc($gender); - - if ($gender eq 'F') - { - $suffix = 'ste'; - } - elsif ($gender eq 'N') - { - $suffix = 'stes'; - } - else - { - $suffix = 'ster'; - $gender = 'M'; - } - - local($num) = $orgnum; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000 and $num < 2000) - { - $name = &translate_commands("\\eintausend "); - } - elsif ($num >= 2000) - { - $name = &get_numberunderhundredgerman($num/1000) - . "tausend"; - } - - $num = $orgnum%1000; - - # is that it or is there more? - if ($orgnum >= 1000 and $num == 0) - { - $name .= $suffix; - return $name; - } - - if ($num >= 100 and $num < 200) - { - if ($orgnum > 1000) - { - $name .= "einhundert"; - } - else - { - $name = &translate_commands("\\einhundert "); - } - } - elsif ($num >= 200) - { - $name .= $unitstringgerman[$num/100]."hundert"; - } - - $num = $num%100; - - # is that it or is there more? - if ($orgnum >= 100 and $num == 0) - { - $name .= $suffix; - return $name; - } - - if ($orgnum == 0) - { - if ($gender eq 'F') - { - $name = $unitthstringFgerman[0]; - } - elsif ($gender eq 'N') - { - $name = $unitthstringNgerman[0]; - } - else - { - $name = $unitthstringMgerman[0]; - } - } - elsif ($num > 0) - { - $name .= &get_numberunderhundredthgerman($num,$gender); - } - } - - $name; -} - -sub get_ordinalstring{ - local($val,$gender) = @_; - - if ($default_language eq 'french') - { - &get_ordinalstringfrench($val,$gender); - } - elsif ($default_language eq 'spanish') - { - &get_ordinalstringspanish($val,$gender); - } - elsif ($default_language eq 'portuges') - { - &get_ordinalstringportuges($val,$gender); - } - elsif ($default_language eq 'german' - or $default_language eq 'ngerman') - { - &get_ordinalstringgerman($val,$gender); - } - else - { - &get_ordinalstringenglish($val); - } -} - -sub do_cmd_ordinalstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_ordinalstring($num,$gender), $_); -} - -sub do_cmd_ordinalstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{ORDINALSTRING{', $ctr, '}}', $_); - } - else - { - join('', &get_ordinalstring($val, $gender), $_); - } -} - - %fmtcntvar = (); - -sub do_cmd_FMCuse{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $fmtcntvar{$key}.$_; -} - -sub do_cmd_storeordinalstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{ORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeordinalstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); - - $_; -} - -sub get_Ordinalstring{ - local($val,$gender) = @_; - local($string) = &get_ordinalstring($val,$gender); - - if ($default_language=~m/german/) - { - $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/; - } - else - { - $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/g; - - if ($default_language eq 'french') - { - $string =~ s/ Et / et /g; - } - else - { - $string =~ s/ And / and /g; - } - } - - $string; -} - -sub do_cmd_Ordinalstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_Ordinalstring($num,$gender), $_); -} - -sub do_cmd_Ordinalstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{OORDINALSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_Ordinalstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storeOrdinalstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{OORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeOrdinalstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); - - $_; -} - -sub do_cmd_ORDINALstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', uc(&get_ordinalstring($num,$gender)), $_); -} - -sub do_cmd_ORDINALstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{CAPORDINALSTRING{', $ctr, '}}', $_); - } - else - { - join('', uc(&get_ordinalstring($val, $gender)), $_); - } -} - -sub do_cmd_storeORDINALstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{CAPORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeORDINALstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); - - $_; -} - -sub do_cmd_fmtcountsetoptions{ - local($_) = @_; - local($options) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($options=$2)); - - if ($options =~ m/french=?(\w*)(,|$)/) - { - if ($1 eq 'france' or $1 eq 'swiss' or $1 eq 'belgian') - { - $frenchdialect = $1; - - print "Using French dialect: $1" if ($VERBOSITY > 0) ; - } - elsif ($1 eq '') - { - $frenchdialect = 'france'; - - print "Using French dialect: france" if ($VERBOSITY > 0); - } - else - { - &write_warnings("unknown french dialect '$1'"); - } - } - - if ($options =~ m/abbrv=?(\w*)(,|$)/) - { - if ($1 eq 'true' or $1 eq '') - { - $ordinalabbrv = 1; - - print "Setting abbrv=true" if ($VERBOSITY > 0); - } - elsif ($1 eq 'false') - { - $ordinalabbrv = 0; - - print "Setting abbrv=false" if ($VERBOSITY > 0); - } - else - { - &write_warnings("fmtcountsetoptions key abbrv: unknown value '$1'."); - } - } - - if ($options =~ m/fmtord=(\w*)(,|$)/) - { - if ($1 eq 'raise') - { - &do_fmtcount_raise(); - - print "Using raised ordinals" if ($VERBOSITY > 0); - } - elsif ($1 eq 'level') - { - &do_fmtcount_level(); - - print "Using level ordinals" if ($VERBOSITY > 0); - } - elsif ($1 eq 'user') - { - # do nothing - - print "Using user defined fmtord" if ($VERBOSITY > 0); - } - else - { - &write_warnings("unknown fmtcount option fmtord=$1"); - } - } - - $_[0]; -} - -$padzeroes = 0; - -sub do_cmd_padzeroes{ - local($_) = @_; - local($val,$pat) = &get_next_optional_argument; - - if ($val eq '') - { - $padzeroes = 17; - } - else - { - $padzeroes = $val; - } - - $_; -} - -sub get_binary{ - local($num) = @_; - local($val) = ""; - - for (my $i=17; $i>=0; $i--) - { - if (($i < $padzeroes) || ($num & (1 << $i)) || !($val eq "")) - { - $val .= ($num & (1 << $i) ? 1 : 0); - } - } - - $val; -} - -sub do_cmd_binary{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_binary($val), $_); -} - -sub do_cmd_binarynum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_binary($num), $_); -} - -sub get_decimal{ - local($num) = @_; - - sprintf "%0${padzeroes}d", $num; -} - -sub do_cmd_decimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_decimal($val), $_); -} - -sub do_cmd_decimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_decimal($num), $_); -} - -sub get_hexadecimal{ - local($num) = @_; - - sprintf "%0${padzeroes}lx", $num; -} - -sub do_cmd_hexadecimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_hexadecimal($val), $_); -} - -sub do_cmd_hexadecimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_hexadecimal($num), $_); -} - -sub get_Hexadecimal{ - local($num) = @_; - - sprintf "%0${padzeroes}lX", $num; -} - -sub do_cmd_Hexadecimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_Hexadecimal($val), $_); -} - -sub do_cmd_Hexadecimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_Hexadecimal($num), $_); -} - -sub get_octal{ - local($num) = @_; - - sprintf "%0${padzeroes}lo", $num; -} - -sub do_cmd_octal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_octal($val), $_); -} - -sub do_cmd_octalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_octal($num), $_); -} - -sub get_aaalph{ - local($num) = @_; - local($rep) = int($num/26) + 1; - local($c) = chr(ord('a')-1+$num%26); - - local($_) = $c x $rep; -} - -sub do_cmd_aaalph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_aaalph($val), $_); -} - -sub get_AAAlph{ - local($num) = @_; - local($rep) = int($num/26) + 1; - local($c) = chr(ord('A')-1+$num%26); - - local($_) = $c x $rep; -} - -sub do_cmd_AAAlph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_AAAlph($val), $_); -} - -sub do_cmd_aaalphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', (sprintf "%${padzeroes}s", &get_aaalph($num)), $_); -} - -sub do_cmd_AAAlphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', uc(sprintf "%${padzeroes}s", &get_aaalph($num)), $_); -} - -sub get_abalph{ - local($num) = @_; - local($str); - - if ($num == 0) - { - $str = ''; - } - elsif ($num > 0 && $num <= 26) - { - $str = chr(ord('a')-1+$num); - } - else - { - $str = &get_abalph(int($num/26)) . chr(ord('a')-1+($num%26)); - } - - $str; -} - -sub do_cmd_abalph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', (sprintf "%${padzeroes}s", &get_abalph($val)), $_); -} - -sub do_cmd_abalphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', (sprintf "%${padzeroes}s", &get_abalph($num)), $_); -} - -sub do_cmd_ABAlph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', uc(sprintf "%${padzeroes}s", &get_abalph($val)), $_); -} - -sub do_cmd_ABAlphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', uc(sprintf "%${padzeroes}s", &get_abalph($num)), $_); -} - -sub get_twodigit{ - local($num) = @_; - - sprintf "%02d", $num; -} - -sub do_cmd_twodigit{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - # this is a cludge - if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") - { - join('', 'TWODIGIT{', $num, '}', $_); - } - else - { - join('', &get_twodigit($num), $_); - } -} - -# this was put here to help with the definition of \datelatin - -sub do_cmd_romannumeral{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - # this is a cludge - if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") - { - join('', 'ROMANNUMERAL{', $num, '}', $_); - } - else - { - join('', &froman($num), $_); - } -} - -# load configuration file if it exists -# Note: The configuration file should be loaded before -# the package options are executed. - -# why doesn't this work? If I call this subroutine it -# causes an infinite loop. - -sub load_fmtcount_cfg{ - local($file,$found); - - $file = &fulltexpath('fmtcount.cfg'); - - $found = (-f $file); - - if (!$found) - { - foreach $texpath (split /$envkey/, $TEXINPUTS) - { - $file = "$texpath${dd}fmtcount.cfg"; - - last if ($found = (-f $file)); - } - } - - if ($found) - { - print "\nusing configuration file $file\n"; - - &slurp_input($file); - &pre_process; - &substitute_meta_cmds if (%new_command || %new_environment); - &wrap_shorthand_environments; - $_ = &translate_commands(&translate_environments($_)); - - print "\n processed size: ".length($_)."\n" if ($VERBOSITY>1) - } - else - { - print "\nNo configuation file fmtcount.cfg found\n" if ($VERBOSITY>1) - } -} - -1; diff --git a/Master/texmf-dist/doc/latex/fmtcount/latex2html/fmtcount.perl b/Master/texmf-dist/doc/latex/fmtcount/latex2html/fmtcount.perl deleted file mode 100644 index bc7d3b9fb4e..00000000000 --- a/Master/texmf-dist/doc/latex/fmtcount/latex2html/fmtcount.perl +++ /dev/null @@ -1,2670 +0,0 @@ -# File : fmtcount.perl -# Author : Nicola Talbot -# Date : 26 May 2007 -# Version : 1.05 -# Description : LaTeX2HTML implementation of fmtcount package - -package main; - -sub do_fmtcount_raise{ - local($tmp)=""; - - $tmp .= 'sub do_cmd_fmtord{'; - $tmp .= 'local($_) = @_;'; - $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);'; - $tmp .= 'join("", "<SUP>",$suffix,"</SUP>",$_);'; - $tmp .='}'; - - eval($tmp); -} - -sub do_fmtcount_level{ - local($tmp)=""; - - $tmp .= 'sub do_cmd_fmtord{'; - $tmp .= 'local($_) = @_;'; - $tmp .= 'local($suffix) = &missing_braces unless (s/$next_pair_pr_rx/$suffix=$2;\'\'/eo);'; - $tmp .= 'join("", $suffix,$_);'; - $tmp .='}'; - - eval($tmp); -} - -if (not defined &do_cmd_fmtord) -{ - &do_fmtcount_raise(@_); -} - -$frenchdialect = 'france'; -$ordinalabbrv = 0; - -sub get_ordinal_suffix_english{ - local($num,$gender) = @_; - local($suffix); - - if ((($num % 10) == 1) && ($num%100 != 11)) - { - $suffix = 'st'; - } - elsif ((($num % 10) == 2) && ($num%100 != 12)) - { - $suffix = 'nd'; - } - elsif ((($num % 10) == 3) && ($num%100 != 13)) - { - $suffix = 'rd'; - } - else - { - $suffix = 'th'; - } - - $suffix; -} - -sub get_ordinal_suffix_french{ - local($num,$gender) = @_; - local($_); - - if ($ordinalabbrv > 0) - { - $_ = 'e'; - } - else - { - if ($num == 1) - { - $_ = ($gender eq 'f' ? 'ere' : 'er'); - } - else - { - $_ = 'eme'; - } - } -} - -sub get_ordinal_suffix_spanish{ - local($num,$gender) = @_; - - ($gender eq 'f' ? 'a' : 'o'); -} - -sub get_ordinal_suffix_portuges{ - local($num,$gender) = @_; - - ($gender eq 'f' ? 'a' : 'o'); -} - -sub get_ordinal_suffix_german{ - local($num,$gender) = @_; - - ''; -} - -sub get_ordinal_suffix_ngerman{ - local($num,$gender) = @_; - - ''; -} - -sub get_ordinal_suffix{ - local($num,$gender) = @_; - local($suffix,$suffixsub); - - $suffixsub = "get_ordinal_suffix_$default_language"; - - if (defined ($suffixsub)) - { - $suffix = &$suffixsub($num,$gender); - } - else - { - $suffix = &get_ordinal_suffix_english($num,$gender); - } - - $suffix; -} - -sub getordinal{ - local($num,$gender) = @_; - local($suffix) = &get_ordinal_suffix($num,$gender); - local($text)=''; - - if ($suffix eq '') - { - $text = $num; - } - else - { - local($br_id) = ++$global{'max_id'}; - $text = $num . "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}"; - } - - $text; -} - -sub do_cmd_ordinalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - my($gender)='m'; - local($suffix)=''; - - if (s/\[([mfn])\]//) - { - $gender = $1; - } - - $suffix = &get_ordinal_suffix($num,$gender); - - local($br_id) = ++$global{'max_id'}; - join('', $num, "\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}", $_); -} - -sub do_cmd_FCordinal{ - &do_cmd_ordinal; -} - -sub do_cmd_ordinal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $str eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{ORDINAL{', $ctr, '}}', $_[0]); - } - else - { - join('', &getordinal($val, $gender), $_[0]); - } -} - -sub do_cmd_storeordinal{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{ORDINAL{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = &getordinal($val, $gender); - } - - $_; -} - -sub do_cmd_storeordinalnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = &getordinal($val, $gender); - - $_; -} - -@unitthstring = ('zeroth', - 'first', - 'second', - 'third', - 'fourth', - 'fifth', - 'sixth', - 'seventh', - 'eighth', - 'ninth'); - -@tenthstring = ('', - 'tenth', - 'twentieth', - 'thirtieth', - 'fortieth', - 'fiftieth', - 'sixtieth', - 'seventieth', - 'eightieth', - 'ninetieth'); - -@teenthstring = ('tenth', - 'eleventh', - 'twelfth', - 'thirteenth', - 'fourteenth', - 'fifteenth', - 'sixteenth', - 'seventeenth', - 'eighteenth', - 'nineteenth'); - -@unitstring = ('zero', - 'one', - 'two', - 'three', - 'four', - 'five', - 'six', - 'seven', - 'eight', - 'nine'); - -@teenstring = ('ten', - 'eleven', - 'twelve', - 'thirteen', - 'fourteen', - 'fifteen', - 'sixteen', - 'seventeen', - 'eighteen', - 'nineteen'); -@tenstring = ('', - 'ten', - 'twenty', - 'thirty', - 'forty', - 'fifty', - 'sixty', - 'seventy', - 'eighty', - 'ninety'); - -$hundredname = "hundred"; -$hundredthname = "hundredth"; -$thousandname = "thousand"; -$thousandthname = "thousandth"; - -sub get_numberstringenglish{ - local($num) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = &get_numberstringenglish($num/1000); - $name .= $thousands . " $thousandname"; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = &get_numberstringenglish($num/100); - $name .= $hundreds . " $hundredname"; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } - - if ($num >= 20) - { - $name .= $tenstring[$num/10]; - - if ($num%10 > 0) { $name .= '-'; } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstring[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstring[$num%10]; - } - } - - $name; -} - -@unitthstringfrench = ('zeroi\`eme', - 'uni\`eme', - 'deuxi\`eme', - 'troisi\`eme', - 'quatri\`eme', - 'cinqui\`eme', - 'sixi\`eme', - 'septi\`eme', - 'huiti\`eme', - 'neuvi\`eme'); - -@tenthstringfrench = ('', - 'dixi\`eme', - 'vingti\`eme', - 'trentri\`eme', - 'quaranti\`eme', - 'cinquanti\`eme', - 'soixanti\`eme', - 'septenti\`eme', - 'huitanti\`eme', - 'nonenti\`eme'); - -@teenthstringfrench = ('dixi\`eme', - 'onzi\`eme', - 'douzi\`eme', - 'treizi\`eme', - 'quatorzi\`eme', - 'quinzi\`eme', - 'seizi\`eme', - 'dix-septi\`eme', - 'dix-huiti\`eme', - 'dix-neuvi\`eme'); - -@unitstringfrench = ('zero', - 'un', - 'deux', - 'trois', - 'quatre', - 'cinq', - 'six', - 'sept', - 'huit', - 'neuf'); - -@teenstringfrench = ('dix', - 'onze', - 'douze', - 'treize', - 'quatorze', - 'quinze', - 'seize', - 'dix-sept', - 'dix-huit', - 'dix-neuf'); - -@tenstringfrench = ('', - 'dix', - 'vingt', - 'trente', - 'quarante', - 'cinquante', - 'soixante', - 'septente', - 'huitante', - 'nonente'); - -$hundrednamefrench = "cent"; -$hundredthnamefrench = "centi\\`eme"; -$thousandnamefrench = "mille"; -$thousandthnamefrench = "mili\\`eme"; - -@unitthstringspanish = ('cero', - 'primero', - 'segundo', - 'tercero', - 'cuarto', - 'quinto', - 'sexto', - 's\\\'eptimo', - 'octavo', - 'noveno'); - -@tenthstringspanish = ('', - 'd\\\'ecimo', - 'vig\\\'esimo', - 'trig\\\'esimo', - 'cuadrag\\\'esimo', - 'quincuag\\\'esimo', - 'sexag\\\'esimo', - 'septuag\\\'esimo', - 'octog\\\'esimo', - 'nonag\\\'esimo'); - -@teenthstringspanish = ('d\\\'ecimo', - 'und\\\'ecimo', - 'duod\\\'ecimo', - 'decimotercero', - 'decimocuarto', - 'decimoquinto', - 'decimosexto', - 'decimos\\\'eptimo', - 'decimoctavo', - 'decimonoveno'); - -@hundredthstringspanish = ('', - 'cent\\\'esimo', - 'ducent\\\'esimo', - 'tricent\\\'esimo', - 'cuadringent\\\'esimo', - 'quingent\\\'esimo', - 'sexcent\\\'esimo', - 'septing\\\'esimo', - 'octingent\\\'esimo', - 'noningent\\\'esimo'); - -@unitstringspanish = ('cero', - 'uno', - 'dos', - 'tres', - 'cuatro', - 'cinco', - 'seis', - 'siete', - 'ocho', - 'nueve'); - -@teenstringspanish = ('diez', - 'once', - 'doce', - 'trece', - 'catorce', - 'quince', - 'diecis\\\'eis', - 'diecisiete', - 'dieciocho', - 'diecinueve'); - -@twentystringspanish = ('viente', - 'vientiuno', - 'vientid\\\'os', - 'vientitr\\\'es', - 'vienticuatro', - 'vienticinco', - 'vientis\\\'eis', - 'vientisiete', - 'vientiocho', - 'vientinueve'); - -@tenstringspanish = ('', - 'diez', - 'viente', - 'treinta', - 'cuarenta', - 'cincuenta', - 'sesenta', - 'setenta', - 'ochenta', - 'noventa'); - -@hundredstringspanish = ('', - 'ciento', - 'doscientos', - 'trescientos', - 'cuatrocientos', - 'quinientos', - 'seiscientos', - 'setecientos', - 'ochocientos', - 'novecientos'); - -$hundrednamespanish = "cien"; -$hundredthnamespanish = "centi\\`eme"; -$thousandnamespanish = "mil"; -$thousandthnamespanish = "mil\\'esimo"; - -@unitthstringportuges = ('zero', - 'primeiro', - 'segundo', - 'terceiro', - 'quatro', - 'quinto', - 'sexto', - 's\\\'etimo', - 'oitavo', - 'nono'); - -@tenthstringportuges = ('', - 'd\\\'ecimo', - 'vig\\\'esimo', - 'trig\\\'esimo', - 'quadrag\\\'esimo', - 'q\"uinquag\\\'esimo', - 'sexag\\\'esimo', - 'setuag\\\'esimo', - 'octog\\\'esimo', - 'nonag\\\'esimo'); - -@hundredthstringportuges = ('', - 'cent\\\'esimo', - 'ducent\\\'esimo', - 'trecent\\\'esimo', - 'quadringent\\\'esimo', - 'q\"uingent\\\'esimo', - 'seiscent\\\'esimo', - 'setingent\\\'esimo', - 'octingent\\\'esimo', - 'nongent\\\'esimo'); - -@unitstringportuges = ('zero', - 'um', - 'dois', - 'tr\^es', - 'quatro', - 'cinco', - 'seis', - 'sete', - 'oito', - 'nove'); - -@teenstringportuges = ('dez', - 'onze', - 'doze', - 'treze', - 'quatorze', - 'quinze', - 'dezesseis', - 'dezessete', - 'dezoito', - 'dezenove'); - -@tenstringportuges = ('', - 'dez', - 'vinte', - 'trinta', - 'quaranta', - 'cinq\"uenta', - 'sessenta', - 'setenta', - 'oitenta', - 'noventa'); - -@hundredstringportuges = ('', - 'cento', - 'duzentos', - 'trezentos', - 'quatrocentos', - 'quinhentos', - 'seiscentos', - 'setecentos', - 'oitocentos', - 'novecentos'); - -$hundrednameportuges = "cem"; -$thousandnameportuges = "mil"; -$thousandthnameportuges = "mil\\'esimo"; - -sub get_numberstringfrench{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringfrench[1] = 'une'; - } - else - { - $unitstringfrench[1] = 'un'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringfrench($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnamefrench; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num >= 200) - { - $hundreds = &get_numberstringfrench($num/100,$gender).' '; - } - - $name .= $hundreds . $hundrednamefrench; - $num = $num%100; - - if (($_[0]%100 == 0) && ($_[0]/100 > 1)) - { - $name .= 's'; - } - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - if ($num >= 20) - { - if ($frenchdialect eq 'france' and $num >= 70) - { - if ($num < 80) - { - $name .= $tenstringfrench[6]; - - if ($num%10 == 1) - { - $name .= ' et '; - } - else - { - $name .= '-'; - } - - $num = 10+($num%10); - } - else - { - $name .= 'quatre-vingt' . ($num==80?'s':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - } - elsif ($frenchdialect eq 'belgian' - && ($num >= 80) && ($num < 90)) - { - $name .= 'quatre-vingt' . ($num==80?'s':'-'); - } - else - { - $name .= $tenstringfrench[$num/10]; - - if ($num%10 == 1) { $name .= ' et ';} - elsif ($num%10 > 0) { $name .= '-'; } - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstringfrench[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringfrench[$num%10]; - } - } - - $name; -} - -sub get_numberstringspanish{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringspanish[1] = 'una'; - } - else - { - $unitstringspanish[1] = 'uno'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringspanish($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnamespanish; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num > 100) - { - $hundreds = $hundredstringspanish[$num/100]; - } - else - { - $hundreds = 'cien'; - } - - $name .= $hundreds; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " y "; } - - if ($num >= 30) - { - $name .= $tenstringspanish[$num/10]; - - if ($num%10 > 0) { $name .= ' y '; } - } - - if (($num >=20) && ($num < 30)) - { - $name .= $twentystringspanish[$num%10]; - } - elsif (($num >= 10) && ($num < 20)) - { - $name .= $teenstringspanish[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringspanish[$num%10]; - } - } - - $name; -} - -sub get_numberstringportuges{ - local($num,$gender) = @_; - local($name)=""; - - if ($gender eq 'f') - { - $unitstringportuges[0] = 'zera'; - $unitstringportuges[1] = 'uma'; - $unitstringportuges[2] = 'duas'; - } - else - { - $unitstringportuges[0] = 'zero'; - $unitstringportuges[1] = 'um'; - $unitstringportuges[2] = 'dois'; - } - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringportuges($num/1000,$gender).' '; - } - - $name .= $thousands . $thousandnameportuges; - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num > 100) - { - $hundreds = $hundredstringportuges[$num/100]; - - if ($gender eq 'f' and $num >= 200) - { - $hundreds =~s/o(s?)$/a\1/; - } - } - else - { - $hundreds = $hundrednameportuges; - } - - $name .= $hundreds; - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " e "; } - - if ($num >= 20) - { - $name .= $tenstringportuges[$num/10]; - - if ($num%10 == 1) { $name .= ' e ';} - elsif ($num%10 > 0) { $name .= ' '; } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenstringportuges[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitstringportuges[$num%10]; - } - } - - $name; -} - -@unitthstringMgerman = ('nullter', - 'erster', - 'zweiter', - 'dritter', - 'vierter', - 'f\\"unter', - 'sechster', - 'siebter', - 'achter', - 'neunter'); - -@tenthstringMgerman = ('', - 'zehnter', - 'zwanzigster', - 'drei\\ss igster', - 'vierzigster', - 'f\\"unfzigster', - 'sechzigster', - 'siebzigster', - 'achtzigster', - 'neunzigster'); - -@teenthstringMgerman = ('zehnter', - 'elfter', - 'zw\\"olfter', - 'dreizehnter', - 'vierzehnter', - 'f\\"unfzehnter', - 'sechzehnter', - 'siebzehnter', - 'achtzehnter', - 'neunzehnter'); - -@unitthstringFgerman = ('nullte', - 'erste', - 'zweite', - 'dritte', - 'vierte', - 'f\\"unfte', - 'sechste', - 'siebte', - 'achte', - 'neunte'); - -@tenthstringFgerman = ('', - 'zehnte', - 'zwanzigste', - 'drei\\ss igste', - 'vierzigste', - 'f\\"unfzigste', - 'sechzigste', - 'siebzigste', - 'achtzigste', - 'neunzigste'); - -@teenthstringFgerman = ('zehnte', - 'elfte', - 'zw\\"olfte', - 'dreizehnte', - 'vierzehnte', - 'f\\"unfzehnte', - 'sechzehnte', - 'siebzehnte', - 'achtzehnte', - 'neunzehnte'); - -@unitthstringNgerman = ('nulltes', - 'erstes', - 'zweites', - 'drittes', - 'viertes', - 'f\\"unte', - 'sechstes', - 'siebtes', - 'achtes', - 'neuntes'); - -@tenthstringNgerman = ('', - 'zehntes', - 'zwanzigstes', - 'drei\\ss igstes', - 'vierzigstes', - 'f\\"unfzigstes', - 'sechzigstes', - 'siebzigstes', - 'achtzigstes', - 'neunzigstes'); - -@teenthstringNgerman = ('zehntes', - 'elftes', - 'zw\\"olftes', - 'dreizehntes', - 'vierzehntes', - 'f\\"unfzehntes', - 'sechzehntes', - 'siebzehntes', - 'achtzehntes', - 'neunzehntes'); - -@unitstringgerman = ('null', - 'ein', # eins dealt with separately (this is for prefixes) - 'zwei', - 'drei', - 'vier', - 'f\\"unf', - 'sechs', - 'sieben', - 'acht', - 'neun'); - -@teenstringgerman = ('zehn', - 'elf', - 'zw\\"olf', - 'dreizehn', - 'vierzehn', - 'f\\"unfzehn', - 'sechzehn', - 'siebzehn', - 'achtzehn', - 'neunzehn'); - -@tenstringgerman = ('', - 'zehn', - 'zwanzig', - 'drei\\ss ig', - 'vierzig', - 'f\\"unfzig', - 'sechzig', - 'siebzig', - 'achtzig', - 'neunzig'); - -sub do_cmd_einhundert{ - local($_) = @_; - - "einhundert$_"; -} - -sub do_cmd_eintausend{ - local($_) = @_; - - "eintausend$_"; -} - -sub get_numberunderhundredgerman{ - local($num)=@_; - local($name)=''; - - if ($num == 1) - { - $name = 'eins'; - } - elsif ($num < 10) - { - $name = $unitstringgerman[$num]; - } - elsif ($num%10 == 0) - { - $name = $tenstringgerman[$num/10]; - } - else - { - $name = join('und', $unitstringgerman[$num%10], - $tenstringgerman[$num/10]); - } - - $name; -} - -sub get_numberstringgerman{ - local($orgnum,$gender) = @_; - local($name)=""; - - local($num) = $orgnum; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000 and $num < 2000) - { - $name = &translate_commands("\\eintausend "); - } - elsif ($num >= 2000) - { - $name = &get_numberunderhundredgerman($num/1000) - . "tausend"; - } - - $num = $orgnum%1000; - - if ($num >= 100 and $num < 200) - { - if ($orgnum > 1000) - { - $name .= "einhundert"; - } - else - { - $name = &translate_commands("\\einhundert "); - } - } - elsif ($num >= 200) - { - $name .= $unitstringgerman[$num/100]."hundert"; - } - - $num = $num%100; - - if ($orgnum == 0) - { - $name = 'null'; - } - elsif ($num > 0) - { - $name .= &get_numberunderhundredgerman($num); - } - } - - $name; -} - -sub get_numberstring{ - local($val,$gender) = @_; - - if ($default_language eq 'french') - { - &get_numberstringfrench($val,$gender); - } - elsif ($default_language eq 'spanish') - { - &get_numberstringspanish($val,$gender); - } - elsif ($default_language eq 'portuges') - { - &get_numberstringportuges($val,$gender); - } - elsif ($default_language eq 'german' - or $default_language eq 'ngerman') - { - &get_numberstringgerman($val,$gender); - } - else - { - &get_numberstringenglish($val); - } -} - -sub do_cmd_numberstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces unless - s/$next_pair_pr_rx/$num=$2;''/eo; - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_numberstring($num,$gender), $_); -} - -sub do_cmd_numberstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{NUMBERSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_numberstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storenumberstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{NUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storenumberstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_numberstring($val, $gender)); - - $_; -} - -sub get_Numberstring{ - local($val,$gender) = @_; - local($string) = &get_numberstring($val,$gender); - - if ($default_language=~m/german/) - { - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/; - } - else - { - $string =~ s/([a-z])([^\s\-]+)/\u\1\2/g; - - if ($default_language eq 'french') - { - $string =~ s/ Et / et /g; - } - elsif ($default_language eq 'spanish') - { - $string =~ s/ Y / y /g; - } - elsif ($default_language eq 'portuges') - { - $string =~ s/ E / e /g; - } - else - { - $string =~ s/ And / and /g; - } - } - - $string; -} - -sub do_cmd_Numberstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_Numberstring($num,$gender), $_); -} - -sub do_cmd_Numberstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{NNUMBERSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_Numberstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storeNumberstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{NNUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeNumberstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_Numberstring($val, $gender)); - - $_; -} - -sub do_cmd_NUMBERstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', uc(&get_numberstring($num,$gender)), $_); -} - -sub do_cmd_NUMBERstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{CAPNUMBERSTRING{', $ctr, '}}', $_); - } - else - { - join('', uc(&get_numberstring($val, $gender)), $_); - } -} - -sub do_cmd_storeNUMBERstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{CAPNUMBERSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeNUMBERstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[([mfn])\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = uc(&get_numberstring($val, $gender)); - - $_; -} - -sub get_ordinalstringenglish{ - local($num) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = &get_numberstring($num/1000); - $name .= $thousands; - - if ($num%1000 > 0) - { - $name .= " $thousandname"; - } - else - { - $name .= " $thousandthname"; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = &get_numberstring($num/100); - $name .= $hundreds; - - if ($num%100 > 0) - { - $name .= " $hundredname"; - } - else - { - $name .= " $hundredthname"; - } - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " and "; } - - if ($num >= 20) - { - if ($num%10 > 0) - { - $name .= $tenstring[$num/10] . '-'; - } - else - { - $name .= $tenthstring[$num/10]; - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenthstring[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitthstring[$num%10]; - } - } - - $name; -} - -sub get_ordinalstringfrench{ - local($num,$gender) = @_; - local($name)=""; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - local($thousands) = ''; - - if ($num >= 2000) - { - $thousands = &get_numberstringfrench($num/1000,$gender).' '; - } - - $num = $num%1000; - - if ($num > 0) - { - $name .= $thousands . $thousandnamefrench; - } - else - { - $name .= $thousands . $thousandthnamefrench; - } - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = ''; - - if ($num >= 200) - { - $hundreds = &get_numberstringfrench($num/100,$gender).' '; - } - - $num = $num%100; - - if ($num > 0) - { - $name .= $hundreds . $hundrednamefrench; - } - else - { - $name .= $hundreds . $hundredthnamefrench; - } - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - if ($num >= 20) - { - if ($frenchdialect eq 'france' and $num >= 70) - { - if ($num < 80) - { - if ($num%10 > 0) - { - $name .= $tenstringfrench[6]; - } - else - { - $name .= $tenthstringfrench[6]; - } - - if ($num%10 == 1) - { - $name .= ' et '; - } - else - { - $name .= '-'; - } - - $num = 10+($num%10); - } - else - { - $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - } - elsif ($frenchdialect eq 'belgian' and $num >= 80) - { - $name .= 'quatre-vingt' . ($num==80?'i\`eme':'-'); - - if ($num >= 90) - { - $num = 10+($num%10); - } - } - else - { - if ($num%10 > 0) - { - $name .= $tenstringfrench[$num/10]; - } - else - { - $name .= $tenthstringfrench[$num/10]; - } - - if ($num%10 == 1) { $name .= ' et ';} - elsif ($num%10 > 0) { $name .= '-'; } - } - } - - if (($num >= 10) && ($num < 20)) - { - $name .= $teenthstringfrench[$num%10]; - } - elsif ($_[0] == 1) - { - $name = 'premi\`ere'; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $name .= $unitthstringfrench[$num%10]; - } - } - - $name; -} - -sub get_ordinalstringspanish{ - local($num,$gender) = @_; - local($name)=""; - local($str); - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - if ($num >= 2000) - { - local($thousands) = &get_ordinalstringspanish($num/1000); - - if ($gender eq 'f') - { - $thousands =~s/o(s?)$/a\1/; - } - - $name .= $thousands. " "; - } - else - { - $name = ""; - } - - $name .= "$thousandthnamespanish"; - - if ($gender eq 'f') - { - $name =~s/o$/a/; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = $hundredthstringspanish[$num/100]; - - if ($gender eq 'f') - { - $hundreds =~s/o$/a/; - } - - $name .= $hundreds; - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= " "; } - - local($lastbit)=""; - - if ($num >= 20) - { - $lastbit = $tenthstringspanish[$num/10]; - - if ($num%10 > 0) - { - $lastbit .= ' '; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - - $lastbit = ""; - } - - if (($num >= 10) && ($num < 20)) - { - $lastbit = $teenthstringspanish[$num%10]; - } - elsif (($num%10 > 0) || ($_[0] == 0)) - { - $lastbit = $unitthstringspanish[$num%10]; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - } - - $name; -} - -sub get_ordinalstringportuges{ - local($num,$gender) = @_; - local($name)=""; - local($str); - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000) - { - if ($num >= 2000) - { - local($thousands) = &get_ordinalstringportuges($num/1000); - - if ($gender eq 'f') - { - $thousands =~s/o(s?)$/a\1/; - } - - $name .= $thousands. " "; - } - else - { - $name = ""; - } - - $name .= "$thousandthnameportuges"; - - if ($gender eq 'f') - { - $name =~s/o$/a/; - } - - $num = $num%1000; - } - - if ($num >= 100) - { - if ($_[0] >= 1000) { $name .= " "; } - - local($hundreds) = $hundredthstringportuges[$num/100]; - - if ($gender eq 'f') - { - $hundreds =~s/o$/a/; - } - - $name .= $hundreds; - - $num = $num%100; - } - - if (($_[0] > 100) && ($_[0]%100 > 0)) { $name .= "-"; } - - local($lastbit)=""; - - if ($num >= 10) - { - $lastbit = $tenthstringportuges[$num/10]; - - if ($num%10 > 0) - { - $lastbit .= '-'; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - - $lastbit = ""; - } - - if (($num%10 > 0) || ($_[0] == 0)) - { - $lastbit = $unitthstringportuges[$num%10]; - } - - if ($gender eq 'f') - { - $lastbit =~s/o([ s]*)$/a\1/; - } - - $name .= $lastbit; - } - - $name; -} - -sub get_numberunderhundredthgerman{ - local($num,$gender)=@_; - local($name)=''; - - if ($num < 10) - { - if ($gender eq 'F') - { - $name = $unitthstringFgerman[$num]; - } - elsif ($gender eq 'N') - { - $name = $unitthstringNgerman[$num]; - } - else - { - $name = $unitthstringMgerman[$num]; - } - } - elsif ($num%10 == 0) - { - if ($gender eq 'F') - { - $name = $tenthstringFgerman[$num/10]; - } - elsif ($gender eq 'N') - { - $name = $tenthstringNgerman[$num/10]; - } - else - { - $name = $tenthstringMgerman[$num/10]; - } - } - else - { - local($tenth); - if ($gender eq 'F') - { - $tenth = $tenthstringFgerman[$num/10]; - } - elsif ($gender eq 'N') - { - $tenth = $tenthstringNgerman[$num/10]; - } - else - { - $tenth = $tenthstringMgerman[$num/10]; - } - - $name = join('und', $unitstringgerman[$num%10], $tenth); - } - - $name; -} - -sub get_ordinalstringgerman{ - local($orgnum,$gender) = @_; - local($name)=""; - local($suffix)=''; - - $gender = uc($gender); - - if ($gender eq 'F') - { - $suffix = 'ste'; - } - elsif ($gender eq 'N') - { - $suffix = 'stes'; - } - else - { - $suffix = 'ster'; - $gender = 'M'; - } - - local($num) = $orgnum; - - unless (($num >= 1000000) || ($num < 0)) - { - if ($num >= 1000 and $num < 2000) - { - $name = &translate_commands("\\eintausend "); - } - elsif ($num >= 2000) - { - $name = &get_numberunderhundredgerman($num/1000) - . "tausend"; - } - - $num = $orgnum%1000; - - # is that it or is there more? - if ($orgnum >= 1000 and $num == 0) - { - $name .= $suffix; - return $name; - } - - if ($num >= 100 and $num < 200) - { - if ($orgnum > 1000) - { - $name .= "einhundert"; - } - else - { - $name = &translate_commands("\\einhundert "); - } - } - elsif ($num >= 200) - { - $name .= $unitstringgerman[$num/100]."hundert"; - } - - $num = $num%100; - - # is that it or is there more? - if ($orgnum >= 100 and $num == 0) - { - $name .= $suffix; - return $name; - } - - if ($orgnum == 0) - { - if ($gender eq 'F') - { - $name = $unitthstringFgerman[0]; - } - elsif ($gender eq 'N') - { - $name = $unitthstringNgerman[0]; - } - else - { - $name = $unitthstringMgerman[0]; - } - } - elsif ($num > 0) - { - $name .= &get_numberunderhundredthgerman($num,$gender); - } - } - - $name; -} - -sub get_ordinalstring{ - local($val,$gender) = @_; - - if ($default_language eq 'french') - { - &get_ordinalstringfrench($val,$gender); - } - elsif ($default_language eq 'spanish') - { - &get_ordinalstringspanish($val,$gender); - } - elsif ($default_language eq 'portuges') - { - &get_ordinalstringportuges($val,$gender); - } - elsif ($default_language eq 'german' - or $default_language eq 'ngerman') - { - &get_ordinalstringgerman($val,$gender); - } - else - { - &get_ordinalstringenglish($val); - } -} - -sub do_cmd_ordinalstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_ordinalstring($num,$gender), $_); -} - -sub do_cmd_ordinalstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{ORDINALSTRING{', $ctr, '}}', $_); - } - else - { - join('', &get_ordinalstring($val, $gender), $_); - } -} - - %fmtcntvar = (); - -sub do_cmd_FMCuse{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $fmtcntvar{$key}.$_; -} - -sub do_cmd_storeordinalstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{ORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeordinalstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_ordinalstring($val, $gender)); - - $_; -} - -sub get_Ordinalstring{ - local($val,$gender) = @_; - local($string) = &get_ordinalstring($val,$gender); - - if ($default_language=~m/german/) - { - $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/; - } - else - { - $string =~ s/\b([a-z])([^\s\-]+)/\u\1\2/g; - - if ($default_language eq 'french') - { - $string =~ s/ Et / et /g; - } - else - { - $string =~ s/ And / and /g; - } - } - - $string; -} - -sub do_cmd_Ordinalstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', &get_Ordinalstring($num,$gender), $_); -} - -sub do_cmd_Ordinalstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{OORDINALSTRING{', $ctr, '}}', $_[0]); - } - else - { - join('', &get_Ordinalstring($val, $gender), $_[0]); - } -} - -sub do_cmd_storeOrdinalstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{OORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeOrdinalstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = join('', &get_Ordinalstring($val, $gender)); - - $_; -} - -sub do_cmd_ORDINALstringnum{ - local($_) = @_; - local($num,$gender); - $num = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - if (s/\[(m|f|n)\]//) - { - $gender = $1; - } - else - { - $gender = 'm'; - } - - join('', uc(&get_ordinalstring($num,$gender)), $_); -} - -sub do_cmd_ORDINALstring{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - my($gender)='m'; - - $_[0] =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_[0]=~s/\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - join('', '{CAPORDINALSTRING{', $ctr, '}}', $_); - } - else - { - join('', uc(&get_ordinalstring($val, $gender)), $_); - } -} - -sub do_cmd_storeORDINALstring{ - local($_) = @_; - local($key); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - local($ctr, $val, $id, $_) = &read_counter_value($_); - my($gender)='m'; - - $_ =~ s/${OP}$id${CP}$ctr${OP}$id${CP}//; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - if ($ctr eq 'DAY' or $ctr eq 'MONTH' or $ctr eq 'YEAR') - { - # this is a cludge to make it work with newdateformat - $fmtcntvar{$key} = join('', '{CAPORDINALSTRING{', $ctr, '}}'); - } - else - { - $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); - } - - $_; -} - -sub do_cmd_storeORDINALstringnum{ - local($_) = @_; - local($key, $val); - - $key = &missing_braces - unless ((s/$next_pair_pr_rx//o)&&($key=$2)); - - $val = &missing_braces - unless (s/$next_pair_pr_rx/$val=$2;''/eo); - - my($gender)='m'; - - if ($_ =~s/\s*\[(.)\]//) - { - $gender = $1; - } - - $fmtcntvar{$key} = uc(&get_ordinalstring($val, $gender)); - - $_; -} - -sub do_cmd_fmtcountsetoptions{ - local($_) = @_; - local($options) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($options=$2)); - - if ($options =~ m/french=?(\w*)(,|$)/) - { - if ($1 eq 'france' or $1 eq 'swiss' or $1 eq 'belgian') - { - $frenchdialect = $1; - - print "Using French dialect: $1" if ($VERBOSITY > 0) ; - } - elsif ($1 eq '') - { - $frenchdialect = 'france'; - - print "Using French dialect: france" if ($VERBOSITY > 0); - } - else - { - &write_warnings("unknown french dialect '$1'"); - } - } - - if ($options =~ m/abbrv=?(\w*)(,|$)/) - { - if ($1 eq 'true' or $1 eq '') - { - $ordinalabbrv = 1; - - print "Setting abbrv=true" if ($VERBOSITY > 0); - } - elsif ($1 eq 'false') - { - $ordinalabbrv = 0; - - print "Setting abbrv=false" if ($VERBOSITY > 0); - } - else - { - &write_warnings("fmtcountsetoptions key abbrv: unknown value '$1'."); - } - } - - if ($options =~ m/fmtord=(\w*)(,|$)/) - { - if ($1 eq 'raise') - { - &do_fmtcount_raise(); - - print "Using raised ordinals" if ($VERBOSITY > 0); - } - elsif ($1 eq 'level') - { - &do_fmtcount_level(); - - print "Using level ordinals" if ($VERBOSITY > 0); - } - elsif ($1 eq 'user') - { - # do nothing - - print "Using user defined fmtord" if ($VERBOSITY > 0); - } - else - { - &write_warnings("unknown fmtcount option fmtord=$1"); - } - } - - $_[0]; -} - -$padzeroes = 0; - -sub do_cmd_padzeroes{ - local($_) = @_; - local($val,$pat) = &get_next_optional_argument; - - if ($val eq '') - { - $padzeroes = 17; - } - else - { - $padzeroes = $val; - } - - $_; -} - -sub get_binary{ - local($num) = @_; - local($val) = ""; - - for (my $i=17; $i>=0; $i--) - { - if (($i < $padzeroes) || ($num & (1 << $i)) || !($val eq "")) - { - $val .= ($num & (1 << $i) ? 1 : 0); - } - } - - $val; -} - -sub do_cmd_binary{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_binary($val), $_); -} - -sub do_cmd_binarynum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_binary($num), $_); -} - -sub get_decimal{ - local($num) = @_; - - sprintf "%0${padzeroes}d", $num; -} - -sub do_cmd_decimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_decimal($val), $_); -} - -sub do_cmd_decimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_decimal($num), $_); -} - -sub get_hexadecimal{ - local($num) = @_; - - sprintf "%0${padzeroes}lx", $num; -} - -sub do_cmd_hexadecimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_hexadecimal($val), $_); -} - -sub do_cmd_hexadecimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_hexadecimal($num), $_); -} - -sub get_Hexadecimal{ - local($num) = @_; - - sprintf "%0${padzeroes}lX", $num; -} - -sub do_cmd_Hexadecimal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_Hexadecimal($val), $_); -} - -sub do_cmd_Hexadecimalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_Hexadecimal($num), $_); -} - -sub get_octal{ - local($num) = @_; - - sprintf "%0${padzeroes}lo", $num; -} - -sub do_cmd_octal{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_octal($val), $_); -} - -sub do_cmd_octalnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', &get_octal($num), $_); -} - -sub get_aaalph{ - local($num) = @_; - local($rep) = int($num/26) + 1; - local($c) = chr(ord('a')-1+$num%26); - - local($_) = $c x $rep; -} - -sub do_cmd_aaalph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_aaalph($val), $_); -} - -sub get_AAAlph{ - local($num) = @_; - local($rep) = int($num/26) + 1; - local($c) = chr(ord('A')-1+$num%26); - - local($_) = $c x $rep; -} - -sub do_cmd_AAAlph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', &get_AAAlph($val), $_); -} - -sub do_cmd_aaalphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', (sprintf "%${padzeroes}s", &get_aaalph($num)), $_); -} - -sub do_cmd_AAAlphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', uc(sprintf "%${padzeroes}s", &get_aaalph($num)), $_); -} - -sub get_abalph{ - local($num) = @_; - local($str); - - if ($num == 0) - { - $str = ''; - } - elsif ($num > 0 && $num <= 26) - { - $str = chr(ord('a')-1+$num); - } - else - { - $str = &get_abalph(int($num/26)) . chr(ord('a')-1+($num%26)); - } - - $str; -} - -sub do_cmd_abalph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', (sprintf "%${padzeroes}s", &get_abalph($val)), $_); -} - -sub do_cmd_abalphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', (sprintf "%${padzeroes}s", &get_abalph($num)), $_); -} - -sub do_cmd_ABAlph{ - local($ctr, $val, $id, $_) = &read_counter_value($_[0]); - - join('', uc(sprintf "%${padzeroes}s", &get_abalph($val)), $_); -} - -sub do_cmd_ABAlphnum{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - join('', uc(sprintf "%${padzeroes}s", &get_abalph($num)), $_); -} - -sub get_twodigit{ - local($num) = @_; - - sprintf "%02d", $num; -} - -sub do_cmd_twodigit{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - # this is a cludge - if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") - { - join('', 'TWODIGIT{', $num, '}', $_); - } - else - { - join('', &get_twodigit($num), $_); - } -} - -# this was put here to help with the definition of \datelatin - -sub do_cmd_romannumeral{ - local($_) = @_; - local($num) = &missing_braces - unless (s/$next_pair_pr_rx/$num=$2;''/eo); - - # this is a cludge - if ($num eq "THEDAY" or $num eq "THEYEAR" or $num eq "THEMONTH") - { - join('', 'ROMANNUMERAL{', $num, '}', $_); - } - else - { - join('', &froman($num), $_); - } -} - -# load configuration file if it exists -# Note: The configuration file should be loaded before -# the package options are executed. - -# why doesn't this work? If I call this subroutine it -# causes an infinite loop. - -sub load_fmtcount_cfg{ - local($file,$found); - - $file = &fulltexpath('fmtcount.cfg'); - - $found = (-f $file); - - if (!$found) - { - foreach $texpath (split /$envkey/, $TEXINPUTS) - { - $file = "$texpath${dd}fmtcount.cfg"; - - last if ($found = (-f $file)); - } - } - - if ($found) - { - print "\nusing configuration file $file\n"; - - &slurp_input($file); - &pre_process; - &substitute_meta_cmds if (%new_command || %new_environment); - &wrap_shorthand_environments; - $_ = &translate_commands(&translate_environments($_)); - - print "\n processed size: ".length($_)."\n" if ($VERBOSITY>1) - } - else - { - print "\nNo configuation file fmtcount.cfg found\n" if ($VERBOSITY>1) - } -} - -1; |