summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty
blob: b5ac4c9b2cbe65c70797c8abebaf685949369397 (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
107
108
109
110
111
112
113
114
115
116
117
118
%%
%% This is file `l3flag.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3flag.dtx  (with options: `package')
%% 
%% EXPERIMENTAL CODE
%% 
%% Do not distribute this file without also distributing the
%% source files specified above.
%% 
%% Do not distribute a modified version of this file.
%% 
%% File: l3flag.dtx Copyright (C) 2011-2012,2014,2015 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.
%%
%% The released version of this bundle is available from CTAN.
%%
%% -----------------------------------------------------------------------
%%
%% The development version of the bundle can be found at
%%
%%    http://www.latex-project.org/svnroot/experimental/trunk/
%%
%% for those people who are interested.
%%
%%%%%%%%%%%
%% NOTE: %%
%%%%%%%%%%%
%%
%%   Snapshots taken from the repository represent work in progress and may
%%   not work or may contain conflicting material!  We therefore ask
%%   people _not_ to put them into distributions, archives, etc. without
%%   prior consultation with the LaTeX3 Project.
%%
%% -----------------------------------------------------------------------
\RequirePackage{expl3}[2015/11/04]
\@ifpackagelater{expl3}{2015/11/04}
  {}
  {%
    \PackageError{l3flag}{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 l3flag will abort!%
      }%
    \endinput
  }
\GetIdInfo$Id: l3flag.dtx 6224 2015-11-04 08:38:08Z joseph $
  {L3 Experimental flags}
\ProvidesExplPackage
  {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\cs_new_protected:Npn \flag_new:n #1
  {
    \cs_new:cpn { __flag_trap_#1:w } ##1 ;
      { \exp_after:wN \use_none:n \cs:w __flag_#1_##1: \cs_end: }
  }
\cs_new_protected:Npn \flag_clear:n #1
  { \__flag_clear:ww 0 ; #1 \q_stop }
\cs_new_protected:Npn \__flag_clear:ww #1 ; #2 \q_stop
  {
    \if_cs_exist:w __flag_#2_#1: \cs_end:
    \else:
      \exp_after:wN \use_none_delimit_by_q_stop:w
    \fi:
    \cs_set_eq:cN { __flag_#2_#1: } \tex_undefined:D
    \exp_after:wN \__flag_clear:ww
    \int_use:N \__int_eval:w \c_one + #1 ;
    #2 \q_stop
  }
\cs_new_protected:Npn \flag_clear_new:n #1
  { \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} }
\cs_new_protected:Npn \flag_set_trap:nn #1#2
  { \cs_set:cpn { __flag_trap_#1:w } ##1 ; {#2} }
\prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF }
  {
    \cs_if_exist:cTF { __flag_trap_#1:w }
      { \prg_return_true: } { \prg_return_false: }
  }
\prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF }
  {
    \if_cs_exist:w __flag_#1_0: \cs_end:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \flag_height:n #1 { \__flag_height_loop:ww 0; #1 \q_stop }
\cs_new:Npn \__flag_height_loop:ww #1 ; #2 \q_stop
  {
    \if_cs_exist:w __flag_#2_#1: \cs_end:
      \exp_after:wN \__flag_height_loop:ww \int_use:N \__int_eval:w \c_one +
    \else:
      \exp_after:wN \__flag_height_end:ww
    \fi:
    #1 ; #2 \q_stop
  }
\cs_new:Npn \__flag_height_end:ww #1 ; #2 \q_stop { #1 }
\cs_new:Npn \flag_raise:n #1
  {
    \cs:w __flag_trap_#1:w \exp_after:wN \cs_end:
    \__int_value:w \flag_height:n {#1} ;
  }
%% 
%%
%% End of file `l3flag.sty'.