summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/xetx-ini.mkii
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2009-08-23 11:11:32 +0000
committerTaco Hoekwater <taco@elvenkind.com>2009-08-23 11:11:32 +0000
commit8fc3039c82d48605b5ca8b2eda3f4fdd755681e1 (patch)
tree3cd9bbdd599bc4d1ac0409e167fee2136e4c0ec9 /Master/texmf-dist/tex/context/base/xetx-ini.mkii
parent850fc99b7cd3ae7a20065531fe866ff7bae642ec (diff)
this is context 2009.08.19 17:10
git-svn-id: svn://tug.org/texlive/trunk@14827 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/xetx-ini.mkii')
-rw-r--r--Master/texmf-dist/tex/context/base/xetx-ini.mkii132
1 files changed, 132 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/xetx-ini.mkii b/Master/texmf-dist/tex/context/base/xetx-ini.mkii
new file mode 100644
index 00000000000..db3cccabdbf
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/xetx-ini.mkii
@@ -0,0 +1,132 @@
+%D \module
+%D [ file=xetx-ini,
+%D version=2004.09.11,
+%D title=\CONTEXT\ System Macros,
+%D subtitle=\XETEX\ Initializations,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D We moved some code around and now have reorganized the xetex
+%D code in the \type {xetx} module namespace.
+
+\unprotect
+
+%D Some defaults.
+
+\ifdefined\XeTeXuseglyphmetrics
+ \XeTeXuseglyphmetrics\plusone
+\fi
+
+%D Character classes.
+
+\newcount\nofXTXcharinjections
+
+\def\defineXTXcharinjectionclass[#1]%
+ {\global\advance\nofXTXcharinjections\plusone
+ \setxvalue{@xtx@cc@#1}{\number\nofXTXcharinjections}}
+
+\setxvalue{@xtx@cc@\s!default}{0}
+
+\def\getXTXcharinjectionclass#1%
+ {\csname @xtx@cc@\ifcsname @xtx@cc@#1\endcsname#1\else\s!default\fi\endcsname}
+
+\let\currentXTXcharinjection\s!default
+
+\def\startXTXcharinjecxtions[#1]%
+ {\pushmacro\currentXTXcharinjection
+ \def\currentXTXcharinjection{#1}}
+
+\def\stopXTXcharinjections
+ {\popmacro\currentXTXcharinjection}
+
+\def\defineXTXcharinjection #1 #2 %
+ {\doifnumberelse{#1}{\edef\XTXclassone{\number#1}}{\edef\XTXclassone{\getXTXcharinjectionclas{#1}}}%
+ \doifnumberelse{#2}{\edef\XTXclasstwo{\number#2}}{\edef\XTXclasstwo{\getXTXcharinjectionclas{#2}}}%
+ \expanded{\dodefineXTXcharinjection{\XTXclassone}{\XTXclasstwo}}}
+
+\def\setXTXcharcodes #1 #2 #3 % encoding syntax
+ {\catcode#1=11 \lccode #1=#2 \uccode #1=#3 }
+
+\def\dosetXTXcharcodes#1#2#3% compact syntax
+ {\catcode#1=11 \lccode #1=#2 \uccode #1=#3 }
+
+\ifdefined\XeTeXinterchartoks
+
+ \long\def\dodefineXTXcharinjection#1#2#3%
+ {\XeTeXinterchartoks #1 #2 {\XTXcharinjection{#1}{#2}}%
+ \setvalue{@xtx@ch@\currentXTXcharinjection @#1@#2@}{#3}}
+
+ \def\setXTXcharacterclass #1 #2 %
+ {\doifnumberelse{#2}
+ {\XeTeXcharclass#1=#2\relax}
+ {\XeTeXcharclass#1=\getXTXcharinjectionclass{#2}\relax}}
+
+ \def\dosetXTXcharacterclass#1% #2 fast one
+ {\XeTeXcharclass#1=\getXTXcharinjectionclass}
+
+\else
+
+ \long\def\dodefineXTXcharinjection#1#2#3%
+ {\setvalue{@xtx@ch@\currentXTXcharinjection @#1@#2@}{#3}}
+
+ \def\setXTXcharacterclass #1 #2 %
+ {}
+
+\fi
+
+\chardef\XTXcharinjectionsmode=1
+
+\letvalue{@xtx@ch@\s!empty}\empty
+
+\def\XTXcharinjection#1#2%
+ {\csname @xtx@ch@%
+ \ifcase\XTXcharinjectionsmode
+ \s!empty
+ \or
+ \ifcsname @xtx@ch@\currentXTXcharinjection @#1@#2@\endcsname \currentXTXcharinjection @#1@#2@\fi
+ \or
+ \ifcsname @xtx@ch@\currentXTXcharinjection @#1@#2@\endcsname \currentXTXcharinjection @#1@#2@\else
+ \ifcsname @xtx@ch@\s!default @#1@#2@\endcsname \s!default @#1@#2@\else
+ \s!empty
+ \fi\fi
+ \else
+ \s!empty
+ \fi
+ \endcsname}
+
+\def\enableXTXcharinjections[#1]%
+ {\def\currentXTXcharinjection{#1}}
+
+\protect \endinput
+
+\starttext
+
+\startXTXcharinjecxtions[default]
+ \defineXTXcharinjection 10 40 {[default]}
+\stopXTXcharinjections
+
+\startXTXcharinjecxtions[whatever]
+ \defineXTXcharinjection 20 40 {[whatever]}
+\stopXTXcharinjections
+
+\chardef\XTXcharinjectionsmode=0
+
+\enableXTXcharinjections[default] A\XTXcharinjection{10}{40}B\XTXcharinjection{20}{40}C
+\enableXTXcharinjections[whatever] A\XTXcharinjection{10}{40}B\XTXcharinjection{20}{40}C
+
+\chardef\XTXcharinjectionsmode=1
+
+\enableXTXcharinjections[default] A\XTXcharinjection{10}{40}B\XTXcharinjection{20}{40}C
+\enableXTXcharinjections[whatever] A\XTXcharinjection{10}{40}B\XTXcharinjection{20}{40}C
+
+\chardef\XTXcharinjectionsmode=2
+
+\enableXTXcharinjections[default] A\XTXcharinjection{10}{40}B\XTXcharinjection{20}{40}C
+\enableXTXcharinjections[whatever] A\XTXcharinjection{10}{40}B\XTXcharinjection{20}{40}C
+
+\stoptext