summaryrefslogtreecommitdiff
path: root/tex/context/base/syst-prm.tex
blob: dc259dff700db39d86905f17f681f0315903de28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
%D \module
%D   [       file=syst-prm,
%D        version=1999.03.17,
%D          title=\CONTEXT\ System Macros,
%D       subtitle=Primitive Behavior,
%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.

\unprotect

%D Saved primitives are preceded by \type {\normal}, as in:

\let\normalfmtversion\fmtversion

%D When applicable, we also load the \ETEX\ source and
%D definition files.

\bgroup \obeylines

\ifx\eTeXversion\undefined

  \long\gdef\beginETEX#1\endETEX%
    {}

  \gdef\beginTEX%
    {\bgroup\obeylines\dobeginTEX}

  \gdef\dobeginTEX#1
    {\egroup}

  \global\let\endTEX\relax

\else

  \long\gdef\beginTEX#1\endTEX%
    {}

  \gdef\beginETEX%
    {\bgroup\obeylines\dobeginETEX}

%   \gdef\dobeginETEX#1
%     {\egroup\immediate\write16%
%        {system (E-TEX) : [line \the\inputlineno] \detokenize{#1}}}

  \gdef\dobeginETEX#1
    {\egroup}

  \global\let\endETEX\relax

\fi

\ifx\OmegaVersion\undefined

  \long\gdef\beginOMEGA#1\endOMEGA%
    {}

\else

  \gdef\beginOMEGA%
    {\bgroup\obeylines\dobeginOMEGA}

  \ifx\detokenize\undefined

    \gdef\dobeginOMEGA#1
      {\egroup\immediate\write16%
         {system (OMEGA) : [line \the\inputlineno] \string#1 }} % we assume an argument

  \else

    \gdef\dobeginOMEGA#1
      {\egroup\immediate\write16%
         {system (OMEGA) : [line \the\inputlineno] \detokenize{#1}}} % we assume aleph

  \fi

  \global\let\endOMEGA\relax

\fi

\ifx\XeTeXversion\undefined

  \long\gdef\beginXETEX#1\endXETEX%
    {}

\else

  \gdef\beginXETEX%
    {\bgroup\obeylines\dobeginXETEX}

  \gdef\dobeginXETEX#1
    {\egroup\immediate\write16%
       {system (XETEX) : [line \the\inputlineno] \detokenize{#1}}}

  \global\let\endXETEX\relax

\fi

\ifx\directlua\undefined

  \long\gdef\beginLUATEX#1\endLUATEX%
    {}

\else

  \gdef\beginLUATEX%
    {\bgroup\obeylines\dobeginLUATEX}

  \gdef\dobeginLUATEX#1
    {\egroup\immediate\write16%
       {system (LUATEX) : [line \the\inputlineno] \detokenize{#1}}}

  \global\let\endLUATEX\relax

\fi

% traditional tex's vs de utf tex's

\ifx\XeTeXversion\undefined \ifx\directlua\undefined

  \gdef\beginOLDTEX%
    {\bgroup\obeylines\dobeginOLDTEX}

  \gdef\dobeginOLDTEX#1
    {\egroup\immediate\write16%
       {system (OLDTEX) : [line \the\inputlineno] \detokenize{#1}}}

  \global\let\endOLDTEX\relax

  \long\gdef\beginNEWTEX#1\endNEWTEX%
    {}

\fi \fi \ifx\beginOLDTEX\undefined

  \long\gdef\beginOLDTEX#1\endOLDTEX%
    {}

  \gdef\beginNEWTEX%
    {\bgroup\obeylines\dobeginNEWTEX}

  \gdef\dobeginNEWTEX#1
    {\egroup\immediate\write16%
       {system (NEWTEX) : [line \the\inputlineno] \detokenize{#1}}}

  \global\let\endNEWTEX\relax

\fi

\egroup

%D Let's get rid of this one:

\def\wlog#1{}

%D Just for tracing purposes we set:

\tracingstats=1

%D We don't like outer commands, and we always want access
%D to the original \type {\input} primitive.

\let\normalouter = \outer  \let\outer\relax
\let\normalinput = \input

%D We need to make sure that we start up in \DVI\ mode, so,
%D after testing for running \PDFTEX, we default to \DVI.

\ifx\pdftexversion\undefined \newcount\pdfoutput \fi \pdfoutput=0

%D To circumvent dependencies, we can postpone certain
%D initializations to dumping time, by appending them to the
%D \type {\everydump} token register.

\newtoks \everydump

\let\normaldump \dump

\def\dump{\the\everydump\normaldump}

%D \macros
%D    {bindprimitive}

\beginTEX

\def\bindprimitive#1 #2 % new old
  {\expandafter\ifx\csname#1\endcsname\relax \expandafter\ifx\csname#2\endcsname\relax \else
       \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname
   \fi\fi}

\endTEX

\beginETEX

\def\bindprimitive#1 #2 % new old
  {\ifcsname#1\endcsname \else\ifcsname#2\endcsname
     \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname
   \fi\fi}

\endETEX

% %D Ligature prevention (for instance, ec encoding has ligatures
% %D in mono spaced fonts). Alas, we need to do some testing in order
% %D to get to the ptex'd one.

% \def\checkpdftexprimitive #1
%   {\expandafter\ifx\csname     #1\endcsname\relax
%    \expandafter\ifx\csname  pdf#1\endcsname\relax
%    \expandafter\ifx\csname ptex#1\endcsname\relax
%      \expandafter\let\csname normal#1\endcsname            \undefined                   \else
%      \expandafter\let\csname normal#1\expandafter\endcsname\csname ptex#1\endcsname \fi \else
%      \expandafter\let\csname normal#1\expandafter\endcsname\csname  pdf#1\endcsname \fi \else
%      \expandafter\let\csname normal#1\expandafter\endcsname\csname     #1\endcsname \fi}

% \checkpdftexprimitive quitvmode
% \checkpdftexprimitive noligatures
% \checkpdftexprimitive setrandomseed
% \checkpdftexprimitive uniformdeviate

%D We preserve \TEX's ending:

\ifx\normalend\undefined \let\normalend\end \fi

\protect \endinput