summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx
blob: baf4bfc875622c7f9321a2a9915c7a3188d2cffb (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
% \iffalse meta-comment
%
%% File: l3sys.dtx Copyright (C) 2015 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.
%%
%% -----------------------------------------------------------------------
%
%<*driver>
\documentclass[full]{l3doc}
%</driver>
%<*driver|package>
\GetIdInfo$Id$
  {L3 Experimental system/runtime functions}
%</driver|package>
%<*driver>
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \title{^^A
%   The \pkg{l3sys} package\\System/runtime functions^^A
%   \thanks{This file describes v\ExplFileVersion,
%      last revised \ExplFileDate.}^^A
% }
%
% \author{^^A
%  The \LaTeX3 Project\thanks
%    {^^A
%      E-mail:
%        \href{mailto:latex-team@latex-project.org}
%          {latex-team@latex-project.org}^^A
%    }^^A
% }
%
% \date{Released \ExplFileDate}
%
% \maketitle
%
% \begin{documentation}
%
% \subsection{Engine-specific conditionals}
%
% \begin{function}[added = 2015-09-07, EXP, pTF]^^A
%   {^^A
%     \sys_if_engine_luatex:,
%     \sys_if_engine_pdftex:,
%     \sys_if_engine_ptex:  ,
%     \sys_if_engine_uptex: ,
%     \sys_if_engine_xetex:
%   }
%   \begin{syntax}
%     \cs{sys_if_engine_pdftex:TF} \Arg{true code} \Arg{false code}
%   \end{syntax}
%   Conditionals which allow engine-specific code to be used. The names
%   follow naturally from those of the engine binaries: note that the
%   |(u)ptex| tests are for \epTeX{} and \eupTeX{} as \pkg{expl3} requires
%   the \eTeX{} extensions. Each conditional is true for
%   \emph{exactly one} supported engine. In particular,
%   |\sys_if_engine_ptex_p:| is true for \epTeX{} but false for \eupTeX{}.
% \end{function}
%
% \end{documentation}
%
% \begin{implementation}
%
% \section{\pkg{l3sys} implementation}
%
%    \begin{macrocode}
%<*initex|package>
%    \end{macrocode}
%
% \subsubsection{Detecting the engine}
%
% \begin{macro}[pTF, EXP]^^A
%   {^^A
%     \sys_if_engine_luatex:,
%     \sys_if_engine_pdftex:,
%     \sys_if_engine_ptex:,
%     \sys_if_engine_uptex:,
%     \sys_if_engine_xetex:
%   }
%   Set up the engine tests on the basis exactly one test should be true.
%   Mainly a case of looking for the appropriate marker primitive. For
%   \upTeX{}, there is a complexity in that setting |-kanji-internal=sjis|
%   or |-kanji-internal=euc| effective makes it more like \pTeX{}. In those
%   cases we therefore report \pTeX{} rather than \upTeX{}.
%    \begin{macrocode}
\clist_map_inline:nn { lua , pdf , p , up , xe }
  {
    \cs_new_eq:cN { sys_if_engine_ #1 tex:T }  \use_none:n
    \cs_new_eq:cN { sys_if_engine_ #1 tex:F }  \use:n
    \cs_new_eq:cN { sys_if_engine_ #1 tex:TF } \use_ii:nn
    \cs_new_eq:cN { sys_if_engine_ #1 tex_p: } \c_false_bool
  }
\cs_if_exist:NT \luatex_luatexversion:D
  {
    \cs_gset_eq:NN \sys_if_engine_luatex:T  \use:n
    \cs_gset_eq:NN \sys_if_engine_luatex:F  \use_none:n
    \cs_gset_eq:NN \sys_if_engine_luatex:TF \use_i:nn
    \cs_gset_eq:NN \sys_if_engine_luatex_p: \c_true_bool
  }
\cs_if_exist:NT \pdftex_pdftexversion:D
  {
    \cs_gset_eq:NN \sys_if_engine_pdftex:T  \use:n
    \cs_gset_eq:NN \sys_if_engine_pdftex:F  \use_none:n
    \cs_gset_eq:NN \sys_if_engine_pdftex:TF \use_i:nn
    \cs_gset_eq:NN \sys_if_engine_pdftex_p: \c_true_bool
  }
\cs_if_exist:NT \ptex_kanjiskip:D
  {
    \bool_if:nTF
      {
        \cs_if_exist_p:N \uptex_disablecjktoken:D &&
        \int_compare_p:nNn { \ptex_jis:D "2121 } = { "3000 }
      }
      {
        \cs_gset_eq:NN \sys_if_engine_uptex:T  \use:n
        \cs_gset_eq:NN \sys_if_engine_uptex:F  \use_none:n
        \cs_gset_eq:NN \sys_if_engine_uptex:TF \use_i:nn
        \cs_gset_eq:NN \sys_if_engine_uptex_p: \c_true_bool
      }
      {
        \cs_gset_eq:NN \sys_if_engine_ptex:T  \use:n
        \cs_gset_eq:NN \sys_if_engine_ptex:F  \use_none:n
        \cs_gset_eq:NN \sys_if_engine_ptex:TF \use_i:nn
        \cs_gset_eq:NN \sys_if_engine_ptex_p: \c_true_bool
      }
  }
\cs_if_exist:NT \xetex_XeTeXversion:D
  {
    \cs_gset_eq:NN \sys_if_engine_xetex:T  \use:n
    \cs_gset_eq:NN \sys_if_engine_xetex:F  \use_none:n
    \cs_gset_eq:NN \sys_if_engine_xetex:TF \use_i:nn
    \cs_gset_eq:NN \sys_if_engine_xetex_p: \c_true_bool
  }
%    \end{macrocode}
% \end{macro}
%
% \subsection{Deprecated functions}
%
% Deprecated 2015-09-07 for removal after 2016-12-31. The older logic supported
% only three engines so that has to be allowed for.
%    \begin{macrocode}
\prg_new_eq_conditional:NNn \luatex_if_engine: \sys_if_engine_luatex:
  { T , F , TF , p }
\prg_new_eq_conditional:NNn \xetex_if_engine:  \sys_if_engine_xetex:
  { T , F , TF , p }
\bool_if:nTF
  {
    \sys_if_engine_luatex_p: ||
    \sys_if_engine_xetex_p:
  }
  {
    \cs_new_eq:NN \pdftex_if_engine:T  \use_none:n
    \cs_new_eq:NN \pdftex_if_engine:F  \use:n
    \cs_new_eq:NN \pdftex_if_engine:TF \use_ii:nn
    \cs_new_eq:NN \pdftex_if_engine_p: \c_false_bool
  }
  {
    \cs_new_eq:NN \pdftex_if_engine:T  \use:n
    \cs_new_eq:NN \pdftex_if_engine:F  \use_none:n
    \cs_new_eq:NN \pdftex_if_engine:TF \use_i:nn
    \cs_new_eq:NN \pdftex_if_engine_p: \c_true_bool
  }
%    \end{macrocode}
%
%    \begin{macrocode}
%</initex|package>
%    \end{macrocode}
%
%\end{implementation}
%
%\PrintIndex