| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% |
| 3 |
% Module: ZzTeX Main Module |
| 4 |
% |
| 5 |
% Synopsis: This is the main module of ZzTeX. It sets up character |
| 6 |
% categories and loads all the other modules. |
| 7 |
% |
| 8 |
% Note: ZzTeX assumes the use of DVIPSONE, the PostScript DVI program |
| 9 |
% from Y&Y. |
| 10 |
% |
| 11 |
% Author: Paul C. Anagnostopoulos |
| 12 |
% Created: 27 March 1989 |
| 13 |
% |
| 14 |
% Copyright 1989--2020 by Paul C. Anagnostopoulos |
| 15 |
% under The MIT License (opensource.org/licenses/MIT) |
| 16 |
% |
| 17 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 18 |
|
| 19 |
% If ZzTeX is already loaded, quit immediately. |
| 20 |
|
| 21 |
\ifx \ZzTeX\zzzundefinedzzz \else \message{... using format}\endinput \fi |
| 22 |
|
| 23 |
% Character Categories |
| 24 |
% --------- ---------- |
| 25 |
|
| 26 |
|
| 27 |
% Character INITEX ZzTeX Notes |
| 28 |
% |
| 29 |
% NUL ignored invalid Ignored in Plain TeX. |
| 30 |
% TAB invalid Space in Plain TeX. |
| 31 |
% FORMFEED active: \par |
| 32 |
% RETURN end of line end of line |
| 33 |
% space space space |
| 34 |
% # parameter |
| 35 |
% $ math shift |
| 36 |
% & alignment tab |
| 37 |
% % comment comment |
| 38 |
% @ other active: command |
| 39 |
% letters letter letter |
| 40 |
% \ escape escape |
| 41 |
% ^ superscript |
| 42 |
% _ subscript |
| 43 |
% { begin group |
| 44 |
% } end group |
| 45 |
% ~ active: tie |
| 46 |
% DELETE invalid invalid |
| 47 |
% others other invalid |
| 48 |
|
| 49 |
|
| 50 |
\chardef \catescape = 0 % Escape character (\). %^catcode |
| 51 |
\chardef \catbegin = 1 % Begin group ({). %^catcode |
| 52 |
\chardef \catend = 2 % End group (}). %^catcode |
| 53 |
\chardef \catmath = 3 % Math mode ($). %^catcode |
| 54 |
\chardef \catalign = 4 % Alignment tab (&). %^catcode |
| 55 |
\chardef \catendofline = 5 % End of line. %^catcode |
| 56 |
\chardef \catparameter = 6 % Parameter (#). %^catcode |
| 57 |
\chardef \catsuperscript = 7 % Superscript (^). %^catcode |
| 58 |
\chardef \catsubscript = 8 % Subscript (_). %^catcode |
| 59 |
\chardef \catignored = 9 % Ignored character. %^catcode |
| 60 |
\chardef \catspace = 10 % Space. %^catcode |
| 61 |
\chardef \catletter = 11 % Letter. %^catcode |
| 62 |
\chardef \catother = 12 % Other. %^catcode |
| 63 |
\chardef \catactive = 13 % Active character (tilde). %^catcode |
| 64 |
\chardef \catcomment = 14 % Comment (percent). %^catcode |
| 65 |
\chardef \catinvalid = 15 % Invalid character. %^catcode |
| 66 |
\chardef \catcsname = 16 |
| 67 |
|
| 68 |
\catcode`\^ = \catsuperscript |
| 69 |
\catcode`\^^@ = \catinvalid |
| 70 |
\catcode`\^^I = \catinvalid |
| 71 |
\catcode`\^^L = \catactive |
| 72 |
\catcode`\^^M = \catendofline |
| 73 |
\catcode`\ = \catspace |
| 74 |
\catcode`\# = \catparameter |
| 75 |
\catcode`\$ = \catmath |
| 76 |
\catcode`\& = \catalign |
| 77 |
\catcode`\% = \catcomment |
| 78 |
\catcode`\@ = \catactive |
| 79 |
\catcode`\\ = \catescape |
| 80 |
\catcode`\_ = \catsubscript |
| 81 |
\catcode`\{ = \catbegin |
| 82 |
\catcode`\} = \catend |
| 83 |
\catcode`\~ = \catactive |
| 84 |
\catcode`\^^? = \catinvalid |
| 85 |
|
| 86 |
% Characters "80--"FF are catcoded as invalid in zzmisc. |
| 87 |
|
| 88 |
\outer \def ^^L{\par} |
| 89 |
|
| 90 |
% Atsign Commands |
| 91 |
% ------ -------- |
| 92 |
|
| 93 |
|
| 94 |
% At-sign commands are reserved for extended commands within blocks. |
| 95 |
% \defineatsigncommand makes a local definition! |
| 96 |
|
| 97 |
|
| 98 |
\def \defineatsigncommand @#1{% char args {body} |
| 99 |
\withname\def{\zat#1}} |
| 100 |
|
| 101 |
\def @#1{% char |
| 102 |
%%%\relax % Stops \omit search in an alignment cell. |
| 103 |
\if \undefinedp{\zat#1}% |
| 104 |
\error{undefat}{The atsign command `\string@#1' is not defined |
| 105 |
in this block}% |
| 106 |
\fi |
| 107 |
\name{\zat#1}} |
| 108 |
|
| 109 |
% Markers |
| 110 |
% ------- |
| 111 |
|
| 112 |
|
| 113 |
% This command does nothing, but it provides a name on which to |
| 114 |
% hang a comment for ZzExplore. |
| 115 |
|
| 116 |
\def \definemarker #1{% {marker-name} |
| 117 |
} |
| 118 |
|
| 119 |
% Paragraph Programs |
| 120 |
% --------- -------- |
| 121 |
|
| 122 |
|
| 123 |
% We maintain a list of little programs that must be executed |
| 124 |
% at the beginning of every paragraph. A program is declared |
| 125 |
% with `\declareeverypar'. The programs are executed with |
| 126 |
% `\requiredeverypar'. |
| 127 |
|
| 128 |
\def \everyparlist {} |
| 129 |
|
| 130 |
\def \declareeverypar #1{% {code} |
| 131 |
\append{#1}{\everyparlist}} |
| 132 |
|
| 133 |
\def \requiredeverypar {% |
| 134 |
\maplist{##1}{\everyparlist}} |
| 135 |
|
| 136 |
% Modules |
| 137 |
% ------- |
| 138 |
|
| 139 |
|
| 140 |
\def \zremovePlaindef #1{% |
| 141 |
\let #1= \relax} |
| 142 |
|
| 143 |
\input zzprog % Must be first. |
| 144 |
\input zzreg % Must be second. |
| 145 |
\input zzerror |
| 146 |
\input zzhelp |
| 147 |
\input zzio |
| 148 |
\input zzfont |
| 149 |
\input zzvmode |
| 150 |
\input zzhmode |
| 151 |
\input zzhmodeb |
| 152 |
\input zzhyph |
| 153 |
\input zzltrspc |
| 154 |
\input zzblock |
| 155 |
\input zzxref |
| 156 |
\input zzdoc |
| 157 |
\input zzdiv |
| 158 |
\input zzpage |
| 159 |
\input zzoverlay |
| 160 |
\input zzindexv1 % Must precede body files. |
| 161 |
\input zzsect |
| 162 |
\input zztext |
| 163 |
\input zztabbing |
| 164 |
\input zznote |
| 165 |
\input zzlist |
| 166 |
\input zztabularv3 |
| 167 |
\input zzfloat |
| 168 |
\input zzart |
| 169 |
\input zztag |
| 170 |
\input zzmath |
| 171 |
\input zzfront |
| 172 |
\input zzps |
| 173 |
\input zzhyper |
| 174 |
\input zzmisc % Must be next to last. |
| 175 |
\input zzplain % Must be last. |
| 176 |
|
| 177 |
% Identification |
| 178 |
% -------------- |
| 179 |
|
| 180 |
|
| 181 |
\def \TeX {T\kern-.1667em \lower .55ex \hbox{E}\kern-.1em X} |
| 182 |
\def \ZzTeX {Z\kern -.02em z\kern -.05em \TeX} |
| 183 |
|
| 184 |
\input zzver\relax |
| 185 |
|
| 186 |
\everyjob = {\messagenl{__Welcome to ZzTeX version \ZzTeXversion__}} |
| 187 |
|
| 188 |
\def \fmtname {ZzTeX} |
| 189 |
\edef \fmtversion {\ZzTeXversion} |
| 190 |
|
| 191 |
|
| 192 |
\messagenl{__Welcome to ZzTeX version \ZzTeXversion__} |
| 193 |
|
| 194 |
\if \orp{\hmodep}{\posp{\pagetotal}} |
| 195 |
\zzerror{Spurious paragraph text appears in the ZzTeX files}% |
| 196 |
\fi |