summaryrefslogtreecommitdiff
path: root/tex/context/base/mkii/xetx-ini.mkii
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-12 17:15:07 +0100
commit8d8d528d2ad52599f11250cfc567fea4f37f2a8b (patch)
tree94286bc131ef7d994f9432febaf03fe23d10eef8 /tex/context/base/mkii/xetx-ini.mkii
parentf5aed2e51223c36c84c5f25a6cad238b2af59087 (diff)
downloadcontext-8d8d528d2ad52599f11250cfc567fea4f37f2a8b.tar.gz
2016-01-12 16:26:00
Diffstat (limited to 'tex/context/base/mkii/xetx-ini.mkii')
-rw-r--r--tex/context/base/mkii/xetx-ini.mkii132
1 files changed, 132 insertions, 0 deletions
diff --git a/tex/context/base/mkii/xetx-ini.mkii b/tex/context/base/mkii/xetx-ini.mkii
new file mode 100644
index 000000000..55155fa1a
--- /dev/null
+++ b/tex/context/base/mkii/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 ADE \& \CONTEXT\ Development Team}]
+%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