blob: 69c45b2546651bffdc8ea1d33fabb77c50a11cbd (
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
%%
%% This is file `luatexbase-cctb.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% luatexbase-cctb.dtx (with options: `texpackage')
%%
%% See the aforementioned source file(s) for copyright and licensing information.
%%
\begingroup\catcode61\catcode48\catcode32=10\relax% = and space
\catcode123 1 % {
\catcode125 2 % }
\catcode 35 6 % #
\toks0\expandafter{\expandafter\endlinechar\the\endlinechar}%
\edef\x{\endlinechar13}%
\def\y#1 #2 {%
\toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}%
\edef\x{\x \catcode#1 #2}}%
\y 13 5 % carriage return
\y 61 12 % =
\y 32 10 % space
\y 123 1 % {
\y 125 2 % }
\y 35 6 % #
\y 64 11 % @ (letter)
\y 10 12 % new line ^^J
\y 39 12 % '
\y 40 12 % (
\y 41 12 % )
\y 44 12 % ,
\y 45 12 % -
\y 46 12 % .
\y 47 12 % /
\y 58 12 % :
\y 60 12 % <
\y 62 12 % >
\y 91 12 % [
\y 93 12 % ]
\y 94 7 % ^
\y 95 8 % _
\y 96 12 % `
\toks0\expandafter{\the\toks0 \relax\noexpand\endinput}%
\edef\y#1{\noexpand\expandafter\endgroup%
\noexpand\ifx#1\relax \edef#1{\the\toks0}\x\relax%
\noexpand\else \noexpand\expandafter\noexpand\endinput%
\noexpand\fi}%
\expandafter\y\csname luatexbase@cctb@sty@endinput\endcsname%
\begingroup
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
\def\x#1[#2]{\immediate\write16{Package: #1 #2}}
\else
\let\x\ProvidesPackage
\fi
\expandafter\endgroup
\x{luatexbase-cctb}[2013/05/11 v0.6 Catcodetable allocation for LuaTeX]
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
\input ifluatex.sty
\else
\RequirePackage{ifluatex}
\fi
\ifluatex\else
\begingroup
\expandafter\ifx\csname PackageError\endcsname\relax
\def\x#1#2#3{\begingroup \newlinechar10
\errhelp{#3}\errmessage{Package #1 error: #2}\endgroup}
\else
\let\x\PackageError
\fi
\expandafter\endgroup
\x{luatexbase-cctb}{LuaTeX is required for this package. Aborting.}{%
This package can only be used with the LuaTeX engine^^J%
(command `lualatex' or `luatex').^^J%
Package loading has been stopped to prevent additional errors.}
\expandafter\luatexbase@cctb@sty@endinput%
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
\input luatexbase-modutils.sty
\else
\RequirePackage{luatexbase-modutils}
\fi
\luatexbase@directlua{require('luatexbase.cctb')}
\luatexbase@ensure@primitive{luaescapestring}
\luatexbase@ensure@primitive{catcodetable}
\luatexbase@ensure@primitive{initcatcodetable}
\luatexbase@ensure@primitive{savecatcodetable}
\newcount\lltxb@catcodetable@alloc
\lltxb@catcodetable@alloc\m@ne
\newcount\CatcodeTableStack
\CatcodeTableStack\z@
\def\newluatexcatcodetable#1{%
\ifnum\lltxb@catcodetable@alloc<65535\relax
\global\advance\lltxb@catcodetable@alloc\tw@
\allocationnumber\lltxb@catcodetable@alloc
\global\chardef#1\allocationnumber
\luatexinitcatcodetable\allocationnumber
\begingroup\escapechar\m@ne
\luatexbase@directlua{luatexbase.catcodetabledef_from_tex(
'\luatexluaescapestring{\string#1}', '\number\allocationnumber')}%
\endgroup
\wlog{\string#1=\string\luatexcatcodetable\the\allocationnumber}%
\else
\errmessage{No room for a new \string\luatexcatcodetable}%
\fi}
\def\IncCatcodeTableStack{%
\ifnum\CatcodeTableStack<65534\relax
\global\advance\CatcodeTableStack\tw@
\else
\errmessage{CatcodeTableStack overflow}%
\fi}
\def\DecCatcodeTableStack{%
\ifnum\CatcodeTableStack>\z@
\global\advance\CatcodeTableStack-2\relax
\else
\errmessage{CatcodeTableStack underflow}%
\fi}
\expandafter\ifx\csname @tempcnta\endcsname\relax
\csname newcount\endcsname\@tempcnta
\fi
\expandafter\ifx\csname @tempcntb\endcsname\relax
\csname newcount\endcsname\@tempcntb
\fi
\def\SetCatcodeRange#1#2#3{%
\edef\luaSCR@temp{%
\noexpand\@tempcnta=\the\@tempcnta
\noexpand\@tempcntb=\the\@tempcntb
\noexpand\count@=\the\count@
\relax}%
\@tempcnta=#1\relax
\@tempcntb=#2\relax
\count@=#3\relax
\loop\unless\ifnum\@tempcnta>\@tempcntb
\catcode\@tempcnta=\count@
\advance\@tempcnta\@ne
\repeat
\luaSCR@temp}
\def\lltxb@synonym#1#2{%
\def#1{%
\begingroup
\ifdefined\PackageWarning
\let\x\PackageWarning
\else
\def\x####1####2{%
\begingroup \endlinechar10
\message{Package ####1 warning: ####2}%
\endgroup}
\fi
\expandafter\endgroup
\x{luatex}{\string#1 is deprecated^^J%
and will be removed in the next version of the package.^^J%
Please use \string#2 instead.}
\let#1#2%
#1}}
\lltxb@synonym \setcatcoderange \SetCatcodeRange
\def\setluatexcatcodetable#1#2{%
\begingroup
#2%
\luatexsavecatcodetable#1%
\endgroup}
\newluatexcatcodetable\CatcodeTableIniTeX
\newluatexcatcodetable\CatcodeTableString
\setluatexcatcodetable\CatcodeTableString{%
\luatexcatcodetable\CatcodeTableIniTeX
\catcode0 12 % nul
\catcode13 12 % carriage return
\catcode37 12 % percent
\SetCatcodeRange{65}{90}{12}% A-Z
\SetCatcodeRange{97}{122}{12}% a-z
\catcode92 12 % backslash
\catcode127 12 }
\newluatexcatcodetable\CatcodeTableOther
\setluatexcatcodetable\CatcodeTableOther{%
\luatexcatcodetable\CatcodeTableString
\catcode32 12 }
\newluatexcatcodetable\CatcodeTableLaTeX
\setluatexcatcodetable\CatcodeTableLaTeX{%
\luatexcatcodetable\CatcodeTableIniTeX
\SetCatcodeRange{0}{31}{15}%
\catcode9 10 % tab
\catcode10 12 % newline
\catcode12 13 % form feed
\catcode13 5 % carriage return
\catcode35 6 % hash
\catcode36 3 % dollar
\catcode38 4 % ampersand
\catcode94 7 % circumflex
\catcode95 8 % underscore
\catcode123 1 % brace left
\catcode125 2 % brace right
\catcode126 13 % tilde
\catcode127 15 }
\newluatexcatcodetable\CatcodeTableLaTeXAtLetter
\setluatexcatcodetable\CatcodeTableLaTeXAtLetter{%
\luatexcatcodetable\CatcodeTableLaTeX
\catcode64=11 }
\newluatexcatcodetable\CatcodeTableExpl
\setluatexcatcodetable\CatcodeTableExpl{%
\luatexcatcodetable\CatcodeTableLaTeX
\catcode126 10 % tilde is a space char
\catcode32 9 % space is ignored
\catcode9 9 % tab also ignored
\catcode95 11 % underscore letter
\catcode58 11 % colon letter
}
\luatexbase@directlua{luatexbase.catcodetable_do_shortcuts()}
\def\lltxb@cctb@numstack{0}
\def\PushCatcodeTableNumStack{%
\xdef\lltxb@cctb@numstack{{\the\luatexcatcodetable}\lltxb@cctb@numstack}}
\def\PopCatcodeTableNumStack{%
\expandafter\lltxb@cctb@numstack@pop\lltxb@cctb@numstack\@nil}
\def\lltxb@cctb@numstack@pop#1#2\@nil{%
\ifx\empty#2\empty
\begingroup
\ifdefined\PackageWarning
\let\x\PackageWarning
\else
\def\x####1####2{%
\begingroup \endlinechar10
\message{Package ####1 warning: ####2}%
\endgroup}%
\fi
\expandafter\endgroup
\x{luatexbase-cctb}{Popping from an empty CatcodeTableNumStack}%
\luatexcatcodetable\z@
\else
\gdef\lltxb@cctb@numstack{#2}%
\luatexcatcodetable#1\relax
\fi}
\def\BeginCatcodeRegime#1{%
\PushCatcodeTableNumStack
\IncCatcodeTableStack
\setluatexcatcodetable\CatcodeTableStack{\luatexcatcodetable#1}%
\luatexcatcodetable\CatcodeTableStack}
\def\EndCatcodeRegime{%
\DecCatcodeTableStack
\PopCatcodeTableNumStack}
\luatexbase@cctb@sty@endinput%
\endinput
%%
%% End of file `luatexbase-cctb.sty'.
|