diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3experimental/l3str/l3intarray.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3experimental/l3str/l3intarray.sty | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3intarray.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3intarray.sty new file mode 100644 index 00000000000..8239e693bbc --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3intarray.sty @@ -0,0 +1,104 @@ +%% +%% This is file `l3intarray.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3intarray.dtx (with options: `package') +%% +%% Copyright (C) 2011-2017 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 "l3experimental bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% File: l3intarray.dtx Copyright (C) 2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/05/13] +\@ifpackagelater{expl3}{2017/05/13} + {} + {% + \PackageError{l3intarray}{Support package l3kernel too old} + {% + Please install an up to date version of l3kernel\MessageBreak + using your TeX package manager or from CTAN.\MessageBreak + \MessageBreak + Loading l3intarray will abort!% + }% + \endinput + } +\ProvidesExplPackage{l3intarray}{2017/05/13}{} + {L3 Experimental low-level arrays of small integers} +\int_new:N \g__intarray_font_int +\cs_new_protected:Npn \__intarray_new:Nn #1#2 + { + \__chk_if_free_cs:N #1 + \int_gincr:N \g__intarray_font_int + \tex_global:D \tex_font:D #1 = cmr10~at~ \g__intarray_font_int sp \scan_stop: + \tex_hyphenchar:D #1 = \int_eval:n {#2} \scan_stop: + \int_compare:nNnT { \tex_hyphenchar:D #1 } > 0 + { \tex_fontdimen:D \tex_hyphenchar:D #1 #1 = 0 sp \scan_stop: } + \int_step_inline:nnnn { 1 } { 1 } { 8 } + { \tex_fontdimen:D ##1 #1 = 0 sp \scan_stop: } + } +\cs_new:Npn \__intarray_count:N #1 { \tex_the:D \tex_hyphenchar:D #1 } +\cs_new_protected:Npn \__intarray_gset_fast:Nnn #1#2#3 + { \tex_fontdimen:D \int_eval:n {#2} #1 = \int_eval:n {#3} sp \scan_stop: } +\cs_new_protected:Npn \__intarray_gset:Nnn #1#2#3 + { + \exp_args:Nff \__intarray_gset_aux:Nnn #1 + { \int_eval:n {#2} } { \int_eval:n {#3} } + } +\cs_new_protected:Npn \__intarray_gset_aux:Nnn #1#2#3 + { + \int_compare:nTF { 1 <= #2 <= \__intarray_count:N #1 } + { + \int_compare:nTF { - \c_max_dim <= \int_abs:n {#3} <= \c_max_dim } + { \__intarray_gset_fast:Nnn #1 {#2} {#3} } + { + \__msg_kernel_error:nnxxxx { intarray } { overflow } + { \token_to_str:N #1 } {#2} {#3} + { \int_compare:nNnT {#3} < 0 { - } \__int_value:w \c_max_dim } + \__intarray_gset_fast:Nnn #1 {#2} + { \int_compare:nNnT {#3} < 0 { - } \c_max_dim } + } + } + { + \__msg_kernel_error:nnxxx { intarray } { out-of-bounds } + { \token_to_str:N #1 } {#2} { \__intarray_count:N #1 } + } + } +\cs_new:Npn \__intarray_item_fast:Nn #1#2 + { \__int_value:w \tex_fontdimen:D \int_eval:n {#2} #1 } +\cs_new:Npn \__intarray_item:Nn #1#2 + { \exp_args:Nf \__intarray_item_aux:Nn #1 { \int_eval:n {#2} } } +\cs_new:Npn \__intarray_item_aux:Nn #1#2 + { + \int_compare:nTF { 1 <= #2 <= \__intarray_count:N #1 } + { \__intarray_item_fast:Nn #1 {#2} } + { + \__msg_kernel_expandable_error:nnnnn { intarray } { out-of-bounds } + { \token_to_str:N #1 } {#2} { \__intarray_count:N #1 } + 0 + } + } +\__msg_kernel_new:nnnn { intarray } { overflow } + { Integers~larger~than~2^{30}-1~cannot~be~stored~in~arrays. } + { + An~attempt~was~made~to~store~#3~at~position~#2~in~the~array~'#1'.~ + The~largest~allowed~value~#4~will~be~used~instead. + } +\__msg_kernel_new:nnnn { intarray } { out-of-bounds } + { Access~to~an~entry~beyond~an~array's~bounds. } + { + An~attempt~was~made~to~access~or~store~data~at~position~#2~of~the~ + array~'#1',~but~this~array~has~entries~at~positions~from~1~to~#3. + } +%% +%% +%% End of file `l3intarray.sty'. |