summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3experimental/l3cctab/l3cctab.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/l3cctab/l3cctab.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3experimental/l3cctab/l3cctab.sty91
1 files changed, 82 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3cctab/l3cctab.sty b/Master/texmf-dist/tex/latex/l3experimental/l3cctab/l3cctab.sty
index cafae3fb78c..1bff7ecc6fc 100644
--- a/Master/texmf-dist/tex/latex/l3experimental/l3cctab/l3cctab.sty
+++ b/Master/texmf-dist/tex/latex/l3experimental/l3cctab/l3cctab.sty
@@ -20,7 +20,7 @@
%%
%% File: l3cctab.dtx
\RequirePackage{expl3}
-\ProvidesExplPackage{l3cctab}{2019-08-25}{}
+\ProvidesExplPackage{l3cctab}{2019-09-19}{}
{L3 Experimental category code tables}
\int_new:N \g__cctab_allocate_int
\int_gset:Nn \g__cctab_allocate_int { -1 }
@@ -34,7 +34,7 @@
\__kernel_chk_if_free_cs:N #1
\newcatcodetable #1
}
- \cs_new_protected:Npn \cctab_begin:N #1
+ \cs_new_protected:Npn \__cctab_begin:N #1
{
\seq_gpush:Nx \g__cctab_stack_seq { \tex_the:D \tex_catcodetable:D }
\tex_catcodetable:D #1
@@ -44,7 +44,7 @@
\tex_savecatcodetable:D \g__cctab_stack_int
\tex_catcodetable:D \g__cctab_stack_int
}
- \cs_new_protected:Npn \cctab_end:
+ \cs_new_protected:Npn \__cctab_end:
{
\int_gsub:Nn \g__cctab_stack_int { 2 }
\seq_if_empty:NTF \g__cctab_stack_seq
@@ -55,7 +55,7 @@
\cs_new_protected:Npn \cctab_gset:Nn #1#2
{
\group_begin:
- #2
+ #2 \scan_stop:
\tex_savecatcodetable:D #1
\group_end:
}
@@ -80,14 +80,14 @@
\__cctab_gstore:Nnn #1 { 13 } { 5 }
\__cctab_gstore:Nnn #1 { 32 } { 10 }
\__cctab_gstore:Nnn #1 { 37 } { 14 }
- \int_step_inline:nnn { 64 } { 89 }
+ \int_step_inline:nnn { 65 } { 90 }
{ \__cctab_gstore:Nnn #1 {##1} { 11 } }
\__cctab_gstore:Nnn #1 { 92 } { 0 }
\int_step_inline:nnn { 97 } { 122 }
{ \__cctab_gstore:Nnn #1 {##1} { 11 } }
\__cctab_gstore:Nnn #1 { 127 } { 15 }
}
- \cs_new_protected:Npn \cctab_begin:N #1
+ \cs_new_protected:Npn \__cctab_begin:N #1
{
\int_gadd:Nn \g__cctab_stack_int { 2 }
\int_compare:nNnT \g__cctab_stack_int > \c_max_register_int
@@ -116,7 +116,7 @@
}
\cs_generate_variant:Nn \intarray_new:Nn { c }
\cs_generate_variant:Nn \intarray_gset:Nnn { c }
- \cs_new_protected:Npn \cctab_end:
+ \cs_new_protected:Npn \__cctab_end:
{
\int_step_inline:nn { 256 }
{
@@ -127,13 +127,13 @@
{##1}
}
}
- \int_gsub:Nn \g__cctab_stack_int { 1 }
+ \int_gsub:Nn \g__cctab_stack_int { 2 }
}
\cs_generate_variant:Nn \intarray_item:Nn { c }
\cs_new_protected:Npn \cctab_gset:Nn #1#2
{
\group_begin:
- #2
+ #2 \scan_stop:
\int_step_inline:nn { 256 }
{
\intarray_gset:cnn { g__cctab_ \int_use:N #1 _cctab } {##1}
@@ -142,11 +142,71 @@
\group_end:
}
}
+\cs_generate_variant:Nn \cctab_new:N { c }
+\cs_generate_variant:Nn \cctab_gset:Nn { c }
+\cs_new_protected:Npn \cctab_begin:N #1
+ { \__cctab_chk_if_valid:NT #1 { \__cctab_begin:N #1 } }
+\cs_generate_variant:Nn \cctab_begin:N { c }
+\cs_new_protected:Npn \cctab_end:
+ {
+ \int_compare:nNnTF { \g__cctab_stack_int } = { \c_zero_int }
+ { \__kernel_msg_error:nn { kernel } { cctab-extra-end } }
+ { \__cctab_end: }
+ }
+\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_protected_conditional:Npnn \__cctab_chk_if_valid:N #1
+ { TF , T , F }
+ {
+ \cctab_if_exist:NTF #1
+ {
+ \int_compare:nNnTF {#1-1} < { \e@alloc@ccodetable@count }
+ { \prg_return_true: }
+ {
+ \__kernel_msg_error:nnx { kernel } { invalid-cctab }
+ { \token_to_str:N #1 }
+ \prg_return_false:
+ }
+ }
+ {
+ \__kernel_msg_error:nnx { kernel } { command-not-defined }
+ { \token_to_str:N #1 }
+ \prg_return_false:
+ }
+ }
+ }
+ {
+ \prg_new_protected_conditional:Npnn \__cctab_chk_if_valid:N #1
+ { TF , T , F }
+ {
+ \cctab_if_exist:NTF #1
+ {
+ \cs_if_exist:cTF { g__cctab_ \int_use:N #1 _cctab }
+ { \prg_return_true: }
+ {
+ \__kernel_msg_error:nnx { kernel } { invalid-cctab }
+ { \token_to_str:N #1 }
+ \prg_return_false:
+ }
+ }
+ {
+ \__kernel_msg_error:nnx { kernel } { command-not-defined }
+ { \token_to_str:N #1 }
+ \prg_return_false:
+ }
+ }
+ }
\cs_new_protected:Npn \cctab_const:Nn #1#2
{
\cctab_new:N #1
\cctab_gset:Nn #1 {#2}
}
+\cs_generate_variant:Nn \cctab_const:Nn { c }
+\cctab_new:N \c_initex_cctab
\cctab_const:Nn \c_code_cctab { }
\cctab_const:Nn \c_document_cctab
{
@@ -173,6 +233,19 @@
LaTeX~has~been~asked~to~switch~to~a~new~category~code~table,~
but~there~is~no~more~space~to~do~this!
}
+\__kernel_msg_new:nnnn { kernel } { cctab-extra-end }
+ { Extra~\iow_char:N\\cctab_end:~ignored~\msg_line_context:. }
+ {
+ LaTeX~came~across~a~\iow_char:N\\cctab_end:~without~a~matching~
+ \iow_char:N\\cctab_begin:N.~This~command~will~be~ignored.
+ }
+\__kernel_msg_new:nnnn { kernel } { invalid-cctab }
+ { Invalid~\iow_char:N\\catcode~table. }
+ {
+ You~can~only~switch~to~a~\iow_char:N\\catcode~table~that~is~
+ initialized~using~\iow_char:N\\cctab_new:N~or~
+ \iow_char:N\\cctab_const:Nn.
+ }
%%
%%
%% End of file `l3cctab.sty'.