%%
%% 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
 % LaTeX2HTML

\documentclass[a4paper]{article}

\usepackage[french,english,spanish,portuges,ngerman,italian]{babel}
\usepackage{fmtcount}

\newcounter{startval}
\newcounter{endval}
\newcounter{stepsize}
\newcounter{N}
\newcount\myctr
\newcount\langid

\begin{document}

\section{Displaying the value of a counter}

\typeout{This is an interactive script, testing the fmtcount package.}

\langid=-1

\loop
\typeout{Which language?^^J}
\typeout{[1] English}
\typeout{[2] Portuguese}
\typeout{[3] Spanish}
\typeout{[4] French}
\typeout{[5] French (Swiss)}
\typeout{[6] French (Belgium)}
\typeout{[7] German}
\typeout{[8] Italian}

\typein[\response]{}

\ifthenelse{\equal{\response}{1}}{\langid=1}{
\ifthenelse{\equal{\response}{2}}{\langid=2}{
\ifthenelse{\equal{\response}{3}}{\langid=3}{
\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}{8}}{\langid=8}{%
\langid=-1
\typeout{Invalid response '\response', please select a number from 1 to 6}}}}}}}}}
\ifnum\langid=-1
\repeat

\ifcase\langid
\or \selectlanguage{english}
Current language: English.
\or \selectlanguage{portuges}
Current language: Portuguese.
\or \selectlanguage{spanish}
Current language: Spanish.
\or \selectlanguage{french}
Current language: French.
\or \selectlanguage{french}
Current language: French (Swiss).
\or \selectlanguage{french}
Current language: French (Belgium).
\or \selectlanguage{ngerman}
Current language: German.
\or \selectlanguage{italian}
Current language: Italian.
\fi

\def\startval{-1}

\loop
\typein[\startval]{Start value? (Integer from 0 to 99999)
[Default 1]}
\ifthenelse{\equal{\startval}{}}{\def\startval{1}}{}
\ifnum\startval<0\def\startval{-1}\fi
\ifnum\startval>99999\def\startval{-1}\fi
\ifnum\startval=-1
\repeat

\def\endval{-1}

\loop
\typein[\endval]{End value? (Integer from 0 to 99999)
[Default 1000]}
\ifthenelse{\equal{\endval}{}}{\def\endval{1000}}{}
\ifnum\endval<0\def\endval{-1}\fi
\ifnum\endval>99999\def\endval{-1}\fi
\ifnum\endval=-1
\repeat

\def\stepsize{0}

\loop
\typein[\stepsize]{Step size? (Non zero integer)
[Default 1]}
\ifthenelse{\equal{\stepsize}{}}{\def\stepsize{1}}{}
\ifnum\stepsize=0
\repeat

\typeout{From {\startval} to {\endval} step {\stepsize}}

\ifnum\startval<\endval
\ifnum\stepsize<0
\PackageError{fc-lang}{Infinite loop not permitted!}{}
\def\endval{\startval}
\fi
\fi

\ifnum\startval>\endval
\ifnum\stepsize>0
\PackageError{fc-lang}{Infinite loop not permitted!}{}
\def\endval{\startval}
\fi
\fi

\newcount\numformat

\numformat=-1
\loop
\typeout{Which format?^^J}
\typeout{[1] ordinalstring}
\typeout{[2] Ordinalstring}
\typeout{[3] ORDINALstring}
\typeout{[4] numberstring}
\typeout{[5] Numberstring}
\typeout{[6] NUMBERstring}

\typein[\response]{Default: 1}

\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default val
\ifthenelse{\equal{\response}{1}}{\numformat=1}{
\ifthenelse{\equal{\response}{2}}{\numformat=2}{
\ifthenelse{\equal{\response}{3}}{\numformat=3}{
\ifthenelse{\equal{\response}{4}}{\numformat=4}{
\ifthenelse{\equal{\response}{5}}{\numformat=5}{
\ifthenelse{\equal{\response}{6}}{\numformat=6}{\numformat=-1
\typeout{Invalid response '\response', please select a number from 1 to 4}}}}}}}
\ifnum\numformat=-1
\repeat

\ifcase\numformat
\or\def\stringtype{ordinalstring}
\or\def\stringtype{Ordinalstring}
\or\def\stringtype{ORDINALstring}
\or\def\stringtype{numberstring}
\or\def\stringtype{Numberstring}
\or\def\stringtype{NUMBERstring}
\fi

\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
\typeout{Ordinal format?^^J}
\typeout{[1] raised}
\typeout{[2] level}
\typein[\response]{Default: 1}
\ifthenelse{\equal{\response}{1}\or\equal{\response}{}}{%
\fmtcountsetoptions{fmtord=raise}\myctr=1}{%
\ifthenelse{\equal{\response}{2}}{%
\fmtcountsetoptions{fmtord=level}\myctr=2}{%
\myctr=-1}}
\ifnum\myctr=-1
\repeat

\ifnum\langid=1
\myctr=1
\else
\ifthenelse{\langid=7 \and \numformat>3}{}{%
\loop
\ifnum\langid=7
  \typein[\response]{Gender? (m, f or n) [Default: m]}
  \ifthenelse{\equal{\response}{m}}{\myctr=1}{
  \ifthenelse{\equal{\response}{f}}{\myctr=2}{
   \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}}{\myctr=1}{
  \ifthenelse{\equal{\response}{f}}{\myctr=2}{%
  \ifthenelse{\equal{\response}{}}{\myctr=1}{%
  \myctr=-1
  \typeout{Invalid response '\response'}}}}
\fi
\ifnum\myctr=-1
\repeat
}
\fi

\ifcase\myctr
\or \def\gender{m}
\or \def\gender{f}
\or \def\gender{n}
\fi

\ifnum\langid=7
\ifnum\startval>99
\myctr=-1
\loop
\typeout{einhundert/eintausend or hundert/tausend?^^J}
\typeout{[1] einhundert/eintausend}
\typeout{[2] hundert/tausend}
\typein[\response]{Default: 1}
\ifthenelse{\equal{\response}{}}{\def\response{1}}{}%default
\ifthenelse{\equal{\response}{1}}{%
\renewcommand{\einhundert}{einhundert}
\renewcommand{\eintausend}{eintausend}
\myctr=1}{%
\ifthenelse{\equal{\response}{2}}{%
\renewcommand{\einhundert}{hundert}
\renewcommand{\eintausend}{tausend}
\myctr=2}{%
\myctr=-1}}
\ifnum\myctr=-1
\repeat
\fi
\fi

\setcounter{startval}{\startval}
\setcounter{endval}{\endval}
\setcounter{stepsize}{\stepsize}

\stepcounter{endval}
\begin{ttfamily}
\noindent
\makebox[0.25in][c]{N}
\makebox[0.5in][c]{ordinal}\quad
\stringtype
\par
\myctr=\value{startval}
\loop
\noindent
\setcounter{N}{\myctr}
\makebox[0.25in][r]{\arabic{N}}
\makebox[0.5in][r]{\ordinal{N}[\gender]}\quad
\csname\stringtype\endcsname{N}[\gender].
\par
\advance\myctr by \value{stepsize}\relax
\ifnum\myctr<\value{endval}
\repeat

\end{ttfamily}

\end{document}
\endinput
%%
%% End of file `fc-lang.tex'.
