diff options
author | Karl Berry <karl@freefriends.org> | 2019-12-10 22:14:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-12-10 22:14:10 +0000 |
commit | b54546a6c56dbb42db906cf73f240d22f610f1fd (patch) | |
tree | f7795e130c33d5ecf236dc5f690de4ed3be9d968 /Master/texmf-dist/tex/generic/bitset | |
parent | 62b8b206c0ccdf22a38d475ab69bb327b8da0b61 (diff) |
bitset split from oberdiek (10dec19)
git-svn-id: svn://tug.org/texlive/trunk@53085 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/bitset')
-rw-r--r-- | Master/texmf-dist/tex/generic/bitset/bitset.sty | 1452 |
1 files changed, 1452 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/bitset/bitset.sty b/Master/texmf-dist/tex/generic/bitset/bitset.sty new file mode 100644 index 00000000000..c3e2bacb2c3 --- /dev/null +++ b/Master/texmf-dist/tex/generic/bitset/bitset.sty @@ -0,0 +1,1452 @@ +%% +%% This is file `bitset.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% bitset.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Project: bitset +%% Version: 2019/12/09 v1.3 +%% +%% Copyright (C) +%% 2007, 2011 Heiko Oberdiek +%% 2016-2019 Oberdiek Package Support Group +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% https://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% The Current Maintainers of this work are +%% Heiko Oberdiek and the Oberdiek Package Support Group +%% https://github.com/ho-tex/bitset/issues +%% +%% +%% The Base Interpreter refers to any `TeX-Format', +%% because some files are installed in TDS:tex/generic//. +%% +%% This work consists of the main source file bitset.dtx +%% and the derived files +%% bitset.sty, bitset.pdf, bitset.ins, bitset.drv, bitset-test1.tex, +%% bitset-test2.tex, bitset-test3.tex. +%% +\begingroup\catcode61\catcode48\catcode32=10\relax% + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode35=6 % # + \catcode39=12 % ' + \catcode44=12 % , + \catcode45=12 % - + \catcode46=12 % . + \catcode58=12 % : + \catcode64=11 % @ + \catcode123=1 % { + \catcode125=2 % } + \expandafter\let\expandafter\x\csname ver@bitset.sty\endcsname + \ifx\x\relax % plain-TeX, first loading + \else + \def\empty{}% + \ifx\x\empty % LaTeX, first loading, + % variable is initialized, but \ProvidesPackage not yet seen + \else + \expandafter\ifx\csname PackageInfo\endcsname\relax + \def\x#1#2{% + \immediate\write-1{Package #1 Info: #2.}% + }% + \else + \def\x#1#2{\PackageInfo{#1}{#2, stopped}}% + \fi + \x{bitset}{The package is already loaded}% + \aftergroup\endinput + \fi + \fi +\endgroup% +\begingroup\catcode61\catcode48\catcode32=10\relax% + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode35=6 % # + \catcode39=12 % ' + \catcode40=12 % ( + \catcode41=12 % ) + \catcode44=12 % , + \catcode45=12 % - + \catcode46=12 % . + \catcode47=12 % / + \catcode58=12 % : + \catcode64=11 % @ + \catcode91=12 % [ + \catcode93=12 % ] + \catcode123=1 % { + \catcode125=2 % } + \expandafter\ifx\csname ProvidesPackage\endcsname\relax + \def\x#1#2#3[#4]{\endgroup + \immediate\write-1{Package: #3 #4}% + \xdef#1{#4}% + }% + \else + \def\x#1#2[#3]{\endgroup + #2[{#3}]% + \ifx#1\@undefined + \xdef#1{#3}% + \fi + \ifx#1\relax + \xdef#1{#3}% + \fi + }% + \fi +\expandafter\x\csname ver@bitset.sty\endcsname +\ProvidesPackage{bitset}% + [2019/12/09 v1.3 Handle bit-vector datatype (HO)]% +\begingroup\catcode61\catcode48\catcode32=10\relax% + \catcode13=5 % ^^M + \endlinechar=13 % + \catcode123=1 % { + \catcode125=2 % } + \catcode64=11 % @ + \def\x{\endgroup + \expandafter\edef\csname BitSet@AtEnd\endcsname{% + \endlinechar=\the\endlinechar\relax + \catcode13=\the\catcode13\relax + \catcode32=\the\catcode32\relax + \catcode35=\the\catcode35\relax + \catcode61=\the\catcode61\relax + \catcode64=\the\catcode64\relax + \catcode123=\the\catcode123\relax + \catcode125=\the\catcode125\relax + }% + }% +\x\catcode61\catcode48\catcode32=10\relax% +\catcode13=5 % ^^M +\endlinechar=13 % +\catcode35=6 % # +\catcode64=11 % @ +\catcode123=1 % { +\catcode125=2 % } +\def\TMP@EnsureCode#1#2{% + \edef\BitSet@AtEnd{% + \BitSet@AtEnd + \catcode#1=\the\catcode#1\relax + }% + \catcode#1=#2\relax +} +\TMP@EnsureCode{33}{12}% ! +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{42}{12}% * +\TMP@EnsureCode{43}{12}% + +\TMP@EnsureCode{44}{12}% , +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{58}{11}% : (letter!) +\TMP@EnsureCode{60}{12}% < +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{63}{14}% ? (comment!) +\TMP@EnsureCode{91}{12}% [ +\TMP@EnsureCode{93}{12}% ] +\TMP@EnsureCode{96}{12}% ` +\edef\BitSet@AtEnd{\BitSet@AtEnd\noexpand\endinput} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname BitSet@TestMode\endcsname\relax +\else + \catcode63=9 % ? (ignore) +\fi +? \let\BitSet@@TestMode\BitSet@TestMode +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname RequirePackage\endcsname\relax + \def\TMP@RequirePackage#1[#2]{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname ver@#1.sty\endcsname\relax + \input #1.sty\relax + \fi + }% + \TMP@RequirePackage{infwarerr}[2007/09/09]% + \TMP@RequirePackage{intcalc}[2007/09/27]% + \TMP@RequirePackage{bigintcalc}[2007/09/27]% +\else + \RequirePackage{infwarerr}[2007/09/09]% + \RequirePackage{intcalc}[2007/09/27]% + \RequirePackage{bigintcalc}[2007/09/27]% +\fi +\def\BitSet@MaxSize{2147483647}% +\def\BitSet@Empty{} +\def\BitSet@FirstOfOne#1{#1} +\def\BitSet@Gobble#1{} +\def\BitSet@FirstOfTwo#1#2{#1} +\def\BitSet@SecondOfTwo#1#2{#2} +\def\BitSet@Space{ } +\def\BitSet@ZapSpace#1 #2{% + #1% + \ifx\BitSet@Empty#2% + \else + \expandafter\BitSet@ZapSpace + \fi + #2% +} +\let\BitSet@Fi\fi +\def\BitSet@AfterFi#1#2\BitSet@Fi{\fi#1} +\def\BitSet@AfterFiFi#1#2\BitSet@Fi{\fi\fi#1}% +\def\BitSet@AfterFiFiFi#1#2\BitSet@Fi{\fi\fi\fi#1}% +\def\BitSet@IfUndefined#1{% + \expandafter\ifx\csname BS@#1\endcsname\relax + \expandafter\BitSet@FirstOfTwo + \else + \expandafter\BitSet@SecondOfTwo + \fi +} +\def\BitSet@CheckIndex#1#2#3{% + \BitSet@IfUndefined{#2}{\bitsetReset{#2}}{}% + \expandafter\expandafter\expandafter\BitSet@@CheckIndex + \intcalcNum{#3}!% + {#2}{#1}% +} +\def\BitSet@@CheckIndex#1!#2#3{% + \ifnum#1<0 % + \BitSet@AfterFi{% + \@PackageError{bitset}{% + Invalid negative index (#1)% + }\@ehc + }% + \else + \BitSet@AfterFi{% + #3{#2}{#1}% + }% + \BitSet@Fi +} +\def\bitsetReset#1{% + \expandafter\def\csname BS@#1\endcsname{0}% +} +\def\bitsetLet#1#2{% + \BitSet@IfUndefined{#2}{% + \bitsetReset{#1}% + }{% + \expandafter\let\csname BS@#1\expandafter\endcsname + \csname BS@#2\endcsname + }% +} +\def\bitsetSetBin#1#2{% + \edef\BitSet@Temp{#2}% + \edef\BitSet@Temp{% + \expandafter\expandafter\expandafter\BitSet@ZapSpace + \expandafter\BitSet@Temp\BitSet@Space\BitSet@Empty + }% + \edef\BitSet@Temp{% + \expandafter\BitSet@KillZeros\BitSet@Temp\BitSet@Empty + }% + \ifx\BitSet@Temp\BitSet@Empty + \expandafter\let\csname BS@#1\endcsname\BitSet@Zero + \else + \expandafter\edef\csname BS@#1\endcsname{% + \expandafter\BitSet@Reverse\BitSet@Temp!% + }% + \fi +} +\def\BitSet@KillZeros#1{% + \ifx#10% + \expandafter\BitSet@KillZeros + \else + #1% + \fi +} +\def\BitSet@Reverse#1#2!{% + \ifx\\#2\\% + #1% + \else + \BitSet@AfterFi{% + \BitSet@Reverse#2!#1% + }% + \BitSet@Fi +} +\def\bitsetSetOct{% + \BitSet@SetOctHex\BitSet@FromFirstOct +} +\def\bitsetSetHex{% + \BitSet@SetOctHex\BitSet@FromFirstHex +} +\def\BitSet@SetOctHex#1#2#3{% + \edef\BitSet@Temp{#3}% + \edef\BitSet@Temp{% + \expandafter\expandafter\expandafter\BitSet@ZapSpace + \expandafter\BitSet@Temp\BitSet@Space\BitSet@Empty + }% + \edef\BitSet@Temp{% + \expandafter\BitSet@KillZeros\BitSet@Temp\BitSet@Empty + }% + \ifx\BitSet@Temp\BitSet@Empty + \expandafter\let\csname BS@#2\endcsname\BitSet@Zero + \else + \edef\BitSet@Temp{% + \expandafter#1\BitSet@Temp!% + }% + \ifx\BitSet@Temp\BitSet@Empty + \expandafter\let\csname BS@#2\endcsname\BitSet@Zero + \else + \expandafter\edef\csname BS@#2\endcsname{% + \expandafter\BitSet@Reverse\BitSet@Temp!% + }% + \fi + \fi +} +\def\BitSet@FromFirstOct#1{% + \ifx#1!% + \else + \ifcase#1 \BitSet@AfterFiFi\BitSet@FromFirstOct + \or 1% + \or 10% + \or 11% + \or 100% + \or 101% + \or 110% + \or 111% + \else \BitSetError:WrongOctalDigit% + \fi + \expandafter\BitSet@FromOct + \BitSet@Fi +} +\def\BitSet@FromOct#1{% + \ifx#1!% + \else + \ifcase#1 000% + \or 001% + \or 010% + \or 011% + \or 100% + \or 101% + \or 110% + \or 111% + \else \BitSetError:WrongOctalDigit% + \fi + \expandafter\BitSet@FromOct + \fi +} +\def\BitSet@FromFirstHex#1{% + \ifx#1!% + \else + \ifx#10% + \BitSet@AfterFiFi\BitSet@FromFirstHex + \fi + \expandafter\ifx\csname BitSet@Hex#1\endcsname\relax + \BitSetError:InvalidHexDigit% + \else + \expandafter\expandafter\expandafter\BitSet@KillZeros + \csname BitSet@Hex#1\endcsname + \fi + \expandafter\BitSet@FromHex + \BitSet@Fi +} +\def\BitSet@FromHex#1{% + \ifx#1!% + \else + \expandafter\ifx\csname BitSet@Hex#1\endcsname\relax + \BitSetError:InvalidHexDigit% + \else + \csname BitSet@Hex#1\endcsname + \fi + \expandafter\BitSet@FromHex + \fi +} +\def\BitSet@Temp#1{% + \expandafter\def\csname BitSet@Hex#1\endcsname +} +\BitSet@Temp 0{0000}% +\BitSet@Temp 1{0001}% +\BitSet@Temp 2{0010}% +\BitSet@Temp 3{0011}% +\BitSet@Temp 4{0100}% +\BitSet@Temp 5{0101}% +\BitSet@Temp 6{0110}% +\BitSet@Temp 7{0111}% +\BitSet@Temp 8{1000}% +\BitSet@Temp 9{1001}% +\BitSet@Temp A{1010}% +\BitSet@Temp B{1011}% +\BitSet@Temp C{1100}% +\BitSet@Temp D{1101}% +\BitSet@Temp E{1110}% +\BitSet@Temp F{1111}% +\BitSet@Temp a{1010}% +\BitSet@Temp b{1011}% +\BitSet@Temp c{1100}% +\BitSet@Temp d{1101}% +\BitSet@Temp e{1110}% +\BitSet@Temp f{1111}% +\def\bitsetSetDec#1#2{% + \edef\BitSet@Temp{#2}% + \edef\BitSet@Temp{% + \expandafter\expandafter\expandafter\BitSet@ZapSpace + \expandafter\BitSet@Temp\BitSet@Space\BitSet@Empty + }% + \edef\BitSet@Temp{% + \expandafter\BitSet@KillZeros\BitSet@Temp\BitSet@Empty + }% + \ifx\BitSet@Temp\BitSet@Empty + \expandafter\let\csname BS@#1\endcsname\BitSet@Zero + \else + \ifcase\bigintcalcSgn{\BitSet@Temp} % + \expandafter\let\csname BS@#1\endcsname\BitSet@Zero + \or + \ifnum\bigintcalcCmp\BitSet@Temp\BitSet@MaxSize>0 % + \expandafter\edef\csname BS@#1\endcsname{% + \expandafter\BitSet@SetDecBig\BitSet@Temp!% + }% + \else + \expandafter\edef\csname BS@#1\endcsname{% + \expandafter\BitSet@SetDec\BitSet@Temp!% + }% + \fi + \else + \@PackageError{bitset}{% + Bit sets cannot be negative% + }\@ehc + \fi + \fi +} +\def\BitSet@SetDecBig#1#2#3#4#5#6#7#8#9!{% + \ifx\\#9\\% + \BitSet@SetDec#1#2#3#4#5#6#7#8!% + \else + \ifcase\BigIntCalcOdd#1#2#4#5#6#7#8#9! % + 0% + \or + 1% +? \else\BitSetError:ThisCannotHappen% + \fi + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@SetDecBig + \BigIntCalcShr#1#2#3#4#5#6#7#8#9!!% + }% + \BitSet@Fi +} +\def\BitSet@SetDec#1!{% + \ifcase#1 % + \or 1% + \else + \ifodd#1 % + 1% + \else + 0% + \fi + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@SetDec + \IntCalcShr#1!!% + }% + \BitSet@Fi +} +\def\bitsetGetBin#1#2{% + \romannumeral0% + \expandafter\expandafter\expandafter\BitSet@@GetBin + \intcalcNum{#2}!{#1}% +} +\def\BitSet@@GetBin#1!#2{% + \BitSet@IfUndefined{#2}{% + \ifnum#1>1 % + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@Fill + \IntCalcDec#1!!0% + }% + \else + \BitSet@AfterFi{ 0}% + \BitSet@Fi + }{% + \expandafter\expandafter\expandafter\BitSet@NumBinRev + \expandafter\expandafter\expandafter1% + \expandafter\expandafter\expandafter!% + \csname BS@#2\endcsname!!#1!% + }% +} +\def\BitSet@Fill#1!{% + \ifnum#1>0 % + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@Fill + \IntCalcDec#1!!0% + }% + \else + \BitSet@AfterFi{ }% + \BitSet@Fi +} +\def\BitSet@NumBinRev#1!#2#3!{% + \ifx\\#3\\% + \BitSet@AfterFi{% + \BitSet@NumBinFill#1!#2% + }% + \else + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@NumBinRev + \IntCalcInc#1!!#3!#2% + }% + \BitSet@Fi +} +\def\BitSet@NumBinFill#1!#2!#3!{% + \ifnum#3>#1 % + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@Fill + \IntCalcSub#3!#1!!#2% + }% + \else + \BitSet@AfterFi{ #2}% + \BitSet@Fi +} +\def\bitsetGetOct#1#2{% + \romannumeral0% + \bitsetIsEmpty{#1}{% + \expandafter\expandafter\expandafter\BitSet@@GetOctHex + \intcalcNum{#2}!3!230% + }{% + \expandafter\expandafter\expandafter\BitSet@@GetOct + \expandafter\expandafter\expandafter1% + \expandafter\expandafter\expandafter!% + \expandafter\expandafter\expandafter!% + \csname BS@#1\endcsname00% + \BitSet@Empty\BitSet@Empty\BitSet@Empty!{#2}% + }% +} +\def\bitsetGetHex#1#2{% + \romannumeral0% + \bitsetIsEmpty{#1}{% + \expandafter\expandafter\expandafter\BitSet@@GetOctHex + \intcalcNum{#2}!4!340% + }{% + \expandafter\expandafter\expandafter\BitSet@@GetHex + \expandafter\expandafter\expandafter1% + \expandafter\expandafter\expandafter!% + \expandafter\expandafter\expandafter!% + \csname BS@#1\endcsname000% + \BitSet@Empty\BitSet@Empty\BitSet@Empty\BitSet@Empty!{#2}% + }% +} +\def\BitSet@@GetOct#1!#2!#3#4#5{% + \ifx#5\BitSet@Empty + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@GetOctHex + \IntCalcDec#1!!#2!23% + }% + \else + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@@GetOct + \number\IntCalcInc#1!\expandafter\expandafter\expandafter!% + \csname BitSet@Oct#5#4#3\endcsname#2!% + }% + \BitSet@Fi +} +\def\BitSet@Temp#1#2#3#4{% + \expandafter\def\csname BitSet@Oct#1#2#3\endcsname{#4}% +} +\BitSet@Temp0000% +\BitSet@Temp0011% +\BitSet@Temp0102% +\BitSet@Temp0113% +\BitSet@Temp1004% +\BitSet@Temp1015% +\BitSet@Temp1106% +\BitSet@Temp1117% +\def\BitSet@@GetHex#1!#2!#3#4#5#6{% + \ifx#6\BitSet@Empty + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@GetOctHex + \IntCalcDec#1!!#2!34% + }% + \else + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@@GetHex + \number\IntCalcInc#1!\expandafter\expandafter\expandafter!% + \csname BitSet@Hex#6#5#4#3\endcsname#2!% + }% + \BitSet@Fi +} +\def\BitSet@Temp#1#2#3#4#5{% + \expandafter\def\csname BitSet@Hex#1#2#3#4\endcsname{#5}% +} +\BitSet@Temp00000% +\BitSet@Temp00011% +\BitSet@Temp00102% +\BitSet@Temp00113% +\BitSet@Temp01004% +\BitSet@Temp01015% +\BitSet@Temp01106% +\BitSet@Temp01117% +\BitSet@Temp10008% +\BitSet@Temp10019% +\BitSet@Temp1010A% +\BitSet@Temp1011B% +\BitSet@Temp1100C% +\BitSet@Temp1101D% +\BitSet@Temp1110E% +\BitSet@Temp1111F% +\def\BitSet@GetOctHex#1!#2!#3#4#5!#6{% + \expandafter\BitSet@@GetOctHex + \number\intcalcNum{#6}\expandafter\expandafter\expandafter!% + \IntCalcMul#1!#4!!#3#4#2% +} +\def\BitSet@@GetOctHex#1!#2!#3#4{% + \ifnum#1>#2 % + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\BitSet@Fill + \expandafter\IntCalcDiv\number + \expandafter\expandafter\expandafter\IntCalcAdd + \IntCalcSub#1!#2!!#3!!#4!!% + }% + \else + \BitSet@AfterFi{ }% + \BitSet@Fi +} +\def\bitsetGetDec#1{% + \romannumeral0% + \BitSet@IfUndefined{#1}{ 0}{% + \expandafter\expandafter\expandafter\BitSet@GetDec + \csname BS@#1\endcsname!% + }% +} +\def\BitSet@GetDec#1#2!{% + \ifx\\#2\\% + \BitSet@AfterFi{ #1}% + \else + \BitSet@AfterFi{% + \BitSet@@GetDec2!#1!#2!% + }% + \BitSet@Fi +} +\def\BitSet@@GetDec#1!#2!#3#4!{% + \ifx\\#4\\% + \ifx#31% + \BitSet@AfterFiFi{% + \expandafter\expandafter\expandafter\BitSet@Space + \IntCalcAdd#1!#2!% + }% + \else + \BitSet@AfterFiFi{ #2}% + \fi + \else + \ifx#31% + \BitSet@AfterFiFi{% + \csname BitSet@N#1% + \expandafter\expandafter\expandafter\endcsname + \IntCalcAdd#1!#2!!#4!% + }% + \else + \BitSet@AfterFiFi{% + \csname BitSet@N#1\endcsname#2!#4!% + }% + \fi + \BitSet@Fi +} +\def\BitSet@Temp#1#2{% + \expandafter\def\csname BitSet@N#1\endcsname{% + \BitSet@@GetDec#2!% + }% +} +\BitSet@Temp{1}{2} +\BitSet@Temp{2}{4} +\BitSet@Temp{4}{8} +\BitSet@Temp{8}{16} +\BitSet@Temp{16}{32} +\BitSet@Temp{32}{64} +\BitSet@Temp{64}{128} +\BitSet@Temp{128}{256} +\BitSet@Temp{256}{512} +\BitSet@Temp{512}{1024} +\BitSet@Temp{1024}{2048} +\BitSet@Temp{2048}{4096} +\BitSet@Temp{4096}{8192} +\BitSet@Temp{8192}{16384} +\BitSet@Temp{16384}{32768} +\BitSet@Temp{32768}{65536} +\BitSet@Temp{65536}{131072} +\BitSet@Temp{131072}{262144} +\BitSet@Temp{262144}{524288} +\BitSet@Temp{524288}{1048576} +\BitSet@Temp{1048576}{2097152} +\BitSet@Temp{2097152}{4194304} +\BitSet@Temp{4194304}{8388608} +\BitSet@Temp{8388608}{16777216} +\BitSet@Temp{16777216}{33554432} +\BitSet@Temp{33554432}{67108864} +\BitSet@Temp{67108864}{134217728} +\BitSet@Temp{134217728}{268435456} +\BitSet@Temp{268435456}{536870912} +\BitSet@Temp{536870912}{1073741824} +\expandafter\def\csname BitSet@N1073741824\endcsname{% + \BitSet@GetDecBig2147483648!% +}% +\def\BitSet@GetDecBig#1!#2!#3#4!{% + \ifx\\#4\\% + \ifx#31% + \BitSet@AfterFiFi{% + \expandafter\expandafter\expandafter\BitSet@Space + \BigIntCalcAdd#1!#2!% + }% + \else + \BitSet@AfterFiFi{ #2}% + \fi + \else + \ifx#31% + \BitSet@AfterFiFi{% + \expandafter\expandafter\expandafter\BitSet@@GetDecBig + \BigIntCalcAdd#1!#2!!#1!#4!% + }% + \else + \BitSet@AfterFiFi{% + \expandafter\expandafter\expandafter\BitSet@GetDecBig + \BigIntCalcShl#1!!#2!#4!% + }% + \fi + \BitSet@Fi +} +\def\BitSet@@GetDecBig#1!#2!{% + \expandafter\expandafter\expandafter\BitSet@GetDecBig + \BigIntCalcShl#2!!#1!% +} +\def\bitsetAnd#1#2{% + \bitsetIsEmpty{#1}{% + \bitsetReset{#1}% + }{% + \bitsetIsEmpty{#2}{% + \bitsetReset{#1}% + }{% + \expandafter\edef\csname BS@#1\endcsname{% + \expandafter\expandafter\expandafter\BitSet@And + \csname BS@#1\expandafter\expandafter\expandafter\endcsname + \expandafter\expandafter\expandafter!% + \csname BS@#2\endcsname!!% + }% + \expandafter\ifx\csname BS@#1\endcsname\BitSet@Empty + \bitsetReset{#1}% + \fi + }% + }% +} +\def\BitSet@And#1#2!#3#4!#5!{% + \ifx\\#2\\% + \ifnum#1#3=11 #51\fi + \else + \ifx\\#4\\% + \ifnum#1#3=11 #51\fi + \else + \ifnum#1#3=11 % + #51% + \BitSet@AfterFiFiFi{% + \BitSet@And#2!#4!!% + }% + \else + \BitSet@AfterFiFiFi{% + \BitSet@And#2!#4!#50!% + }% + \fi + \fi + \BitSet@Fi +} +\def\bitsetAndNot#1#2{% + \bitsetIsEmpty{#1}{% + \bitsetReset{#1}% + }{% + \bitsetIsEmpty{#2}{% + }{% + \expandafter\edef\csname BS@#1\endcsname{% + \expandafter\expandafter\expandafter\BitSet@AndNot + \csname BS@#1\expandafter\expandafter\expandafter\endcsname + \expandafter\expandafter\expandafter!% + \csname BS@#2\endcsname!!% + }% + \expandafter\ifx\csname BS@#1\endcsname\BitSet@Empty + \bitsetReset{#1}% + \fi + }% + }% +} +\def\BitSet@AndNot#1#2!#3#4!#5!{% + \ifx\\#2\\% + \ifnum#1#3=10 #51\fi + \else + \ifx\\#4\\% + #5% + \ifnum#1#3=10 1\else 0\fi + #2% + \else + \ifnum#1#3=10 % + #51% + \BitSet@AfterFiFiFi{% + \BitSet@AndNot#2!#4!!% + }% + \else + \BitSet@AfterFiFiFi{% + \BitSet@AndNot#2!#4!#50!% + }% + \fi + \fi + \BitSet@Fi +} +\def\bitsetOr#1#2{% + \bitsetIsEmpty{#2}{% + \BitSet@IfUndefined{#1}{\bitsetReset{#1}}{}% + }{% + \bitsetIsEmpty{#1}{% + \expandafter\let\csname BS@#1\expandafter\endcsname + \csname BS@#2\endcsname + }{% + \expandafter\edef\csname BS@#1\endcsname{% + \expandafter\expandafter\expandafter\BitSet@Or + \csname BS@#1\expandafter\expandafter\expandafter\endcsname + \expandafter\expandafter\expandafter!% + \csname BS@#2\endcsname!% + }% + }% + }% +} +\def\BitSet@Or#1#2!#3#4!{% + \ifnum#1#3>0 1\else 0\fi + \ifx\\#2\\% + #4% + \else + \ifx\\#4\\% + #2% + \else + \BitSet@AfterFiFi{% + \BitSet@Or#2!#4!% + }% + \fi + \BitSet@Fi +} +\def\bitsetXor#1#2{% + \bitsetIsEmpty{#2}{% + \BitSet@IfUndefined{#1}{\bitsetReset{#1}}{}% + }{% + \bitsetIsEmpty{#1}{% + \expandafter\let\csname BS@#1\expandafter\endcsname + \csname BS@#2\endcsname + }{% + \expandafter\edef\csname BS@#1\endcsname{% + \expandafter\expandafter\expandafter\BitSet@Xor + \csname BS@#1\expandafter\expandafter\expandafter\endcsname + \expandafter\expandafter\expandafter!% + \csname BS@#2\endcsname!!% + }% + \expandafter\ifx\csname BS@#1\endcsname\BitSet@Empty + \bitsetReset{#1}% + \fi + }% + }% +} +\def\BitSet@Xor#1#2!#3#4!#5!{% + \ifx\\#2\\% + \ifx#1#3% + \ifx\\#4\\% + \else + #50#4% + \fi + \else + #51#4% + \fi + \else + \ifx\\#4\\% + #5% + \ifx#1#30\else 1\fi + #2% + \else + \ifx#1#3% + \BitSet@AfterFiFiFi{% + \BitSet@Xor#2!#4!#50!% + }% + \else + #51% + \BitSet@AfterFiFiFi{% + \BitSet@Xor#2!#4!!% + }% + \fi + \fi + \BitSet@Fi +} +\def\bitsetShiftLeft#1#2{% + \BitSet@IfUndefined{#1}{% + \bitsetReset{#1}% + }{% + \bitsetIsEmpty{#1}{% + }{% + \expandafter\expandafter\expandafter\BitSet@ShiftLeft + \intcalcNum{#2}!{#1}% + }% + }% +} +\def\BitSet@ShiftLeft#1!#2{% + \ifcase\intcalcSgn{#1} % + \or + \begingroup + \uccode`m=`0 % + \uppercase\expandafter{\expandafter\endgroup + \expandafter\edef\csname BS@#2\expandafter\endcsname + \expandafter{% + \romannumeral#1000\expandafter\BitSet@Space + \csname BS@#2\endcsname + }% + }% + \else + \expandafter\BitSet@ShiftRight\BitSet@Gobble#1!{#2}% + \fi +} +\def\bitsetShiftRight#1#2{% + \BitSet@IfUndefined{#1}{% + \bitsetReset{#1}% + }{% + \bitsetIsEmpty{#1}{% + }{% + \expandafter\expandafter\expandafter\BitSet@ShiftRight + \intcalcNum{#2}!{#1}% + }% + }% +} +\def\BitSet@ShiftRight#1!#2{% + \ifcase\intcalcSgn{#1} % + \or + \expandafter\edef\csname BS@#2\endcsname{% + \expandafter\expandafter\expandafter\BitSet@Kill + \csname BS@#2\expandafter\endcsname\expandafter\BitSet@Empty + \expandafter=% + \expandafter{\expandafter}\expandafter{\expandafter}% + \romannumeral#1000!% + }% + \else + \expandafter\BitSet@ShiftLeft\BitSet@Gobble#1!{#2}% + \fi +} +\def\BitSet@Kill#1#2=#3#4#5{% + #3#4% + \ifx#5!% + \ifx#1\BitSet@Empty + 0% + \else + #1#2% + \fi + \else + \ifx#1\BitSet@Empty + 0% + \BitSet@AfterFiFi\BitSet@Cleanup + \else + \BitSet@Kill#2=% + \fi + \BitSet@Fi +} +\def\bitsetClear{% + \BitSet@CheckIndex\BitSet@Clear +} +\def\bitsetSet{% + \BitSet@CheckIndex\BitSet@Set +} +\def\bitsetFlip{% + \BitSet@CheckIndex\BitSet@Flip +} +\def\bitsetSetValue#1#2#3{% + \expandafter\expandafter\expandafter\BitSet@SetValue + \intcalcNum{#3}!{#1}{#2}% +} +\def\BitSet@SetValue#1!{% + \BitSet@CheckIndex{% + \ifcase#1 % + \expandafter\BitSet@Clear + \or + \expandafter\BitSet@Set + \else + \BitSet@ErrorInvalidBitValue{#1}% + \expandafter\expandafter\expandafter\BitSet@Gobble + \expandafter\BitSet@Gobble + \fi + }% +} +\def\BitSet@ErrorInvalidBitValue#1{% + \@PackageError{bitset}{% + Invalid bit value (#1) not in range 0..1% + }\@ehc +} +\def\BitSet@Clear#1#2{% + \edef\BitSet@Temp{% + \expandafter\expandafter\expandafter\BitSet@@Clear + \csname BS@#1\expandafter\endcsname + \expandafter\BitSet@Empty\expandafter=\expandafter!% + \romannumeral#2000!% + }% + \expandafter\let\csname BS@#1\expandafter\endcsname + \ifx\BitSet@Temp\BitSet@Empty + \BitSet@Zero + \else + \BitSet@Temp + \fi +} +\def\BitSet@@Clear#1#2=#3!#4{% + \ifx#4!% + \ifx#1\BitSet@Empty + \else + \ifx\BitSet@Empty#2% + \else + #30#2% + \fi + \fi + \else + \ifx#1\BitSet@Empty + \BitSet@AfterFiFi\BitSet@Cleanup + \else + \ifx#10% + \BitSet@AfterFiFiFi{% + \BitSet@@Clear#2=#30!% + }% + \else + #31% + \BitSet@AfterFiFiFi{% + \BitSet@@Clear#2=!% + }% + \fi + \fi + \BitSet@Fi +} +\def\BitSet@Set#1#2{% + \expandafter\edef\csname BS@#1\endcsname{% + \expandafter\expandafter\expandafter\BitSet@@Set + \csname BS@#1\expandafter\endcsname + \expandafter\BitSet@Empty\expandafter=% + \expandafter{\expandafter}\expandafter{\expandafter}% + \romannumeral#2000!% + }% +} +\def\BitSet@@Set#1#2=#3#4#5{% + #3#4% + \ifx#5!% + 1#2% + \else + \ifx#1\BitSet@Empty + 0% + \BitSet@AfterFiFi\BitSet@@@Set + \else + #1% + \BitSet@@Set#2=% + \fi + \BitSet@Fi +} +\def\BitSet@@@Set#1{% + \ifx#1!% + 1% + \else + 0% + \expandafter\BitSet@@@Set + \fi +} +\def\BitSet@Flip#1#2{% + \edef\BitSet@Temp{% + \expandafter\expandafter\expandafter\BitSet@@Flip + \csname BS@#1\expandafter\endcsname + \expandafter\BitSet@Empty\expandafter=\expandafter!% + \romannumeral#2000!% + }% + \expandafter\let\csname BS@#1\expandafter\endcsname + \ifx\BitSet@Temp\BitSet@Empty + \BitSet@Zero + \else + \BitSet@Temp + \fi +} +\def\BitSet@@Flip#1#2=#3!#4{% + \ifx#4!% + \ifx#11% + \ifx\BitSet@Empty#2% + \else + #30#2% + \fi + \else + #31#2% + \fi + \else + \ifx#1\BitSet@Empty + #30% + \BitSet@AfterFiFi\BitSet@@@Set + \else + \ifx#10% + \BitSet@AfterFiFiFi{% + \BitSet@@Flip#2=#30!% + }% + \else + #31% + \BitSet@AfterFiFiFi{% + \BitSet@@Flip#2=!% + }% + \fi + \fi + \BitSet@Fi +} +\def\bitsetClearRange{% + \BitSet@Range\BitSet@Clear +} +\def\bitsetSetRange{% + \BitSet@Range\BitSet@Set +} +\def\bitsetFlipRange{% + \BitSet@Range\BitSet@Flip +} +\def\bitsetSetValueRange#1#2#3#4{% + \expandafter\expandafter\expandafter\BitSet@SetValueRange + \intcalcNum{#4}!{#1}{#2}{#3}% +} +\def\BitSet@SetValueRange#1!#2#3#4{% + \ifcase#1 % + \BitSet@Range\BitSet@Clear{#2}{#3}{#4}% + \or + \BitSet@Range\BitSet@Set{#2}{#3}{#4}% + \else + \BitSet@ErrorInvalidBitValue{#1}% + \fi +} +\def\BitSet@Range#1#2#3#4{% + \edef\BitSet@Temp{% + \noexpand\BitSet@@Range\noexpand#1{#2}% + \intcalcNum{#3}!\intcalcNum{#4}!% + }% + \BitSet@Temp +} +\def\BitSet@@Range#1#2#3!#4!{% + \ifnum#3<0 % + \BitSet@NegativeIndex#1{#2}#3!#4!0!#4!% + \else + \ifnum#4<0 % + \BitSet@NegativeIndex#1{#2}#3!#4!#3!0!% + \else + \ifcase\intcalcCmp{#3}{#4} % + \or + \@PackageError{bitset}{% + Wrong index numbers in range [#3..#4]\MessageBreak% hash-ok + for clear/set/flip on bit set `#2'.\MessageBreak + The lower index exceeds the upper index.\MessageBreak + Canceling the operation as error recovery% + }\@ehc + \else + \BitSet@@@Range#3!#4!#1{#2}% + \fi + \fi + \fi +} +\def\BitSet@NegativeIndex#1#2#3!#4!#5!#6!{% + \@PackageError{bitset}{% + Negative index in range [#3..#4]\MessageBreak % hash-ok + for \string\bitset + \ifx#1\BitSet@Clear + Clear% + \else + \ifx#1\BitSet@Set + Set% + \else + Flip% + \fi + \fi + Range on bit set `#2'.\MessageBreak + Using [#5..#6] as error recovery% hash-ok + }\@ehc + \BitSet@@Range#1{#2}#5!#6!% +} +\def\BitSet@@@Range#1!#2!#3#4{% + \ifnum#1<#2 % + #3{#4}{#1}% + \BitSet@AfterFi{% + \expandafter\expandafter\expandafter\BitSet@@@Range + \IntCalcInc#1!!#2!#3{#4}% + }% + \BitSet@Fi +} +\def\bitsetGet#1#2{% + \number + \expandafter\expandafter\expandafter\BitSet@Get + \intcalcNum{#2}!{#1}% +} +\def\BitSet@Get#1!#2{% + \ifnum#1<0 % + \BitSet@AfterFi{% + 0 \BitSetError:NegativeIndex% + }% + \else + \BitSet@IfUndefined{#2}{0}{% + \expandafter\expandafter\expandafter\BitSet@@Get + \csname BS@#2\expandafter\endcsname + \expandafter!\expandafter=% + \expandafter{\expandafter}\expandafter{\expandafter}% + \romannumeral\intcalcNum{#1}000!% + }% + \expandafter\BitSet@Space + \BitSet@Fi +} +\def\BitSet@@Get#1#2=#3#4#5{% + #3#4% + \ifx#5!% + \ifx#1!% + 0% + \else + #1% + \fi + \else + \ifx#1!% + 0% + \BitSet@AfterFiFi\BitSet@Cleanup + \else + \BitSet@@Get#2=% + \fi + \BitSet@Fi +} +\def\bitsetNextClearBit#1#2{% + \number + \expandafter\expandafter\expandafter\BitSet@NextClearBit + \intcalcNum{#2}!{#1} % +} +\def\BitSet@NextClearBit#1!#2{% + \ifnum#1<0 % + \BitSet@NextClearBit0!{#2}% + \BitSet@AfterFi{% + \expandafter\BitSet@Space + \expandafter\BitSetError:NegativeIndex\romannumeral0% + }% + \else + \bitsetIsEmpty{#2}{#1}{% + \expandafter\BitSet@Skip + \number#1\expandafter\expandafter\expandafter!% + \csname BS@#2\endcsname!!!!!!!!!=% + {\BitSet@@NextClearBit#1!}% + }% + \BitSet@Fi +} +\def\BitSet@@NextClearBit#1!#2{% + \ifx#2!% + #1% + \else + \ifx#20% + #1% + \BitSet@AfterFiFi\BitSet@Cleanup + \else + \BitSet@AfterFiFi{% + \expandafter\expandafter\expandafter\BitSet@@NextClearBit + \IntCalcInc#1!!% + }% + \fi + \BitSet@Fi +} +\def\bitsetNextSetBit#1#2{% + \number + \expandafter\expandafter\expandafter\BitSet@NextSetBit + \intcalcNum{#2}!{#1} % +} +\def\BitSet@NextSetBit#1!#2{% + \ifnum#1<0 % + \BitSet@NextSetBit0!{#2}% + \BitSet@AfterFi{% + \expandafter\BitSet@Space + \expandafter\BitSetError:NegativeIndex\romannumeral0% + }% + \else + \bitsetIsEmpty{#2}{-1}{% + \expandafter\BitSet@Skip + \number#1\expandafter\expandafter\expandafter!% + \csname BS@#2\endcsname!!!!!!!!!=% + {\BitSet@@NextSetBit#1!}% + }% + \BitSet@Fi +} +\def\BitSet@@NextSetBit#1!#2{% + \ifx#2!% + -1% + \else + \ifx#21% + #1% + \BitSet@AfterFiFi\BitSet@Cleanup + \else + \BitSet@AfterFiFi{% + \expandafter\expandafter\expandafter\BitSet@@NextSetBit + \IntCalcInc#1!!% + }% + \fi + \BitSet@Fi +} +\def\BitSet@Cleanup#1!{} +\def\BitSet@Skip#1!#2{% + \ifx#2!% + \BitSet@AfterFi{% + \BitSet@SkipContinue% + }% + \else + \ifcase#1 % + \BitSet@AfterFiFi{% + \BitSet@SkipContinue#2% + }% + \or + \BitSet@AfterFiFi\BitSet@SkipContinue + \or + \BitSet@AfterFiFi{% + \expandafter\BitSet@SkipContinue\BitSet@Gobble + }% + \else + \ifnum#1>8 % + \BitSet@AfterFiFiFi{% + \expandafter\BitSet@Skip + \number\IntCalcSub#1!8!\expandafter!% + \BitSet@GobbleSeven + }% + \else + \BitSet@AfterFiFiFi{% + \expandafter\expandafter\expandafter\BitSet@Skip + \IntCalcDec#1!!% + }% + \fi + \fi + \BitSet@Fi +} +\def\BitSet@SkipContinue#1!#2=#3{% + #3#1!% +} +\def\BitSet@GobbleSeven#1#2#3#4#5#6#7{} +\def\bitsetGetSetBitList#1{% + \romannumeral0% + \bitsetIsEmpty{#1}{ }{% + \expandafter\BitSet@GetSetBitList + \number\BitSet@NextSetBit0!{#1}!{#1}{}!% + }% +} +\def\BitSet@GetSetBitList#1!#2#3#4!{% + \ifnum#1<0 % + \BitSet@AfterFi{ #4}% + \else + \BitSet@AfterFi{% + \expandafter\BitSet@GetSetBitList\number + \expandafter\expandafter\expandafter\BitSet@NextSetBit + \IntCalcInc#1!!{#2}!{#2},#4#3#1!% + }% + \BitSet@Fi +} +\def\bitsetSize#1{% + \number + \BitSet@IfUndefined{#1}{0 }{% + \expandafter\expandafter\expandafter\BitSet@Size + \expandafter\expandafter\expandafter1% + \expandafter\expandafter\expandafter!% + \csname BS@#1\endcsname!0!% + }% +} +\def\BitSet@Size#1!#2#3!#4!{% + \ifx#21% + \ifx\\#3\\% + \BitSet@AfterFiFi{#1 }% + \else + \BitSet@AfterFiFi{% + \expandafter\expandafter\expandafter\BitSet@Size + \IntCalcInc#1!!#3!#1!% + }% + \fi + \else + \ifx\\#3\\% + \BitSet@AfterFiFi{#4 }% + \else + \BitSet@AfterFiFi{% + \expandafter\expandafter\expandafter\BitSet@Size + \IntCalcInc#1!!#3!#4!% + }% + \fi + \fi + \BitSet@Fi +} +\def\bitsetCardinality#1{% + \number + \BitSet@IfUndefined{#1}{0 }{% + \expandafter\expandafter\expandafter\BitSet@Cardinality + \expandafter\expandafter\expandafter0% + \expandafter\expandafter\expandafter!% + \csname BS@#1\endcsname!% + }% +} +\def\BitSet@Cardinality#1!#2#3!{% + \ifx#21% + \ifx\\#3\\% + \BitSet@AfterFiFi{\IntCalcInc#1! }% + \else + \BitSet@AfterFiFi{% + \expandafter\expandafter\expandafter\BitSet@Cardinality + \IntCalcInc#1!!#3!% + }% + \fi + \else + \ifx\\#3\\% + \BitSet@AfterFiFi{#1 }% + \else + \BitSet@AfterFiFi{% + \BitSet@Cardinality#1!#3!% + }% + \fi + \fi + \BitSet@Fi +} +\def\bitsetIsDefined#1{% + \BitSet@IfUndefined{#1}% + \BitSet@SecondOfTwo + \BitSet@FirstOfTwo +} +\def\bitsetIsEmpty#1{% + \BitSet@IfUndefined{#1}\BitSet@FirstOfTwo{% + \expandafter\ifx\csname BS@#1\endcsname\BitSet@Zero + \expandafter\BitSet@FirstOfTwo + \else + \expandafter\BitSet@SecondOfTwo + \fi + }% +} +\def\BitSet@Zero{0} +\def\bitsetQuery#1#2{% + \ifnum\bitsetGet{#1}{#2}=1 % + \expandafter\BitSet@FirstOfTwo + \else + \expandafter\BitSet@SecondOfTwo + \fi +} +\def\bitsetEquals#1#2{% + \BitSet@IfUndefined{#1}{% + \BitSet@IfUndefined{#2}\BitSet@FirstOfTwo\BitSet@SecondOfTwo + }{% + \BitSet@IfUndefined{#2}\BitSet@SecondOfTwo{% + \expandafter\ifx\csname BS@#1\expandafter\endcsname + \csname BS@#2\endcsname + \expandafter\BitSet@FirstOfTwo + \else + \expandafter\BitSet@SecondOfTwo + \fi + }% + }% +} +\def\bitsetIntersects#1#2{% + \bitsetIsEmpty{#1}\BitSet@SecondOfTwo{% + \bitsetIsEmpty{#2}\BitSet@SecondOfTwo{% + \expandafter\expandafter\expandafter\BitSet@Intersects + \csname BS@#1\expandafter\expandafter\expandafter\endcsname + \expandafter\expandafter\expandafter!% + \csname BS@#2\endcsname!% + }% + }% +} +\def\BitSet@Intersects#1#2!#3#4!{% + \ifnum#1#3=11 % + \BitSet@AfterFi\BitSet@FirstOfTwo + \else + \ifx\\#2\\% + \BitSet@AfterFiFi\BitSet@SecondOfTwo + \else + \ifx\\#4\\% + \BitSet@AfterFiFiFi\BitSet@SecondOfTwo + \else + \BitSet@AfterFiFiFi{% + \BitSet@Intersects#2!#4!% + }% + \fi + \fi + \BitSet@Fi +} +\BitSet@AtEnd% +%% \section{Installation} +\endinput +%% +%% End of file `bitset.sty'. |