From 868ed760a9b6b4748e6f6766f96a8546b3a7e5a1 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Fri, 20 Mar 2009 10:32:26 +0000 Subject: new build system git-svn-id: svn://tug.org/texlive/trunk@12462 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/alephdir/alephextra-rc1.h | 36 - Build/source/texk/web2c/alephdir/alephextra-rc2.h | 37 - Build/source/texk/web2c/alephdir/alephextra.h | 37 + Build/source/texk/web2c/alephdir/com16bit-rc1.ch | 2507 ------------------ Build/source/texk/web2c/alephdir/com16bit-rc2.ch | 2825 --------------------- Build/source/texk/web2c/alephdir/com16bit.ch | 2825 +++++++++++++++++++++ Build/source/texk/web2c/alephdir/comsrcspec.ch | 2 +- Build/source/texk/web2c/alephdir/eo16bit-rc1.ch | 696 ----- Build/source/texk/web2c/alephdir/eo16bit-rc2.ch | 696 ----- Build/source/texk/web2c/alephdir/eo16bit-rc3.ch | 759 ------ Build/source/texk/web2c/alephdir/eo16bit.ch | 696 +++++ Build/source/texk/web2c/alephdir/eochar-rc1.ch | 0 Build/source/texk/web2c/alephdir/eochar-rc2.ch | 158 -- Build/source/texk/web2c/alephdir/eochar.ch | 158 ++ Build/source/texk/web2c/alephdir/eomem-rc1.ch | 321 --- Build/source/texk/web2c/alephdir/eomem-rc2.ch | 330 --- Build/source/texk/web2c/alephdir/eomem-rc3.ch | 498 ---- Build/source/texk/web2c/alephdir/eomem.ch | 330 +++ Build/source/texk/web2c/alephdir/eonewdir-rc1.ch | 0 Build/source/texk/web2c/alephdir/eonewdir-rc2.ch | 52 - Build/source/texk/web2c/alephdir/eonewdir.ch | 52 + Build/source/texk/web2c/alephdir/eopage-rc1.ch | 0 Build/source/texk/web2c/alephdir/eopage-rc2.ch | 180 -- Build/source/texk/web2c/alephdir/eopage.ch | 180 ++ Build/source/texk/web2c/alephdir/eover-rc1.ch | 21 - Build/source/texk/web2c/alephdir/eover-rc2.ch | 230 -- Build/source/texk/web2c/alephdir/eover.ch | 230 ++ 27 files changed, 4509 insertions(+), 9347 deletions(-) delete mode 100644 Build/source/texk/web2c/alephdir/alephextra-rc1.h delete mode 100644 Build/source/texk/web2c/alephdir/alephextra-rc2.h create mode 100644 Build/source/texk/web2c/alephdir/alephextra.h delete mode 100644 Build/source/texk/web2c/alephdir/com16bit-rc1.ch delete mode 100644 Build/source/texk/web2c/alephdir/com16bit-rc2.ch create mode 100644 Build/source/texk/web2c/alephdir/com16bit.ch delete mode 100644 Build/source/texk/web2c/alephdir/eo16bit-rc1.ch delete mode 100644 Build/source/texk/web2c/alephdir/eo16bit-rc2.ch delete mode 100644 Build/source/texk/web2c/alephdir/eo16bit-rc3.ch create mode 100644 Build/source/texk/web2c/alephdir/eo16bit.ch delete mode 100644 Build/source/texk/web2c/alephdir/eochar-rc1.ch delete mode 100644 Build/source/texk/web2c/alephdir/eochar-rc2.ch create mode 100644 Build/source/texk/web2c/alephdir/eochar.ch delete mode 100644 Build/source/texk/web2c/alephdir/eomem-rc1.ch delete mode 100644 Build/source/texk/web2c/alephdir/eomem-rc2.ch delete mode 100644 Build/source/texk/web2c/alephdir/eomem-rc3.ch create mode 100644 Build/source/texk/web2c/alephdir/eomem.ch delete mode 100644 Build/source/texk/web2c/alephdir/eonewdir-rc1.ch delete mode 100644 Build/source/texk/web2c/alephdir/eonewdir-rc2.ch create mode 100644 Build/source/texk/web2c/alephdir/eonewdir.ch delete mode 100644 Build/source/texk/web2c/alephdir/eopage-rc1.ch delete mode 100644 Build/source/texk/web2c/alephdir/eopage-rc2.ch create mode 100644 Build/source/texk/web2c/alephdir/eopage.ch delete mode 100644 Build/source/texk/web2c/alephdir/eover-rc1.ch delete mode 100644 Build/source/texk/web2c/alephdir/eover-rc2.ch create mode 100644 Build/source/texk/web2c/alephdir/eover.ch (limited to 'Build/source/texk/web2c/alephdir') diff --git a/Build/source/texk/web2c/alephdir/alephextra-rc1.h b/Build/source/texk/web2c/alephdir/alephextra-rc1.h deleted file mode 100644 index 7953d08adc9..00000000000 --- a/Build/source/texk/web2c/alephdir/alephextra-rc1.h +++ /dev/null @@ -1,36 +0,0 @@ -/* alephextra.h: banner etc. for Aleph. - - This is included by Aleph, from ../alephextra.c - (generated from ../lib/texmfmp.c). - -This file is part of Aleph. - -Copyright (c) 2004 the Aleph team - -Aleph is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -Aleph is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Aleph; if not, write to the Free Software Foundation, Inc., -59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - -*/ - -#define BANNER "This is Aleph, Version 3.1415926--1.15--2.1 (RC1)" -#define COPYRIGHT_HOLDER "the Aleph task force" -#define AUTHOR NULL -#define PROGRAM_HELP ALEPHHELP -#define DUMP_VAR TEXformatdefault -#define DUMP_LENGTH_VAR formatdefaultlength -#define DUMP_OPTION "fmt" -#define DUMP_EXT ".fmt" -#define INPUT_FORMAT kpse_tex_format -#define INI_PROGRAM "inialeph" -#define VIR_PROGRAM "viraleph" diff --git a/Build/source/texk/web2c/alephdir/alephextra-rc2.h b/Build/source/texk/web2c/alephdir/alephextra-rc2.h deleted file mode 100644 index a7632dc8cfa..00000000000 --- a/Build/source/texk/web2c/alephdir/alephextra-rc2.h +++ /dev/null @@ -1,37 +0,0 @@ -/* alephextra.h: banner etc. for Aleph. - - This is included by Aleph, from ../alephextra.c - (generated from ../lib/texmfmp.c). - -This file is part of Aleph. - -Copyright (C) 2004 the Aleph team - -Aleph is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -Aleph is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Aleph; if not, write to the Free Software Foundation, Inc., -59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - -*/ - -#define BANNER "This is Aleph, Version 3.1415926-1.15-2.1-0.0-rc4" -#define COPYRIGHT_HOLDER "Aleph task force" -#define AUTHOR NULL -#define PROGRAM_HELP ALEPHHELP -#define BUG_ADDRESS "tex-k@tug.org" -#define DUMP_VAR TEXformatdefault -#define DUMP_LENGTH_VAR formatdefaultlength -#define DUMP_OPTION "fmt" -#define DUMP_EXT ".fmt" -#define INPUT_FORMAT kpse_tex_format -#define INI_PROGRAM "inialeph" -#define VIR_PROGRAM "viraleph" diff --git a/Build/source/texk/web2c/alephdir/alephextra.h b/Build/source/texk/web2c/alephdir/alephextra.h new file mode 100644 index 00000000000..a7632dc8cfa --- /dev/null +++ b/Build/source/texk/web2c/alephdir/alephextra.h @@ -0,0 +1,37 @@ +/* alephextra.h: banner etc. for Aleph. + + This is included by Aleph, from ../alephextra.c + (generated from ../lib/texmfmp.c). + +This file is part of Aleph. + +Copyright (C) 2004 the Aleph team + +Aleph is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +Aleph is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Aleph; if not, write to the Free Software Foundation, Inc., +59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#define BANNER "This is Aleph, Version 3.1415926-1.15-2.1-0.0-rc4" +#define COPYRIGHT_HOLDER "Aleph task force" +#define AUTHOR NULL +#define PROGRAM_HELP ALEPHHELP +#define BUG_ADDRESS "tex-k@tug.org" +#define DUMP_VAR TEXformatdefault +#define DUMP_LENGTH_VAR formatdefaultlength +#define DUMP_OPTION "fmt" +#define DUMP_EXT ".fmt" +#define INPUT_FORMAT kpse_tex_format +#define INI_PROGRAM "inialeph" +#define VIR_PROGRAM "viraleph" diff --git a/Build/source/texk/web2c/alephdir/com16bit-rc1.ch b/Build/source/texk/web2c/alephdir/com16bit-rc1.ch deleted file mode 100644 index be4007cdfbb..00000000000 --- a/Build/source/texk/web2c/alephdir/com16bit-rc1.ch +++ /dev/null @@ -1,2507 +0,0 @@ -% com16bit.ch: Aleph version of file tex.ch -% -% tex.ch for C compilation with web2c, derived from various other change files. -% By Tim Morgan, UC Irvine ICS Department, and many others. -% -% (05/28/86) ETM Started with TeX 2.0 -% (06/03/87) ETM Brought up to TeX 2.2 -% (09/26/87) ETM Brought up to TeX 2.3 -% (10/01/87) ETM Brought up to TeX 2.5 -% (12/21/87) ETM Brought up to TeX 2.7 -% (01/14/88) ETM Brought up to TeX 2.9 -% (02/20/88) PAM Revised format and module numbers -% (03/01/88) ETM Eliminated some unused variables and unnecesary tests -% (05/09/88) ETM Added yet another casting bug fix -% (06/21/88) ETM Brought up to TeX version 2.93 -% (12/11/88) ETM Brought up to TeX version 2.94 -% (01/12/89) PAM Brought up to TeX version 2.95 -% (02/14/89) ETM Brought up to TeX version 2.96 -% (03/10/89) ETM Brought up to TeX version 2.98 -% (07/06/89) ETM Brought up to TeX version 2.991 -% (11/30/89) KB To version 2.992 (8-bit). -% (01/10/90) SR To version 2.993. -% (03/27/90) KY To version 3.0. -% (more recent changes in ChangeLog) -% -% The TeX program is copyright (C) 1982 by D. E. Knuth. -% TeX is a trademark of the American Mathematical Society. -% -% The module numbers in this change file refer to TEX.WEB 3.141592 as -% of March, 1995 (published as Donald E. Knuth, TeX: The Program, -% Volume B of Computers & Typesetting). - -@x [0.0] l.83 - WEAVE: print changes only. - \def\?##1]{\hbox to 1in{\hfil##1.\ }} - } -@y 83 - \def\?##1]{\hbox{Changes to \hbox to 1em{\hfil##1}.\ }} - } -\let\maybe=\iffalse -@z - -@x -@d banner=='This is Aleph, Version 3.1415926--1.15--2.1 (RC1)' {printed when \TeX\ starts} -@y -@d banner=='This is Aleph, Version 3.1415926--1.15--2.1 (RC1)' {printed when \TeX\ starts} -@d banner_k=='This is Alephk, Version 3.1415926--1.15--2.1 (RC1)' {printed when \TeX\ starts} -@z - -@x [1.4] l.233 - program header -Actually the heading shown here is not quite normal: The |program| line -does not mention any |output| file, because \ph\ would ask the \TeX\ user -to specify a file name if |output| were specified here. -@^system dependencies@> -@y -@z - -@x [1.4] l.243 - labels in outer block not needed -program OMEGA; {all file names are defined dynamically} -label @@/ -@y -program OMEGA; {all file names are defined dynamically} -@z - -@x [1.6] l.267 - labels in outer block not needed -@ Three labels must be declared in the main program, so we give them -symbolic names. - -@d start_of_TEX=1 {go here when \TeX's variables are initialized} -@d end_of_TEX=9998 {go here to close files and terminate gracefully} -@d final_end=9999 {this label marks the ending of the program} - -@= -start_of_TEX@t\hskip-2pt@>, end_of_TEX@t\hskip-2pt@>,@,final_end; - {key control points} -@y -@ For Web2c, labels are not declared in the main program, but -we still have to declare the symbolic names. - -@d start_of_TEX=1 {go here when \TeX's variables are initialized} -@d final_end=9999 {this label marks the ending of the program} -@z - -% Here we change these WEB symbols, which are used much as #ifdef's -% are in C, into something which will get translated into actual #ifdef's. -@x [1.7] l.292 - debug..gubed, stat..tats -@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging} -@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging} -@y -@d debug==ifdef('TEXMF_DEBUG') -@d gubed==endif('TEXMF_DEBUG') -@z -@x [1.7] l.297 - debug..gubed, stat..tats -@d stat==@{ {change this to `$\\{stat}\equiv\null$' when gathering - usage statistics} -@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$' when gathering - usage statistics} -@y -@d stat==ifdef('STAT') -@d tats==endif('STAT') -@z - -@x [1.8] l.312 - Same, for `init...tini'. -@d init== {change this to `$\\{init}\equiv\.{@@\{}$' in the production version} -@d tini== {change this to `$\\{tini}\equiv\.{@@\}}$' in the production version} -@y 312 -@d init==ifdef('INITEX') -@d tini==endif('INITEX') -@z - -@x [1.8] l.319 - init...tini is dynamic -@!init @@;@+tini -@y 318 -@!init -if ini_version then - begin @@; - end; -@+tini -@z - -@x [1.11] l.375 - Compile-time constants: most removed for dynamic allocation. -@= -@!mem_max=30000; {greatest index in \TeX's internal |mem| array; - must be strictly less than |max_halfword|; - must be equal to |mem_top| in \.{INITEX}, otherwise |>=mem_top|} -@!mem_min=0; {smallest index in \TeX's internal |mem| array; - must be |min_halfword| or more; - must be equal to |mem_bot| in \.{INITEX}, otherwise |<=mem_bot|} -@!buf_size=500; {maximum number of characters simultaneously present in - current lines of open files and in control sequences between - \.{\\csname} and \.{\\endcsname}; must not exceed |max_halfword|} -@!error_line=72; {width of context lines on terminal error messages} -@!half_error_line=42; {width of first lines of contexts in terminal - error messages; should be between 30 and |error_line-15|} -@!max_print_line=79; {width of longest text lines output; should be at least 60} -@!stack_size=200; {maximum number of simultaneous input sources} -@!max_in_open=6; {maximum number of input files and error insertions that - can be going on simultaneously} -@y -@d file_name_size == maxint -@d ssup_error_line = 255 -@d ssup_max_strings ==200000 -{Larger values may be used, but then the arrays consume much more memory.} -@d ssup_trie_opcode == 65535 -@d ssup_trie_size == 4194303 - -@d ssup_hyph_size == 65535 {Changing this requires changing (un)dumping!} -@d iinf_hyphen_size == 610 {Must be not less than |hyph_prime|!} - -@= -@!mem_bot=0; {smallest index in the |mem| array dumped by \.{INITEX}; - must not be less than |mem_min|} - {Use |mem_bot=0| for compilers which cannot decrement pointers.} -@z - -@x -@!font_max=65535; {maximum internal font number; must be at most |font_biggest|} -@!param_size=60; {maximum number of simultaneous macro parameters} -@!nest_size=40; {maximum number of semantic levels simultaneously active} -@!max_strings=3000; {maximum number of strings; must not exceed |max_halfword|} -@!string_vacancies=8000; {the minimum number of characters that should be - available for the user's control sequences and font names, - after \TeX's own error messages are stored} -@!pool_size=32000; {maximum number of characters in strings, including all - error messages and help texts, and the names of all fonts and - control sequences; must exceed |string_vacancies| by the total - length of \TeX's own strings, which is currently about 23000} -@!save_size=600; {space for saving values outside of current group; must be - at most |max_halfword|} -@!trie_size=8000; {space for hyphenation patterns; should be larger for - \.{INITEX} than it is in production versions of \TeX} -@!trie_op_size=500; {space for ``opcodes'' in the hyphenation patterns} -@!dvi_buf_size=800; {size of the output buffer; must be a multiple of 8} -@!file_name_size=40; {file names shouldn't be longer than this} -@!pool_name='TeXformats:ALEPH.POOL '; - {string of length |file_name_size|; tells where the string pool appears} -@y -@!font_max=65535; {maximum internal font number; must be at most |font_biggest|} -@!hash_offset=514; {smallest index in hash array, i.e., |hash_base| } - {Use |hash_offset=0| for compilers which cannot decrement pointers.} -@!trie_op_size=15011; {space for ``opcodes'' in the hyphenation patterns; - best if relatively prime to 313, 361, and 1009.} -@!neg_trie_op_size=-15011; {for lower |trie_op_hash| array bound; - must be equal to |-trie_op_size|.} -@!min_trie_op=0; {first possible trie op code for any language} -@!max_trie_op=ssup_trie_opcode; {largest possible trie opcode for any language} -@!pool_name=TEX_POOL_NAME; {this is configurable, for the sake of ML-\TeX} - {string of length |file_name_size|; tells where the string pool appears} -@# -@!inf_main_memory = 2000000; -@!sup_main_memory = 16000000; - -@!inf_trie_size = 80000; -@!sup_trie_size = ssup_trie_size; - -@!inf_max_strings = 100000; -@!sup_max_strings = ssup_max_strings; - -@!inf_strings_free = 100; -@!sup_strings_free = sup_max_strings; - -@!inf_buf_size = 500; -@!sup_buf_size = 200000; - -@!inf_nest_size = 40; -@!sup_nest_size = 400; - -@!inf_max_in_open = 6; -@!sup_max_in_open = 127; - -@!inf_param_size = 60; -@!sup_param_size = 600; - -@!inf_save_size = 600; -@!sup_save_size = 40000; - -@!inf_stack_size = 200; -@!sup_stack_size = 3000; - -@!inf_dvi_buf_size = 800; -@!sup_dvi_buf_size = 65536; - -@!inf_pool_size = 32000; -@!sup_pool_size = 10000000; -@!inf_pool_free = 1000; -@!sup_pool_free = sup_pool_size; -@!inf_string_vacancies = 8000; -@!sup_string_vacancies = sup_pool_size - 23000; - -@!sup_hyph_size = ssup_hyph_size; -@!inf_hyph_size = iinf_hyphen_size; {Must be not less than |hyph_prime|!} -@z - -@x [1.12] l.427 - Constants that are WEB numeric macros. -@d mem_bot=0 {smallest index in the |mem| array dumped by \.{INITEX}; - must not be less than |mem_min|} -@d mem_top==30000 {largest index in the |mem| array dumped by \.{INITEX}; - must be substantially larger than |mem_bot| - and not greater than |mem_max|} -@d font_base=0 {smallest internal font number; must not be less - than |min_quarterword|} -@d hash_size=65536 {maximum number of control sequences; it should be at most - about |(mem_max-mem_min)/10|} -@d hash_prime=55711 {a prime number equal to about 85\pct! of |hash_size|} -@d hyph_size=307 {another prime; the number of \.{\\hyphenation} exceptions} -@y -@d font_base=0 {smallest internal font number; must not be less - than |min_quarterword|} -@d hash_size=65536 {maximum number of control sequences; it should be at most - about |(mem_max-mem_min)/10|} -@d hash_prime=55711 {a prime number equal to about 85\pct! of |hash_size|} -@d hyph_prime=607 {another prime for hashing \.{\\hyphenation} exceptions; - if you change this, you should also change |iinf_hyphen_size|.} -@z - -@x [1.16] l.498 - Use C macros for `incr' and `decr'. -@d incr(#) == #:=#+1 {increase a variable by unity} -@d decr(#) == #:=#-1 {decrease a variable by unity} -@y -@z - -% The text_char type is used as an array index into xord. The -% default type `char' produces signed integers, which are bad array -% indices in C. -@x [2.19] l.565 - data type text_char is 8-bit ASCII_code -@d text_char == char {the data type of characters in text files} -@y -@d text_char == ASCII_code {the data type of characters in text files} -@z - -% [3.26] name_of_file is no longer an array. And change the destination -% type to text_char, which fixes: -% -% Date: 19 Sep 1994 10:38:24 +0200 -% From: thorinn@diku.dk (Lars Mathiesen) -% When echoed to the screen and in the log, character codes -% above '177 in file names are shown wrongly (typically as ^@). -% -@x [3.26] l.789 - name_of_file is no longer an array -@!name_of_file:packed array[1..file_name_size] of char;@;@/ - {on some systems this may be a \&{record} variable} -@y -@!name_of_file:^char; -@z - -@x [3.27] l.794 - Do file opening in C. -@ The \ph\ compiler with which the present version of \TeX\ was prepared has -extended the rules of \PASCAL\ in a very convenient way. To open file~|f|, -we can write -$$\vbox{\halign{#\hfil\qquad&#\hfil\cr -|reset(f,@t\\{name}@>,'/O')|&for input;\cr -|rewrite(f,@t\\{name}@>,'/O')|&for output.\cr}}$$ -The `\\{name}' parameter, which is of type `{\bf packed array -$[\langle\\{any}\rangle]$ of \\{char}}', stands for the name of -the external file that is being opened for input or output. -Blank spaces that might appear in \\{name} are ignored. - -The `\.{/O}' parameter tells the operating system not to issue its own -error messages if something goes wrong. If a file of the specified name -cannot be found, or if such a file cannot be opened for some other reason -(e.g., someone may already be trying to write the same file), we will have -|@!erstat(f)<>0| after an unsuccessful |reset| or |rewrite|. This allows -\TeX\ to undertake appropriate corrective action. -@:PASCAL H}{\ph@> -@^system dependencies@> - -\TeX's file-opening procedures return |false| if no file identified by -|name_of_file| could be opened. - -@d reset_OK(#)==erstat(#)=0 -@d rewrite_OK(#)==erstat(#)=0 - -@p function a_open_in(var f:alpha_file):boolean; - {open a text file for input} -begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f); -end; -@# -function a_open_out(var f:alpha_file):boolean; - {open a text file for output} -begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f); -end; -@# -function b_open_in(var f:byte_file):boolean; - {open a binary file for input} -begin reset(f,name_of_file,'/O'); b_open_in:=reset_OK(f); -end; -@# -function b_open_out(var f:byte_file):boolean; - {open a binary file for output} -begin rewrite(f,name_of_file,'/O'); b_open_out:=rewrite_OK(f); -end; -@# -function w_open_in(var f:word_file):boolean; - {open a word file for input} -begin reset(f,name_of_file,'/O'); w_open_in:=reset_OK(f); -end; -@# -function w_open_out(var f:word_file):boolean; - {open a word file for output} -begin rewrite(f,name_of_file,'/O'); w_open_out:=rewrite_OK(f); -end; -@y -@ All of the file opening functions are defined in C. -@z - -@x [3.28] l.850 - Do file closing in C. -@ Files can be closed with the \ph\ routine `|close(f)|', which -@^system dependencies@> -should be used when all input or output with respect to |f| has been completed. -This makes |f| available to be opened again, if desired; and if |f| was used for -output, the |close| operation makes the corresponding external file appear -on the user's area, ready to be read. - -These procedures should not generate error messages if a file is -being closed before it has been successfully opened. - -@p procedure a_close(var f:alpha_file); {close a text file} -begin close(f); -end; -@# -procedure b_close(var f:byte_file); {close a binary file} -begin close(f); -end; -@# -procedure w_close(var f:word_file); {close a word file} -begin close(f); -end; -@y -@ And all the file closing routines as well. -@z - -@x [3.30] l.888 - Array size of input buffer is determined at runtime. -@!buffer:array[0..buf_size] of ASCII_code; {lines of characters being read} -@y -@!buffer:^ASCII_code; {lines of characters being read} -@z - -@x [3.31] l.933 - Do `input_ln' in C. -@p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean; - {inputs the next line or returns |false|} -var last_nonblank:0..buf_size; {|last| with trailing blanks removed} -begin if bypass_eoln then if not eof(f) then get(f); - {input the first character of the line into |f^|} -last:=first; {cf.\ Matthew 19\thinspace:\thinspace30} -if eof(f) then input_ln:=false -else begin last_nonblank:=first; - while not eoln(f) do - begin if last>=max_buf_stack then - begin max_buf_stack:=last+1; - if max_buf_stack=buf_size then - @; - end; - buffer[last]:=f^; get(f); incr(last); - if buffer[last-1]<>" " then last_nonblank:=last; - end; - last:=last_nonblank; input_ln:=true; - end; -end; -@y -We define |input_ln| in C, for efficiency. -@z - -% [3.32] `term_in' and `term_out' are standard input and output. -% Declare the variables that used to be constants. -@x [3.32] l.961 - `term_in' and `term_out' are standard input and output. -@= -@!term_in:alpha_file; {the terminal as an input file} -@!term_out:alpha_file; {the terminal as an output file} -@y -@d term_in==stdin {the terminal as an input file} -@d term_out==stdout {the terminal as an output file} - -@= -@!init -@!ini_version:boolean; {are we \.{INITEX}?} -@!dump_option:boolean; {was the dump name option used?} -@!dump_line:boolean; {was a \.{\%\AM format} line seen?} -tini@/ -@# -@!bound_default:integer; {temporary for setup} -@!bound_name:^char; {temporary for setup} -@# -@!main_memory:integer; {total memory words allocated in initex} -@!extra_mem_bot:integer; {|mem_min:=mem_bot-extra_mem_bot| except in \.{INITEX}} -@!mem_min:integer; {smallest index in \TeX's internal |mem| array; - must be |min_halfword| or more; - must be equal to |mem_bot| in \.{INITEX}, otherwise |<=mem_bot|} -@!mem_top:integer; {largest index in the |mem| array dumped by \.{INITEX}; - must be substantially larger than |mem_bot|, - equal to |mem_max| in \.{INITEX}, else not greater than |mem_max|} -@!extra_mem_top:integer; {|mem_max:=mem_top+extra_mem_top| except in \.{INITEX}} -@!mem_max:integer; {greatest index in \TeX's internal |mem| array; - must be strictly less than |max_halfword|; - must be equal to |mem_top| in \.{INITEX}, otherwise |>=mem_top|} -@!error_line:integer; {width of context lines on terminal error messages} -@!half_error_line:integer; {width of first lines of contexts in terminal - error messages; should be between 30 and |error_line-15|} -@!max_print_line:integer; - {width of longest text lines output; should be at least 60} -@!max_strings:integer; {maximum number of strings; must not exceed |max_halfword|} -@!strings_free:integer; {strings available after format loaded} -@!string_vacancies:integer; {the minimum number of characters that should be - available for the user's control sequences and font names, - after \TeX's own error messages are stored} -@!pool_size:integer; {maximum number of characters in strings, including all - error messages and help texts, and the names of all fonts and - control sequences; must exceed |string_vacancies| by the total - length of \TeX's own strings, which is currently about 23000} -@!pool_free:integer;{pool space free after format loaded} -@!hyph_size:integer; {maximun number of hyphen exceptions} -@!trie_size:integer; {space for hyphenation patterns; should be larger for - \.{INITEX} than it is in production versions of \TeX. 50000 is - needed for English, German, and Portuguese.} -@!buf_size:integer; {maximum number of characters simultaneously present in - current lines of open files and in control sequences between - \.{\\csname} and \.{\\endcsname}; must not exceed |max_halfword|} -@!stack_size:integer; {maximum number of simultaneous input sources} -@!max_in_open:integer; {maximum number of input files and error insertions that - can be going on simultaneously} -@!param_size:integer; {maximum number of simultaneous macro parameters} -@!nest_size:integer; {maximum number of semantic levels simultaneously active} -@!save_size:integer; {space for saving values outside of current group; must be - at most |max_halfword|} -@!dvi_buf_size:integer; {size of the output buffer; must be a multiple of 8} -@z - -@x [3.33] l.964 - We don't need to open terminal files. -@ Here is how to open the terminal files -in \ph. The `\.{/I}' switch suppresses the first |get|. -@^system dependencies@> - -@d t_open_in==reset(term_in,'TTY:','/O/I') {open the terminal for text input} -@d t_open_out==rewrite(term_out,'TTY:','/O') {open the terminal for text output} -@y -@ Here is how to open the terminal files. |t_open_out| does nothing. -|t_open_in|, on the other hand, does the work of ``rescanning,'' or getting -any command line arguments the user has provided. It's defined in C. - -@d t_open_out == {output already open for text output} -@z - -@x [3.34] l.982 - Flushing output to terminal files. -these operations can be specified in \ph: -@^system dependencies@> - -@d update_terminal == break(term_out) {empty the terminal output buffer} -@d clear_terminal == break_in(term_in,true) {clear the terminal input buffer} -@y -these operations can be specified with {\mc UNIX}. |update_terminal| -does an |fflush|. |clear_terminal| is redefined -to do nothing, since the user should control the terminal. -@^system dependencies@> - -@d update_terminal == fflush (term_out) -@d clear_terminal == do_nothing -@z - -@x [3.35] l.1017 - Do `input_ln' in C => section not needed. -@= -if format_ident=0 then - begin write_ln(term_out,'Buffer size exceeded!'); goto final_end; -@.Buffer size exceeded@> - end -else begin cur_input.loc_field:=first; cur_input.limit_field:=last-1; - overflow("buffer size",buf_size); -@:TeX capacity exceeded buffer size}{\quad buffer size@> - end -@y -Routine is implemented in C; part of module is, however, needed for e-TeX. - -@= - begin cur_input.loc_field:=first; cur_input.limit_field:=last-1; - overflow("buffer size",buf_size); -@:TeX capacity exceeded buffer size}{\quad buffer size@> - end -@z - -@x [3.37] l.1055 - |init_terminal|, reading the command line. -@ The following program does the required initialization -without retrieving a possible command line. -It should be clear how to modify this routine to deal with command lines, -if the system permits them. -@^system dependencies@> - -@p function init_terminal:boolean; {gets the terminal input started} -label exit; -begin t_open_in; -@y -@ The following program does the required initialization. -Iff anything has been specified on the command line, then |t_open_in| -will return with |last > first|. -@^system dependencies@> - -@p function init_terminal:boolean; {gets the terminal input started} -label exit; -begin t_open_in; -if last > first then - begin loc := first; - while (loc < last) and (buffer[loc]=' ') do incr(loc); - if loc < last then - begin init_terminal := true; goto exit; - end; - end; -@z - -@x [3.37] l.1068 - |init_terminal|, output missing newline. - write(term_out,'! End of file on the terminal... why?'); -@y - write_ln(term_out,'! End of file on the terminal... why?'); -@z - -@x [4.38] l.1126 - Array size for string pool is determined at runtime. -@!pool_pointer = 0..pool_size; {for variables that point into |str_pool|} -@!str_number = 0..max_strings; {for variables that point into |str_start|} -@y -@!pool_pointer = integer; {for variables that point into |str_pool|} -@!str_number = 0..ssup_max_strings; {for variables that point into |str_start|} -@z - -@x [4.39] l.1131 - Dynamically size pool arrays. -@!str_pool:packed array[pool_pointer] of packed_ASCII_code; {the characters} -@!str_start_ar : array[str_number] of pool_pointer; {the starting pointers} -@y -@!str_pool: ^packed_ASCII_code; {the characters} -@!str_start_ar : ^pool_pointer; {the starting pointers} -@z - -@x [4.47] l.1237 - string recycling -@p @!init function get_strings_started:boolean; {initializes the string pool, -@y -@p @t\4@>@@/ - -@!init function get_strings_started:boolean; {initializes the string pool, -@z - -% [4.51] Open the pool file using a path, and can't do string -% assignments directly. (`strcpy' and `strlen' work here because -% `pool_name' is a constant string, and thus ends in a null and doesn't -% start with a space.) -@x [4.51] l.1314 - Open the pool file. -name_of_file:=pool_name; {we needn't set |name_length|} -if a_open_in(pool_file) then -@y -name_length := strlen (pool_name); -name_of_file := xmalloc_array (char, name_length + 1); -strcpy (name_of_file+1, pool_name); {copy the string} -if a_open_in (pool_file, kpse_texpool_format) then -@z - -@x [4.51] l.1322 - Make `OMEGA.POOL' lowercase, and change how it's read. -else bad_pool('! I can''t read ALEPH.POOL.') -@y -else bad_pool('! I can''t read ', pool_name, '; bad path?') -@z -@x [4.52] l.1326 - Make `OMEGA.POOL' lowercase, and change how it's read. -begin if eof(pool_file) then bad_pool('! ALEPH.POOL has no check sum.'); -@.ALEPH.POOL has no check sum@> -read(pool_file,m,n); {read two digits of string length} -@y -begin if eof(pool_file) then bad_pool('! ', pool_name, ' has no check sum.'); -@.ALEPH.POOL has no check sum@> -read(pool_file,m); read(pool_file,n); {read two digits of string length} -@z -@x [4.52] l.1332 - Make `ALEPH.POOL' lowercase, and change how it's read. - bad_pool('! ALEPH.POOL line doesn''t begin with two digits.'); -@y - bad_pool('! ', pool_name, ' line doesn''t begin with two digits.'); -@z -@x [4.53] l.1354 - Make `ALEPH.POOL' lowercase, and change how it's read. - bad_pool('! ALEPH.POOL check sum doesn''t have nine digits.'); -@y - bad_pool('! ', pool_name, ' check sum doesn''t have nine digits.'); -@z -@x [4.53] l.1360 - Make `OMEGA.POOL' lowercase, and change how it's read. -done: if a<>@$ then bad_pool('! ALEPH.POOL doesn''t match; OTANGLE me again.'); -@y -done: if a<>@$ then - bad_pool('! ', pool_name, ' doesn''t match; otangle me again (or fix the path).'); -@z - -@x [5.54] l.1422 - error_line -@!trick_buf:array[0..error_line] of ASCII_code; {circular buffer for -@y -@!trick_buf:array[0..ssup_error_line] of ASCII_code; {circular buffer for -@z - -@x [5.61] l.1556 - Print rest of banner, eliminate misleading `(no format preloaded)'. -wterm(eTeX_banner); -if format_ident=0 then wterm_ln(' (no format preloaded)') -else begin slow_print(format_ident); print_ln; - end; -@y -wterm(eTeX_banner); -wterm(version_string); -if format_ident>0 then slow_print(format_ident); -print_ln; -@z - -@x [6.73] l.1732 - Add unspecified_mode. -@d error_stop_mode=3 {stops at every opportunity to interact} -@y -@d error_stop_mode=3 {stops at every opportunity to interact} -@d unspecified_mode=4 {extra value for command-line switch} -@z - -@x [6.73] l.1738 - Add interaction_option. -@!interaction:batch_mode..error_stop_mode; {current level of interaction} -@y -@!interaction:batch_mode..error_stop_mode; {current level of interaction} -@!interaction_option:batch_mode..unspecified_mode; {set from command line} -@z - -@x [6.74] l.1740 - Allow override by command line switch. -@ @=interaction:=error_stop_mode; -@y -@ @=if interaction_option=unspecified_mode then - interaction:=error_stop_mode -else - interaction:=interaction_option; -@z - -% [6.81] Eliminate nonlocal goto, since C doesn't have them. -% Plus, it's nicer just to do an exit with the appropriate status code -% under Unix. We call it `uexit' because there's a WEB symbol called -% `exit' already. We use a C macro to change `uexit' back to `exit'. -@x [6.81] l.1852 - Eliminate nonlocal goto, since C doesn't have them. -@= -procedure jump_out; -begin goto end_of_TEX; -end; -@y -@d do_final_end==begin - update_terminal; - ready_already:=0; - if (history <> spotless) and (history <> warning_issued) then - uexit(1) - else - uexit(0); - end - -@= -procedure jump_out; -begin -close_files_and_terminate; -do_final_end; -end; -@z - -@x [6.84] l.1888 - Implement the switch-to-editor option. -line ready to be edited. But such an extension requires some system -wizardry, so the present implementation simply types out the name of the -file that should be -edited and the relevant line number. -@^system dependencies@> - -There is a secret `\.D' option available when the debugging routines haven't -been commented~out. -@^debugging@> -@y -line ready to be edited. -We do this by calling the external procedure |call_edit| with a pointer to -the filename, its length, and the line number. -However, here we just set up the variables that will be used as arguments, -since we don't want to do the switch-to-editor until after TeX has closed -its files. -@^system dependencies@> - -There is a secret `\.D' option available when the debugging routines haven't -been commented~out. -@^debugging@> -@d edit_file==input_stack[base_ptr] -@z - -@x [6.84] l.1903 - Implement the switch-to-editor option. -"E": if base_ptr>0 then - begin print_nl("You want to edit file "); -@.You want to edit file x@> - slow_print(input_stack[base_ptr].name_field); - print(" at line "); print_int(line); - interaction:=scroll_mode; jump_out; -@y -"E": if base_ptr>0 then - begin edit_name_start:=str_start(edit_file.name_field); - edit_name_length:=str_start(edit_file.name_field+1) - - str_start(edit_file.name_field); - edit_line:=line; - jump_out; -@z - -% [7.104] `remainder' is a library routine on some systems, so change -% its name to avoid conflicts. -@x [7.104] l.2227 - avoid name conflicts with lib routine remainder() -|remainder|, holds the remainder after a division. - -@= -@y -|remainder|, holds the remainder after a division. - -@d remainder==tex_remainder - -@= -@z - -@x [7.109] l.2352 - Define glue_ratio in C. -@!glue_ratio=real; {one-word representation of a glue expansion factor} -@y -@z - -@x [8.112] l.2435 - Efficiency. -macros are simplified in the obvious way when |min_quarterword=0|. -@^inner loop@>@^system dependencies@> - -@d qi(#)==#+min_quarterword - {to put an |eight_bits| item into a quarterword} -@d qo(#)==#-min_quarterword - {to take an |eight_bits| item out of a quarterword} -@d hi(#)==#+min_halfword - {to put a sixteen-bit item into a halfword} -@d ho(#)==#-min_halfword - {to take a sixteen-bit item from a halfword} -@y -macros are simplified in the obvious way when |min_quarterword=0|. -So they have been simplified here in the obvious way. -@^inner loop@>@^system dependencies@> - -@d qi(#)==# {to put an |eight_bits| item into a quarterword} -@d qo(#)==# {to take an |eight_bits| item from a quarterword} -@d hi(#)==# {to put a sixteen-bit item into a halfword} -@d ho(#)==# {to take a sixteen-bit item from a halfword} -@z - -% [8.113] We've put the memory structure into the include file -% `texmf.h', since it's too hard to translate automatically. -@x [8.113] l.2453 - data structures for main memory -@!quarterword = min_quarterword..max_quarterword; {1/4 of a word} -@!halfword=min_halfword..max_halfword; {1/2 of a word} -@!two_choices = 1..2; {used when there are two variants in a record} -@!four_choices = 1..4; {used when there are four variants in a record} -@!two_halves = packed record@;@/ - @!rh:halfword; - case two_choices of - 1: (@!lh:halfword); - 2: (@!b0:quarterword; @!b1:quarterword); - end; -@!four_quarters = packed record@;@/ - @!b0:quarterword; - @!b1:quarterword; - @!b2:quarterword; - @!b3:quarterword; - end; -@!memory_word = record@;@/ - case four_choices of - 1: (@!int:integer); - 2: (@!gr:glue_ratio); - 3: (@!hh:two_halves); - 4: (@!qqqq:four_quarters); - end; -@y -@!quarterword = min_quarterword..max_quarterword; -@!halfword = min_halfword..max_halfword; -@!two_choices = 1..2; {used when there are two variants in a record} -@!four_choices = 1..4; {used when there are four variants in a record} -@=#include "texmfmem.h";@> -@=#include "alephmem.h";@> -@z - -% [9.116] Change `mem' to `zmem', so we can define mem to be a register -% pointer to the memory array for speed. -@x [9.116] l.2545 - definition of main memory array -@!mem : array[mem_min..mem_max] of memory_word; {the big dynamic storage area} -@y -@!yzmem : ^memory_word; {the big dynamic storage area} -@!zmem : ^memory_word; {the big dynamic storage area} -@z - -% [9.127] Fix casting problem in C. -% There are several of these. They come from the rules C uses for -% comparing signed and unsigned quantities. Just doing the comparison -% can result in incorrect evaluation wrt the way Pascal would do it. -@x [9.127] l.2739 - Fix casting problem in C. -if r>p+1 then @; -@y 2738 -if r>intcast(p+1) then @; -@z - -% [11.165] Fix the word `free' so that it doesn't conflict with the -% standard C library routine of the same name. -@x [11.165] l.3364 - avoid conflict with lib function free() -are debugging.) -@y -are debugging.) - -@d free==free_arr -@z - -@x [11.165] l.3367 - dummy |free| and |was_free| arrays -@!debug @!free: packed array [mem_min..mem_max] of boolean; {free cells} -@t\hskip10pt@>@!was_free: packed array [mem_min..mem_max] of boolean; -@y - {The debug memory arrays have not been mallocated yet.} -@!debug @!free: packed array [0..9] of boolean; {free cells} -@t\hskip10pt@>@!was_free: packed array [0..9] of boolean; -@z - -@x [12.174] l.3526 - Eliminate unsigned comparisons to zero. - begin if (font(p)font_max) then - print_char("*") -@.*\relax@> - else @; -@y - begin @; -@z - -@x [12.176] l.3563 - Eliminate unsigned comparisons to zero. -begin if p>mem_end then print_esc("CLOBBERED.") -else begin if (font(p)font_max) then print_char("*") -@.*\relax@> - else @; -@y -begin if p>mem_end then print_esc("CLOBBERED.") -else begin @; -@z - -@x [12.186] l.3747 - Don't worry about strange floating point values. - if abs(mem[p+glue_offset].int)<@'4000000 then print("?.?") - else if abs(g)>float_constant(20000) then -@y 3747 - { The Unix |pc| folks removed this restriction with a remark that - invalid bit patterns were vanishingly improbable, so we follow - their example without really understanding it. - |if abs(mem[p+glue_offset].int)<@'4000000 then print('?.?')| - |else| } - if fabs(g)>float_constant(20000) then -@z - - -@x [16.213] l.4321 - texarray -@!nest:array[0..nest_size] of list_state_record; -@y -@!nest:^list_state_record; -@z - -@x [16.215] l.4344 - remove mem[] reference from initialize. -@; -@y -@/{The following piece of code is a copy of module 991:} -page_contents:=empty; page_tail:=page_head; {|link(page_head):=null;|}@/ -last_glue:=max_halfword; last_penalty:=0; last_kern:=0; -page_depth:=0; page_max_depth:=0; -@z - -@x [17.241] l.5219 - Do `fix_date_and_time' in C. -@ The following procedure, which is called just before \TeX\ initializes its -input and output, establishes the initial values of the date and time. -@^system dependencies@> -Since standard \PASCAL\ cannot provide such information, something special -is needed. The program here simply specifies July 4, 1776, at noon; but -users probably want a better approximation to the truth. - -@p procedure fix_date_and_time; -begin time:=12*60; {minutes since midnight} -day:=4; {fourth day of the month} -month:=7; {seventh month of the year} -year:=1776; {Anno Domini} -end; -@y -@ The following procedure, which is called just before \TeX\ initializes its -input and output, establishes the initial values of the date and time. -It calls a macro-defined |date_and_time| routine. |date_and_time| -in turn is a C macro, which calls |get_date_and_time|, passing -it the addresses of the day, month, etc., so they can be set by the -routine. |get_date_and_time| also sets up interrupt catching if that -is conditionally compiled in the C code. -@^system dependencies@> - -@d fix_date_and_time==o_date_and_time(int_base+time_code, - int_base+day_code, - int_base+month_code, - int_base+year_code) -@z - -@x [18.262] l.5584 - Remove more unsigned comparisons to zero. -else if (newtext(p)<0)or(newtext(p)>=str_ptr) then print_esc("NONEXISTENT.") -@y -else if (newtext(p)>=str_ptr) then print_esc("NONEXISTENT.") -@z - -@x [19.271] l.5872 - texarray -@!save_stack : array[0..save_size] of memory_word; -@y -@!save_stack : ^memory_word; -@z - -@x [22.301] l.6432 - texarray -@!input_stack : array[0..stack_size] of in_state_record; -@y -@!input_stack : ^in_state_record; -@z - -@x [22.304] l.6536 - texarray -@!input_file : array[1..max_in_open] of alpha_file; -@!input_file_mode : array[1..max_in_open] of halfword; -@!input_file_translation : array[1..max_in_open] of halfword; -@!line : integer; {current line number in the current source file} -@!line_stack : array[1..max_in_open] of integer; -@y -@!input_file : ^alpha_file; -@!input_file_mode : ^halfword; -@!input_file_translation : ^halfword; -@!line : integer; {current line number in the current source file} -@!line_stack : ^integer; -@z - -@x [22.308] l.6701 - texarray -@!param_stack:array [0..param_size] of pointer; - {token list pointers for parameters} -@y -@!param_stack: ^pointer; - {token list pointers for parameters} -@z - -@x [23.331] l.7071 - init source file name stacks -begin input_ptr:=0; max_in_stack:=0; -@y -begin input_ptr:=0; max_in_stack:=0; -source_filename_stack[0]:=0;full_source_filename_stack[0]:=0; -@z - -@x [29.513] l.9951 - Area and extension rules for filenames. -@ The file names we shall deal with for illustrative purposes have the -following structure: If the name contains `\.>' or `\.:', the file area -consists of all characters up to and including the final such character; -otherwise the file area is null. If the remaining file name contains -`\..', the file extension consists of all such characters from the first -remaining `\..' to the end, otherwise the file extension is null. -@y -@ The file names we shall deal with have the -following structure: If the name contains `\./' or `\.:' -(for Amiga only), the file area -consists of all characters up to and including the final such character; -otherwise the file area is null. If the remaining file name contains -`\..', the file extension consists of all such characters from the last -`\..' to the end, otherwise the file extension is null. -@z - -@x [29.513] l.9963 - Area and extension rules for filenames. -@!area_delimiter:pool_pointer; {the most recent `\.>' or `\.:', if any} -@!ext_delimiter:pool_pointer; {the relevant `\..', if any} -@y -@!area_delimiter:pool_pointer; {the most recent `\./', if any} -@!ext_delimiter:pool_pointer; {the most recent `\..', if any} -@z - -@x [29.514] l.9973 - TeX area directories. -@d TEX_area=="TeXinputs:" -@.TeXinputs@> -@d TEX_font_area=="TeXfonts:" -@.TeXfonts@> -@y -In C, the default paths are specified separately. -@z - -@x [29.516] l.9994 - filenames: more_name - if (c=">")or(c=":") then -@y - if IS_DIR_SEP(c) then -@z - -@x [29.516] l.9997 - filenames: more_name - else if (c=".")and(ext_delimiter=0) then ext_delimiter:=cur_length; -@y - else if c="." then ext_delimiter:=cur_length; -@z - -@x [29.517] l.10002 - end_name: string recycling -@ The third. -@^system dependencies@> - -@p procedure end_name; -@y -@ The third. -@^system dependencies@> -If a string is already in the string pool, the function -|slow_make_string| does not create a new string but returns this string -number, thus saving string space. Because of this new property of the -returned string number it is not possible to apply |flush_string| to -these strings. - -@p procedure end_name; -var temp_str: str_number; {result of file name cache lookups} -@!j: pool_pointer; {running index} -@z - -@x [29.517] l.10011 - end_name: string recycling - str_start(str_ptr+1):=str_start(str_ptr)+area_delimiter; incr(str_ptr); - end; -if ext_delimiter=0 then - begin cur_ext:=""; cur_name:=make_string; -@y - str_start(str_ptr+1):=str_start(str_ptr)+area_delimiter; incr(str_ptr); - temp_str:=search_string(cur_area); - if temp_str>0 then - begin cur_area:=temp_str; - decr(str_ptr); {no |flush_string|, |pool_ptr| will be wrong!} - for j:=str_start(str_ptr+1) to pool_ptr-1 do - begin str_pool[j-area_delimiter]:=str_pool[j]; - end; - pool_ptr:=pool_ptr-area_delimiter; {update |pool_ptr|} - end; - end; -if ext_delimiter=0 then - begin cur_ext:=""; cur_name:=slow_make_string; -@z - -@x [29.517] l.10016 - end_name: string recycling -else begin cur_name:=str_ptr; - str_start(str_ptr+1):=str_start(str_ptr)+ext_delimiter-area_delimiter-1; - incr(str_ptr); cur_ext:=make_string; -@y -else begin cur_name:=str_ptr; - str_start(str_ptr+1):=str_start(str_ptr)+ext_delimiter-area_delimiter-1; - incr(str_ptr); cur_ext:=make_string; - decr(str_ptr); {undo extension string to look at name part} - temp_str:=search_string(cur_name); - if temp_str>0 then - begin cur_name:=temp_str; - decr(str_ptr); {no |flush_string|, |pool_ptr| will be wrong!} - for j:=str_start(str_ptr+1) to pool_ptr-1 do - begin str_pool[j-ext_delimiter+area_delimiter+1]:=str_pool[j]; - end; - pool_ptr:=pool_ptr-ext_delimiter+area_delimiter+1; {update |pool_ptr|} - end; - cur_ext:=slow_make_string; {remake extension string} -@z - -% [29.519] In pack_file_name, leave room for the extra null we append at -% the end of a filename. -@x [29.519] l.10047 - pack_file_name, leave room for the extra null -for j:=str_start(a) to str_start(a+1)-1 do append_to_name(so(str_pool[j])); -@y -if name_of_file then libc_free (name_of_file); -name_of_file:= xmalloc_array(char, 1 + length(a) + length(n) + length(e)); -for j:=str_start(a) to str_start(a+1)-1 do append_to_name(so(str_pool[j])); -@z - -@x [29.519] l.10051 - pack_file_name, append the extra null -for k:=name_length+1 to file_name_size do name_of_file[k]:=' '; -@y -name_of_file[name_length+1]:=0; -@z - -@x [29.520] l.10060 - filenames: default format. -@d format_default_length=20 {length of the |TEX_format_default| string} -@d format_area_length=11 {length of its area part} -@d format_ext_length=4 {length of its `\.{.fmt}' part} -@d format_extension=".fmt" {the extension, as a \.{WEB} constant} -@y -Under {\mc UNIX} we don't give the area part, instead depending -on the path searching that will happen during file opening. Also, the -length will be set in the main program. - -@d format_area_length=0 {length of its area part} -@d format_ext_length=4 {length of its `\.{.fmt}' part} -@d format_extension=".fmt" {the extension, as a \.{WEB} constant} -@z - -@x [29.521] l.10066 - filenames: default format, where `plain.fmt' is. -@!TEX_format_default:packed array[1..format_default_length] of char; - -@ @= -TEX_format_default:='TeXformats:plain.fmt'; -@y -@!format_default_length: integer; -@!TEX_format_default: ^char; - -@ We set the name of the default format file and the length of that name -in C, instead of Pascal, since we want them to depend on the name of the -program. -@z - -@x [29.523] l.10095 - Change to pack_buffered_name as with pack_file_name. -for j:=1 to n do append_to_name(TEX_format_default[j]); -@y -if name_of_file then libc_free (name_of_file); -name_of_file := xmalloc_array (char, 1 + n + (b - a + 1) + format_ext_length); -for j:=1 to n do append_to_name(TEX_format_default[j]); -@z - -@x [29.523] l.10100 - Change to pack_buffered_name as with pack_file_name. -for k:=name_length+1 to file_name_size do name_of_file[k]:=' '; -@y -name_of_file[name_length+1]:=0; -@z - -@x [29.524] l.10118 - Format file opening: only try once, with path searching. - pack_buffered_name(0,loc,j-1); {try first without the system file area} - if w_open_in(fmt_file) then goto found; - pack_buffered_name(format_area_length,loc,j-1); - {now try the system format file area} - if w_open_in(fmt_file) then goto found; -@y - pack_buffered_name(0,loc,j-1); {Kpathsea does everything} - if w_open_in(fmt_file) then goto found; -@z - -@x [29.524] l.10124 - replace `PLAIN' in error messages with `default'. - wterm_ln('Sorry, I can''t find that format;',' will try PLAIN.'); -@y - wterm ('Sorry, I can''t find the format `'); - fputs (name_of_file + 1, stdout); - wterm ('''; will try `'); - fputs (TEX_format_default + 1, stdout); - wterm_ln ('''.'); -@z - -@x [29.524] l.10132 - replace `PLAIN' in error messages with `default'. - wterm_ln('I can''t find the PLAIN format file!'); -@.I can't find PLAIN...@> -@y - wterm ('I can''t find the format file `'); - fputs (TEX_format_default + 1, stdout); - wterm_ln ('''!'); -@.I can't find the format...@> -@z - -@x [29.530] l.10239 - prompt_file_name: No default extension is TeX input file. -if e=".tex" then show_context; -@y -if (e=".tex") or (e="") then show_context; -@z - -@x [29.532] l.10263 - avoid conflict, `logname' in on some systems. -@ Here's an example of how these conventions are used. Whenever it is time to -ship out a box of stuff, we shall use the macro |ensure_dvi_open|. - -@y -@ Here's an example of how these conventions are used. Whenever it is time to -ship out a box of stuff, we shall use the macro |ensure_dvi_open|. - -@d log_name == texmf_log_name -@z - -@x [29.534] l.10285 - Adjust for C string conventions. -@!months:packed array [1..36] of char; {abbreviations of month names} -@y -@!months:^char; -j:integer; -@z - -@x [29.534] l. - Send the job_name to the file recorder. -begin old_setting:=selector; -if job_name=0 then job_name:="texput"; -@y -begin old_setting:=selector; -if job_name=0 then job_name:="texput"; -pack_job_name(".ofl"); -recorder_change_filename(stringcast(name_of_file+1)); -@z - -@x [29.536] l.10324 - Print rest of banner. -begin wlog(eTeX_banner); -@y -begin wlog(eTeX_banner); -wlog(version_string); -@z - -@x [29.536] l.10327 - Adjust for C string conventions. -months:='JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'; -@y -months := ' JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'; -@z - -% [29.537] Use a path when calling a_open_in to do a \input; also, try -% to open the file with and without the `.tex' extension, regardless of -% whether the file already has an extension. This allows filenames like -% `foo' and `foo.bar.tex', as well as `foo.tex' and `foo.bar'. -@x [29.537] l.10338 - start_input -begin scan_file_name; {set |cur_name| to desired file name} -if cur_ext="" then cur_ext:=".tex"; -pack_cur_name; -loop@+ begin begin_file_reading; {set up |cur_file| and new level of input} - if a_open_in(cur_file) then goto done; - if cur_area="" then - begin pack_file_name(cur_name,TEX_area,cur_ext); - if a_open_in(cur_file) then goto done; - end; -@y -var temp_str: str_number; k: integer; -begin scan_file_name; {set |cur_name| to desired file name} -pack_cur_name; -loop@+ begin begin_file_reading; {set up |cur_file| and new level of input} - tex_input_type := 1; {Tell |open_input| we are \.{\\input}.} - {Kpathsea tries all the various ways to get the file.} - if open_in_name_ok(name_of_file+1) - and a_open_in(cur_file, kpse_tex_format) then - {At this point |name_of_file| contains the actual name found. - We extract the |cur_area|, |cur_name|, and |cur_ext| from it.} - begin k:=1; - name_in_progress:=true; - begin_name; - while (k<=name_length)and(more_name(name_of_file[k])) do - incr(k); - end_name; - name_in_progress:=false; - goto done; - end; -@z - -@x [29.537] l.10348 - start_input: don't force ".tex" extension. - prompt_file_name("input file name",".tex"); -@y - prompt_file_name("input file name",""); -@z - -@x [29.537] l.10350 - start_input: string recycling -done: name:=a_make_name_string(cur_file); -@y -done: name:=a_make_name_string(cur_file); -if name=str_ptr-1 then {we can try to conserve string pool space now} - begin temp_str:=search_string(name); - if temp_str>0 then - begin name:=temp_str; flush_string; - end; - end; -@z - -@x [29.537] l.10352 - start_input: use different heuristic for initex. - begin job_name:=cur_name; open_log_file; -@y - begin job_name:=get_job_name; open_log_file; -@z - -@x [29.537] l.10359 - start_input: don't return filename to string pool. -if name=str_ptr-1 then {we can conserve string pool space now} - begin flush_string; name:=cur_name; - end; -@y -@z - -@x [30.563] l.10943 - Don't use TEX_font_area. -if aire="" then pack_file_name(nom,TEX_font_area,".ofm") -else pack_file_name(nom,aire,".ofm"); -if not b_open_in(tfm_file) then abort; -@y -{|kpse_find_file| will append the |".ofm"| or |".tfm"|, - and avoid searching the disk before the font alias files as well.} -pack_file_name(nom,aire,""); -if not ofm_open_in(tfm_file) then abort; -@z - -% [30.564] Reading the tfm file. As a special case, whenever we open a -% tfm file, we read its first byte into `tfm_temp' right away. TeX -% looks at `fbyte' before calling `fget', so it ends up seeing every -% byte. This is Pascal-like I/O. -@x [30.564] l.10956 - reading the tfm file, define fget & fbyte -@d fget==get(tfm_file) -@d fbyte==tfm_file^ -@y -@d fget==tfm_temp:=getc(tfm_file) -@d fbyte==tfm_temp -@z - -% [32.575] We only want `eof' on the TFM file to be true if we -% previously had EOF, not if we're at EOF now. This is like `feof', and -% unlike our implementation of `eof' elsewhere. -@x [32.575] l.11161 - Reading the tfm file, replace eof() by feof(). -if eof(tfm_file) then abort; -@y -if feof(tfm_file) then abort; -@z - -@x [32.595] l.11860 - texarray -@!dvi_buf:array[dvi_index] of real_eight_bits; {buffer for \.{DVI} output} -@!half_buf:dvi_index; {half of |dvi_buf_size|} -@!dvi_limit:dvi_index; {end of the current half buffer} -@!dvi_ptr:dvi_index; {the next available buffer address} -@y -@!dvi_buf:^real_eight_bits; {buffer for \.{DVI} output} -@!half_buf:integer; {half of |dvi_buf_size|} -@!dvi_limit:integer; {end of the current half buffer} -@!dvi_ptr:integer; {the next available buffer address} -@z - -@x [32.597] l.11886 - write_dvi done in C. -@p procedure write_dvi(@!a,@!b:dvi_index); -var k:dvi_index; -begin for k:=a to b do write(dvi_file,dvi_buf[k]); -end; -@y -In C, we use a macro to call |fwrite| or |write| directly, writing all -the bytes in one shot. Much better even than writing four -bytes at a time. -@z - -@x [32.617] l.12261 - Use output_comment if the user set it. Assume it's short enough. - old_setting:=selector; selector:=new_string; -@y -if output_comment then - begin l:=strlen(output_comment); dvi_out(l); - for s:=0 to l-1 do dvi_out(output_comment[s]); - end -else begin {the default code is unchanged} - old_setting:=selector; selector:=new_string; -@z - -@x [32.617] l.12268 - Use output_comment if the user set it. - pool_ptr:=str_start(str_ptr); {flush the current string} -@y - pool_ptr:=str_start(str_ptr); {flush the current string} -end; -@z - -% We output each portion of the page as we get to it, if we are using -% IPC, so that the previewer (TeXView) can display it immediately. [SPM] -@x [32.640] l.12690 - IPC -dvi_out(eop); incr(total_pages); cur_s:=-1; -@y -dvi_out(eop); incr(total_pages); cur_s:=-1; -ifdef ('IPC') -if ipc_on>0 then - begin if dvi_limit=half_buf then - begin write_dvi(half_buf, dvi_buf_size-1); - flush_dvi; - dvi_gone:=dvi_gone+half_buf; - end; - if dvi_ptr>0 then - begin write_dvi(0, dvi_ptr-1); - flush_dvi; - dvi_offset:=dvi_offset+dvi_ptr; dvi_gone:=dvi_gone+dvi_ptr; - end; - dvi_ptr:=0; dvi_limit:=dvi_buf_size; - ipc_page(dvi_gone); - end; -endif ('IPC'); -@z - -@x [32.642] l.12742 - Use dvi_offset instead of dvi_buf_size with IPC stuff. - k:=4+((dvi_buf_size-dvi_ptr) mod 4); {the number of 223's} -@y -ifdef ('IPC') - k:=7-((3+dvi_offset+dvi_ptr) mod 4); {the number of 223's} -endif ('IPC') -ifndef ('IPC') - k:=4+((dvi_buf_size-dvi_ptr) mod 4); {the number of 223's} -endifn ('IPC') -@z - -@x [38.859] l.16855 - Fix a casting/expression evaluation problem. -if abs(fit_class-fitness(r))>1 then d:=d+adj_demerits; -@y -if abs(intcast(fit_class)-intcast(fitness(r)))>1 then d:=d+adj_demerits; -@z - -@x [39.875] l.17170 - Another casting problem. - begin line_diff:=line_number(r)-best_line; -@y - begin line_diff:=intcast(line_number(r))-intcast(best_line); -@z - -@x [42.920] l.18068 - bigtrie: allow larger hyphenation tries. -@!trie_pointer=0..trie_size; {an index into |trie|} -@y -@!trie_pointer=0..ssup_trie_size; {an index into |trie|} -@z - -@x [42.921] l.18075 - bigtrie: allow larger hyphenation tries. -@!trie:array[trie_pointer] of two_halves; {|trie_link|, |trie_char|, |trie_op|} -@y -{We will dynamically allocate this arrays.} -@!trie:^two_halves; {|trie_link|} -@z - -%%%%%%%% dynamic hyph_size -@x 18126 m.925 -different from $\alpha$, we can conclude that $\alpha$ is not in the table. -@y 18126 -different from $\alpha$, we can conclude that $\alpha$ is not in the table. -This is a clever scheme which saves the need for a hash link array. -However, it is difficult to increase the size of the hyphen exception -arrays. To make this easier, the ordered hash has been replaced by -a simple hash, using an additional array |hyph_link|. The value -|0| in |hyph_link[k]| means that there are no more entries corresponding -to the specific hash chain. When |hyph_link[k]>0|, the next entry in -the hash chain is |hyph_link[k]-1|. This value is used because the -arrays start at |0|. -@z - -%%%%%%%% dynamic hyph_size -@x 18134 m.925 -@!hyph_pointer=0..hyph_size; {an index into the ordered hash table} -@y 18134 -@!hyph_pointer=0..ssup_hyph_size; {index into hyphen exceptions hash table; - enlarging this requires changing (un)dump code} -@z - -%%%%%%%% dynamic hyph_size -@x 18137 m.926 -@!hyph_word:array[hyph_pointer] of str_number; {exception words} -@!hyph_list:array[hyph_pointer] of pointer; {list of hyphen positions} -@!hyph_count:hyph_pointer; {the number of words in the exception dictionary} -@y 18139 -@!hyph_word: ^str_number; {exception words} -@!hyph_list: ^pointer; {list of hyphen positions} -@!hyph_link: ^hyph_pointer; {link array for hyphen exceptions hash table} -@!hyph_count:integer; {the number of words in the exception dictionary} -@!hyph_next:integer; {next free slot in hyphen exceptions hash table} -@z - -%%%%%%%% dynamic hyph_size -@x 18145 m.928 -for z:=0 to hyph_size do - begin hyph_word[z]:=0; hyph_list[z]:=null; - end; -hyph_count:=0; -@y 18148 -for z:=0 to hyph_size do - begin hyph_word[z]:=0; hyph_list[z]:=null; hyph_link[z]:=0; - end; -hyph_count:=0; -hyph_next:=hyph_prime+1; if hyph_next>hyph_size then hyph_next:=hyph_prime; -@z - -%%%%%%%% dynamic hyph_size -@x 18163 m.930 -h:=hc[1]; incr(hn); hc[hn]:=cur_lang; -for j:=2 to hn do h:=(h+h+hc[j]) mod hyph_size; -loop@+ begin @; - if h>0 then decr(h)@+else h:=hyph_size; - end; -not_found: decr(hn) -@y 18170 -h:=hc[1]; incr(hn); hc[hn]:=cur_lang; -for j:=2 to hn do h:=(h+h+hc[j]) mod hyph_prime; -loop@+ begin @; - h:=hyph_link[h]; if h=0 then goto not_found; - decr(h); - end; -not_found: decr(hn) -@z - -%%%%%%%% dynamic hyph_size -@x 18172 m.931 -@ @= -k:=hyph_word[h]; if k=0 then goto not_found; -if length(k)hc[j] then goto done; - incr(j); incr(u); - until j>hn; - @; - decr(hn); goto found; - end; -done: -@y 18184 -@ @= -{This is now a simple hash list, not an ordered one, so -the module title is no longer descriptive.} -k:=hyph_word[h]; if k=0 then goto not_found; -if length(k)=hn then - begin j:=1; u:=str_start(k); - repeat - if so(str_pool[u])<>hc[j] then goto done; - incr(j); incr(u); - until j>hn; - @; - decr(hn); goto found; - end; -done: -@z - -% The GNU C compiler complains of unused variables. -@x -@!s,@!t:str_number; {strings being compared or stored} -@y -@!s:str_number; {strings being compared or stored} -@z - -%%%%%%%% dynamic hyph_size -@x 18274 m.939 - begin h:=(h+h+hc[j]) mod hyph_size; -@y 18274 - begin h:=(h+h+hc[j]) mod hyph_prime; -@z - -%%%%%%%% dynamic hyph_size -@x 18281 m.940 -@ @= -if hyph_count=hyph_size then overflow("exception dictionary",hyph_size); -@:TeX capacity exceeded exception dictionary}{\quad exception dictionary@> -incr(hyph_count); -while hyph_word[h]<>0 do - begin @; - if h>0 then decr(h)@+else h:=hyph_size; - end; -hyph_word[h]:=s; hyph_list[h]:=p -@y 18290 -@ @= - if hyph_next <= hyph_prime then - while (hyph_next>0) and (hyph_word[hyph_next-1]>0) do decr(hyph_next); -if (hyph_count=hyph_size)or(hyph_next=0) then - overflow("exception dictionary",hyph_size); -@:TeX capacity exceeded exception dictionary}{\quad exception dictionary@> -incr(hyph_count); -while hyph_word[h]<>0 do - begin @; - if hyph_link[h]=0 then - begin - hyph_link[h]:=hyph_next; - if hyph_next >= hyph_size then hyph_next:=hyph_prime; - if hyph_next > hyph_prime then incr(hyph_next); - end; - h:=hyph_link[h]-1; - end; - -found: hyph_word[h]:=s; hyph_list[h]:=p -@z - -%%%%%%%% dynamic hyph_size -@x 18292 m.941 -@ @= -k:=hyph_word[h]; -if length(k)length(s) then goto not_found; -u:=str_start(k); v:=str_start(s); -repeat if str_pool[u]str_pool[v] then goto not_found; -incr(u); incr(v); -until u=str_start(k+1); -found:q:=hyph_list[h]; hyph_list[h]:=p; p:=q;@/ -t:=hyph_word[h]; hyph_word[h]:=s; s:=t; -not_found: -@y 18303 -@ @= -{This is now a simple hash list, not an ordered one, so -the module title is no longer descriptive.} -k:=hyph_word[h]; -if length(k)<>length(s) then goto not_found; -u:=str_start(k); v:=str_start(s); -repeat if str_pool[u]<>str_pool[v] then goto not_found; -incr(u); incr(v); -until u=str_start(k+1); -{repeat hyphenation exception; flushing old data} -flush_string; s:=hyph_word[h]; {avoid |slow_make_string|!} -decr(hyph_count); -{ We could also |flush_list(hyph_list[h]);|, but it interferes - with \.{trip.log}. } -goto found; -not_found: -@z - -@x [43.943] l.18346 - web2c can't parse negative lower bounds in arrays. Sorry. -@!init@! trie_op_hash:array[-trie_op_size..trie_op_size] of 0..trie_op_size; -@y -@!init@! trie_op_hash:array[neg_trie_op_size..trie_op_size] of 0..trie_op_size; -@z - -@x [43.944] l.18365 - web2c can't parse negative lower bounds in arrays. Sorry -var h:-trie_op_size..trie_op_size; {trial hash location} -@y -var h:neg_trie_op_size..trie_op_size; {trial hash location} -@z - -@x [43.944] l.18370 - Another casting problem, and use |neg_trie_op_size|. -begin h:=abs(n+313*d+361*v+1009*cur_lang) mod (trie_op_size+trie_op_size) - - trie_op_size; -@y -begin h:=abs(intcast(n)+313*intcast(d)+361*intcast(v)+1009*intcast(cur_lang)) - mod (trie_op_size - neg_trie_op_size) - + neg_trie_op_size; -@z - -@x [43.947] l.18438 - Dynamically allocate arrays, and a casting problem. -@!init @!trie_c:packed array[trie_pointer] of ASCII_code; - {characters to match} -@t\hskip10pt@>@!trie_o:packed array[trie_pointer] of quarterword; - {operations to perform} -@t\hskip10pt@>@!trie_l:packed array[trie_pointer] of trie_pointer; - {left subtrie links} -@t\hskip10pt@>@!trie_r:packed array[trie_pointer] of trie_pointer; - {right subtrie links} -@t\hskip10pt@>@!trie_ptr:trie_pointer; {the number of nodes in the trie} -@t\hskip10pt@>@!trie_hash:packed array[trie_pointer] of trie_pointer; - {used to identify equivalent subtries} -tini -@y -@!init @!trie_c:^ASCII_code; - {characters to match} -@t\hskip10pt@>@!trie_o:^quarterword; - {operations to perform} -@t\hskip10pt@>@!trie_l:^trie_pointer; - {left subtrie links} -@t\hskip10pt@>@!trie_r:^trie_pointer; - {right subtrie links} -@t\hskip10pt@>@!trie_ptr:trie_pointer; {the number of nodes in the trie} -@t\hskip10pt@>@!trie_hash:^trie_pointer; - {used to identify equivalent subtries} -tini -@z - -@x [43.948] l.18471 - Another casting problem. -begin h:=abs(trie_c[p]+1009*trie_o[p]+@| - 2718*trie_l[p]+3142*trie_r[p]) mod trie_size; -@y -begin h:=abs(intcast(trie_c[p])+1009*intcast(trie_o[p])+@| - 2718*intcast(trie_l[p])+3142*intcast(trie_r[p])) mod trie_size; -@z - -@x [43.590] l.18524 - Dynamically allocate & larger tries. -@!init@!trie_taken:packed array[1..trie_size] of boolean; - {does a family start here?} -@t\hskip10pt@>@!trie_min:array[ASCII_code] of trie_pointer; - {the first possible slot for each character} -@t\hskip10pt@>@!trie_max:trie_pointer; {largest location used in |trie|} -@t\hskip10pt@>@!trie_not_ready:boolean; {is the trie still in linked form?} -tini -@y -@!init@!trie_taken: ^boolean; - {does a family start here?} -@t\hskip10pt@>@!trie_min:^trie_pointer; - {the first possible slot for each character} -@t\hskip10pt@>@!trie_max:trie_pointer; {largest location used in |trie|} -@t\hskip10pt@>@!trie_not_ready:boolean; {is the trie still in linked form?} -tini -@z - -@x [43.951] l.18539 - Dynamically allocate. -trie_not_ready:=true; trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0; -@y -trie_not_ready:=true; -@z - -%% -%% We can rewrite the original code after "main_loop_move+2" upto the -%% "tail_append(lig_stack)" in module 1036 as -%% -% -% main_loop_move+2: -% if font_bc[main_f]<=cur_chr then -% if cur_chr<=font_ec[main_f] then -% begin main_i:=char_info(main_f)(cur_l); -% if char_exists(main_i) goto main_loop_move+3; -% end; -% char_warning(main_f,cur_chr); free_avail(lig_stack); goto big_switch; -% main_loop_move+3: -% tail_append(lig_stack) {|main_loop_lookahead| is next} -% - -@x [49.1252] l.23230 - INI = VIR, so have to do runtime test. -hyph_data: if cur_chr=1 then - begin @!init new_patterns; goto done;@;@+tini@/ -@y 23215 -hyph_data: if cur_chr=1 then - begin @!init if ini_version then - begin new_patterns; goto done; end; @;@+tini@/ -@z - -@x -@!flushable_string:str_number; {string not yet referenced} -@y -@z - -% undo Knuth's change because -% a) the string is already replaced in |scan_file_name| and therefore -% b) the wrong string will get flushed!!! -% -@x [49.1260] l.23331 new_font: string recycling -- already done -flushable_string:=str_ptr-1; -@y -@z - -% If you don't want to remove code with the following change, -% please replace the former change by -% -% @x -% flushable_string:=str_ptr-1; -% @y -% if cur_name=str_ptr-1 then -% flushable_string:=str_ptr-1 -% else -% flushable_string:=str_ptr; {number of a non-existing} -% @z -% -% otherwise the wrong string will get removed by |flush_string|!! -% -@x [49.1260] l.23334 new_font: string recycling -- already done - begin if cur_name=flushable_string then - begin flush_string; cur_name:=font_name(f); - end; - if s>0 then -@y - begin if s>0 then -@z - -@x [49.1265] if batchmode, mktex... scripts should be silent. -interaction:=cur_chr; -@y -interaction:=cur_chr; -if interaction = batch_mode -then kpse_make_tex_discard_errors := 1 -else kpse_make_tex_discard_errors := 0; -@z - -@x [49.1275] l.23441 - Same stuff as for \input, this time for \openin. - if cur_ext="" then cur_ext:=".tex"; - pack_cur_name; - if a_open_in(read_file[n]) then read_open[n]:=just_open; -@y - pack_cur_name; - tex_input_type:=0; {Tell |open_input| we are \.{\\openin}.} - if open_in_name_ok(name_of_file+1) - and a_open_in(read_file[n], kpse_tex_format) then - begin k:=1; - name_in_progress:=true; - begin_name; - while (k<=name_length)and(more_name(name_of_file[k])) do - incr(k); - end_name; - name_in_progress:=false; - read_open[n]:=just_open; - end; -@z - -@x [50.1301] l.23679 - INI = VIR, so runtime test. -format_ident:=" (INIALEPH)"; -@y -if ini_version then format_ident:=" (INIALEPH)"; -@z - -% The GNU C compiler complains of unused variables. -@x [50.1302] l.23690 - Eliminate now-unused variable `w' in `store_fmt_file'. -var j,@!k,@!l:integer; {all-purpose indices} -@!p,@!q: pointer; {all-purpose pointers} -@!x: integer; {something to dump} -@!w: four_quarters; {four ASCII codes} -@y -var j,@!k:integer; {all-purpose indices} -@!p,@!q: pointer; {all-purpose pointers} -@!x: integer; {something to dump} -@!format_engine: ^char; -@z - -@x [50.1303] l.23722 - Ditto, for `load_fmt_file'. -@!w: four_quarters; {four ASCII codes} -@y -@!format_engine: ^char; -@z - -@x [50.1305] l.23751 - Do dumping and undumping of fmt files in C. -@d dump_wd(#)==begin fmt_file^:=#; put(fmt_file);@+end -@d dump_int(#)==begin fmt_file^.int:=#; put(fmt_file);@+end -@d dump_hh(#)==begin fmt_file^.hh:=#; put(fmt_file);@+end -@d dump_qqqq(#)==begin fmt_file^.qqqq:=#; put(fmt_file);@+end -@y -@z -@x [1306] -@d undump_wd(#)==begin get(fmt_file); #:=fmt_file^;@+end -@d undump_int(#)==begin get(fmt_file); #:=fmt_file^.int;@+end -@d undump_hh(#)==begin get(fmt_file); #:=fmt_file^.hh;@+end -@d undump_qqqq(#)==begin get(fmt_file); #:=fmt_file^.qqqq;@+end -@y -@z -@x [still 1306] debug format file -@d undump_size_end_end(#)==too_small(#)@+else undump_end_end -@y -@d format_debug_end(#)== - write_ln (stderr, ' = ', #); - end; -@d format_debug(#)== - if debug_format_file then begin - write (stderr, 'fmtdebug:', #); - format_debug_end -@d undump_size_end_end(#)== - too_small(#)@+else format_debug (#)(x); undump_end_end -@z - -@x [50,1307] l.23779 - texarray -dump_int(@$);@/ -@y -dump_int(@"57325458); {Web2C \TeX's magic constant: "W2TX"} -{Align engine to 4 bytes with one or more trailing NUL} -x:=strlen(engine_name); -format_engine:=xmalloc_array(char,x+4); -strcpy(format_engine, engine_name); -for k:=x to x+3 do format_engine[k]:=0; -x:=x+4-(x mod 4); -dump_int(x);dump_things(format_engine[0], x); -libc_free(format_engine);@/ -dump_int(@$);@/ -dump_int(max_halfword);@/ -@z - -%%%%%%%% dynamic hyph_size -@x 23784 m.1307 -dump_int(hyph_size) -@y 23784 -dump_int(hyph_prime) -@z - -@x [50.1308] l.23793 - texarray -x:=fmt_file^.int; -if x<>@$ then goto bad_fmt; {check that strings are the same} -@/@@/ -undump_int(x); -if x<>mem_bot then goto bad_fmt; -undump_int(x); -if x<>mem_top then goto bad_fmt; -@y -@+init -if ini_version then - begin libc_free(str_pool); libc_free(str_start_ar); libc_free(yzmem); - end; -@+tini -undump_int(x); -format_debug('string pool checksum')(x); -if x<>@$ then goto bad_fmt; {check that strings are the same} -undump_int(x); -if x<>max_halfword then goto bad_fmt; {check |max_halfword|} -@/@@/ - -undump_int(x); format_debug ('mem_bot')(x); -if x<>mem_bot then goto bad_fmt; -undump_int(mem_top); format_debug ('mem_top')(mem_top); -if mem_bot+1100>mem_top then goto bad_fmt; - - -head:=contrib_head; tail:=contrib_head; - page_tail:=page_head; {page initialization} - -mem_min := mem_bot - extra_mem_bot; -mem_max := mem_top + extra_mem_top; - -yzmem:=xmalloc_array (memory_word, mem_max - mem_min); -zmem := yzmem - mem_min; {this pointer arithmetic fails with some compilers} -mem := zmem; -@z - -%%%%%%%% dynamic hyph_size -@x 23804 m.1308 -if x<>hyph_size then goto bad_fmt -@y 23804 -if x<>hyph_prime then goto bad_fmt -@z - -% [1309] Make dumping/undumping more efficient by doing whole arrays at -% a time, via fread/fwrite in texmfmp.c. -@x [50.1309] l.23814 - Make dumping/undumping more efficient. -for k:=too_big_char to str_ptr do dump_int(str_start(k)); -k:=0; -while k+40 then - begin dump_int(k); dump_int(hyph_word[k]); dump_int(hyph_list[k]); - end; -@y 24061 -dump_int(hyph_count); -if hyph_next <= hyph_prime then hyph_next:=hyph_size; -dump_int(hyph_next);{minumum value of |hyphen_size| needed} -for k:=0 to hyph_size do if hyph_word[k]<>0 then - begin dump_int(k+65536*hyph_link[k]); - {assumes number of hyphen exceptions does not exceed 65535} - dump_int(hyph_word[k]); dump_int(hyph_list[k]); - end; -@z - -@x [50.1324] l.24066 - Make dumping/undumping more efficient - trie -for k:=0 to trie_max do dump_hh(trie[k]); -dump_int(max_hyph_char); -dump_int(trie_op_ptr); -for k:=1 to trie_op_ptr do - begin dump_int(hyf_distance[k]); - dump_int(hyf_num[k]); - dump_int(hyf_next[k]); - end; -@y -dump_things(trie[0],trie_max+1); -dump_int(max_hyph_char); -dump_int(trie_op_ptr); -dump_things(hyf_distance[1], trie_op_ptr); -dump_things(hyf_num[1], trie_op_ptr); -dump_things(hyf_next[1], trie_op_ptr); -@z - -@x [50.1325] l.24086 - Make dumping/undumping more efficient - trie -@= -@y -{This is only used for the hyphenation tries below, and the size is - always |j+1|.} -@d xmalloc_and_undump(#) == - if not # then #:=xmalloc_array(two_halves, j+1); - undump_things(#[0], j+1); - -@= -@z - -%%%%%%%% dynamic hyph_size -@x 24087 m.1325 -undump(0)(hyph_size)(hyph_count); -for k:=1 to hyph_count do - begin undump(0)(hyph_size)(j); - undump(0)(str_ptr)(hyph_word[j]); - undump(min_halfword)(max_halfword)(hyph_list[j]); - end; -@y 24092 -undump_size(0)(hyph_size)('hyph_size')(hyph_count); -undump_size(hyph_prime)(hyph_size)('hyph_size')(hyph_next); -j:=0; -for k:=1 to hyph_count do - begin undump_int(j); if j<0 then goto bad_fmt; - if j>65535 then - begin hyph_next:= j div 65536; j:=j - hyph_next * 65536; end - else hyph_next:=0; - if (j>=hyph_size)or(hyph_next>hyph_size) then goto bad_fmt; - hyph_link[j]:=hyph_next; - undump(0)(str_ptr)(hyph_word[j]); - undump(min_halfword)(max_halfword)(hyph_list[j]); - end; - {|j| is now the largest occupied location in |hyph_word|} - incr(j); - if j= hyph_size then hyph_next:=hyph_prime else - if hyph_next >= hyph_prime then incr(hyph_next); -@z - - -@x [50.1325] l.24094 - Make dumping/undumping more efficient - trie -for k:=0 to j do undump_hh(trie[k]); -undump_int(max_hyph_char); -undump_size(0)(trie_op_size)('trie op size')(j); @+init trie_op_ptr:=j;@+tini -for k:=1 to j do - begin undump(0)(63)(hyf_distance[k]); {a |small_number|} - undump(0)(63)(hyf_num[k]); - undump(min_quarterword)(max_quarterword)(hyf_next[k]); - end; -@y -{The first array has not been allocated yet unless we're \.{INITEX}; - we do that precisely so we don't allocate more space than necessary.} -xmalloc_and_undump(trie); -undump_int(max_hyph_char); -undump_size(0)(trie_op_size)('trie op size')(j); @+init trie_op_ptr:=j;@+tini -{I'm not sure we have such a strict limitation (64) on these values, so - let's leave them unchecked.} -undump_things(hyf_distance[1], j); -undump_things(hyf_num[1], j); -undump_upper_check_things(max_quarterword, hyf_next[1], j); -@z - -@x [50.1327] l.24117 - Allow command line to override dumped value. -undump(batch_mode)(error_stop_mode)(interaction); -@y -undump(batch_mode)(error_stop_mode)(interaction); -if interaction_option<>unspecified_mode then interaction:=interaction_option; -@z - -% [50.1327] As with TFM files, `eof' here means `have we previously -% encountered the end-of-file', not `are we at the end of the file'. -@x [50.1327] l.24120 - dumping/undumping, replace eof() by feof() -if (x<>69069)or eof(fmt_file) then goto bad_fmt -@y -if (x<>69069)or feof(fmt_file) then goto bad_fmt -@z - -@x [50.1328] l.24124 - Eliminate probably wrong word `preloaded' from format_idents. -print(" (preloaded format="); print(job_name); print_char(" "); -@y -print(" (format="); print(job_name); print_char(" "); -@z - -@x [51.1332] l.24203 - make the main program a procedure, for eqtb hack. -@p begin @!{|start_here|} -@y -@d const_chk(#)==begin if # < inf@&# then # := inf@&# else - if # > sup@&# then # := sup@&# end - -{|setup_bound_var| stuff duplicated in \.{mf.ch}.} -@d setup_bound_var(#)==bound_default:=#; setup_bound_var_end -@d setup_bound_var_end(#)==bound_name:=#; setup_bound_var_end_end -@d setup_bound_var_end_end(#)== - setup_bound_variable(address_of(#), bound_name, bound_default); - -@p procedure main_body; -begin @!{|start_here|} - -{Always start the file recorder?} - {|recorder_enabled:=true;|} - -{Bounds that may be set from the configuration file. We want the user to - be able to specify the names with underscores, but \.{TANGLE} removes - underscores, so we're stuck giving the names twice, once as a string, - once as the identifier. How ugly.} - setup_bound_var (1000000)('main_memory')(main_memory); - {|memory_word|s for |mem| in \.{INITEX}} - setup_bound_var (0)('extra_mem_top')(extra_mem_top); - {increase high mem in \.{VIRTEX}} - setup_bound_var (0)('extra_mem_bot')(extra_mem_bot); - {increase low mem in \.{VIRTEX}} - setup_bound_var (300000)('pool_size')(pool_size); - setup_bound_var (200000)('string_vacancies')(string_vacancies); - setup_bound_var (5000)('pool_free')(pool_free); {min pool avail after fmt} - setup_bound_var (100000)('max_strings')(max_strings); - setup_bound_var (100)('strings_free')(strings_free); - setup_bound_var (20000)('trie_size')(trie_size); - {if |ssup_trie_size| increases, recompile} - setup_bound_var (659)('hyph_size')(hyph_size); - setup_bound_var (20000)('buf_size')(buf_size); - setup_bound_var (50)('nest_size')(nest_size); - setup_bound_var (15)('max_in_open')(max_in_open); - setup_bound_var (60)('param_size')(param_size); - setup_bound_var (4000)('save_size')(save_size); - setup_bound_var (300)('stack_size')(stack_size); - setup_bound_var (16384)('dvi_buf_size')(dvi_buf_size); - setup_bound_var (79)('error_line')(error_line); - setup_bound_var (50)('half_error_line')(half_error_line); - setup_bound_var (79)('max_print_line')(max_print_line); - const_chk (main_memory); -@+init - if ini_version then begin - extra_mem_top := 0; - extra_mem_bot := 0; - end; -@+tini - if extra_mem_bot>sup_main_memory then extra_mem_bot:=sup_main_memory; - if extra_mem_top>sup_main_memory then extra_mem_top:=sup_main_memory; - mem_top := mem_bot + main_memory; - mem_min := mem_bot; - mem_max := mem_top; - - {Check other constants against their sup and inf.} - const_chk (trie_size); - const_chk (hyph_size); - const_chk (buf_size); - const_chk (nest_size); - const_chk (max_in_open); - const_chk (param_size); - const_chk (save_size); - const_chk (stack_size); - const_chk (dvi_buf_size); - const_chk (pool_size); - const_chk (string_vacancies); - const_chk (pool_free); - const_chk (max_strings); - const_chk (strings_free); - if error_line > ssup_error_line then error_line := ssup_error_line; - - {array memory allocation} - buffer:=xmalloc_array (ASCII_code, buf_size); - nest:=xmalloc_array (list_state_record, nest_size); - save_stack:=xmalloc_array (memory_word, save_size); - input_stack:=xmalloc_array (in_state_record, stack_size); - input_file:=xmalloc_array (alpha_file, max_in_open); - input_file_mode:=xmalloc_array (halfword, max_in_open); - input_file_translation:=xmalloc_array (halfword, max_in_open); - line_stack:=xmalloc_array (integer, max_in_open); - param_stack:=xmalloc_array (halfword, param_size); - dvi_buf:=xmalloc_array (real_eight_bits, dvi_buf_size); - hyph_word:=xmalloc_array (str_number, hyph_size); - hyph_list:=xmalloc_array (halfword, hyph_size); - hyph_link:=xmalloc_array (hyph_pointer, hyph_size); -@+init -if ini_version then begin - yzmem:=xmalloc_array (memory_word, mem_top - mem_bot); - zmem := yzmem - mem_bot; {Some compilers require |mem_bot=0|} - - str_start_ar:=xmalloc_array (pool_pointer, max_strings-biggest_char); - str_pool:=xmalloc_array (packed_ASCII_code, pool_size); -end; -@+tini -@z - -@x [51.1332] l.24215 - INI = VIR, so pool init needs runtime test -@!init if not get_strings_started then goto final_end; -init_prim; {call |primitive| for each primitive} -init_str_ptr:=str_ptr; init_pool_ptr:=pool_ptr; fix_date_and_time; -tini@/ -@y -@+init if ini_version then - begin if not get_strings_started then goto final_end; - init_prim; {call |primitive| for each primitive} - init_str_ptr:=str_ptr; init_pool_ptr:=pool_ptr; fix_date_and_time; - end; -@+tini@/ -@z - -@x [51.1332] l.24225 - main -end_of_TEX: close_files_and_terminate; -final_end: ready_already:=0; -end. -@y -close_files_and_terminate; -final_end: do_final_end; -end {|main_body|}; -@z - -@x [51.1333] l.24254 - Print new line before termination; switch to editor if necessary. - slow_print(log_name); print_char("."); - end; - end; -@y - slow_print(log_name); print_char("."); - end; - end; -print_ln; -if (edit_name_start<>0) and (interaction>batch_mode) then - call_edit(str_pool,edit_name_start,edit_name_length,edit_line); -@z - -@x [51.1334] l. - Remove reference to fontmemsize - wlog_ln(', out of ',font_mem_size:1,' for ',font_max-font_base:1);@/ -@y -@z - -@x [51.1335] l.24335 - Only do dump if ini. - begin @!init for c:=top_mark_code to split_bot_mark_code do - if cur_mark[c]<>null then delete_token_ref(cur_mark[c]); - if sa_mark<>null then - if do_marks(destroy_marks,0,sa_mark) then sa_mark:=null; - for c:=last_box_code to vsplit_code do flush_node_list(disc_ptr[c]); - store_fmt_file; return;@+tini@/ -@y - begin @!init if ini_version then - begin for c:=top_mark_code to split_bot_mark_code do - if cur_mark[c]<>null then delete_token_ref(cur_mark[c]); - if sa_mark<>null then - if do_marks(destroy_marks,0,sa_mark) then sa_mark:=null; - for c:=last_box_code to vsplit_code do flush_node_list(disc_ptr[c]); - store_fmt_file; return; - end;@+tini@/ -@z - -@x [51.1337] l.24361 - Handle %&format in all cases. -if (format_ident=0)or(buffer[loc]="&") then -@y -if (format_ident=0)or(buffer[loc]="&")or dump_line then -@z - -@x [51.1337] l.24371 - Allocate hyphenation tries. -fix_date_and_time;@/ -@y -fix_date_and_time;@/ - -@!init -if trie_not_ready then begin {initex without format loaded} - trie:=xmalloc_array (two_halves, trie_size); - - trie_c:=xmalloc_array (ASCII_code, trie_size); - trie_o:=xmalloc_array (quarterword, trie_size); - trie_l:=xmalloc_array (trie_pointer, trie_size); - trie_r:=xmalloc_array (trie_pointer, trie_size); - trie_hash:=xmalloc_array (trie_pointer, trie_size); - trie_taken:=xmalloc_array (boolean, trie_size); - trie_min:=xmalloc_array (trie_pointer, too_big_char); - - trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0; - end; - tini@/ - -@z - -% [52.1338] Core-dump in debugging mode on 0 input. Under Unix, it's -% not possible to portably switch into the debugger while a program is -% running. The best approximation is to do a core dump, then run the -% debugger on it later. -@x [52.1338] l.24411 - Core-dump in debugging mode on 0 input. - begin goto breakpoint;@\ {go to every label at least once} - breakpoint: m:=0; @{'BREAKPOINT'@}@\ - end -@y - dump_core {do something to cause a core dump} -@z - -% The GNU C compiler complains of unused variables. -@x -procedure do_extension; -var i,@!j,@!k:integer; {all-purpose integers} -@!p,@!q,@!r:pointer; {all-purpose pointers} -@y -procedure do_extension; -var @!k:integer; {all-purpose integers} -@!p:pointer; {all-purpose pointers} -@z - -% [53.1350] (new_write_whatsit) Allow 18 as a \write stream. We never -% refer to an actual file, though, so we don't need to change the -% write_file or write_open arrays. We provide for disabling this at -% runtime, for paranoids. -@x [53.1350] l.24609 - system: Allow 18 as a \write stream. - else if cur_val>15 then cur_val:=16; -@y - else if (cur_val>15) and (cur_val <> 18) then cur_val:=16; -@z - -@x [53.1370] l.24770 - system: (write_out) \write18{foo} => system(foo). -begin @ system(foo). -if write_open[j] then selector:=j -@y -if shell_enabled_p and (j=18) then - begin selector := new_string; - end -else if write_open[j] then selector:=j -@z - -% Then call system(3) on that string. -@x [53.1370] l.24779 - system: (write_out) \write18{foo} => system(foo). -flush_list(def_ref); selector:=old_setting; -@y -flush_list(def_ref); -if j=18 then - begin if (tracing_online<=0) then - selector:=log_only {Show what we're doing in the log file.} - else selector:=term_and_log; {Show what we're doing.} - print_nl("system("); - for d:=0 to cur_length-1 do - begin {|print| gives up if passed |str_ptr|, so do it by hand.} - print(so(str_pool[str_start(str_ptr)+d])); {N.B.: not |print_char|} - end; - print(")..."); - if shell_enabled_p then - begin str_room(1); append_char(0); {Append a null byte to the expansion.} - clobbered:=false; - for d:=0 to cur_length-1 do {Convert to external character set.} - begin str_pool[str_start(str_ptr)+d]:=xchr[str_pool[str_start(str_ptr)+d]]; - if (str_pool[str_start(str_ptr)+d]=null_code) - and (d - -@= -@!edit_name_start: pool_pointer; {where the filename to switch to starts} -@!edit_name_length,@!edit_line: integer; {what line to start editing at} -@!ipc_on: integer; {level of IPC action, 0 for none [default]} - -@ The |edit_name_start| will be set to point into |str_pool| somewhere after -its beginning if \TeX\ is supposed to switch to an editor on exit. - -@= -edit_name_start:=0; - -@ These are used when we regenerate the representation of the first 256 -strings. - -@ = -@!save_str_ptr: str_number; -@!save_pool_ptr: pool_pointer; -@!shell_enabled_p: c_int_type; -@!output_comment: ^char; -@!k,l: 0..65535; {used by `Make the first 256 strings', etc.} - -@ When debugging a macro package, it can be useful to see the exact -control sequence names in the format file. For example, if ten new -csnames appear, it's nice to know what they are, to help pinpoint where -they came from. (This isn't a truly ``basic'' printing procedure, but -that's a convenient module in which to put it.) - -@ = -procedure print_csnames (hstart:integer; hfinish:integer); -var c,h:integer; -begin - write_ln(stderr, 'fmtdebug:csnames from ', hstart, ' to ', hfinish, ':'); - for h := hstart to hfinish do begin - if newtext(h) > 0 then begin {if have anything at this position} - for c := str_start(newtext(h)) to str_start(newtext(h) + 1) - 1 - do begin - put_byte(str_pool[c], stderr); {print the characters} - end; - write_ln(stderr, '|'); - end; - end; -end; - -@ Are we printing extra info as we read the format file? - -@ = -@!debug_format_file: boolean; - - -@* \[54/web2c-string] The string recycling routines. \TeX{} uses 2 -upto 4 {\it new\/} strings when scanning a filename in an \.{\\input}, -\.{\\openin}, or \.{\\openout} operation. These strings are normally -lost because the reference to them are not saved after finishing the -operation. |search_string| searches through the string pool for the -given string and returns either 0 or the found string number. - -@= -function search_string(@!search:str_number):str_number; -label found; -var result: str_number; -@!s: str_number; {running index} -@!len: integer; {length of searched string} -begin result:=0; len:=length(search); -if len=0 then {trivial case} - begin result:=""; goto found; - end -else begin s:=search-1; {start search with newest string below |s|; |search>1|!} - while s>65535 do {first 65536 strings depend on implementation!!} - begin if length(s)=len then - if str_eq_str(s,search) then - begin result:=s; goto found; - end; - decr(s); - end; - end; -found:search_string:=result; -end; - -@ The following routine is a variant of |make_string|. It searches -the whole string pool for a string equal to the string currently built -and returns a found string. Otherwise a new string is created and -returned. Be cautious, you can not apply |flush_string| to a replaced -string! - -@= -function slow_make_string : str_number; -label exit; -var s: str_number; {result of |search_string|} -@!t: str_number; {new string} -begin t:=make_string; s:=search_string(t); -if s>0 then - begin flush_string; slow_make_string:=s; return; - end; -slow_make_string:=t; -exit:end; - - -@* \[54] System-dependent changes. -@z diff --git a/Build/source/texk/web2c/alephdir/com16bit-rc2.ch b/Build/source/texk/web2c/alephdir/com16bit-rc2.ch deleted file mode 100644 index 188a9833482..00000000000 --- a/Build/source/texk/web2c/alephdir/com16bit-rc2.ch +++ /dev/null @@ -1,2825 +0,0 @@ -% com16bit.ch: Aleph version of file tex.ch -% -% tex.ch for C compilation with web2c, derived from various other change files. -% By Tim Morgan, UC Irvine ICS Department, and many others. -% -% (05/28/86) ETM Started with TeX 2.0 -% (06/03/87) ETM Brought up to TeX 2.2 -% (09/26/87) ETM Brought up to TeX 2.3 -% (10/01/87) ETM Brought up to TeX 2.5 -% (12/21/87) ETM Brought up to TeX 2.7 -% (01/14/88) ETM Brought up to TeX 2.9 -% (02/20/88) PAM Revised format and module numbers -% (03/01/88) ETM Eliminated some unused variables and unnecesary tests -% (05/09/88) ETM Added yet another casting bug fix -% (06/21/88) ETM Brought up to TeX version 2.93 -% (12/11/88) ETM Brought up to TeX version 2.94 -% (01/12/89) PAM Brought up to TeX version 2.95 -% (02/14/89) ETM Brought up to TeX version 2.96 -% (03/10/89) ETM Brought up to TeX version 2.98 -% (07/06/89) ETM Brought up to TeX version 2.991 -% (11/30/89) KB To version 2.992 (8-bit). -% (01/10/90) SR To version 2.993. -% (03/27/90) KY To version 3.0. -% (more recent changes in ChangeLog) -% -% The TeX program is copyright (C) 1982 by D. E. Knuth. -% TeX is a trademark of the American Mathematical Society. -% -% The module numbers in this change file refer to TEX.WEB 3.141592 as -% of March, 1995 (published as Donald E. Knuth, TeX: The Program, -% Volume B of Computers & Typesetting). - -@x [0.0] l.83 - WEAVE: print changes only. - \def\?##1]{\hbox to 1in{\hfil##1.\ }} - } -@y 83 - \def\?##1]{\hbox{Changes to \hbox to 1em{\hfil##1}.\ }} - } -\let\maybe=\iffalse -@z - -@x -@d banner=='This is Aleph, Version 3.1415926-',Omega_version_banner,'-',eTeX_version_banner,'-',Aleph_version_banner {printed when \TeX\ starts} -@y -@d banner=='This is Aleph, Version 3.1415926-',Omega_version_banner,'-',eTeX_version_banner,'-',Aleph_version_banner {printed when \TeX\ starts} -@d banner_k==banner {Web2C announces itself} -@z - -@x [1.4] l.233 - program header -Actually the heading shown here is not quite normal: The |program| line -does not mention any |output| file, because \ph\ would ask the \TeX\ user -to specify a file name if |output| were specified here. -@:PASCAL H}{\ph@> -@^system dependencies@> -@y -@z - -@x [1.4] l.243 - labels in outer block not needed -program OMEGA; {all file names are defined dynamically} -label @@/ -@y -program OMEGA; {all file names are defined dynamically} -@z - -@x [1.6] l.267 - labels in outer block not needed -@ Three labels must be declared in the main program, so we give them -symbolic names. - -@d start_of_TEX=1 {go here when \TeX's variables are initialized} -@d end_of_TEX=9998 {go here to close files and terminate gracefully} -@d final_end=9999 {this label marks the ending of the program} - -@= -start_of_TEX@t\hskip-2pt@>, end_of_TEX@t\hskip-2pt@>,@,final_end; - {key control points} -@y -@ For Web2c, labels are not declared in the main program, but -we still have to declare the symbolic names. - -@d start_of_TEX=1 {go here when \TeX's variables are initialized} -@d final_end=9999 {this label marks the ending of the program} -@z - -% Here we change these WEB symbols, which are used much as #ifdef's -% are in C, into something which will get translated into actual #ifdef's. -@x [1.7] l.292 - debug..gubed, stat..tats -@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging} -@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging} -@y -@d debug==ifdef('TEXMF_DEBUG') -@d gubed==endif('TEXMF_DEBUG') -@z -@x [1.7] l.297 - debug..gubed, stat..tats -@d stat==@{ {change this to `$\\{stat}\equiv\null$' when gathering - usage statistics} -@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$' when gathering - usage statistics} -@y -@d stat==ifdef('STAT') -@d tats==endif('STAT') -@z - -@x [1.8] l.312 - Same, for `init...tini'. -@d init== {change this to `$\\{init}\equiv\.{@@\{}$' in the production version} -@d tini== {change this to `$\\{tini}\equiv\.{@@\}}$' in the production version} -@y 312 -@d init==ifdef('INITEX') -@d tini==endif('INITEX') -@z - -@x [1.8] l.319 - init...tini is dynamic -@!init @@;@+tini -@y 318 -@!init -if ini_version then - begin @@; - end; -@+tini -@z - -@x [1.11] l.375 - Compile-time constants: most removed for dynamic allocation. -@= -@!mem_max=30000; {greatest index in \TeX's internal |mem| array; - must be strictly less than |max_halfword|; - must be equal to |mem_top| in \.{INITEX}, otherwise |>=mem_top|} -@!mem_min=0; {smallest index in \TeX's internal |mem| array; - must be |min_halfword| or more; - must be equal to |mem_bot| in \.{INITEX}, otherwise |<=mem_bot|} -@!buf_size=500; {maximum number of characters simultaneously present in - current lines of open files and in control sequences between - \.{\\csname} and \.{\\endcsname}; must not exceed |max_halfword|} -@!error_line=72; {width of context lines on terminal error messages} -@!half_error_line=42; {width of first lines of contexts in terminal - error messages; should be between 30 and |error_line-15|} -@!max_print_line=79; {width of longest text lines output; should be at least 60} -@!stack_size=200; {maximum number of simultaneous input sources} -@!max_in_open=6; {maximum number of input files and error insertions that - can be going on simultaneously} -@y -@d file_name_size == maxint -@d ssup_error_line = 255 -@d ssup_max_strings == 2097151 -{Larger values may be used, but then the arrays consume much more memory.} -@d ssup_trie_opcode == 65535 -@d ssup_trie_size == @"3FFFFF - -@d ssup_hyph_size == 65535 {Changing this requires changing (un)dumping!} -@d iinf_hyphen_size == 610 {Must be not less than |hyph_prime|!} - -@= -@!mem_bot=0; {smallest index in the |mem| array dumped by \.{INITEX}; - must not be less than |mem_min|} - {Use |mem_bot=0| for compilers which cannot decrement pointers.} -@z - -@x -@!font_max=65535; {maximum internal font number; must be at most |font_biggest|} -@!param_size=60; {maximum number of simultaneous macro parameters} -@!nest_size=40; {maximum number of semantic levels simultaneously active} -@!max_strings=3000; {maximum number of strings; must not exceed |max_halfword|} -@!string_vacancies=8000; {the minimum number of characters that should be - available for the user's control sequences and font names, - after \TeX's own error messages are stored} -@!pool_size=32000; {maximum number of characters in strings, including all - error messages and help texts, and the names of all fonts and - control sequences; must exceed |string_vacancies| by the total - length of \TeX's own strings, which is currently about 23000} -@!save_size=600; {space for saving values outside of current group; must be - at most |max_halfword|} -@!trie_size=8000; {space for hyphenation patterns; should be larger for - \.{INITEX} than it is in production versions of \TeX} -@!trie_op_size=500; {space for ``opcodes'' in the hyphenation patterns} -@!dvi_buf_size=800; {size of the output buffer; must be a multiple of 8} -@!file_name_size=40; {file names shouldn't be longer than this} -@!pool_name='TeXformats:ALEPH.POOL '; - {string of length |file_name_size|; tells where the string pool appears} -@y -@!font_max=65535; {maximum internal font number; must be at most |font_biggest|} -@!hash_offset=514; {smallest index in hash array, i.e., |hash_base| } - {Use |hash_offset=0| for compilers which cannot decrement pointers.} -@!trie_op_size=15011; {space for ``opcodes'' in the hyphenation patterns; - best if relatively prime to 313, 361, and 1009.} -@!neg_trie_op_size=-15011; {for lower |trie_op_hash| array bound; - must be equal to |-trie_op_size|.} -@!min_trie_op=0; {first possible trie op code for any language} -@!max_trie_op=ssup_trie_opcode; {largest possible trie opcode for any language} -@!pool_name=TEXMF_POOL_NAME; {this is configurable, for the sake of ML-\TeX} - {string of length |file_name_size|; tells where the string pool appears} -@!engine_name=TEXMF_ENGINE_NAME; {the name of this engine} -@# -@!inf_main_memory = 2000000; -@!sup_main_memory = 256000000; - -@!inf_trie_size = 80000; -@!sup_trie_size = ssup_trie_size; - -@!inf_max_strings = 100000; -@!sup_max_strings = ssup_max_strings; - -@!inf_strings_free = 100; -@!sup_strings_free = sup_max_strings; - -@!inf_buf_size = 500; -@!sup_buf_size = 30000000; - -@!inf_nest_size = 40; -@!sup_nest_size = 4000; - -@!inf_max_in_open = 6; -@!sup_max_in_open = 127; - -@!inf_param_size = 60; -@!sup_param_size = 6000; - -@!inf_save_size = 600; -@!sup_save_size = 80000; - -@!inf_stack_size = 200; -@!sup_stack_size = 30000; - -@!inf_dvi_buf_size = 800; -@!sup_dvi_buf_size = 65536; - -@!inf_pool_size = 32000; -@!sup_pool_size = 40000000; -@!inf_pool_free = 1000; -@!sup_pool_free = sup_pool_size; -@!inf_string_vacancies = 8000; -@!sup_string_vacancies = sup_pool_size - 23000; - -@!sup_hyph_size = ssup_hyph_size; -@!inf_hyph_size = iinf_hyphen_size; {Must be not less than |hyph_prime|!} -@z - -@x [1.12] l.427 - Constants that are WEB numeric macros. -@d mem_bot=0 {smallest index in the |mem| array dumped by \.{INITEX}; - must not be less than |mem_min|} -@d mem_top==30000 {largest index in the |mem| array dumped by \.{INITEX}; - must be substantially larger than |mem_bot| - and not greater than |mem_max|} -@d font_base=0 {smallest internal font number; must not be less - than |min_quarterword|} -@d hash_size=65536 {maximum number of control sequences; it should be at most - about |(mem_max-mem_min)/10|} -@d hash_prime=55711 {a prime number equal to about 85\pct! of |hash_size|} -@d hyph_size=307 {another prime; the number of \.{\\hyphenation} exceptions} -@y -@d font_base=0 {smallest internal font number; must not be less - than |min_quarterword|} -@d hash_size=65536 {maximum number of control sequences; it should be at most - about |(mem_max-mem_min)/10|} -@d hash_prime=55711 {a prime number equal to about 85\pct! of |hash_size|} -@d hyph_prime=607 {another prime for hashing \.{\\hyphenation} exceptions; - if you change this, you should also change |iinf_hyphen_size|.} -@z - -@x [1.16] l.498 - Use C macros for `incr' and `decr'. -@d incr(#) == #:=#+1 {increase a variable by unity} -@d decr(#) == #:=#-1 {decrease a variable by unity} -@y -@z - -% The text_char type is used as an array index into xord. The -% default type `char' produces signed integers, which are bad array -% indices in C. -@x [2.19] l.565 - data type text_char is 8-bit ASCII_code -@d text_char == char {the data type of characters in text files} -@y -@d text_char == ASCII_code {the data type of characters in text files} -@z - -% [3.26] name_of_file is no longer an array. And change the destination -% type to text_char, which fixes: -% -% Date: 19 Sep 1994 10:38:24 +0200 -% From: thorinn@diku.dk (Lars Mathiesen) -% When echoed to the screen and in the log, character codes -% above '177 in file names are shown wrongly (typically as ^@). -% -@x [3.26] l.789 - name_of_file is no longer an array -@!name_of_file:packed array[1..file_name_size] of char;@;@/ - {on some systems this may be a \&{record} variable} -@y -@!name_of_file:^char; -@z - -@x [3.27] l.794 - Do file opening in C. -@ The \ph\ compiler with which the present version of \TeX\ was prepared has -extended the rules of \PASCAL\ in a very convenient way. To open file~|f|, -we can write -$$\vbox{\halign{#\hfil\qquad&#\hfil\cr -|reset(f,@t\\{name}@>,'/O')|&for input;\cr -|rewrite(f,@t\\{name}@>,'/O')|&for output.\cr}}$$ -The `\\{name}' parameter, which is of type `{\bf packed array -$[\langle\\{any}\rangle]$ of \\{char}}', stands for the name of -the external file that is being opened for input or output. -Blank spaces that might appear in \\{name} are ignored. - -The `\.{/O}' parameter tells the operating system not to issue its own -error messages if something goes wrong. If a file of the specified name -cannot be found, or if such a file cannot be opened for some other reason -(e.g., someone may already be trying to write the same file), we will have -|@!erstat(f)<>0| after an unsuccessful |reset| or |rewrite|. This allows -\TeX\ to undertake appropriate corrective action. -@:PASCAL H}{\ph@> -@^system dependencies@> - -\TeX's file-opening procedures return |false| if no file identified by -|name_of_file| could be opened. - -@d reset_OK(#)==erstat(#)=0 -@d rewrite_OK(#)==erstat(#)=0 - -@p function a_open_in(var f:alpha_file):boolean; - {open a text file for input} -begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f); -end; -@# -function a_open_out(var f:alpha_file):boolean; - {open a text file for output} -begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f); -end; -@# -function b_open_in(var f:byte_file):boolean; - {open a binary file for input} -begin reset(f,name_of_file,'/O'); b_open_in:=reset_OK(f); -end; -@# -function b_open_out(var f:byte_file):boolean; - {open a binary file for output} -begin rewrite(f,name_of_file,'/O'); b_open_out:=rewrite_OK(f); -end; -@# -function w_open_in(var f:word_file):boolean; - {open a word file for input} -begin reset(f,name_of_file,'/O'); w_open_in:=reset_OK(f); -end; -@# -function w_open_out(var f:word_file):boolean; - {open a word file for output} -begin rewrite(f,name_of_file,'/O'); w_open_out:=rewrite_OK(f); -end; -@y -@ All of the file opening functions are defined in C. -@z - -@x [3.28] l.850 - Do file closing in C. -@ Files can be closed with the \ph\ routine `|close(f)|', which -@:PASCAL H}{\ph@> -@^system dependencies@> -should be used when all input or output with respect to |f| has been completed. -This makes |f| available to be opened again, if desired; and if |f| was used for -output, the |close| operation makes the corresponding external file appear -on the user's area, ready to be read. - -These procedures should not generate error messages if a file is -being closed before it has been successfully opened. - -@p procedure a_close(var f:alpha_file); {close a text file} -begin close(f); -end; -@# -procedure b_close(var f:byte_file); {close a binary file} -begin close(f); -end; -@# -procedure w_close(var f:word_file); {close a word file} -begin close(f); -end; -@y -@ And all the file closing routines as well. -@z - -@x [3.30] l.888 - Array size of input buffer is determined at runtime. -@!buffer:array[0..buf_size] of ASCII_code; {lines of characters being read} -@y -@!buffer:^ASCII_code; {lines of characters being read} -@z - -@x [3.31] l.933 - Do `input_ln' in C. -@p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean; - {inputs the next line or returns |false|} -var last_nonblank:0..buf_size; {|last| with trailing blanks removed} -begin if bypass_eoln then if not eof(f) then get(f); - {input the first character of the line into |f^|} -last:=first; {cf.\ Matthew 19\thinspace:\thinspace30} -if eof(f) then input_ln:=false -else begin last_nonblank:=first; - while not eoln(f) do - begin if last>=max_buf_stack then - begin max_buf_stack:=last+1; - if max_buf_stack=buf_size then - @; - end; - buffer[last]:=f^; get(f); incr(last); - if buffer[last-1]<>" " then last_nonblank:=last; - end; - last:=last_nonblank; input_ln:=true; - end; -end; -@y -We define |input_ln| in C, for efficiency. -@z - -% [3.32] `term_in' and `term_out' are standard input and output. -% Declare the variables that used to be constants. -@x [3.32] l.961 - `term_in' and `term_out' are standard input and output. -@= -@!term_in:alpha_file; {the terminal as an input file} -@!term_out:alpha_file; {the terminal as an output file} -@y -@d term_in==stdin {the terminal as an input file} -@d term_out==stdout {the terminal as an output file} - -@= -@!init -@!ini_version:boolean; {are we \.{INITEX}?} -@!dump_option:boolean; {was the dump name option used?} -@!dump_line:boolean; {was a \.{\%\AM format} line seen?} -tini@/ -@# -@!bound_default:integer; {temporary for setup} -@!bound_name:^char; {temporary for setup} -@# -@!main_memory:integer; {total memory words allocated in initex} -@!extra_mem_bot:integer; {|mem_min:=mem_bot-extra_mem_bot| except in \.{INITEX}} -@!mem_min:integer; {smallest index in \TeX's internal |mem| array; - must be |min_halfword| or more; - must be equal to |mem_bot| in \.{INITEX}, otherwise |<=mem_bot|} -@!mem_top:integer; {largest index in the |mem| array dumped by \.{INITEX}; - must be substantially larger than |mem_bot|, - equal to |mem_max| in \.{INITEX}, else not greater than |mem_max|} -@!extra_mem_top:integer; {|mem_max:=mem_top+extra_mem_top| except in \.{INITEX}} -@!mem_max:integer; {greatest index in \TeX's internal |mem| array; - must be strictly less than |max_halfword|; - must be equal to |mem_top| in \.{INITEX}, otherwise |>=mem_top|} -@!error_line:integer; {width of context lines on terminal error messages} -@!half_error_line:integer; {width of first lines of contexts in terminal - error messages; should be between 30 and |error_line-15|} -@!max_print_line:integer; - {width of longest text lines output; should be at least 60} -@!max_strings:integer; {maximum number of strings; must not exceed |max_halfword|} -@!strings_free:integer; {strings available after format loaded} -@!string_vacancies:integer; {the minimum number of characters that should be - available for the user's control sequences and font names, - after \TeX's own error messages are stored} -@!pool_size:integer; {maximum number of characters in strings, including all - error messages and help texts, and the names of all fonts and - control sequences; must exceed |string_vacancies| by the total - length of \TeX's own strings, which is currently about 23000} -@!pool_free:integer;{pool space free after format loaded} -@!hyph_size:integer; {maximun number of hyphen exceptions} -@!trie_size:integer; {space for hyphenation patterns; should be larger for - \.{INITEX} than it is in production versions of \TeX. 50000 is - needed for English, German, and Portuguese.} -@!buf_size:integer; {maximum number of characters simultaneously present in - current lines of open files and in control sequences between - \.{\\csname} and \.{\\endcsname}; must not exceed |max_halfword|} -@!stack_size:integer; {maximum number of simultaneous input sources} -@!max_in_open:integer; {maximum number of input files and error insertions that - can be going on simultaneously} -@!param_size:integer; {maximum number of simultaneous macro parameters} -@!nest_size:integer; {maximum number of semantic levels simultaneously active} -@!save_size:integer; {space for saving values outside of current group; must be - at most |max_halfword|} -@!dvi_buf_size:integer; {size of the output buffer; must be a multiple of 8} -@!quoted_filename:boolean; {current filename is quoted} -@z - -@x [3.33] l.964 - We don't need to open terminal files. -@ Here is how to open the terminal files -in \ph. The `\.{/I}' switch suppresses the first |get|. -@:PASCAL H}{\ph@> -@^system dependencies@> - -@d t_open_in==reset(term_in,'TTY:','/O/I') {open the terminal for text input} -@d t_open_out==rewrite(term_out,'TTY:','/O') {open the terminal for text output} -@y -@ Here is how to open the terminal files. |t_open_out| does nothing. -|t_open_in|, on the other hand, does the work of ``rescanning,'' or getting -any command line arguments the user has provided. It's defined in C. - -@d t_open_out == {output already open for text output} -@z - -@x [3.34] l.982 - Flushing output to terminal files. -these operations can be specified in \ph: -@:PASCAL H}{\ph@> -@^system dependencies@> - -@d update_terminal == break(term_out) {empty the terminal output buffer} -@d clear_terminal == break_in(term_in,true) {clear the terminal input buffer} -@y -these operations can be specified with {\mc UNIX}. |update_terminal| -does an |fflush|. |clear_terminal| is redefined -to do nothing, since the user should control the terminal. -@^system dependencies@> - -@d update_terminal == fflush (term_out) -@d clear_terminal == do_nothing -@z - -@x [3.35] l.1017 - Do `input_ln' in C => section not needed. -@= -if format_ident=0 then - begin write_ln(term_out,'Buffer size exceeded!'); goto final_end; -@.Buffer size exceeded@> - end -else begin cur_input.loc_field:=first; cur_input.limit_field:=last-1; - overflow("buffer size",buf_size); -@:TeX capacity exceeded buffer size}{\quad buffer size@> - end -@y -Routine is implemented in C; part of module is, however, needed for e-TeX. - -@= - begin cur_input.loc_field:=first; cur_input.limit_field:=last-1; - overflow("buffer size",buf_size); -@:TeX capacity exceeded buffer size}{\quad buffer size@> - end -@z - -@x [3.37] l.1055 - |init_terminal|, reading the command line. -@ The following program does the required initialization -without retrieving a possible command line. -It should be clear how to modify this routine to deal with command lines, -if the system permits them. -@^system dependencies@> - -@p function init_terminal:boolean; {gets the terminal input started} -label exit; -begin t_open_in; -@y -@ The following program does the required initialization. -Iff anything has been specified on the command line, then |t_open_in| -will return with |last > first|. -@^system dependencies@> - -@p function init_terminal:boolean; {gets the terminal input started} -label exit; -begin t_open_in; -if last > first then - begin loc := first; - while (loc < last) and (buffer[loc]=' ') do incr(loc); - if loc < last then - begin init_terminal := true; goto exit; - end; - end; -@z - -@x [3.37] l.1068 - |init_terminal|, output missing newline. - write(term_out,'! End of file on the terminal... why?'); -@y - write_ln(term_out,'! End of file on the terminal... why?'); -@z - -@x [4.38] l.1126 - Array size for string pool is determined at runtime. -@!pool_pointer = 0..pool_size; {for variables that point into |str_pool|} -@!str_number = 0..max_strings; {for variables that point into |str_start|} -@y -@!pool_pointer = integer; {for variables that point into |str_pool|} -@!str_number = 0..ssup_max_strings; {for variables that point into |str_start|} -@z - -@x [4.39] l.1131 - Dynamically size pool arrays. -@!str_pool:packed array[pool_pointer] of packed_ASCII_code; {the characters} -@!str_start_ar : array[str_number] of pool_pointer; {the starting pointers} -@y -@!str_pool: ^packed_ASCII_code; {the characters} -@!str_start_ar : ^pool_pointer; {the starting pointers} -@z - -@x [4.47] l.1237 - string recycling -@p @!init function get_strings_started:boolean; {initializes the string pool, -@y -@p @t\4@>@@/ - -@!init function get_strings_started:boolean; {initializes the string pool, -@z - -@x -@ @d bad_pool(#)==begin wake_up_terminal; write_ln(term_out,#); - a_close(pool_file); get_strings_started:=false; return; - end -@= -name_of_file:=pool_name; {we needn't set |name_length|} -if a_open_in(pool_file) then - begin c:=false; - repeat @; - until c; - a_close(pool_file); get_strings_started:=true; - end -else bad_pool('! I can''t read ALEPH.POOL.') -@.I can't read ALEPH.POOL@> - -@ @= -begin if eof(pool_file) then bad_pool('! ALEPH.POOL has no check sum.'); -@.ALEPH.POOL has no check sum@> -read(pool_file,m,n); {read two digits of string length} -if m='*' then @ -else begin if (m<"0")or(m>"9")or@| - (n<"0")or(n>"9") then - bad_pool('! ALEPH.POOL line doesn''t begin with two digits.'); -@.ALEPH.POOL line doesn't...@> - l:=m*10+n-"0"*11; {compute the length} - if pool_ptr+l+string_vacancies>pool_size then - bad_pool('! You have to increase POOLSIZE.'); -@.You have to increase POOLSIZE@> - for k:=1 to l do - begin if eoln(pool_file) then m:=' '@+else read(pool_file,m); - append_char(m); - end; - read_ln(pool_file); g:=make_string; - end; -end - -@ The \.{WEB} operation \.{@@\$} denotes the value that should be at the -end of this \.{OMEGA.POOL} file; any other value means that the wrong pool -file has been loaded. -@^check sum@> - -@= -begin a:=0; k:=1; -loop@+ begin if (n<"0")or(n>"9") then - bad_pool('! ALEPH.POOL check sum doesn''t have nine digits.'); -@.ALEPH.POOL check sum...@> - a:=10*a+n-"0"; - if k=9 then goto done; - incr(k); read(pool_file,n); - end; -done: if a<>@$ then bad_pool('! ALEPH.POOL doesn''t match; OTANGLE me again.'); -@.ALEPH.POOL doesn't match@> -c:=true; -end -@y -@ @= - g := loadpoolstrings((pool_size-string_vacancies)); - if g=0 then begin - wake_up_terminal; write_ln(term_out,'! You have to increase POOLSIZE.'); - get_strings_started:=false; - return; - end; - get_strings_started:=true; - -@ Empty module - -@ Empty module -@z - -@x [5.54] l.1422 - error_line -@!trick_buf:array[0..error_line] of ASCII_code; {circular buffer for -@y -@!trick_buf:array[0..ssup_error_line] of ASCII_code; {circular buffer for -@z - -@x [5.61] l.1556 - Print rest of banner, eliminate misleading `(no format preloaded)'. -wterm(eTeX_banner); -if format_ident=0 then wterm_ln(' (no format preloaded)') -else begin slow_print(format_ident); print_ln; - end; -@y -wterm(eTeX_banner); -wterm(version_string); -if format_ident>0 then slow_print(format_ident); -print_ln; -@z - -@x [6.73] l.1732 - Add unspecified_mode. -@d error_stop_mode=3 {stops at every opportunity to interact} -@y -@d error_stop_mode=3 {stops at every opportunity to interact} -@d unspecified_mode=4 {extra value for command-line switch} -@z - -@x [6.73] l.1738 - Add interaction_option. -@!interaction:batch_mode..error_stop_mode; {current level of interaction} -@y -@!interaction:batch_mode..error_stop_mode; {current level of interaction} -@!interaction_option:batch_mode..unspecified_mode; {set from command line} -@z - -@x [6.74] l.1740 - Allow override by command line switch. -@ @=interaction:=error_stop_mode; -@y -@ @=if interaction_option=unspecified_mode then - interaction:=error_stop_mode -else - interaction:=interaction_option; -@z - -% [6.81] Eliminate nonlocal goto, since C doesn't have them. -% Plus, it's nicer just to do an exit with the appropriate status code -% under Unix. We call it `uexit' because there's a WEB symbol called -% `exit' already. We use a C macro to change `uexit' back to `exit'. -@x [6.81] l.1852 - Eliminate nonlocal goto, since C doesn't have them. -@= -procedure jump_out; -begin goto end_of_TEX; -end; -@y -@d do_final_end==begin - update_terminal; - ready_already:=0; - if (history <> spotless) and (history <> warning_issued) then - uexit(1) - else - uexit(0); - end - -@= -procedure jump_out; -begin -close_files_and_terminate; -do_final_end; -end; -@z - -@x [6.84] l.1888 - Implement the switch-to-editor option. -line ready to be edited. But such an extension requires some system -wizardry, so the present implementation simply types out the name of the -file that should be -edited and the relevant line number. -@^system dependencies@> - -There is a secret `\.D' option available when the debugging routines haven't -been commented~out. -@^debugging@> -@y -line ready to be edited. -We do this by calling the external procedure |call_edit| with a pointer to -the filename, its length, and the line number. -However, here we just set up the variables that will be used as arguments, -since we don't want to do the switch-to-editor until after TeX has closed -its files. -@^system dependencies@> - -There is a secret `\.D' option available when the debugging routines haven't -been commented~out. -@^debugging@> -@d edit_file==input_stack[base_ptr] -@z - -@x [6.84] l.1903 - Implement the switch-to-editor option. -"E": if base_ptr>0 then - begin print_nl("You want to edit file "); -@.You want to edit file x@> - slow_print(input_stack[base_ptr].name_field); - print(" at line "); print_int(line); - interaction:=scroll_mode; jump_out; -@y -"E": if base_ptr>0 then - begin edit_name_start:=str_start(edit_file.name_field); - edit_name_length:=str_start(edit_file.name_field+1) - - str_start(edit_file.name_field); - edit_line:=line; - jump_out; -@z - -% [7.104] `remainder' is a library routine on some systems, so change -% its name to avoid conflicts. -@x [7.104] l.2227 - avoid name conflicts with lib routine remainder() -|remainder|, holds the remainder after a division. - -@= -@y -|remainder|, holds the remainder after a division. - -@d remainder==tex_remainder - -@= -@z - -@x [7.109] l.2352 - Define glue_ratio in C. -@!glue_ratio=real; {one-word representation of a glue expansion factor} -@y -@z - -@x [8.112] l.2435 - Efficiency. -macros are simplified in the obvious way when |min_quarterword=0|. -@^inner loop@>@^system dependencies@> - -@d qi(#)==#+min_quarterword - {to put an |eight_bits| item into a quarterword} -@d qo(#)==#-min_quarterword - {to take an |eight_bits| item out of a quarterword} -@d hi(#)==#+min_halfword - {to put a sixteen-bit item into a halfword} -@d ho(#)==#-min_halfword - {to take a sixteen-bit item from a halfword} -@y -macros are simplified in the obvious way when |min_quarterword=0|. -So they have been simplified here in the obvious way. -@^inner loop@>@^system dependencies@> - -@d qi(#)==# {to put an |eight_bits| item into a quarterword} -@d qo(#)==# {to take an |eight_bits| item from a quarterword} -@d hi(#)==# {to put a sixteen-bit item into a halfword} -@d ho(#)==# {to take a sixteen-bit item from a halfword} -@z - -% [8.113] We've put the memory structure into the include file -% `texmf.h', since it's too hard to translate automatically. -@x [8.113] l.2453 - data structures for main memory -@!quarterword = min_quarterword..max_quarterword; {1/4 of a word} -@!halfword=min_halfword..max_halfword; {1/2 of a word} -@!two_choices = 1..2; {used when there are two variants in a record} -@!four_choices = 1..4; {used when there are four variants in a record} -@!two_halves = packed record@;@/ - @!rh:halfword; - case two_choices of - 1: (@!lh:halfword); - 2: (@!b0:quarterword; @!b1:quarterword); - end; -@!four_quarters = packed record@;@/ - @!b0:quarterword; - @!b1:quarterword; - @!b2:quarterword; - @!b3:quarterword; - end; -@!memory_word = record@;@/ - case four_choices of - 1: (@!int:integer); - 2: (@!gr:glue_ratio); - 3: (@!hh:two_halves); - 4: (@!qqqq:four_quarters); - end; -@y -@!quarterword = min_quarterword..max_quarterword; -@!halfword = min_halfword..max_halfword; -@!two_choices = 1..2; {used when there are two variants in a record} -@!four_choices = 1..4; {used when there are four variants in a record} -@=#include "texmfmem.h";@> -@=#include "alephmem.h";@> -@z - -% [9.116] Change `mem' to `zmem', so we can define mem to be a register -% pointer to the memory array for speed. -@x [9.116] l.2545 - definition of main memory array -@!mem : array[mem_min..mem_max] of memory_word; {the big dynamic storage area} -@y -@!yzmem : ^memory_word; {the big dynamic storage area} -@!zmem : ^memory_word; {the big dynamic storage area} -@z - -% [9.127] Fix casting problem in C. -% There are several of these. They come from the rules C uses for -% comparing signed and unsigned quantities. Just doing the comparison -% can result in incorrect evaluation wrt the way Pascal would do it. -@x [9.127] l.2739 - Fix casting problem in C. -if r>p+1 then @; -@y 2738 -if r>intcast(p+1) then @; -@z - -% [11.165] Fix the word `free' so that it doesn't conflict with the -% standard C library routine of the same name. -@x [11.165] l.3364 - avoid conflict with lib function free() -are debugging.) -@y -are debugging.) - -@d free==free_arr -@z - -@x [11.165] l.3367 - dummy |free| and |was_free| arrays -@!debug @!free: packed array [mem_min..mem_max] of boolean; {free cells} -@t\hskip10pt@>@!was_free: packed array [mem_min..mem_max] of boolean; -@y - {The debug memory arrays have not been mallocated yet.} -@!debug @!free: packed array [0..9] of boolean; {free cells} -@t\hskip10pt@>@!was_free: packed array [0..9] of boolean; -@z - -@x [12.174] l.3526 - Eliminate unsigned comparisons to zero. - begin if (font(p)font_max) then - print_char("*") -@.*\relax@> - else @; -@y - begin @; -@z - -@x [12.176] l.3563 - Eliminate unsigned comparisons to zero. -begin if p>mem_end then print_esc("CLOBBERED.") -else begin if (font(p)font_max) then print_char("*") -@.*\relax@> - else @; -@y -begin if p>mem_end then print_esc("CLOBBERED.") -else begin @; -@z - -@x [12.186] l.3747 - Don't worry about strange floating point values. - if abs(mem[p+glue_offset].int)<@'4000000 then print("?.?") - else if abs(g)>float_constant(20000) then -@y 3747 - { The Unix |pc| folks removed this restriction with a remark that - invalid bit patterns were vanishingly improbable, so we follow - their example without really understanding it. - |if abs(mem[p+glue_offset].int)<@'4000000 then print('?.?')| - |else| } - if fabs(g)>float_constant(20000) then -@z - - -@x [16.213] l.4321 - texarray -@!nest:array[0..nest_size] of list_state_record; -@y -@!nest:^list_state_record; -@z - -@x [16.215] l.4344 - remove mem[] reference from initialize. -@; -@y -@/{The following piece of code is a copy of module 991:} -page_contents:=empty; page_tail:=page_head; {|link(page_head):=null;|}@/ -last_glue:=max_halfword; last_penalty:=0; last_kern:=0; -page_depth:=0; page_max_depth:=0; -@z - -@x [17.241] l.5219 - Do `fix_date_and_time' in C. -@ The following procedure, which is called just before \TeX\ initializes its -input and output, establishes the initial values of the date and time. -@^system dependencies@> -Since standard \PASCAL\ cannot provide such information, something special -is needed. The program here simply specifies July 4, 1776, at noon; but -users probably want a better approximation to the truth. - -@p procedure fix_date_and_time; -begin time:=12*60; {minutes since midnight} -day:=4; {fourth day of the month} -month:=7; {seventh month of the year} -year:=1776; {Anno Domini} -end; -@y -@ The following procedure, which is called just before \TeX\ initializes its -input and output, establishes the initial values of the date and time. -It calls a macro-defined |date_and_time| routine. |date_and_time| -in turn is a C macro, which calls |get_date_and_time|, passing -it the addresses of the day, month, etc., so they can be set by the -routine. |get_date_and_time| also sets up interrupt catching if that -is conditionally compiled in the C code. -@^system dependencies@> - -@d fix_date_and_time==o_date_and_time(int_base+time_code, - int_base+day_code, - int_base+month_code, - int_base+year_code) -@z - -@x [18.262] l.5584 - Remove more unsigned comparisons to zero. -else if (newtext(p)<0)or(newtext(p)>=str_ptr) then print_esc("NONEXISTENT.") -@y -else if (newtext(p)>=str_ptr) then print_esc("NONEXISTENT.") -@z - -@x [19.271] l.5872 - texarray -@!save_stack : array[0..save_size] of memory_word; -@y -@!save_stack : ^memory_word; -@z - -@x [22.301] l.6432 - texarray -@!input_stack : array[0..stack_size] of in_state_record; -@y -@!input_stack : ^in_state_record; -@z - -@x [22.304] l.6536 - texarray -@!input_file : array[1..max_in_open] of alpha_file; -@!input_file_mode : array[1..max_in_open] of halfword; -@!input_file_translation : array[1..max_in_open] of halfword; -@!line : integer; {current line number in the current source file} -@!line_stack : array[1..max_in_open] of integer; -@y -@!input_file : ^alpha_file; -@!input_file_mode : ^halfword; -@!input_file_translation : ^halfword; -@!line : integer; {current line number in the current source file} -@!line_stack : ^integer; -@z - -@x [22.308] l.6701 - texarray -@!param_stack:array [0..param_size] of pointer; - {token list pointers for parameters} -@y -@!param_stack: ^pointer; - {token list pointers for parameters} -@z - -@x [23.328] l.7043 - keep top of source_filename_stack initialized -incr(in_open); push_input; index:=in_open; -@y -incr(in_open); push_input; index:=in_open; -source_filename_stack[index]:=0;full_source_filename_stack[index]:=0; -@z - -@x [23.331] l.7071 - init source file name stacks -begin input_ptr:=0; max_in_stack:=0; -@y -begin input_ptr:=0; max_in_stack:=0; -source_filename_stack[0]:=0;full_source_filename_stack[0]:=0; -@z - -@x [28.501] l.9747 - \eof18 -if_eof_code: begin scan_four_bit_int; b:=(read_open[cur_val]=closed); - end; -@y -if_eof_code: begin scan_four_bit_int_or_18; - if cur_val=18 then b:=not shellenabledp - else b:=(read_open[cur_val]=closed); - end; -@z - -@x [29.513] l.9951 - Area and extension rules for filenames. -@ The file names we shall deal with for illustrative purposes have the -following structure: If the name contains `\.>' or `\.:', the file area -consists of all characters up to and including the final such character; -otherwise the file area is null. If the remaining file name contains -`\..', the file extension consists of all such characters from the first -remaining `\..' to the end, otherwise the file extension is null. -@y -@ The file names we shall deal with have the -following structure: If the name contains `\./' or `\.:' -(for Amiga only), the file area -consists of all characters up to and including the final such character; -otherwise the file area is null. If the remaining file name contains -`\..', the file extension consists of all such characters from the last -`\..' to the end, otherwise the file extension is null. -@z - -@x [29.513] l.9963 - Area and extension rules for filenames. -@!area_delimiter:pool_pointer; {the most recent `\.>' or `\.:', if any} -@!ext_delimiter:pool_pointer; {the relevant `\..', if any} -@y -@!area_delimiter:pool_pointer; {the most recent `\./', if any} -@!ext_delimiter:pool_pointer; {the most recent `\..', if any} -@z - -@x [29.514] l.9973 - TeX area directories. -@d TEX_area=="TeXinputs:" -@.TeXinputs@> -@d TEX_font_area=="TeXfonts:" -@.TeXfonts@> -@y -In C, the default paths are specified separately. -@z - -@x [29.515] l.9995 - filenames: quoted -begin area_delimiter:=0; ext_delimiter:=0; -@y -begin area_delimiter:=0; ext_delimiter:=0; quoted_filename:=false; -@z - -@x [29.516] l.9992 - filenames: more_name -begin if c=" " then more_name:=false -@y -begin if (c=" ") and stop_at_space and (not quoted_filename) then - more_name:=false -else if c="""" then begin - quoted_filename:=not quoted_filename; - more_name:=true; - end -@z - -@x [29.516] l.9994 - filenames: more_name - if (c=">")or(c=":") then -@y - if IS_DIR_SEP(c) then -@z - -@x [29.516] l.9997 - filenames: more_name - else if (c=".")and(ext_delimiter=0) then ext_delimiter:=cur_length; -@y - else if c="." then ext_delimiter:=cur_length; -@z - -@x [29.517] l.10002 - end_name: string recycling -@ The third. -@^system dependencies@> - -@p procedure end_name; -@y -@ The third. -@^system dependencies@> -If a string is already in the string pool, the function -|slow_make_string| does not create a new string but returns this string -number, thus saving string space. Because of this new property of the -returned string number it is not possible to apply |flush_string| to -these strings. - -@p procedure end_name; -var temp_str: str_number; {result of file name cache lookups} -@!j,@!s,@!t: pool_pointer; {running indices} -@!must_quote:boolean; {whether we need to quote a string} -@z - -@x [29.517] l.10022 - end_name: spaces in filenames -@:TeX capacity exceeded number of strings}{\quad number of strings@> -@y -@:TeX capacity exceeded number of strings}{\quad number of strings@> -str_room(6); {Room for quotes, if needed.} -{add quotes if needed} -if area_delimiter<>0 then begin - {maybe quote |cur_area|} - must_quote:=false; - s:=str_start(str_ptr); - t:=str_start(str_ptr)+area_delimiter; - j:=s; - while (not must_quote) and (j0 then ext_delimiter:=ext_delimiter+2; - area_delimiter:=area_delimiter+2; - pool_ptr:=pool_ptr+2; - end; - end; -{maybe quote |cur_name|} -s:=str_start(str_ptr)+area_delimiter; -if ext_delimiter=0 then t:=pool_ptr else t:=str_start(str_ptr)+ext_delimiter-1; -must_quote:=false; -j:=s; -while (not must_quote) and (j0 then ext_delimiter:=ext_delimiter+2; - pool_ptr:=pool_ptr+2; - end; -if ext_delimiter<>0 then begin - {maybe quote |cur_ext|} - s:=str_start(str_ptr)+ext_delimiter-1; - t:=pool_ptr; - must_quote:=false; - j:=s; - while (not must_quote) and (j0 then - begin cur_area:=temp_str; - decr(str_ptr); {no |flush_string|, |pool_ptr| will be wrong!} - for j:=str_start(str_ptr+1) to pool_ptr-1 do - begin str_pool[j-area_delimiter]:=str_pool[j]; - end; - pool_ptr:=pool_ptr-area_delimiter; {update |pool_ptr|} - end; - end; -if ext_delimiter=0 then - begin cur_ext:=""; cur_name:=slow_make_string; -@z - -@x [29.517] l.10016 - end_name: string recycling -else begin cur_name:=str_ptr; - str_start(str_ptr+1):=str_start(str_ptr)+ext_delimiter-area_delimiter-1; - incr(str_ptr); cur_ext:=make_string; -@y -else begin cur_name:=str_ptr; - str_start(str_ptr+1):=str_start(str_ptr)+ext_delimiter-area_delimiter-1; - incr(str_ptr); cur_ext:=make_string; - decr(str_ptr); {undo extension string to look at name part} - temp_str:=search_string(cur_name); - if temp_str>0 then - begin cur_name:=temp_str; - decr(str_ptr); {no |flush_string|, |pool_ptr| will be wrong!} - for j:=str_start(str_ptr+1) to pool_ptr-1 do - begin str_pool[j-ext_delimiter+area_delimiter+1]:=str_pool[j]; - end; - pool_ptr:=pool_ptr-ext_delimiter+area_delimiter+1; {update |pool_ptr|} - end; - cur_ext:=slow_make_string; {remake extension string} -@z - -@x [29.518] l.10042 - print_file_name: quote if spaces in names. -begin slow_print(a); slow_print(n); slow_print(e); -@y -var must_quote: boolean; {whether to quote the filename} -@!j:pool_pointer; {index into |str_pool|} -begin -must_quote:=false; -if a<>0 then begin - j:=str_start(a); - while (not must_quote) and (j0 then begin - j:=str_start(n); - while (not must_quote) and (j0 then begin - j:=str_start(e); - while (not must_quote) and (j0)and(|str_pool|[|str_start|(|a|)]=""""))or - ((|n|<>0)and(|str_pool|[|str_start|(|n|)]=""""))or - ((|e|<>0)and(|str_pool|[|str_start|(|e|)]=""""));} -if must_quote then print_char(""""); -if a<>0 then - for j:=str_start(a) to str_start(a+1)-1 do - if so(str_pool[j])<>"""" then - print_char(so(str_pool[j])); -if n<>0 then - for j:=str_start(n) to str_start(n+1)-1 do - if so(str_pool[j])<>"""" then - print_char(so(str_pool[j])); -if e<>0 then - for j:=str_start(e) to str_start(e+1)-1 do - if so(str_pool[j])<>"""" then - print_char(so(str_pool[j])); -if must_quote then print_char(""""); -@z - -@x [29.519] l.10051 - have append_to_name skip quotes. -@d append_to_name(#)==begin c:=#; incr(k); - if k<=file_name_size then name_of_file[k]:=xchr[c]; - end -@y -@d append_to_name(#)==begin c:=#; if not (c="""") then begin incr(k); - if k<=file_name_size then name_of_file[k]:=xchr[c]; - end end -@z - -% [29.519] In pack_file_name, leave room for the extra null we append at -% the end of a filename. -@x [29.519] l.10047 - pack_file_name, leave room for the extra null -for j:=str_start(a) to str_start(a+1)-1 do append_to_name(so(str_pool[j])); -@y -if name_of_file then libc_free (name_of_file); -name_of_file:= xmalloc_array(char, 1 + length(a) + length(n) + length(e)); -for j:=str_start(a) to str_start(a+1)-1 do append_to_name(so(str_pool[j])); -@z - -@x [29.519] l.10051 - pack_file_name, append the extra null -for k:=name_length+1 to file_name_size do name_of_file[k]:=' '; -@y -name_of_file[name_length+1]:=0; -@z - -@x [29.520] l.10060 - filenames: default format. -@d format_default_length=20 {length of the |TEX_format_default| string} -@d format_area_length=11 {length of its area part} -@d format_ext_length=4 {length of its `\.{.fmt}' part} -@d format_extension=".fmt" {the extension, as a \.{WEB} constant} -@y -Under {\mc UNIX} we don't give the area part, instead depending -on the path searching that will happen during file opening. Also, the -length will be set in the main program. - -@d format_area_length=0 {length of its area part} -@d format_ext_length=4 {length of its `\.{.fmt}' part} -@d format_extension=".fmt" {the extension, as a \.{WEB} constant} -@z - -@x [29.521] l.10066 - filenames: default format, where `plain.fmt' is. -@!TEX_format_default:packed array[1..format_default_length] of char; - -@ @= -TEX_format_default:='TeXformats:plain.fmt'; -@y -@!format_default_length: integer; -@!TEX_format_default: ^char; - -@ We set the name of the default format file and the length of that name -in C, instead of Pascal, since we want them to depend on the name of the -program. -@z - -@x [29.523] l.10095 - Change to pack_buffered_name as with pack_file_name. -for j:=1 to n do append_to_name(TEX_format_default[j]); -@y -if name_of_file then libc_free (name_of_file); -name_of_file := xmalloc_array (char, 1 + n + (b - a + 1) + format_ext_length); -for j:=1 to n do append_to_name(TEX_format_default[j]); -@z - -@x [29.523] l.10100 - Change to pack_buffered_name as with pack_file_name. -for k:=name_length+1 to file_name_size do name_of_file[k]:=' '; -@y -name_of_file[name_length+1]:=0; -@z - -@x [29.524] l.10118 - Format file opening: only try once, with path searching. - pack_buffered_name(0,loc,j-1); {try first without the system file area} - if w_open_in(fmt_file) then goto found; - pack_buffered_name(format_area_length,loc,j-1); - {now try the system format file area} - if w_open_in(fmt_file) then goto found; -@y - pack_buffered_name(0,loc,j-1); {Kpathsea does everything} - if w_open_in(fmt_file) then goto found; -@z - -@x [29.524] l.10124 - replace `PLAIN' in error messages with `default'. - wterm_ln('Sorry, I can''t find that format;',' will try PLAIN.'); -@y - wterm ('Sorry, I can''t find the format `'); - fputs (name_of_file + 1, stdout); - wterm ('''; will try `'); - fputs (TEX_format_default + 1, stdout); - wterm_ln ('''.'); -@z - -@x [29.524] l.10132 - replace `PLAIN' in error messages with `default'. - wterm_ln('I can''t find the PLAIN format file!'); -@.I can't find PLAIN...@> -@y - wterm ('I can''t find the format file `'); - fputs (TEX_format_default + 1, stdout); - wterm_ln ('''!'); -@.I can't find the format...@> -@z - -@x [29.525] l.10163 - make_name_string -@p function make_name_string:str_number; -var k:1..file_name_size; {index into |name_of_file|} -begin if (pool_ptr+name_length>pool_size)or(str_ptr=max_strings)or - (cur_length>0) then - make_name_string:="?" -else begin for k:=1 to name_length do append_char(name_of_file[k]); - make_name_string:=make_string; - end; -@y -@p function make_name_string:str_number; -var k:1..file_name_size; {index into |name_of_file|} -save_area_delimiter, save_ext_delimiter: pool_pointer; -save_name_in_progress, save_stop_at_space: boolean; -begin if (pool_ptr+name_length>pool_size)or(str_ptr=max_strings)or - (cur_length>0) then - make_name_string:="?" -else begin for k:=1 to name_length do append_char(name_of_file[k]); - make_name_string:=make_string; - {At this point we also set |cur_name|, |cur_ext|, and |cur_area| to - match the contents of |name_of_file|.} - save_area_delimiter:=area_delimiter; save_ext_delimiter:=ext_delimiter; - save_name_in_progress:=name_in_progress; save_stop_at_space:=stop_at_space; - name_in_progress:=true; - begin_name; - stop_at_space:=false; - k:=1; - while (k<=name_length)and(more_name(name_of_file[k])) do - incr(k); - stop_at_space:=save_stop_at_space; - end_name; - name_in_progress:=save_name_in_progress; - area_delimiter:=save_area_delimiter; ext_delimiter:=save_ext_delimiter; - end; -@z - -@x [29.526] l.10194 - stop scanning file name if we're at end-of-line. - if not more_name(cur_chr) then goto done; -@y - {If |cur_chr| is a space and we're not scanning a token list, check - whether we're at the end of the buffer. Otherwise we end up adding - spurious spaces to file names in some cases.} - if (cur_chr=" ") and (state<>token_list) and (loc>limit) then goto done; - if not more_name(cur_chr) then goto done; -@z - -@x [29.530] l.10245 - prompt_file_name: prevent empty filenames. -var k:0..buf_size; {index into |buffer|} -@y -var k:0..buf_size; {index into |buffer|} -@!saved_cur_name:str_number; {to catch empty terminal input} -@!saved_cur_ext:str_number; {to catch empty terminal input} -@!saved_cur_area:str_number; {to catch empty terminal input} -@z - -@x [29.530] l.10252 - prompt_file_name: No default extension is TeX input file. -if e=".tex" then show_context; -@y -if (e=".tex") or (e="") then show_context; -print_ln; print("(Type to retry, or to exit"); -if (e<>"") then - begin - print(" Default file extension is `"); print(e); print("'"); - end; -print(")"); print_ln; -@z - -@x [29.530] l.10258 - prompt_file_name: prevent empty filenames. -clear_terminal; prompt_input(": "); @; -if cur_ext="" then cur_ext:=e; -@y -saved_cur_name:=cur_name; -saved_cur_ext:=cur_ext; -saved_cur_area:=cur_area; -clear_terminal; prompt_input(": "); @; -if (length(cur_name)=0) and (cur_ext="") and (cur_area="") then - begin - cur_name:=saved_cur_name; - cur_ext:=saved_cur_ext; - cur_area:=saved_cur_area; - end -else - if cur_ext="" then cur_ext:=e; -@z - -@x [29.532] l.10263 - avoid conflict, `logname' in on some systems. -@ Here's an example of how these conventions are used. Whenever it is time to -ship out a box of stuff, we shall use the macro |ensure_dvi_open|. - -@y -@ Here's an example of how these conventions are used. Whenever it is time to -ship out a box of stuff, we shall use the macro |ensure_dvi_open|. - -@d log_name == texmf_log_name -@z - -@x [29.534] l.10285 - Adjust for C string conventions. -@!months:packed array [1..36] of char; {abbreviations of month names} -@y -@!months:^char; -j:integer; -@z - -@x [29.534] l. - Send the job_name to the file recorder. -begin old_setting:=selector; -if job_name=0 then job_name:="texput"; -@y -begin old_setting:=selector; -if job_name=0 then job_name:=get_job_name("texput"); -pack_job_name(".ofl"); -recorder_change_filename(stringcast(name_of_file+1)); -@z - -@x [29.536] l.10324 - Print rest of banner. -begin wlog(eTeX_banner); -@y -begin wlog(eTeX_banner); -wlog(version_string); -@z - -@x [29.536] l.10327 - Adjust for C string conventions. -months:='JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'; -@y -months := ' JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'; -@z - -% [29.537] Use a path when calling a_open_in to do a \input; also, try -% to open the file with and without the `.tex' extension, regardless of -% whether the file already has an extension. This allows filenames like -% `foo' and `foo.bar.tex', as well as `foo.tex' and `foo.bar'. -@x [29.537] l.10338 - start_input -begin scan_file_name; {set |cur_name| to desired file name} -if cur_ext="" then cur_ext:=".tex"; -pack_cur_name; -loop@+ begin begin_file_reading; {set up |cur_file| and new level of input} - if a_open_in(cur_file) then goto done; - if cur_area="" then - begin pack_file_name(cur_name,TEX_area,cur_ext); - if a_open_in(cur_file) then goto done; - end; -@y -var temp_str: str_number; -begin scan_file_name; {set |cur_name| to desired file name} -pack_cur_name; -loop@+ begin begin_file_reading; {set up |cur_file| and new level of input} - tex_input_type := 1; {Tell |open_input| we are \.{\\input}.} - {Kpathsea tries all the various ways to get the file.} - if open_in_name_ok(name_of_file+1) - and a_open_in(cur_file, kpse_tex_format) then - goto done; -@z - -@x [29.537] l.10348 - start_input: don't force ".tex" extension. - prompt_file_name("input file name",".tex"); -@y - prompt_file_name("input file name",""); -@z - -@x [29.537] l.10350 - start_input: string recycling -done: name:=a_make_name_string(cur_file); -@y -done: name:=a_make_name_string(cur_file); -if name=str_ptr-1 then {we can try to conserve string pool space now} - begin temp_str:=search_string(name); - if temp_str>0 then - begin name:=temp_str; flush_string; - end; - end; -@z - -@x [29.537] l.10352 - start_input: use different heuristic for initex. - begin job_name:=cur_name; open_log_file; -@y - begin job_name:=get_job_name(cur_name); open_log_file; -@z - -@x [29.537] l.10359 - start_input: don't return filename to string pool. -if name=str_ptr-1 then {we can conserve string pool space now} - begin flush_string; name:=cur_name; - end; -@y -@z - -@x [30.563] l.10943 - Don't use TEX_font_area. -if aire="" then pack_file_name(nom,TEX_font_area,".ofm") -else pack_file_name(nom,aire,".ofm"); -if not b_open_in(tfm_file) then abort; -@y -{|kpse_find_file| will append the |".ofm"| or |".tfm"|, - and avoid searching the disk before the font alias files as well.} -pack_file_name(nom,aire,""); -if not ofm_open_in(tfm_file) then abort; -@z - -% [30.564] Reading the tfm file. As a special case, whenever we open a -% tfm file, we read its first byte into `tfm_temp' right away. TeX -% looks at `fbyte' before calling `fget', so it ends up seeing every -% byte. This is Pascal-like I/O. -@x [30.564] l.10956 - reading the tfm file, define fget & fbyte -@d fget==get(tfm_file) -@d fbyte==tfm_file^ -@y -@d fget==tfm_temp:=getc(tfm_file) -@d fbyte==tfm_temp -@z - -% [32.575] We only want `eof' on the TFM file to be true if we -% previously had EOF, not if we're at EOF now. This is like `feof', and -% unlike our implementation of `eof' elsewhere. -@x [32.575] l.11161 - Reading the tfm file, replace eof() by feof(). -if eof(tfm_file) then abort; -@y -if feof(tfm_file) then abort; -@z - -@x [32.595] l.11860 - texarray -@!dvi_buf:array[dvi_index] of real_eight_bits; {buffer for \.{DVI} output} -@!half_buf:dvi_index; {half of |dvi_buf_size|} -@!dvi_limit:dvi_index; {end of the current half buffer} -@!dvi_ptr:dvi_index; {the next available buffer address} -@y -@!dvi_buf:^real_eight_bits; {buffer for \.{DVI} output} -@!half_buf:integer; {half of |dvi_buf_size|} -@!dvi_limit:integer; {end of the current half buffer} -@!dvi_ptr:integer; {the next available buffer address} -@z - -@x [32.597] l.11886 - write_dvi done in C. -@p procedure write_dvi(@!a,@!b:dvi_index); -var k:dvi_index; -begin for k:=a to b do write(dvi_file,dvi_buf[k]); -end; -@y -In C, we use a macro to call |fwrite| or |write| directly, writing all -the bytes in one shot. Much better even than writing four -bytes at a time. -@z - -@x [32.617] l.12261 - Use output_comment if the user set it. Assume it's short enough. - old_setting:=selector; selector:=new_string; -@y -if output_comment then - begin l:=strlen(output_comment); dvi_out(l); - for s:=0 to l-1 do dvi_out(output_comment[s]); - end -else begin {the default code is unchanged} - old_setting:=selector; selector:=new_string; -@z - -@x [32.617] l.12268 - Use output_comment if the user set it. - pool_ptr:=str_start(str_ptr); {flush the current string} -@y - pool_ptr:=str_start(str_ptr); {flush the current string} -end; -@z - -% We output each portion of the page as we get to it, if we are using -% IPC, so that the previewer (TeXView) can display it immediately. [SPM] -@x [32.640] l.12690 - IPC -dvi_out(eop); incr(total_pages); cur_s:=-1; -@y -dvi_out(eop); incr(total_pages); cur_s:=-1; -ifdef ('IPC') -if ipc_on>0 then - begin if dvi_limit=half_buf then - begin write_dvi(half_buf, dvi_buf_size-1); - flush_dvi; - dvi_gone:=dvi_gone+half_buf; - end; - if dvi_ptr>0 then - begin write_dvi(0, dvi_ptr-1); - flush_dvi; - dvi_offset:=dvi_offset+dvi_ptr; dvi_gone:=dvi_gone+dvi_ptr; - end; - dvi_ptr:=0; dvi_limit:=dvi_buf_size; - ipc_page(dvi_gone); - end; -endif ('IPC'); -@z - -@x [32.642] l.12742 - Use dvi_offset instead of dvi_buf_size with IPC stuff. - k:=4+((dvi_buf_size-dvi_ptr) mod 4); {the number of 223's} -@y -ifdef ('IPC') - k:=7-((3+dvi_offset+dvi_ptr) mod 4); {the number of 223's} -endif ('IPC') -ifndef ('IPC') - k:=4+((dvi_buf_size-dvi_ptr) mod 4); {the number of 223's} -endifn ('IPC') -@z - -@x [32.642] l.12773 - use print_file_name - print_nl("Output written on "); slow_print(output_file_name); -@y - print_nl("Output written on "); print_file_name(0, output_file_name, 0); -@z - -@x [38.859] l.16855 - Fix a casting/expression evaluation problem. -if abs(fit_class-fitness(r))>1 then d:=d+adj_demerits; -@y -if abs(intcast(fit_class)-intcast(fitness(r)))>1 then d:=d+adj_demerits; -@z - -@x [39.875] l.17170 - Another casting problem. - begin line_diff:=line_number(r)-best_line; -@y - begin line_diff:=intcast(line_number(r))-intcast(best_line); -@z - -@x [42.920] l.18068 - bigtrie: allow larger hyphenation tries. -@!trie_pointer=0..trie_size; {an index into |trie|} -@y -@!trie_pointer=0..ssup_trie_size; {an index into |trie|} -@z - -@x [42.921] l.18075 - bigtrie: allow larger hyphenation tries. -@!trie:array[trie_pointer] of two_halves; {|trie_link|, |trie_char|, |trie_op|} -@y -{We will dynamically allocate this arrays.} -@!trie:^two_halves; {|trie_link|} -@z - -%%%%%%%% dynamic hyph_size -@x 18126 m.925 -different from $\alpha$, we can conclude that $\alpha$ is not in the table. -@y 18126 -different from $\alpha$, we can conclude that $\alpha$ is not in the table. -This is a clever scheme which saves the need for a hash link array. -However, it is difficult to increase the size of the hyphen exception -arrays. To make this easier, the ordered hash has been replaced by -a simple hash, using an additional array |hyph_link|. The value -|0| in |hyph_link[k]| means that there are no more entries corresponding -to the specific hash chain. When |hyph_link[k]>0|, the next entry in -the hash chain is |hyph_link[k]-1|. This value is used because the -arrays start at |0|. -@z - -%%%%%%%% dynamic hyph_size -@x 18134 m.925 -@!hyph_pointer=0..hyph_size; {an index into the ordered hash table} -@y 18134 -@!hyph_pointer=0..ssup_hyph_size; {index into hyphen exceptions hash table; - enlarging this requires changing (un)dump code} -@z - -%%%%%%%% dynamic hyph_size -@x 18137 m.926 -@!hyph_word:array[hyph_pointer] of str_number; {exception words} -@!hyph_list:array[hyph_pointer] of pointer; {lists of hyphen positions} -@!hyph_count:hyph_pointer; {the number of words in the exception dictionary} -@y 18139 -@!hyph_word: ^str_number; {exception words} -@!hyph_list: ^pointer; {list of hyphen positions} -@!hyph_link: ^hyph_pointer; {link array for hyphen exceptions hash table} -@!hyph_count:integer; {the number of words in the exception dictionary} -@!hyph_next:integer; {next free slot in hyphen exceptions hash table} -@z - -%%%%%%%% dynamic hyph_size -@x 18145 m.928 -for z:=0 to hyph_size do - begin hyph_word[z]:=0; hyph_list[z]:=null; - end; -hyph_count:=0; -@y 18148 -for z:=0 to hyph_size do - begin hyph_word[z]:=0; hyph_list[z]:=null; hyph_link[z]:=0; - end; -hyph_count:=0; -hyph_next:=hyph_prime+1; if hyph_next>hyph_size then hyph_next:=hyph_prime; -@z - -%%%%%%%% dynamic hyph_size -@x 18163 m.930 -h:=hc[1]; incr(hn); hc[hn]:=cur_lang; -for j:=2 to hn do h:=(h+h+hc[j]) mod hyph_size; -loop@+ begin @; - if h>0 then decr(h)@+else h:=hyph_size; - end; -not_found: decr(hn) -@y 18170 -h:=hc[1]; incr(hn); hc[hn]:=cur_lang; -for j:=2 to hn do h:=(h+h+hc[j]) mod hyph_prime; -loop@+ begin @; - h:=hyph_link[h]; if h=0 then goto not_found; - decr(h); - end; -not_found: decr(hn) -@z - -%%%%%%%% dynamic hyph_size -@x 18172 m.931 -@ @= -k:=hyph_word[h]; if k=0 then goto not_found; -if length(k)hc[j] then goto done; - incr(j); incr(u); - until j>hn; - @; - decr(hn); goto found; - end; -done: -@y 18184 -@ @= -{This is now a simple hash list, not an ordered one, so -the module title is no longer descriptive.} -k:=hyph_word[h]; if k=0 then goto not_found; -if length(k)=hn then - begin j:=1; u:=str_start(k); - repeat - if so(str_pool[u])<>hc[j] then goto done; - incr(j); incr(u); - until j>hn; - @; - decr(hn); goto found; - end; -done: -@z - -% The GNU C compiler complains of unused variables. -@x -@!s,@!t:str_number; {strings being compared or stored} -@y -@!s:str_number; {strings being compared or stored} -@z - -%%%%%%%% dynamic hyph_size -@x 18274 m.939 - begin h:=(h+h+hc[j]) mod hyph_size; -@y 18274 - begin h:=(h+h+hc[j]) mod hyph_prime; -@z - -%%%%%%%% dynamic hyph_size -@x 18281 m.940 -@ @= -if hyph_count=hyph_size then overflow("exception dictionary",hyph_size); -@:TeX capacity exceeded exception dictionary}{\quad exception dictionary@> -incr(hyph_count); -while hyph_word[h]<>0 do - begin @; - if h>0 then decr(h)@+else h:=hyph_size; - end; -hyph_word[h]:=s; hyph_list[h]:=p -@y 18290 -@ @= - if hyph_next <= hyph_prime then - while (hyph_next>0) and (hyph_word[hyph_next-1]>0) do decr(hyph_next); -if (hyph_count=hyph_size)or(hyph_next=0) then - overflow("exception dictionary",hyph_size); -@:TeX capacity exceeded exception dictionary}{\quad exception dictionary@> -incr(hyph_count); -while hyph_word[h]<>0 do - begin @; - if hyph_link[h]=0 then - begin - hyph_link[h]:=hyph_next; - if hyph_next >= hyph_size then hyph_next:=hyph_prime; - if hyph_next > hyph_prime then incr(hyph_next); - end; - h:=hyph_link[h]-1; - end; - -found: hyph_word[h]:=s; hyph_list[h]:=p -@z - -%%%%%%%% dynamic hyph_size -@x 18292 m.941 -@ @= -k:=hyph_word[h]; -if length(k)length(s) then goto not_found; -u:=str_start(k); v:=str_start(s); -repeat if str_pool[u]str_pool[v] then goto not_found; -incr(u); incr(v); -until u=str_start(k+1); -found:q:=hyph_list[h]; hyph_list[h]:=p; p:=q;@/ -t:=hyph_word[h]; hyph_word[h]:=s; s:=t; -not_found: -@y 18303 -@ @= -{This is now a simple hash list, not an ordered one, so -the module title is no longer descriptive.} -k:=hyph_word[h]; -if length(k)<>length(s) then goto not_found; -u:=str_start(k); v:=str_start(s); -repeat if str_pool[u]<>str_pool[v] then goto not_found; -incr(u); incr(v); -until u=str_start(k+1); -{repeat hyphenation exception; flushing old data} -flush_string; s:=hyph_word[h]; {avoid |slow_make_string|!} -decr(hyph_count); -{ We could also |flush_list(hyph_list[h]);|, but it interferes - with \.{trip.log}. } -goto found; -not_found: -@z - -@x [43.943] l.18346 - web2c can't parse negative lower bounds in arrays. Sorry. -@!init@! trie_op_hash:array[-trie_op_size..trie_op_size] of 0..trie_op_size; -@y -@!init@! trie_op_hash:array[neg_trie_op_size..trie_op_size] of 0..trie_op_size; -@z - -@x [43.944] l.18365 - web2c can't parse negative lower bounds in arrays. Sorry -var h:-trie_op_size..trie_op_size; {trial hash location} -@y -var h:neg_trie_op_size..trie_op_size; {trial hash location} -@z - -@x [43.944] l.18370 - Another casting problem, and use |neg_trie_op_size|. -begin h:=abs(n+313*d+361*v+1009*cur_lang) mod (trie_op_size+trie_op_size) - - trie_op_size; -@y -begin h:=abs(intcast(n)+313*intcast(d)+361*intcast(v)+1009*intcast(cur_lang)) - mod (trie_op_size - neg_trie_op_size) - + neg_trie_op_size; -@z - -@x [43.947] l.18438 - Dynamically allocate arrays, and a casting problem. -@!init @!trie_c:packed array[trie_pointer] of ASCII_code; - {characters to match} -@t\hskip10pt@>@!trie_o:packed array[trie_pointer] of quarterword; - {operations to perform} -@t\hskip10pt@>@!trie_l:packed array[trie_pointer] of trie_pointer; - {left subtrie links} -@t\hskip10pt@>@!trie_r:packed array[trie_pointer] of trie_pointer; - {right subtrie links} -@t\hskip10pt@>@!trie_ptr:trie_pointer; {the number of nodes in the trie} -@t\hskip10pt@>@!trie_hash:packed array[trie_pointer] of trie_pointer; - {used to identify equivalent subtries} -tini -@y -@!init @!trie_c:^ASCII_code; - {characters to match} -@t\hskip10pt@>@!trie_o:^quarterword; - {operations to perform} -@t\hskip10pt@>@!trie_l:^trie_pointer; - {left subtrie links} -@t\hskip10pt@>@!trie_r:^trie_pointer; - {right subtrie links} -@t\hskip10pt@>@!trie_ptr:trie_pointer; {the number of nodes in the trie} -@t\hskip10pt@>@!trie_hash:^trie_pointer; - {used to identify equivalent subtries} -tini -@z - -@x [43.948] l.18471 - Another casting problem. -begin h:=abs(trie_c[p]+1009*trie_o[p]+@| - 2718*trie_l[p]+3142*trie_r[p]) mod trie_size; -@y -begin h:=abs(intcast(trie_c[p])+1009*intcast(trie_o[p])+@| - 2718*intcast(trie_l[p])+3142*intcast(trie_r[p])) mod trie_size; -@z - -@x [43.590] l.18524 - Dynamically allocate & larger tries. -@!init@!trie_taken:packed array[1..trie_size] of boolean; - {does a family start here?} -@t\hskip10pt@>@!trie_min:array[ASCII_code] of trie_pointer; - {the first possible slot for each character} -@t\hskip10pt@>@!trie_max:trie_pointer; {largest location used in |trie|} -@t\hskip10pt@>@!trie_not_ready:boolean; {is the trie still in linked form?} -tini -@y -@!init@!trie_taken: ^boolean; - {does a family start here?} -@t\hskip10pt@>@!trie_min:^trie_pointer; - {the first possible slot for each character} -@t\hskip10pt@>@!trie_max:trie_pointer; {largest location used in |trie|} -@t\hskip10pt@>@!trie_not_ready:boolean; {is the trie still in linked form?} -tini -@z - -@x [43.951] l.18539 - Dynamically allocate. -trie_not_ready:=true; trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0; -@y -trie_not_ready:=true; -@z - -%% -%% We can rewrite the original code after "main_loop_move+2" upto the -%% "tail_append(lig_stack)" in module 1036 as -%% -% -% main_loop_move+2: -% if font_bc[main_f]<=cur_chr then -% if cur_chr<=font_ec[main_f] then -% begin main_i:=char_info(main_f)(cur_l); -% if char_exists(main_i) goto main_loop_move+3; -% end; -% char_warning(main_f,cur_chr); free_avail(lig_stack); goto big_switch; -% main_loop_move+3: -% tail_append(lig_stack) {|main_loop_lookahead| is next} -% - -@x [49.1252] l.23230 - INI = VIR, so have to do runtime test. -hyph_data: if cur_chr=1 then - begin @!init new_patterns; goto done;@;@+tini@/ -@y 23215 -hyph_data: if cur_chr=1 then - begin @!init if ini_version then - begin new_patterns; goto done; end; @;@+tini@/ -@z - -@x -@!flushable_string:str_number; {string not yet referenced} -@y -@z - -% undo Knuth's change because -% a) the string is already replaced in |scan_file_name| and therefore -% b) the wrong string will get flushed!!! -% -@x [49.1260] l.23331 new_font: string recycling -- already done -flushable_string:=str_ptr-1; -@y -@z - -% If you don't want to remove code with the following two changes, -% please replace the former change by -% -% @x -% flushable_string:=str_ptr-1; -% @y -% if cur_name=str_ptr-1 then -% flushable_string:=str_ptr-1 -% else -% flushable_string:=str_ptr; {number of a non-existing} -% @z -% -% otherwise the wrong string will get removed by |flush_string|!! -% -@x [49.1260] l.23334 new_font: string recycling -- already done - begin if cur_name=flushable_string then - begin flush_string; cur_name:=font_name(f); - end; - if s>0 then -@y - begin if s>0 then -@z - -@x [49.1265] if batchmode, mktex... scripts should be silent. -interaction:=cur_chr; -@y -interaction:=cur_chr; -if interaction = batch_mode -then kpse_make_tex_discard_errors := 1 -else kpse_make_tex_discard_errors := 0; -@z - -@x [49.1275] l.23441 - Same stuff as for \input, this time for \openin. - if cur_ext="" then cur_ext:=".tex"; - pack_cur_name; - if a_open_in(read_file[n]) then read_open[n]:=just_open; -@y - pack_cur_name; - tex_input_type:=0; {Tell |open_input| we are \.{\\openin}.} - if open_in_name_ok(name_of_file+1) - and a_open_in(read_file[n], kpse_tex_format) then - read_open[n]:=just_open; -@z - -@x [50.1301] l.23679 - INI = VIR, so runtime test. -format_ident:=" (INIALEPH)"; -@y -if ini_version then format_ident:=" (INIALEPH)"; -@z - -% The GNU C compiler complains of unused variables. -% Add format_engine. -@x [50.1302] l.23690 - Eliminate now-unused variable `w' in `store_fmt_file'. -var j,@!k,@!l:integer; {all-purpose indices} -@!p,@!q: pointer; {all-purpose pointers} -@!x: integer; {something to dump} -@!w: four_quarters; {four ASCII codes} -@y -var j,@!k:integer; {all-purpose indices} -@!p,@!q: pointer; {all-purpose pointers} -@!x: integer; {something to dump} -@!format_engine: ^char; -@z - -@x [50.1303] l.23722 - Ditto, for `load_fmt_file'. -@!w: four_quarters; {four ASCII codes} -@y -@!format_engine: ^char; -@z - -@x [50.1305] l.23751 - Do dumping and undumping of fmt files in C. -@d dump_wd(#)==begin fmt_file^:=#; put(fmt_file);@+end -@d dump_int(#)==begin fmt_file^.int:=#; put(fmt_file);@+end -@d dump_hh(#)==begin fmt_file^.hh:=#; put(fmt_file);@+end -@d dump_qqqq(#)==begin fmt_file^.qqqq:=#; put(fmt_file);@+end -@y -@z -@x [1306] -@d undump_wd(#)==begin get(fmt_file); #:=fmt_file^;@+end -@d undump_int(#)==begin get(fmt_file); #:=fmt_file^.int;@+end -@d undump_hh(#)==begin get(fmt_file); #:=fmt_file^.hh;@+end -@d undump_qqqq(#)==begin get(fmt_file); #:=fmt_file^.qqqq;@+end -@y -@z -@x [still 1306] debug format file -@d undump_size_end_end(#)==too_small(#)@+else undump_end_end -@y -@d format_debug_end(#)== - write_ln (stderr, ' = ', #); - end; -@d format_debug(#)== - if debug_format_file then begin - write (stderr, 'fmtdebug:', #); - format_debug_end -@d undump_size_end_end(#)== - too_small(#)@+else format_debug (#)(x); undump_end_end -@z - -@x [50,1307] l.23779 - texarray -dump_int(@$);@/ -@y -dump_int(@"57325458); {Web2C \TeX's magic constant: "W2TX"} -{Align engine to 4 bytes with one or more trailing NUL} -x:=strlen(engine_name); -format_engine:=xmalloc_array(char,x+4); -strcpy(format_engine, engine_name); -for k:=x to x+3 do format_engine[k]:=0; -x:=x+4-(x mod 4); -dump_int(x);dump_things(format_engine[0], x); -libc_free(format_engine);@/ -dump_int(@$);@/ -dump_int(max_halfword);@/ -@z - -%%%%%%%% dynamic hyph_size -@x 23784 m.1307 -dump_int(hyph_size) -@y 23784 -dump_int(hyph_prime) -@z - -@x [50.1308] l.23793 - texarray -x:=fmt_file^.int; -if x<>@$ then goto bad_fmt; {check that strings are the same} -@/@@/ -undump_int(x); -if x<>mem_bot then goto bad_fmt; -undump_int(x); -if x<>mem_top then goto bad_fmt; -@y -@+init -if ini_version then - begin libc_free(str_pool); libc_free(str_start_ar); libc_free(yzmem); - end; -@+tini -undump_int(x); -format_debug('format magic number')(x); -if x<>@"57325458 then goto bad_fmt; {not a format file} -undump_int(x); -format_debug('engine name size')(x); -if (x<0) or (x>256) then goto bad_fmt; {corrupted format file} -format_engine:=xmalloc_array(char, x); -undump_things(format_engine[0], x); -format_engine[x-1]:=0; {force string termination, just in case} -if strcmp(engine_name, format_engine) then - begin wake_up_terminal; - wterm_ln('---! ', stringcast(name_of_file+1), ' was written by ', format_engine); - libc_free(format_engine); - goto bad_fmt; -end; -libc_free(format_engine); -undump_int(x); -format_debug('string pool checksum')(x); -if x<>@$ then begin {check that strings are the same} - wake_up_terminal; - wterm_ln('---! ', stringcast(name_of_file+1), ' doesn''t match ', pool_name); - goto bad_fmt; -end; -undump_int(x); -if x<>max_halfword then goto bad_fmt; {check |max_halfword|} -@/@@/ - -undump_int(x); format_debug ('mem_bot')(x); -if x<>mem_bot then goto bad_fmt; -undump_int(mem_top); format_debug ('mem_top')(mem_top); -if mem_bot+1100>mem_top then goto bad_fmt; - - -head:=contrib_head; tail:=contrib_head; - page_tail:=page_head; {page initialization} - -mem_min := mem_bot - extra_mem_bot; -mem_max := mem_top + extra_mem_top; - -yzmem:=xmalloc_array (memory_word, mem_max - mem_min + 1); -zmem := yzmem - mem_min; {this pointer arithmetic fails with some compilers} -mem := zmem; -@z - -%%%%%%%% dynamic hyph_size -@x 23804 m.1308 -if x<>hyph_size then goto bad_fmt -@y 23804 -if x<>hyph_prime then goto bad_fmt -@z - -% [1309] Make dumping/undumping more efficient by doing whole arrays at -% a time, via fread/fwrite in texmfmp.c. -@x [50.1309] l.23814 - Make dumping/undumping more efficient. -for k:=too_big_char to str_ptr do dump_int(str_start(k)); -k:=0; -while k+40 then - begin dump_int(k); dump_int(hyph_word[k]); dump_int(hyph_list[k]); - end; -@y 24061 -dump_int(hyph_count); -if hyph_next <= hyph_prime then hyph_next:=hyph_size; -dump_int(hyph_next);{minumum value of |hyphen_size| needed} -for k:=0 to hyph_size do if hyph_word[k]<>0 then - begin dump_int(k+65536*hyph_link[k]); - {assumes number of hyphen exceptions does not exceed 65535} - dump_int(hyph_word[k]); dump_int(hyph_list[k]); - end; -@z - -@x [50.1324] l.24066 - Make dumping/undumping more efficient - trie -for k:=0 to trie_max do dump_hh(trie[k]); -dump_int(max_hyph_char); -dump_int(trie_op_ptr); -for k:=1 to trie_op_ptr do - begin dump_int(hyf_distance[k]); - dump_int(hyf_num[k]); - dump_int(hyf_next[k]); - end; -@y -dump_things(trie[0],trie_max+1); -dump_int(max_hyph_char); -dump_int(trie_op_ptr); -dump_things(hyf_distance[1], trie_op_ptr); -dump_things(hyf_num[1], trie_op_ptr); -dump_things(hyf_next[1], trie_op_ptr); -@z - -@x [50.1325] l.24086 - Make dumping/undumping more efficient - trie -@= -@y -{This is only used for the hyphenation tries below, and the size is - always |j+1|.} -@d xmalloc_and_undump(#) == - if not # then #:=xmalloc_array(two_halves, j+1); - undump_things(#[0], j+1); - -@= -@z - -%%%%%%%% dynamic hyph_size -@x 24087 m.1325 -undump(0)(hyph_size)(hyph_count); -for k:=1 to hyph_count do - begin undump(0)(hyph_size)(j); - undump(0)(str_ptr)(hyph_word[j]); - undump(min_halfword)(max_halfword)(hyph_list[j]); - end; -@y 24092 -undump_size(0)(hyph_size)('hyph_size')(hyph_count); -undump_size(hyph_prime)(hyph_size)('hyph_size')(hyph_next); -j:=0; -for k:=1 to hyph_count do - begin undump_int(j); if j<0 then goto bad_fmt; - if j>65535 then - begin hyph_next:= j div 65536; j:=j - hyph_next * 65536; end - else hyph_next:=0; - if (j>=hyph_size)or(hyph_next>hyph_size) then goto bad_fmt; - hyph_link[j]:=hyph_next; - undump(0)(str_ptr)(hyph_word[j]); - undump(min_halfword)(max_halfword)(hyph_list[j]); - end; - {|j| is now the largest occupied location in |hyph_word|} - incr(j); - if j= hyph_size then hyph_next:=hyph_prime else - if hyph_next >= hyph_prime then incr(hyph_next); -@z - - -@x [50.1325] l.24094 - Make dumping/undumping more efficient - trie -for k:=0 to j do undump_hh(trie[k]); -undump_int(max_hyph_char); -undump_size(0)(trie_op_size)('trie op size')(j); @+init trie_op_ptr:=j;@+tini -for k:=1 to j do - begin undump(0)(63)(hyf_distance[k]); {a |small_number|} - undump(0)(63)(hyf_num[k]); - undump(min_quarterword)(max_quarterword)(hyf_next[k]); - end; -@y -{The first array has not been allocated yet unless we're \.{INITEX}; - we do that precisely so we don't allocate more space than necessary.} -xmalloc_and_undump(trie); -undump_int(max_hyph_char); -undump_size(0)(trie_op_size)('trie op size')(j); @+init trie_op_ptr:=j;@+tini -{I'm not sure we have such a strict limitation (64) on these values, so - let's leave them unchecked.} -undump_things(hyf_distance[1], j); -undump_things(hyf_num[1], j); -undump_upper_check_things(max_quarterword, hyf_next[1], j); -@z - -@x [50.1327] l.24117 - Allow command line to override dumped value. -undump(batch_mode)(error_stop_mode)(interaction); -@y -undump(batch_mode)(error_stop_mode)(interaction); -if interaction_option<>unspecified_mode then interaction:=interaction_option; -@z - -% [50.1327] As with TFM files, `eof' here means `have we previously -% encountered the end-of-file', not `are we at the end of the file'. -@x [50.1327] l.24120 - dumping/undumping, replace eof() by feof() -if (x<>69069)or eof(fmt_file) then goto bad_fmt -@y -if (x<>69069)or feof(fmt_file) then goto bad_fmt -@z - -@x [50.1328] l.24124 - Eliminate probably wrong word `preloaded' from format_idents. -print(" (preloaded format="); print(job_name); print_char(" "); -@y -print(" (format="); print(job_name); print_char(" "); -@z - -@x [51.1332] l.24203 - make the main program a procedure, for eqtb hack. -@p begin @!{|start_here|} -@y -@d const_chk(#)==begin if # < inf@&# then # := inf@&# else - if # > sup@&# then # := sup@&# end - -{|setup_bound_var| stuff duplicated in \.{mf.ch}.} -@d setup_bound_var(#)==bound_default:=#; setup_bound_var_end -@d setup_bound_var_end(#)==bound_name:=#; setup_bound_var_end_end -@d setup_bound_var_end_end(#)== - setup_bound_variable(addressof(#), bound_name, bound_default); - -@p procedure main_body; -begin @!{|start_here|} - -{Always start the file recorder?} - {|recorder_enabled:=true;|} - -{Bounds that may be set from the configuration file. We want the user to - be able to specify the names with underscores, but \.{TANGLE} removes - underscores, so we're stuck giving the names twice, once as a string, - once as the identifier. How ugly.} - setup_bound_var (1000000)('main_memory')(main_memory); - {|memory_word|s for |mem| in \.{INITEX}} - setup_bound_var (0)('extra_mem_top')(extra_mem_top); - {increase high mem in \.{VIRTEX}} - setup_bound_var (0)('extra_mem_bot')(extra_mem_bot); - {increase low mem in \.{VIRTEX}} - setup_bound_var (300000)('pool_size')(pool_size); - setup_bound_var (200000)('string_vacancies')(string_vacancies); - setup_bound_var (5000)('pool_free')(pool_free); {min pool avail after fmt} - setup_bound_var (100000)('max_strings')(max_strings); - setup_bound_var (100)('strings_free')(strings_free); - setup_bound_var (20000)('trie_size')(trie_size); - {if |ssup_trie_size| increases, recompile} - setup_bound_var (659)('hyph_size')(hyph_size); - setup_bound_var (20000)('buf_size')(buf_size); - setup_bound_var (50)('nest_size')(nest_size); - setup_bound_var (15)('max_in_open')(max_in_open); - setup_bound_var (60)('param_size')(param_size); - setup_bound_var (4000)('save_size')(save_size); - setup_bound_var (300)('stack_size')(stack_size); - setup_bound_var (16384)('dvi_buf_size')(dvi_buf_size); - setup_bound_var (79)('error_line')(error_line); - setup_bound_var (50)('half_error_line')(half_error_line); - setup_bound_var (79)('max_print_line')(max_print_line); - const_chk (main_memory); -@+init - if ini_version then begin - extra_mem_top := 0; - extra_mem_bot := 0; - end; -@+tini - if extra_mem_bot>sup_main_memory then extra_mem_bot:=sup_main_memory; - if extra_mem_top>sup_main_memory then extra_mem_top:=sup_main_memory; - {|mem_top| is an index, |main_memory| a size} - mem_top := mem_bot + main_memory -1; - mem_min := mem_bot; - mem_max := mem_top; - - {Check other constants against their sup and inf.} - const_chk (trie_size); - const_chk (hyph_size); - const_chk (buf_size); - const_chk (nest_size); - const_chk (max_in_open); - const_chk (param_size); - const_chk (save_size); - const_chk (stack_size); - const_chk (dvi_buf_size); - const_chk (pool_size); - const_chk (string_vacancies); - const_chk (pool_free); - const_chk (max_strings); - const_chk (strings_free); - if error_line > ssup_error_line then error_line := ssup_error_line; - - {array memory allocation} - buffer:=xmalloc_array (ASCII_code, buf_size); - nest:=xmalloc_array (list_state_record, nest_size); - save_stack:=xmalloc_array (memory_word, save_size); - input_stack:=xmalloc_array (in_state_record, stack_size); - input_file:=xmalloc_array (alpha_file, max_in_open); - input_file_mode:=xmalloc_array (halfword, max_in_open); - input_file_translation:=xmalloc_array (halfword, max_in_open); - line_stack:=xmalloc_array (integer, max_in_open); - param_stack:=xmalloc_array (halfword, param_size); - dvi_buf:=xmalloc_array (real_eight_bits, dvi_buf_size); - hyph_word:=xmalloc_array (str_number, hyph_size); - hyph_list:=xmalloc_array (halfword, hyph_size); - hyph_link:=xmalloc_array (hyph_pointer, hyph_size); -@+init -if ini_version then begin - yzmem:=xmalloc_array (memory_word, mem_top - mem_bot + 1); - zmem := yzmem - mem_bot; {Some compilers require |mem_bot=0|} - - str_start_ar:=xmalloc_array (pool_pointer, max_strings-biggest_char); - str_pool:=xmalloc_array (packed_ASCII_code, pool_size); -end; -@+tini -@z - -@x [51.1332] l.24215 - INI = VIR, so pool init needs runtime test -@!init if not get_strings_started then goto final_end; -init_prim; {call |primitive| for each primitive} -init_str_ptr:=str_ptr; init_pool_ptr:=pool_ptr; fix_date_and_time; -tini@/ -@y -@+init if ini_version then - begin if not get_strings_started then goto final_end; - init_prim; {call |primitive| for each primitive} - init_str_ptr:=str_ptr; init_pool_ptr:=pool_ptr; fix_date_and_time; - end; -@+tini@/ -@z - -@x [51.1332] l.24225 - main -end_of_TEX: close_files_and_terminate; -final_end: ready_already:=0; -end. -@y -close_files_and_terminate; -final_end: do_final_end; -end {|main_body|}; -@z - -@x [51.1333] l.24254 - Print new line before termination; switch to editor if necessary. - slow_print(log_name); print_char("."); - end; - end; -@y - print_file_name(0, log_name, 0); print_char("."); - end; - end; -print_ln; -if (edit_name_start<>0) and (interaction>batch_mode) then - call_edit(str_pool,edit_name_start,edit_name_length,edit_line); -@z - -@x [51.1334] l. - Remove reference to fontmemsize - wlog_ln(', out of ',font_mem_size:1,' for ',font_max-font_base:1);@/ -@y -@z - -@x [51.1335] l.24335 - Only do dump if ini. - begin @!init for c:=top_mark_code to split_bot_mark_code do - if cur_mark[c]<>null then delete_token_ref(cur_mark[c]); - if sa_mark<>null then - if do_marks(destroy_marks,0,sa_mark) then sa_mark:=null; - for c:=last_box_code to vsplit_code do flush_node_list(disc_ptr[c]); - if last_glue<>max_halfword then delete_glue_ref(last_glue); - store_fmt_file; return;@+tini@/ -@y - begin @!init if ini_version then - begin for c:=top_mark_code to split_bot_mark_code do - if cur_mark[c]<>null then delete_token_ref(cur_mark[c]); - if sa_mark<>null then - if do_marks(destroy_marks,0,sa_mark) then sa_mark:=null; - for c:=last_box_code to vsplit_code do flush_node_list(disc_ptr[c]); - store_fmt_file; return; - end;@+tini@/ -@z - -@x [51.1337] l.24361 - Handle %&format in all cases. -if (format_ident=0)or(buffer[loc]="&") then -@y -if (format_ident=0)or(buffer[loc]="&")or dump_line then -@z - -@x [51.1337] l.24371 - Allocate hyphenation tries. -fix_date_and_time;@/ -@y -fix_date_and_time;@/ - -@!init -if trie_not_ready then begin {initex without format loaded} - trie:=xmalloc_array (two_halves, trie_size); - - trie_c:=xmalloc_array (ASCII_code, trie_size); - trie_o:=xmalloc_array (quarterword, trie_size); - trie_l:=xmalloc_array (trie_pointer, trie_size); - trie_r:=xmalloc_array (trie_pointer, trie_size); - trie_hash:=xmalloc_array (trie_pointer, trie_size); - trie_taken:=xmalloc_array (boolean, trie_size); - trie_min:=xmalloc_array (trie_pointer, too_big_char); - - trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0; - end; - tini@/ - -@z - -% [52.1338] Core-dump in debugging mode on 0 input. Under Unix, it's -% not possible to portably switch into the debugger while a program is -% running. The best approximation is to do a core dump, then run the -% debugger on it later. -@x [52.1338] l.24411 - Core-dump in debugging mode on 0 input. - begin goto breakpoint;@\ {go to every label at least once} - breakpoint: m:=0; @{'BREAKPOINT'@}@\ - end -@y - dump_core {do something to cause a core dump} -@z - -% The GNU C compiler complains of unused variables. -@x -procedure do_extension; -var i,@!j,@!k:integer; {all-purpose integers} -@!p,@!q,@!r:pointer; {all-purpose pointers} -@y -procedure do_extension; -var @!k:integer; {all-purpose integers} -@!p:pointer; {all-purpose pointers} -@z - -% [53.1350] (new_write_whatsit) Allow 18 as a \write stream. We never -% refer to an actual file, though, so we don't need to change the -% write_file or write_open arrays. We provide for disabling this at -% runtime, for paranoids. -@x [53.1350] l.24609 - system: Allow 18 as a \write stream. - else if cur_val>15 then cur_val:=16; -@y - else if (cur_val>15) and (cur_val <> 18) then cur_val:=16; -@z - -@x [53.1370] l.24770 - system: (write_out) \write18{foo} => system(foo). -begin @ system(foo). -if write_open[j] then selector:=j -@y -if j=18 then selector := new_string -else if write_open[j] then selector:=j -@z - -% Then call system(3) on that string. -@x [53.1370] l.24779 - system: (write_out) \write18{foo} => system(foo). -flush_list(def_ref); selector:=old_setting; -@y -flush_list(def_ref); -if j=18 then - begin if (tracing_online<=0) then - selector:=log_only {Show what we're doing in the log file.} - else selector:=term_and_log; {Show what we're doing.} - {If the log file isn't open yet, we can only send output to the terminal. - Calling |open_log_file| from here seems to result in bad data in the log.} - if not log_opened then selector:=term_only; - print_nl("runsystem("); - for d:=0 to cur_length-1 do - begin {|print| gives up if passed |str_ptr|, so do it by hand.} - print(so(str_pool[str_start(str_ptr)+d])); {N.B.: not |print_char|} - end; - print(")..."); - if shellenabledp then - begin str_room(1); append_char(0); {Append a null byte to the expansion.} - clobbered:=false; - for d:=0 to cur_length-1 do {Convert to external character set.} - begin - str_pool[str_start(str_ptr)+d]:=xchr[str_pool[str_start(str_ptr)+d]]; - if (str_pool[str_start(str_ptr)+d]=null_code) - and (d - -@= -@!edit_name_start: pool_pointer; {where the filename to switch to starts} -@!edit_name_length,@!edit_line: integer; {what line to start editing at} -@!ipc_on: cinttype; {level of IPC action, 0 for none [default]} -@!stop_at_space: boolean; {whether |more_name| returns false for space} - -@ The |edit_name_start| will be set to point into |str_pool| somewhere after -its beginning if \TeX\ is supposed to switch to an editor on exit. - -@= -edit_name_start:=0; -stop_at_space:=true; - -@ These are used when we regenerate the representation of the first 256 -strings. - -@ = -@!save_str_ptr: str_number; -@!save_pool_ptr: pool_pointer; -@!shellenabledp: cinttype; -@!restrictedshell: cinttype; -@!output_comment: ^char; -@!k,l: 0..65535; {used by `Make the first 256 strings', etc.} - -@ When debugging a macro package, it can be useful to see the exact -control sequence names in the format file. For example, if ten new -csnames appear, it's nice to know what they are, to help pinpoint where -they came from. (This isn't a truly ``basic'' printing procedure, but -that's a convenient module in which to put it.) - -@ = -procedure print_csnames (hstart:integer; hfinish:integer); -var c,h:integer; -begin - write_ln(stderr, 'fmtdebug:csnames from ', hstart, ' to ', hfinish, ':'); - for h := hstart to hfinish do begin - if newtext(h) > 0 then begin {if have anything at this position} - for c := str_start(newtext(h)) to str_start(newtext(h) + 1) - 1 - do begin - put_byte(str_pool[c], stderr); {print the characters} - end; - write_ln(stderr, '|'); - end; - end; -end; - -@ Are we printing extra info as we read the format file? - -@ = -@!debug_format_file: boolean; - - -@ A helper for printing file:line:error style messages. Look for a -filename in |full_source_filename_stack|, and if we fail to find -one fall back on the non-file:line:error style. - -@= -procedure print_file_line; -var level: 0..max_in_open; -begin - level:=in_open; - while (level>0) and (full_source_filename_stack[level]=0) do - decr(level); - if level=0 then - print_nl("! ") - else begin - print_nl (""); print (full_source_filename_stack[level]); print (":"); - if level=in_open then print_int (line) - else print_int (line_stack[index+1-(in_open-level)]); - print (": "); - end; -end; - -@ To be able to determine whether \.{\\write18} is enabled from within -\TeX\ we also implement \.{\\eof18}. We sort of cheat by having an -additional route |scan_four_bit_int_or_18| which is the same as -|scan_four_bit_int| except it also accepts the value 18. - -@= -procedure scan_four_bit_int_or_18; -begin scan_int; -if (cur_val<0)or((cur_val>15)and(cur_val<>18)) then - begin print_err("Bad number"); -@.Bad number@> - help2("Since I expected to read a number between 0 and 15,")@/ - ("I changed this one to zero."); int_error(cur_val); cur_val:=0; - end; -end; - -@* \[54/web2c-string] The string recycling routines. \TeX{} uses 2 -upto 4 {\it new\/} strings when scanning a filename in an \.{\\input}, -\.{\\openin}, or \.{\\openout} operation. These strings are normally -lost because the reference to them are not saved after finishing the -operation. |search_string| searches through the string pool for the -given string and returns either 0 or the found string number. - -@= -function search_string(@!search:str_number):str_number; -label found; -var result: str_number; -@!s: str_number; {running index} -@!len: integer; {length of searched string} -begin result:=0; len:=length(search); -if len=0 then {trivial case} - begin result:=""; goto found; - end -else begin s:=search-1; {start search with newest string below |s|; |search>1|!} - while s>65535 do {first 65536 strings depend on implementation!!} - begin if length(s)=len then - if str_eq_str(s,search) then - begin result:=s; goto found; - end; - decr(s); - end; - end; -found:search_string:=result; -end; - -@ The following routine is a variant of |make_string|. It searches -the whole string pool for a string equal to the string currently built -and returns a found string. Otherwise a new string is created and -returned. Be cautious, you can not apply |flush_string| to a replaced -string! - -@= -function slow_make_string : str_number; -label exit; -var s: str_number; {result of |search_string|} -@!t: str_number; {new string} -begin t:=make_string; s:=search_string(t); -if s>0 then - begin flush_string; slow_make_string:=s; return; - end; -slow_make_string:=t; -exit:end; - -@* \[54] System-dependent changes. -@z diff --git a/Build/source/texk/web2c/alephdir/com16bit.ch b/Build/source/texk/web2c/alephdir/com16bit.ch new file mode 100644 index 00000000000..42e4faa3f0c --- /dev/null +++ b/Build/source/texk/web2c/alephdir/com16bit.ch @@ -0,0 +1,2825 @@ +% com16bit.ch: Aleph version of file tex.ch +% +% tex.ch for C compilation with web2c, derived from various other change files. +% By Tim Morgan, UC Irvine ICS Department, and many others. +% +% (05/28/86) ETM Started with TeX 2.0 +% (06/03/87) ETM Brought up to TeX 2.2 +% (09/26/87) ETM Brought up to TeX 2.3 +% (10/01/87) ETM Brought up to TeX 2.5 +% (12/21/87) ETM Brought up to TeX 2.7 +% (01/14/88) ETM Brought up to TeX 2.9 +% (02/20/88) PAM Revised format and module numbers +% (03/01/88) ETM Eliminated some unused variables and unnecesary tests +% (05/09/88) ETM Added yet another casting bug fix +% (06/21/88) ETM Brought up to TeX version 2.93 +% (12/11/88) ETM Brought up to TeX version 2.94 +% (01/12/89) PAM Brought up to TeX version 2.95 +% (02/14/89) ETM Brought up to TeX version 2.96 +% (03/10/89) ETM Brought up to TeX version 2.98 +% (07/06/89) ETM Brought up to TeX version 2.991 +% (11/30/89) KB To version 2.992 (8-bit). +% (01/10/90) SR To version 2.993. +% (03/27/90) KY To version 3.0. +% (more recent changes in ChangeLog) +% +% The TeX program is copyright (C) 1982 by D. E. Knuth. +% TeX is a trademark of the American Mathematical Society. +% +% The module numbers in this change file refer to TEX.WEB 3.141592 as +% of March, 1995 (published as Donald E. Knuth, TeX: The Program, +% Volume B of Computers & Typesetting). + +@x [0.0] l.83 - WEAVE: print changes only. + \def\?##1]{\hbox to 1in{\hfil##1.\ }} + } +@y 83 + \def\?##1]{\hbox{Changes to \hbox to 1em{\hfil##1}.\ }} + } +\let\maybe=\iffalse +@z + +@x +@d banner=='This is Aleph, Version 3.1415926-',Omega_version_banner,'-',eTeX_version_banner,'-',Aleph_version_banner {printed when \TeX\ starts} +@y +@d banner=='This is Aleph, Version 3.1415926-',Omega_version_banner,'-',eTeX_version_banner,'-',Aleph_version_banner {printed when \TeX\ starts} +@d banner_k==banner {Web2C announces itself} +@z + +@x [1.4] l.233 - program header +Actually the heading shown here is not quite normal: The |program| line +does not mention any |output| file, because \ph\ would ask the \TeX\ user +to specify a file name if |output| were specified here. +@:PASCAL H}{\ph@> +@^system dependencies@> +@y +@z + +@x [1.4] l.243 - labels in outer block not needed +program OMEGA; {all file names are defined dynamically} +label @@/ +@y +program OMEGA; {all file names are defined dynamically} +@z + +@x [1.6] l.267 - labels in outer block not needed +@ Three labels must be declared in the main program, so we give them +symbolic names. + +@d start_of_TEX=1 {go here when \TeX's variables are initialized} +@d end_of_TEX=9998 {go here to close files and terminate gracefully} +@d final_end=9999 {this label marks the ending of the program} + +@= +start_of_TEX@t\hskip-2pt@>, end_of_TEX@t\hskip-2pt@>,@,final_end; + {key control points} +@y +@ For Web2c, labels are not declared in the main program, but +we still have to declare the symbolic names. + +@d start_of_TEX=1 {go here when \TeX's variables are initialized} +@d final_end=9999 {this label marks the ending of the program} +@z + +% Here we change these WEB symbols, which are used much as #ifdef's +% are in C, into something which will get translated into actual #ifdef's. +@x [1.7] l.292 - debug..gubed, stat..tats +@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging} +@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging} +@y +@d debug==ifdef('TEXMF_DEBUG') +@d gubed==endif('TEXMF_DEBUG') +@z +@x [1.7] l.297 - debug..gubed, stat..tats +@d stat==@{ {change this to `$\\{stat}\equiv\null$' when gathering + usage statistics} +@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$' when gathering + usage statistics} +@y +@d stat==ifdef('STAT') +@d tats==endif('STAT') +@z + +@x [1.8] l.312 - Same, for `init...tini'. +@d init== {change this to `$\\{init}\equiv\.{@@\{}$' in the production version} +@d tini== {change this to `$\\{tini}\equiv\.{@@\}}$' in the production version} +@y 312 +@d init==ifdef('INITEX') +@d tini==endif('INITEX') +@z + +@x [1.8] l.319 - init...tini is dynamic +@!init @@;@+tini +@y 318 +@!init +if ini_version then + begin @@; + end; +@+tini +@z + +@x [1.11] l.375 - Compile-time constants: most removed for dynamic allocation. +@= +@!mem_max=30000; {greatest index in \TeX's internal |mem| array; + must be strictly less than |max_halfword|; + must be equal to |mem_top| in \.{INITEX}, otherwise |>=mem_top|} +@!mem_min=0; {smallest index in \TeX's internal |mem| array; + must be |min_halfword| or more; + must be equal to |mem_bot| in \.{INITEX}, otherwise |<=mem_bot|} +@!buf_size=500; {maximum number of characters simultaneously present in + current lines of open files and in control sequences between + \.{\\csname} and \.{\\endcsname}; must not exceed |max_halfword|} +@!error_line=72; {width of context lines on terminal error messages} +@!half_error_line=42; {width of first lines of contexts in terminal + error messages; should be between 30 and |error_line-15|} +@!max_print_line=79; {width of longest text lines output; should be at least 60} +@!stack_size=200; {maximum number of simultaneous input sources} +@!max_in_open=6; {maximum number of input files and error insertions that + can be going on simultaneously} +@y +@d file_name_size == maxint +@d ssup_error_line = 255 +@d ssup_max_strings == 2097151 +{Larger values may be used, but then the arrays consume much more memory.} +@d ssup_trie_opcode == 65535 +@d ssup_trie_size == @"3FFFFF + +@d ssup_hyph_size == 65535 {Changing this requires changing (un)dumping!} +@d iinf_hyphen_size == 610 {Must be not less than |hyph_prime|!} + +@= +@!mem_bot=0; {smallest index in the |mem| array dumped by \.{INITEX}; + must not be less than |mem_min|} + {Use |mem_bot=0| for compilers which cannot decrement pointers.} +@z + +@x +@!font_max=65535; {maximum internal font number; must be at most |font_biggest|} +@!param_size=60; {maximum number of simultaneous macro parameters} +@!nest_size=40; {maximum number of semantic levels simultaneously active} +@!max_strings=3000; {maximum number of strings; must not exceed |max_halfword|} +@!string_vacancies=8000; {the minimum number of characters that should be + available for the user's control sequences and font names, + after \TeX's own error messages are stored} +@!pool_size=32000; {maximum number of characters in strings, including all + error messages and help texts, and the names of all fonts and + control sequences; must exceed |string_vacancies| by the total + length of \TeX's own strings, which is currently about 23000} +@!save_size=600; {space for saving values outside of current group; must be + at most |max_halfword|} +@!trie_size=8000; {space for hyphenation patterns; should be larger for + \.{INITEX} than it is in production versions of \TeX} +@!trie_op_size=500; {space for ``opcodes'' in the hyphenation patterns} +@!dvi_buf_size=800; {size of the output buffer; must be a multiple of 8} +@!file_name_size=40; {file names shouldn't be longer than this} +@!pool_name='TeXformats:ALEPH.POOL '; + {string of length |file_name_size|; tells where the string pool appears} +@y +@!font_max=65535; {maximum internal font number; must be at most |font_biggest|} +@!hash_offset=514; {smallest index in hash array, i.e., |hash_base| } + {Use |hash_offset=0| for compilers which cannot decrement pointers.} +@!trie_op_size=15011; {space for ``opcodes'' in the hyphenation patterns; + best if relatively prime to 313, 361, and 1009.} +@!neg_trie_op_size=-15011; {for lower |trie_op_hash| array bound; + must be equal to |-trie_op_size|.} +@!min_trie_op=0; {first possible trie op code for any language} +@!max_trie_op=ssup_trie_opcode; {largest possible trie opcode for any language} +@!pool_name=TEXMF_POOL_NAME; {this is configurable, for the sake of ML-\TeX} + {string of length |file_name_size|; tells where the string pool appears} +@!engine_name=TEXMF_ENGINE_NAME; {the name of this engine} +@# +@!inf_main_memory = 2000000; +@!sup_main_memory = 256000000; + +@!inf_trie_size = 80000; +@!sup_trie_size = ssup_trie_size; + +@!inf_max_strings = 100000; +@!sup_max_strings = ssup_max_strings; + +@!inf_strings_free = 100; +@!sup_strings_free = sup_max_strings; + +@!inf_buf_size = 500; +@!sup_buf_size = 30000000; + +@!inf_nest_size = 40; +@!sup_nest_size = 4000; + +@!inf_max_in_open = 6; +@!sup_max_in_open = 127; + +@!inf_param_size = 60; +@!sup_param_size = 6000; + +@!inf_save_size = 600; +@!sup_save_size = 80000; + +@!inf_stack_size = 200; +@!sup_stack_size = 30000; + +@!inf_dvi_buf_size = 800; +@!sup_dvi_buf_size = 65536; + +@!inf_pool_size = 32000; +@!sup_pool_size = 40000000; +@!inf_pool_free = 1000; +@!sup_pool_free = sup_pool_size; +@!inf_string_vacancies = 8000; +@!sup_string_vacancies = sup_pool_size - 23000; + +@!sup_hyph_size = ssup_hyph_size; +@!inf_hyph_size = iinf_hyphen_size; {Must be not less than |hyph_prime|!} +@z + +@x [1.12] l.427 - Constants that are WEB numeric macros. +@d mem_bot=0 {smallest index in the |mem| array dumped by \.{INITEX}; + must not be less than |mem_min|} +@d mem_top==30000 {largest index in the |mem| array dumped by \.{INITEX}; + must be substantially larger than |mem_bot| + and not greater than |mem_max|} +@d font_base=0 {smallest internal font number; must not be less + than |min_quarterword|} +@d hash_size=65536 {maximum number of control sequences; it should be at most + about |(mem_max-mem_min)/10|} +@d hash_prime=55711 {a prime number equal to about 85\pct! of |hash_size|} +@d hyph_size=307 {another prime; the number of \.{\\hyphenation} exceptions} +@y +@d font_base=0 {smallest internal font number; must not be less + than |min_quarterword|} +@d hash_size=65536 {maximum number of control sequences; it should be at most + about |(mem_max-mem_min)/10|} +@d hash_prime=55711 {a prime number equal to about 85\pct! of |hash_size|} +@d hyph_prime=607 {another prime for hashing \.{\\hyphenation} exceptions; + if you change this, you should also change |iinf_hyphen_size|.} +@z + +@x [1.16] l.498 - Use C macros for `incr' and `decr'. +@d incr(#) == #:=#+1 {increase a variable by unity} +@d decr(#) == #:=#-1 {decrease a variable by unity} +@y +@z + +% The text_char type is used as an array index into xord. The +% default type `char' produces signed integers, which are bad array +% indices in C. +@x [2.19] l.565 - data type text_char is 8-bit ASCII_code +@d text_char == char {the data type of characters in text files} +@y +@d text_char == ASCII_code {the data type of characters in text files} +@z + +% [3.26] name_of_file is no longer an array. And change the destination +% type to text_char, which fixes: +% +% Date: 19 Sep 1994 10:38:24 +0200 +% From: thorinn@diku.dk (Lars Mathiesen) +% When echoed to the screen and in the log, character codes +% above '177 in file names are shown wrongly (typically as ^@). +% +@x [3.26] l.789 - name_of_file is no longer an array +@!name_of_file:packed array[1..file_name_size] of char;@;@/ + {on some systems this may be a \&{record} variable} +@y +@!name_of_file:^char; +@z + +@x [3.27] l.794 - Do file opening in C. +@ The \ph\ compiler with which the present version of \TeX\ was prepared has +extended the rules of \PASCAL\ in a very convenient way. To open file~|f|, +we can write +$$\vbox{\halign{#\hfil\qquad&#\hfil\cr +|reset(f,@t\\{name}@>,'/O')|&for input;\cr +|rewrite(f,@t\\{name}@>,'/O')|&for output.\cr}}$$ +The `\\{name}' parameter, which is of type `{\bf packed array +$[\langle\\{any}\rangle]$ of \\{char}}', stands for the name of +the external file that is being opened for input or output. +Blank spaces that might appear in \\{name} are ignored. + +The `\.{/O}' parameter tells the operating system not to issue its own +error messages if something goes wrong. If a file of the specified name +cannot be found, or if such a file cannot be opened for some other reason +(e.g., someone may already be trying to write the same file), we will have +|@!erstat(f)<>0| after an unsuccessful |reset| or |rewrite|. This allows +\TeX\ to undertake appropriate corrective action. +@:PASCAL H}{\ph@> +@^system dependencies@> + +\TeX's file-opening procedures return |false| if no file identified by +|name_of_file| could be opened. + +@d reset_OK(#)==erstat(#)=0 +@d rewrite_OK(#)==erstat(#)=0 + +@p function a_open_in(var f:alpha_file):boolean; + {open a text file for input} +begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f); +end; +@# +function a_open_out(var f:alpha_file):boolean; + {open a text file for output} +begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f); +end; +@# +function b_open_in(var f:byte_file):boolean; + {open a binary file for input} +begin reset(f,name_of_file,'/O'); b_open_in:=reset_OK(f); +end; +@# +function b_open_out(var f:byte_file):boolean; + {open a binary file for output} +begin rewrite(f,name_of_file,'/O'); b_open_out:=rewrite_OK(f); +end; +@# +function w_open_in(var f:word_file):boolean; + {open a word file for input} +begin reset(f,name_of_file,'/O'); w_open_in:=reset_OK(f); +end; +@# +function w_open_out(var f:word_file):boolean; + {open a word file for output} +begin rewrite(f,name_of_file,'/O'); w_open_out:=rewrite_OK(f); +end; +@y +@ All of the file opening functions are defined in C. +@z + +@x [3.28] l.850 - Do file closing in C. +@ Files can be closed with the \ph\ routine `|close(f)|', which +@:PASCAL H}{\ph@> +@^system dependencies@> +should be used when all input or output with respect to |f| has been completed. +This makes |f| available to be opened again, if desired; and if |f| was used for +output, the |close| operation makes the corresponding external file appear +on the user's area, ready to be read. + +These procedures should not generate error messages if a file is +being closed before it has been successfully opened. + +@p procedure a_close(var f:alpha_file); {close a text file} +begin close(f); +end; +@# +procedure b_close(var f:byte_file); {close a binary file} +begin close(f); +end; +@# +procedure w_close(var f:word_file); {close a word file} +begin close(f); +end; +@y +@ And all the file closing routines as well. +@z + +@x [3.30] l.888 - Array size of input buffer is determined at runtime. +@!buffer:array[0..buf_size] of ASCII_code; {lines of characters being read} +@y +@!buffer:^ASCII_code; {lines of characters being read} +@z + +@x [3.31] l.933 - Do `input_ln' in C. +@p function input_ln(var f:alpha_file;@!bypass_eoln:boolean):boolean; + {inputs the next line or returns |false|} +var last_nonblank:0..buf_size; {|last| with trailing blanks removed} +begin if bypass_eoln then if not eof(f) then get(f); + {input the first character of the line into |f^|} +last:=first; {cf.\ Matthew 19\thinspace:\thinspace30} +if eof(f) then input_ln:=false +else begin last_nonblank:=first; + while not eoln(f) do + begin if last>=max_buf_stack then + begin max_buf_stack:=last+1; + if max_buf_stack=buf_size then + @; + end; + buffer[last]:=f^; get(f); incr(last); + if buffer[last-1]<>" " then last_nonblank:=last; + end; + last:=last_nonblank; input_ln:=true; + end; +end; +@y +We define |input_ln| in C, for efficiency. +@z + +% [3.32] `term_in' and `term_out' are standard input and output. +% Declare the variables that used to be constants. +@x [3.32] l.961 - `term_in' and `term_out' are standard input and output. +@= +@!term_in:alpha_file; {the terminal as an input file} +@!term_out:alpha_file; {the terminal as an output file} +@y +@d term_in==stdin {the terminal as an input file} +@d term_out==stdout {the terminal as an output file} + +@= +@!init +@!ini_version:boolean; {are we \.{INITEX}?} +@!dump_option:boolean; {was the dump name option used?} +@!dump_line:boolean; {was a \.{\%\AM format} line seen?} +tini@/ +@# +@!bound_default:integer; {temporary for setup} +@!bound_name:^char; {temporary for setup} +@# +@!main_memory:integer; {total memory words allocated in initex} +@!extra_mem_bot:integer; {|mem_min:=mem_bot-extra_mem_bot| except in \.{INITEX}} +@!mem_min:integer; {smallest index in \TeX's internal |mem| array; + must be |min_halfword| or more; + must be equal to |mem_bot| in \.{INITEX}, otherwise |<=mem_bot|} +@!mem_top:integer; {largest index in the |mem| array dumped by \.{INITEX}; + must be substantially larger than |mem_bot|, + equal to |mem_max| in \.{INITEX}, else not greater than |mem_max|} +@!extra_mem_top:integer; {|mem_max:=mem_top+extra_mem_top| except in \.{INITEX}} +@!mem_max:integer; {greatest index in \TeX's internal |mem| array; + must be strictly less than |max_halfword|; + must be equal to |mem_top| in \.{INITEX}, otherwise |>=mem_top|} +@!error_line:integer; {width of context lines on terminal error messages} +@!half_error_line:integer; {width of first lines of contexts in terminal + error messages; should be between 30 and |error_line-15|} +@!max_print_line:integer; + {width of longest text lines output; should be at least 60} +@!max_strings:integer; {maximum number of strings; must not exceed |max_halfword|} +@!strings_free:integer; {strings available after format loaded} +@!string_vacancies:integer; {the minimum number of characters that should be + available for the user's control sequences and font names, + after \TeX's own error messages are stored} +@!pool_size:integer; {maximum number of characters in strings, including all + error messages and help texts, and the names of all fonts and + control sequences; must exceed |string_vacancies| by the total + length of \TeX's own strings, which is currently about 23000} +@!pool_free:integer;{pool space free after format loaded} +@!hyph_size:integer; {maximun number of hyphen exceptions} +@!trie_size:integer; {space for hyphenation patterns; should be larger for + \.{INITEX} than it is in production versions of \TeX. 50000 is + needed for English, German, and Portuguese.} +@!buf_size:integer; {maximum number of characters simultaneously present in + current lines of open files and in control sequences between + \.{\\csname} and \.{\\endcsname}; must not exceed |max_halfword|} +@!stack_size:integer; {maximum number of simultaneous input sources} +@!max_in_open:integer; {maximum number of input files and error insertions that + can be going on simultaneously} +@!param_size:integer; {maximum number of simultaneous macro parameters} +@!nest_size:integer; {maximum number of semantic levels simultaneously active} +@!save_size:integer; {space for saving values outside of current group; must be + at most |max_halfword|} +@!dvi_buf_size:integer; {size of the output buffer; must be a multiple of 8} +@!quoted_filename:boolean; {current filename is quoted} +@z + +@x [3.33] l.964 - We don't need to open terminal files. +@ Here is how to open the terminal files +in \ph. The `\.{/I}' switch suppresses the first |get|. +@:PASCAL H}{\ph@> +@^system dependencies@> + +@d t_open_in==reset(term_in,'TTY:','/O/I') {open the terminal for text input} +@d t_open_out==rewrite(term_out,'TTY:','/O') {open the terminal for text output} +@y +@ Here is how to open the terminal files. |t_open_out| does nothing. +|t_open_in|, on the other hand, does the work of ``rescanning,'' or getting +any command line arguments the user has provided. It's defined in C. + +@d t_open_out == {output already open for text output} +@z + +@x [3.34] l.982 - Flushing output to terminal files. +these operations can be specified in \ph: +@:PASCAL H}{\ph@> +@^system dependencies@> + +@d update_terminal == break(term_out) {empty the terminal output buffer} +@d clear_terminal == break_in(term_in,true) {clear the terminal input buffer} +@y +these operations can be specified with {\mc UNIX}. |update_terminal| +does an |fflush|. |clear_terminal| is redefined +to do nothing, since the user should control the terminal. +@^system dependencies@> + +@d update_terminal == fflush (term_out) +@d clear_terminal == do_nothing +@z + +@x [3.35] l.1017 - Do `input_ln' in C => section not needed. +@= +if format_ident=0 then + begin write_ln(term_out,'Buffer size exceeded!'); goto final_end; +@.Buffer size exceeded@> + end +else begin cur_input.loc_field:=first; cur_input.limit_field:=last-1; + overflow("buffer size",buf_size); +@:TeX capacity exceeded buffer size}{\quad buffer size@> + end +@y +Routine is implemented in C; part of module is, however, needed for e-TeX. + +@= + begin cur_input.loc_field:=first; cur_input.limit_field:=last-1; + overflow("buffer size",buf_size); +@:TeX capacity exceeded buffer size}{\quad buffer size@> + end +@z + +@x [3.37] l.1055 - |init_terminal|, reading the command line. +@ The following program does the required initialization +without retrieving a possible command line. +It should be clear how to modify this routine to deal with command lines, +if the system permits them. +@^system dependencies@> + +@p function init_terminal:boolean; {gets the terminal input started} +label exit; +begin t_open_in; +@y +@ The following program does the required initialization. +Iff anything has been specified on the command line, then |t_open_in| +will return with |last > first|. +@^system dependencies@> + +@p function init_terminal:boolean; {gets the terminal input started} +label exit; +begin t_open_in; +if last > first then + begin loc := first; + while (loc < last) and (buffer[loc]=' ') do incr(loc); + if loc < last then + begin init_terminal := true; goto exit; + end; + end; +@z + +@x [3.37] l.1068 - |init_terminal|, output missing newline. + write(term_out,'! End of file on the terminal... why?'); +@y + write_ln(term_out,'! End of file on the terminal... why?'); +@z + +@x [4.38] l.1126 - Array size for string pool is determined at runtime. +@!pool_pointer = 0..pool_size; {for variables that point into |str_pool|} +@!str_number = 0..max_strings; {for variables that point into |str_start|} +@y +@!pool_pointer = integer; {for variables that point into |str_pool|} +@!str_number = 0..ssup_max_strings; {for variables that point into |str_start|} +@z + +@x [4.39] l.1131 - Dynamically size pool arrays. +@!str_pool:packed array[pool_pointer] of packed_ASCII_code; {the characters} +@!str_start_ar : array[str_number] of pool_pointer; {the starting pointers} +@y +@!str_pool: ^packed_ASCII_code; {the characters} +@!str_start_ar : ^pool_pointer; {the starting pointers} +@z + +@x [4.47] l.1237 - string recycling +@p @!init function get_strings_started:boolean; {initializes the string pool, +@y +@p @t\4@>@@/ + +@!init function get_strings_started:boolean; {initializes the string pool, +@z + +@x +@ @d bad_pool(#)==begin wake_up_terminal; write_ln(term_out,#); + a_close(pool_file); get_strings_started:=false; return; + end +@= +name_of_file:=pool_name; {we needn't set |name_length|} +if a_open_in(pool_file) then + begin c:=false; + repeat @; + until c; + a_close(pool_file); get_strings_started:=true; + end +else bad_pool('! I can''t read ALEPH.POOL.') +@.I can't read ALEPH.POOL@> + +@ @= +begin if eof(pool_file) then bad_pool('! ALEPH.POOL has no check sum.'); +@.ALEPH.POOL has no check sum@> +read(pool_file,m,n); {read two digits of string length} +if m='*' then @ +else begin if (m<"0")or(m>"9")or@| + (n<"0")or(n>"9") then + bad_pool('! ALEPH.POOL line doesn''t begin with two digits.'); +@.ALEPH.POOL line doesn't...@> + l:=m*10+n-"0"*11; {compute the length} + if pool_ptr+l+string_vacancies>pool_size then + bad_pool('! You have to increase POOLSIZE.'); +@.You have to increase POOLSIZE@> + for k:=1 to l do + begin if eoln(pool_file) then m:=' '@+else read(pool_file,m); + append_char(m); + end; + read_ln(pool_file); g:=make_string; + end; +end + +@ The \.{WEB} operation \.{@@\$} denotes the value that should be at the +end of this \.{OMEGA.POOL} file; any other value means that the wrong pool +file has been loaded. +@^check sum@> + +@= +begin a:=0; k:=1; +loop@+ begin if (n<"0")or(n>"9") then + bad_pool('! ALEPH.POOL check sum doesn''t have nine digits.'); +@.ALEPH.POOL check sum...@> + a:=10*a+n-"0"; + if k=9 then goto done; + incr(k); read(pool_file,n); + end; +done: if a<>@$ then bad_pool('! ALEPH.POOL doesn''t match; OTANGLE me again.'); +@.ALEPH.POOL doesn't match@> +c:=true; +end +@y +@ @= + g := loadpoolstrings((pool_size-string_vacancies)); + if g=0 then begin + wake_up_terminal; write_ln(term_out,'! You have to increase POOLSIZE.'); + get_strings_started:=false; + return; + end; + get_strings_started:=true; + +@ Empty module + +@ Empty module +@z + +@x [5.54] l.1422 - error_line +@!trick_buf:array[0..error_line] of ASCII_code; {circular buffer for +@y +@!trick_buf:array[0..ssup_error_line] of ASCII_code; {circular buffer for +@z + +@x [5.61] l.1556 - Print rest of banner, eliminate misleading `(no format preloaded)'. +wterm(eTeX_banner); +if format_ident=0 then wterm_ln(' (no format preloaded)') +else begin slow_print(format_ident); print_ln; + end; +@y +wterm(eTeX_banner); +wterm(version_string); +if format_ident>0 then slow_print(format_ident); +print_ln; +@z + +@x [6.73] l.1732 - Add unspecified_mode. +@d error_stop_mode=3 {stops at every opportunity to interact} +@y +@d error_stop_mode=3 {stops at every opportunity to interact} +@d unspecified_mode=4 {extra value for command-line switch} +@z + +@x [6.73] l.1738 - Add interaction_option. +@!interaction:batch_mode..error_stop_mode; {current level of interaction} +@y +@!interaction:batch_mode..error_stop_mode; {current level of interaction} +@!interaction_option:batch_mode..unspecified_mode; {set from command line} +@z + +@x [6.74] l.1740 - Allow override by command line switch. +@ @=interaction:=error_stop_mode; +@y +@ @=if interaction_option=unspecified_mode then + interaction:=error_stop_mode +else + interaction:=interaction_option; +@z + +% [6.81] Eliminate nonlocal goto, since C doesn't have them. +% Plus, it's nicer just to do an exit with the appropriate status code +% under Unix. We call it `uexit' because there's a WEB symbol called +% `exit' already. We use a C macro to change `uexit' back to `exit'. +@x [6.81] l.1852 - Eliminate nonlocal goto, since C doesn't have them. +@= +procedure jump_out; +begin goto end_of_TEX; +end; +@y +@d do_final_end==begin + update_terminal; + ready_already:=0; + if (history <> spotless) and (history <> warning_issued) then + uexit(1) + else + uexit(0); + end + +@= +procedure jump_out; +begin +close_files_and_terminate; +do_final_end; +end; +@z + +@x [6.84] l.1888 - Implement the switch-to-editor option. +line ready to be edited. But such an extension requires some system +wizardry, so the present implementation simply types out the name of the +file that should be +edited and the relevant line number. +@^system dependencies@> + +There is a secret `\.D' option available when the debugging routines haven't +been commented~out. +@^debugging@> +@y +line ready to be edited. +We do this by calling the external procedure |call_edit| with a pointer to +the filename, its length, and the line number. +However, here we just set up the variables that will be used as arguments, +since we don't want to do the switch-to-editor until after TeX has closed +its files. +@^system dependencies@> + +There is a secret `\.D' option available when the debugging routines haven't +been commented~out. +@^debugging@> +@d edit_file==input_stack[base_ptr] +@z + +@x [6.84] l.1903 - Implement the switch-to-editor option. +"E": if base_ptr>0 then + begin print_nl("You want to edit file "); +@.You want to edit file x@> + slow_print(input_stack[base_ptr].name_field); + print(" at line "); print_int(line); + interaction:=scroll_mode; jump_out; +@y +"E": if base_ptr>0 then + begin edit_name_start:=str_start(edit_file.name_field); + edit_name_length:=str_start(edit_file.name_field+1) - + str_start(edit_file.name_field); + edit_line:=line; + jump_out; +@z + +% [7.104] `remainder' is a library routine on some systems, so change +% its name to avoid conflicts. +@x [7.104] l.2227 - avoid name conflicts with lib routine remainder() +|remainder|, holds the remainder after a division. + +@= +@y +|remainder|, holds the remainder after a division. + +@d remainder==tex_remainder + +@= +@z + +@x [7.109] l.2352 - Define glue_ratio in C. +@!glue_ratio=real; {one-word representation of a glue expansion factor} +@y +@z + +@x [8.112] l.2435 - Efficiency. +macros are simplified in the obvious way when |min_quarterword=0|. +@^inner loop@>@^system dependencies@> + +@d qi(#)==#+min_quarterword + {to put an |eight_bits| item into a quarterword} +@d qo(#)==#-min_quarterword + {to take an |eight_bits| item out of a quarterword} +@d hi(#)==#+min_halfword + {to put a sixteen-bit item into a halfword} +@d ho(#)==#-min_halfword + {to take a sixteen-bit item from a halfword} +@y +macros are simplified in the obvious way when |min_quarterword=0|. +So they have been simplified here in the obvious way. +@^inner loop@>@^system dependencies@> + +@d qi(#)==# {to put an |eight_bits| item into a quarterword} +@d qo(#)==# {to take an |eight_bits| item from a quarterword} +@d hi(#)==# {to put a sixteen-bit item into a halfword} +@d ho(#)==# {to take a sixteen-bit item from a halfword} +@z + +% [8.113] We've put the memory structure into the include file +% `texmf.h', since it's too hard to translate automatically. +@x [8.113] l.2453 - data structures for main memory +@!quarterword = min_quarterword..max_quarterword; {1/4 of a word} +@!halfword=min_halfword..max_halfword; {1/2 of a word} +@!two_choices = 1..2; {used when there are two variants in a record} +@!four_choices = 1..4; {used when there are four variants in a record} +@!two_halves = packed record@;@/ + @!rh:halfword; + case two_choices of + 1: (@!lh:halfword); + 2: (@!b0:quarterword; @!b1:quarterword); + end; +@!four_quarters = packed record@;@/ + @!b0:quarterword; + @!b1:quarterword; + @!b2:quarterword; + @!b3:quarterword; + end; +@!memory_word = record@;@/ + case four_choices of + 1: (@!int:integer); + 2: (@!gr:glue_ratio); + 3: (@!hh:two_halves); + 4: (@!qqqq:four_quarters); + end; +@y +@!quarterword = min_quarterword..max_quarterword; +@!halfword = min_halfword..max_halfword; +@!two_choices = 1..2; {used when there are two variants in a record} +@!four_choices = 1..4; {used when there are four variants in a record} +@=#include "texmfmem.h";@> +@=#include "alephmem.h";@> +@z + +% [9.116] Change `mem' to `zmem', so we can define mem to be a register +% pointer to the memory array for speed. +@x [9.116] l.2545 - definition of main memory array +@!mem : array[mem_min..mem_max] of memory_word; {the big dynamic storage area} +@y +@!yzmem : ^memory_word; {the big dynamic storage area} +@!zmem : ^memory_word; {the big dynamic storage area} +@z + +% [9.127] Fix casting problem in C. +% There are several of these. They come from the rules C uses for +% comparing signed and unsigned quantities. Just doing the comparison +% can result in incorrect evaluation wrt the way Pascal would do it. +@x [9.127] l.2739 - Fix casting problem in C. +if r>p+1 then @; +@y 2738 +if r>intcast(p+1) then @; +@z + +% [11.165] Fix the word `free' so that it doesn't conflict with the +% standard C library routine of the same name. +@x [11.165] l.3364 - avoid conflict with lib function free() +are debugging.) +@y +are debugging.) + +@d free==free_arr +@z + +@x [11.165] l.3367 - dummy |free| and |was_free| arrays +@!debug @!free: packed array [mem_min..mem_max] of boolean; {free cells} +@t\hskip10pt@>@!was_free: packed array [mem_min..mem_max] of boolean; +@y + {The debug memory arrays have not been mallocated yet.} +@!debug @!free: packed array [0..9] of boolean; {free cells} +@t\hskip10pt@>@!was_free: packed array [0..9] of boolean; +@z + +@x [12.174] l.3526 - Eliminate unsigned comparisons to zero. + begin if (font(p)font_max) then + print_char("*") +@.*\relax@> + else @; +@y + begin @; +@z + +@x [12.176] l.3563 - Eliminate unsigned comparisons to zero. +begin if p>mem_end then print_esc("CLOBBERED.") +else begin if (font(p)font_max) then print_char("*") +@.*\relax@> + else @; +@y +begin if p>mem_end then print_esc("CLOBBERED.") +else begin @; +@z + +@x [12.186] l.3747 - Don't worry about strange floating point values. + if abs(mem[p+glue_offset].int)<@'4000000 then print("?.?") + else if abs(g)>float_constant(20000) then +@y 3747 + { The Unix |pc| folks removed this restriction with a remark that + invalid bit patterns were vanishingly improbable, so we follow + their example without really understanding it. + |if abs(mem[p+glue_offset].int)<@'4000000 then print('?.?')| + |else| } + if fabs(g)>float_constant(20000) then +@z + + +@x [16.213] l.4321 - texarray +@!nest:array[0..nest_size] of list_state_record; +@y +@!nest:^list_state_record; +@z + +@x [16.215] l.4344 - remove mem[] reference from initialize. +@; +@y +@/{The following piece of code is a copy of module 991:} +page_contents:=empty; page_tail:=page_head; {|link(page_head):=null;|}@/ +last_glue:=max_halfword; last_penalty:=0; last_kern:=0; +page_depth:=0; page_max_depth:=0; +@z + +@x [17.241] l.5219 - Do `fix_date_and_time' in C. +@ The following procedure, which is called just before \TeX\ initializes its +input and output, establishes the initial values of the date and time. +@^system dependencies@> +Since standard \PASCAL\ cannot provide such information, something special +is needed. The program here simply specifies July 4, 1776, at noon; but +users probably want a better approximation to the truth. + +@p procedure fix_date_and_time; +begin time:=12*60; {minutes since midnight} +day:=4; {fourth day of the month} +month:=7; {seventh month of the year} +year:=1776; {Anno Domini} +end; +@y +@ The following procedure, which is called just before \TeX\ initializes its +input and output, establishes the initial values of the date and time. +It calls a macro-defined |date_and_time| routine. |date_and_time| +in turn is a C macro, which calls |get_date_and_time|, passing +it the addresses of the day, month, etc., so they can be set by the +routine. |get_date_and_time| also sets up interrupt catching if that +is conditionally compiled in the C code. +@^system dependencies@> + +@d fix_date_and_time==o_date_and_time(int_base+time_code, + int_base+day_code, + int_base+month_code, + int_base+year_code) +@z + +@x [18.262] l.5584 - Remove more unsigned comparisons to zero. +else if (newtext(p)<0)or(newtext(p)>=str_ptr) then print_esc("NONEXISTENT.") +@y +else if (newtext(p)>=str_ptr) then print_esc("NONEXISTENT.") +@z + +@x [19.271] l.5872 - texarray +@!save_stack : array[0..save_size] of memory_word; +@y +@!save_stack : ^memory_word; +@z + +@x [22.301] l.6432 - texarray +@!input_stack : array[0..stack_size] of in_state_record; +@y +@!input_stack : ^in_state_record; +@z + +@x [22.304] l.6536 - texarray +@!input_file : array[1..max_in_open] of alpha_file; +@!input_file_mode : array[1..max_in_open] of halfword; +@!input_file_translation : array[1..max_in_open] of halfword; +@!line : integer; {current line number in the current source file} +@!line_stack : array[1..max_in_open] of integer; +@y +@!input_file : ^alpha_file; +@!input_file_mode : ^halfword; +@!input_file_translation : ^halfword; +@!line : integer; {current line number in the current source file} +@!line_stack : ^integer; +@z + +@x [22.308] l.6701 - texarray +@!param_stack:array [0..param_size] of pointer; + {token list pointers for parameters} +@y +@!param_stack: ^pointer; + {token list pointers for parameters} +@z + +@x [23.328] l.7043 - keep top of source_filename_stack initialized +incr(in_open); push_input; index:=in_open; +@y +incr(in_open); push_input; index:=in_open; +source_filename_stack[index]:=0;full_source_filename_stack[index]:=0; +@z + +@x [23.331] l.7071 - init source file name stacks +begin input_ptr:=0; max_in_stack:=0; +@y +begin input_ptr:=0; max_in_stack:=0; +source_filename_stack[0]:=0;full_source_filename_stack[0]:=0; +@z + +@x [28.501] l.9747 - \eof18 +if_eof_code: begin scan_four_bit_int; b:=(read_open[cur_val]=closed); + end; +@y +if_eof_code: begin scan_four_bit_int_or_18; + if cur_val=18 then b:=not shellenabledp + else b:=(read_open[cur_val]=closed); + end; +@z + +@x [29.513] l.9951 - Area and extension rules for filenames. +@ The file names we shall deal with for illustrative purposes have the +following structure: If the name contains `\.>' or `\.:', the file area +consists of all characters up to and including the final such character; +otherwise the file area is null. If the remaining file name contains +`\..', the file extension consists of all such characters from the first +remaining `\..' to the end, otherwise the file extension is null. +@y +@ The file names we shall deal with have the +following structure: If the name contains `\./' or `\.:' +(for Amiga only), the file area +consists of all characters up to and including the final such character; +otherwise the file area is null. If the remaining file name contains +`\..', the file extension consists of all such characters from the last +`\..' to the end, otherwise the file extension is null. +@z + +@x [29.513] l.9963 - Area and extension rules for filenames. +@!area_delimiter:pool_pointer; {the most recent `\.>' or `\.:', if any} +@!ext_delimiter:pool_pointer; {the relevant `\..', if any} +@y +@!area_delimiter:pool_pointer; {the most recent `\./', if any} +@!ext_delimiter:pool_pointer; {the most recent `\..', if any} +@z + +@x [29.514] l.9973 - TeX area directories. +@d TEX_area=="TeXinputs:" +@.TeXinputs@> +@d TEX_font_area=="TeXfonts:" +@.TeXfonts@> +@y +In C, the default paths are specified separately. +@z + +@x [29.515] l.9995 - filenames: quoted +begin area_delimiter:=0; ext_delimiter:=0; +@y +begin area_delimiter:=0; ext_delimiter:=0; quoted_filename:=false; +@z + +@x [29.516] l.9992 - filenames: more_name +begin if c=" " then more_name:=false +@y +begin if (c=" ") and stop_at_space and (not quoted_filename) then + more_name:=false +else if c="""" then begin + quoted_filename:=not quoted_filename; + more_name:=true; + end +@z + +@x [29.516] l.9994 - filenames: more_name + if (c=">")or(c=":") then +@y + if IS_DIR_SEP(c) then +@z + +@x [29.516] l.9997 - filenames: more_name + else if (c=".")and(ext_delimiter=0) then ext_delimiter:=cur_length; +@y + else if c="." then ext_delimiter:=cur_length; +@z + +@x [29.517] l.10002 - end_name: string recycling +@ The third. +@^system dependencies@> + +@p procedure end_name; +@y +@ The third. +@^system dependencies@> +If a string is already in the string pool, the function +|slow_make_string| does not create a new string but returns this string +number, thus saving string space. Because of this new property of the +returned string number it is not possible to apply |flush_string| to +these strings. + +@p procedure end_name; +var temp_str: str_number; {result of file name cache lookups} +@!j,@!s,@!t: pool_pointer; {running indices} +@!must_quote:boolean; {whether we need to quote a string} +@z + +@x [29.517] l.10022 - end_name: spaces in filenames +@:TeX capacity exceeded number of strings}{\quad number of strings@> +@y +@:TeX capacity exceeded number of strings}{\quad number of strings@> +str_room(6); {Room for quotes, if needed.} +{add quotes if needed} +if area_delimiter<>0 then begin + {maybe quote |cur_area|} + must_quote:=false; + s:=str_start(str_ptr); + t:=str_start(str_ptr)+area_delimiter; + j:=s; + while (not must_quote) and (j0 then ext_delimiter:=ext_delimiter+2; + area_delimiter:=area_delimiter+2; + pool_ptr:=pool_ptr+2; + end; + end; +{maybe quote |cur_name|} +s:=str_start(str_ptr)+area_delimiter; +if ext_delimiter=0 then t:=pool_ptr else t:=str_start(str_ptr)+ext_delimiter-1; +must_quote:=false; +j:=s; +while (not must_quote) and (j0 then ext_delimiter:=ext_delimiter+2; + pool_ptr:=pool_ptr+2; + end; +if ext_delimiter<>0 then begin + {maybe quote |cur_ext|} + s:=str_start(str_ptr)+ext_delimiter-1; + t:=pool_ptr; + must_quote:=false; + j:=s; + while (not must_quote) and (j0 then + begin cur_area:=temp_str; + decr(str_ptr); {no |flush_string|, |pool_ptr| will be wrong!} + for j:=str_start(str_ptr+1) to pool_ptr-1 do + begin str_pool[j-area_delimiter]:=str_pool[j]; + end; + pool_ptr:=pool_ptr-area_delimiter; {update |pool_ptr|} + end; + end; +if ext_delimiter=0 then + begin cur_ext:=""; cur_name:=slow_make_string; +@z + +@x [29.517] l.10016 - end_name: string recycling +else begin cur_name:=str_ptr; + str_start(str_ptr+1):=str_start(str_ptr)+ext_delimiter-area_delimiter-1; + incr(str_ptr); cur_ext:=make_string; +@y +else begin cur_name:=str_ptr; + str_start(str_ptr+1):=str_start(str_ptr)+ext_delimiter-area_delimiter-1; + incr(str_ptr); cur_ext:=make_string; + decr(str_ptr); {undo extension string to look at name part} + temp_str:=search_string(cur_name); + if temp_str>0 then + begin cur_name:=temp_str; + decr(str_ptr); {no |flush_string|, |pool_ptr| will be wrong!} + for j:=str_start(str_ptr+1) to pool_ptr-1 do + begin str_pool[j-ext_delimiter+area_delimiter+1]:=str_pool[j]; + end; + pool_ptr:=pool_ptr-ext_delimiter+area_delimiter+1; {update |pool_ptr|} + end; + cur_ext:=slow_make_string; {remake extension string} +@z + +@x [29.518] l.10042 - print_file_name: quote if spaces in names. +begin slow_print(a); slow_print(n); slow_print(e); +@y +var must_quote: boolean; {whether to quote the filename} +@!j:pool_pointer; {index into |str_pool|} +begin +must_quote:=false; +if a<>0 then begin + j:=str_start(a); + while (not must_quote) and (j0 then begin + j:=str_start(n); + while (not must_quote) and (j0 then begin + j:=str_start(e); + while (not must_quote) and (j0)and(|str_pool|[|str_start|(|a|)]=""""))or + ((|n|<>0)and(|str_pool|[|str_start|(|n|)]=""""))or + ((|e|<>0)and(|str_pool|[|str_start|(|e|)]=""""));} +if must_quote then print_char(""""); +if a<>0 then + for j:=str_start(a) to str_start(a+1)-1 do + if so(str_pool[j])<>"""" then + print_char(so(str_pool[j])); +if n<>0 then + for j:=str_start(n) to str_start(n+1)-1 do + if so(str_pool[j])<>"""" then + print_char(so(str_pool[j])); +if e<>0 then + for j:=str_start(e) to str_start(e+1)-1 do + if so(str_pool[j])<>"""" then + print_char(so(str_pool[j])); +if must_quote then print_char(""""); +@z + +@x [29.519] l.10051 - have append_to_name skip quotes. +@d append_to_name(#)==begin c:=#; incr(k); + if k<=file_name_size then name_of_file[k]:=xchr[c]; + end +@y +@d append_to_name(#)==begin c:=#; if not (c="""") then begin incr(k); + if k<=file_name_size then name_of_file[k]:=xchr[c]; + end end +@z + +% [29.519] In pack_file_name, leave room for the extra null we append at +% the end of a filename. +@x [29.519] l.10047 - pack_file_name, leave room for the extra null +for j:=str_start(a) to str_start(a+1)-1 do append_to_name(so(str_pool[j])); +@y +if name_of_file then libc_free (name_of_file); +name_of_file:= xmalloc_array(char, 1 + length(a) + length(n) + length(e)); +for j:=str_start(a) to str_start(a+1)-1 do append_to_name(so(str_pool[j])); +@z + +@x [29.519] l.10051 - pack_file_name, append the extra null +for k:=name_length+1 to file_name_size do name_of_file[k]:=' '; +@y +name_of_file[name_length+1]:=0; +@z + +@x [29.520] l.10060 - filenames: default format. +@d format_default_length=20 {length of the |TEX_format_default| string} +@d format_area_length=11 {length of its area part} +@d format_ext_length=4 {length of its `\.{.fmt}' part} +@d format_extension=".fmt" {the extension, as a \.{WEB} constant} +@y +Under {\mc UNIX} we don't give the area part, instead depending +on the path searching that will happen during file opening. Also, the +length will be set in the main program. + +@d format_area_length=0 {length of its area part} +@d format_ext_length=4 {length of its `\.{.fmt}' part} +@d format_extension=".fmt" {the extension, as a \.{WEB} constant} +@z + +@x [29.521] l.10066 - filenames: default format, where `plain.fmt' is. +@!TEX_format_default:packed array[1..format_default_length] of char; + +@ @= +TEX_format_default:='TeXformats:plain.fmt'; +@y +@!format_default_length: integer; +@!TEX_format_default: ^char; + +@ We set the name of the default format file and the length of that name +in C, instead of Pascal, since we want them to depend on the name of the +program. +@z + +@x [29.523] l.10095 - Change to pack_buffered_name as with pack_file_name. +for j:=1 to n do append_to_name(TEX_format_default[j]); +@y +if name_of_file then libc_free (name_of_file); +name_of_file := xmalloc_array (char, 1 + n + (b - a + 1) + format_ext_length); +for j:=1 to n do append_to_name(TEX_format_default[j]); +@z + +@x [29.523] l.10100 - Change to pack_buffered_name as with pack_file_name. +for k:=name_length+1 to file_name_size do name_of_file[k]:=' '; +@y +name_of_file[name_length+1]:=0; +@z + +@x [29.524] l.10118 - Format file opening: only try once, with path searching. + pack_buffered_name(0,loc,j-1); {try first without the system file area} + if w_open_in(fmt_file) then goto found; + pack_buffered_name(format_area_length,loc,j-1); + {now try the system format file area} + if w_open_in(fmt_file) then goto found; +@y + pack_buffered_name(0,loc,j-1); {Kpathsea does everything} + if w_open_in(fmt_file) then goto found; +@z + +@x [29.524] l.10124 - replace `PLAIN' in error messages with `default'. + wterm_ln('Sorry, I can''t find that format;',' will try PLAIN.'); +@y + wterm ('Sorry, I can''t find the format `'); + fputs (name_of_file + 1, stdout); + wterm ('''; will try `'); + fputs (TEX_format_default + 1, stdout); + wterm_ln ('''.'); +@z + +@x [29.524] l.10132 - replace `PLAIN' in error messages with `default'. + wterm_ln('I can''t find the PLAIN format file!'); +@.I can't find PLAIN...@> +@y + wterm ('I can''t find the format file `'); + fputs (TEX_format_default + 1, stdout); + wterm_ln ('''!'); +@.I can't find the format...@> +@z + +@x [29.525] l.10163 - make_name_string +@p function make_name_string:str_number; +var k:1..file_name_size; {index into |name_of_file|} +begin if (pool_ptr+name_length>pool_size)or(str_ptr=max_strings)or + (cur_length>0) then + make_name_string:="?" +else begin for k:=1 to name_length do append_char(name_of_file[k]); + make_name_string:=make_string; + end; +@y +@p function make_name_string:str_number; +var k:1..file_name_size; {index into |name_of_file|} +save_area_delimiter, save_ext_delimiter: pool_pointer; +save_name_in_progress, save_stop_at_space: boolean; +begin if (pool_ptr+name_length>pool_size)or(str_ptr=max_strings)or + (cur_length>0) then + make_name_string:="?" +else begin for k:=1 to name_length do append_char(name_of_file[k]); + make_name_string:=make_string; + {At this point we also set |cur_name|, |cur_ext|, and |cur_area| to + match the contents of |name_of_file|.} + save_area_delimiter:=area_delimiter; save_ext_delimiter:=ext_delimiter; + save_name_in_progress:=name_in_progress; save_stop_at_space:=stop_at_space; + name_in_progress:=true; + begin_name; + stop_at_space:=false; + k:=1; + while (k<=name_length)and(more_name(name_of_file[k])) do + incr(k); + stop_at_space:=save_stop_at_space; + end_name; + name_in_progress:=save_name_in_progress; + area_delimiter:=save_area_delimiter; ext_delimiter:=save_ext_delimiter; + end; +@z + +@x [29.526] l.10194 - stop scanning file name if we're at end-of-line. + if not more_name(cur_chr) then goto done; +@y + {If |cur_chr| is a space and we're not scanning a token list, check + whether we're at the end of the buffer. Otherwise we end up adding + spurious spaces to file names in some cases.} + if (cur_chr=" ") and (state<>token_list) and (loc>limit) then goto done; + if not more_name(cur_chr) then goto done; +@z + +@x [29.530] l.10245 - prompt_file_name: prevent empty filenames. +var k:0..buf_size; {index into |buffer|} +@y +var k:0..buf_size; {index into |buffer|} +@!saved_cur_name:str_number; {to catch empty terminal input} +@!saved_cur_ext:str_number; {to catch empty terminal input} +@!saved_cur_area:str_number; {to catch empty terminal input} +@z + +@x [29.530] l.10252 - prompt_file_name: No default extension is TeX input file. +if e=".tex" then show_context; +@y +if (e=".tex") or (e="") then show_context; +print_ln; print("(Type to retry, or to exit"); +if (e<>"") then + begin + print(" Default file extension is `"); print(e); print("'"); + end; +print(")"); print_ln; +@z + +@x [29.530] l.10258 - prompt_file_name: prevent empty filenames. +clear_terminal; prompt_input(": "); @; +if cur_ext="" then cur_ext:=e; +@y +saved_cur_name:=cur_name; +saved_cur_ext:=cur_ext; +saved_cur_area:=cur_area; +clear_terminal; prompt_input(": "); @; +if (length(cur_name)=0) and (cur_ext="") and (cur_area="") then + begin + cur_name:=saved_cur_name; + cur_ext:=saved_cur_ext; + cur_area:=saved_cur_area; + end +else + if cur_ext="" then cur_ext:=e; +@z + +@x [29.532] l.10263 - avoid conflict, `logname' in on some systems. +@ Here's an example of how these conventions are used. Whenever it is time to +ship out a box of stuff, we shall use the macro |ensure_dvi_open|. + +@y +@ Here's an example of how these conventions are used. Whenever it is time to +ship out a box of stuff, we shall use the macro |ensure_dvi_open|. + +@d log_name == texmf_log_name +@z + +@x [29.534] l.10285 - Adjust for C string conventions. +@!months:packed array [1..36] of char; {abbreviations of month names} +@y +@!months:^char; +j:integer; +@z + +@x [29.534] l. - Send the job_name to the file recorder. +begin old_setting:=selector; +if job_name=0 then job_name:="texput"; +@y +begin old_setting:=selector; +if job_name=0 then job_name:=get_job_name("texput"); +pack_job_name(".ofl"); +recorder_change_filename(stringcast(name_of_file+1)); +@z + +@x [29.536] l.10324 - Print rest of banner. +begin wlog(eTeX_banner); +@y +begin wlog(eTeX_banner); +wlog(version_string); +@z + +@x [29.536] l.10327 - Adjust for C string conventions. +months:='JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'; +@y +months := ' JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'; +@z + +% [29.537] Use a path when calling a_open_in to do a \input; also, try +% to open the file with and without the `.tex' extension, regardless of +% whether the file already has an extension. This allows filenames like +% `foo' and `foo.bar.tex', as well as `foo.tex' and `foo.bar'. +@x [29.537] l.10338 - start_input +begin scan_file_name; {set |cur_name| to desired file name} +if cur_ext="" then cur_ext:=".tex"; +pack_cur_name; +loop@+ begin begin_file_reading; {set up |cur_file| and new level of input} + if a_open_in(cur_file) then goto done; + if cur_area="" then + begin pack_file_name(cur_name,TEX_area,cur_ext); + if a_open_in(cur_file) then goto done; + end; +@y +var temp_str: str_number; +begin scan_file_name; {set |cur_name| to desired file name} +pack_cur_name; +loop@+ begin begin_file_reading; {set up |cur_file| and new level of input} + tex_input_type := 1; {Tell |open_input| we are \.{\\input}.} + {Kpathsea tries all the various ways to get the file.} + if open_in_name_ok(name_of_file+1) + and a_open_in(cur_file, kpse_tex_format) then + goto done; +@z + +@x [29.537] l.10348 - start_input: don't force ".tex" extension. + prompt_file_name("input file name",".tex"); +@y + prompt_file_name("input file name",""); +@z + +@x [29.537] l.10350 - start_input: string recycling +done: name:=a_make_name_string(cur_file); +@y +done: name:=a_make_name_string(cur_file); +if name=str_ptr-1 then {we can try to conserve string pool space now} + begin temp_str:=search_string(name); + if temp_str>0 then + begin name:=temp_str; flush_string; + end; + end; +@z + +@x [29.537] l.10352 - start_input: use different heuristic for initex. + begin job_name:=cur_name; open_log_file; +@y + begin job_name:=get_job_name(cur_name); open_log_file; +@z + +@x [29.537] l.10359 - start_input: don't return filename to string pool. +if name=str_ptr-1 then {we can conserve string pool space now} + begin flush_string; name:=cur_name; + end; +@y +@z + +@x [30.563] l.10943 - Don't use TEX_font_area. +if aire="" then pack_file_name(nom,TEX_font_area,".ofm") +else pack_file_name(nom,aire,".ofm"); +if not b_open_in(tfm_file) then abort; +@y +{|kpse_find_file| will append the |".ofm"| or |".tfm"|, + and avoid searching the disk before the font alias files as well.} +pack_file_name(nom,aire,""); +if not ofm_open_in(tfm_file) then abort; +@z + +% [30.564] Reading the tfm file. As a special case, whenever we open a +% tfm file, we read its first byte into `tfm_temp' right away. TeX +% looks at `fbyte' before calling `fget', so it ends up seeing every +% byte. This is Pascal-like I/O. +@x [30.564] l.10956 - reading the tfm file, define fget & fbyte +@d fget==get(tfm_file) +@d fbyte==tfm_file^ +@y +@d fget==tfm_temp:=getc(tfm_file) +@d fbyte==tfm_temp +@z + +% [32.575] We only want `eof' on the TFM file to be true if we +% previously had EOF, not if we're at EOF now. This is like `feof', and +% unlike our implementation of `eof' elsewhere. +@x [32.575] l.11161 - Reading the tfm file, replace eof() by feof(). +if eof(tfm_file) then abort; +@y +if feof(tfm_file) then abort; +@z + +@x [32.595] l.11860 - texarray +@!dvi_buf:array[dvi_index] of real_eight_bits; {buffer for \.{DVI} output} +@!half_buf:dvi_index; {half of |dvi_buf_size|} +@!dvi_limit:dvi_index; {end of the current half buffer} +@!dvi_ptr:dvi_index; {the next available buffer address} +@y +@!dvi_buf:^real_eight_bits; {buffer for \.{DVI} output} +@!half_buf:integer; {half of |dvi_buf_size|} +@!dvi_limit:integer; {end of the current half buffer} +@!dvi_ptr:integer; {the next available buffer address} +@z + +@x [32.597] l.11886 - write_dvi done in C. +@p procedure write_dvi(@!a,@!b:dvi_index); +var k:dvi_index; +begin for k:=a to b do write(dvi_file,dvi_buf[k]); +end; +@y +In C, we use a macro to call |fwrite| or |write| directly, writing all +the bytes in one shot. Much better even than writing four +bytes at a time. +@z + +@x [32.617] l.12261 - Use output_comment if the user set it. Assume it's short enough. + old_setting:=selector; selector:=new_string; +@y +if output_comment then + begin l:=strlen(output_comment); dvi_out(l); + for s:=0 to l-1 do dvi_out(output_comment[s]); + end +else begin {the default code is unchanged} + old_setting:=selector; selector:=new_string; +@z + +@x [32.617] l.12268 - Use output_comment if the user set it. + pool_ptr:=str_start(str_ptr); {flush the current string} +@y + pool_ptr:=str_start(str_ptr); {flush the current string} +end; +@z + +% We output each portion of the page as we get to it, if we are using +% IPC, so that the previewer (TeXView) can display it immediately. [SPM] +@x [32.640] l.12690 - IPC +dvi_out(eop); incr(total_pages); cur_s:=-1; +@y +dvi_out(eop); incr(total_pages); cur_s:=-1; +ifdef ('IPC') +if ipc_on>0 then + begin if dvi_limit=half_buf then + begin write_dvi(half_buf, dvi_buf_size-1); + flush_dvi; + dvi_gone:=dvi_gone+half_buf; + end; + if dvi_ptr>0 then + begin write_dvi(0, dvi_ptr-1); + flush_dvi; + dvi_offset:=dvi_offset+dvi_ptr; dvi_gone:=dvi_gone+dvi_ptr; + end; + dvi_ptr:=0; dvi_limit:=dvi_buf_size; + ipc_page(dvi_gone); + end; +endif ('IPC'); +@z + +@x [32.642] l.12742 - Use dvi_offset instead of dvi_buf_size with IPC stuff. + k:=4+((dvi_buf_size-dvi_ptr) mod 4); {the number of 223's} +@y +ifdef ('IPC') + k:=7-((3+dvi_offset+dvi_ptr) mod 4); {the number of 223's} +endif ('IPC') +ifndef ('IPC') + k:=4+((dvi_buf_size-dvi_ptr) mod 4); {the number of 223's} +endifn ('IPC') +@z + +@x [32.642] l.12773 - use print_file_name + print_nl("Output written on "); slow_print(output_file_name); +@y + print_nl("Output written on "); print_file_name(0, output_file_name, 0); +@z + +@x [38.859] l.16855 - Fix a casting/expression evaluation problem. +if abs(fit_class-fitness(r))>1 then d:=d+adj_demerits; +@y +if abs(intcast(fit_class)-intcast(fitness(r)))>1 then d:=d+adj_demerits; +@z + +@x [39.875] l.17170 - Another casting problem. + begin line_diff:=line_number(r)-best_line; +@y + begin line_diff:=intcast(line_number(r))-intcast(best_line); +@z + +@x [42.920] l.18068 - bigtrie: allow larger hyphenation tries. +@!trie_pointer=0..trie_size; {an index into |trie|} +@y +@!trie_pointer=0..ssup_trie_size; {an index into |trie|} +@z + +@x [42.921] l.18075 - bigtrie: allow larger hyphenation tries. +@!trie:array[trie_pointer] of two_halves; {|trie_link|, |trie_char|, |trie_op|} +@y +{We will dynamically allocate this arrays.} +@!trie:^two_halves; {|trie_link|} +@z + +%%%%%%%% dynamic hyph_size +@x 18126 m.925 +different from $\alpha$, we can conclude that $\alpha$ is not in the table. +@y 18126 +different from $\alpha$, we can conclude that $\alpha$ is not in the table. +This is a clever scheme which saves the need for a hash link array. +However, it is difficult to increase the size of the hyphen exception +arrays. To make this easier, the ordered hash has been replaced by +a simple hash, using an additional array |hyph_link|. The value +|0| in |hyph_link[k]| means that there are no more entries corresponding +to the specific hash chain. When |hyph_link[k]>0|, the next entry in +the hash chain is |hyph_link[k]-1|. This value is used because the +arrays start at |0|. +@z + +%%%%%%%% dynamic hyph_size +@x 18134 m.925 +@!hyph_pointer=0..hyph_size; {an index into the ordered hash table} +@y 18134 +@!hyph_pointer=0..ssup_hyph_size; {index into hyphen exceptions hash table; + enlarging this requires changing (un)dump code} +@z + +%%%%%%%% dynamic hyph_size +@x 18137 m.926 +@!hyph_word:array[hyph_pointer] of str_number; {exception words} +@!hyph_list:array[hyph_pointer] of pointer; {lists of hyphen positions} +@!hyph_count:hyph_pointer; {the number of words in the exception dictionary} +@y 18139 +@!hyph_word: ^str_number; {exception words} +@!hyph_list: ^pointer; {list of hyphen positions} +@!hyph_link: ^hyph_pointer; {link array for hyphen exceptions hash table} +@!hyph_count:integer; {the number of words in the exception dictionary} +@!hyph_next:integer; {next free slot in hyphen exceptions hash table} +@z + +%%%%%%%% dynamic hyph_size +@x 18145 m.928 +for z:=0 to hyph_size do + begin hyph_word[z]:=0; hyph_list[z]:=null; + end; +hyph_count:=0; +@y 18148 +for z:=0 to hyph_size do + begin hyph_word[z]:=0; hyph_list[z]:=null; hyph_link[z]:=0; + end; +hyph_count:=0; +hyph_next:=hyph_prime+1; if hyph_next>hyph_size then hyph_next:=hyph_prime; +@z + +%%%%%%%% dynamic hyph_size +@x 18163 m.930 +h:=hc[1]; incr(hn); hc[hn]:=cur_lang; +for j:=2 to hn do h:=(h+h+hc[j]) mod hyph_size; +loop@+ begin @; + if h>0 then decr(h)@+else h:=hyph_size; + end; +not_found: decr(hn) +@y 18170 +h:=hc[1]; incr(hn); hc[hn]:=cur_lang; +for j:=2 to hn do h:=(h+h+hc[j]) mod hyph_prime; +loop@+ begin @; + h:=hyph_link[h]; if h=0 then goto not_found; + decr(h); + end; +not_found: decr(hn) +@z + +%%%%%%%% dynamic hyph_size +@x 18172 m.931 +@ @= +k:=hyph_word[h]; if k=0 then goto not_found; +if length(k)hc[j] then goto done; + incr(j); incr(u); + until j>hn; + @; + decr(hn); goto found; + end; +done: +@y 18184 +@ @= +{This is now a simple hash list, not an ordered one, so +the module title is no longer descriptive.} +k:=hyph_word[h]; if k=0 then goto not_found; +if length(k)=hn then + begin j:=1; u:=str_start(k); + repeat + if so(str_pool[u])<>hc[j] then goto done; + incr(j); incr(u); + until j>hn; + @; + decr(hn); goto found; + end; +done: +@z + +% The GNU C compiler complains of unused variables. +@x +@!s,@!t:str_number; {strings being compared or stored} +@y +@!s:str_number; {strings being compared or stored} +@z + +%%%%%%%% dynamic hyph_size +@x 18274 m.939 + begin h:=(h+h+hc[j]) mod hyph_size; +@y 18274 + begin h:=(h+h+hc[j]) mod hyph_prime; +@z + +%%%%%%%% dynamic hyph_size +@x 18281 m.940 +@ @= +if hyph_count=hyph_size then overflow("exception dictionary",hyph_size); +@:TeX capacity exceeded exception dictionary}{\quad exception dictionary@> +incr(hyph_count); +while hyph_word[h]<>0 do + begin @; + if h>0 then decr(h)@+else h:=hyph_size; + end; +hyph_word[h]:=s; hyph_list[h]:=p +@y 18290 +@ @= + if hyph_next <= hyph_prime then + while (hyph_next>0) and (hyph_word[hyph_next-1]>0) do decr(hyph_next); +if (hyph_count=hyph_size)or(hyph_next=0) then + overflow("exception dictionary",hyph_size); +@:TeX capacity exceeded exception dictionary}{\quad exception dictionary@> +incr(hyph_count); +while hyph_word[h]<>0 do + begin @; + if hyph_link[h]=0 then + begin + hyph_link[h]:=hyph_next; + if hyph_next >= hyph_size then hyph_next:=hyph_prime; + if hyph_next > hyph_prime then incr(hyph_next); + end; + h:=hyph_link[h]-1; + end; + +found: hyph_word[h]:=s; hyph_list[h]:=p +@z + +%%%%%%%% dynamic hyph_size +@x 18292 m.941 +@ @= +k:=hyph_word[h]; +if length(k)length(s) then goto not_found; +u:=str_start(k); v:=str_start(s); +repeat if str_pool[u]str_pool[v] then goto not_found; +incr(u); incr(v); +until u=str_start(k+1); +found:q:=hyph_list[h]; hyph_list[h]:=p; p:=q;@/ +t:=hyph_word[h]; hyph_word[h]:=s; s:=t; +not_found: +@y 18303 +@ @= +{This is now a simple hash list, not an ordered one, so +the module title is no longer descriptive.} +k:=hyph_word[h]; +if length(k)<>length(s) then goto not_found; +u:=str_start(k); v:=str_start(s); +repeat if str_pool[u]<>str_pool[v] then goto not_found; +incr(u); incr(v); +until u=str_start(k+1); +{repeat hyphenation exception; flushing old data} +flush_string; s:=hyph_word[h]; {avoid |slow_make_string|!} +decr(hyph_count); +{ We could also |flush_list(hyph_list[h]);|, but it interferes + with \.{trip.log}. } +goto found; +not_found: +@z + +@x [43.943] l.18346 - web2c can't parse negative lower bounds in arrays. Sorry. +@!init@! trie_op_hash:array[-trie_op_size..trie_op_size] of 0..trie_op_size; +@y +@!init@! trie_op_hash:array[neg_trie_op_size..trie_op_size] of 0..trie_op_size; +@z + +@x [43.944] l.18365 - web2c can't parse negative lower bounds in arrays. Sorry +var h:-trie_op_size..trie_op_size; {trial hash location} +@y +var h:neg_trie_op_size..trie_op_size; {trial hash location} +@z + +@x [43.944] l.18370 - Another casting problem, and use |neg_trie_op_size|. +begin h:=abs(n+313*d+361*v+1009*cur_lang) mod (trie_op_size+trie_op_size) + - trie_op_size; +@y +begin h:=abs(intcast(n)+313*intcast(d)+361*intcast(v)+1009*intcast(cur_lang)) + mod (trie_op_size - neg_trie_op_size) + + neg_trie_op_size; +@z + +@x [43.947] l.18438 - Dynamically allocate arrays, and a casting problem. +@!init @!trie_c:packed array[trie_pointer] of ASCII_code; + {characters to match} +@t\hskip10pt@>@!trie_o:packed array[trie_pointer] of quarterword; + {operations to perform} +@t\hskip10pt@>@!trie_l:packed array[trie_pointer] of trie_pointer; + {left subtrie links} +@t\hskip10pt@>@!trie_r:packed array[trie_pointer] of trie_pointer; + {right subtrie links} +@t\hskip10pt@>@!trie_ptr:trie_pointer; {the number of nodes in the trie} +@t\hskip10pt@>@!trie_hash:packed array[trie_pointer] of trie_pointer; + {used to identify equivalent subtries} +tini +@y +@!init @!trie_c:^ASCII_code; + {characters to match} +@t\hskip10pt@>@!trie_o:^quarterword; + {operations to perform} +@t\hskip10pt@>@!trie_l:^trie_pointer; + {left subtrie links} +@t\hskip10pt@>@!trie_r:^trie_pointer; + {right subtrie links} +@t\hskip10pt@>@!trie_ptr:trie_pointer; {the number of nodes in the trie} +@t\hskip10pt@>@!trie_hash:^trie_pointer; + {used to identify equivalent subtries} +tini +@z + +@x [43.948] l.18471 - Another casting problem. +begin h:=abs(trie_c[p]+1009*trie_o[p]+@| + 2718*trie_l[p]+3142*trie_r[p]) mod trie_size; +@y +begin h:=abs(intcast(trie_c[p])+1009*intcast(trie_o[p])+@| + 2718*intcast(trie_l[p])+3142*intcast(trie_r[p])) mod trie_size; +@z + +@x [43.590] l.18524 - Dynamically allocate & larger tries. +@!init@!trie_taken:packed array[1..trie_size] of boolean; + {does a family start here?} +@t\hskip10pt@>@!trie_min:array[ASCII_code] of trie_pointer; + {the first possible slot for each character} +@t\hskip10pt@>@!trie_max:trie_pointer; {largest location used in |trie|} +@t\hskip10pt@>@!trie_not_ready:boolean; {is the trie still in linked form?} +tini +@y +@!init@!trie_taken: ^boolean; + {does a family start here?} +@t\hskip10pt@>@!trie_min:^trie_pointer; + {the first possible slot for each character} +@t\hskip10pt@>@!trie_max:trie_pointer; {largest location used in |trie|} +@t\hskip10pt@>@!trie_not_ready:boolean; {is the trie still in linked form?} +tini +@z + +@x [43.951] l.18539 - Dynamically allocate. +trie_not_ready:=true; trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0; +@y +trie_not_ready:=true; +@z + +%% +%% We can rewrite the original code after "main_loop_move+2" upto the +%% "tail_append(lig_stack)" in module 1036 as +%% +% +% main_loop_move+2: +% if font_bc[main_f]<=cur_chr then +% if cur_chr<=font_ec[main_f] then +% begin main_i:=char_info(main_f)(cur_l); +% if char_exists(main_i) goto main_loop_move+3; +% end; +% char_warning(main_f,cur_chr); free_avail(lig_stack); goto big_switch; +% main_loop_move+3: +% tail_append(lig_stack) {|main_loop_lookahead| is next} +% + +@x [49.1252] l.23230 - INI = VIR, so have to do runtime test. +hyph_data: if cur_chr=1 then + begin @!init new_patterns; goto done;@;@+tini@/ +@y 23215 +hyph_data: if cur_chr=1 then + begin @!init if ini_version then + begin new_patterns; goto done; end; @;@+tini@/ +@z + +@x +@!flushable_string:str_number; {string not yet referenced} +@y +@z + +% undo Knuth's change because +% a) the string is already replaced in |scan_file_name| and therefore +% b) the wrong string will get flushed!!! +% +@x [49.1260] l.23331 new_font: string recycling -- already done +flushable_string:=str_ptr-1; +@y +@z + +% If you don't want to remove code with the following two changes, +% please replace the former change by +% +% @x +% flushable_string:=str_ptr-1; +% @y +% if cur_name=str_ptr-1 then +% flushable_string:=str_ptr-1 +% else +% flushable_string:=str_ptr; {number of a non-existing} +% @z +% +% otherwise the wrong string will get removed by |flush_string|!! +% +@x [49.1260] l.23334 new_font: string recycling -- already done + begin if cur_name=flushable_string then + begin flush_string; cur_name:=font_name(f); + end; + if s>0 then +@y + begin if s>0 then +@z + +@x [49.1265] if batchmode, mktex... scripts should be silent. +interaction:=cur_chr; +@y +interaction:=cur_chr; +if interaction = batch_mode +then kpse_make_tex_discard_errors := 1 +else kpse_make_tex_discard_errors := 0; +@z + +@x [49.1275] l.23441 - Same stuff as for \input, this time for \openin. + if cur_ext="" then cur_ext:=".tex"; + pack_cur_name; + if a_open_in(read_file[n]) then read_open[n]:=just_open; +@y + pack_cur_name; + tex_input_type:=0; {Tell |open_input| we are \.{\\openin}.} + if open_in_name_ok(name_of_file+1) + and a_open_in(read_file[n], kpse_tex_format) then + read_open[n]:=just_open; +@z + +@x [50.1301] l.23679 - INI = VIR, so runtime test. +format_ident:=" (INIALEPH)"; +@y +if ini_version then format_ident:=" (INIALEPH)"; +@z + +% The GNU C compiler complains of unused variables. +% Add format_engine. +@x [50.1302] l.23690 - Eliminate now-unused variable `w' in `store_fmt_file'. +var j,@!k,@!l:integer; {all-purpose indices} +@!p,@!q: pointer; {all-purpose pointers} +@!x: integer; {something to dump} +@!w: four_quarters; {four ASCII codes} +@y +var j,@!k:integer; {all-purpose indices} +@!p,@!q: pointer; {all-purpose pointers} +@!x: integer; {something to dump} +@!format_engine: ^char; +@z + +@x [50.1303] l.23722 - Ditto, for `load_fmt_file'. +@!w: four_quarters; {four ASCII codes} +@y +@!format_engine: ^char; +@z + +@x [50.1305] l.23751 - Do dumping and undumping of fmt files in C. +@d dump_wd(#)==begin fmt_file^:=#; put(fmt_file);@+end +@d dump_int(#)==begin fmt_file^.int:=#; put(fmt_file);@+end +@d dump_hh(#)==begin fmt_file^.hh:=#; put(fmt_file);@+end +@d dump_qqqq(#)==begin fmt_file^.qqqq:=#; put(fmt_file);@+end +@y +@z +@x [1306] +@d undump_wd(#)==begin get(fmt_file); #:=fmt_file^;@+end +@d undump_int(#)==begin get(fmt_file); #:=fmt_file^.int;@+end +@d undump_hh(#)==begin get(fmt_file); #:=fmt_file^.hh;@+end +@d undump_qqqq(#)==begin get(fmt_file); #:=fmt_file^.qqqq;@+end +@y +@z +@x [still 1306] debug format file +@d undump_size_end_end(#)==too_small(#)@+else undump_end_end +@y +@d format_debug_end(#)== + write_ln (stderr, ' = ', #); + end; +@d format_debug(#)== + if debug_format_file then begin + write (stderr, 'fmtdebug:', #); + format_debug_end +@d undump_size_end_end(#)== + too_small(#)@+else format_debug (#)(x); undump_end_end +@z + +@x [50,1307] l.23779 - texarray +dump_int(@$);@/ +@y +dump_int(@"57325458); {Web2C \TeX's magic constant: "W2TX"} +{Align engine to 4 bytes with one or more trailing NUL} +x:=strlen(engine_name); +format_engine:=xmalloc_array(char,x+4); +strcpy(format_engine, engine_name); +for k:=x to x+3 do format_engine[k]:=0; +x:=x+4-(x mod 4); +dump_int(x);dump_things(format_engine[0], x); +libc_free(format_engine);@/ +dump_int(@$);@/ +dump_int(max_halfword);@/ +@z + +%%%%%%%% dynamic hyph_size +@x 23784 m.1307 +dump_int(hyph_size) +@y 23784 +dump_int(hyph_prime) +@z + +@x [50.1308] l.23793 - texarray +x:=fmt_file^.int; +if x<>@$ then goto bad_fmt; {check that strings are the same} +@/@@/ +undump_int(x); +if x<>mem_bot then goto bad_fmt; +undump_int(x); +if x<>mem_top then goto bad_fmt; +@y +@+init +if ini_version then + begin libc_free(str_pool); libc_free(str_start_ar); libc_free(yzmem); + end; +@+tini +undump_int(x); +format_debug('format magic number')(x); +if x<>@"57325458 then goto bad_fmt; {not a format file} +undump_int(x); +format_debug('engine name size')(x); +if (x<0) or (x>256) then goto bad_fmt; {corrupted format file} +format_engine:=xmalloc_array(char, x); +undump_things(format_engine[0], x); +format_engine[x-1]:=0; {force string termination, just in case} +if strcmp(engine_name, format_engine) then + begin wake_up_terminal; + wterm_ln('---! ', stringcast(name_of_file+1), ' was written by ', format_engine); + libc_free(format_engine); + goto bad_fmt; +end; +libc_free(format_engine); +undump_int(x); +format_debug('string pool checksum')(x); +if x<>@$ then begin {check that strings are the same} + wake_up_terminal; + wterm_ln('---! ', stringcast(name_of_file+1), ' doesn''t match ', pool_name); + goto bad_fmt; +end; +undump_int(x); +if x<>max_halfword then goto bad_fmt; {check |max_halfword|} +@/@@/ + +undump_int(x); format_debug ('mem_bot')(x); +if x<>mem_bot then goto bad_fmt; +undump_int(mem_top); format_debug ('mem_top')(mem_top); +if mem_bot+1100>mem_top then goto bad_fmt; + + +head:=contrib_head; tail:=contrib_head; + page_tail:=page_head; {page initialization} + +mem_min := mem_bot - extra_mem_bot; +mem_max := mem_top + extra_mem_top; + +yzmem:=xmalloc_array (memory_word, mem_max - mem_min + 1); +zmem := yzmem - mem_min; {this pointer arithmetic fails with some compilers} +mem := zmem; +@z + +%%%%%%%% dynamic hyph_size +@x 23804 m.1308 +if x<>hyph_size then goto bad_fmt +@y 23804 +if x<>hyph_prime then goto bad_fmt +@z + +% [1309] Make dumping/undumping more efficient by doing whole arrays at +% a time, via fread/fwrite in texmfmp.c. +@x [50.1309] l.23814 - Make dumping/undumping more efficient. +for k:=too_big_char to str_ptr do dump_int(str_start(k)); +k:=0; +while k+40 then + begin dump_int(k); dump_int(hyph_word[k]); dump_int(hyph_list[k]); + end; +@y 24061 +dump_int(hyph_count); +if hyph_next <= hyph_prime then hyph_next:=hyph_size; +dump_int(hyph_next);{minumum value of |hyphen_size| needed} +for k:=0 to hyph_size do if hyph_word[k]<>0 then + begin dump_int(k+65536*hyph_link[k]); + {assumes number of hyphen exceptions does not exceed 65535} + dump_int(hyph_word[k]); dump_int(hyph_list[k]); + end; +@z + +@x [50.1324] l.24066 - Make dumping/undumping more efficient - trie +for k:=0 to trie_max do dump_hh(trie[k]); +dump_int(max_hyph_char); +dump_int(trie_op_ptr); +for k:=1 to trie_op_ptr do + begin dump_int(hyf_distance[k]); + dump_int(hyf_num[k]); + dump_int(hyf_next[k]); + end; +@y +dump_things(trie[0],trie_max+1); +dump_int(max_hyph_char); +dump_int(trie_op_ptr); +dump_things(hyf_distance[1], trie_op_ptr); +dump_things(hyf_num[1], trie_op_ptr); +dump_things(hyf_next[1], trie_op_ptr); +@z + +@x [50.1325] l.24086 - Make dumping/undumping more efficient - trie +@= +@y +{This is only used for the hyphenation tries below, and the size is + always |j+1|.} +@d xmalloc_and_undump(#) == + if not # then #:=xmalloc_array(two_halves, j+1); + undump_things(#[0], j+1); + +@= +@z + +%%%%%%%% dynamic hyph_size +@x 24087 m.1325 +undump(0)(hyph_size)(hyph_count); +for k:=1 to hyph_count do + begin undump(0)(hyph_size)(j); + undump(0)(str_ptr)(hyph_word[j]); + undump(min_halfword)(max_halfword)(hyph_list[j]); + end; +@y 24092 +undump_size(0)(hyph_size)('hyph_size')(hyph_count); +undump_size(hyph_prime)(hyph_size)('hyph_size')(hyph_next); +j:=0; +for k:=1 to hyph_count do + begin undump_int(j); if j<0 then goto bad_fmt; + if j>65535 then + begin hyph_next:= j div 65536; j:=j - hyph_next * 65536; end + else hyph_next:=0; + if (j>=hyph_size)or(hyph_next>hyph_size) then goto bad_fmt; + hyph_link[j]:=hyph_next; + undump(0)(str_ptr)(hyph_word[j]); + undump(min_halfword)(max_halfword)(hyph_list[j]); + end; + {|j| is now the largest occupied location in |hyph_word|} + incr(j); + if j= hyph_size then hyph_next:=hyph_prime else + if hyph_next >= hyph_prime then incr(hyph_next); +@z + + +@x [50.1325] l.24094 - Make dumping/undumping more efficient - trie +for k:=0 to j do undump_hh(trie[k]); +undump_int(max_hyph_char); +undump_size(0)(trie_op_size)('trie op size')(j); @+init trie_op_ptr:=j;@+tini +for k:=1 to j do + begin undump(0)(63)(hyf_distance[k]); {a |small_number|} + undump(0)(63)(hyf_num[k]); + undump(min_quarterword)(max_quarterword)(hyf_next[k]); + end; +@y +{The first array has not been allocated yet unless we're \.{INITEX}; + we do that precisely so we don't allocate more space than necessary.} +xmalloc_and_undump(trie); +undump_int(max_hyph_char); +undump_size(0)(trie_op_size)('trie op size')(j); @+init trie_op_ptr:=j;@+tini +{I'm not sure we have such a strict limitation (64) on these values, so + let's leave them unchecked.} +undump_things(hyf_distance[1], j); +undump_things(hyf_num[1], j); +undump_upper_check_things(max_quarterword, hyf_next[1], j); +@z + +@x [50.1327] l.24117 - Allow command line to override dumped value. +undump(batch_mode)(error_stop_mode)(interaction); +@y +undump(batch_mode)(error_stop_mode)(interaction); +if interaction_option<>unspecified_mode then interaction:=interaction_option; +@z + +% [50.1327] As with TFM files, `eof' here means `have we previously +% encountered the end-of-file', not `are we at the end of the file'. +@x [50.1327] l.24120 - dumping/undumping, replace eof() by feof() +if (x<>69069)or eof(fmt_file) then goto bad_fmt +@y +if (x<>69069)or feof(fmt_file) then goto bad_fmt +@z + +@x [50.1328] l.24124 - Eliminate probably wrong word `preloaded' from format_idents. +print(" (preloaded format="); print(job_name); print_char(" "); +@y +print(" (format="); print(job_name); print_char(" "); +@z + +@x [51.1332] l.24203 - make the main program a procedure, for eqtb hack. +@p begin @!{|start_here|} +@y +@d const_chk(#)==begin if # < inf@&# then # := inf@&# else + if # > sup@&# then # := sup@&# end + +{|setup_bound_var| stuff duplicated in \.{mf.ch}.} +@d setup_bound_var(#)==bound_default:=#; setup_bound_var_end +@d setup_bound_var_end(#)==bound_name:=#; setup_bound_var_end_end +@d setup_bound_var_end_end(#)== + setup_bound_variable(addressof(#), bound_name, bound_default); + +@p procedure main_body; +begin @!{|start_here|} + +{Always start the file recorder?} + {|recorder_enabled:=true;|} + +{Bounds that may be set from the configuration file. We want the user to + be able to specify the names with underscores, but \.{TANGLE} removes + underscores, so we're stuck giving the names twice, once as a string, + once as the identifier. How ugly.} + setup_bound_var (1000000)('main_memory')(main_memory); + {|memory_word|s for |mem| in \.{INITEX}} + setup_bound_var (0)('extra_mem_top')(extra_mem_top); + {increase high mem in \.{VIRTEX}} + setup_bound_var (0)('extra_mem_bot')(extra_mem_bot); + {increase low mem in \.{VIRTEX}} + setup_bound_var (300000)('pool_size')(pool_size); + setup_bound_var (200000)('string_vacancies')(string_vacancies); + setup_bound_var (5000)('pool_free')(pool_free); {min pool avail after fmt} + setup_bound_var (100000)('max_strings')(max_strings); + setup_bound_var (100)('strings_free')(strings_free); + setup_bound_var (20000)('trie_size')(trie_size); + {if |ssup_trie_size| increases, recompile} + setup_bound_var (659)('hyph_size')(hyph_size); + setup_bound_var (20000)('buf_size')(buf_size); + setup_bound_var (50)('nest_size')(nest_size); + setup_bound_var (15)('max_in_open')(max_in_open); + setup_bound_var (60)('param_size')(param_size); + setup_bound_var (4000)('save_size')(save_size); + setup_bound_var (300)('stack_size')(stack_size); + setup_bound_var (16384)('dvi_buf_size')(dvi_buf_size); + setup_bound_var (79)('error_line')(error_line); + setup_bound_var (50)('half_error_line')(half_error_line); + setup_bound_var (79)('max_print_line')(max_print_line); + const_chk (main_memory); +@+init + if ini_version then begin + extra_mem_top := 0; + extra_mem_bot := 0; + end; +@+tini + if extra_mem_bot>sup_main_memory then extra_mem_bot:=sup_main_memory; + if extra_mem_top>sup_main_memory then extra_mem_top:=sup_main_memory; + {|mem_top| is an index, |main_memory| a size} + mem_top := mem_bot + main_memory -1; + mem_min := mem_bot; + mem_max := mem_top; + + {Check other constants against their sup and inf.} + const_chk (trie_size); + const_chk (hyph_size); + const_chk (buf_size); + const_chk (nest_size); + const_chk (max_in_open); + const_chk (param_size); + const_chk (save_size); + const_chk (stack_size); + const_chk (dvi_buf_size); + const_chk (pool_size); + const_chk (string_vacancies); + const_chk (pool_free); + const_chk (max_strings); + const_chk (strings_free); + if error_line > ssup_error_line then error_line := ssup_error_line; + + {array memory allocation} + buffer:=xmalloc_array (ASCII_code, buf_size); + nest:=xmalloc_array (list_state_record, nest_size); + save_stack:=xmalloc_array (memory_word, save_size); + input_stack:=xmalloc_array (in_state_record, stack_size); + input_file:=xmalloc_array (alpha_file, max_in_open); + input_file_mode:=xmalloc_array (halfword, max_in_open); + input_file_translation:=xmalloc_array (halfword, max_in_open); + line_stack:=xmalloc_array (integer, max_in_open); + param_stack:=xmalloc_array (halfword, param_size); + dvi_buf:=xmalloc_array (real_eight_bits, dvi_buf_size); + hyph_word:=xmalloc_array (str_number, hyph_size); + hyph_list:=xmalloc_array (halfword, hyph_size); + hyph_link:=xmalloc_array (hyph_pointer, hyph_size); +@+init +if ini_version then begin + yzmem:=xmalloc_array (memory_word, mem_top - mem_bot + 1); + zmem := yzmem - mem_bot; {Some compilers require |mem_bot=0|} + + str_start_ar:=xmalloc_array (pool_pointer, max_strings-biggest_char); + str_pool:=xmalloc_array (packed_ASCII_code, pool_size); +end; +@+tini +@z + +@x [51.1332] l.24215 - INI = VIR, so pool init needs runtime test +@!init if not get_strings_started then goto final_end; +init_prim; {call |primitive| for each primitive} +init_str_ptr:=str_ptr; init_pool_ptr:=pool_ptr; fix_date_and_time; +tini@/ +@y +@+init if ini_version then + begin if not get_strings_started then goto final_end; + init_prim; {call |primitive| for each primitive} + init_str_ptr:=str_ptr; init_pool_ptr:=pool_ptr; fix_date_and_time; + end; +@+tini@/ +@z + +@x [51.1332] l.24225 - main +end_of_TEX: close_files_and_terminate; +final_end: ready_already:=0; +end. +@y +close_files_and_terminate; +final_end: do_final_end; +end {|main_body|}; +@z + +@x [51.1333] l.24254 - Print new line before termination; switch to editor if necessary. + slow_print(log_name); print_char("."); + end; + end; +@y + print_file_name(0, log_name, 0); print_char("."); + end; + end; +print_ln; +if (edit_name_start<>0) and (interaction>batch_mode) then + call_edit(str_pool,edit_name_start,edit_name_length,edit_line); +@z + +@x [51.1334] l. - Remove reference to fontmemsize + wlog_ln(', out of ',font_mem_size:1,' for ',font_max-font_base:1);@/ +@y +@z + +@x [51.1335] l.24335 - Only do dump if ini. + begin @!init for c:=top_mark_code to split_bot_mark_code do + if cur_mark[c]<>null then delete_token_ref(cur_mark[c]); + if sa_mark<>null then + if do_marks(destroy_marks,0,sa_mark) then sa_mark:=null; + for c:=last_box_code to vsplit_code do flush_node_list(disc_ptr[c]); + if last_glue<>max_halfword then delete_glue_ref(last_glue); + store_fmt_file; return;@+tini@/ +@y + begin @!init if ini_version then + begin for c:=top_mark_code to split_bot_mark_code do + if cur_mark[c]<>null then delete_token_ref(cur_mark[c]); + if sa_mark<>null then + if do_marks(destroy_marks,0,sa_mark) then sa_mark:=null; + for c:=last_box_code to vsplit_code do flush_node_list(disc_ptr[c]); + store_fmt_file; return; + end;@+tini@/ +@z + +@x [51.1337] l.24361 - Handle %&format in all cases. +if (format_ident=0)or(buffer[loc]="&") then +@y +if (format_ident=0)or(buffer[loc]="&")or dump_line then +@z + +@x [51.1337] l.24371 - Allocate hyphenation tries. +fix_date_and_time;@/ +@y +fix_date_and_time;@/ + +@!init +if trie_not_ready then begin {initex without format loaded} + trie:=xmalloc_array (two_halves, trie_size); + + trie_c:=xmalloc_array (ASCII_code, trie_size); + trie_o:=xmalloc_array (quarterword, trie_size); + trie_l:=xmalloc_array (trie_pointer, trie_size); + trie_r:=xmalloc_array (trie_pointer, trie_size); + trie_hash:=xmalloc_array (trie_pointer, trie_size); + trie_taken:=xmalloc_array (boolean, trie_size); + trie_min:=xmalloc_array (trie_pointer, too_big_char); + + trie_root:=0; trie_c[0]:=si(0); trie_ptr:=0; + end; + tini@/ + +@z + +% [52.1338] Core-dump in debugging mode on 0 input. Under Unix, it's +% not possible to portably switch into the debugger while a program is +% running. The best approximation is to do a core dump, then run the +% debugger on it later. +@x [52.1338] l.24411 - Core-dump in debugging mode on 0 input. + begin goto breakpoint;@\ {go to every label at least once} + breakpoint: m:=0; @{'BREAKPOINT'@}@\ + end +@y + dump_core {do something to cause a core dump} +@z + +% The GNU C compiler complains of unused variables. +@x +procedure do_extension; +var i,@!j,@!k:integer; {all-purpose integers} +@!p,@!q,@!r:pointer; {all-purpose pointers} +@y +procedure do_extension; +var @!k:integer; {all-purpose integers} +@!p:pointer; {all-purpose pointers} +@z + +% [53.1350] (new_write_whatsit) Allow 18 as a \write stream. We never +% refer to an actual file, though, so we don't need to change the +% write_file or write_open arrays. We provide for disabling this at +% runtime, for paranoids. +@x [53.1350] l.24609 - system: Allow 18 as a \write stream. + else if cur_val>15 then cur_val:=16; +@y + else if (cur_val>15) and (cur_val <> 18) then cur_val:=16; +@z + +@x [53.1370] l.24770 - system: (write_out) \write18{foo} => system(foo). +begin @ system(foo). +if write_open[j] then selector:=j +@y +if j=18 then selector := new_string +else if write_open[j] then selector:=j +@z + +% Then call system(3) on that string. +@x [53.1370] l.24779 - system: (write_out) \write18{foo} => system(foo). +flush_list(def_ref); selector:=old_setting; +@y +flush_list(def_ref); +if j=18 then + begin if (tracing_online<=0) then + selector:=log_only {Show what we're doing in the log file.} + else selector:=term_and_log; {Show what we're doing.} + {If the log file isn't open yet, we can only send output to the terminal. + Calling |open_log_file| from here seems to result in bad data in the log.} + if not log_opened then selector:=term_only; + print_nl("runsystem("); + for d:=0 to cur_length-1 do + begin {|print| gives up if passed |str_ptr|, so do it by hand.} + print(so(str_pool[str_start(str_ptr)+d])); {N.B.: not |print_char|} + end; + print(")..."); + if shellenabledp then begin + str_room(1); append_char(0); {Append a null byte to the expansion.} + clobbered:=false; + for d:=0 to cur_length-1 do {Convert to external character set.} + begin + str_pool[str_start(str_ptr)+d]:=xchr[str_pool[str_start(str_ptr)+d]]; + if (str_pool[str_start(str_ptr)+d]=null_code) + and (d + +@= +@!edit_name_start: pool_pointer; {where the filename to switch to starts} +@!edit_name_length,@!edit_line: integer; {what line to start editing at} +@!ipc_on: cinttype; {level of IPC action, 0 for none [default]} +@!stop_at_space: boolean; {whether |more_name| returns false for space} + +@ The |edit_name_start| will be set to point into |str_pool| somewhere after +its beginning if \TeX\ is supposed to switch to an editor on exit. + +@= +edit_name_start:=0; +stop_at_space:=true; + +@ These are used when we regenerate the representation of the first 256 +strings. + +@ = +@!save_str_ptr: str_number; +@!save_pool_ptr: pool_pointer; +@!shellenabledp: cinttype; +@!restrictedshell: cinttype; +@!output_comment: ^char; +@!k,l: 0..65535; {used by `Make the first 256 strings', etc.} + +@ When debugging a macro package, it can be useful to see the exact +control sequence names in the format file. For example, if ten new +csnames appear, it's nice to know what they are, to help pinpoint where +they came from. (This isn't a truly ``basic'' printing procedure, but +that's a convenient module in which to put it.) + +@ = +procedure print_csnames (hstart:integer; hfinish:integer); +var c,h:integer; +begin + write_ln(stderr, 'fmtdebug:csnames from ', hstart, ' to ', hfinish, ':'); + for h := hstart to hfinish do begin + if newtext(h) > 0 then begin {if have anything at this position} + for c := str_start(newtext(h)) to str_start(newtext(h) + 1) - 1 + do begin + put_byte(str_pool[c], stderr); {print the characters} + end; + write_ln(stderr, '|'); + end; + end; +end; + +@ Are we printing extra info as we read the format file? + +@ = +@!debug_format_file: boolean; + + +@ A helper for printing file:line:error style messages. Look for a +filename in |full_source_filename_stack|, and if we fail to find +one fall back on the non-file:line:error style. + +@= +procedure print_file_line; +var level: 0..max_in_open; +begin + level:=in_open; + while (level>0) and (full_source_filename_stack[level]=0) do + decr(level); + if level=0 then + print_nl("! ") + else begin + print_nl (""); print (full_source_filename_stack[level]); print (":"); + if level=in_open then print_int (line) + else print_int (line_stack[index+1-(in_open-level)]); + print (": "); + end; +end; + +@ To be able to determine whether \.{\\write18} is enabled from within +\TeX\ we also implement \.{\\eof18}. We sort of cheat by having an +additional route |scan_four_bit_int_or_18| which is the same as +|scan_four_bit_int| except it also accepts the value 18. + +@= +procedure scan_four_bit_int_or_18; +begin scan_int; +if (cur_val<0)or((cur_val>15)and(cur_val<>18)) then + begin print_err("Bad number"); +@.Bad number@> + help2("Since I expected to read a number between 0 and 15,")@/ + ("I changed this one to zero."); int_error(cur_val); cur_val:=0; + end; +end; + +@* \[54/web2c-string] The string recycling routines. \TeX{} uses 2 +upto 4 {\it new\/} strings when scanning a filename in an \.{\\input}, +\.{\\openin}, or \.{\\openout} operation. These strings are normally +lost because the reference to them are not saved after finishing the +operation. |search_string| searches through the string pool for the +given string and returns either 0 or the found string number. + +@= +function search_string(@!search:str_number):str_number; +label found; +var result: str_number; +@!s: str_number; {running index} +@!len: integer; {length of searched string} +begin result:=0; len:=length(search); +if len=0 then {trivial case} + begin result:=""; goto found; + end +else begin s:=search-1; {start search with newest string below |s|; |search>1|!} + while s>65535 do {first 65536 strings depend on implementation!!} + begin if length(s)=len then + if str_eq_str(s,search) then + begin result:=s; goto found; + end; + decr(s); + end; + end; +found:search_string:=result; +end; + +@ The following routine is a variant of |make_string|. It searches +the whole string pool for a string equal to the string currently built +and returns a found string. Otherwise a new string is created and +returned. Be cautious, you can not apply |flush_string| to a replaced +string! + +@= +function slow_make_string : str_number; +label exit; +var s: str_number; {result of |search_string|} +@!t: str_number; {new string} +begin t:=make_string; s:=search_string(t); +if s>0 then + begin flush_string; slow_make_string:=s; return; + end; +slow_make_string:=t; +exit:end; + +@* \[54] System-dependent changes. +@z diff --git a/Build/source/texk/web2c/alephdir/comsrcspec.ch b/Build/source/texk/web2c/alephdir/comsrcspec.ch index 6569431c1c5..97583491f57 100644 --- a/Build/source/texk/web2c/alephdir/comsrcspec.ch +++ b/Build/source/texk/web2c/alephdir/comsrcspec.ch @@ -107,7 +107,7 @@ if shellenabledp then begin wlog('restricted '); end; wlog('\write18 enabled.') -end; + end; if src_specials_p then begin wlog_cr; wlog(' Source specials enabled.') diff --git a/Build/source/texk/web2c/alephdir/eo16bit-rc1.ch b/Build/source/texk/web2c/alephdir/eo16bit-rc1.ch deleted file mode 100644 index 87872aa2d3e..00000000000 --- a/Build/source/texk/web2c/alephdir/eo16bit-rc1.ch +++ /dev/null @@ -1,696 +0,0 @@ -% This is an \Aleph change file; it brings \eTeX register numbers -% from 32767 ($2^{15}-1$) to 65535 ($2^{16}-1), to bring it on line -% with \Omega -% Noticeably, since Omega has 16-bit quarterwords, it is possible -% to do so without changing much. -% Notice that we do this for marks register: everything else is -% brought to level with Omega in eomem.ch -%---------------------------------------- -@x Section 53a onwards l.4600 -@ @= -max_reg_num:=32767; -max_reg_help_line:="A register number must be between 0 and 32767."; -@y -@ @= -max_reg_num:=65535; -max_reg_help_line:="A register number must be between 0 and 65535."; -@z -%---------------------------------------- -@x l.4607 -@ There are seven almost identical doubly linked trees, one for the -sparse array of the up to 32512 additional registers of each kind and -one for the sparse array of the up to 32767 additional mark classes. -The root of each such tree, if it exists, is an index node containing 16 -pointers to subtrees for 4096 consecutive array elements. Similar index -nodes are the starting points for all nonempty subtrees for 4096, 256, -and 16 consecutive array elements. These four levels of index nodes are -followed by a fifth level with nodes for the individual array elements. - -Each index node is nine words long. The pointers to the 16 possible -subtrees or are kept in the |info| and |link| fields of the last eight -words. (It would be both elegant and efficient to declare them as -array, unfortunately \PASCAL\ doesn't allow this.) - -The fields in the first word of each index node and in the nodes for the -array elements are closely related. The |link| field points to the next -lower index node and the |sa_index| field contains four bits (one -hexadecimal digit) of the register number or mark class. For the lowest -index node the |link| field is |null| and the |sa_index| field indicates -the type of quantity (|int_avl|, |dimen_val|, |glue_val|, |mu_val|, -|box_val|, |tok_val|, or |mark_val|). The |sa_used| field in the index -nodes counts how many of the 16 pointers are non-null. -@y -@ There is one doubly linked tree, to handle the sparse array of the up -to 65535 additional mark classes. -The root of the tree, if it exists, is an index node containing 16 -pointers to subtrees for 4096 consecutive array elements. Similar index -nodes are the starting points for all nonempty subtrees for 4096, 256, -and 16 consecutive array elements. These four levels of index nodes are -followed by a fifth level with nodes for the individual array elements. - -Each index node is nine words long. The pointers to the 16 possible -subtrees are kept in the |info| and |link| fields of the last eight -words. (It would be both elegant and efficient to declare them as -array, unfortunately \PASCAL\ doesn't allow this.) - -The fields in the first word of each index node and in the nodes for the -array elements are closely related. The |link| field points to the next -lower index node and the |sa_index| field contains eight bits (two -hexadecimal digits) of the mark class. For the lowest -index node the |link| field is |null| and the |sa_index| field indicates -the type of quantity (which is always |mark_val|). The |sa_used| field in the -index nodes counts how many of the 16 pointers are non-null. -@z -%---------------------------------------- -@x l.4630 -The |sa_index| field in the nodes for array elements contains the four -bits plus 16 times the type. Therefore such a node represents a count -or dimen register if and only if |sa_index= -@!sa_root:array[int_val..mark_val] of pointer; {roots of sparse arrays} -@!cur_ptr:pointer; {value returned by |new_index| and |find_sa_element|} -@!sa_null:memory_word; {two |null| pointers} - -@ @= -sa_mark:=null; sa_null.hh.lh:=null; sa_null.hh.rh:=null; - -@ @= -for i:=int_val to tok_val do sa_root[i]:=null; -@y -@ The root of the tree for the additional mark classes is kept -in |sa_mark|. - -@= -@!sa_mark:pointer; {pointer to sparse array of marks} -@!cur_ptr:pointer; {value returned by |new_index| and |find_sa_element|} -@!sa_null:memory_word; {two |null| pointers} - -@ @= -sa_mark:=null; sa_null.hh.lh:=null; sa_null.hh.rh:=null; -@z -%---------------------------------------- -@x l.4681 -@ Given a type |t| and a sixteen-bit number |n|, the |find_sa_element| -procedure returns (in |cur_ptr|) a pointer to the node for the -corresponding array element, or |null| when no such element exists. The -third parameter |w| is set |true| if the element must exist, e.g., -because it is about to be modified. The procedure has two main -branches: one follows the existing tree structure, the other (only used -when |w| is |true|) creates the missing nodes. - -We use macros to extract the four-bit pieces from a sixteen-bit register -number or mark class and to fetch or store one of the 16 pointers from -an index node. - -@d if_cur_ptr_is_null_then_return_or_goto(#)== {some tree element is missing} - begin if cur_ptr=null then - if w then goto #@+else return; - end -@# -@d hex_dig1(#)==# div 4096 {the fourth lowest hexadecimal digit} -@d hex_dig2(#)==(# div 256) mod 16 {the third lowest hexadecimal digit} -@d hex_dig3(#)==(# div 16) mod 16 {the second lowest hexadecimal digit} -@d hex_dig4(#)==# mod 16 {the lowest hexadecimal digit} -@# -@d get_sa_ptr==if odd(i) then cur_ptr:=link(q+(i div 2)+1) - else cur_ptr:=info(q+(i div 2)+1) - {set |cur_ptr| to the pointer indexed by |i| from index node |q|} -@d put_sa_ptr(#)==if odd(i) then link(q+(i div 2)+1):=# - else info(q+(i div 2)+1):=# - {store the pointer indexed by |i| in index node |q|} -@d add_sa_ptr==begin put_sa_ptr(cur_ptr); incr(sa_used(q)); - end {add |cur_ptr| as the pointer indexed by |i| in index node |q|} -@d delete_sa_ptr==begin put_sa_ptr(null); decr(sa_used(q)); - end {delete the pointer indexed by |i| in index node |q|} - -@= -procedure find_sa_element(@!t:small_number;@!n:halfword;@!w:boolean); - {sets |cur_val| to sparse array element location or |null|} -label not_found,not_found1,not_found2,not_found3,not_found4,exit; -var q:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -begin cur_ptr:=sa_root[t]; -if_cur_ptr_is_null_then_return_or_goto(not_found);@/ -q:=cur_ptr; i:=hex_dig1(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found1);@/ -q:=cur_ptr; i:=hex_dig2(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found2);@/ -q:=cur_ptr; i:=hex_dig3(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found3);@/ -q:=cur_ptr; i:=hex_dig4(n); get_sa_ptr; -if (cur_ptr=null)and w then goto not_found4; -return; -not_found: new_index(t,null); {create first level index node} -sa_root[t]:=cur_ptr; q:=cur_ptr; i:=hex_dig1(n); -not_found1: new_index(i,q); {create second level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig2(n); -not_found2: new_index(i,q); {create third level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig3(n); -not_found3: new_index(i,q); {create fourth level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig4(n); -not_found4: @; -link(cur_ptr):=q; add_sa_ptr; -exit:end; - -@ The array elements for registers are subject to grouping and have an -|sa_lev| field (quite analogous to |eq_level|) instead of |sa_used|. -Since saved values as well as shorthand definitions (created by e.g., -\.{\\countdef}) refer to the location of the respective array element, -we need a reference count that is kept in the |sa_ref| field. An array -element can be deleted (together with all references to it) when its -|sa_ref| value is |null| and its value is the default value. -@^reference counts@> - -Skip, muskip, box, and token registers use two word nodes, their values -are stored in the |sa_ptr| field. -Count and dimen registers use three word nodes, their -values are stored in the |sa_int| resp.\ |sa_dim| field in the third -word; the |sa_ptr| field is used under the name |sa_num| to store -the register number. Mark classes use four word nodes. The last three -words contain the five types of current marks - -@d sa_lev==sa_used {grouping level for the current value} -@d pointer_node_size=2 {size of an element with a pointer value} -@d sa_type(#)==(sa_index(#) div 16) {type part of combined type/index} -@d sa_ref(#)==info(#+1) {reference count of a sparse array element} -@d sa_ptr(#)==link(#+1) {a pointer value} -@# -@d word_node_size=3 {size of an element with a word value} -@d sa_num==sa_ptr {the register number} -@d sa_int(#)==mem[#+2].int {an integer} -@d sa_dim(#)==mem[#+2].sc {a dimension (a somewhat esotheric distinction)} -@# -@d mark_class_node_size=4 {size of an element for a mark class} -@# -@d fetch_box(#)== {fetch |box(cur_val)|} - if cur_val<256 then #:=box(cur_val) - else begin find_sa_element(box_val,cur_val,false); - if cur_ptr=null then #:=null@+else #:=sa_ptr(cur_ptr); - end - -@= -if t=mark_val then {a mark class} - begin cur_ptr:=get_node(mark_class_node_size); - mem[cur_ptr+1]:=sa_null; mem[cur_ptr+2]:=sa_null; mem[cur_ptr+3]:=sa_null; - end -else begin if t<=dimen_val then {a count or dimen register} - begin cur_ptr:=get_node(word_node_size); sa_int(cur_ptr):=0; - sa_num(cur_ptr):=n; - end - else begin cur_ptr:=get_node(pointer_node_size); - if t<=mu_val then {a skip or muskip register} - begin sa_ptr(cur_ptr):=zero_glue; add_glue_ref(zero_glue); - end - else sa_ptr(cur_ptr):=null; {a box or token list register} - end; - sa_ref(cur_ptr):=null; {all registers have a reference count} - end; -sa_index(cur_ptr):=16*t+i; sa_lev(cur_ptr):=level_one - -@ The |delete_sa_ref| procedure is called when a pointer to an array -element representing a register is being removed; this means that the -reference count should be decreased by one. If the reduced reference -count is |null| and the register has been (globally) assigned its -default value the array element should disappear, possibly together with -some index nodes. This procedure will never be used for mark class -nodes. -@^reference counts@> - -@d add_sa_ref(#)==incr(sa_ref(#)) {increase reference count} -@# -@d change_box(#)== {change |box(cur_val)|, the |eq_level| stays the same} - if cur_val<256 then set_equiv(box_base+cur_val,#)@+else set_sa_box(#) -@# - -{ FIXME: needs debugging (sparse arrays) } -@d set_sa_box(#)==begin find_sa_element(box_val,cur_val,false); - if cur_ptr<>0 then - begin - set_equiv(sa_ptr(cur_ptr),#); - add_sa_ref(cur_ptr); - delete_sa_ref(cur_ptr); - end; - end - -@= -procedure delete_sa_ref(@!q:pointer); {reduce reference count} -label exit; -var p:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -@!s:small_number; {size of a node} -begin decr(sa_ref(q)); -if sa_ref(q)<>null then return; -if sa_index(q)null then return; - s:=pointer_node_size; - end; -repeat i:=hex_dig4(sa_index(q)); p:=q; q:=link(p); free_node(p,s); -if q=null then {the whole tree has been freed} - begin sa_root[i]:=null; return; - end; -delete_sa_ptr; s:=index_node_size; {node |q| is an index node} -until sa_used(q)>0; -exit:end; - -@ The |print_sa_num| procedure prints the register number corresponding -to an array element. - -@= -procedure print_sa_num(@!q:pointer); {print register number} -var @!n:halfword; {the register number} -begin if sa_index(q)= -@!stat procedure show_sa(@!p:pointer;@!s:str_number); -var t:small_number; {the type of element} -begin begin_diagnostic; print_char("{"); print(s); print_char(" "); -if p=null then print_char("?") {this can't happen} -else begin t:=sa_type(p); - if tnull then show_token_list(link(p),null,32); - end - else print_char("?"); {this can't happen either} - end; - end; -print_char("}"); end_diagnostic(false); -end; -tats -@y -@ Given a type |t| (which is always |mark_val|) and a sixteen-bit number |n|, -the |find_sa_element| procedure returns (in |cur_ptr|) a pointer to the node -for the corresponding array element, or |null| when no such element exists. -The third parameter |w| is set |true| if the element must exist, e.g., because -it is about to be modified. The procedure has two main branches: one follows -the existing tree structure, the other (only used when |w| is |true|) creates -the missing nodes. - -We use macros to extract the four-bit pieces from a sixteen-bit register -number or mark class and to fetch or store one of the 16 pointers from -an index node. - -@d if_cur_ptr_is_null_then_return_or_goto(#)== {some tree element is missing} - begin if cur_ptr=null then - if w then goto #@+else return; - end -@# -{FIXME: needs debugging} -@d hex_dig1(#)==# div 4096 {the fourth lowest hexadecimal digit} -@d hex_dig2(#)==(# div 256) mod 16 {the third lowest hexadecimal digit} -@d hex_dig3(#)==(# div 16) mod 16 {the second lowest hexadecimal digit} -@d hex_dig4(#)==# mod 16 {the lowest hexadecimal digit} -@# -@d get_sa_ptr==if odd(i) then cur_ptr:=link(q+(i div 2)+1) - else cur_ptr:=info(q+(i div 2)+1) - {set |cur_ptr| to the pointer indexed by |i| from index node |q|} -@d put_sa_ptr(#)==if odd(i) then link(q+(i div 2)+1):=# - else info(q+(i div 2)+1):=# - {store the pointer indexed by |i| in index node |q|} -@d add_sa_ptr==begin put_sa_ptr(cur_ptr); incr(sa_used(q)); - end {add |cur_ptr| as the pointer indexed by |i| in index node |q|} -@d delete_sa_ptr==begin put_sa_ptr(null); decr(sa_used(q)); - end {delete the pointer indexed by |i| in index node |q|} - -@= -procedure find_sa_element(@!t:small_number;@!n:halfword;@!w:boolean); - {sets |cur_val| to sparse array element location or |null|} -label not_found,not_found1,not_found2,not_found3,not_found4,exit; -var q:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -begin -begin if t<>mark_val then begin - cur_ptr:=null; - return; -end; end; -cur_ptr:=sa_mark; -if_cur_ptr_is_null_then_return_or_goto(not_found);@/ -q:=cur_ptr; i:=hex_dig1(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found1);@/ -q:=cur_ptr; i:=hex_dig2(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found2);@/ -q:=cur_ptr; i:=hex_dig3(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found3);@/ -q:=cur_ptr; i:=hex_dig4(n); get_sa_ptr; -if (cur_ptr=null)and w then goto not_found4; -return; -not_found: new_index(t,null); {create first level index node} -sa_mark:=cur_ptr; q:=cur_ptr; i:=hex_dig1(n); -not_found1: new_index(i,q); {create second level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig2(n); -not_found2: new_index(i,q); {create third level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig3(n); -not_found3: new_index(i,q); {create fourth level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig4(n); -not_found4: @; -link(cur_ptr):=q; add_sa_ptr; -exit:end; - -@ FIXME OBSOLETE The array elements for registers are subject to grouping and have an -|sa_lev| field (quite analogous to |eq_level|) instead of |sa_used|. -Since saved values as well as shorthand definitions (created by e.g., -\.{\\countdef}) refer to the location of the respective array element, -we need a reference count that is kept in the |sa_ref| field. An array -element can be deleted (together with all references to it) when its -|sa_ref| value is |null| and its value is the default value. -@^reference counts@> - -Skip, muskip, box, and token registers use two word nodes, their values -are stored in the |sa_ptr| field. -Count and dimen registers use three word nodes, their -values are stored in the |sa_int| resp.\ |sa_dim| field in the third -word; the |sa_ptr| field is used under the name |sa_num| to store -the register number. - -@ Mark classes use four word nodes. The last three -words contain the five types of current marks - -@d sa_lev==sa_used {grouping level for the current value} -@d pointer_node_size=2 {size of an element with a pointer value} -@d sa_type(#)==(sa_index(#) div 256) {type part of combined type/index} -@d sa_ref(#)==info(#+1) {reference count of a sparse array element} -@d sa_ptr(#)==link(#+1) {a pointer value} -@# -{FIXME: will be removed} -@d word_node_size=3 {size of an element with a word value} -@d sa_num==sa_ptr {the register number} -@d sa_int(#)==mem[#+2].int {an integer} -@d sa_dim(#)==mem[#+2].sc {a dimension (a somewhat esotheric distinction)} -@# -@d mark_class_node_size=4 {size of an element for a mark class} -@# -{FIXME: will be removed} -@d fetch_box(#)== {fetch |box(cur_val)|} - if cur_val= -if t=mark_val then {a mark class} - begin cur_ptr:=get_node(mark_class_node_size); - mem[cur_ptr+1]:=sa_null; mem[cur_ptr+2]:=sa_null; mem[cur_ptr+3]:=sa_null; - end; -{ -|else begin if t<=dimen_val then| {a count or dimen register} -| begin cur_ptr:=get_node(word_node_size); sa_int(cur_ptr):=0;| -| sa_num(cur_ptr):=n;| -| end| -| else begin cur_ptr:=get_node(pointer_node_size);| -| if t<=mu_val then| {a skip or muskip register} -| begin sa_ptr(cur_ptr):=zero_glue; add_glue_ref(zero_glue);| -| end| -| else sa_ptr(cur_ptr):=null; |{a box or token list register} -| end;| -| sa_ref(cur_ptr):=null;| {all registers have a reference count} -| end;| -} -sa_index(cur_ptr):=256*t+i; sa_lev(cur_ptr):=level_one - -@ The |delete_sa_ref| procedure is called when a pointer to an array -element representing a register is being removed; this means that the -reference count should be decreased by one. If the reduced reference -count is |null| and the register has been (globally) assigned its -default value the array element should disappear, possibly together with -some index nodes. This procedure will never be used for mark class -nodes. -@^reference counts@> - -@d add_sa_ref(#)==incr(sa_ref(#)) {increase reference count} -@# -@d change_box(#)== {change |box(cur_val)|, the |eq_level| stays the same} - set_equiv(box_base+cur_val,#) -@# - -{FIXME: will be removed} -@d set_sa_box(#)==begin find_sa_element(box_val,cur_val,false); - if cur_ptr<>0 then - begin - set_equiv(sa_ptr(cur_ptr),#); - add_sa_ref(cur_ptr); - delete_sa_ref(cur_ptr); - end; - end - -@= -procedure delete_sa_ref(@!q:pointer); {reduce reference count} -label exit; -var p:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -@!s:small_number; {size of a node} -begin decr(sa_ref(q)); -if sa_ref(q)<>null then return; -if false then {was |if sa_index(q)null then return; - s:=pointer_node_size; - end; -repeat i:=hex_dig4(sa_index(q)); p:=q; q:=link(p); free_node(p,s); -if q=null then {the whole tree has been freed} - begin - sa_mark:=null {was |sa_root[i]:=null|}; return; - end; -delete_sa_ptr; s:=index_node_size; {node |q| is an index node} -until sa_used(q)>0; -exit:end; - -@ The |print_sa_num| procedure prints the register number corresponding -to an array element. - -@= -procedure print_sa_num(@!q:pointer); {print register number} -var @!n:halfword; {the register number} -begin if false {was |sa_index(q)= -@!stat procedure show_sa(@!p:pointer;@!s:str_number); -var t:small_number; {the type of element} -begin begin_diagnostic; print_char("{"); print(s); print_char(" "); -{ -|if p=null then print_char("?")| {this can't happen} -|else begin t:=sa_type(p);| -| if tnull then show_token_list(link(p),null,32);| -| end| -| else print_char("?");| {this can't happen either} -| end;| -| end;| -} -print_char("}"); end_diagnostic(false); -end; -tats -@z -%---------------------------------------- -% TODO: l.5029+: will the simply be removed? -% (i.e.: cases which cannot happen (anymore)?) -%---------------------------------------- -@x -procedure sa_save(@!p:pointer); {saves value of |p|} -var q:pointer; {the new save node} -@!i:quarterword; {index field of node} -begin if cur_level<>sa_level then - begin check_full_save_stack; save_type(save_ptr):=restore_sa; - save_level(save_ptr):=sa_level; save_index(save_ptr):=sa_chain; - incr(save_ptr); sa_chain:=null; sa_level:=cur_level; - end; -i:=sa_index(p); -if i= -procedure sa_destroy(@!p:pointer); {destroy value of |p|} -begin if sa_index(p)null then - if sa_index(p)sa_level then - begin check_full_save_stack; save_type(save_ptr):=restore_sa; - save_level(save_ptr):=sa_level; save_index(save_ptr):=sa_chain; - incr(save_ptr); sa_chain:=null; sa_level:=cur_level; - end; -i:=sa_index(p); -if false {was |i= -procedure sa_destroy(@!p:pointer); {destroy value of |p|} -begin if false {was |sa_index(p)null then - if false {was |sa_index(p)=dimen_val_limit then sa_destroy(sa_chain); - @!stat if tracing_restores>0 then show_sa(p,"retaining");@+tats@;@/ - end -else begin if sa_index(p)0 then show_sa(p,"restoring");@+tats@;@/ - end; -delete_sa_ref(p); -p:=sa_chain; sa_chain:=link(p); -if sa_index(p)=dimen_val_limit then|} sa_destroy(sa_chain); - @!stat if tracing_restores>0 then show_sa(p,"retaining");@+tats@;@/ - end -else begin if false {was |sa_index(p)0 then show_sa(p,"restoring");@+tats@;@/ - end; -delete_sa_ref(p); -p:=sa_chain; sa_chain:=link(p); -if false {was |sa_index(p)= -max_reg_num:=32767; -max_reg_help_line:="A register number must be between 0 and 32767."; -@y -@ @= -max_reg_num:=65535; -max_reg_help_line:="A register number must be between 0 and 65535."; -@z -%---------------------------------------- -@x l.4607 -@ There are seven almost identical doubly linked trees, one for the -sparse array of the up to 32512 additional registers of each kind and -one for the sparse array of the up to 32767 additional mark classes. -The root of each such tree, if it exists, is an index node containing 16 -pointers to subtrees for 4096 consecutive array elements. Similar index -nodes are the starting points for all nonempty subtrees for 4096, 256, -and 16 consecutive array elements. These four levels of index nodes are -followed by a fifth level with nodes for the individual array elements. - -Each index node is nine words long. The pointers to the 16 possible -subtrees or are kept in the |info| and |link| fields of the last eight -words. (It would be both elegant and efficient to declare them as -array, unfortunately \PASCAL\ doesn't allow this.) - -The fields in the first word of each index node and in the nodes for the -array elements are closely related. The |link| field points to the next -lower index node and the |sa_index| field contains four bits (one -hexadecimal digit) of the register number or mark class. For the lowest -index node the |link| field is |null| and the |sa_index| field indicates -the type of quantity (|int_avl|, |dimen_val|, |glue_val|, |mu_val|, -|box_val|, |tok_val|, or |mark_val|). The |sa_used| field in the index -nodes counts how many of the 16 pointers are non-null. -@y -@ There is one doubly linked tree, to handle the sparse array of the up -to 65535 additional mark classes. -The root of the tree, if it exists, is an index node containing 16 -pointers to subtrees for 4096 consecutive array elements. Similar index -nodes are the starting points for all nonempty subtrees for 4096, 256, -and 16 consecutive array elements. These four levels of index nodes are -followed by a fifth level with nodes for the individual array elements. - -Each index node is nine words long. The pointers to the 16 possible -subtrees are kept in the |info| and |link| fields of the last eight -words. (It would be both elegant and efficient to declare them as -array, unfortunately \PASCAL\ doesn't allow this.) - -The fields in the first word of each index node and in the nodes for the -array elements are closely related. The |link| field points to the next -lower index node and the |sa_index| field contains eight bits (two -hexadecimal digits) of the mark class. For the lowest -index node the |link| field is |null| and the |sa_index| field indicates -the type of quantity (which is always |mark_val|). The |sa_used| field in the -index nodes counts how many of the 16 pointers are non-null. -@z -%---------------------------------------- -@x l.4630 -The |sa_index| field in the nodes for array elements contains the four -bits plus 16 times the type. Therefore such a node represents a count -or dimen register if and only if |sa_index= -@!sa_root:array[int_val..mark_val] of pointer; {roots of sparse arrays} -@!cur_ptr:pointer; {value returned by |new_index| and |find_sa_element|} -@!sa_null:memory_word; {two |null| pointers} - -@ @= -sa_mark:=null; sa_null.hh.lh:=null; sa_null.hh.rh:=null; - -@ @= -for i:=int_val to tok_val do sa_root[i]:=null; -@y -@ The root of the tree for the additional mark classes is kept -in |sa_mark|. - -@= -@!sa_mark:pointer; {pointer to sparse array of marks} -@!cur_ptr:pointer; {value returned by |new_index| and |find_sa_element|} -@!sa_null:memory_word; {two |null| pointers} - -@ @= -sa_mark:=null; sa_null.hh.lh:=null; sa_null.hh.rh:=null; -@z -%---------------------------------------- -@x l.4681 -@ Given a type |t| and a sixteen-bit number |n|, the |find_sa_element| -procedure returns (in |cur_ptr|) a pointer to the node for the -corresponding array element, or |null| when no such element exists. The -third parameter |w| is set |true| if the element must exist, e.g., -because it is about to be modified. The procedure has two main -branches: one follows the existing tree structure, the other (only used -when |w| is |true|) creates the missing nodes. - -We use macros to extract the four-bit pieces from a sixteen-bit register -number or mark class and to fetch or store one of the 16 pointers from -an index node. - -@d if_cur_ptr_is_null_then_return_or_goto(#)== {some tree element is missing} - begin if cur_ptr=null then - if w then goto #@+else return; - end -@# -@d hex_dig1(#)==# div 4096 {the fourth lowest hexadecimal digit} -@d hex_dig2(#)==(# div 256) mod 16 {the third lowest hexadecimal digit} -@d hex_dig3(#)==(# div 16) mod 16 {the second lowest hexadecimal digit} -@d hex_dig4(#)==# mod 16 {the lowest hexadecimal digit} -@# -@d get_sa_ptr==if odd(i) then cur_ptr:=link(q+(i div 2)+1) - else cur_ptr:=info(q+(i div 2)+1) - {set |cur_ptr| to the pointer indexed by |i| from index node |q|} -@d put_sa_ptr(#)==if odd(i) then link(q+(i div 2)+1):=# - else info(q+(i div 2)+1):=# - {store the pointer indexed by |i| in index node |q|} -@d add_sa_ptr==begin put_sa_ptr(cur_ptr); incr(sa_used(q)); - end {add |cur_ptr| as the pointer indexed by |i| in index node |q|} -@d delete_sa_ptr==begin put_sa_ptr(null); decr(sa_used(q)); - end {delete the pointer indexed by |i| in index node |q|} - -@= -procedure find_sa_element(@!t:small_number;@!n:halfword;@!w:boolean); - {sets |cur_val| to sparse array element location or |null|} -label not_found,not_found1,not_found2,not_found3,not_found4,exit; -var q:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -begin cur_ptr:=sa_root[t]; -if_cur_ptr_is_null_then_return_or_goto(not_found);@/ -q:=cur_ptr; i:=hex_dig1(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found1);@/ -q:=cur_ptr; i:=hex_dig2(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found2);@/ -q:=cur_ptr; i:=hex_dig3(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found3);@/ -q:=cur_ptr; i:=hex_dig4(n); get_sa_ptr; -if (cur_ptr=null)and w then goto not_found4; -return; -not_found: new_index(t,null); {create first level index node} -sa_root[t]:=cur_ptr; q:=cur_ptr; i:=hex_dig1(n); -not_found1: new_index(i,q); {create second level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig2(n); -not_found2: new_index(i,q); {create third level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig3(n); -not_found3: new_index(i,q); {create fourth level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig4(n); -not_found4: @; -link(cur_ptr):=q; add_sa_ptr; -exit:end; - -@ The array elements for registers are subject to grouping and have an -|sa_lev| field (quite analogous to |eq_level|) instead of |sa_used|. -Since saved values as well as shorthand definitions (created by e.g., -\.{\\countdef}) refer to the location of the respective array element, -we need a reference count that is kept in the |sa_ref| field. An array -element can be deleted (together with all references to it) when its -|sa_ref| value is |null| and its value is the default value. -@^reference counts@> - -Skip, muskip, box, and token registers use two word nodes, their values -are stored in the |sa_ptr| field. -Count and dimen registers use three word nodes, their -values are stored in the |sa_int| resp.\ |sa_dim| field in the third -word; the |sa_ptr| field is used under the name |sa_num| to store -the register number. Mark classes use four word nodes. The last three -words contain the five types of current marks - -@d sa_lev==sa_used {grouping level for the current value} -@d pointer_node_size=2 {size of an element with a pointer value} -@d sa_type(#)==(sa_index(#) div 16) {type part of combined type/index} -@d sa_ref(#)==info(#+1) {reference count of a sparse array element} -@d sa_ptr(#)==link(#+1) {a pointer value} -@# -@d word_node_size=3 {size of an element with a word value} -@d sa_num==sa_ptr {the register number} -@d sa_int(#)==mem[#+2].int {an integer} -@d sa_dim(#)==mem[#+2].sc {a dimension (a somewhat esotheric distinction)} -@# -@d mark_class_node_size=4 {size of an element for a mark class} -@# -@d fetch_box(#)== {fetch |box(cur_val)|} - if cur_val<256 then #:=box(cur_val) - else begin find_sa_element(box_val,cur_val,false); - if cur_ptr=null then #:=null@+else #:=sa_ptr(cur_ptr); - end - -@= -if t=mark_val then {a mark class} - begin cur_ptr:=get_node(mark_class_node_size); - mem[cur_ptr+1]:=sa_null; mem[cur_ptr+2]:=sa_null; mem[cur_ptr+3]:=sa_null; - end -else begin if t<=dimen_val then {a count or dimen register} - begin cur_ptr:=get_node(word_node_size); sa_int(cur_ptr):=0; - sa_num(cur_ptr):=n; - end - else begin cur_ptr:=get_node(pointer_node_size); - if t<=mu_val then {a skip or muskip register} - begin sa_ptr(cur_ptr):=zero_glue; add_glue_ref(zero_glue); - end - else sa_ptr(cur_ptr):=null; {a box or token list register} - end; - sa_ref(cur_ptr):=null; {all registers have a reference count} - end; -sa_index(cur_ptr):=16*t+i; sa_lev(cur_ptr):=level_one - -@ The |delete_sa_ref| procedure is called when a pointer to an array -element representing a register is being removed; this means that the -reference count should be decreased by one. If the reduced reference -count is |null| and the register has been (globally) assigned its -default value the array element should disappear, possibly together with -some index nodes. This procedure will never be used for mark class -nodes. -@^reference counts@> - -@d add_sa_ref(#)==incr(sa_ref(#)) {increase reference count} -@# -@d change_box(#)== {change |box(cur_val)|, the |eq_level| stays the same} - if cur_val<256 then set_equiv(box_base+cur_val,#)@+else set_sa_box(#) -@# - -{ FIXME: needs debugging (sparse arrays) } -@d set_sa_box(#)==begin find_sa_element(box_val,cur_val,false); - if cur_ptr<>0 then - begin - set_equiv(sa_ptr(cur_ptr),#); - add_sa_ref(cur_ptr); - delete_sa_ref(cur_ptr); - end; - end - -@= -procedure delete_sa_ref(@!q:pointer); {reduce reference count} -label exit; -var p:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -@!s:small_number; {size of a node} -begin decr(sa_ref(q)); -if sa_ref(q)<>null then return; -if sa_index(q)null then return; - s:=pointer_node_size; - end; -repeat i:=hex_dig4(sa_index(q)); p:=q; q:=link(p); free_node(p,s); -if q=null then {the whole tree has been freed} - begin sa_root[i]:=null; return; - end; -delete_sa_ptr; s:=index_node_size; {node |q| is an index node} -until sa_used(q)>0; -exit:end; - -@ The |print_sa_num| procedure prints the register number corresponding -to an array element. - -@= -procedure print_sa_num(@!q:pointer); {print register number} -var @!n:halfword; {the register number} -begin if sa_index(q)= -@!stat procedure show_sa(@!p:pointer;@!s:str_number); -var t:small_number; {the type of element} -begin begin_diagnostic; print_char("{"); print(s); print_char(" "); -if p=null then print_char("?") {this can't happen} -else begin t:=sa_type(p); - if tnull then show_token_list(link(p),null,32); - end - else print_char("?"); {this can't happen either} - end; - end; -print_char("}"); end_diagnostic(false); -end; -tats -@y -@ Given a type |t| (which is always |mark_val|) and a sixteen-bit number |n|, -the |find_sa_element| procedure returns (in |cur_ptr|) a pointer to the node -for the corresponding array element, or |null| when no such element exists. -The third parameter |w| is set |true| if the element must exist, e.g., because -it is about to be modified. The procedure has two main branches: one follows -the existing tree structure, the other (only used when |w| is |true|) creates -the missing nodes. - -We use macros to extract the four-bit pieces from a sixteen-bit register -number or mark class and to fetch or store one of the 16 pointers from -an index node. - -@d if_cur_ptr_is_null_then_return_or_goto(#)== {some tree element is missing} - begin if cur_ptr=null then - if w then goto #@+else return; - end -@# -{FIXME: needs debugging} -@d hex_dig1(#)==# div 4096 {the fourth lowest hexadecimal digit} -@d hex_dig2(#)==(# div 256) mod 16 {the third lowest hexadecimal digit} -@d hex_dig3(#)==(# div 16) mod 16 {the second lowest hexadecimal digit} -@d hex_dig4(#)==# mod 16 {the lowest hexadecimal digit} -@# -@d get_sa_ptr==if odd(i) then cur_ptr:=link(q+(i div 2)+1) - else cur_ptr:=info(q+(i div 2)+1) - {set |cur_ptr| to the pointer indexed by |i| from index node |q|} -@d put_sa_ptr(#)==if odd(i) then link(q+(i div 2)+1):=# - else info(q+(i div 2)+1):=# - {store the pointer indexed by |i| in index node |q|} -@d add_sa_ptr==begin put_sa_ptr(cur_ptr); incr(sa_used(q)); - end {add |cur_ptr| as the pointer indexed by |i| in index node |q|} -@d delete_sa_ptr==begin put_sa_ptr(null); decr(sa_used(q)); - end {delete the pointer indexed by |i| in index node |q|} - -@= -procedure find_sa_element(@!t:small_number;@!n:halfword;@!w:boolean); - {sets |cur_val| to sparse array element location or |null|} -label not_found,not_found1,not_found2,not_found3,not_found4,exit; -var q:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -begin -begin if t<>mark_val then begin - cur_ptr:=null; - return; -end; end; -cur_ptr:=sa_mark; -if_cur_ptr_is_null_then_return_or_goto(not_found);@/ -q:=cur_ptr; i:=hex_dig1(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found1);@/ -q:=cur_ptr; i:=hex_dig2(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found2);@/ -q:=cur_ptr; i:=hex_dig3(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found3);@/ -q:=cur_ptr; i:=hex_dig4(n); get_sa_ptr; -if (cur_ptr=null)and w then goto not_found4; -return; -not_found: new_index(t,null); {create first level index node} -sa_mark:=cur_ptr; q:=cur_ptr; i:=hex_dig1(n); -not_found1: new_index(i,q); {create second level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig2(n); -not_found2: new_index(i,q); {create third level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig3(n); -not_found3: new_index(i,q); {create fourth level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig4(n); -not_found4: @; -link(cur_ptr):=q; add_sa_ptr; -exit:end; - -@ FIXME OBSOLETE The array elements for registers are subject to grouping and have an -|sa_lev| field (quite analogous to |eq_level|) instead of |sa_used|. -Since saved values as well as shorthand definitions (created by e.g., -\.{\\countdef}) refer to the location of the respective array element, -we need a reference count that is kept in the |sa_ref| field. An array -element can be deleted (together with all references to it) when its -|sa_ref| value is |null| and its value is the default value. -@^reference counts@> - -Skip, muskip, box, and token registers use two word nodes, their values -are stored in the |sa_ptr| field. -Count and dimen registers use three word nodes, their -values are stored in the |sa_int| resp.\ |sa_dim| field in the third -word; the |sa_ptr| field is used under the name |sa_num| to store -the register number. - -@ Mark classes use four word nodes. The last three -words contain the five types of current marks - -@d sa_lev==sa_used {grouping level for the current value} -@d pointer_node_size=2 {size of an element with a pointer value} -@d sa_type(#)==(sa_index(#) div 256) {type part of combined type/index} -@d sa_ref(#)==info(#+1) {reference count of a sparse array element} -@d sa_ptr(#)==link(#+1) {a pointer value} -@# -{FIXME: will be removed} -@d word_node_size=3 {size of an element with a word value} -@d sa_num==sa_ptr {the register number} -@d sa_int(#)==mem[#+2].int {an integer} -@d sa_dim(#)==mem[#+2].sc {a dimension (a somewhat esotheric distinction)} -@# -@d mark_class_node_size=4 {size of an element for a mark class} -@# -{FIXME: will be removed} -@d fetch_box(#)== {fetch |box(cur_val)|} - if cur_val= -if t=mark_val then {a mark class} - begin cur_ptr:=get_node(mark_class_node_size); - mem[cur_ptr+1]:=sa_null; mem[cur_ptr+2]:=sa_null; mem[cur_ptr+3]:=sa_null; - end; -{ -|else begin if t<=dimen_val then| {a count or dimen register} -| begin cur_ptr:=get_node(word_node_size); sa_int(cur_ptr):=0;| -| sa_num(cur_ptr):=n;| -| end| -| else begin cur_ptr:=get_node(pointer_node_size);| -| if t<=mu_val then| {a skip or muskip register} -| begin sa_ptr(cur_ptr):=zero_glue; add_glue_ref(zero_glue);| -| end| -| else sa_ptr(cur_ptr):=null; |{a box or token list register} -| end;| -| sa_ref(cur_ptr):=null;| {all registers have a reference count} -| end;| -} -sa_index(cur_ptr):=256*t+i; sa_lev(cur_ptr):=level_one - -@ The |delete_sa_ref| procedure is called when a pointer to an array -element representing a register is being removed; this means that the -reference count should be decreased by one. If the reduced reference -count is |null| and the register has been (globally) assigned its -default value the array element should disappear, possibly together with -some index nodes. This procedure will never be used for mark class -nodes. -@^reference counts@> - -@d add_sa_ref(#)==incr(sa_ref(#)) {increase reference count} -@# -@d change_box(#)== {change |box(cur_val)|, the |eq_level| stays the same} - set_equiv(box_base+cur_val,#) -@# - -{FIXME: will be removed} -@d set_sa_box(#)==begin find_sa_element(box_val,cur_val,false); - if cur_ptr<>0 then - begin - set_equiv(sa_ptr(cur_ptr),#); - add_sa_ref(cur_ptr); - delete_sa_ref(cur_ptr); - end; - end - -@= -procedure delete_sa_ref(@!q:pointer); {reduce reference count} -label exit; -var p:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -@!s:small_number; {size of a node} -begin decr(sa_ref(q)); -if sa_ref(q)<>null then return; -if false then {was |if sa_index(q)null then return; - s:=pointer_node_size; - end; -repeat i:=hex_dig4(sa_index(q)); p:=q; q:=link(p); free_node(p,s); -if q=null then {the whole tree has been freed} - begin - sa_mark:=null {was |sa_root[i]:=null|}; return; - end; -delete_sa_ptr; s:=index_node_size; {node |q| is an index node} -until sa_used(q)>0; -exit:end; - -@ The |print_sa_num| procedure prints the register number corresponding -to an array element. - -@= -procedure print_sa_num(@!q:pointer); {print register number} -var @!n:halfword; {the register number} -begin if false {was |sa_index(q)= -@!stat procedure show_sa(@!p:pointer;@!s:str_number); -var t:small_number; {the type of element} -begin begin_diagnostic; print_char("{"); print(s); print_char(" "); -{ -|if p=null then print_char("?")| {this can't happen} -|else begin t:=sa_type(p);| -| if tnull then show_token_list(link(p),null,32);| -| end| -| else print_char("?");| {this can't happen either} -| end;| -| end;| -} -print_char("}"); end_diagnostic(false); -end; -tats -@z -%---------------------------------------- -% TODO: l.5029+: will the simply be removed? -% (i.e.: cases which cannot happen (anymore)?) -%---------------------------------------- -@x -procedure sa_save(@!p:pointer); {saves value of |p|} -var q:pointer; {the new save node} -@!i:quarterword; {index field of node} -begin if cur_level<>sa_level then - begin check_full_save_stack; save_type(save_ptr):=restore_sa; - save_level(save_ptr):=sa_level; save_index(save_ptr):=sa_chain; - incr(save_ptr); sa_chain:=null; sa_level:=cur_level; - end; -i:=sa_index(p); -if i= -procedure sa_destroy(@!p:pointer); {destroy value of |p|} -begin if sa_index(p)null then - if sa_index(p)sa_level then - begin check_full_save_stack; save_type(save_ptr):=restore_sa; - save_level(save_ptr):=sa_level; save_index(save_ptr):=sa_chain; - incr(save_ptr); sa_chain:=null; sa_level:=cur_level; - end; -i:=sa_index(p); -if false {was |i= -procedure sa_destroy(@!p:pointer); {destroy value of |p|} -begin if false {was |sa_index(p)null then - if false {was |sa_index(p)=dimen_val_limit then sa_destroy(sa_chain); - @!stat if tracing_restores>0 then show_sa(p,"retaining");@+tats@;@/ - end -else begin if sa_index(p)0 then show_sa(p,"restoring");@+tats@;@/ - end; -delete_sa_ref(p); -p:=sa_chain; sa_chain:=link(p); -if sa_index(p)=dimen_val_limit then|} sa_destroy(sa_chain); - @!stat if tracing_restores>0 then show_sa(p,"retaining");@+tats@;@/ - end -else begin if false {was |sa_index(p)0 then show_sa(p,"restoring");@+tats@;@/ - end; -delete_sa_ref(p); -p:=sa_chain; sa_chain:=link(p); -if false {was |sa_index(p)= -primitive("marks",mark,marks_code); -@!@:marks_}{\.{\\marks} primitive@> -primitive("topmarks",top_bot_mark,top_mark_code+marks_code); -@!@:top_marks_}{\.{\\topmarks} primitive@> -primitive("firstmarks",top_bot_mark,first_mark_code+marks_code); -@!@:first_marks_}{\.{\\firstmarks} primitive@> -primitive("botmarks",top_bot_mark,bot_mark_code+marks_code); -@!@:bot_marks_}{\.{\\botmarks} primitive@> -primitive("splitfirstmarks",top_bot_mark,split_first_mark_code+marks_code); -@!@:split_first_marks_}{\.{\\splitfirstmarks} primitive@> -primitive("splitbotmarks",top_bot_mark,split_bot_mark_code+marks_code); -@!@:split_bot_marks_}{\.{\\splitbotmarks} primitive@> - -@ The |scan_register_num| procedure scans a register number that must -not exceed 255 in compatibility mode resp.\ 32767 in extended mode. - -@= -procedure@?scan_register_num; forward;@t\2@> - -@ @= -procedure scan_register_num; -begin scan_int; -if (cur_val<0)or(cur_val>max_reg_num) then - begin print_err("Bad register code"); -@.Bad register code@> - help2(max_reg_help_line)("I changed this one to zero."); - int_error(cur_val); cur_val:=0; - end; -end; - -@ @= -max_reg_num:=255; -max_reg_help_line:="A register number must be between 0 and 255."; - -@ @= -max_reg_num:=32767; -max_reg_help_line:="A register number must be between 0 and 32767."; -@y -@ \eOmega\ (in extended mode) supports 65536 (i.e., $2^{16}$) count, -dimen, skip, muskip, box, and token registers. They are -implemented as in \TeX. - -There are 32768 mark classes; the command \.{\\marks}|n| -creates a mark node for a given mark class |0<=n<=32767| (where -\.{\\marks0} is synonymous to \.{\\mark}). The page builder (actually -the |fire_up| routine) and the |vsplit| routine maintain the current -values of |top_mark|, |first_mark|, |bot_mark|, |split_first_mark|, and -|split_bot_mark| for each mark class. They are accessed as -\.{\\topmarks}|n| etc., and \.{\\topmarks0} is again synonymous to -\.{\\topmark}. As in \TeX\ the five current marks for mark class zero -are realized as |cur_mark| array. The additional current marks are -again realized as tree structure with individual mark classes existing -only when needed. - -@= -primitive("marks",mark,marks_code); -@!@:marks_}{\.{\\marks} primitive@> -primitive("topmarks",top_bot_mark,top_mark_code+marks_code); -@!@:top_marks_}{\.{\\topmarks} primitive@> -primitive("firstmarks",top_bot_mark,first_mark_code+marks_code); -@!@:first_marks_}{\.{\\firstmarks} primitive@> -primitive("botmarks",top_bot_mark,bot_mark_code+marks_code); -@!@:bot_marks_}{\.{\\botmarks} primitive@> -primitive("splitfirstmarks",top_bot_mark,split_first_mark_code+marks_code); -@!@:split_first_marks_}{\.{\\splitfirstmarks} primitive@> -primitive("splitbotmarks",top_bot_mark,split_bot_mark_code+marks_code); -@!@:split_bot_marks_}{\.{\\splitbotmarks} primitive@> - -@ The |scan_register_num| procedure scans a (token) register number. - -@= -procedure@?scan_register_num; forward;@t\2@> - -@ @= -procedure scan_register_num; -begin scan_int; -if (cur_val<0)or(cur_val>max_reg_num) then - begin print_err("Bad register code"); -@.Bad register code@> - help2(max_reg_help_line)("I changed this one to zero."); - int_error(cur_val); cur_val:=0; - end; -end; - -@ @= -max_reg_num:=255; -max_reg_help_line:="A register number must be between 0 and 255."; - -@ @= -max_reg_num:=32767; -max_reg_help_line:="A register number must be between 0 and 32727."; -@z -%---------------------------------------- -@x l.4607 -@ @= -@!max_reg_num: halfword; {largest allowed register number} -@!max_reg_help_line: str_number; {first line of help message} - -@ There are seven almost identical doubly linked trees, one for the -sparse array of the up to 32512 additional registers of each kind and -one for the sparse array of the up to 32767 additional mark classes. -The root of each such tree, if it exists, is an index node containing 16 -pointers to subtrees for 4096 consecutive array elements. Similar index -nodes are the starting points for all nonempty subtrees for 4096, 256, -and 16 consecutive array elements. These four levels of index nodes are -followed by a fifth level with nodes for the individual array elements. - -Each index node is nine words long. The pointers to the 16 possible -subtrees or are kept in the |info| and |link| fields of the last eight -words. (It would be both elegant and efficient to declare them as -array, unfortunately \PASCAL\ doesn't allow this.) - -The fields in the first word of each index node and in the nodes for the -array elements are closely related. The |link| field points to the next -lower index node and the |sa_index| field contains four bits (one -hexadecimal digit) of the register number or mark class. For the lowest -index node the |link| field is |null| and the |sa_index| field indicates -the type of quantity (|int_avl|, |dimen_val|, |glue_val|, |mu_val|, -|box_val|, |tok_val|, or |mark_val|). The |sa_used| field in the index -nodes counts how many of the 16 pointers are non-null. -@y -@ @= -@!max_reg_num: halfword; {largest allowed register number} -@!max_reg_help_line: str_number; {first line of help message} - -@ There is one doubly linked tree, to handle the sparse array of the up -to 32727 additional mark classes. -The root of the tree, if it exists, is an index node containing 16 -pointers to subtrees for 4096 consecutive array elements. Similar index -nodes are the starting points for all nonempty subtrees for 4096, 256, -and 16 consecutive array elements. These four levels of index nodes are -followed by a fifth level with nodes for the individual array elements. - -Each index node is nine words long. The pointers to the 16 possible -subtrees are kept in the |info| and |link| fields of the last eight -words. (It would be both elegant and efficient to declare them as -array, unfortunately \PASCAL\ doesn't allow this.) - -The fields in the first word of each index node and in the nodes for the -array elements are closely related. The |link| field points to the next -lower index node and the |sa_index| field contains eight bits (two -hexadecimal digits) of the mark class. For the lowest -index node the |link| field is |null| and the |sa_index| field indicates -the type of quantity (which is always |mark_val|). The |sa_used| field in the -index nodes counts how many of the 16 pointers are non-null. -@z -%---------------------------------------- -@x l.4630 -The |sa_index| field in the nodes for array elements contains the four -bits plus 16 times the type. Therefore such a node represents a count -or dimen register if and only if |sa_index= -@!sa_root:array[int_val..mark_val] of pointer; {roots of sparse arrays} -@!cur_ptr:pointer; {value returned by |new_index| and |find_sa_element|} -@!sa_null:memory_word; {two |null| pointers} - -@ @= -sa_mark:=null; sa_null.hh.lh:=null; sa_null.hh.rh:=null; - -@ @= -for i:=int_val to tok_val do sa_root[i]:=null; -@y -@ The root of the tree for the additional mark classes is kept -in |sa_mark|. - -@= -@!sa_mark:pointer; {pointer to sparse array of marks} -@!cur_ptr:pointer; {value returned by |new_index| and |find_sa_element|} -@!sa_null:memory_word; {two |null| pointers} - -@ @= -sa_mark:=null; sa_null.hh.lh:=null; sa_null.hh.rh:=null; -@z -%---------------------------------------- -@x l.4681 -@ Given a type |t| and a sixteen-bit number |n|, the |find_sa_element| -procedure returns (in |cur_ptr|) a pointer to the node for the -corresponding array element, or |null| when no such element exists. The -third parameter |w| is set |true| if the element must exist, e.g., -because it is about to be modified. The procedure has two main -branches: one follows the existing tree structure, the other (only used -when |w| is |true|) creates the missing nodes. - -We use macros to extract the four-bit pieces from a sixteen-bit register -number or mark class and to fetch or store one of the 16 pointers from -an index node. - -@d if_cur_ptr_is_null_then_return_or_goto(#)== {some tree element is missing} - begin if cur_ptr=null then - if w then goto #@+else return; - end -@# -@d hex_dig1(#)==# div 4096 {the fourth lowest hexadecimal digit} -@d hex_dig2(#)==(# div 256) mod 16 {the third lowest hexadecimal digit} -@d hex_dig3(#)==(# div 16) mod 16 {the second lowest hexadecimal digit} -@d hex_dig4(#)==# mod 16 {the lowest hexadecimal digit} -@# -@d get_sa_ptr==if odd(i) then cur_ptr:=link(q+(i div 2)+1) - else cur_ptr:=info(q+(i div 2)+1) - {set |cur_ptr| to the pointer indexed by |i| from index node |q|} -@d put_sa_ptr(#)==if odd(i) then link(q+(i div 2)+1):=# - else info(q+(i div 2)+1):=# - {store the pointer indexed by |i| in index node |q|} -@d add_sa_ptr==begin put_sa_ptr(cur_ptr); incr(sa_used(q)); - end {add |cur_ptr| as the pointer indexed by |i| in index node |q|} -@d delete_sa_ptr==begin put_sa_ptr(null); decr(sa_used(q)); - end {delete the pointer indexed by |i| in index node |q|} - -@= -procedure find_sa_element(@!t:small_number;@!n:halfword;@!w:boolean); - {sets |cur_val| to sparse array element location or |null|} -label not_found,not_found1,not_found2,not_found3,not_found4,exit; -var q:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -begin cur_ptr:=sa_root[t]; -if_cur_ptr_is_null_then_return_or_goto(not_found);@/ -q:=cur_ptr; i:=hex_dig1(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found1);@/ -q:=cur_ptr; i:=hex_dig2(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found2);@/ -q:=cur_ptr; i:=hex_dig3(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found3);@/ -q:=cur_ptr; i:=hex_dig4(n); get_sa_ptr; -if (cur_ptr=null)and w then goto not_found4; -return; -not_found: new_index(t,null); {create first level index node} -sa_root[t]:=cur_ptr; q:=cur_ptr; i:=hex_dig1(n); -not_found1: new_index(i,q); {create second level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig2(n); -not_found2: new_index(i,q); {create third level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig3(n); -not_found3: new_index(i,q); {create fourth level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig4(n); -not_found4: @; -link(cur_ptr):=q; add_sa_ptr; -exit:end; - -@ The array elements for registers are subject to grouping and have an -|sa_lev| field (quite analogous to |eq_level|) instead of |sa_used|. -Since saved values as well as shorthand definitions (created by e.g., -\.{\\countdef}) refer to the location of the respective array element, -we need a reference count that is kept in the |sa_ref| field. An array -element can be deleted (together with all references to it) when its -|sa_ref| value is |null| and its value is the default value. -@^reference counts@> - -Skip, muskip, box, and token registers use two word nodes, their values -are stored in the |sa_ptr| field. -Count and dimen registers use three word nodes, their -values are stored in the |sa_int| resp.\ |sa_dim| field in the third -word; the |sa_ptr| field is used under the name |sa_num| to store -the register number. Mark classes use four word nodes. The last three -words contain the five types of current marks - -@d sa_lev==sa_used {grouping level for the current value} -@d pointer_node_size=2 {size of an element with a pointer value} -@d sa_type(#)==(sa_index(#) div 16) {type part of combined type/index} -@d sa_ref(#)==info(#+1) {reference count of a sparse array element} -@d sa_ptr(#)==link(#+1) {a pointer value} -@# -@d word_node_size=3 {size of an element with a word value} -@d sa_num==sa_ptr {the register number} -@d sa_int(#)==mem[#+2].int {an integer} -@d sa_dim(#)==mem[#+2].sc {a dimension (a somewhat esotheric distinction)} -@# -@d mark_class_node_size=4 {size of an element for a mark class} -@# -@d fetch_box(#)== {fetch |box(cur_val)|} - if cur_val<256 then #:=box(cur_val) - else begin find_sa_element(box_val,cur_val,false); - if cur_ptr=null then #:=null@+else #:=sa_ptr(cur_ptr); - end - -@= -if t=mark_val then {a mark class} - begin cur_ptr:=get_node(mark_class_node_size); - mem[cur_ptr+1]:=sa_null; mem[cur_ptr+2]:=sa_null; mem[cur_ptr+3]:=sa_null; - end -else begin if t<=dimen_val then {a count or dimen register} - begin cur_ptr:=get_node(word_node_size); sa_int(cur_ptr):=0; - sa_num(cur_ptr):=n; - end - else begin cur_ptr:=get_node(pointer_node_size); - if t<=mu_val then {a skip or muskip register} - begin sa_ptr(cur_ptr):=zero_glue; add_glue_ref(zero_glue); - end - else sa_ptr(cur_ptr):=null; {a box or token list register} - end; - sa_ref(cur_ptr):=null; {all registers have a reference count} - end; -sa_index(cur_ptr):=16*t+i; sa_lev(cur_ptr):=level_one - -@ The |delete_sa_ref| procedure is called when a pointer to an array -element representing a register is being removed; this means that the -reference count should be decreased by one. If the reduced reference -count is |null| and the register has been (globally) assigned its -default value the array element should disappear, possibly together with -some index nodes. This procedure will never be used for mark class -nodes. -@^reference counts@> - -@d add_sa_ref(#)==incr(sa_ref(#)) {increase reference count} -@# -@d change_box(#)== {change |box(cur_val)|, the |eq_level| stays the same} - if cur_val<256 then set_equiv(box_base+cur_val,#)@+else set_sa_box(#) -@# - -{ FIXME: needs debugging (sparse arrays) } -@d set_sa_box(#)==begin find_sa_element(box_val,cur_val,false); - if cur_ptr<>0 then - begin - set_equiv(sa_ptr(cur_ptr),#); - add_sa_ref(cur_ptr); - delete_sa_ref(cur_ptr); - end; - end - -@= -procedure delete_sa_ref(@!q:pointer); {reduce reference count} -label exit; -var p:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -@!s:small_number; {size of a node} -begin decr(sa_ref(q)); -if sa_ref(q)<>null then return; -if sa_index(q)null then return; - s:=pointer_node_size; - end; -repeat i:=hex_dig4(sa_index(q)); p:=q; q:=link(p); free_node(p,s); -if q=null then {the whole tree has been freed} - begin sa_root[i]:=null; return; - end; -delete_sa_ptr; s:=index_node_size; {node |q| is an index node} -until sa_used(q)>0; -exit:end; - -@ The |print_sa_num| procedure prints the register number corresponding -to an array element. - -@= -procedure print_sa_num(@!q:pointer); {print register number} -var @!n:halfword; {the register number} -begin if sa_index(q)= -@!stat procedure show_sa(@!p:pointer;@!s:str_number); -var t:small_number; {the type of element} -begin begin_diagnostic; print_char("{"); print(s); print_char(" "); -if p=null then print_char("?") {this can't happen} -else begin t:=sa_type(p); - if tnull then show_token_list(link(p),null,32); - end - else print_char("?"); {this can't happen either} - end; - end; -print_char("}"); end_diagnostic(false); -end; -tats -@y -@ Given a type |t| (which is always |mark_val|) and a sixteen-bit number |n|, -the |find_sa_element| procedure returns (in |cur_ptr|) a pointer to the node -for the corresponding array element, or |null| when no such element exists. -The third parameter |w| is set |true| if the element must exist, e.g., because -it is about to be modified. The procedure has two main branches: one follows -the existing tree structure, the other (only used when |w| is |true|) creates -the missing nodes. - -We use macros to extract the four-bit pieces from a sixteen-bit register -number or mark class and to fetch or store one of the 16 pointers from -an index node. - -@d if_cur_ptr_is_null_then_return_or_goto(#)== {some tree element is missing} - begin if cur_ptr=null then - if w then goto #@+else return; - end -@# -{FIXME: needs debugging} -@d hex_dig1(#)==# div 4096 {the fourth lowest hexadecimal digit} -@d hex_dig2(#)==(# div 256) mod 16 {the third lowest hexadecimal digit} -@d hex_dig3(#)==(# div 16) mod 16 {the second lowest hexadecimal digit} -@d hex_dig4(#)==# mod 16 {the lowest hexadecimal digit} -@# -@d get_sa_ptr==if odd(i) then cur_ptr:=link(q+(i div 2)+1) - else cur_ptr:=info(q+(i div 2)+1) - {set |cur_ptr| to the pointer indexed by |i| from index node |q|} -@d put_sa_ptr(#)==if odd(i) then link(q+(i div 2)+1):=# - else info(q+(i div 2)+1):=# - {store the pointer indexed by |i| in index node |q|} -@d add_sa_ptr==begin put_sa_ptr(cur_ptr); incr(sa_used(q)); - end {add |cur_ptr| as the pointer indexed by |i| in index node |q|} -@d delete_sa_ptr==begin put_sa_ptr(null); decr(sa_used(q)); - end {delete the pointer indexed by |i| in index node |q|} - -@= -procedure find_sa_element(@!t:small_number;@!n:halfword;@!w:boolean); - {sets |cur_val| to sparse array element location or |null|} -label not_found,not_found1,not_found2,not_found3,not_found4,exit; -var q:pointer; {for list manipulations} -@!i:small_number; {a four bit index} -begin -if t<>mark_val then begin - confusion("sparse arrays, finding") - cur_ptr:=null; - return; -end; -cur_ptr:=sa_mark; -if_cur_ptr_is_null_then_return_or_goto(not_found);@/ -q:=cur_ptr; i:=hex_dig1(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found1);@/ -q:=cur_ptr; i:=hex_dig2(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found2);@/ -q:=cur_ptr; i:=hex_dig3(n); get_sa_ptr; -if_cur_ptr_is_null_then_return_or_goto(not_found3);@/ -q:=cur_ptr; i:=hex_dig4(n); get_sa_ptr; -if (cur_ptr=null)and w then goto not_found4; -return; -not_found: new_index(t,null); {create first level index node} -sa_mark:=cur_ptr; q:=cur_ptr; i:=hex_dig1(n); -not_found1: new_index(i,q); {create second level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig2(n); -not_found2: new_index(i,q); {create third level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig3(n); -not_found3: new_index(i,q); {create fourth level index node} -add_sa_ptr; q:=cur_ptr; i:=hex_dig4(n); -not_found4: @; -link(cur_ptr):=q; add_sa_ptr; -exit:end; - -@ Mark classes use four word nodes. The last three -words contain the five types of current marks - -@d sa_lev==sa_used {grouping level for the current value} -@d pointer_node_size=2 {size of an element with a pointer value} -@d sa_type(#)==(sa_index(#) div 256) {type part of combined type/index} -@d sa_ref(#)==info(#+1) {reference count of a sparse array element} -@d sa_ptr(#)==link(#+1) {a pointer value} -@# -@d sa_num==sa_ptr {the register number} -@d sa_int(#)==mem[#+2].int {an integer} -@d sa_dim(#)==mem[#+2].sc {a dimension (a somewhat esotheric distinction)} -@# -@d mark_class_node_size=4 {size of an element for a mark class} -@# - -@= -{|if t=mark_val then|} {a mark class} {check not needed} - begin cur_ptr:=get_node(mark_class_node_size); - mem[cur_ptr+1]:=sa_null; mem[cur_ptr+2]:=sa_null; mem[cur_ptr+3]:=sa_null; - end; -{|else begin|} -{| confusion("sparse arrays, creating");|} -{|end|} -sa_index(cur_ptr):=256*t+i; sa_lev(cur_ptr):=level_one - -@z -%---------------------------------------- -% TODO: l.5029+: will the simply be removed? -% (i.e.: cases which cannot happen (anymore)?) -%---------------------------------------- -@x l.5078 -@ The command code |register| is used for `\.{\\count}', `\.{\\dimen}', -etc., as well as for references to sparse array elements defined by -`\.{\\countdef}', etc. - -@= -begin if (chr_codelo_mem_stat_max) then - cmd:=sa_type(chr_code) -else begin cmd:=chr_code-mem_bot; chr_code:=null; - end; -if cmd=int_val then print_esc("count") -else if cmd=dimen_val then print_esc("dimen") -else if cmd=glue_val then print_esc("skip") -else print_esc("muskip"); -if chr_code<>null then print_sa_num(chr_code); -end - -@ Similarly the command code |toks_register| is used for `\.{\\toks}' as -well as for references to sparse array elements defined by -`\.{\\toksdef}'. - -@= -begin print_esc("toks"); -if chr_code<>mem_bot then print_sa_num(chr_code); -end - -@ When a shorthand definition for an element of one of the sparse arrays -is destroyed, we must reduce the reference count. - -@= -toks_register,register: - if (equiv_field(w)lo_mem_stat_max) then - delete_sa_ref(equiv_field(w)); - -@ The task to maintain (change, save, and restore) register values is -essentially the same when the register is realized as sparse array -element or entry in |eqtb|. The global variable |sa_chain| is the head -of a linked list of entries saved at the topmost level |sa_level|; the -lists for lowel levels are kept in special save stack entries. - -@= -@!sa_chain: pointer; {chain of saved sparse array entries} -@!sa_level: quarterword; {group level for |sa_chain|} - -@ @= -sa_chain:=null; sa_level:=level_zero; - -@ The individual saved items are kept in pointer or word nodes similar -to those used for the array elements: a word node with value zero is, -however, saved as pointer node with the otherwise impossible |sa_index| -value |tok_val_limit|. - -@d sa_loc==sa_ref {location of saved item} - -@= -procedure sa_save(@!p:pointer); {saves value of |p|} -var q:pointer; {the new save node} -@!i:quarterword; {index field of node} -begin if cur_level<>sa_level then - begin check_full_save_stack; save_type(save_ptr):=restore_sa; - save_level(save_ptr):=sa_level; save_index(save_ptr):=sa_chain; - incr(save_ptr); sa_chain:=null; sa_level:=cur_level; - end; -i:=sa_index(p); -if i= -procedure sa_destroy(@!p:pointer); {destroy value of |p|} -begin if sa_index(p)null then - if sa_index(p)= -procedure sa_def(@!p:pointer;@!e:halfword); - {new data for sparse array elements} -begin add_sa_ref(p); -if sa_ptr(p)=e then - begin @!stat if tracing_assigns>0 then show_sa(p,"reassigning");@+tats@;@/ - sa_destroy(p); - end -else begin @!stat if tracing_assigns>0 then show_sa(p,"changing");@+tats@;@/ - if sa_lev(p)=cur_level then sa_destroy(p)@+else sa_save(p); - sa_lev(p):=cur_level; sa_ptr(p):=e; - @!stat if tracing_assigns>0 then show_sa(p,"into");@+tats@;@/ - end; -delete_sa_ref(p); -end; -@# -procedure sa_w_def(@!p:pointer;@!w:integer); -begin add_sa_ref(p); -if sa_int(p)=w then - begin @!stat if tracing_assigns>0 then show_sa(p,"reassigning");@+tats@;@/ - end -else begin @!stat if tracing_assigns>0 then show_sa(p,"changing");@+tats@;@/ - if sa_lev(p)<>cur_level then sa_save(p); - sa_lev(p):=cur_level; sa_int(p):=w; - @!stat if tracing_assigns>0 then show_sa(p,"into");@+tats@;@/ - end; -delete_sa_ref(p); -end; - -@ The |sa_def| and |sa_w_def| routines take care of local definitions. -@^global definitions@> -Global definitions are done in almost the same way, but there is no need -to save old values, and the new value is associated with |level_one|. - -@= -procedure gsa_def(@!p:pointer;@!e:halfword); {global |sa_def|} -begin add_sa_ref(p); -@!stat if tracing_assigns>0 then show_sa(p,"globally changing");@+tats@;@/ -sa_destroy(p); sa_lev(p):=level_one; sa_ptr(p):=e; -@!stat if tracing_assigns>0 then show_sa(p,"into");@+tats@;@/ -delete_sa_ref(p); -end; -@# -procedure gsa_w_def(@!p:pointer;@!w:integer); {global |sa_w_def|} -begin add_sa_ref(p); -@!stat if tracing_assigns>0 then show_sa(p,"globally changing");@+tats@;@/ -sa_lev(p):=level_one; sa_int(p):=w; -@!stat if tracing_assigns>0 then show_sa(p,"into");@+tats@;@/ -delete_sa_ref(p); -end; - -@ The |sa_restore| procedure restores the sparse array entries pointed -at by |sa_chain| - -@= -procedure sa_restore; -var p:pointer; {sparse array element} -begin repeat p:=sa_loc(sa_chain); -if sa_lev(p)=level_one then - begin if sa_index(p)>=dimen_val_limit then sa_destroy(sa_chain); - @!stat if tracing_restores>0 then show_sa(p,"retaining");@+tats@;@/ - end -else begin if sa_index(p)0 then show_sa(p,"restoring");@+tats@;@/ - end; -delete_sa_ref(p); -p:=sa_chain; sa_chain:=link(p); -if sa_index(p)= -begin cmd:=chr_code-mem_bot; -if cmd=int_val then print_esc("count") -else if cmd=dimen_val then print_esc("dimen") -else if cmd=glue_val then print_esc("skip") -else print_esc("muskip"); -end - -@ @= -print_esc("toks") - -@ @= -{empty section} - -@z diff --git a/Build/source/texk/web2c/alephdir/eo16bit.ch b/Build/source/texk/web2c/alephdir/eo16bit.ch new file mode 100644 index 00000000000..87872aa2d3e --- /dev/null +++ b/Build/source/texk/web2c/alephdir/eo16bit.ch @@ -0,0 +1,696 @@ +% This is an \Aleph change file; it brings \eTeX register numbers +% from 32767 ($2^{15}-1$) to 65535 ($2^{16}-1), to bring it on line +% with \Omega +% Noticeably, since Omega has 16-bit quarterwords, it is possible +% to do so without changing much. +% Notice that we do this for marks register: everything else is +% brought to level with Omega in eomem.ch +%---------------------------------------- +@x Section 53a onwards l.4600 +@ @= +max_reg_num:=32767; +max_reg_help_line:="A register number must be between 0 and 32767."; +@y +@ @= +max_reg_num:=65535; +max_reg_help_line:="A register number must be between 0 and 65535."; +@z +%---------------------------------------- +@x l.4607 +@ There are seven almost identical doubly linked trees, one for the +sparse array of the up to 32512 additional registers of each kind and +one for the sparse array of the up to 32767 additional mark classes. +The root of each such tree, if it exists, is an index node containing 16 +pointers to subtrees for 4096 consecutive array elements. Similar index +nodes are the starting points for all nonempty subtrees for 4096, 256, +and 16 consecutive array elements. These four levels of index nodes are +followed by a fifth level with nodes for the individual array elements. + +Each index node is nine words long. The pointers to the 16 possible +subtrees or are kept in the |info| and |link| fields of the last eight +words. (It would be both elegant and efficient to declare them as +array, unfortunately \PASCAL\ doesn't allow this.) + +The fields in the first word of each index node and in the nodes for the +array elements are closely related. The |link| field points to the next +lower index node and the |sa_index| field contains four bits (one +hexadecimal digit) of the register number or mark class. For the lowest +index node the |link| field is |null| and the |sa_index| field indicates +the type of quantity (|int_avl|, |dimen_val|, |glue_val|, |mu_val|, +|box_val|, |tok_val|, or |mark_val|). The |sa_used| field in the index +nodes counts how many of the 16 pointers are non-null. +@y +@ There is one doubly linked tree, to handle the sparse array of the up +to 65535 additional mark classes. +The root of the tree, if it exists, is an index node containing 16 +pointers to subtrees for 4096 consecutive array elements. Similar index +nodes are the starting points for all nonempty subtrees for 4096, 256, +and 16 consecutive array elements. These four levels of index nodes are +followed by a fifth level with nodes for the individual array elements. + +Each index node is nine words long. The pointers to the 16 possible +subtrees are kept in the |info| and |link| fields of the last eight +words. (It would be both elegant and efficient to declare them as +array, unfortunately \PASCAL\ doesn't allow this.) + +The fields in the first word of each index node and in the nodes for the +array elements are closely related. The |link| field points to the next +lower index node and the |sa_index| field contains eight bits (two +hexadecimal digits) of the mark class. For the lowest +index node the |link| field is |null| and the |sa_index| field indicates +the type of quantity (which is always |mark_val|). The |sa_used| field in the +index nodes counts how many of the 16 pointers are non-null. +@z +%---------------------------------------- +@x l.4630 +The |sa_index| field in the nodes for array elements contains the four +bits plus 16 times the type. Therefore such a node represents a count +or dimen register if and only if |sa_index= +@!sa_root:array[int_val..mark_val] of pointer; {roots of sparse arrays} +@!cur_ptr:pointer; {value returned by |new_index| and |find_sa_element|} +@!sa_null:memory_word; {two |null| pointers} + +@ @= +sa_mark:=null; sa_null.hh.lh:=null; sa_null.hh.rh:=null; + +@ @= +for i:=int_val to tok_val do sa_root[i]:=null; +@y +@ The root of the tree for the additional mark classes is kept +in |sa_mark|. + +@= +@!sa_mark:pointer; {pointer to sparse array of marks} +@!cur_ptr:pointer; {value returned by |new_index| and |find_sa_element|} +@!sa_null:memory_word; {two |null| pointers} + +@ @= +sa_mark:=null; sa_null.hh.lh:=null; sa_null.hh.rh:=null; +@z +%---------------------------------------- +@x l.4681 +@ Given a type |t| and a sixteen-bit number |n|, the |find_sa_element| +procedure returns (in |cur_ptr|) a pointer to the node for the +corresponding array element, or |null| when no such element exists. The +third parameter |w| is set |true| if the element must exist, e.g., +because it is about to be modified. The procedure has two main +branches: one follows the existing tree structure, the other (only used +when |w| is |true|) creates the missing nodes. + +We use macros to extract the four-bit pieces from a sixteen-bit register +number or mark class and to fetch or store one of the 16 pointers from +an index node. + +@d if_cur_ptr_is_null_then_return_or_goto(#)== {some tree element is missing} + begin if cur_ptr=null then + if w then goto #@+else return; + end +@# +@d hex_dig1(#)==# div 4096 {the fourth lowest hexadecimal digit} +@d hex_dig2(#)==(# div 256) mod 16 {the third lowest hexadecimal digit} +@d hex_dig3(#)==(# div 16) mod 16 {the second lowest hexadecimal digit} +@d hex_dig4(#)==# mod 16 {the lowest hexadecimal digit} +@# +@d get_sa_ptr==if odd(i) then cur_ptr:=link(q+(i div 2)+1) + else cur_ptr:=info(q+(i div 2)+1) + {set |cur_ptr| to the pointer indexed by |i| from index node |q|} +@d put_sa_ptr(#)==if odd(i) then link(q+(i div 2)+1):=# + else info(q+(i div 2)+1):=# + {store the pointer indexed by |i| in index node |q|} +@d add_sa_ptr==begin put_sa_ptr(cur_ptr); incr(sa_used(q)); + end {add |cur_ptr| as the pointer indexed by |i| in index node |q|} +@d delete_sa_ptr==begin put_sa_ptr(null); decr(sa_used(q)); + end {delete the pointer indexed by |i| in index node |q|} + +@= +procedure find_sa_element(@!t:small_number;@!n:halfword;@!w:boolean); + {sets |cur_val| to sparse array element location or |null|} +label not_found,not_found1,not_found2,not_found3,not_found4,exit; +var q:pointer; {for list manipulations} +@!i:small_number; {a four bit index} +begin cur_ptr:=sa_root[t]; +if_cur_ptr_is_null_then_return_or_goto(not_found);@/ +q:=cur_ptr; i:=hex_dig1(n); get_sa_ptr; +if_cur_ptr_is_null_then_return_or_goto(not_found1);@/ +q:=cur_ptr; i:=hex_dig2(n); get_sa_ptr; +if_cur_ptr_is_null_then_return_or_goto(not_found2);@/ +q:=cur_ptr; i:=hex_dig3(n); get_sa_ptr; +if_cur_ptr_is_null_then_return_or_goto(not_found3);@/ +q:=cur_ptr; i:=hex_dig4(n); get_sa_ptr; +if (cur_ptr=null)and w then goto not_found4; +return; +not_found: new_index(t,null); {create first level index node} +sa_root[t]:=cur_ptr; q:=cur_ptr; i:=hex_dig1(n); +not_found1: new_index(i,q); {create second level index node} +add_sa_ptr; q:=cur_ptr; i:=hex_dig2(n); +not_found2: new_index(i,q); {create third level index node} +add_sa_ptr; q:=cur_ptr; i:=hex_dig3(n); +not_found3: new_index(i,q); {create fourth level index node} +add_sa_ptr; q:=cur_ptr; i:=hex_dig4(n); +not_found4: @; +link(cur_ptr):=q; add_sa_ptr; +exit:end; + +@ The array elements for registers are subject to grouping and have an +|sa_lev| field (quite analogous to |eq_level|) instead of |sa_used|. +Since saved values as well as shorthand definitions (created by e.g., +\.{\\countdef}) refer to the location of the respective array element, +we need a reference count that is kept in the |sa_ref| field. An array +element can be deleted (together with all references to it) when its +|sa_ref| value is |null| and its value is the default value. +@^reference counts@> + +Skip, muskip, box, and token registers use two word nodes, their values +are stored in the |sa_ptr| field. +Count and dimen registers use three word nodes, their +values are stored in the |sa_int| resp.\ |sa_dim| field in the third +word; the |sa_ptr| field is used under the name |sa_num| to store +the register number. Mark classes use four word nodes. The last three +words contain the five types of current marks + +@d sa_lev==sa_used {grouping level for the current value} +@d pointer_node_size=2 {size of an element with a pointer value} +@d sa_type(#)==(sa_index(#) div 16) {type part of combined type/index} +@d sa_ref(#)==info(#+1) {reference count of a sparse array element} +@d sa_ptr(#)==link(#+1) {a pointer value} +@# +@d word_node_size=3 {size of an element with a word value} +@d sa_num==sa_ptr {the register number} +@d sa_int(#)==mem[#+2].int {an integer} +@d sa_dim(#)==mem[#+2].sc {a dimension (a somewhat esotheric distinction)} +@# +@d mark_class_node_size=4 {size of an element for a mark class} +@# +@d fetch_box(#)== {fetch |box(cur_val)|} + if cur_val<256 then #:=box(cur_val) + else begin find_sa_element(box_val,cur_val,false); + if cur_ptr=null then #:=null@+else #:=sa_ptr(cur_ptr); + end + +@= +if t=mark_val then {a mark class} + begin cur_ptr:=get_node(mark_class_node_size); + mem[cur_ptr+1]:=sa_null; mem[cur_ptr+2]:=sa_null; mem[cur_ptr+3]:=sa_null; + end +else begin if t<=dimen_val then {a count or dimen register} + begin cur_ptr:=get_node(word_node_size); sa_int(cur_ptr):=0; + sa_num(cur_ptr):=n; + end + else begin cur_ptr:=get_node(pointer_node_size); + if t<=mu_val then {a skip or muskip register} + begin sa_ptr(cur_ptr):=zero_glue; add_glue_ref(zero_glue); + end + else sa_ptr(cur_ptr):=null; {a box or token list register} + end; + sa_ref(cur_ptr):=null; {all registers have a reference count} + end; +sa_index(cur_ptr):=16*t+i; sa_lev(cur_ptr):=level_one + +@ The |delete_sa_ref| procedure is called when a pointer to an array +element representing a register is being removed; this means that the +reference count should be decreased by one. If the reduced reference +count is |null| and the register has been (globally) assigned its +default value the array element should disappear, possibly together with +some index nodes. This procedure will never be used for mark class +nodes. +@^reference counts@> + +@d add_sa_ref(#)==incr(sa_ref(#)) {increase reference count} +@# +@d change_box(#)== {change |box(cur_val)|, the |eq_level| stays the same} + if cur_val<256 then set_equiv(box_base+cur_val,#)@+else set_sa_box(#) +@# + +{ FIXME: needs debugging (sparse arrays) } +@d set_sa_box(#)==begin find_sa_element(box_val,cur_val,false); + if cur_ptr<>0 then + begin + set_equiv(sa_ptr(cur_ptr),#); + add_sa_ref(cur_ptr); + delete_sa_ref(cur_ptr); + end; + end + +@= +procedure delete_sa_ref(@!q:pointer); {reduce reference count} +label exit; +var p:pointer; {for list manipulations} +@!i:small_number; {a four bit index} +@!s:small_number; {size of a node} +begin decr(sa_ref(q)); +if sa_ref(q)<>null then return; +if sa_index(q)null then return; + s:=pointer_node_size; + end; +repeat i:=hex_dig4(sa_index(q)); p:=q; q:=link(p); free_node(p,s); +if q=null then {the whole tree has been freed} + begin sa_root[i]:=null; return; + end; +delete_sa_ptr; s:=index_node_size; {node |q| is an index node} +until sa_used(q)>0; +exit:end; + +@ The |print_sa_num| procedure prints the register number corresponding +to an array element. + +@= +procedure print_sa_num(@!q:pointer); {print register number} +var @!n:halfword; {the register number} +begin if sa_index(q)= +@!stat procedure show_sa(@!p:pointer;@!s:str_number); +var t:small_number; {the type of element} +begin begin_diagnostic; print_char("{"); print(s); print_char(" "); +if p=null then print_char("?") {this can't happen} +else begin t:=sa_type(p); + if tnull then show_token_list(link(p),null,32); + end + else print_char("?"); {this can't happen either} + end; + end; +print_char("}"); end_diagnostic(false); +end; +tats +@y +@ Given a type |t| (which is always |mark_val|) and a sixteen-bit number |n|, +the |find_sa_element| procedure returns (in |cur_ptr|) a pointer to the node +for the corresponding array element, or |null| when no such element exists. +The third parameter |w| is set |true| if the element must exist, e.g., because +it is about to be modified. The procedure has two main branches: one follows +the existing tree structure, the other (only used when |w| is |true|) creates +the missing nodes. + +We use macros to extract the four-bit pieces from a sixteen-bit register +number or mark class and to fetch or store one of the 16 pointers from +an index node. + +@d if_cur_ptr_is_null_then_return_or_goto(#)== {some tree element is missing} + begin if cur_ptr=null then + if w then goto #@+else return; + end +@# +{FIXME: needs debugging} +@d hex_dig1(#)==# div 4096 {the fourth lowest hexadecimal digit} +@d hex_dig2(#)==(# div 256) mod 16 {the third lowest hexadecimal digit} +@d hex_dig3(#)==(# div 16) mod 16 {the second lowest hexadecimal digit} +@d hex_dig4(#)==# mod 16 {the lowest hexadecimal digit} +@# +@d get_sa_ptr==if odd(i) then cur_ptr:=link(q+(i div 2)+1) + else cur_ptr:=info(q+(i div 2)+1) + {set |cur_ptr| to the pointer indexed by |i| from index node |q|} +@d put_sa_ptr(#)==if odd(i) then link(q+(i div 2)+1):=# + else info(q+(i div 2)+1):=# + {store the pointer indexed by |i| in index node |q|} +@d add_sa_ptr==begin put_sa_ptr(cur_ptr); incr(sa_used(q)); + end {add |cur_ptr| as the pointer indexed by |i| in index node |q|} +@d delete_sa_ptr==begin put_sa_ptr(null); decr(sa_used(q)); + end {delete the pointer indexed by |i| in index node |q|} + +@= +procedure find_sa_element(@!t:small_number;@!n:halfword;@!w:boolean); + {sets |cur_val| to sparse array element location or |null|} +label not_found,not_found1,not_found2,not_found3,not_found4,exit; +var q:pointer; {for list manipulations} +@!i:small_number; {a four bit index} +begin +begin if t<>mark_val then begin + cur_ptr:=null; + return; +end; end; +cur_ptr:=sa_mark; +if_cur_ptr_is_null_then_return_or_goto(not_found);@/ +q:=cur_ptr; i:=hex_dig1(n); get_sa_ptr; +if_cur_ptr_is_null_then_return_or_goto(not_found1);@/ +q:=cur_ptr; i:=hex_dig2(n); get_sa_ptr; +if_cur_ptr_is_null_then_return_or_goto(not_found2);@/ +q:=cur_ptr; i:=hex_dig3(n); get_sa_ptr; +if_cur_ptr_is_null_then_return_or_goto(not_found3);@/ +q:=cur_ptr; i:=hex_dig4(n); get_sa_ptr; +if (cur_ptr=null)and w then goto not_found4; +return; +not_found: new_index(t,null); {create first level index node} +sa_mark:=cur_ptr; q:=cur_ptr; i:=hex_dig1(n); +not_found1: new_index(i,q); {create second level index node} +add_sa_ptr; q:=cur_ptr; i:=hex_dig2(n); +not_found2: new_index(i,q); {create third level index node} +add_sa_ptr; q:=cur_ptr; i:=hex_dig3(n); +not_found3: new_index(i,q); {create fourth level index node} +add_sa_ptr; q:=cur_ptr; i:=hex_dig4(n); +not_found4: @; +link(cur_ptr):=q; add_sa_ptr; +exit:end; + +@ FIXME OBSOLETE The array elements for registers are subject to grouping and have an +|sa_lev| field (quite analogous to |eq_level|) instead of |sa_used|. +Since saved values as well as shorthand definitions (created by e.g., +\.{\\countdef}) refer to the location of the respective array element, +we need a reference count that is kept in the |sa_ref| field. An array +element can be deleted (together with all references to it) when its +|sa_ref| value is |null| and its value is the default value. +@^reference counts@> + +Skip, muskip, box, and token registers use two word nodes, their values +are stored in the |sa_ptr| field. +Count and dimen registers use three word nodes, their +values are stored in the |sa_int| resp.\ |sa_dim| field in the third +word; the |sa_ptr| field is used under the name |sa_num| to store +the register number. + +@ Mark classes use four word nodes. The last three +words contain the five types of current marks + +@d sa_lev==sa_used {grouping level for the current value} +@d pointer_node_size=2 {size of an element with a pointer value} +@d sa_type(#)==(sa_index(#) div 256) {type part of combined type/index} +@d sa_ref(#)==info(#+1) {reference count of a sparse array element} +@d sa_ptr(#)==link(#+1) {a pointer value} +@# +{FIXME: will be removed} +@d word_node_size=3 {size of an element with a word value} +@d sa_num==sa_ptr {the register number} +@d sa_int(#)==mem[#+2].int {an integer} +@d sa_dim(#)==mem[#+2].sc {a dimension (a somewhat esotheric distinction)} +@# +@d mark_class_node_size=4 {size of an element for a mark class} +@# +{FIXME: will be removed} +@d fetch_box(#)== {fetch |box(cur_val)|} + if cur_val= +if t=mark_val then {a mark class} + begin cur_ptr:=get_node(mark_class_node_size); + mem[cur_ptr+1]:=sa_null; mem[cur_ptr+2]:=sa_null; mem[cur_ptr+3]:=sa_null; + end; +{ +|else begin if t<=dimen_val then| {a count or dimen register} +| begin cur_ptr:=get_node(word_node_size); sa_int(cur_ptr):=0;| +| sa_num(cur_ptr):=n;| +| end| +| else begin cur_ptr:=get_node(pointer_node_size);| +| if t<=mu_val then| {a skip or muskip register} +| begin sa_ptr(cur_ptr):=zero_glue; add_glue_ref(zero_glue);| +| end| +| else sa_ptr(cur_ptr):=null; |{a box or token list register} +| end;| +| sa_ref(cur_ptr):=null;| {all registers have a reference count} +| end;| +} +sa_index(cur_ptr):=256*t+i; sa_lev(cur_ptr):=level_one + +@ The |delete_sa_ref| procedure is called when a pointer to an array +element representing a register is being removed; this means that the +reference count should be decreased by one. If the reduced reference +count is |null| and the register has been (globally) assigned its +default value the array element should disappear, possibly together with +some index nodes. This procedure will never be used for mark class +nodes. +@^reference counts@> + +@d add_sa_ref(#)==incr(sa_ref(#)) {increase reference count} +@# +@d change_box(#)== {change |box(cur_val)|, the |eq_level| stays the same} + set_equiv(box_base+cur_val,#) +@# + +{FIXME: will be removed} +@d set_sa_box(#)==begin find_sa_element(box_val,cur_val,false); + if cur_ptr<>0 then + begin + set_equiv(sa_ptr(cur_ptr),#); + add_sa_ref(cur_ptr); + delete_sa_ref(cur_ptr); + end; + end + +@= +procedure delete_sa_ref(@!q:pointer); {reduce reference count} +label exit; +var p:pointer; {for list manipulations} +@!i:small_number; {a four bit index} +@!s:small_number; {size of a node} +begin decr(sa_ref(q)); +if sa_ref(q)<>null then return; +if false then {was |if sa_index(q)null then return; + s:=pointer_node_size; + end; +repeat i:=hex_dig4(sa_index(q)); p:=q; q:=link(p); free_node(p,s); +if q=null then {the whole tree has been freed} + begin + sa_mark:=null {was |sa_root[i]:=null|}; return; + end; +delete_sa_ptr; s:=index_node_size; {node |q| is an index node} +until sa_used(q)>0; +exit:end; + +@ The |print_sa_num| procedure prints the register number corresponding +to an array element. + +@= +procedure print_sa_num(@!q:pointer); {print register number} +var @!n:halfword; {the register number} +begin if false {was |sa_index(q)= +@!stat procedure show_sa(@!p:pointer;@!s:str_number); +var t:small_number; {the type of element} +begin begin_diagnostic; print_char("{"); print(s); print_char(" "); +{ +|if p=null then print_char("?")| {this can't happen} +|else begin t:=sa_type(p);| +| if tnull then show_token_list(link(p),null,32);| +| end| +| else print_char("?");| {this can't happen either} +| end;| +| end;| +} +print_char("}"); end_diagnostic(false); +end; +tats +@z +%---------------------------------------- +% TODO: l.5029+: will the simply be removed? +% (i.e.: cases which cannot happen (anymore)?) +%---------------------------------------- +@x +procedure sa_save(@!p:pointer); {saves value of |p|} +var q:pointer; {the new save node} +@!i:quarterword; {index field of node} +begin if cur_level<>sa_level then + begin check_full_save_stack; save_type(save_ptr):=restore_sa; + save_level(save_ptr):=sa_level; save_index(save_ptr):=sa_chain; + incr(save_ptr); sa_chain:=null; sa_level:=cur_level; + end; +i:=sa_index(p); +if i= +procedure sa_destroy(@!p:pointer); {destroy value of |p|} +begin if sa_index(p)null then + if sa_index(p)sa_level then + begin check_full_save_stack; save_type(save_ptr):=restore_sa; + save_level(save_ptr):=sa_level; save_index(save_ptr):=sa_chain; + incr(save_ptr); sa_chain:=null; sa_level:=cur_level; + end; +i:=sa_index(p); +if false {was |i= +procedure sa_destroy(@!p:pointer); {destroy value of |p|} +begin if false {was |sa_index(p)null then + if false {was |sa_index(p)=dimen_val_limit then sa_destroy(sa_chain); + @!stat if tracing_restores>0 then show_sa(p,"retaining");@+tats@;@/ + end +else begin if sa_index(p)0 then show_sa(p,"restoring");@+tats@;@/ + end; +delete_sa_ref(p); +p:=sa_chain; sa_chain:=link(p); +if sa_index(p)=dimen_val_limit then|} sa_destroy(sa_chain); + @!stat if tracing_restores>0 then show_sa(p,"retaining");@+tats@;@/ + end +else begin if false {was |sa_index(p)0 then show_sa(p,"restoring");@+tats@;@/ + end; +delete_sa_ref(p); +p:=sa_chain; sa_chain:=link(p); +if false {was |sa_index(p) primitives -%--------------------------------------- -@x -@d assign_font_dimen=assign_mu_glue+1 - {user-defined font dimension ( \.{\\fontdimen} )} -@y -@d assign_font_dimen=assign_mu_glue+1 - {font dimension ( \.{\\fontdimen} ), \.{\\charwd}, \.{\\charht}, etc} -@d font_dimen_code=0 -@d char_width_code=font_dimen_code+1 -@d char_height_code=char_width_code+1 -@d char_depth_code=char_height_code+1 -@d char_italic_code=char_depth_code+1 -@z -%--------------------------------------- -@x [26] m.416 l.8407 - Omega char dimensions -primitive("fontdimen",assign_font_dimen,0);@/ -@!@:font_dimen_}{\.{\\fontdimen} primitive@> -@y -primitive("fontdimen",assign_font_dimen,font_dimen_code);@/ -@!@:font_dimen_}{\.{\\fontdimen} primitive@> -primitive("charwd",assign_font_dimen,char_width_code);@/ -@!@:char_width_}{\.{\\charwd} primitive@> -primitive("charht",assign_font_dimen,char_height_code);@/ -@!@:char_height_}{\.{\\charht} primitive@> -primitive("chardp",assign_font_dimen,char_depth_code);@/ -@!@:char_depth_}{\.{\\chardp} primitive@> -primitive("charit",assign_font_dimen,char_italic_code);@/ -@!@:char_italic_}{\.{\\charit} primitive@> -@z -%--------------------------------------- -@x [26] m.416 l.8425 - Omega char dimensions -assign_font_dimen: print_esc("fontdimen"); -@y -assign_font_dimen: if chr_code=font_dimen_code then print_esc("fontdimen") -else if chr_code=char_width_code then print_esc("charwd") -else if chr_code=char_height_code then print_esc("charht") -else if chr_code=char_depth_code then print_esc("chardp") -else if chr_code=char_italic_code then print_esc("charit") -else print("[unknown fontdimen code!]"); -@z -%--------------------------------------- -@x CLEAN UP FROM OMEGA -primitive("charwd",set_box_dimen,(width_offset+3)); -@!@:charwd_}{\.{\\charwd} primitive@> -primitive("charht",set_box_dimen,(height_offset+3)); -@!@:charht_}{\.{\\charht} primitive@> -primitive("chardp",set_box_dimen,(depth_offset+3)); -@!@:chardp_}{\.{\\chardp} primitive@> -primitive("charit",set_box_dimen,(depth_offset+4)); -@!@:charit_}{\.{\\charit} primitive@> -@y -@z -%--------------------------------------- -@x -else if chr_code=(width_offset+3) then print_esc("charwd") -else if chr_code=(height_offset+3) then print_esc("charht") -else if chr_code=(depth_offset+3) then print_esc("chardp") -else print_esc("charit"); -@y -else print("[unknown box dimen!]"); -@z -%--------------------------------------- -@x -@ @= -if m<=3 then -begin - scan_register_num; - fetch_box(q); - if q=null then cur_val:=0 @+else - cur_val:=mem[q+m].sc; - cur_val_level:=dimen_val; -end -else -begin - scan_char_num; - if m=(width_offset+3) then begin - cur_val:= char_width(main_f)(char_info(main_f)(cur_val)) - end - else if m=(height_offset+3) then begin - cur_val:= char_height(main_f)(height_depth(char_info(main_f)(cur_val))) - end - else if m=(depth_offset+3) then begin - cur_val:= char_depth(main_f)(height_depth(char_info(main_f)(cur_val))) - end - else begin - cur_val:= char_italic(main_f)(char_info(main_f)(cur_val)); - end; - cur_val_level:=dimen_val; -end -@y -@ @= -if m<=height_offset then begin - scan_register_num; - fetch_box(q); - if q=null then cur_val:=0 @+else - cur_val:=mem[q+m].sc; - cur_val_level:=dimen_val; -end -else begin - confusion("boxdimen"); - { something wrong with the code ...} -end -@z -%--------------------------------------- -@x [26] m.419 l.8461 - Omega char dimensions -@ @= -begin find_font_dimen(false); -font_info(dimen_font)(font_file_size(dimen_font)).sc:=0; -scanned_result(font_info(dimen_font)(cur_val).sc)(dimen_val); -end -@y -@ @= -if m=font_dimen_code then begin find_font_dimen(false); - font_info(dimen_font)(font_file_size(dimen_font)).sc:=0; - scanned_result(font_info(dimen_font)(cur_val).sc)(dimen_val); - end -else - begin scan_char_num; - if m=char_width_code then begin - cur_val:= char_width(main_f)(char_info(main_f)(cur_val)) - end - else if m=char_height_code then begin - cur_val:= char_height(main_f)(height_depth(char_info(main_f)(cur_val))) - end - else if m=char_depth_code then begin - cur_val:= char_depth(main_f)(height_depth(char_info(main_f)(cur_val))) - end - else if m=char_italic_code then begin - cur_val:= char_italic(main_f)(char_info(main_f)(cur_val)); - end - else confusion("fontdimen"); - cur_val_level:=dimen_val; - end -@z -%--------------------------------------- -@x -assign_font_dimen: begin find_font_dimen(true); k:=cur_val; - scan_optional_equals; scan_normal_dimen; - font_info(dimen_font)(k).sc:=cur_val; - end; -@y -assign_font_dimen: begin - n:=cur_chr; - if n=font_dimen_code then begin - find_font_dimen(true); k:=cur_val; - scan_optional_equals; scan_normal_dimen; - font_info(dimen_font)(k).sc:=cur_val; - end - else begin - print_err("Invalid dimension assignment"); - help2("You tried to assign a character dimension.")@/ - ("This is not allowed. Proceed; I'll ignore the assignment."); - error; - scan_char_num; scan_optional_equals; scan_normal_dimen; - end -end; -@z diff --git a/Build/source/texk/web2c/alephdir/eochar.ch b/Build/source/texk/web2c/alephdir/eochar.ch new file mode 100644 index 00000000000..8c6fba10ada --- /dev/null +++ b/Build/source/texk/web2c/alephdir/eochar.ch @@ -0,0 +1,158 @@ +% Fix the Omega \char<..> primitives +%--------------------------------------- +@x +@d assign_font_dimen=assign_mu_glue+1 + {user-defined font dimension ( \.{\\fontdimen} )} +@y +@d assign_font_dimen=assign_mu_glue+1 + {font dimension ( \.{\\fontdimen} ), \.{\\charwd}, \.{\\charht}, etc} +@d font_dimen_code=0 +@d char_width_code=font_dimen_code+1 +@d char_height_code=char_width_code+1 +@d char_depth_code=char_height_code+1 +@d char_italic_code=char_depth_code+1 +@z +%--------------------------------------- +@x [26] m.416 l.8407 - Omega char dimensions +primitive("fontdimen",assign_font_dimen,0);@/ +@!@:font_dimen_}{\.{\\fontdimen} primitive@> +@y +primitive("fontdimen",assign_font_dimen,font_dimen_code);@/ +@!@:font_dimen_}{\.{\\fontdimen} primitive@> +primitive("charwd",assign_font_dimen,char_width_code);@/ +@!@:char_width_}{\.{\\charwd} primitive@> +primitive("charht",assign_font_dimen,char_height_code);@/ +@!@:char_height_}{\.{\\charht} primitive@> +primitive("chardp",assign_font_dimen,char_depth_code);@/ +@!@:char_depth_}{\.{\\chardp} primitive@> +primitive("charit",assign_font_dimen,char_italic_code);@/ +@!@:char_italic_}{\.{\\charit} primitive@> +@z +%--------------------------------------- +@x [26] m.416 l.8425 - Omega char dimensions +assign_font_dimen: print_esc("fontdimen"); +@y +assign_font_dimen: if chr_code=font_dimen_code then print_esc("fontdimen") +else if chr_code=char_width_code then print_esc("charwd") +else if chr_code=char_height_code then print_esc("charht") +else if chr_code=char_depth_code then print_esc("chardp") +else if chr_code=char_italic_code then print_esc("charit") +else print("[unknown fontdimen code!]"); +@z +%--------------------------------------- +@x CLEAN UP FROM OMEGA +primitive("charwd",set_box_dimen,(width_offset+3)); +@!@:charwd_}{\.{\\charwd} primitive@> +primitive("charht",set_box_dimen,(height_offset+3)); +@!@:charht_}{\.{\\charht} primitive@> +primitive("chardp",set_box_dimen,(depth_offset+3)); +@!@:chardp_}{\.{\\chardp} primitive@> +primitive("charit",set_box_dimen,(depth_offset+4)); +@!@:charit_}{\.{\\charit} primitive@> +@y +@z +%--------------------------------------- +@x +else if chr_code=(width_offset+3) then print_esc("charwd") +else if chr_code=(height_offset+3) then print_esc("charht") +else if chr_code=(depth_offset+3) then print_esc("chardp") +else print_esc("charit"); +@y +else print("[unknown box dimen!]"); +@z +%--------------------------------------- +@x +@ @= +if m<=3 then +begin + scan_register_num; + fetch_box(q); + if q=null then cur_val:=0 @+else + cur_val:=mem[q+m].sc; + cur_val_level:=dimen_val; +end +else +begin + scan_char_num; + if m=(width_offset+3) then begin + cur_val:= char_width(main_f)(char_info(main_f)(cur_val)) + end + else if m=(height_offset+3) then begin + cur_val:= char_height(main_f)(height_depth(char_info(main_f)(cur_val))) + end + else if m=(depth_offset+3) then begin + cur_val:= char_depth(main_f)(height_depth(char_info(main_f)(cur_val))) + end + else begin + cur_val:= char_italic(main_f)(char_info(main_f)(cur_val)); + end; + cur_val_level:=dimen_val; +end +@y +@ @= +if m<=height_offset then begin + scan_register_num; + fetch_box(q); + if q=null then cur_val:=0 @+else + cur_val:=mem[q+m].sc; + cur_val_level:=dimen_val; +end +else begin + confusion("boxdimen"); + { something wrong with the code ...} +end +@z +%--------------------------------------- +@x [26] m.419 l.8461 - Omega char dimensions +@ @= +begin find_font_dimen(false); +font_info(dimen_font)(font_file_size(dimen_font)).sc:=0; +scanned_result(font_info(dimen_font)(cur_val).sc)(dimen_val); +end +@y +@ @= +if m=font_dimen_code then begin find_font_dimen(false); + font_info(dimen_font)(font_file_size(dimen_font)).sc:=0; + scanned_result(font_info(dimen_font)(cur_val).sc)(dimen_val); + end +else + begin scan_char_num; + if m=char_width_code then begin + cur_val:= char_width(main_f)(char_info(main_f)(cur_val)) + end + else if m=char_height_code then begin + cur_val:= char_height(main_f)(height_depth(char_info(main_f)(cur_val))) + end + else if m=char_depth_code then begin + cur_val:= char_depth(main_f)(height_depth(char_info(main_f)(cur_val))) + end + else if m=char_italic_code then begin + cur_val:= char_italic(main_f)(char_info(main_f)(cur_val)); + end + else confusion("fontdimen"); + cur_val_level:=dimen_val; + end +@z +%--------------------------------------- +@x +assign_font_dimen: begin find_font_dimen(true); k:=cur_val; + scan_optional_equals; scan_normal_dimen; + font_info(dimen_font)(k).sc:=cur_val; + end; +@y +assign_font_dimen: begin + n:=cur_chr; + if n=font_dimen_code then begin + find_font_dimen(true); k:=cur_val; + scan_optional_equals; scan_normal_dimen; + font_info(dimen_font)(k).sc:=cur_val; + end + else begin + print_err("Invalid dimension assignment"); + help2("You tried to assign a character dimension.")@/ + ("This is not allowed. Proceed; I'll ignore the assignment."); + error; + scan_char_num; scan_optional_equals; scan_normal_dimen; + end +end; +@z diff --git a/Build/source/texk/web2c/alephdir/eomem-rc1.ch b/Build/source/texk/web2c/alephdir/eomem-rc1.ch deleted file mode 100644 index 6bba75066b1..00000000000 --- a/Build/source/texk/web2c/alephdir/eomem-rc1.ch +++ /dev/null @@ -1,321 +0,0 @@ -% vim ft=ch -% This file is part of the e-Omega project -% Purpouse of this file: adapting e-TeX to Omega memory management -% Most registers are reverted to the Omega model. The only exception -% is markings. -%--------------------------------------- - @x eobase.ch l.672 -begin if eTeX_ex and(eqtb[p].int=w) then - @y -begin if eTeX_ex and(new_eqtb_int(p)=w) then - @z -%--------------------------------------- -@x eobase.ch l.1071 - if m=mem_bot then - begin scan_register_num; - if cur_val<256 then cur_val:=equiv(toks_base+cur_val) - else begin find_sa_element(tok_val,cur_val,false); - if cur_ptr=null then cur_val:=null - else cur_val:=sa_ptr(cur_ptr); - end; - end - else cur_val:=sa_ptr(m) - else cur_val:=equiv(m); - cur_val_level:=tok_val; -@y - begin scan_eight_bit_int; m:=toks_base+cur_val; - end; - scanned_result(equiv(m))(tok_val); -@z -%---------------------------------------- -@x l.1220 -begin if (mlo_mem_stat_max) then - begin cur_val_level:=sa_type(m); - if cur_val_level255 then - begin find_sa_element(cur_val_level,cur_val,false); - if cur_ptr=null then - if cur_val_level1) then tracing_online:=1; -@y - if eTeX_ex and(tracing_lost_chars>1) then set_new_eqtb_int(int_base+tracing_online_code,1); -@z -%---------------------------------------- -@x - tracing_online:=old_setting; -@y - set_new_eqtb_int(int_base+tracing_online_code,old_setting); -@z -%---------------------------------------- -@x eobase.ch l.2309 -begin if box_contextcopy_code then @; -c:=cur_chr; scan_register_num; fetch_box(p); -@y -begin if cur_chr>copy_code then @; -c:=cur_chr; scan_eight_bit_int; p:=box(cur_val); -@z -%--------------------------------------- -@x eobase.ch l.2431 -else begin link(tail):=list_ptr(p); -change_box(null); -@y -else begin link(tail):=list_ptr(p); -set_equiv(box_base+cur_val,null); -@z -%---------------------------------------- -@x eobase.ch l.2698 - othercases begin scan_register_num; - if cur_val>255 then - begin j:=n-count_def_code; {|int_val..box_val|} - if j>mu_val then j:=tok_val; {|int_val..mu_val| or |tok_val|} - find_sa_element(j,cur_val,true); add_sa_ref(cur_ptr); - if j=tok_val then j:=toks_register@+else j:=register; - define(p,j,cur_ptr); - end - else -@y - othercases begin scan_eight_bit_int; -@z -%--------------------------------------- -@x eobase.ch l.2726 - e:=false; {just in case, will be set |true| for sparse array elements} - if cur_cmd=toks_register then - if cur_chr=mem_bot then - begin scan_register_num; - if cur_val>255 then - begin find_sa_element(tok_val,cur_val,true); - cur_chr:=cur_ptr; e:=true; - end - else cur_chr:=toks_base+cur_val; - end - else e:=true; - p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots} -@y - if cur_cmd=toks_register then - begin scan_eight_bit_int; p:=toks_base+cur_val; - end - else p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots} -@z -%--------------------------------------- -@x eobase.ch l.2746 - begin sa_define(p,null)(p,undefined_cs,null); free_avail(def_ref); - end - else begin if (p=output_routine_loc)and not e then {enclose in curlies} -@y - begin define(p,undefined_cs,null); free_avail(def_ref); - end - else begin if p=output_routine_loc then {enclose in curlies} -@z -%--------------------------------------- -@x eobase.ch l.2754 - sa_define(p,def_ref)(p,call,def_ref); -@y - define(p,call,def_ref); -@z -%--------------------------------------- -@x eobase.ch l.2770 -if (cur_cmd=toks_register)or(cur_cmd=assign_toks) then - begin if cur_cmd=toks_register then - if cur_chr=mem_bot then - begin scan_register_num; - if cur_val<256 then q:=equiv(toks_base+cur_val) - else begin find_sa_element(tok_val,cur_val,false); - if cur_ptr=null then q:=null - else q:=sa_ptr(cur_ptr); - end; - end - else q:=sa_ptr(cur_ptr) - else q:=equiv(cur_chr); - if q=null then sa_define(p,null)(p,undefined_cs,null) - else begin add_token_ref(q); sa_define(p,q)(p,call,q); - end; - goto done; - end -@y -begin if cur_cmd=toks_register then - begin scan_eight_bit_int; cur_cmd:=assign_toks; cur_chr:=toks_base+cur_val; - end; -if cur_cmd=assign_toks then - begin q:=equiv(cur_chr); - if q=null then define(p,undefined_cs,null) - else begin add_token_ref(q); define(p,call,q); - end; - goto done; - end; -end -@z -%--------------------------------------- -@x eobase.ch l.2792 -@!e:boolean; {does |l| refer to a sparse array element?} -@!w:integer; {integer or dimen value of |l|} -begin q:=cur_cmd; -e:=false; {just in case, will be set |true| for sparse array elements} -@y -begin q:=cur_cmd; -@z -%---------------------------------------- -@x eobase.ch l.2802 -if plo_mem_stat_max) then - begin l:=cur_chr; p:=sa_type(l); e:=true; - end -else begin p:=cur_chr-mem_bot; scan_register_num; - if cur_val>255 then - begin find_sa_element(p,cur_val,true); l:=cur_ptr; e:=true; - end - else -@y -p:=cur_chr; scan_eight_bit_int; -@z -%--------------------------------------- -@x eobase.ch l.2823 - end; -end; -found: if pnull then mem[b+c].sc:=cur_val; -@y -@!b:eight_bits; {box number} -begin c:=cur_chr; scan_eight_bit_int; b:=cur_val; scan_optional_equals; -scan_normal_dimen; -if box(b)<>null then mem[box(b)+c].sc:=cur_val; -@z -%--------------------------------------- -@x [49] m.1296 l.23637 - e-TeX sparse arrays -begin scan_register_num; fetch_box(p); begin_diagnostic; -print_nl("> \box"); print_int(cur_val); print_char("="); -if p=null then print("void")@+else show_box(p); -@y -begin scan_eight_bit_int; begin_diagnostic; -print_nl("> \box"); print_int(cur_val); print_char("="); -if box(cur_val)=null then print("void") -else show_box(box(cur_val)); -@z -%---------------------------------------- -@x eobase.ch l.2979 -if eTeX_ex then for k:=int_val to tok_val do dump_int(sa_root[k]); -@y -@z -%---------------------------------------- -@x eobase.ch l.2986 -if eTeX_ex then for k:=int_val to tok_val do - undump(null)(lo_mem_max)(sa_root[k]); -@y -@z -@x l. 3132 -for j:=0 to eTeX_states-1 do eTeX_state(j):=0; {disable all enhancements} -@y -for j:=0 to eTeX_states-1 do set_new_eqtb_int(eTeX_state_base+j,0); {disable all enhancements} -@z diff --git a/Build/source/texk/web2c/alephdir/eomem-rc2.ch b/Build/source/texk/web2c/alephdir/eomem-rc2.ch deleted file mode 100644 index dd91d3128be..00000000000 --- a/Build/source/texk/web2c/alephdir/eomem-rc2.ch +++ /dev/null @@ -1,330 +0,0 @@ -% vim ft=ch -% This file is part of the e-Omega project -% Purpouse of this file: adapting e-TeX to Omega memory management -% Most registers are reverted to the Omega model. The only exception -% is markings. -%--------------------------------------- - @x eobase.ch l.672 -begin if eTeX_ex and(eqtb[p].int=w) then - @y -begin if eTeX_ex and(new_eqtb_int(p)=w) then - @z -%--------------------------------------- -@x eobase.ch l.1071 - if m=mem_bot then - begin scan_register_num; - if cur_val<256 then cur_val:=equiv(toks_base+cur_val) - else begin find_sa_element(tok_val,cur_val,false); - if cur_ptr=null then cur_val:=null - else cur_val:=sa_ptr(cur_ptr); - end; - end - else cur_val:=sa_ptr(m) - else cur_val:=equiv(m); - cur_val_level:=tok_val; -@y - begin scan_eight_bit_int; m:=toks_base+cur_val; - end; - scanned_result(equiv(m))(tok_val); -@z -%---------------------------------------- -@x l.1220 -begin if (mlo_mem_stat_max) then - begin cur_val_level:=sa_type(m); - if cur_val_level255 then - begin find_sa_element(cur_val_level,cur_val,false); - if cur_ptr=null then - if cur_val_level1) then tracing_online:=1; -@y - if eTeX_ex and(tracing_lost_chars>1) then set_new_eqtb_int(int_base+tracing_online_code,1); -@z -%---------------------------------------- -@x - tracing_online:=old_setting; -@y - set_new_eqtb_int(int_base+tracing_online_code,old_setting); -@z -%--------------------------------------- -@x l.2336 -@d global_box_flag==box_flag+(number_regs+number_regs) {context code for `\.{\\global\\setbox0}'} -@d ship_out_flag==global_box_flag+1 {context code for `\.{\\shipout}'} -@y -@d global_box_flag==(box_flag+number_regs) {context code for `\.{\\global\\setbox0}'} -@d max_global_box_flag==(global_box_flag+number_regs) -@d ship_out_flag==(max_global_box_flag+1) {context code for `\.{\\shipout}'} -@z -%---------------------------------------- -@x eobase.ch l.2309 -begin if box_contextcopy_code then @; -c:=cur_chr; scan_register_num; fetch_box(p); -@y -begin if cur_chr>copy_code then @; -c:=cur_chr; scan_eight_bit_int; p:=box(cur_val); -@z -%--------------------------------------- -@x eobase.ch l.2431 -else begin link(tail):=list_ptr(p); -change_box(null); -@y -else begin link(tail):=list_ptr(p); -set_equiv(box_base+cur_val,null); -@z -%---------------------------------------- -@x eobase.ch l.2698 - othercases begin scan_register_num; - if cur_val>255 then - begin j:=n-count_def_code; {|int_val..box_val|} - if j>mu_val then j:=tok_val; {|int_val..mu_val| or |tok_val|} - find_sa_element(j,cur_val,true); add_sa_ref(cur_ptr); - if j=tok_val then j:=toks_register@+else j:=register; - define(p,j,cur_ptr); - end - else -@y - othercases begin scan_eight_bit_int; -@z -%--------------------------------------- -@x eobase.ch l.2726 - e:=false; {just in case, will be set |true| for sparse array elements} - if cur_cmd=toks_register then - if cur_chr=mem_bot then - begin scan_register_num; - if cur_val>255 then - begin find_sa_element(tok_val,cur_val,true); - cur_chr:=cur_ptr; e:=true; - end - else cur_chr:=toks_base+cur_val; - end - else e:=true; - p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots} -@y - if cur_cmd=toks_register then - begin scan_eight_bit_int; p:=toks_base+cur_val; - end - else p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots} -@z -%--------------------------------------- -@x eobase.ch l.2746 - begin sa_define(p,null)(p,undefined_cs,null); free_avail(def_ref); - end - else begin if (p=output_routine_loc)and not e then {enclose in curlies} -@y - begin define(p,undefined_cs,null); free_avail(def_ref); - end - else begin if p=output_routine_loc then {enclose in curlies} -@z -%--------------------------------------- -@x eobase.ch l.2754 - sa_define(p,def_ref)(p,call,def_ref); -@y - define(p,call,def_ref); -@z -%--------------------------------------- -@x eobase.ch l.2770 -if (cur_cmd=toks_register)or(cur_cmd=assign_toks) then - begin if cur_cmd=toks_register then - if cur_chr=mem_bot then - begin scan_register_num; - if cur_val<256 then q:=equiv(toks_base+cur_val) - else begin find_sa_element(tok_val,cur_val,false); - if cur_ptr=null then q:=null - else q:=sa_ptr(cur_ptr); - end; - end - else q:=sa_ptr(cur_ptr) - else q:=equiv(cur_chr); - if q=null then sa_define(p,null)(p,undefined_cs,null) - else begin add_token_ref(q); sa_define(p,q)(p,call,q); - end; - goto done; - end -@y -begin if cur_cmd=toks_register then - begin scan_eight_bit_int; cur_cmd:=assign_toks; cur_chr:=toks_base+cur_val; - end; -if cur_cmd=assign_toks then - begin q:=equiv(cur_chr); - if q=null then define(p,undefined_cs,null) - else begin add_token_ref(q); define(p,call,q); - end; - goto done; - end; -end -@z -%--------------------------------------- -@x eobase.ch l.2792 -@!e:boolean; {does |l| refer to a sparse array element?} -@!w:integer; {integer or dimen value of |l|} -begin q:=cur_cmd; -e:=false; {just in case, will be set |true| for sparse array elements} -@y -begin q:=cur_cmd; -@z -%---------------------------------------- -@x eobase.ch l.2802 -if plo_mem_stat_max) then - begin l:=cur_chr; p:=sa_type(l); e:=true; - end -else begin p:=cur_chr-mem_bot; scan_register_num; - if cur_val>255 then - begin find_sa_element(p,cur_val,true); l:=cur_ptr; e:=true; - end - else -@y -p:=cur_chr; scan_eight_bit_int; -@z -%--------------------------------------- -@x eobase.ch l.2823 - end; -end; -found: if pnull then mem[b+c].sc:=cur_val; -@y -@!b:eight_bits; {box number} -begin c:=cur_chr; scan_eight_bit_int; b:=cur_val; scan_optional_equals; -scan_normal_dimen; -if box(b)<>null then mem[box(b)+c].sc:=cur_val; -@z -%--------------------------------------- -@x [49] m.1296 l.23637 - e-TeX sparse arrays -begin scan_register_num; fetch_box(p); begin_diagnostic; -print_nl("> \box"); print_int(cur_val); print_char("="); -if p=null then print("void")@+else show_box(p); -@y -begin scan_eight_bit_int; begin_diagnostic; -print_nl("> \box"); print_int(cur_val); print_char("="); -if box(cur_val)=null then print("void") -else show_box(box(cur_val)); -@z -%---------------------------------------- -@x eobase.ch l.2979 -if eTeX_ex then for k:=int_val to tok_val do dump_int(sa_root[k]); -@y -@z -%---------------------------------------- -@x eobase.ch l.2986 -if eTeX_ex then for k:=int_val to tok_val do - undump(null)(lo_mem_max)(sa_root[k]); -@y -@z -@x l. 3132 -for j:=0 to eTeX_states-1 do eTeX_state(j):=0; {disable all enhancements} -@y -for j:=0 to eTeX_states-1 do set_new_eqtb_int(eTeX_state_base+j,0); {disable all enhancements} -@z diff --git a/Build/source/texk/web2c/alephdir/eomem-rc3.ch b/Build/source/texk/web2c/alephdir/eomem-rc3.ch deleted file mode 100644 index c531d831006..00000000000 --- a/Build/source/texk/web2c/alephdir/eomem-rc3.ch +++ /dev/null @@ -1,498 +0,0 @@ -% vim ft=ch -% This file is part of the e-Omega project -% Purpouse of this file: adapting e-TeX to Omega memory management -% Most registers are reverted to the Omega model. The only exception -% is markings. -%--------------------------------------- -@x l.571 -primitive("toks",toks_register,mem_bot);@/ -@y -primitive("toks",toks_register,0);@/ -@z -%--------------------------------------- -@x l.615 -toks_register: @; -@y -toks_register: print_esc("toks"); -@z -%--------------------------------------- -@x l.628 -interpreted in one of five ways: -@y -interpreted in one of four ways: -@z -%--------------------------------------- -@x l.634 -the entries for that group. -Furthermore, in extended \eTeX\ mode, |save_stack[p-1]| contains the -source line number at which the current level of grouping was entered. - -\yskip\hang 5) If |save_type(p)=restore_sa|, then |sa_chain| points to a -chain of sparse array entries to be restored at the end of the current -group. Furthermore |save_index(p)| and |save_level(p)| should replace -the values of |sa_chain| and |sa_level| respectively. -@y -the entries for that group. -Furthermore, in extended \eTeX\ mode, |save_stack[p-1]| contains the -source line number at which the current level of grouping was entered. -@z -%--------------------------------------- -@x l.647 -@d level_boundary=3 {|save_type| corresponding to beginning of group} -@d restore_sa=4 {|save_type| when sparse array entries should be restored} - -@p@t\4@>@ -@y -@d level_boundary=3 {|save_type| corresponding to beginning of group} - -@p@t\4@>@ -@z -%--------------------------------------- - @x eobase.ch l.672 -begin if eTeX_ex and(eqtb[p].int=w) then - @y -begin if eTeX_ex and(new_eqtb_int(p)=w) then - @z -%--------------------------------------- -@x l.686 -@/@@/ -othercases do_nothing -@y -othercases do_nothing -@z -%--------------------------------------- -@x l.774 - else if save_type(save_ptr)=restore_sa then - begin sa_restore; sa_chain:=p; sa_level:=save_level(save_ptr); - end - else begin if save_type(save_ptr)=restore_old_value then -@y - else begin if save_type(save_ptr)=restore_old_value then -@z -%--------------------------------------- -@x l.1065 -|glue_val|, or |mu_val| more than |mem_bot| (dynamic variable-size nodes -cannot have these values) -@y -|glue_val|, or |mu_val|. -@z -%--------------------------------------- -@x l.1072 -primitive("count",register,mem_bot+int_val); -@!@:count_}{\.{\\count} primitive@> -primitive("dimen",register,mem_bot+dimen_val); -@!@:dimen_}{\.{\\dimen} primitive@> -primitive("skip",register,mem_bot+glue_val); -@!@:skip_}{\.{\\skip} primitive@> -primitive("muskip",register,mem_bot+mu_val); -@y -primitive("count",register,int_val); -@!@:count_}{\.{\\count} primitive@> -primitive("dimen",register,dimen_val); -@!@:dimen_}{\.{\\dimen} primitive@> -primitive("skip",register,glue_val); -@!@:skip_}{\.{\\skip} primitive@> -primitive("muskip",register,mu_val); -@z -%--------------------------------------- -@x l.1090 -register: @; -@y -register: if chr_code=int_val then print_esc("count") - else if chr_code=dimen_val then print_esc("dimen") - else if chr_code=glue_val then print_esc("skip") - else print_esc("muskip"); -@z -%--------------------------------------- -@x eobase.ch l.1114 - if m=mem_bot then - begin scan_register_num; - if cur_val<256 then cur_val:=equiv(toks_base+cur_val) - else begin find_sa_element(tok_val,cur_val,false); - if cur_ptr=null then cur_val:=null - else cur_val:=sa_ptr(cur_ptr); - end; - end - else cur_val:=sa_ptr(m) - else cur_val:=equiv(m); - cur_val_level:=tok_val; -@y - begin scan_eight_bit_int; m:=toks_base+cur_val; - end; - scanned_result(equiv(m))(tok_val); -@z -%--------------------------------------- -@x l.1173 -begin - scan_register_num; - fetch_box(q); - if q=null then cur_val:=0 @+else - cur_val:=mem[q+m].sc; -@y -begin - scan_eight_bit_int; - if box(cur_val)=null then cur_val:=0 @+else - cur_val:=mem[box(cur_val)+m].sc; -@z -%---------------------------------------- -@x l.1263 -begin if (mlo_mem_stat_max) then - begin cur_val_level:=sa_type(m); - if cur_val_level255 then - begin find_sa_element(cur_val_level,cur_val,false); - if cur_ptr=null then - if cur_val_level1) then tracing_online:=1; -@y - if eTeX_ex and(tracing_lost_chars>1) then set_new_eqtb_int(int_base+tracing_online_code,1); -@z -%---------------------------------------- -@x - tracing_online:=old_setting; -@y - set_new_eqtb_int(int_base+tracing_online_code,old_setting); -@z -%--------------------------------------- -@x l.2188 -begin cur_val:=n; fetch_box(v); vdir:=box_dir(v); -@y -begin v:=box(n); vdir:=box_dir(v); -@z -%--------------------------------------- -@x l.2212 -if q<>null then q:=vpack(q,natural); -change_box(q); {the |eq_level| of the box stays the same} -@y -if q=null then set_equiv(box_base+n,null) - {the |eq_level| of the box stays the same} -else set_equiv(box_base+n,vpack(q,natural)); -@z -%--------------------------------------- -@x l.2336 -@d global_box_flag==box_flag+(number_regs+number_regs) {context code for `\.{\\global\\setbox0}'} -@d ship_out_flag==global_box_flag+1 {context code for `\.{\\shipout}'} -@y -@d ship_out_flag==box_flag+(number_regs+number_regs) - {context code for `\.{\\shipout}'} -@z -%--------------------------------------- -@x l.2344 -var p:pointer; {|ord_noad| for new box in math mode} -@!a:small_number; {global prefix} -@y -var p:pointer; {|ord_noad| for new box in math mode} -@z -%---------------------------------------- -@x l.2351 -begin if box_contextcopy_code then @; -c:=cur_chr; scan_register_num; fetch_box(p); -@y -begin if cur_chr>copy_code then @; -c:=cur_chr; scan_eight_bit_int; p:=box(cur_val); -@z -%--------------------------------------- -@x eobase.ch l.2431 -else begin link(tail):=list_ptr(p); -change_box(null); -@y -else begin link(tail):=list_ptr(p); -set_equiv(box_base+cur_val,null); -@z -%---------------------------------------- -@x eobase.ch l.2743 - othercases begin scan_register_num; - if cur_val>255 then - begin j:=n-count_def_code; {|int_val..box_val|} - if j>mu_val then j:=tok_val; {|int_val..mu_val| or |tok_val|} - find_sa_element(j,cur_val,true); add_sa_ref(cur_ptr); - if j=tok_val then j:=toks_register@+else j:=register; - define(p,j,cur_ptr); - end - else -@y - othercases begin scan_eight_bit_int; -@z -%--------------------------------------- -@x eobase.ch l.2769 - e:=false; {just in case, will be set |true| for sparse array elements} - if cur_cmd=toks_register then - if cur_chr=mem_bot then - begin scan_register_num; - if cur_val>255 then - begin find_sa_element(tok_val,cur_val,true); - cur_chr:=cur_ptr; e:=true; - end - else cur_chr:=toks_base+cur_val; - end - else e:=true; - p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots} -@y - if cur_cmd=toks_register then - begin scan_eight_bit_int; p:=toks_base+cur_val; - end - else p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots} -@z -%--------------------------------------- -@x eobase.ch l.2789 - begin sa_define(p,null)(p,undefined_cs,null); free_avail(def_ref); - end - else begin if (p=output_routine_loc)and not e then {enclose in curlies} -@y - begin define(p,undefined_cs,null); free_avail(def_ref); - end - else begin if p=output_routine_loc then {enclose in curlies} -@z -%--------------------------------------- -@x eobase.ch l.2799 - sa_define(p,def_ref)(p,call,def_ref); -@y - define(p,call,def_ref); -@z -%--------------------------------------- -@x eobase.ch l.2805 -if (cur_cmd=toks_register)or(cur_cmd=assign_toks) then - begin if cur_cmd=toks_register then - if cur_chr=mem_bot then - begin scan_register_num; - if cur_val<256 then q:=equiv(toks_base+cur_val) - else begin find_sa_element(tok_val,cur_val,false); - if cur_ptr=null then q:=null - else q:=sa_ptr(cur_ptr); - end; - end - else q:=sa_ptr(cur_ptr) - else q:=equiv(cur_chr); - if q=null then sa_define(p,null)(p,undefined_cs,null) - else begin add_token_ref(q); sa_define(p,q)(p,call,q); - end; - goto done; - end -@y -begin if cur_cmd=toks_register then - begin scan_eight_bit_int; cur_cmd:=assign_toks; cur_chr:=toks_base+cur_val; - end; -if cur_cmd=assign_toks then - begin q:=equiv(cur_chr); - if q=null then define(p,undefined_cs,null) - else begin add_token_ref(q); define(p,call,q); - end; - goto done; - end; -end -@z -%--------------------------------------- -@x eobase.ch l.2792 -@!e:boolean; {does |l| refer to a sparse array element?} -@!w:integer; {integer or dimen value of |l|} -begin q:=cur_cmd; -e:=false; {just in case, will be set |true| for sparse array elements} -@y -begin q:=cur_cmd; -@z -%---------------------------------------- -@x eobase.ch l.2802 -if plo_mem_stat_max) then - begin l:=cur_chr; p:=sa_type(l); e:=true; - end -else begin p:=cur_chr-mem_bot; scan_register_num; - if cur_val>255 then - begin find_sa_element(p,cur_val,true); l:=cur_ptr; e:=true; - end - else -@y -p:=cur_chr; scan_eight_bit_int; -@z -%--------------------------------------- -@x eobase.ch l.2823 - end; -end; -found: if pnull then mem[b+c].sc:=cur_val; -@y -@!b:eight_bits; {box number} -begin c:=cur_chr; scan_eight_bit_int; b:=cur_val; scan_optional_equals; -scan_normal_dimen; -if box(b)<>null then mem[box(b)+c].sc:=cur_val; -@z -%--------------------------------------- -@x l.2998 -begin scan_register_num; fetch_box(p); begin_diagnostic; -print_nl("> \box"); print_int(cur_val); print_char("="); -if p=null then print("void")@+else show_box(p); -@y -begin scan_eight_bit_int; begin_diagnostic; -print_nl("> \box"); print_int(cur_val); print_char("="); -if box(cur_val)=null then print("void") -else show_box(box(cur_val)); -@z -%---------------------------------------- -@x eobase.ch l.3023 -if eTeX_ex then for k:=int_val to tok_val do dump_int(sa_root[k]); -@y -@z -%---------------------------------------- -@x eobase.ch l.3030 -if eTeX_ex then for k:=int_val to tok_val do - undump(null)(lo_mem_max)(sa_root[k]); -@y -@z -@x l. 3181 -for j:=0 to eTeX_states-1 do eTeX_state(j):=0; {disable all enhancements} -@y -for j:=0 to eTeX_states-1 do set_new_eqtb_int(eTeX_state_base+j,0); {disable all enhancements} -@z -%---------------------------------------- -@x l.3558 -@ @= -i:=saved(-4); -if i<>0 then - if i0 then print_cmd_chr(j,0) else print_cmd_chr(j,1); - print_scaled(abs(i)); print("pt"); - end - else if i=global_box_flag then - begin print_esc("global"); i:=i-(global_box_flag-box_flag); - end; - print_esc("setbox"); print_int(i-box_flag); print_char("="); - end - else print_cmd_chr(leader_ship,i-(leader_flag-a_leaders)) -@y -@ @= -i:=saved(-4); -if i<>0 then - if i0 then print_cmd_chr(j,0) else print_cmd_chr(j,1); - print_scaled(abs(i)); print("pt"); - end - else if i=box_flag+number_regs then - begin print_esc("global"); i:=i-number_regs; - end; - print_esc("setbox"); print_int(i-box_flag); print_char("="); - end - else print_cmd_chr(leader_ship,i-(leader_flag-a_leaders)) -@z diff --git a/Build/source/texk/web2c/alephdir/eomem.ch b/Build/source/texk/web2c/alephdir/eomem.ch new file mode 100644 index 00000000000..dd91d3128be --- /dev/null +++ b/Build/source/texk/web2c/alephdir/eomem.ch @@ -0,0 +1,330 @@ +% vim ft=ch +% This file is part of the e-Omega project +% Purpouse of this file: adapting e-TeX to Omega memory management +% Most registers are reverted to the Omega model. The only exception +% is markings. +%--------------------------------------- + @x eobase.ch l.672 +begin if eTeX_ex and(eqtb[p].int=w) then + @y +begin if eTeX_ex and(new_eqtb_int(p)=w) then + @z +%--------------------------------------- +@x eobase.ch l.1071 + if m=mem_bot then + begin scan_register_num; + if cur_val<256 then cur_val:=equiv(toks_base+cur_val) + else begin find_sa_element(tok_val,cur_val,false); + if cur_ptr=null then cur_val:=null + else cur_val:=sa_ptr(cur_ptr); + end; + end + else cur_val:=sa_ptr(m) + else cur_val:=equiv(m); + cur_val_level:=tok_val; +@y + begin scan_eight_bit_int; m:=toks_base+cur_val; + end; + scanned_result(equiv(m))(tok_val); +@z +%---------------------------------------- +@x l.1220 +begin if (mlo_mem_stat_max) then + begin cur_val_level:=sa_type(m); + if cur_val_level255 then + begin find_sa_element(cur_val_level,cur_val,false); + if cur_ptr=null then + if cur_val_level1) then tracing_online:=1; +@y + if eTeX_ex and(tracing_lost_chars>1) then set_new_eqtb_int(int_base+tracing_online_code,1); +@z +%---------------------------------------- +@x + tracing_online:=old_setting; +@y + set_new_eqtb_int(int_base+tracing_online_code,old_setting); +@z +%--------------------------------------- +@x l.2336 +@d global_box_flag==box_flag+(number_regs+number_regs) {context code for `\.{\\global\\setbox0}'} +@d ship_out_flag==global_box_flag+1 {context code for `\.{\\shipout}'} +@y +@d global_box_flag==(box_flag+number_regs) {context code for `\.{\\global\\setbox0}'} +@d max_global_box_flag==(global_box_flag+number_regs) +@d ship_out_flag==(max_global_box_flag+1) {context code for `\.{\\shipout}'} +@z +%---------------------------------------- +@x eobase.ch l.2309 +begin if box_contextcopy_code then @; +c:=cur_chr; scan_register_num; fetch_box(p); +@y +begin if cur_chr>copy_code then @; +c:=cur_chr; scan_eight_bit_int; p:=box(cur_val); +@z +%--------------------------------------- +@x eobase.ch l.2431 +else begin link(tail):=list_ptr(p); +change_box(null); +@y +else begin link(tail):=list_ptr(p); +set_equiv(box_base+cur_val,null); +@z +%---------------------------------------- +@x eobase.ch l.2698 + othercases begin scan_register_num; + if cur_val>255 then + begin j:=n-count_def_code; {|int_val..box_val|} + if j>mu_val then j:=tok_val; {|int_val..mu_val| or |tok_val|} + find_sa_element(j,cur_val,true); add_sa_ref(cur_ptr); + if j=tok_val then j:=toks_register@+else j:=register; + define(p,j,cur_ptr); + end + else +@y + othercases begin scan_eight_bit_int; +@z +%--------------------------------------- +@x eobase.ch l.2726 + e:=false; {just in case, will be set |true| for sparse array elements} + if cur_cmd=toks_register then + if cur_chr=mem_bot then + begin scan_register_num; + if cur_val>255 then + begin find_sa_element(tok_val,cur_val,true); + cur_chr:=cur_ptr; e:=true; + end + else cur_chr:=toks_base+cur_val; + end + else e:=true; + p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots} +@y + if cur_cmd=toks_register then + begin scan_eight_bit_int; p:=toks_base+cur_val; + end + else p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots} +@z +%--------------------------------------- +@x eobase.ch l.2746 + begin sa_define(p,null)(p,undefined_cs,null); free_avail(def_ref); + end + else begin if (p=output_routine_loc)and not e then {enclose in curlies} +@y + begin define(p,undefined_cs,null); free_avail(def_ref); + end + else begin if p=output_routine_loc then {enclose in curlies} +@z +%--------------------------------------- +@x eobase.ch l.2754 + sa_define(p,def_ref)(p,call,def_ref); +@y + define(p,call,def_ref); +@z +%--------------------------------------- +@x eobase.ch l.2770 +if (cur_cmd=toks_register)or(cur_cmd=assign_toks) then + begin if cur_cmd=toks_register then + if cur_chr=mem_bot then + begin scan_register_num; + if cur_val<256 then q:=equiv(toks_base+cur_val) + else begin find_sa_element(tok_val,cur_val,false); + if cur_ptr=null then q:=null + else q:=sa_ptr(cur_ptr); + end; + end + else q:=sa_ptr(cur_ptr) + else q:=equiv(cur_chr); + if q=null then sa_define(p,null)(p,undefined_cs,null) + else begin add_token_ref(q); sa_define(p,q)(p,call,q); + end; + goto done; + end +@y +begin if cur_cmd=toks_register then + begin scan_eight_bit_int; cur_cmd:=assign_toks; cur_chr:=toks_base+cur_val; + end; +if cur_cmd=assign_toks then + begin q:=equiv(cur_chr); + if q=null then define(p,undefined_cs,null) + else begin add_token_ref(q); define(p,call,q); + end; + goto done; + end; +end +@z +%--------------------------------------- +@x eobase.ch l.2792 +@!e:boolean; {does |l| refer to a sparse array element?} +@!w:integer; {integer or dimen value of |l|} +begin q:=cur_cmd; +e:=false; {just in case, will be set |true| for sparse array elements} +@y +begin q:=cur_cmd; +@z +%---------------------------------------- +@x eobase.ch l.2802 +if plo_mem_stat_max) then + begin l:=cur_chr; p:=sa_type(l); e:=true; + end +else begin p:=cur_chr-mem_bot; scan_register_num; + if cur_val>255 then + begin find_sa_element(p,cur_val,true); l:=cur_ptr; e:=true; + end + else +@y +p:=cur_chr; scan_eight_bit_int; +@z +%--------------------------------------- +@x eobase.ch l.2823 + end; +end; +found: if pnull then mem[b+c].sc:=cur_val; +@y +@!b:eight_bits; {box number} +begin c:=cur_chr; scan_eight_bit_int; b:=cur_val; scan_optional_equals; +scan_normal_dimen; +if box(b)<>null then mem[box(b)+c].sc:=cur_val; +@z +%--------------------------------------- +@x [49] m.1296 l.23637 - e-TeX sparse arrays +begin scan_register_num; fetch_box(p); begin_diagnostic; +print_nl("> \box"); print_int(cur_val); print_char("="); +if p=null then print("void")@+else show_box(p); +@y +begin scan_eight_bit_int; begin_diagnostic; +print_nl("> \box"); print_int(cur_val); print_char("="); +if box(cur_val)=null then print("void") +else show_box(box(cur_val)); +@z +%---------------------------------------- +@x eobase.ch l.2979 +if eTeX_ex then for k:=int_val to tok_val do dump_int(sa_root[k]); +@y +@z +%---------------------------------------- +@x eobase.ch l.2986 +if eTeX_ex then for k:=int_val to tok_val do + undump(null)(lo_mem_max)(sa_root[k]); +@y +@z +@x l. 3132 +for j:=0 to eTeX_states-1 do eTeX_state(j):=0; {disable all enhancements} +@y +for j:=0 to eTeX_states-1 do set_new_eqtb_int(eTeX_state_base+j,0); {disable all enhancements} +@z diff --git a/Build/source/texk/web2c/alephdir/eonewdir-rc1.ch b/Build/source/texk/web2c/alephdir/eonewdir-rc1.ch deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/Build/source/texk/web2c/alephdir/eonewdir-rc2.ch b/Build/source/texk/web2c/alephdir/eonewdir-rc2.ch deleted file mode 100644 index 9cdab96ab09..00000000000 --- a/Build/source/texk/web2c/alephdir/eonewdir-rc2.ch +++ /dev/null @@ -1,52 +0,0 @@ -% Backport some 1.23 dir primitives to 1.15 -% namely, \boxdir -% NOT \nextfakemath, which requires too many changes - -@x -@d assign_dir=register+1 {(\.{\\pagedir}, \.{\\textdir})} -@d max_internal=assign_dir - {the largest code that can follow \.{\\the}} -@y -@d assign_next_fake_math=register+1 {(\.{\\nextfakemath})} {unused} -@d assign_box_dir=register+2 {(\.{\\boxdir})} -@d assign_dir=register+3 {(\.{\\pagedir}, \.{\\textdir})} -@d max_internal=assign_dir - {the largest code that can follow \.{\\the}} -@z - -@x -assign_int: scanned_result(new_eqtb_int(m))(int_val); -assign_dir: scanned_result(new_eqtb_int(m))(dir_val); -@y -assign_int: scanned_result(new_eqtb_int(m))(int_val); -assign_box_dir: begin - scan_eight_bit_int; - m:=cur_val; - if box(m)<>null then cur_val:=box_dir(box(m)) - else cur_val:=0; - cur_val_level:=dir_val; - end; -assign_dir: scanned_result(new_eqtb_int(m))(dir_val); -@z - -@x [47] m.1071 -primitive("xleaders",leader_ship,x_leaders); -@!@:x_leaders_}{\.{\\xleaders} primitive@> -@y -primitive("xleaders",leader_ship,x_leaders); -@!@:x_leaders_}{\.{\\xleaders} primitive@> -primitive("boxdir",assign_box_dir,0); -@!@:box_dir}{\.{\\boxdir} primitive@> -@z - -@x [47] m.1073 -any_mode(make_box): begin_box(0); -@y -any_mode(make_box): begin_box(0); -any_mode(assign_box_dir): begin scan_eight_bit_int; - cur_box:=box(cur_val); - scan_optional_equals; scan_dir; - if cur_box<>null then box_dir(cur_box):=cur_val; - end; -@z - diff --git a/Build/source/texk/web2c/alephdir/eonewdir.ch b/Build/source/texk/web2c/alephdir/eonewdir.ch new file mode 100644 index 00000000000..9cdab96ab09 --- /dev/null +++ b/Build/source/texk/web2c/alephdir/eonewdir.ch @@ -0,0 +1,52 @@ +% Backport some 1.23 dir primitives to 1.15 +% namely, \boxdir +% NOT \nextfakemath, which requires too many changes + +@x +@d assign_dir=register+1 {(\.{\\pagedir}, \.{\\textdir})} +@d max_internal=assign_dir + {the largest code that can follow \.{\\the}} +@y +@d assign_next_fake_math=register+1 {(\.{\\nextfakemath})} {unused} +@d assign_box_dir=register+2 {(\.{\\boxdir})} +@d assign_dir=register+3 {(\.{\\pagedir}, \.{\\textdir})} +@d max_internal=assign_dir + {the largest code that can follow \.{\\the}} +@z + +@x +assign_int: scanned_result(new_eqtb_int(m))(int_val); +assign_dir: scanned_result(new_eqtb_int(m))(dir_val); +@y +assign_int: scanned_result(new_eqtb_int(m))(int_val); +assign_box_dir: begin + scan_eight_bit_int; + m:=cur_val; + if box(m)<>null then cur_val:=box_dir(box(m)) + else cur_val:=0; + cur_val_level:=dir_val; + end; +assign_dir: scanned_result(new_eqtb_int(m))(dir_val); +@z + +@x [47] m.1071 +primitive("xleaders",leader_ship,x_leaders); +@!@:x_leaders_}{\.{\\xleaders} primitive@> +@y +primitive("xleaders",leader_ship,x_leaders); +@!@:x_leaders_}{\.{\\xleaders} primitive@> +primitive("boxdir",assign_box_dir,0); +@!@:box_dir}{\.{\\boxdir} primitive@> +@z + +@x [47] m.1073 +any_mode(make_box): begin_box(0); +@y +any_mode(make_box): begin_box(0); +any_mode(assign_box_dir): begin scan_eight_bit_int; + cur_box:=box(cur_val); + scan_optional_equals; scan_dir; + if cur_box<>null then box_dir(cur_box):=cur_val; + end; +@z + diff --git a/Build/source/texk/web2c/alephdir/eopage-rc1.ch b/Build/source/texk/web2c/alephdir/eopage-rc1.ch deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/Build/source/texk/web2c/alephdir/eopage-rc2.ch b/Build/source/texk/web2c/alephdir/eopage-rc2.ch deleted file mode 100644 index d55cc6a154c..00000000000 --- a/Build/source/texk/web2c/alephdir/eopage-rc2.ch +++ /dev/null @@ -1,180 +0,0 @@ -% vim ft=ch -% Fix page dimension bugs -% TODO : not there yet for BLB? -@x -emergency_stretch_code:print_esc("emergencystretch"); -othercases print("[unknown dimen parameter!]") -endcases; -end; -@y -emergency_stretch_code:print_esc("emergencystretch"); -page_width_code:print_esc("pagewidth"); -page_height_code:print_esc("pageheight"); -page_right_offset_code:print_esc("pagerightoffset"); -page_bottom_offset_code:print_esc("pagebottomoffset"); -othercases print("[unknown dimen parameter!]") -endcases; -end; -@z - -@x -@ @= -@; -@; -page_loc:=dvi_offset+dvi_ptr; -dvi_out(bop); -for k:=0 to 9 do dvi_four(count(k)); -dvi_four(last_bop); last_bop:=page_loc; -dvi_direction:=page_direction; -case box_direction(dvi_direction) of -dir_TL_,dir_LT_: begin - end; -dir_TR_,dir_RT_: begin - dvi_right(page_right_offset); - end; -dir_RB_,dir_BR_: begin - dvi_right(page_right_offset); - dvi_down(page_bottom_offset); - end; -dir_BL_,dir_LB_: begin - dvi_down(page_bottom_offset); - end; -end; -cur_h:=h_offset; -cur_v:=height(p)+v_offset; -case box_direction(dvi_direction) of -dir_TL_: begin - dvi_down(cur_v); - dvi_right(cur_h); - end; -dir_TR_: begin - dvi_down(cur_v); - dvi_right(-cur_h); - end; -dir_LT_: begin - dvi_right(cur_v); - dvi_down(cur_h); - end; -dir_LB_: begin - dvi_right(cur_v); - dvi_down(-cur_h); - end; -dir_BL_: begin - dvi_down(-cur_v); - dvi_right(cur_h); - end; -dir_BR_: begin - dvi_down(-cur_v); - dvi_right(-cur_h); - end; -dir_RT_: begin - dvi_right(-cur_v); - dvi_down(cur_h); - end; -dir_RB_: begin - dvi_right(-cur_v); - dvi_down(-cur_h); - end; -end; -dvi_h:=cur_h; -dvi_v:=cur_v; -temp_ptr:=p; -if type(p)=vlist_node then vlist_out@+else hlist_out; -dvi_out(eop); incr(total_pages); cur_s:=-1; -done: - -@y -@ @= -@; -@; -page_loc:=dvi_offset+dvi_ptr; -dvi_out(bop); -for k:=0 to 9 do dvi_four(count(k)); -dvi_four(last_bop); last_bop:=page_loc; -dvi_direction:=page_direction; -case box_direction(dvi_direction) of -dir_TL_,dir_LT_: begin - end; -dir_TR_,dir_RT_: begin - dvi_right(page_width-page_right_offset); - dvi_h:=-page_right_offset; - end; -dir_RB_,dir_BR_: begin - dvi_right(page_width-page_right_offset); - dvi_down(page_height-page_bottom_offset); - dvi_h:=-page_right_offset; - dvi_v:=-page_bottom_offset; - end; -dir_BL_,dir_LB_: begin - dvi_down(page_height-page_bottom_offset); - dvi_v:=-page_bottom_offset; - end; -end; -cur_h:=h_offset; -cur_v:=height(p)+v_offset; -case box_direction(dvi_direction) of -dir_TL_: begin - dvi_right(cur_h); - dvi_down(cur_v); - end; -dir_TR_: begin - dvi_right(-cur_h); - dvi_down(cur_v); - end; -dir_LT_: begin - dvi_right(cur_v); - dvi_down(cur_h); - end; -dir_LB_: begin - dvi_right(cur_v); - dvi_down(-cur_h); - end; -dir_BL_: begin - dvi_right(cur_h); - dvi_down(-cur_v); - end; -dir_BR_: begin - dvi_right(-cur_h); - dvi_down(-cur_v); - end; -dir_RT_: begin - dvi_right(-cur_v); - dvi_down(cur_h); - end; -dir_RB_: begin - dvi_right(-cur_v); - dvi_down(-cur_h); - end; -end; -temp_ptr:=p; -dvi_h:=dvi_h+cur_h; -dvi_v:=dvi_v+cur_v; -if type(p)=vlist_node then vlist_out@+else hlist_out; -dvi_out(eop); incr(total_pages); cur_s:=-1; -done: - -@z - -@x -set_new_eqtb_sc(dimen_base+page_bottom_offset_code,page_height-9472573); - {-2 inches} -set_new_eqtb_sc(dimen_base+page_right_offset_code,page_width-9472573); - {-2 inches} -@y -set_new_eqtb_sc(dimen_base+page_bottom_offset_code,4736287); {1 inch} -set_new_eqtb_sc(dimen_base+page_right_offset_code,4736287); {1 inch} -@z - -@x -{ -|primitive("pagerightoffset",assign_dimen,dimen_base+page_right_offset_code);| -|primitive("pagebottomoffset",assign_dimen,dimen_base+page_bottom_offset_code);| -} -@y -primitive("pagerightoffset",assign_dimen,dimen_base+page_right_offset_code); -primitive("pagebottomoffset",assign_dimen,dimen_base+page_bottom_offset_code); -@z - - diff --git a/Build/source/texk/web2c/alephdir/eopage.ch b/Build/source/texk/web2c/alephdir/eopage.ch new file mode 100644 index 00000000000..d55cc6a154c --- /dev/null +++ b/Build/source/texk/web2c/alephdir/eopage.ch @@ -0,0 +1,180 @@ +% vim ft=ch +% Fix page dimension bugs +% TODO : not there yet for BLB? +@x +emergency_stretch_code:print_esc("emergencystretch"); +othercases print("[unknown dimen parameter!]") +endcases; +end; +@y +emergency_stretch_code:print_esc("emergencystretch"); +page_width_code:print_esc("pagewidth"); +page_height_code:print_esc("pageheight"); +page_right_offset_code:print_esc("pagerightoffset"); +page_bottom_offset_code:print_esc("pagebottomoffset"); +othercases print("[unknown dimen parameter!]") +endcases; +end; +@z + +@x +@ @= +@; +@; +page_loc:=dvi_offset+dvi_ptr; +dvi_out(bop); +for k:=0 to 9 do dvi_four(count(k)); +dvi_four(last_bop); last_bop:=page_loc; +dvi_direction:=page_direction; +case box_direction(dvi_direction) of +dir_TL_,dir_LT_: begin + end; +dir_TR_,dir_RT_: begin + dvi_right(page_right_offset); + end; +dir_RB_,dir_BR_: begin + dvi_right(page_right_offset); + dvi_down(page_bottom_offset); + end; +dir_BL_,dir_LB_: begin + dvi_down(page_bottom_offset); + end; +end; +cur_h:=h_offset; +cur_v:=height(p)+v_offset; +case box_direction(dvi_direction) of +dir_TL_: begin + dvi_down(cur_v); + dvi_right(cur_h); + end; +dir_TR_: begin + dvi_down(cur_v); + dvi_right(-cur_h); + end; +dir_LT_: begin + dvi_right(cur_v); + dvi_down(cur_h); + end; +dir_LB_: begin + dvi_right(cur_v); + dvi_down(-cur_h); + end; +dir_BL_: begin + dvi_down(-cur_v); + dvi_right(cur_h); + end; +dir_BR_: begin + dvi_down(-cur_v); + dvi_right(-cur_h); + end; +dir_RT_: begin + dvi_right(-cur_v); + dvi_down(cur_h); + end; +dir_RB_: begin + dvi_right(-cur_v); + dvi_down(-cur_h); + end; +end; +dvi_h:=cur_h; +dvi_v:=cur_v; +temp_ptr:=p; +if type(p)=vlist_node then vlist_out@+else hlist_out; +dvi_out(eop); incr(total_pages); cur_s:=-1; +done: + +@y +@ @= +@; +@; +page_loc:=dvi_offset+dvi_ptr; +dvi_out(bop); +for k:=0 to 9 do dvi_four(count(k)); +dvi_four(last_bop); last_bop:=page_loc; +dvi_direction:=page_direction; +case box_direction(dvi_direction) of +dir_TL_,dir_LT_: begin + end; +dir_TR_,dir_RT_: begin + dvi_right(page_width-page_right_offset); + dvi_h:=-page_right_offset; + end; +dir_RB_,dir_BR_: begin + dvi_right(page_width-page_right_offset); + dvi_down(page_height-page_bottom_offset); + dvi_h:=-page_right_offset; + dvi_v:=-page_bottom_offset; + end; +dir_BL_,dir_LB_: begin + dvi_down(page_height-page_bottom_offset); + dvi_v:=-page_bottom_offset; + end; +end; +cur_h:=h_offset; +cur_v:=height(p)+v_offset; +case box_direction(dvi_direction) of +dir_TL_: begin + dvi_right(cur_h); + dvi_down(cur_v); + end; +dir_TR_: begin + dvi_right(-cur_h); + dvi_down(cur_v); + end; +dir_LT_: begin + dvi_right(cur_v); + dvi_down(cur_h); + end; +dir_LB_: begin + dvi_right(cur_v); + dvi_down(-cur_h); + end; +dir_BL_: begin + dvi_right(cur_h); + dvi_down(-cur_v); + end; +dir_BR_: begin + dvi_right(-cur_h); + dvi_down(-cur_v); + end; +dir_RT_: begin + dvi_right(-cur_v); + dvi_down(cur_h); + end; +dir_RB_: begin + dvi_right(-cur_v); + dvi_down(-cur_h); + end; +end; +temp_ptr:=p; +dvi_h:=dvi_h+cur_h; +dvi_v:=dvi_v+cur_v; +if type(p)=vlist_node then vlist_out@+else hlist_out; +dvi_out(eop); incr(total_pages); cur_s:=-1; +done: + +@z + +@x +set_new_eqtb_sc(dimen_base+page_bottom_offset_code,page_height-9472573); + {-2 inches} +set_new_eqtb_sc(dimen_base+page_right_offset_code,page_width-9472573); + {-2 inches} +@y +set_new_eqtb_sc(dimen_base+page_bottom_offset_code,4736287); {1 inch} +set_new_eqtb_sc(dimen_base+page_right_offset_code,4736287); {1 inch} +@z + +@x +{ +|primitive("pagerightoffset",assign_dimen,dimen_base+page_right_offset_code);| +|primitive("pagebottomoffset",assign_dimen,dimen_base+page_bottom_offset_code);| +} +@y +primitive("pagerightoffset",assign_dimen,dimen_base+page_right_offset_code); +primitive("pagebottomoffset",assign_dimen,dimen_base+page_bottom_offset_code); +@z + + diff --git a/Build/source/texk/web2c/alephdir/eover-rc1.ch b/Build/source/texk/web2c/alephdir/eover-rc1.ch deleted file mode 100644 index 04547ca51ec..00000000000 --- a/Build/source/texk/web2c/alephdir/eover-rc1.ch +++ /dev/null @@ -1,21 +0,0 @@ -@x -@d banner=='This is Aleph, Version 3.1415926--1.15--2.1' {printed when \TeX\ starts} -@# -@d eTeX_version_string=='3.1415926--1.15--2.1' {current \eTeX\ version} -@d eTeX_version=2 { \.{\\eTeXversion} } -@d eTeX_revision==".1" { \.{\\eTeXrevision} } -@# -@d eTeX_banner=='This is Aleph, Version ',eTeX_version_string - {printed when \eTeX\ starts} -@y -@d banner=='This is Aleph, Version 3.1415926--1.15--2.1 (RC1)' {printed when \TeX\ starts} -@# -@d eTeX_version_string=='3.1415926--1.15--2.1 (RC1)' {current \eTeX\ version} -@d eTeX_version=2 { \.{\\eTeXversion} } -@d eTeX_revision==".1" { \.{\\eTeXrevision} } -@d Aleph_version=0 { \.{\\Alephversion} } {TODO: make accessible} -@d Aleph_revision==".2 (RC1)" { \.{\\Alephrevision} } {TODO: make accessible} -@# -@d eTeX_banner==banner - {printed when \eTeX\ starts} -@z diff --git a/Build/source/texk/web2c/alephdir/eover-rc2.ch b/Build/source/texk/web2c/alephdir/eover-rc2.ch deleted file mode 100644 index ff70c7e3158..00000000000 --- a/Build/source/texk/web2c/alephdir/eover-rc2.ch +++ /dev/null @@ -1,230 +0,0 @@ -% Aleph version-specific stuff; -% * we define the banner and everything to be -% Aleph specific (with Aleph version numbering -% added to the sequence --yes, I know it sucks) -% * we add both \eTeX-like and \OMEGA-like -% commands to display the version -@x -@d banner=='This is Aleph, Version 3.1415926--1.15--2.1' {printed when \TeX\ starts} -@# -@d eTeX_version_string=='3.1415926--1.15--2.1' {current \eTeX\ version} -@d eTeX_version=2 { \.{\\eTeXversion} } -@d eTeX_revision==".1" { \.{\\eTeXrevision} } -@# -@d eTeX_banner=='This is Aleph, Version ',eTeX_version_string - {printed when \eTeX\ starts} -@y -@d eTeX_version_banner=='2.1' {current \eTeX\ version} -@d Omega_version_banner=='1.15' {current $\Omega$ version} -@d Aleph_version_banner=='0.0-rc4' {current \Aleph\ version} -@d eTeX_version_string=="2.1" {current \eTeX\ version} -@d Omega_version_string=="1.15" { \.{\\OmegaVersion} } -@d Aleph_version_string=="0.0" { \.{\\AlephVersion} } -@d eTeX_version=2 { \.{\\eTeXversion} } -@d Omega_version=1 { \.{\\Omegaversion} } -@d Aleph_version=0 { \.{\\Alephversion} } -@d eTeX_minor_version=1 { \.{\\eTeXminorversion} } -@d Omega_minor_version=15 { \.{\\Omegaminorversion} } -@d Aleph_minor_version=0 { \.{\\Alephminorversion} } -@d eTeX_revision==".1" { \.{\\eTeXrevision} } -@d Omega_revision==".15" { \.{\\Omegarevision} } -@d Aleph_revision==".0" { \.{\\Alephrevision} } -@# -@d banner=='This is Aleph, Version 3.1415926-',Omega_version_banner,'-',eTeX_version_banner,'-',Aleph_version_banner {printed when \TeX\ starts} -@d eTeX_banner==banner - {printed when \eTeX\ starts} -@z - -% === Aleph history === -%---------------------------------------- -% Version: 0.0 (RC0) -% Internal name: the successfull merge -% Achievement: main executable that would run -% Release date: 20030131 -%---------------------------------------- -% Version: 0.0 (RC1) -% Internal name: the successfull trip (NOT) -% Achievement: fixed the major 'trip' bug -% making Aleph usable for -% production use -% Release date: 20030511 -%---------------------------------------- -% Version: 0.0 (RC2) -% Internal name: the name change -% Achievement: add \boxdir -% add versioning info -% add version-retrieving commands -% fix \overfullrule>0pt -% fix \charit -% fix non-TLT text offset -% fix leaders crashing or stalling -% Release date: 20040322 -%---------------------------------------- -% Version: 0.0 (RC3) -% Internal name: Oh Tea Peas -% Achievement: fix some OTP/OCP-related bugs -% Release date: 20040609 -%---------------------------------------- -% Version: 0.0 (RC4) -% Internal name: Nothing really -% Achievement: adapt to latest web2c changes -% Release date: 20040909 -%---------------------------------------- - -@x -@d eTeX_int=glue_val+4 {first of \eTeX\ codes for integers} -@y -@d Aleph_int=glue_val+4 {first of \Aleph\ codes for integers} -@d Aleph_int_num=5 {number of \Aleph\ integers} -@d eTeX_int=Aleph_int+Aleph_int_num {first of \eTeX\ codes for integers} -@z - -@x -@d omega_code=5 {command code for \.{\\OmegaVersion}} -@d job_name_code=6 {command code for \.{\\jobname}} -@y -@d etex_code=5 {command code for \.{\\eTeXVersion}} -@d omega_code=6 {command code for \.{\\OmegaVersion}} -@d aleph_code=7 {command code for \.{\\AlephVersion}} -@d job_name_code=8 {command code for \.{\\jobname}} -@z - -@x -primitive("OmegaVersion",convert,omega_code);@/ -@!@:omega_version_}{\.{\\OmegaVersion} primitive@> -@y -primitive("eTeXVersion",convert,etex_code);@/ -@!@:omega_version_}{\.{\\OmegaVersion} primitive@> -primitive("OmegaVersion",convert,omega_code);@/ -@!@:omega_version_}{\.{\\OmegaVersion} primitive@> -primitive("AlephVersion",convert,aleph_code);@/ -@!@:aleph_version_}{\.{\\AlephVersion} primitive@> -@z - -% NOTE: we also put jobname in its own -% field. Why was it not put there? -@x - omega_code: print_esc("OmegaVersion"); - @/@@/ - othercases print_esc("jobname") -@y - etex_code: print_esc("eTeXVersion"); - omega_code: print_esc("OmegaVersion"); - aleph_code: print_esc("AlephVersion"); - job_name_code: print_esc("jobname"); - @/@@/ - othercases print_esc("???") -@z - -@x -omega_code:; -job_name_code: if job_name=0 then open_log_file; -@y -etex_code: do_nothing; -omega_code: do_nothing; -aleph_code: do_nothing; -job_name_code: if job_name=0 then open_log_file; -@z - -@x -omega_code: print("1.15"); -job_name_code: print(job_name); -@y -etex_code: print(eTeX_version_string); -omega_code: print(Omega_version_string); -aleph_code: print(Aleph_version_string); -job_name_code: print(job_name); -@z - -@x -@d eTeX_version_code=eTeX_int {code for \.{\\eTeXversion}} -@d eTeX_revision_code=job_name_code+1 {command code for \.{\\eTeXrevision}} - -@= -primitive("lastnodetype",last_item,last_node_type_code); -@!@:last_node_type_}{\.{\\lastnodetype} primitive@> -primitive("eTeXversion",last_item,eTeX_version_code); -@!@:eTeX_version_}{\.{\\eTeXversion} primitive@> -primitive("eTeXrevision",convert,eTeX_revision_code);@/ -@!@:eTeX_revision_}{\.{\\eTeXrevision} primitive@> - -@ @= -last_node_type_code: print_esc("lastnodetype"); -eTeX_version_code: print_esc("eTeXversion"); - -@ @= -eTeX_version_code: cur_val:=eTeX_version; - -@ @= -eTeX_revision_code: print_esc("eTeXrevision"); - -@ @= -eTeX_revision_code: do_nothing; - -@ @= -eTeX_revision_code: print(eTeX_revision); -@y -@d Aleph_version_code=Aleph_int {code for \.{\\Alephversion}} -@d Omega_version_code=Aleph_int+1 {code for \.{\\Omegaversion}} -@d Aleph_minor_version_code=Aleph_int+2 {code for \.{\\Alephminorversion}} -@d Omega_minor_version_code=Aleph_int+3 {code for \.{\\Omegaminorversion}} -@d eTeX_minor_version_code=Aleph_int+4 {code for \.{\\eTeXminorversion}} -@d eTeX_version_code=eTeX_int {code for \.{\\eTeXversion}} -@d Aleph_revision_code=job_name_code+1 {command code for \.{\\Alephrevision}} -@d Omega_revision_code=job_name_code+2 {command code for \.{\\Omegarevision}} -@d eTeX_revision_code=job_name_code+3 {command code for \.{\\eTeXrevision}} - -@= -primitive("lastnodetype",last_item,last_node_type_code); -@!@:last_node_type_}{\.{\\lastnodetype} primitive@> -primitive("Alephversion",last_item,Aleph_version_code); -@!@:eTeX_version_}{\.{\\Alephversion} primitive@> -primitive("Omegaversion",last_item,Omega_version_code); -@!@:eTeX_version_}{\.{\\Omegaversion} primitive@> -primitive("eTeXversion",last_item,eTeX_version_code); -@!@:eTeX_version_}{\.{\\eTeXversion} primitive@> -primitive("Alephminorversion",last_item,Aleph_minor_version_code); -@!@:eTeX_minor_version_}{\.{\\Alephminorversion} primitive@> -primitive("Omegaminorversion",last_item,Omega_minor_version_code); -@!@:eTeX_minor_version_}{\.{\\Omegaminorversion} primitive@> -primitive("eTeXminorversion",last_item,eTeX_minor_version_code); -@!@:eTeX_minor_version_}{\.{\\eTeXminorversion} primitive@> -primitive("Alephrevision",convert,Aleph_revision_code);@/ -@!@:eTeX_revision_}{\.{\\Alephrevision} primitive@> -primitive("Omegarevision",convert,Omega_revision_code);@/ -@!@:eTeX_revision_}{\.{\\Omegarevision} primitive@> -primitive("eTeXrevision",convert,eTeX_revision_code);@/ -@!@:eTeX_revision_}{\.{\\eTeXrevision} primitive@> - -@ @= -last_node_type_code: print_esc("lastnodetype"); -Aleph_version_code: print_esc("Alephversion"); -Omega_version_code: print_esc("Omegaversion"); -eTeX_version_code: print_esc("eTeXversion"); -Aleph_minor_version_code: print_esc("Alephminorversion"); -Omega_minor_version_code: print_esc("Omegaminorversion"); -eTeX_minor_version_code: print_esc("eTeXminorversion"); - -@ @= -Aleph_version_code: cur_val:=Aleph_version; -Omega_version_code: cur_val:=Omega_version; -eTeX_version_code: cur_val:=eTeX_version; -Aleph_minor_version_code: cur_val:=Aleph_minor_version; -Omega_minor_version_code: cur_val:=Omega_minor_version; -eTeX_minor_version_code: cur_val:=eTeX_minor_version; - -@ @= -Aleph_revision_code: print_esc("Alephrevision"); -Omega_revision_code: print_esc("Omegarevision"); -eTeX_revision_code: print_esc("eTeXrevision"); - -@ @= -Aleph_revision_code: do_nothing; -Omega_revision_code: do_nothing; -eTeX_revision_code: do_nothing; - -@ @= -Aleph_revision_code: print(Aleph_revision); -Omega_revision_code: print(Omega_revision); -eTeX_revision_code: print(eTeX_revision); -@z diff --git a/Build/source/texk/web2c/alephdir/eover.ch b/Build/source/texk/web2c/alephdir/eover.ch new file mode 100644 index 00000000000..ff70c7e3158 --- /dev/null +++ b/Build/source/texk/web2c/alephdir/eover.ch @@ -0,0 +1,230 @@ +% Aleph version-specific stuff; +% * we define the banner and everything to be +% Aleph specific (with Aleph version numbering +% added to the sequence --yes, I know it sucks) +% * we add both \eTeX-like and \OMEGA-like +% commands to display the version +@x +@d banner=='This is Aleph, Version 3.1415926--1.15--2.1' {printed when \TeX\ starts} +@# +@d eTeX_version_string=='3.1415926--1.15--2.1' {current \eTeX\ version} +@d eTeX_version=2 { \.{\\eTeXversion} } +@d eTeX_revision==".1" { \.{\\eTeXrevision} } +@# +@d eTeX_banner=='This is Aleph, Version ',eTeX_version_string + {printed when \eTeX\ starts} +@y +@d eTeX_version_banner=='2.1' {current \eTeX\ version} +@d Omega_version_banner=='1.15' {current $\Omega$ version} +@d Aleph_version_banner=='0.0-rc4' {current \Aleph\ version} +@d eTeX_version_string=="2.1" {current \eTeX\ version} +@d Omega_version_string=="1.15" { \.{\\OmegaVersion} } +@d Aleph_version_string=="0.0" { \.{\\AlephVersion} } +@d eTeX_version=2 { \.{\\eTeXversion} } +@d Omega_version=1 { \.{\\Omegaversion} } +@d Aleph_version=0 { \.{\\Alephversion} } +@d eTeX_minor_version=1 { \.{\\eTeXminorversion} } +@d Omega_minor_version=15 { \.{\\Omegaminorversion} } +@d Aleph_minor_version=0 { \.{\\Alephminorversion} } +@d eTeX_revision==".1" { \.{\\eTeXrevision} } +@d Omega_revision==".15" { \.{\\Omegarevision} } +@d Aleph_revision==".0" { \.{\\Alephrevision} } +@# +@d banner=='This is Aleph, Version 3.1415926-',Omega_version_banner,'-',eTeX_version_banner,'-',Aleph_version_banner {printed when \TeX\ starts} +@d eTeX_banner==banner + {printed when \eTeX\ starts} +@z + +% === Aleph history === +%---------------------------------------- +% Version: 0.0 (RC0) +% Internal name: the successfull merge +% Achievement: main executable that would run +% Release date: 20030131 +%---------------------------------------- +% Version: 0.0 (RC1) +% Internal name: the successfull trip (NOT) +% Achievement: fixed the major 'trip' bug +% making Aleph usable for +% production use +% Release date: 20030511 +%---------------------------------------- +% Version: 0.0 (RC2) +% Internal name: the name change +% Achievement: add \boxdir +% add versioning info +% add version-retrieving commands +% fix \overfullrule>0pt +% fix \charit +% fix non-TLT text offset +% fix leaders crashing or stalling +% Release date: 20040322 +%---------------------------------------- +% Version: 0.0 (RC3) +% Internal name: Oh Tea Peas +% Achievement: fix some OTP/OCP-related bugs +% Release date: 20040609 +%---------------------------------------- +% Version: 0.0 (RC4) +% Internal name: Nothing really +% Achievement: adapt to latest web2c changes +% Release date: 20040909 +%---------------------------------------- + +@x +@d eTeX_int=glue_val+4 {first of \eTeX\ codes for integers} +@y +@d Aleph_int=glue_val+4 {first of \Aleph\ codes for integers} +@d Aleph_int_num=5 {number of \Aleph\ integers} +@d eTeX_int=Aleph_int+Aleph_int_num {first of \eTeX\ codes for integers} +@z + +@x +@d omega_code=5 {command code for \.{\\OmegaVersion}} +@d job_name_code=6 {command code for \.{\\jobname}} +@y +@d etex_code=5 {command code for \.{\\eTeXVersion}} +@d omega_code=6 {command code for \.{\\OmegaVersion}} +@d aleph_code=7 {command code for \.{\\AlephVersion}} +@d job_name_code=8 {command code for \.{\\jobname}} +@z + +@x +primitive("OmegaVersion",convert,omega_code);@/ +@!@:omega_version_}{\.{\\OmegaVersion} primitive@> +@y +primitive("eTeXVersion",convert,etex_code);@/ +@!@:omega_version_}{\.{\\OmegaVersion} primitive@> +primitive("OmegaVersion",convert,omega_code);@/ +@!@:omega_version_}{\.{\\OmegaVersion} primitive@> +primitive("AlephVersion",convert,aleph_code);@/ +@!@:aleph_version_}{\.{\\AlephVersion} primitive@> +@z + +% NOTE: we also put jobname in its own +% field. Why was it not put there? +@x + omega_code: print_esc("OmegaVersion"); + @/@@/ + othercases print_esc("jobname") +@y + etex_code: print_esc("eTeXVersion"); + omega_code: print_esc("OmegaVersion"); + aleph_code: print_esc("AlephVersion"); + job_name_code: print_esc("jobname"); + @/@@/ + othercases print_esc("???") +@z + +@x +omega_code:; +job_name_code: if job_name=0 then open_log_file; +@y +etex_code: do_nothing; +omega_code: do_nothing; +aleph_code: do_nothing; +job_name_code: if job_name=0 then open_log_file; +@z + +@x +omega_code: print("1.15"); +job_name_code: print(job_name); +@y +etex_code: print(eTeX_version_string); +omega_code: print(Omega_version_string); +aleph_code: print(Aleph_version_string); +job_name_code: print(job_name); +@z + +@x +@d eTeX_version_code=eTeX_int {code for \.{\\eTeXversion}} +@d eTeX_revision_code=job_name_code+1 {command code for \.{\\eTeXrevision}} + +@= +primitive("lastnodetype",last_item,last_node_type_code); +@!@:last_node_type_}{\.{\\lastnodetype} primitive@> +primitive("eTeXversion",last_item,eTeX_version_code); +@!@:eTeX_version_}{\.{\\eTeXversion} primitive@> +primitive("eTeXrevision",convert,eTeX_revision_code);@/ +@!@:eTeX_revision_}{\.{\\eTeXrevision} primitive@> + +@ @= +last_node_type_code: print_esc("lastnodetype"); +eTeX_version_code: print_esc("eTeXversion"); + +@ @= +eTeX_version_code: cur_val:=eTeX_version; + +@ @= +eTeX_revision_code: print_esc("eTeXrevision"); + +@ @= +eTeX_revision_code: do_nothing; + +@ @= +eTeX_revision_code: print(eTeX_revision); +@y +@d Aleph_version_code=Aleph_int {code for \.{\\Alephversion}} +@d Omega_version_code=Aleph_int+1 {code for \.{\\Omegaversion}} +@d Aleph_minor_version_code=Aleph_int+2 {code for \.{\\Alephminorversion}} +@d Omega_minor_version_code=Aleph_int+3 {code for \.{\\Omegaminorversion}} +@d eTeX_minor_version_code=Aleph_int+4 {code for \.{\\eTeXminorversion}} +@d eTeX_version_code=eTeX_int {code for \.{\\eTeXversion}} +@d Aleph_revision_code=job_name_code+1 {command code for \.{\\Alephrevision}} +@d Omega_revision_code=job_name_code+2 {command code for \.{\\Omegarevision}} +@d eTeX_revision_code=job_name_code+3 {command code for \.{\\eTeXrevision}} + +@= +primitive("lastnodetype",last_item,last_node_type_code); +@!@:last_node_type_}{\.{\\lastnodetype} primitive@> +primitive("Alephversion",last_item,Aleph_version_code); +@!@:eTeX_version_}{\.{\\Alephversion} primitive@> +primitive("Omegaversion",last_item,Omega_version_code); +@!@:eTeX_version_}{\.{\\Omegaversion} primitive@> +primitive("eTeXversion",last_item,eTeX_version_code); +@!@:eTeX_version_}{\.{\\eTeXversion} primitive@> +primitive("Alephminorversion",last_item,Aleph_minor_version_code); +@!@:eTeX_minor_version_}{\.{\\Alephminorversion} primitive@> +primitive("Omegaminorversion",last_item,Omega_minor_version_code); +@!@:eTeX_minor_version_}{\.{\\Omegaminorversion} primitive@> +primitive("eTeXminorversion",last_item,eTeX_minor_version_code); +@!@:eTeX_minor_version_}{\.{\\eTeXminorversion} primitive@> +primitive("Alephrevision",convert,Aleph_revision_code);@/ +@!@:eTeX_revision_}{\.{\\Alephrevision} primitive@> +primitive("Omegarevision",convert,Omega_revision_code);@/ +@!@:eTeX_revision_}{\.{\\Omegarevision} primitive@> +primitive("eTeXrevision",convert,eTeX_revision_code);@/ +@!@:eTeX_revision_}{\.{\\eTeXrevision} primitive@> + +@ @= +last_node_type_code: print_esc("lastnodetype"); +Aleph_version_code: print_esc("Alephversion"); +Omega_version_code: print_esc("Omegaversion"); +eTeX_version_code: print_esc("eTeXversion"); +Aleph_minor_version_code: print_esc("Alephminorversion"); +Omega_minor_version_code: print_esc("Omegaminorversion"); +eTeX_minor_version_code: print_esc("eTeXminorversion"); + +@ @= +Aleph_version_code: cur_val:=Aleph_version; +Omega_version_code: cur_val:=Omega_version; +eTeX_version_code: cur_val:=eTeX_version; +Aleph_minor_version_code: cur_val:=Aleph_minor_version; +Omega_minor_version_code: cur_val:=Omega_minor_version; +eTeX_minor_version_code: cur_val:=eTeX_minor_version; + +@ @= +Aleph_revision_code: print_esc("Alephrevision"); +Omega_revision_code: print_esc("Omegarevision"); +eTeX_revision_code: print_esc("eTeXrevision"); + +@ @= +Aleph_revision_code: do_nothing; +Omega_revision_code: do_nothing; +eTeX_revision_code: do_nothing; + +@ @= +Aleph_revision_code: print(Aleph_revision); +Omega_revision_code: print(Omega_revision); +eTeX_revision_code: print(eTeX_revision); +@z -- cgit v1.2.3