Debian Codegraph @

texmf-dist/tex/latex/oberdiek/flags.sty

raw
1 %%
2 %% This is file `flags.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% flags.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: flags
12 %% Version: 2016/05/16 v0.5
13 %%
14 %% Copyright (C)
15 %% 2007 Heiko Oberdiek
16 %% 2016-2019 Oberdiek Package Support Group
17 %%
18 %% This work may be distributed and/or modified under the
19 %% conditions of the LaTeX Project Public License, either
20 %% version 1.3c of this license or (at your option) any later
21 %% version. This version of this license is in
22 %% https://www.latex-project.org/lppl/lppl-1-3c.txt
23 %% and the latest version of this license is in
24 %% https://www.latex-project.org/lppl.txt
25 %% and version 1.3 or later is part of all distributions of
26 %% LaTeX version 2005/12/01 or later.
27 %%
28 %% This work has the LPPL maintenance status "maintained".
29 %%
30 %% The Current Maintainers of this work are
31 %% Heiko Oberdiek and the Oberdiek Package Support Group
32 %% https://github.com/ho-tex/oberdiek/issues
33 %%
34 %%
35 %% This work consists of the main source file flags.dtx
36 %% and the derived files
37 %% flags.sty, flags.pdf, flags.ins, flags.drv.
38 %%
39 \NeedsTeXFormat{LaTeX2e}
40 \ProvidesPackage{flags}%
41 [2016/05/16 v0.5 Setting/clearing of flags in bit fields (HO)]%
42 \begingroup\expandafter\expandafter\expandafter\endgroup
43 \expandafter\ifx\csname numexpr\endcsname\relax
44 \PackageError{flags}{%
45 Missing e-TeX, package loading aborted%
46 }{%
47 This packages makes heavy use of \string\numexpr.%
48 }%
49 \expandafter\endinput
50 \fi
51 \newcommand*{\resetflags}[1]{%
52 \expandafter\let\csname flags@#1\endcsname\@empty
53 }
54 \newcommand*{\printflags}[1]{%
55 \expandafter\@printflags\csname flags@#1\endcsname
56 }
57 \def\@printflags#1{%
58 \expandafter\@firstofone\expandafter{%
59 \number\numexpr
60 \ifx#1\@empty
61 0%
62 \else
63 \expandafter\@@printflags#1%
64 \fi
65 }%
66 }
67 \def\@@printflags#1#2\fi{%
68 \fi
69 #1%
70 \ifx\\#2\\%
71 \else
72 +2*\numexpr\expandafter\@@printflags#2%
73 \fi
74 }
75 \newcommand*{\setflag}[2]{%
76 \ifnum#2>\z@
77 \expandafter\@setflag\csname flags@#1\expandafter\endcsname
78 \expandafter{\romannumeral\number\numexpr#2-1\relax000}%
79 \else
80 \PackageError{flags}{Position must be a positive number}\@ehc
81 \fi
82 }
83 \def\@setflag#1#2{%
84 \ifx#1\relax
85 \let#1\@empty
86 \fi
87 \edef#1{%
88 \expandafter\@@setflag\expandafter{#1}{#2}%
89 }%
90 }
91 \def\@@setflag#1#2{%
92 \ifx\\#1\\%
93 \FLAGS@zero#2\relax
94 1%
95 \else
96 \ifx\\#2\\%
97 1\@gobble#1%
98 \else
99 \@@@setflag#1|#2%
100 \fi
101 \fi
102 }
103 \def\@@@setflag#1#2|#3#4\fi\fi{%
104 \fi\fi
105 #1%
106 \@@setflag{#2}{#4}%
107 }
108 \newcommand*{\clearflag}[2]{%
109 \ifnum#2>\z@
110 \expandafter\@clearflag\csname flags@#1\expandafter\endcsname
111 \expandafter{\romannumeral\number\numexpr#2-1\relax000}%
112 \else
113 \PackageError{flags}{Position must be a positive number}\@ehc
114 \fi
115 }
116 \def\@clearflag#1#2{%
117 \ifx#1\relax
118 \let#1\@empty
119 \fi
120 \edef#1{%
121 \expandafter\@@clearflag\expandafter{#1}{#2}%
122 }%
123 }
124 \def\@@clearflag#1#2{%
125 \ifx\\#1\\%
126 \else
127 \ifx\\#2\\%
128 0\@gobble#1%
129 \else
130 \@@@clearflag#1|#2%
131 \fi
132 \fi
133 }
134 \def\@@@clearflag#1#2|#3#4\fi\fi{%
135 \fi\fi
136 #1%
137 \@@clearflag{#2}{#4}%
138 }
139 \def\FLAGS@zero#1{%
140 \ifx#1\relax
141 \else
142 0%
143 \expandafter\FLAGS@zero
144 \fi
145 }
146 \newcommand*{\queryflag}[2]{%
147 \ifnum\extractflag{#1}{#2}=\@ne
148 \expandafter\@firstoftwo
149 \else
150 \expandafter\@secondoftwo
151 \fi
152 }
153 \newcommand*{\extractflag}[1]{%
154 \expandafter\@extractflag\csname flags@#1\endcsname
155 }
156 \def\@extractflag#1#2{%
157 \ifx#1\@undefined
158 0%
159 \else
160 \ifx#1\relax
161 0%
162 \else
163 \ifx#1\@empty
164 0%
165 \else
166 \expandafter\expandafter\expandafter\@@extractflag
167 \expandafter\expandafter\expandafter{%
168 \expandafter#1\expandafter
169 }\expandafter{%
170 \romannumeral\number\numexpr#2-1\relax000%
171 }%
172 \fi
173 \fi
174 \fi
175 }
176 \def\@@extractflag#1#2{%
177 \ifx\\#1\\%
178 0%
179 \else
180 \ifx\\#2\\%
181 \@car#1\@nil
182 \else
183 \@@@extractflag#1|#2%
184 \fi
185 \fi
186 }
187 \def\@@@extractflag#1#2|#3#4\fi\fi{%
188 \fi\fi
189 \@@extractflag{#2}{#4}%
190 }
191 \endinput
192 %%
193 %% End of file `flags.sty'.