summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3legacy.dtx
blob: eadf0fcfa683c82919dd19b49002aeda55dcb396 (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
% \iffalse meta-comment
%
%% File: l3legacy.dtx
%
% Copyright (C) 2019-2022 The LaTeX 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
%
%    https://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 development version of the bundle can be found at
%
%    https://github.com/latex3/latex3
%
% for those people who are interested.
%
%<*driver>
\documentclass[full,kernel]{l3doc}
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \title{^^A
%   The \textsf{l3legacy} package\\ Interfaces to legacy concepts^^A
% }
%
% \author{^^A
%  The \LaTeX{} Project\thanks
%    {^^A
%      E-mail:
%        \href{mailto:latex-team@latex-project.org}
%          {latex-team@latex-project.org}^^A
%    }^^A
% }
%
% \date{Released 2022-02-05}
%
% \maketitle
%
% \begin{documentation}
%
% There are a small number of \TeX{} or \LaTeXe{} concepts which are not used
% in \pkg{expl3} code but which need to be manipulated when working as a \LaTeXe{}
% package. To allow these to be integrated cleanly into \pkg{expl3} code, a set
% of legacy interfaces are provided here.
%
% \begin{function}[EXP,pTF]{\legacy_if:n}
%   \begin{syntax}
%     \cs{legacy_if:nTF} \Arg{name} \Arg{true code} \Arg{false code}
%   \end{syntax}
%   Tests if the \LaTeXe{}/plain \TeX{} conditional (generated by \tn{newif})
%   if \texttt{true} or \texttt{false} and branches accordingly. The
%   \meta{name} of the conditional should \emph{omit} the leading \texttt{if}.
% \end{function}
%
% \begin{function}[added = 2021-05-10]
%   {
%     \legacy_if_set_true:n, \legacy_if_set_false:n,
%     \legacy_if_gset_true:n, \legacy_if_gset_false:n
%   }
%   \begin{syntax}
%     \cs{legacy_if_set_true:n} \Arg{name}
%     \cs{legacy_if_set_false:n} \Arg{name}
%   \end{syntax}
%   Sets the \LaTeXe{}/plain \TeX{} conditional |\if|\meta{name}
%   (generated by \tn{newif}) to be \texttt{true} or \texttt{false}.
% \end{function}
%
% \begin{function}[added = 2021-05-10]{\legacy_if_set:nn, \legacy_if_gset:nn}
%   \begin{syntax}
%     \cs{legacy_if_set:nn} \Arg{name} \Arg{boolexpr}
%   \end{syntax}
%   Sets the \LaTeXe{}/plain \TeX{} conditional |\if|\meta{name}
%   (generated by \tn{newif}) to the result of evaluating the
%   \meta{boolean expression}.
% \end{function}
%
% \end{documentation}
%
% \begin{implementation}
%
% \section{\pkg{l3legacy} Implementation}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
%    \begin{macrocode}
%<@@=legacy>
%    \end{macrocode}
%
% \begin{macro}[EXP,pTF]{\legacy_if:n}
%   A friendly wrapper.
%    \begin{macrocode}
\prg_new_conditional:Npnn \legacy_if:n #1 { p , T , F , TF }
  {
    \exp_args:Nc \if_meaning:w { if#1 } \iftrue
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}
%   {
%     \legacy_if_set_true:n, \legacy_if_set_false:n,
%     \legacy_if_gset_true:n, \legacy_if_gset_false:n
%   }
%   A friendly wrapper.
%    \begin{macrocode}
\cs_new_protected:Npn \legacy_if_set_true:n #1
  { \cs_set_eq:cN { if#1 } \if_true: }
\cs_new_protected:Npn \legacy_if_set_false:n #1
  { \cs_set_eq:cN { if#1 } \if_false: }
\cs_new_protected:Npn \legacy_if_gset_true:n #1
  { \cs_gset_eq:cN { if#1 } \if_true: }
\cs_new_protected:Npn \legacy_if_gset_false:n #1
  { \cs_gset_eq:cN { if#1 } \if_false: }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\legacy_if_set:nn, \legacy_if_gset:nn}
%   A more elaborate wrapper.
%    \begin{macrocode}
\cs_new_protected:Npn \legacy_if_set:nn #1#2
  {
    \bool_if:nTF {#2} \legacy_if_set_true:n \legacy_if_set_false:n
    {#1}
  }
\cs_new_protected:Npn \legacy_if_gset:nn #1#2
  {
    \bool_if:nTF {#2} \legacy_if_gset_true:n \legacy_if_gset_false:n
    {#1}
  }
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \end{implementation}
%
% \PrintIndex