summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/syst-con.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-11-16 01:02:47 +0000
committerKarl Berry <karl@freefriends.org>2006-11-16 01:02:47 +0000
commit3c85b55e2f245fb7edac7e445f107e6d0bb423ae (patch)
treec62b7f80edafe0455310d08e09f4218127bf9e87 /Master/texmf-dist/tex/context/base/syst-con.tex
parente5ecff27a26ef59e1dbe9702677687fd7107be3a (diff)
context update
git-svn-id: svn://tug.org/texlive/trunk@2444 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/syst-con.tex')
-rw-r--r--Master/texmf-dist/tex/context/base/syst-con.tex51
1 files changed, 50 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/context/base/syst-con.tex b/Master/texmf-dist/tex/context/base/syst-con.tex
index a9e04921f5f..cbef0dedc26 100644
--- a/Master/texmf-dist/tex/context/base/syst-con.tex
+++ b/Master/texmf-dist/tex/context/base/syst-con.tex
@@ -192,7 +192,7 @@
\dorecurse{255}
{\lccode`a=\recurselevel
- \lowercase{\xdef\rawcharacter{\rawcharacter a\or}}}
+ \lowercase{\xdef\rawcharacter{\rawcharacter \string a\or}}} % string is needed for XeTeX
\@EA\gdef\@EA\rawcharacter\@EA#\@EA1\@EA
{\@EA\ifcase\@EA#\@EA1\rawcharacter\fi}
@@ -207,5 +207,54 @@
\def\threedigits#1%
{\ifnum#1<10 00\else\ifnum#1<100 0\fi\fi\number#1}
+%D \macros{modulonumber}
+%D
+%D In the conversion macros described in \type {core-con} we
+%D need a wrap||around method. The following solution is
+%D provided by Taco.
+%D
+%D The \type {modulonumber} macro expands to the mathematical
+%D modulo of a positive integer. It is crucial for it's
+%D application that this macro is fully exandable.
+%D
+%D The expression inside the \type {\numexpr} itself is
+%D somewhat bizarre because \ETEX\ uses a rounding
+%D division instead of truncation. If \ETEX's division
+%D would have behaved like \TEX's normal\type{\divide}, then
+%D the expression could have been somewhat simpler, like
+%D \type {#2-(#2/#1)*#1}. This works just as well, but a bit
+%D more complex.
+
+\beginETEX
+
+\def\modulonumber#1#2%
+ {\the\numexpr#2-((((#2+(#1/2))/#1)-1)*#1)\relax}
+
+\endETEX
+
+%D \macros{modulatednumber}
+%D
+%D Modulo numbers run from zero to one less than the limit,
+%D but for conversion sets, we need a value between 1 and the
+%D limit. The \type{\modulatednumber} arranges that. This
+%D macro also needs to be fully expandable, resulting in
+%D two \type{\numexpr}s.
+
+\beginETEX
+
+\def\modulatednumber#1#2%
+ {\ifnum\the\numexpr\modulonumber{#1}{#2}\relax=0 #1%
+ \else \the\numexpr\modulonumber{#1}{#2}\relax \fi}
+
+\endETEX
+
+%D When not running \ETEX\ you're left with the maximum:
+
+\beginTEX
+
+\def\modulatednumber#1#2%
+ {\ifnum#2>#1 #1\else#2\fi}
+
+\endTEX
\protect \endinput