Skip to content

Commit

Permalink
\cctab_const:Nn (see #470)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Oct 2, 2018
1 parent 2a99627 commit 38c0c94
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
40 changes: 32 additions & 8 deletions l3experimental/l3cctab/l3cctab.dtx
Expand Up @@ -65,6 +65,15 @@
% used by \IniTeX{}.
% \end{function}
%
% \begin{function}{\cctab_const:Nn}
% \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
% \meta{category code set up} on top of prevailing settings, then saves
% as a constant table.
% \end{function}
%
% \begin{function}{\cctab_gset:Nn}
% \begin{syntax}
% \cs{cctab_gset:Nn} \meta{category code table} \Arg{category code set up}
Expand Down Expand Up @@ -349,6 +358,25 @@
% \end{macro}
% \end{macro}
%
% \begin{variable}{\g_@@_tmp_cctab}
% Scratch space.
% \begin{macrocode}
\cctab_new:N \g_@@_tmp_cctab
% \end{macrocode}
% \end{variable}
%
% \begin{macro}{\cctab_const:Nn}
% Creating constant tables is a bit tricky: we do it in a two part
% fashion via a temporary one.
% \begin{macrocode}
\cs_new_protected:Npn \cctab_const:Nn #1#2
{
\cctab_gset:Nn \g_@@_tmp_cctab {#2}
\cs_new_eq:NN #1 \g_@@_tmp_cctab
}
% \end{macrocode}
% \end{macro}
%
% \begin{variable}
% {
% \c_code_cctab ,
Expand All @@ -361,25 +389,21 @@
% The \texttt{other} and \texttt{string} ones are done by completely
% ignoring the existing codes as this makes life a lot less complex.
% \begin{macrocode}
\cctab_new:N \c_code_cctab
\cctab_new:N \c_document_cctab
\cctab_new:N \c_other_cctab
\cctab_new:N \c_str_cctab
\cctab_gset:Nn \c_code_cctab { }
\cctab_gset:Nn \c_document_cctab
\cctab_const:Nn \c_code_cctab { }
\cctab_const:Nn \c_document_cctab
{
\char_set_catcode_space:n { 9 }
\char_set_catcode_space:n { 32 }
\char_set_catcode_other:n { 58 }
\char_set_catcode_math_subscript:n { 95 }
\char_set_catcode_active:n { 126 }
}
\cctab_gset:Nn \c_other_cctab
\cctab_const:Nn \c_other_cctab
{
\int_step_inline:nnn { 0 } { 127 }
{ \char_set_catcode_other:n {#1} }
}
\cctab_gset:Nn \c_str_cctab
\cctab_const:Nn \c_str_cctab
{
\int_step_inline:nnn { 0 } { 127 }
{ \char_set_catcode_other:n {#1} }
Expand Down
2 changes: 1 addition & 1 deletion l3experimental/l3cctab/testfiles/m3cctab000.luatex.tlg
Expand Up @@ -4,5 +4,5 @@ Author: Joseph Wright
(l3cctab.sty
Package: l3cctab ....-..-.. L3 Experimental category code tables
\g__cctab_stack_int=\count...
\c_code_cctab=\catcodetable...
\g__cctab_tmp_cctab=\catcodetable...
)

0 comments on commit 38c0c94

Please sign in to comment.