summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty
blob: 9673e80ab1cfad041ca46862f7853453810eb871 (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
%%
%% This is file `l3luatex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3luatex.dtx  (with options: `package')
%% 
%% EXPERIMENTAL CODE
%% 
%% Do not distribute this file without also distributing the
%% source files specified above.
%% 
%% Do not distribute a modified version of this file.
%% 
%% File: l3luatex.dtx Copyright (C) 2010-2012 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
%% license or (at your option) any later version.  The latest version
%% of this license is in the file
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% This file is part of the "l3kernel bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
%%
%% -----------------------------------------------------------------------
%%
%% The development version of the bundle can be found at
%%
%%    http://www.latex-project.org/svnroot/experimental/trunk/
%%
%% for those people who are interested.
%%
%%%%%%%%%%%
%% NOTE: %%
%%%%%%%%%%%
%%
%%   Snapshots taken from the repository represent work in progress and may
%%   not work or may contain conflicting material!  We therefore ask
%%   people _not_ to put them into distributions, archives, etc. without
%%   prior consultation with the LaTeX3 Project.
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3bootstrap}
\GetIdInfo$Id: l3luatex.dtx 4049 2012-08-03 14:01:40Z bruno $
  {L3 Experimental LuaTeX-specific functions}
\ProvidesExplPackage
  {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\__expl_package_check:
\luatex_if_engine:TF
  {
    \cs_new_eq:NN \lua_now_x:n     \luatex_directlua:D
    \cs_new_eq:NN \lua_shipout_x:n \luatex_latelua:D
  }
  {
    \cs_new:Npn \lua_now_x:n #1
      {
        \__msg_kernel_expandable_error:nnn
          { kernel } { bad-engine } { \lua_now_x:n }
      }
    \cs_new_protected:Npn \lua_shipout_x:n #1
      {
        \__msg_kernel_expandable_error:nnn
          { kernel } { bad-engine } { \lua_shipout_x:n }
      }
  }
\cs_generate_variant:Nn \lua_now_x:n { x }
\cs_new:Npn \lua_now:n #1
  { \lua_now_x:n { \exp_not:n {#1} } }
\cs_generate_variant:Nn \lua_now:n { x }
\cs_generate_variant:Nn \lua_shipout_x:n { x }
\cs_new_protected:Npn \lua_shipout:n #1
  { \lua_shipout_x:n { \exp_not:n {#1} } }
\cs_generate_variant:Nn \lua_shipout:n { x }
\int_new:N  \g__cctab_allocate_int
\int_set:Nn \g__cctab_allocate_int { \c_minus_one }
\int_new:N \g__cctab_stack_int
\seq_new:N \g__cctab_stack_seq
\cs_new_protected:Npn \cctab_new:N #1
  {
    \__chk_if_free_cs:N #1
    \int_gadd:Nn \g__cctab_allocate_int { \c_two }
    \int_compare:nNnTF
      \g__cctab_allocate_int <  { \c_max_register_int + \c_one }
       {
         \tex_global:D \tex_chardef:D #1 \g__cctab_allocate_int
         \luatex_initcatcodetable:D #1
       }
       { \__msg_kernel_fatal:nnx { kernel } { out-of-registers } { cctab } }
  }
\luatex_if_engine:F
  {
    \cs_set_protected:Npn \cctab_new:N #1
      {
        \__msg_kernel_error:nnx { kernel } { bad-engine }
          { \exp_not:N \cctab_new:N }
      }
  }
\luatex_if_engine:T
  {
    \cs_set_protected:Npn \cctab_new:N #1
      {
        \__chk_if_free_cs:N #1
        \newcatcodetable #1
        \luatex_initcatcodetable:D #1
      }
  }
\cs_new_protected:Npn \cctab_begin:N #1
  {
    \seq_gpush:Nx \g__cctab_stack_seq { \tex_the:D \luatex_catcodetable:D }
    \luatex_catcodetable:D #1
    \int_gadd:Nn \g__cctab_stack_int { \c_two }
    \int_compare:nNnT \g__cctab_stack_int > \c_max_register_int
      { \__msg_kernel_fatal:nn { kernel } { cctab-stack-full } }
    \luatex_savecatcodetable:D \g__cctab_stack_int
    \luatex_catcodetable:D \g__cctab_stack_int
  }
\cs_new_protected_nopar:Npn \cctab_end:
  {
    \int_gsub:Nn \g__cctab_stack_int { \c_two }
    \seq_if_empty:NTF \g__cctab_stack_seq
      { \tl_set:Nn \l__cctab_internal_tl { 0 } }
      { \seq_gpop:NN \g__cctab_stack_seq \l__cctab_internal_tl }
    \luatex_catcodetable:D \l__cctab_internal_tl \scan_stop:
  }
\luatex_if_engine:F
  {
    \cs_set_protected:Npn \cctab_begin:N #1
      {
        \__msg_kernel_error:nnxx { kernel } { bad-engine }
          { \exp_not:N \cctab_begin:N } {#1}
      }
    \cs_set_protected_nopar:Npn \cctab_end:
      {
        \__msg_kernel_error:nnx { kernel } { bad-engine }
          { \exp_not:N \cctab_end: }
      }
  }
\luatex_if_engine:T
  {
    \cs_set_protected:Npn \cctab_begin:N #1 { \BeginCatcodeRegime #1 }
    \cs_set_protected_nopar:Npn \cctab_end: { \EndCatcodeRegime }
  }
\tl_new:N \l__cctab_internal_tl
\cs_new_protected:Npn \cctab_gset:Nn #1#2
  {
    \group_begin:
      #2
      \luatex_savecatcodetable:D #1
    \group_end:
  }
\luatex_if_engine:F
  {
    \cs_set_protected:Npn \cctab_gset:Nn #1#2
      {
        \__msg_kernel_error:nnxx { kernel } { bad-engine }
          { \exp_not:N \cctab_gset:Nn } { #1 {#2} }
      }
  }
\luatex_if_engine:T
  {
    \cctab_new:N \c_code_cctab
    \cctab_gset:Nn \c_code_cctab { }
  }
\luatex_if_engine:T
  {
    \cs_new_eq:NN \c_document_cctab \CatcodeTableLaTeX
    \cs_new_eq:NN \c_initex_cctab   \CatcodeTableIniTeX
    \cs_new_eq:NN \c_other_cctab    \CatcodeTableOther
    \cs_new_eq:NN \c_str_cctab      \CatcodeTableString
  }
\__msg_kernel_new:nnnn { kernel } { bad-engine }
  { LuaTeX~engine~not~in~use!~Ignoring~#1. }
  {
    The~feature~you~are~using~is~only~available~
    with~the~LuaTeX~engine.~LaTeX3~ignored~`#1#2'.
  }
\__msg_kernel_new:nnnn { kernel } { cctab-stack-full }
  { The~category~code~table~stack~is~exhausted. }
  {
    LaTeX~has~been~asked~to~switch~to~a~new~category~code~table,~
    but~there~is~no~more~space~to~do~this!
  }
%% 
%%
%% End of file `l3luatex.sty'.