summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/zztex/tex/zztex.tex
blob: 203affbfac08cb44bba0a1fbf638ed374922f8b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Module:    ZzTeX Main Module
%
% Synopsis:  This is the main module of ZzTeX.  It sets up character
%            categories and loads all the other modules.
%
% Note:      ZzTeX assumes the use of DVIPSONE, the PostScript DVI program
%            from Y&Y.
%
% Author:    Paul C. Anagnostopoulos
% Created:   27 March 1989
%
% Copyright 1989--2020 by Paul C. Anagnostopoulos
% under The MIT License (opensource.org/licenses/MIT)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% If ZzTeX is already loaded, quit immediately.

\ifx \ZzTeX\zzzundefinedzzz \else \message{... using format}\endinput \fi

%                       Character Categories
%                       --------- ----------


%  Character   INITEX         ZzTeX             Notes
%
%  NUL         ignored        invalid           Ignored in Plain TeX.
%  TAB                        invalid           Space in Plain TeX.
%  FORMFEED                   active: \par
%  RETURN      end of line    end of line
%  space       space          space
%  #                          parameter
%  $                          math shift
%  &                          alignment tab
%  %           comment        comment
%  @           other          active: command
%  letters     letter         letter
%  \           escape         escape
%  ^                          superscript
%  _                          subscript
%  {                          begin group
%  }                          end group
%  ~                          active: tie
%  DELETE      invalid        invalid
%  others      other          invalid


\chardef \catescape      =  0 %  Escape character (\).          %^catcode
\chardef \catbegin       =  1 %  Begin group ({).               %^catcode
\chardef \catend         =  2 %  End group (}).                 %^catcode
\chardef \catmath        =  3 %  Math mode ($).                 %^catcode
\chardef \catalign       =  4 %  Alignment tab (&).             %^catcode
\chardef \catendofline   =  5 %  End of line.                   %^catcode
\chardef \catparameter   =  6 %  Parameter (#).                 %^catcode
\chardef \catsuperscript =  7 %  Superscript (^).               %^catcode
\chardef \catsubscript   =  8 %  Subscript (_).                 %^catcode
\chardef \catignored     =  9 %  Ignored character.             %^catcode
\chardef \catspace       = 10 %  Space.                         %^catcode
\chardef \catletter      = 11 %  Letter.                        %^catcode
\chardef \catother       = 12 %  Other.                         %^catcode
\chardef \catactive      = 13 %  Active character (tilde).      %^catcode
\chardef \catcomment     = 14 %  Comment (percent).             %^catcode
\chardef \catinvalid     = 15 %  Invalid character.             %^catcode
\chardef \catcsname      = 16

\catcode`\^   = \catsuperscript
\catcode`\^^@ = \catinvalid
\catcode`\^^I = \catinvalid
\catcode`\^^L = \catactive
\catcode`\^^M = \catendofline
\catcode`\    = \catspace
\catcode`\#   = \catparameter
\catcode`\$   = \catmath
\catcode`\&   = \catalign
\catcode`\%   = \catcomment
\catcode`\@   = \catactive
\catcode`\\   = \catescape
\catcode`\_   = \catsubscript
\catcode`\{   = \catbegin
\catcode`\}   = \catend
\catcode`\~   = \catactive
\catcode`\^^? = \catinvalid

% Characters "80--"FF are catcoded as invalid in zzmisc.

\outer \def ^^L{\par}

%                       Atsign Commands
%                       ------ --------


% At-sign commands are reserved for extended commands within blocks.
% \defineatsigncommand makes a local definition!


\def \defineatsigncommand @#1{%                         char args {body}
  \withname\def{\zat#1}}

\def @#1{%                                              char
  %%%\relax % Stops \omit search in an alignment cell.
  \if \undefinedp{\zat#1}%
    \error{undefat}{The atsign command `\string@#1' is not defined
                    in this block}%
  \fi
  \name{\zat#1}}

%                       Markers
%                       -------


% This command does nothing, but it provides a name on which to
% hang a comment for ZzExplore.

\def \definemarker #1{%                                 {marker-name}
  }

%                       Paragraph Programs
%                       --------- --------


% We maintain a list of little programs that must be executed
% at the beginning of every paragraph.  A program is declared
% with `\declareeverypar'.  The programs are executed with
% `\requiredeverypar'.

\def \everyparlist {}

\def \declareeverypar #1{%                              {code}
  \append{#1}{\everyparlist}}

\def \requiredeverypar {%
  \maplist{##1}{\everyparlist}}

%                       Modules
%                       -------


\def \zremovePlaindef #1{%
  \let #1= \relax}

\input zzprog           % Must be first.
\input zzreg            % Must be second. 
\input zzerror
\input zzhelp
\input zzio
\input zzfont
\input zzvmode
\input zzhmode
\input zzhmodeb
\input zzhyph
\input zzltrspc
\input zzblock
\input zzxref
\input zzdoc
\input zzdiv
\input zzpage
\input zzoverlay
\input zzindexv1        % Must precede body files.
\input zzsect
\input zztext
\input zztabbing
\input zznote
\input zzlist
\input zztabularv3
\input zzfloat
\input zzart
\input zztag
\input zzmath
\input zzfront
\input zzps
\input zzhyper
\input zzmisc           % Must be next to last.
\input zzplain          % Must be last.

%                       Identification
%                       --------------


\def \TeX {T\kern-.1667em \lower .55ex \hbox{E}\kern-.1em X}
\def \ZzTeX {Z\kern -.02em z\kern -.05em \TeX}

\input zzver\relax

\everyjob = {\messagenl{__Welcome to ZzTeX version \ZzTeXversion__}}

\def  \fmtname    {ZzTeX}
\edef \fmtversion {\ZzTeXversion}


\messagenl{__Welcome to ZzTeX version \ZzTeXversion__}

\if \orp{\hmodep}{\posp{\pagetotal}}
  \zzerror{Spurious paragraph text appears in the ZzTeX files}% 
\fi