summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty
blob: aae4b87553e4bfb6ddbece2960121a4aa9e6a7e4 (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
%%
%% This is file `l3tl-build.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3tl-build.dtx  (with options: `package')
%% 
%% Copyright (C) 2011-2016 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: l3tl-build.dtx Copyright (C) 2011-2016 The LaTeX3 Project
\RequirePackage{expl3}[2017/03/07]
\@ifpackagelater{expl3}{2017/03/07}
  {}
  {%
    \PackageError{l3tl-build}{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 l3tl-build will abort!%
      }%
    \endinput
  }
\GetIdInfo$Id: l3tl-build.dtx 6984 2017-03-07 20:53:23Z joseph $
  {L3 Experimental token list construction}
\ProvidesExplPackage
  {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\int_new:N \l__tl_build_start_index_int
\int_new:N \l__tl_build_index_int
\tl_new:N \l__tl_build_result_tl
\cs_new_protected:Npn \__tl_build_unpack:
  {
    \tl_put_right:Nx \l__tl_build_result_tl
      {
        \exp_after:wN \__tl_build_unpack_loop:w
          \int_use:N \l__tl_build_start_index_int ;
        \__prg_break_point:
      }
  }
\cs_new:Npn \__tl_build_unpack_loop:w #1 ;
  {
    \if_int_compare:w #1 = \l__tl_build_index_int
      \exp_after:wN \__prg_break:
    \fi:
    \tex_the:D \tex_toks:D #1 \exp_stop_f:
    \exp_after:wN \__tl_build_unpack_loop:w
      \int_use:N \__int_eval:w #1 + 1 ;
  }
\cs_new_protected:Npn \__tl_build:Nw
  { \__tl_build_aux:NNw \tl_set:Nn }
\cs_new_protected:Npn \__tl_build_x:Nw
  { \__tl_build_aux:NNw \tl_set:Nx }
\cs_new_protected:Npn \__tl_gbuild:Nw
  { \__tl_build_aux:NNw \tl_gset:Nn }
\cs_new_protected:Npn \__tl_gbuild_x:Nw
  { \__tl_build_aux:NNw \tl_gset:Nx }
\cs_new_protected:Npn \__tl_build_aux:NNw #1#2
  {
    \group_begin:
      \cs_set:Npn \__tl_build_end_assignment:n
        { \group_end: #1 #2 }
      \int_zero:N \l__tl_build_start_index_int
      \int_zero:N \l__tl_build_index_int
      \tl_clear:N \l__tl_build_result_tl
  }
\cs_new_protected:Npn \__tl_build_end:
  {
      \__tl_build_unpack:
      \exp_args:No
    \__tl_build_end_assignment:n \l__tl_build_result_tl
  }
\cs_new_eq:NN \__tl_build_end_assignment:n \use_none:n
\cs_new_protected:Npn \__tl_build_one:n #1
  {
    \tex_toks:D \l__tl_build_index_int {#1}
    \int_incr:N \l__tl_build_index_int
    \if_int_compare:w \l__tl_build_index_int > \c_max_register_int
      \__tl_build_unpack:
      \l__tl_build_index_int \l__tl_build_start_index_int
    \fi:
  }
\cs_new_protected:Npn \__tl_build_one:o #1
  {
    \tex_toks:D \l__tl_build_index_int \exp_after:wN {#1}
    \int_incr:N \l__tl_build_index_int
    \if_int_compare:w \l__tl_build_index_int > \c_max_register_int
      \__tl_build_unpack:
      \l__tl_build_index_int \l__tl_build_start_index_int
    \fi:
  }
\cs_new_protected:Npn \__tl_build_one:x #1
  { \use:x { \__tl_build_one:n {#1} } }
%% 
%%
%% End of file `l3tl-build.sty'.