[latex3-commits] [git/LaTeX3-latex3-latex3] master: l3cctab doc and variants (d1167832d)
Phelype Oleinik
phe.h.o1 at gmail.com
Mon Sep 9 22:06:53 CEST 2019
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/d1167832dcc76391bdcf77432304a455a8e626fb
>---------------------------------------------------------------
commit d1167832dcc76391bdcf77432304a455a8e626fb
Author: Phelype Oleinik <phe.h.o1 at gmail.com>
Date: Mon Sep 9 17:06:53 2019 -0300
l3cctab doc and variants
>---------------------------------------------------------------
d1167832dcc76391bdcf77432304a455a8e626fb
l3experimental/l3cctab/l3cctab.dtx | 87 ++++++++++++++++++++++++++++++--------
1 file changed, 70 insertions(+), 17 deletions(-)
diff --git a/l3experimental/l3cctab/l3cctab.dtx b/l3experimental/l3cctab/l3cctab.dtx
index ff8b03d6c..48a40bd77 100644
--- a/l3experimental/l3cctab/l3cctab.dtx
+++ b/l3experimental/l3cctab/l3cctab.dtx
@@ -59,24 +59,29 @@
% range. For other engines, only the $8$-bit range ($0$-$255$) is covered by
% such tables.
%
-% \begin{function}{\cctab_new:N}
+% \subsection{Creating and initialising category code tables}
+%
+% \begin{function}{\cctab_new:N,\cctab_new:c}
% \begin{syntax}
% \cs{cctab_new:N} \meta{category code table}
% \end{syntax}
-% Creates a new category code table, initially with the codes as
-% used by \IniTeX{}.
+% Creates a new \meta{category code table} variable or raises an error if
+% the name is already taken. The declaration is global. The
+% \meta{category code table} is initialised with the codes
+% as used by \IniTeX{}.
% \end{function}
%
-% \begin{function}{\cctab_const:Nn}
+% \begin{function}{\cctab_const:Nn,\cctab_const:cn}
% \begin{syntax}
% \cs{cctab_const:Nn} \meta{category code table} \Arg{category code set up}
% \end{syntax}
-% Creates a new category code table and applies the
+% Creates a new \meta{category code table} with the category code settings in
+% force at the time the function is called, and applies the
% \meta{category code set up} on top of prevailing settings, then saves
% as a constant table.
% \end{function}
%
-% \begin{function}{\cctab_gset:Nn}
+% \begin{function}{\cctab_gset:Nn,\cctab_gset:cn}
% \begin{syntax}
% \cs{cctab_gset:Nn} \meta{category code table} \Arg{category code set up}
% \end{syntax}
@@ -88,14 +93,16 @@
% not respect grouping.
% \end{function}
%
-% \begin{function}{\cctab_begin:N}
+% \subsection{Using category code tables}
+%
+% \begin{function}{\cctab_begin:N,\cctab_begin:c}
% \begin{syntax}
% \cs{cctab_begin:N} \meta{category code table}
% \end{syntax}
% Switches the category codes in force to those stored in the
% \meta{category code table}. The prevailing codes before the
% function is called are added to a stack, for use with
-% \cs{cctab_end:}.
+% \cs{cctab_end:}. This function does not start a \TeX{} group.
% \end{function}
%
% \begin{function}{\cctab_end:}
@@ -103,10 +110,22 @@
% \cs{cctab_end:}
% \end{syntax}
% Ends the scope of a \meta{category code table} started using
-% \cs{cctab_begin:N}, retuning the codes to those in force before the
-% matching \cs{cctab_begin:N} was used.
+% \cs{cctab_begin:N}, retuning the codes to those in force before
+% the matching \cs{cctab_begin:N} was used.
% \end{function}
%
+% \subsection{Category code table conditionals}
+%
+% \begin{function}[pTF]{\cctab_if_exist:N,\cctab_if_exist:c}
+% \begin{syntax}
+% \cs{cctab_if_exist_p:N} \meta{category code table}
+% \cs{cctab_if_exist:NTF} \meta{category code table} \Arg{true code} \Arg{false code}
+% \end{syntax}
+% Tests whether the \meta{category code table} is currently defined.
+% \end{function}
+%
+% \subsection{Constant category code tables}
+%
% \begin{variable}{\c_code_cctab}
% Category code table for the code environment. This does not include
% setting the behaviour of the line-end character, which is only
@@ -178,10 +197,10 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\cctab_new:N}
-% \begin{macro}{\cctab_begin:N}
+% \begin{macro}{\cctab_new:N,\cctab_new:c}
+% \begin{macro}{\cctab_begin:N,\cctab_begin:c}
% \begin{macro}{\cctab_end:}
-% \begin{macro}{\cctab_gset:Nn}
+% \begin{macro}{\cctab_gset:Nn,\cctab_gset:cn}
% As \LuaTeX{} offers engine support for category code tables, and this is
% entirely lacking from the other engines, we need two complementary
% approaches here. Rather than intermix them, we split the set up based on
@@ -350,6 +369,8 @@
\group_end:
}
}
+\cs_generate_variant:Nn \cctab_new:N { c }
+\cs_generate_variant:Nn \cctab_gset:Nn { c }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -369,15 +390,46 @@
{ \token_to_str:N #1 }
}
}
+\cs_generate_variant:Nn \cctab_begin:N { c }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\cctab_if_exist:N,\cctab_if_exist:c}
+% Checks whether a \meta{cctab~var} is defined.
+% The \LuaTeX{} code simply does \cs{cs_if_exist:N} on the argument,
+% as the engine saves the category code table in a single control
+% sequence. The code for other engines does that, but also check if
+% the internal \meta{intarray~var} exists.
% \begin{macrocode}
-\prg_new_eq_conditional:NNn \cctab_if_exist:N \cs_if_exist:N
- { TF , T , F , p }
-\prg_new_eq_conditional:NNn \cctab_if_exist:c \cs_if_exist:c
- { TF , T , F , p }
+\sys_if_engine_luatex:TF
+ {
+ \prg_new_eq_conditional:NNn \cctab_if_exist:N \cs_if_exist:N
+ { TF , T , F , p }
+ \prg_new_eq_conditional:NNn \cctab_if_exist:c \cs_if_exist:c
+ { TF , T , F , p }
+ }
+ {
+ \prg_new_conditional:Npnn \cctab_if_exist:N #1 { TF , T , F , p }
+ {
+ \cs_if_exist:NTF
+ {
+ \cs_if_exist:cTF { g_@@_ \int_use:N #1 _cctab }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ { \prg_return_false: }
+ }
+ \prg_new_conditional:Npnn \cctab_if_exist:c #1 { TF , T , F , p }
+ {
+ \cs_if_exist:cTF
+ {
+ \cs_if_exist:cTF { g_@@_ \int_use:c {#1} _cctab }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ { \prg_return_false: }
+ }
+ }
% \end{macrocode}
% \end{macro}
%
@@ -388,6 +440,7 @@
\cctab_new:N #1
\cctab_gset:Nn #1 {#2}
}
+\cs_generate_variant:Nn \cctab_const:Nn { c }
% \end{macrocode}
% \end{macro}
%
More information about the latex3-commits
mailing list