Debian Codegraph @

texmf-dist/tex/plain/etex/etex.src

raw
1 %% e-TeX V2.1;0
2 %% Revision-date: 01-FEB-1999 22:36:22 /PB
3 %% Revision-history: (at-end)
4
5 % The version number in the first line is compared with the corresponding
6 % element in e-TeX, and an error reported if incompatibility is detected.
7 % The cycle and revision numbers (that is, the element(s) following the
8 % period) are not used in this comparison, allowing enhancements to be made to
9 % this module and recorded in its header without introducing a risk of conflict.
10 %
11 % This allows to use this file with e-TeX versions 2.0 and 2.1!
12 %
13 % Other files whose headers must be kept in synch include "etexdefs.lib" and
14 % "language.def".
15
16 % This is "etex.src", the (e-TeX) source file for the "etex" format file.
17 % To build the format from it, use one of the following commands or the
18 % local equivalent:
19
20 % Generic: einitex *etex.src \dump
21 % emTeX: etex -i *etex.src \dump
22 % VMS: etex /init /noformat *"etex.src \dump"
23
24 % Assume a purely IniTeX environment and set up a minimal \catcode r\'egime
25
26 \catcode `\{=1
27 \catcode `\}=2
28 \catcode `\#=6
29 \catcode `\^=7
30 \catcode `\@=\catcode `\A
31
32 % Define the basic error-reporting and abort mechanisms:
33
34 \def \et@xmsg #1#2%
35 {\begingroup
36 \def \n {^^J}%
37 \def \ { }%
38 \newlinechar=\expandafter `\n
39 \if E#1%
40 \errorcontextlines=0
41 \errmessage {e-TeX error: #2}%
42 \else
43 \message {\n ! e-TeX \if I#1 message%
44 \else \if W#1 warning%
45 \else \if F#1 fatal error%
46 \else
47 \ unknown (#1)%
48 \fi
49 \fi
50 \fi: #2%
51 }%
52 \fi
53 \endgroup
54 }
55
56 % Note: a future version may report errors in the %<fac>-<s>-<code>[, <text>]
57 % format, allowing the more verbose <text>s to be read from file rather than
58 % stored in the format.
59
60 \def \et@xabort #1%
61 {\et@xmsg {F}{#1}%
62 \batchmode
63 \end
64 }
65
66 % Make sure this file is being read by e-TeX in extended mode;
67 % If it is, prepare to check version/revision compatibility, otherwise abort.
68
69 \ifx \undefined \eTeXversion
70 \et@xabort {this file can be processed only in extended mode;\n
71 \ \ did you perhaps forget the asterisk?%
72 }%
73 \else
74 \begingroup
75 \catcode `\%=12
76 \catcode `\?=14
77 \xdef \et@xfilehdr
78 {\detokenize {%% e-TeX V}\the \eTeXversion \eTeXrevision}?
79 \xdef \et@xlibhdr
80 {\detokenize {%% e-TeXlib V}\the \eTeXversion \eTeXrevision}?
81 \endgroup
82 \fi
83
84 % Assume extended mode, but no additional \catcodes/\defs yet;
85 % set up a simple e-TeX condition-reporting system:
86
87 \def \et@xinf #1{\et@xmsg {I}{#1}} %%% not currently used
88 \def \et@xwarn #1{\et@xmsg {W}{#1}}
89 \def \et@xerr #1#2{{\errhelp={#2}\et@xmsg {E}{#1}}}
90
91 % deactivate the processing of patterns and exceptions; these will be
92 % reinstated later, after the \uselanguage mechanism has been defined.
93
94 \let \et@xpatterns=\patterns
95 \def \patterns
96 {\begingroup
97 \everyeof={\fi \endgroup}%
98 \message {[skipping from \noexpand \patterns to end-of-file...]}%
99 \iffalse
100 }
101
102 % Read "plain.tex" (\patterns & \hyphenation will be skipped)
103
104 \input plain
105
106 % restore the catcode of commercial-at (@), which will just have been clobbered
107
108 \catcode `\@=\catcode `\A
109
110 % Assume an extended Plain environment (i.e. there are no longer any
111 % restrictions on the coding techniques we can use). First prepare to
112 % carry out consistency checks on the file headers and the current e-TeX
113 % version/revision levels:
114
115 \newread \et@xinput
116
117 \def \etexhdrchk #1#2%
118 {\openin \et@xinput=#2
119 \ifeof \et@xinput
120 \chardef \etexstatus=0 % V1.0-1
121 \else
122 \begingroup
123 \endlinechar=-1
124 \readline \et@xinput to \et@xbuf
125 \closein \et@xinput
126 \def \p@rtition ##1.##2\endp@rtition {##1}% V2.1%0
127 \xdef \et@xbuf
128 {\expandafter \p@rtition \et@xbuf .\endp@rtition}% V2.1;0
129 \xdef \et@xtmp {\csname et@x#1hdr\endcsname}%
130 \xdef \et@xtmp
131 {\expandafter \p@rtition \et@xtmp .\endp@rtition}% V2.1;0
132 \endgroup
133 \ifx \et@xtmp \et@xbuf
134 \chardef \etexstatus=2 % V1.1;4
135 \else
136 \chardef \etexstatus=1 % V1.1;4
137 \fi
138 \fi
139 }
140
141 % Check the version number of this file:
142
143 \def \et@xfmtsrc {etex.src}
144 \etexhdrchk {file} {\et@xfmtsrc}
145 \ifcase \etexstatus
146 \et@xerr {unable to open format source file "\et@xfmtsrc";}
147 {This should not happen; please ensure that your system
148 allows a file to be opened for reading more than once
149 concurrently.%
150 }%
151 \or
152 \et@xwarn {format source file "\et@xfmtsrc" has wrong header;\n
153 \ \ expected: "\et@xfilehdr"; found: "\et@xbuf";%
154 }%
155 {You are using a version of e-TeX which may be incompatible
156 with the source for the format file you are trying to
157 compile; please ensure that you have the most recent
158 version of each. I will proceed, but you should treat
159 the results with caution...%
160 }%
161 \fi
162
163 % Module handling now implemented (V1.0-2)
164
165 \def \module #1{\iftrue}
166 \let \endmodule=\fi
167
168 \newtoks \et@xtoks
169
170 \def \et@xl@@d #1 #2\endl@ad %%% the "#1 #2" code avoids trailing spaces
171 {\ifcsname module:#1\endcsname
172 \et@xwarn {duplicate module name "#1"}%
173 \else
174 \csname module:#1\endcsname %%% we exploit the side-effect explicitly
175 \et@xtoks=\expandafter
176 {\the \et@xtoks
177 \expandafter \let \csname module:#1\endcsname=\undefined
178 }%
179 \fi
180 }
181
182 \def \et@xl@ad #1#2,#3\endl@ad %%% the #1#2 code avoids spurious leading spaces
183 {\et@xl@@d #1#2 \endl@ad
184 \if *#3*
185 \let \n@xt=\relax
186 \else
187 \def \n@xt {\et@xl@ad #3\endl@ad}%
188 \fi
189 \n@xt
190 }
191
192 \def \et@xload #1 %%% needed because of the embedded \ifs...
193 {\def \module ##1%
194 {\unless
195 \ifcsname module:##1\endcsname
196 \message {Skipping module "##1";}%
197 \else
198 \message {Loading module "##1";}%
199 }%
200 \input #1
201 \def \module ##1{\iftrue}%
202 }
203
204 \def \load #1 from #2 %%% selective module loading from an e-TeX library file
205 {\etexhdrchk {lib} {#2}%
206 \ifcase \etexstatus
207 \et@xerr {unable to open library file "#2"; load aborted.}
208 {I got an <eof> on trying to open your library file;
209 please make sure it exists, is readable and is not locked.%
210 }%
211 \or
212 \et@xerr {library file "#2" has wrong header;\n
213 \ \ expected: "\et@xlibhdr"; found: "\et@xbuf";\n
214 \ \ load aborted.%
215 }%
216 {The first line of your library does not start with
217 the correct e-TeX header; you may need to update the
218 file to be compatible with the current version of
219 e-TeX, or you may simply have specified the wrong file.%
220 }%
221 \else
222 \et@xtoks={\et@xtoks={}}%
223 \et@xl@ad #1,\endl@ad
224 \et@xload {#2}
225 \the \et@xtoks
226 \fi
227 }
228
229 \load interactionmodes from etexdefs.lib %%% \load <foo>[, <bar>...] from <baz>
230
231 \def \@sk #1#2#3%
232 {\ifnum \interactionmode=\interactionmodes {errorstop} %%% V2.0;15
233 \def \pr@mpt {\csname #1 \endcsname}%
234 \edef \pr@mptloop {{\escapechar=-1 \global \readline 16 to \pr@mpt}}%
235 \loop \pr@mptloop
236 \ch@ckforyn \pr@mpt {#2}%
237 \ifb@dresponse
238 \message {Please answer Y[es] or N[o]}%
239 \repeat
240 \else
241 \def \pr@mpt {#3}%
242 \ch@ckforyn \pr@mpt {#2}%
243 \fi
244 }
245
246 \def \ch@ckforyn #1#2% Bernd Raichle's improved version, V1.0-1
247 {\edef \@nswer {#1}%
248 \def \p@rse ##1##2\endp@rse
249 {\lowercase {\if y##1}\b@dresponsefalse \csname #2true\endcsname
250 \else \lowercase {\if n##1}\b@dresponsefalse \csname #2false\endcsname
251 \else
252 \b@dresponsetrue
253 \fi
254 \fi
255 }%
256 \expandafter \p@rse \@nswer \endp@rse
257 }
258
259 \def \usef@llback %%% V1.0-3
260 {\message {Using fallback mode (USenglish)}%
261 \addlanguage {USenglish}{hyphen}{}{2}{3}%
262 }
263
264 % OK, that's all the utilities defined; on with the real work:
265 % First, re-instate \patterns:
266
267 \let \patterns=\et@xpatterns
268
269 % Define the language-handling commands
270
271 \def \et@xlang {\csname newlanguage\endcsname}
272
273 \def \uselanguage #1%
274 {\ifcsname lang@#1\endcsname
275 \language=\csname lang@#1\endcsname
276 \lefthyphenmin=\csname lhm@#1\endcsname
277 \righthyphenmin=\csname rhm@#1\endcsname
278 \ifdefined \uselanguage@hook % V1.0-1
279 \uselanguage@hook {#1}% % V1.0-1
280 \fi
281 \else
282 \et@xerr {language #1 undefined.}%
283 {You are trying to use a language which has not previously
284 been defined; remember that any language you want to use
285 will need to have been specified at the time the format
286 was created.%
287 }%
288 \fi
289 }
290
291 \def \addlanguage #1#2#3#4#5% language patterns exceptions lhm rhm
292 {\expandafter \et@xlang \csname lang@#1\endcsname
293 \expandafter \chardef \csname lhm@#1\endcsname=#4 % V1.0-1
294 \expandafter \chardef \csname rhm@#1\endcsname=#5 % V1.0-1
295 \uselanguage {#1}%
296 \input #2
297 \if *#3*\else \input #3 \fi
298 \ifdefined \addlanguage@hook % V1.0-4
299 \addlanguage@hook {#1}% % V1.0-4
300 \fi
301 \edef \fmtversion {\fmtversion/#1}%
302 }
303
304 % Decrement \count 19, because \newlanguage will increment it again
305
306 \advance \count 19 by -1
307
308 % We are about to try to process a user/site-specific file "language.def",
309 % which establishes a Babel-like language selection environment. Since
310 % there is always a risk of a spurious file of that name being found,
311 % we look for an e-TeX header in the first line. If the file can be opened,
312 % but doesn't have the right header, we interrogate the user as to whether
313 % to use fallback mode; in this mode, we simply establish USenglish as the
314 % sole language, with the et@x patterns, exceptions and left- and right-
315 % hyphen minima for TeX. If we can't interrogate the user (e.g. not in
316 % \errorstopmode), or if the user elects not to use fallback, we abort;
317 % if the file can't be found/opened, we use fallback unconditionally.
318
319 \newif \ifb@dresponse
320 \newif \ifusef@llback
321
322 \def \l@ngdefnfile {language.def}
323
324 \etexhdrchk {file} {\l@ngdefnfile}
325 \ifcase \etexstatus
326 \et@xwarn {unable to open file "\l@ngdefnfile";}%
327 \usef@llback % unable to open "language.def"
328 \or
329 \et@xwarn {file "\l@ngdefnfile" has wrong header;\n
330 \ \ expected: "\et@xfilehdr"; found: "\et@xbuf";%
331 }%
332 \@sk {Use fallback?} {usef@llback} {y}%
333 \ifusef@llback
334 \usef@llback
335 \else
336 \input \l@ngdefnfile % use "language.def" after warning
337 \fi
338 \else
339 \input \l@ngdefnfile % "language.def" open & valid
340 \fi
341
342 % All that was just to set up natural language handling...
343 % The "real" work of "etex.src", however, is to augment the non-primitives
344 % of Plain.TeX to incorporate e-TeX specific features, and to add new
345 % non-primitives to simplify access to new e-TeX specific primitives.
346
347 \message {Augmenting the Plain TeX definitions:}
348 \message {\string \tracingall;}
349
350 \def \tracingall
351 {\tracingonline=\@ne
352 \tracingcommands=\thr@@ % plain.tex has \tw@
353 \tracingstats=\tw@
354 \tracingpages=\@ne
355 \tracingoutput=\@ne
356 \tracinglostchars=\tw@ % plain.tex has \@ne
357 \tracingmacros=\tw@
358 \tracingparagraphs=\@ne
359 \tracingrestores=\@ne
360 \showboxbreadth=\maxdimen
361 \showboxdepth=\maxdimen
362 \errorstopmode
363 \tracinggroups=\@ne
364 \tracingifs=\@ne
365 \tracingscantokens=\@ne
366 \tracingnesting=\@ne
367 \tracingassigns=\tw@
368 }
369
370 \message {Adding new e-TeX definitions:}
371
372 \message {\string \eTeX,}
373 \def \eTeX {$\varepsilon$-\TeX} %%% the simple version, not suitable for maths;
374 %%% a more sophisticated one may find its way
375 %%% into "etexdefs.lib" in due course.
376
377 \message {\string \loggingall,}
378 \def \loggingall {\tracingall \tracingonline=\z@}
379
380 \message {\string \tracingnone,}
381 \def \tracingnone
382 {\tracingassigns=\z@
383 \tracingnesting=\z@
384 \tracingscantokens=\z@
385 \tracingifs=\z@
386 \tracinggroups=\z@
387 \showboxdepth=\thr@@
388 \showboxbreadth=5
389 \tracingrestores=\z@
390 \tracingparagraphs=\z@
391 \tracingmacros=\z@
392 \tracinglostchars=\@ne
393 \tracingoutput=\z@
394 \tracingpages=\z@
395 \tracingstats=\z@
396 \tracingcommands=\z@
397 \tracingonline=\z@
398 }
399
400 \message {register allocation;}
401
402 \newcount \et@xins % our insertion counter (\insc@unt is used differently)
403
404 % We have to adjust the Plain TeX register allocation counts for our
405 % slightly modified book-keeping:
406
407 \advance \count 10 by 1 % \count 10=23 % allocates \count registers 23, 24, ...
408 \advance \count 11 by 1 % \count 11=10 % allocates \dimen registers 10, 11, ...
409 \advance \count 12 by 1 % \count 12=10 % allocates \skip registers 10, 11, ...
410 \advance \count 13 by 1 % \count 13=10 % allocates \muskip registers 10, 11, ...
411 \advance \count 14 by 1 % \count 14=10 % allocates \box registers 10, 11, ...
412 \advance \count 15 by 1 % \count 15=10 % allocates \toks registers 10, 11, ...
413 \advance \count 16 by 1 % \count 16=0 % allocates input streams 0, 1, ...
414 \advance \count 17 by 1 % \count 17=0 % allocates output streams 0, 1, ...
415 \advance \count 18 by 1 % \count 18=4 % allocates math families 4, 5, ...
416 \advance \count 19 by 1 % \count 19=0 % allocates \language codes 0, 1, ...
417
418 \et@xins=\insc@unt % \et@xins=255 % allocates insertions 254, 253, ...
419
420 % We don't change the Plain TeX definitions of \newcount, etc., but the
421 % \alloc@ macro doing the actual work is redefined.
422
423 % When the normal register pool for \count, \dimen, \skip, \muskip,
424 % \box, or \toks registers is exhausted, we switch to the extended pool.
425
426 \def \alloc@ #1#2#3#4#5%
427 {\ifnum \count 1#1 < #4% make sure there's still room
428 \allocationnumber=\count 1#1
429 \global \advance \count 1#1 by \@ne
430 \global #3#5=\allocationnumber
431 \wlog {\string #5=\string #2\the \allocationnumber}%
432 \else \ifnum #1 < 6
433 \begingroup \escapechar=\m@ne
434 \expandafter \alloc@@ \expandafter {\string #2}#5%
435 \else
436 \errmessage {No room for a new #2}%
437 \fi
438 \fi
439 }
440
441 % The \expandafter construction used here allows the generation of
442 % \newcount and \globcount from #1=count. Moreover (and more important)
443 % this construction avoids the appearance of \outer macros inside
444 % macro definitions or conditionals.
445
446 \def \alloc@@ #1#2%
447 {\endgroup % restore \escapechar
448 \message {Normal \csname#1\endcsname register pool exhausted,
449 switching to extended pool.}%
450 \global \expandafter
451 \let \csname new#1\expandafter \endcsname \csname glob#1\endcsname
452 \csname new#1\endcsname#2%
453 }
454
455 % We do change the Plain TeX definition of \newinsert
456
457 \outer \def \newinsert #1%make sure there's still room for ...
458 {\ch@ck 0 \et@xins \count % ... a \count, ...
459 {\ch@ck 1 \et@xins \dimen % ... \dimen, ...
460 {\ch@ck 2 \et@xins \skip % ... \skip, ...
461 {\ch@ck 4 \et@xins \box % ... and \box register
462 {\global \advance \et@xins by \m@ne
463 \unless
464 \ifnum \insc@unt < \et@xins
465 \global \insc@unt=\et@xins
466 \fi
467 \allocationnumber=\et@xins
468 \global \chardef #1=\allocationnumber
469 \wlog {\string #1=\string \insert \the \allocationnumber}%
470 }%
471 }%
472 }%
473 }%
474 }
475
476 \def \ch@ck #1#2#3#4%
477 {\ifnum \count 1#1 < #2#4\else \errmessage {No room for a new #3}\fi}
478
479 % And we define \reserveinserts, so that you can say \reserveinserts{17}
480 % in order to reserve room for up to 17 additional insertion classes that will
481 % not be taken away by \newcount, \newdimen, \newskip, or \newbox.
482
483 \outer \def \reserveinserts#1%
484 {\global \insc@unt=\numexpr \et@xins \ifnum #1 > \z@ -#1\fi \relax}
485
486 \message {extended register allocation;}
487
488 % Now, we define \globcount, \globbox, etc., so that you can say
489 % \globcount\foo and \foo will be defined (with \countdef) to be the
490 % next count register from the vastly larger but somewhat less efficient
491 % extended register pool. We also define \loccount, etc., but these
492 % register definitions are local to the current group.
493
494 \count 260=277 % globally allocates \count registers 277, 278, ...
495 \count 261=\@cclvi % globally allocates \dimen registers 256, 257, ...
496 \count 262=\@cclvi % globally allocates \skip registers 256, 257, ...
497 \count 263=\@cclvi % globally allocates \muskip registers 256, 257, ...
498 \count 264=\@cclvi % globally allocates \box registers 256, 257, ...
499 \count 265=\@cclvi % globally allocates \toks registers 256, 257, ...
500 \count 266=\@ne % globally allocates \marks classes 1, 2, ...
501
502 \def \et@xmaxregs {32768}
503
504 \count 270=\et@xmaxregs % locally allocates \count registers 32767, 32766, ...
505 \count 271=\et@xmaxregs % ditto for \dimen registers
506 \count 272=\et@xmaxregs % ditto for \skip registers
507 \count 273=\et@xmaxregs % ditto for \muskip registers
508 \count 274=\et@xmaxregs % ditto for \box registers
509 \count 275=\et@xmaxregs % ditto for \toks registers
510 \count 276=\et@xmaxregs % ditto for \marks classes
511
512 % \count registers 256-259 and 267-269 are not (yet) used
513
514 \outer \def \globcount {\et@xglob 0 \count \countdef}
515 \def \loccount {\et@xloc 0 \count \countdef}
516 \outer \def \globdimen {\et@xglob 1 \dimen \dimendef}
517 \def \locdimen {\et@xloc 1 \dimen \dimendef}
518 \outer \def \globskip {\et@xglob 2 \skip \skipdef}
519 \def \locskip {\et@xloc 2 \skip \skipdef}
520 \outer \def \globmuskip {\et@xglob 3 \muskip \muskipdef}
521 \def \locmuskip {\et@xloc 3 \muskip \muskipdef}
522 \outer \def \globbox {\et@xglob 4 \box \mathchardef}
523 \def \locbox {\et@xloc 4 \box \mathchardef}
524 \outer \def \globtoks {\et@xglob 5 \toks \toksdef}
525 \def \loctoks {\et@xloc 5 \toks \toksdef}
526 \outer \def \globmarks {\et@xglob 6 \marks \mathchardef}
527 \def \locmarks {\et@xloc 6 \marks \mathchardef}
528
529 \let\newmark=\globmarks %%% 2.0;14
530 \let\newmarks=\globmarks
531
532 \def \et@xglob #1#2#3#4%
533 {\et@xchk #1#2% make sure there's still room
534 {\allocationnumber=\count 26#1
535 \global \advance \count 26#1 by \@ne
536 \global #3#4=\allocationnumber
537 \wlog {\string #4=\string #2\the \allocationnumber}%
538 }%
539 }
540
541 \def \et@xloc#1#2#3#4%
542 {\et@xchk #1#2% make sure there's still room
543 {\advance \count 27#1 by \m@ne
544 \allocationnumber=\count 27#1
545 #3#4=\allocationnumber
546 \wlog {\string #4=\string #2\the \allocationnumber \space (local)}%
547 }%
548 }
549
550 \def \et@xchk #1#2#3%
551 {\ifnum \count 26#1 < \count 27#1
552 #3%
553 \else
554 \errmessage {No room for a new #2}%
555 \fi
556 }
557
558 % Next we define \globcountblk, \loccountblk, etc., so that one can
559 % write \globcountblk\foo{17} and \foo will be defined (with \mathchardef)
560 % as the first (the zeroth?) of a block of 17 consecutive registers.
561 % Thus the user is intended to reference elements <\foo+0> to <\foo+n-1>,
562 % where n is the length of the block allocated.
563
564 \outer \def \globcountblk {\et@xgblk 0 \count}
565 \def \loccountblk {\et@xlblk 0 \count}
566 \outer \def \globdimenblk {\et@xgblk 1 \dimen}
567 \def \locdimenblk {\et@xlblk 1 \dimen}
568 \outer \def \globskipblk {\et@xgblk 2 \skip}
569 \def \locskipblk {\et@xlblk 2 \skip}
570 \outer \def \globmuskipblk {\et@xgblk 3 \muskip}
571 \def \locmuskipblk {\et@xlblk 3 \muskip}
572 \outer \def \globboxblk {\et@xgblk 4 \box}
573 \def \locboxblk {\et@xlblk 4 \box}
574 \outer \def \globtoksblk {\et@xgblk 5 \toks}
575 \def \loctoksblk {\et@xlblk 5 \toks}
576 \outer \def \globmarksblk {\et@xgblk 6 \marks}
577 \def \locmarksblk {\et@xlblk 6 \marks}
578
579 % And, both to provide a higher-level interface to the block allocation
580 % scheme, and to demonstrate possible applications of the new \...expr
581 % primitives, we also define \globcountvector and \loccountvector (etc)
582 % which allow the user to access elements with embedded arithmetic, as in
583
584 % \globcountvector \foo {12}
585 % \foo {\count 0 + 3} = \foo {\count 1 * 2}
586
587 \outer \def \globcountvector {\et@xgvec 0 \count}
588 \def \loccountvector {\et@xlvec 0 \count}
589 \outer \def \globdimenvector {\et@xgvec 1 \dimen}
590 \def \locdimenvector {\et@xlvec 1 \dimen}
591 \outer \def \globskipvector {\et@xgvec 2 \skip}
592 \def \locskipvector {\et@xlvec 2 \skip}
593 \outer \def \globmuskipvector {\et@xgvec 3 \muskip}
594 \def \locmuskipvector {\et@xlvec 3 \muskip}
595 \outer \def \globboxvector {\et@xgvec 4 \box}
596 \def \locboxvector {\et@xlvec 4 \box}
597 \outer \def \globtoksvector {\et@xgvec 5 \toks}
598 \def \loctoksvector {\et@xlvec 5 \toks}
599 \outer \def \globmarksvector {\et@xgvec 6 \marks}
600 \def \locmarksvector {\et@xlvec 6 \marks}
601
602 \def \et@xgblk #1#2#3#4%
603 {\et@xchkblk #1#2{#4}% make sure there's still room
604 {\allocationnumber=\count 26#1
605 \global \advance \count 26#1 by #4%
606 \global \mathchardef #3=\allocationnumber
607 \wlog {\string #3=\string #2blk{\number #4} at \the \allocationnumber}%
608 }%
609 }
610
611 \def \et@xlblk #1#2#3#4%
612 {\et@xchkblk #1#2{#4}% make sure there's still room
613 {\advance \count 27#1 by -#4%
614 \allocationnumber=\count 27#1
615 \mathchardef #3=\allocationnumber
616 \wlog {\string #3=\string #2blk{\number #4}
617 at \the \allocationnumber \space (local)%
618 }%
619 }%
620 }
621
622 \begingroup
623 \catcode `\# = 12
624 \gdef \et@xhash {#}
625 \endgroup
626
627 \def \et@xgvec #1#2#3#4%
628 {\et@xchkblk #1#2{#4}% make sure there's still room
629 {\allocationnumber=\count 26#1
630 \global \advance \count 26#1 by #4%
631 \ifx #2\box
632 \def \2{}%
633 \else \ifx #2\marks
634 \def \2{}%
635 \else
636 \def \2{\string #2}%
637 \fi
638 \fi
639 \xdef #3##1{\2 \noexpand \numexpr \the \allocationnumber+##1\relax}%
640 \wlog {\string #3 {\et@xhash 1} =
641 \2 {\the \allocationnumber+\et@xhash 1} (global #2 vector)%
642 }%
643 }%
644 }
645
646 \def \et@xlvec #1#2#3#4%
647 {\et@xchkblk #1#2{#4}% make sure there's still room
648 {\advance \count 27#1 by -#4%
649 \allocationnumber=\count27#1
650 \mathchardef #3=\allocationnumber
651 \ifx #2\box
652 \def \2{}%
653 \else \ifx #2\marks
654 \def \2{}%
655 \else
656 \def \2{\string #2}%
657 \fi
658 \fi
659 \edef #3##1{\2 \noexpand \numexpr \the \allocationnumber+##1\relax}%
660 \wlog {\string #3 {\et@xhash 1} =
661 \2 {\the \allocationnumber+\et@xhash 1} (local #2 vector)%
662 }%
663 }%
664 }
665
666 \def \et@xchkblk #1#2#3#4%
667 {\ifnum #3 < \z@
668 \errmessage {Negative register block size \number #3}%
669 \else \ifnum \numexpr \count 26#1+#3 > \count 27#1
670 \errmessage {No room for new #2block of size \number#3}%
671 \else
672 #4%
673 \fi
674 \fi
675 }
676
677 % In an attempt to reduce the overheads of e-TeX, we recycle all possible
678 % resources, including (as a penultimate step) the recycler itself...
679 % The user can circumvent (or force) this during format creation,
680 % by \letting \ifrecycle=\iffalse (or \iftrue, to force it).
681
682 % As this file has grown by accretion, it is possible that we are no
683 % longer recycling all the resources we could; this will be investigated.
684
685 \def \mayber@cycle {\expandafter \ifrecycle}
686 \def \forcer@cycle {\expandafter \iftrue}
687
688 \ifdefined \ifrecycle
689 \mayber@cycle
690 \else
691 \forcer@cycle
692 \fi
693
694 % There's a concealed \if... lurking here, which explains the
695 % strange indentation of the code that follows (V1.0-1)
696
697 \def \r@cycle #1%
698 {\ifdefined #1
699 \message {\string #1,}\let #1=\und@fined
700 \else
701 \message {\string #1 (not defined),}
702 \fi
703 }
704 {\newlinechar=`\! \message {!Recycling:}}
705
706 \r@cycle \addlanguage
707 \r@cycle \@nswer
708 \r@cycle \@sk
709 \r@cycle \b@dresponsetrue
710 \r@cycle \b@dresponsefalse
711 \r@cycle \ch@ckforyn
712 \r@cycle \mayber@cycle
713 \r@cycle \et@xabort
714 \r@cycle \et@xbuf
715 \r@cycle \et@xfmtsrc
716 \r@cycle \et@xfilehdr
717 \r@cycle \et@xinf
718 \r@cycle \et@xpatterns
719 % \r@cycle \ifb@dresponse
720 % \r@cycle \ifusef@llback
721 \r@cycle \l@ngdefnfile
722 \r@cycle \n@xt
723 \r@cycle \p@rse
724 \r@cycle \pr@mpt
725 \r@cycle \pr@mptloop
726 \r@cycle \forcer@cycle
727 \r@cycle \usef@llback
728 \r@cycle \usef@llbacktrue
729 \r@cycle \usef@llbackfalse
730
731 % The following are retained, since they may be needed by user code; with a few
732 % (regrettable) exceptions, all of these are given the \etex or \et@x prefix,
733 % to reduce as far as possible the risk of them clashing with other used-defined
734 % names.
735
736 % The e-TeX team are willing to change the names of the remaining, at-risk,
737 % control sequences if it is demonstrated that the current names cause problems
738 % or difficulties.
739
740 \def \r@tain #1%
741 {\ifdefined #1
742 \message {\string #1,}
743 \else
744 \message {\string #1 (not defined),}
745 \fi
746 }
747 {\newlinechar=`\! \message {!Retaining:}}
748
749 \r@tain \et@xerr
750 \r@tain \et@xinput
751 \r@tain \et@xlibhdr
752 \r@tain \et@xmsg
753 \r@tain \et@xtoks
754 \r@tain \et@xwarn
755 \r@tain \et@xl@@d
756 \r@tain \et@xl@ad
757 \r@tain \et@xload
758 \r@tain \et@xlang
759 \r@tain \et@xhash
760 \r@tain \eTeX
761 \r@tain \etexhdrchk
762 % \r@tain \endmodule
763 \r@tain \etexstatus
764 \r@tain \module
765 \r@tain \uselanguage
766
767 \r@cycle \r@tain
768 \r@cycle \r@cycle
769
770 \fi
771
772 % And finally re-catcode commercial-at
773
774 \catcode `\@=12
775 \endinput
776
777 %% Revision-history:
778
779 01-FEB-1999: 2.1;0 Allow file to be used with e-TeX versions 2.0 and 2.1
780
781 25-MAR-1998: 2.0;19 Improved log message for \{glob|loc}{marks|box}vector (PEB)
782
783 24-MAR-1998: 2.0;18 Optimisation of one section made (DC & PEB),
784 a couple of \if tests made more robust,
785 and spacing improved in one macro.
786
787 24-MAR-1998: 2.0;17 Coding styles unified and all references to Peter
788 Breitenlohner eliminated from main code
789
790 23-MAR-1998: 2.0;16 Continued from 2.0;15
791
792 20-MAR-1998: 2.0;15 Changes made here and in "etexdefs.lib" to
793 improve compatibility with LaTeX, and
794 \{glob,loc}{marks,box}vector re-thought.
795
796 11-MAR-1998: 2.0;14 \newmark made synonym for \newmarks / PT
797
798 10-MAR-1998: 2.0;13 Missing brace re-inserted in \...lvec /PT
799
800 10-MAR-1998: 2.0;12 Typo corrected in Peter's name /PT
801
802 10-MAR-1998: 2.0;11 "\...lvec" failed to use \et@xhash; fixed / PT
803
804 10-MAR-1998: 2.0;10 \h@sh -> \et@xhash /PT
805
806 06-MAR-1998: 2.0;9 Final tweaks by PEB !
807
808 05-MAR-1998: <missing version number> Final tweaks by PT
809
810 28-Feb-1998: 2.0;8 Major re-work by PEB
811
812 24-Feb-1998: 2.0;7 \tracingnesting -> \tw@
813
814 24-FEB-1998: 2.0;6 version-mismatch reduced in severity;
815 \tracingall and ...none improved;
816 aesthetic spaces around "=" removed
817
818 24-Jan-1998: 2.0;5: block allocation of registers added
819
820 21-Jan-1998: 2.0;4: released to e-TeX team for testing/comments
821
822 20-Jan-1998: \glob... implemented, and coding simplified by
823 the implementation and use of of \max@xpr
824
825 06-Jan-1998: Alpha-testing complete of extended and local register allocation.
826
827 29-Dec-1997: The "%!" convention replaced by a corresponding "%%":
828 this should avoid any inadvertent conflict with Adobe conventions.
829
830 \tracingall augmented with
831 \tracinglostchars=\tw@ %%% Q -- should this be default?
832 \tracingnesting=\@ne
833
834 \tracingnone augmented.
835
836 05-DEC-1997: A long-standing bug removed: left- and right- hyphenmin
837 were transposed in fallback mode :-(((((
838
839 24-APR-1997: An interim release, to provide compatibility with Peter's
840 naming conventions for beta-test versions of e-TeX V2.
841 Consistency checking is now restricted to \eTeXversion,
842 and \eTeXrevision is ignored.
843
844 01-NOV-1996: V1.1;5: Final stage? Checking that everything possible
845 is recycled whilst nothing that is needed is lost. Retained
846 names given \etex or \et@x prefix wherever possible. Some
847 potentially dangerous cs-names commented out of the recycle/retain
848 lists because they were synonyms of members of the if-else-fi set.
849 The definition of the e-TeX logo added: this had somehow slipped
850 through the net! Intended to be the final revision before public
851 release, but awaiting comments from other members of the team.
852
853 31-OCT-1996: V1.1;4: errors noticed while proof-reading corrected; far
854 greater use made of concealed control sequences with
855 commercial-at (@); library file headers differentiated
856 from ordinary file headers; return-values for header-check
857 altered to allow fall-thru' if ok; fallback-use algorithm
858 significantly modified (major semantic shift).
859
860 29-OCT-1996: V1.1;3: tidying up prior to release; careful check on
861 which control words can be re-cycled; \recycle made more
862 robust, to check whether one is trying to re-cycle something
863 that was never 'cycled' in the first place (PEB suggestion);
864 \et@xmsg re-written to use \message or \errmessage as necessary;
865 \errhelps provided for all places they might be referenced.
866
867 27-OCT-1996: V1.1;2: minor version numbers re-introduced, using semi-colon
868 as delimiter and stopping pattern matching at the semi-colon;
869 \et@xfilehdr defined dynamically, based in \eTeXversion and
870 \eTeXrevision; \load now uses \etexhdrchk, so library
871 files are required to start with an e-TeX header; this will
872 have implications when e-TeX -> V2+, so this code should be
873 re-considered at this point.
874
875 17-OCT-1996: V1.1: minor version numbers eliminated, to reduce the
876 need for users to update their "language.def" files.
877
878 17-OCT-1996: V1.0-4: \addlanguage@hook added, version history moved to end.
879
880 17-OCT-1996: Version 1.0-3 does away with the "fallback" file.
881
882 16-OCT-1996: Version 1.0-2 implements module handling, so constant "3"
883 no longer used (see below).
884
885 13-Oct-1996: Replaced \def by \chardef where possible;
886 eliminated dependency on "etexdefs.def", hard-coding
887 in the constant "3" (with comment) instead;
888 used Bernd's \ch@ckforyn;
889 re-catcoded `\@ earlier, to reduce number of \[if]csnames;
890 commented the strange indentation of the \recycles at end.
891
892 11-Oct-1996: language handling commands modified (V1.0): PT/BR