core-ini.mkiv /size: 5437 b    last modification: 2021-10-28 13:50
1%D \module
2%D   [       file=core-ini,
3%D        version=2003.12.01,
4%D          title=\CONTEXT\ Core Macros,
5%D       subtitle=Additional Initialization,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\writestatus{loading}{ConTeXt Core Macros / Additional Initialization}
15
16\unprotect
17
18%D We introduce a couple of variables that are used all over \CONTEXT. Alternatively
19%D we could define them in each module but as they are part of the bigger picture we
20%D prefer to do it here. Ideally we should hav ea proper dependency tree but it might
21%D be that we want to make versions with a smaller footprints in which case one would
22%D still need to define the token list registers (unless we could do that runtime).
23
24%D \macros
25%D   {every...}
26%D
27%D A few every's.
28
29%D Output routine:
30
31\newtoks \everybeforeoutput
32\newtoks \everyafteroutput
33
34%D Shipout:
35
36\newtoks \everyshipout
37\newtoks \everybeforeshipout
38\newtoks \everyaftershipout
39\newtoks \everyfirstshipout
40\newtoks \everylastshipout
41
42%D End of run:
43
44\newtoks \everybye
45\newtoks \everygoodbye
46\newtoks \everynotabene
47
48%D Document:
49
50\newtoks \everyendoftextbody
51
52\newtoks \everystarttext
53\newtoks \everystoptext
54
55\newtoks \everystartdocument
56\newtoks \everystopdocument
57
58%D Purity:
59
60\newtoks \everyforgetall
61\newtoks \everycleanupfeatures
62\newtoks \everysimplifycommands
63\newtoks \everypreroll
64
65\let\simplifiedcommands\everysimplifycommands % backward compatible, will stay as it's used in styles
66
67\newconditional\simplifyingcommands % public
68
69\unexpanded\def\forgetall       {\the\everyforgetall}
70\unexpanded\def\cleanupfeatures {\the\everycleanupfeatures}
71\unexpanded\def\simplifycommands{\the\everysimplifycommands}
72
73\appendtoks
74    \settrue\simplifyingcommands
75\to \everysimplifycommands
76
77\appendtoks
78    \everypar\emptytoks % pretty important
79\to \everyforgetall
80
81%D Page building:
82
83\newtoks \everybeforepagebody
84\newtoks \everyafterpagebody
85
86\let\everypagebody\everybeforepagebody % backward compatible, will become obsolete
87
88%D Floats:
89
90\newtoks \everyinsidefloat
91
92%D Exporting:
93
94\newtoks \everyinitializeexport
95
96%D Sectioning:
97
98%newtoks \everyheadstart
99
100%D Par building (experimental, used in xml <p> .. </p>)
101
102\newtoks \everybeginofpar
103\newtoks \everyendofpar
104%newtoks \everyparflush
105
106\unexpanded\def\bpar{\the\everybeginofpar\ignorespaces}                  % may interfere with \everypar
107\unexpanded\def\epar{\ifhmode\removeunwantedspaces\the\everyendofpar\fi} % test prevents problems with \bpar\epar
108
109%D Lists:
110
111\newtoks \everylistentry
112\newtoks \everysavesortkeys
113
114%D Marks:
115
116%newtoks \everymarking
117
118%D Fonts:
119
120\newtoks \everyfont
121\newtoks \everyglobalbodyfont
122\newtoks \everydefinedfont
123
124\newtoks \everybodyfont
125\newtoks \everyfontswitch
126
127\newtoks \everysetupbodyfont
128\newtoks \everyswitchtobodyfont
129
130%D Math:
131
132\newtoks \everybeforedisplayformula
133\newtoks \everymathematics
134
135\prependtoks \the\everymathematics \to \everymath
136\prependtoks \the\everymathematics \to \everydisplay
137
138%D Tables:
139
140%newtoks \everytable % we need to disstinguish kinds
141
142%D State mess:
143
144\newtoks \everypushsomestate
145\newtoks \everypopsomestate
146
147\unexpanded\def\pushsomestates{\the\everypushsomestate}
148\unexpanded\def\popsomestates {\the\everypopsomestate }
149
150%D More generic (used to be pushcolor etc)
151
152\newtoks\everystarttextproperties
153\newtoks\everystoptextproperties
154
155\unexpanded\def\starttextproperties{\the\everystarttextproperties}
156\unexpanded\def\stoptextproperties {\the\everystoptextproperties}
157
158%D \macros
159%D   {trialtypesetting}
160%D
161%D We disable trial typesetting in the output routine,
162%D just to be sure.
163
164\prependtoks
165    \resettrialtypesetting
166\to \everybeforepagebody
167
168%D \macros
169%D   {ifinpagebody,ifinsidecolumns,ifdoublesided,ifsinglesided}
170%D
171%D These will become system modes and conditionals
172
173\newif \ifinpagebody
174\newif \ifinsidecolumns
175\newif \ifinsidemulticolumns  % simple mixed-in-text columns
176\newif \ifdoublesided         \doublesidedfalse
177\newif \ifsinglesided         \singlesidedtrue
178\newif \ifinsidefloat
179\newif \ifdoingblocks
180\newif \ifgridsnapping
181\newif \ifexporting
182
183\newconstant\pageduplexmode % 0 single 1 double 2 mix
184\newconstant\pagebodymode   % 0 not 1 normal pagebody 2 spread
185
186\newcount\nofcolumns      \nofcolumns     \plusone
187\newcount\nofmulticolumns \nofmulticolumns\plusone
188
189%D \macros
190%D   {ifproductionrun}
191%D
192%D This boolean can be used to bypass certain initializations.
193
194% \newif\ifproductionrun % already defined
195
196\appendtoks
197    \productionruntrue
198\to \everydump
199
200%D \macros
201%D   {everyboxedcontent, ifboxedcontent,
202%D    startboxedcontent, stopboxedcontent}
203%D
204%D This one is relatively new and will be used as a more robust test for inner
205%D situations.
206
207\newif  \ifboxedcontent
208\newtoks\everyboxedcontent
209
210\appendtoks
211    \boxedcontenttrue
212\to \everyboxedcontent
213
214\unexpanded\def\startboxedcontent{\bgroup\the\everyboxedcontent}
215
216\let\stopboxedcontent\egroup
217
218%D We store some original meanings, maybe in \type {math-ini}.
219
220\let\normalat   \at
221\let\normalin   \in
222\let\normalfrom \from
223%let\normalover \over
224\let\normalabout\about
225
226%D This will be implemented way later:
227
228\let\setlayoutcomponentattribute  \gobbleoneargument
229\let\resetlayoutcomponentattribute\relax
230\let\layoutcomponentboxattribute  \empty
231
232\protect \endinput
233