diff options
author | Karl Berry <karl@freefriends.org> | 2008-04-01 00:29:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-04-01 00:29:26 +0000 |
commit | f75d6cc3f99e24feb4fa05d04ff9be31ac3372ba (patch) | |
tree | 993d29c2a865525d0b4ecf89e1ae18a0cd02f371 /Master/texmf-dist/tex/latex/stringstrings | |
parent | 396c32d3bf0da9bc7b24122e15b65454634fe851 (diff) |
new latex package stringstrings (31mar08)
git-svn-id: svn://tug.org/texlive/trunk@7272 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/stringstrings')
-rw-r--r-- | Master/texmf-dist/tex/latex/stringstrings/stringstrings.sty | 2104 |
1 files changed, 2104 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/stringstrings/stringstrings.sty b/Master/texmf-dist/tex/latex/stringstrings/stringstrings.sty new file mode 100644 index 00000000000..893d0ecb977 --- /dev/null +++ b/Master/texmf-dist/tex/latex/stringstrings/stringstrings.sty @@ -0,0 +1,2104 @@ +%% +%% This is file `stringstrings.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% stringstrings.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from stringstrings.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file stringstrings.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +\ProvidesPackage{stringstrings} +[2008/03/28 v1.00 + Extensive array of string manipulation routines for + cosmetic and programming application] +\NeedsTeXFormat{LaTeX2e} +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%% INITIALIZATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{ifthen} + +\def\@MAXSTRINGSIZE{500} + +\def\endofstring{@E@o@S@}% +\def\undecipherable{.}% UNDECIPHERABLE TOKENS TO BE REPLACED BY PERIOD +\def\@blankaction{\BlankSpace} + +\let\SaveDollar\$ +\let\SaveHardspace~ +\let\SaveCircumflex\^ +\let\SaveTilde\~ +\let\SaveUmlaut\" +\let\SaveGrave\` +\let\SaveAcute\' +\let\SaveMacron\= +\let\SaveOverdot\. +\let\SaveBreve\u +\let\SaveCaron\v +\let\SaveDoubleAcute\H +\let\SaveCedilla\c +\let\SaveUnderdot\d +\let\SaveArchJoin\t +\let\SaveLineUnder\b +\let\SaveCopyright\copyright +\let\SavePounds\pounds +\let\SaveLeftBrace\{ +\let\SaveRightBrace\} +\let\SaveUnderscore\_ +\let\SaveDagger\dag +\let\SaveDoubleDagger\ddag +\let\SaveSectionSymbol\S +\let\SavePilcrow\P +\let\SaveAEsc\AE +\let\Saveaesc\ae +\let\SaveOEthel\OE +\let\Saveoethel\oe +\let\SaveAngstrom\AA +\let\Saveangstrom\aa +\let\SaveSlashedO\O +\let\SaveSlashedo\o +\let\SaveBarredL\L +\let\SaveBarredl\l +\let\SaveEszett\ss +\let\SaveLB{ +\let\SaveRB} + +\def\EncodedBlankSpace{\SaveOEthel} +\edef\BlankSpace{ } + +\def\EscapeChar{|} + +\def\PipeCode{0} +\def\EncodedPipe{\EscapeChar\PipeCode} +\def\Pipe{|} +\let\|\EncodedPipe + +\def\DollarCode{1} +\def\EncodedDollar{\EscapeChar\DollarCode} +\def\Dollar{\symbol{36}} + +\def\CaratCode{2} +\def\EncodedCarat{\EscapeChar\CaratCode} +\def\Carat{\symbol{94}} +\let\carat\EncodedCarat + +\def\LeftBraceCode{4} +\def\EncodedLeftBrace{\EscapeChar\LeftBraceCode} +\def\LeftBrace{\symbol{123}} + +\def\RightBraceCode{5} +\def\EncodedRightBrace{\EscapeChar\RightBraceCode} +\def\RightBrace{\symbol{125}} + +\def\UnderscoreCode{6} +\def\EncodedUnderscore{\EscapeChar\UnderscoreCode} +\def\Underscore{\symbol{95}} + +\def\CircumflexCode{7} +\def\EncodedCircumflex{\EscapeChar\CircumflexCode} +\def\Circumflex{\noexpand\SaveCircumflex} + +\def\TildeCode{8} +\def\EncodedTilde{\EscapeChar\TildeCode} +\def\Tilde{\noexpand\SaveTilde} + +\def\UmlautCode{"} +\def\EncodedUmlaut{\EscapeChar\UmlautCode} +\def\Umlaut{\noexpand\SaveUmlaut} + +\def\GraveCode{`} +\def\EncodedGrave{\EscapeChar\GraveCode} +\def\Grave{\noexpand\SaveGrave} + +\def\AcuteCode{'} +\def\EncodedAcute{\EscapeChar\AcuteCode} +\def\Acute{\noexpand\SaveAcute} + +\def\MacronCode{=} +\def\EncodedMacron{\EscapeChar\MacronCode} +\def\Macron{\noexpand\SaveMacron} + +\def\OverdotCode{.} +\def\EncodedOverdot{\EscapeChar\OverdotCode} +\def\Overdot{\noexpand\SaveOverdot} + +\def\BreveCode{u} +\def\EncodedBreve{\EscapeChar\BreveCode} +\def\Breve{\noexpand\SaveBreve} + +\def\CaronCode{v} +\def\EncodedCaron{\EscapeChar\CaronCode} +\def\Caron{\noexpand\SaveCaron} + +\def\DoubleAcuteCode{H} +\def\EncodedDoubleAcute{\EscapeChar\DoubleAcuteCode} +\def\DoubleAcute{\noexpand\SaveDoubleAcute} + +\def\CedillaCode{c} +\def\EncodedCedilla{\EscapeChar\CedillaCode} +\def\Cedilla{\noexpand\SaveCedilla} + +\def\UnderdotCode{d} +\def\EncodedUnderdot{\EscapeChar\UnderdotCode} +\def\Underdot{.}% CANNOT \edef \d + +\def\ArchJoinCode{t} +\def\EncodedArchJoin{\EscapeChar\ArchJoinCode} +\def\ArchJoin{.}% CANNOT \edef \t + +\def\LineUnderCode{b} +\def\EncodedLineUnder{\EscapeChar\LineUnderCode} +\def\LineUnder{.}% CANNOT \edef \b + +\def\CopyrightCode{C} +\def\EncodedCopyright{\EscapeChar\CopyrightCode} +\def\Copyright{.}% CANNOT \edef \copyright + +\def\PoundsCode{p} +\def\EncodedPounds{\EscapeChar\PoundsCode} +\def\Pounds{\SavePounds} + +\def\LBCode{[} +\def\EncodedLB{\EscapeChar\LBCode} +\def\UnencodedLB{.} +\def\LB{\EncodedLB} + +\def\RBCode{]} +\def\EncodedRB{\EscapeChar\RBCode} +\def\UnencodedRB{.} +\def\RB{\EncodedRB} + +\def\DaggerCode{z} +\def\EncodedDagger{\EscapeChar\DaggerCode} +\def\Dagger{.}% CANNOT \edef \dag + +\def\DoubleDaggerCode{Z} +\def\EncodedDoubleDagger{\EscapeChar\DoubleDaggerCode} +\def\DoubleDagger{.}% CANNOT \edef \ddag + +\def\SectionSymbolCode{S} +\def\EncodedSectionSymbol{\EscapeChar\SectionSymbolCode} +\def\SectionSymbol{\SaveSectionSymbol} + +\def\PilcrowCode{P} +\def\EncodedPilcrow{\EscapeChar\PilcrowCode} +\def\Pilcrow{.}% CANNOT \edef \P + +\def\AEscCode{E} +\def\EncodedAEsc{\EscapeChar\AEscCode} +\def\AEsc{\SaveAEsc} + +\def\aescCode{e} +\def\Encodedaesc{\EscapeChar\aescCode} +\def\aesc{\Saveaesc} + +\def\OEthelCode{O} +\def\EncodedOEthel{\EscapeChar\OEthelCode} +\def\OEthel{\SaveOEthel} + +\def\oethelCode{o} +\def\Encodedoethel{\EscapeChar\oethelCode} +\def\oethel{\Saveoethel} + +\def\AngstromCode{A} +\def\EncodedAngstrom{\EscapeChar\AngstromCode} +\def\Angstrom{\SaveAngstrom} + +\def\angstromCode{a} +\def\Encodedangstrom{\EscapeChar\angstromCode} +\def\angstrom{\Saveangstrom} + +\def\SlashedOCode{Q} +\def\EncodedSlashedO{\EscapeChar\SlashedOCode} +\def\SlashedO{\SaveSlashedO} + +\def\SlashedoCode{q} +\def\EncodedSlashedo{\EscapeChar\SlashedoCode} +\def\Slashedo{\SaveSlashedo} + +\def\BarredLCode{L} +\def\EncodedBarredL{\EscapeChar\BarredLCode} +\def\BarredL{\SaveBarredL} + +\def\BarredlCode{l} +\def\EncodedBarredl{\EscapeChar\BarredlCode} +\def\Barredl{\SaveBarredl} + +\def\EszettCode{s} +\def\EncodedEszett{\EscapeChar\EszettCode} +\def\Eszett{\SaveEszett} + +\newcounter{@letterindex} +\newcounter{@@letterindex} +\newcounter{@@@letterindex} +\newcounter{@wordindex} +\newcounter{@iargc} +\newcounter{@gobblesize} +\newcounter{@maxrotation} +\newcounter{@stringsize} +\newcounter{@@stringsize} +\newcounter{@revisedstringsize} +\newcounter{@gobbleindex} +\newcounter{@charsfound} +\newcounter{@alph} +\newcounter{@alphaindex} +\newcounter{@capstrigger} +\newcounter{@fromindex} +\newcounter{@toindex} +\newcounter{@previousindex} +\newcounter{@flag} +\newcounter{@matchloc} +\newcounter{@matchend} +\newcounter{@matchsize} +\newcounter{@matchmax} +\newcounter{@skipped} +%%%%% CONFIGURATION COMMANDS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommand\defaultTreatments{% + \def\EncodingTreatment{v}% <--Set=v to decode special chars (vs. q,e) + \def\AlphaCapsTreatment{1}% <--Set=1 to retain uppercase (vs. 0,2) + \def\AlphaTreatment{1}% <--Set=1 to retain lowercase (vs. 0,2) + \def\PunctuationTreatment{1}% <--Set=1 to retain punctuation (vs. 0) + \def\NumeralTreatment{1}% <--Set=1 to retain numerals (vs. 0) + \def\SymbolTreatment{1}% <--Set=1 to retain special chars (vs. 0) + \def\BlankTreatment{1}% <--Set=1 to retain blanks (vs. 0) + \def\CapitalizeString{0}% <--Set=0 for no special action (vs. 1,2) + \def\SeekBlankSpace{0}% <--Set=0 for no special action (vs. 1,2) +} +\defaultTreatments + +\newcommand\Treatments[6]{% + \def\AlphaCapsTreatment{#1}% <--Set=0 to remove uppercase + \def\AlphaTreatment{#2}% <--Set=0 to remove lowercase + \def\PunctuationTreatment{#3}%<--Set=0 to remove punctuation + \def\NumeralTreatment{#4}% <--Set=0 to remove numerals + \def\SymbolTreatment{#5}% <--Set=0 to remove special chars + \def\BlankTreatment{#6}% <--Set=0 to remove blanks +} + +\newcommand\+{% + \def\${\EncodedDollar}% + \def~{\EncodedBlankSpace}% + \def\^{\EncodedCircumflex}% + \def\~{\EncodedTilde}% + \def\"{\EncodedUmlaut}% + \def\`{\EncodedGrave}% + \def\'{\EncodedAcute}% + \def\={\EncodedMacron}% + \def\.{\EncodedOverdot}% + \def\u{\EncodedBreve}% + \def\v{\EncodedCaron}% + \def\H{\EncodedDoubleAcute}% + \def\c{\EncodedCedilla}% + \def\d{\EncodedUnderdot}% + \def\t{\EncodedArchJoin}% + \def\b{\EncodedLineUnder}% + \def\copyright{\EncodedCopyright}% + \def\pounds{\EncodedPounds}% + \def\{{\EncodedLeftBrace}% + \def\}{\EncodedRightBrace}% + \def\_{\EncodedUnderscore}% + \def\dag{\EncodedDagger}% + \def\ddag{\EncodedDoubleDagger}% + \def\S{\EncodedSectionSymbol}% + \def\P{\EncodedPilcrow}% + \def\AE{\EncodedAEsc}% + \def\ae{\Encodedaesc}% + \def\OE{\EncodedOEthel}% + \def\oe{\Encodedoethel}% + \def\AA{\EncodedAngstrom}% + \def\aa{\Encodedangstrom}% + \def\O{\EncodedSlashedO}% + \def\o{\EncodedSlashedo}% + \def\L{\EncodedBarredL}% + \def\l{\EncodedBarredl}% + \def\ss{\EncodedEszett}% +} + +\newcommand\?{% + \let\$\SaveDollar% + \let~\SaveHardspace% + \let\^\SaveCircumflex% + \let\~\SaveTilde% + \let\"\SaveUmlaut% + \let\`\SaveGrave% + \let\'\SaveAcute% + \let\=\SaveMacron% + \let\.\SaveOverdot% + \let\u\SaveBreve% + \let\v\SaveCaron% + \let\H\SaveDoubleAcute% + \let\c\SaveCedilla% + \let\d\SaveUnderdot% + \let\t\SaveArchJoin% + \let\b\SaveLineUnder% + \let\copyright\SaveCopyright% + \let\pounds\SavePounds% + \let\{\SaveLeftBrace% + \let\}\SaveRightBrace% + \let\_\SaveUnderscore% + \let\dag\SaveDagger% + \let\ddag\SaveDoubleDagger% + \let\S\SaveSectionSymbol% + \let\P\SavePilcrow% + \let\AE\SaveAEsc% + \let\ae\Saveaesc% + \let\OE\SaveOEthel% + \let\oe\Saveoethel% + \let\AA\SaveAngstrom% + \let\aa\Saveangstrom% + \let\O\SaveSlashedO% + \let\o\SaveSlashedo% + \let\L\SaveBarredL% + \let\l\SaveBarredl% + \let\ss\SaveEszett% +} + +%%%%% COMMANDS TO MANIPULATE STRINGS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommand\substring[4][v]{\+% + \@getstringlength{#2}{@stringsize}% + \@decodepointer{#3}% + \setcounter{@fromindex}{\fromtoindex}% + \@decodepointer{#4}% + \setcounter{@toindex}{\fromtoindex}% + \setcounter{@gobblesize}{\value{@stringsize}}% + \ifthenelse{\value{@toindex} > \value{@stringsize}}% + {\setcounter{@maxrotation}{\value{@stringsize}}}% + {\setcounter{@maxrotation}{\value{@toindex}}}% + \addtocounter{@gobblesize}{-\value{@maxrotation}}% + \addtocounter{@gobblesize}{\value{@fromindex}}% + \addtocounter{@gobblesize}{-1}% + \setcounter{@letterindex}{0}% + \edef\rotatingword{#2}% + \def\EncodingTreatment{#1}% + \if 0\CapitalizeString% + \setcounter{@capstrigger}{0}% + \else + \let\SaveAlphaTreatment\AlphaTreatment% + \let\SaveAlphaCapsTreatment\AlphaCapsTreatment% + \setcounter{@capstrigger}{1}% + \@forcecapson% + \fi +\@defineactions% + \whiledo{\value{@letterindex} < \value{@maxrotation}}{% + \addtocounter{@letterindex}{1}% + \if 2\CapitalizeString% + \isnextbyte[q]{\EncodedBlankSpace}{\rotatingword}% + \if F\theresult\isnextbyte[q]{\BlankSpace}{\rotatingword}\fi% + \if T\theresult% + \if 0\arabic{@capstrigger}% + \@forcecapson% + \@defineactions% + \fi + \setcounter{@capstrigger}{2}% + \fi + \fi + \isnextbyte[q]{\EscapeChar}{\rotatingword}% + \ifthenelse{\value{@letterindex} < \value{@fromindex}}% + {% + \if T\theresult% + \edef\rotatingword{\rotate{\rotatingword}}% + \addtocounter{@letterindex}{-1}% + \else + \edef\rotatingword{\rotate{\rotatingword}}% + \fi + }% + {% + \if T\theresult% + \edef\rotatingword{\ESCrotate{\expandafter\@gobble\rotatingword}}% + \else + \edef\rotatingword{\rotate{\rotatingword}}% + \fi + }% + \if 0\arabic{@capstrigger}% + \else + \addtocounter{@capstrigger}{-1}% + \if 0\arabic{@capstrigger}\@relaxcapson\fi + \fi + \if 0\SeekBlankSpace\else + \isnextbyte[q]{\EncodedBlankSpace}{\rotatingword}% + \if F\theresult\isnextbyte[q]{\BlankSpace}{\rotatingword}\fi% + \if T\theresult% + \if 1\SeekBlankSpace% + \setcounter{@maxrotation}{\value{@letterindex}}% + \else + \addtocounter{@gobblesize}{\value{@maxrotation}}% + \setcounter{@maxrotation}{\value{@letterindex}}% + \addtocounter{@gobblesize}{-\value{@maxrotation}}% + \fi + \fi + \fi + }% + \@gobblearg{\rotatingword}{\arabic{@gobblesize}}% + \edef\thestring{\gobbledword}% + \if v#1\thestring\fi% +\?} + +\newcommand\caseupper[2][v]{% + \Treatments{1}{2}{1}{1}{1}{1}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \defaultTreatments% +} + +\newcommand\caselower[2][v]{% + \Treatments{2}{1}{1}{1}{1}{1}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \defaultTreatments% +} + +\newcommand\solelyuppercase[2][v]{% + \Treatments{1}{2}{0}{0}{0}{1}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \defaultTreatments% +} + +\newcommand\solelylowercase[2][v]{% + \Treatments{2}{1}{0}{0}{0}{1}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \defaultTreatments% +} + +\newcommand\changecase[2][v]{% + \Treatments{2}{2}{1}{1}{1}{1}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \defaultTreatments% +} + +\newcommand\noblanks[2][v]{% + \Treatments{1}{1}{1}{1}{1}{0}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \defaultTreatments% +} + +\newcommand\nosymbolsnumerals[2][v]{% + \Treatments{1}{1}{1}{0}{0}{1}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \defaultTreatments% +} + +\newcommand\alphabetic[2][v]{% + \Treatments{1}{1}{0}{0}{0}{1}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \defaultTreatments% +} + +\newcommand\capitalize[2][v]{% + \defaultTreatments% + \def\CapitalizeString{1}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \def\CapitalizeString{0}% +} + +\newcommand\capitalizewords[2][v]{% + \defaultTreatments% + \def\CapitalizeString{2}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \def\CapitalizeString{0}% +} + +\newcommand\reversestring[2][v]{% + \def\@reversedstring{}% + \+\@getstringlength{#2}{@@stringsize}\?% + \setcounter{@@@letterindex}{\the@@stringsize}% + \whiledo{\the@@@letterindex > 0}{% + \if e#1% + \substring[e]{#2}{\the@@@letterindex}{\the@@@letterindex}% + \else + \substring[q]{#2}{\the@@@letterindex}{\the@@@letterindex}% + \fi + \edef\@reversedstring{\@reversedstring\thestring}% + \addtocounter{@@@letterindex}{-1}% + }% + \edef\thestring{\@reversedstring}% + \if v#1\thestring\fi% +} + +\newcommand\convertchar[4][v]{% + \+% + \edef\encodedstring{#2} + \edef\encodedfromarg{#3}% + \edef\encodedtoarg{#4}% + \?% + \isnextbyte[q]{\EscapeChar}{\encodedfromarg} + \if F\theresult% + \@convertbytetostring[#1]{\encodedstring}{#3}{\encodedtoarg}% + \else + \@convertsymboltostring[#1]{\encodedstring}% + {\expandafter\@gobble\encodedfromarg}{\encodedtoarg}% + \fi +} + + +\newcommand\rotateword[2][v]{% + \+\edef\thestring{#2}\?% + \@treatleadingspaces[e]{\thestring}{}% + \def\SeekBlankSpace{1}% + \Treatments{1}{1}{1}{1}{1}{1}% + \substring[e]{\thestring}{1}{\@MAXSTRINGSIZE}% + \@treatleadingspaces[#1]{\thestring}{}% + \defaultTreatments% +} + +\newcommand\removeword[2][v]{% + \+\edef\thestring{#2}\?% + \@treatleadingspaces[e]{\thestring}{x}% + \def\SeekBlankSpace{1}% + \Treatments{0}{0}{0}{0}{0}{0}% + \substring[e]{\thestring}{1}{\@MAXSTRINGSIZE}% + \@treatleadingspaces[#1]{\thestring}{x}% + \defaultTreatments% +} + +\newcommand\getnextword[2][v]{% + \getaword[#1]{#2}{1}% +} + +\newcommand\getaword[3][v]{% + \setcounter{@wordindex}{1}% + \+\edef\thestring{#2}\?% + \@treatleadingspaces[e]{\thestring}{}% + \whiledo{\value{@wordindex} < #3}{% + \rotateword[e]{\thestring}% + \addtocounter{@wordindex}{1}% + }% + \@getnextword[#1]{\thestring}% +} +\newcommand\rotateleadingspaces[2][v]{% + \@treatleadingspaces[#1]{#2}{}% +} + +\newcommand\removeleadingspaces[2][v]{% + \@treatleadingspaces[#1]{#2}{x}% +} + +\newcommand\stringencode[2][e]{% + \defaultTreatments% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% +} + +\newcommand\stringdecode[2][v]{% + \defaultTreatments% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% +} + +\newcommand\gobblechar[2][q]{\+% + \@gobblearg{#2}{1}% + \?\retokenize[#1]{\gobbledword}% +} + +\newcommand\gobblechars[3][q]{\+% + \@gobblearg{#2}{#3}% + \?\retokenize[#1]{\gobbledword}% +} + +\newcommand\retokenize[2][q]{\+% + \edef\@svstring{#2}% + \edef\buildtoken{}% + \@getstringlength{#2}{@@stringsize}\?% + \setcounter{@@letterindex}{0}% + \whiledo{\the@@letterindex < \the@@stringsize}{% + \setcounter{@previousindex}{\the@@letterindex}% + \addtocounter{@@letterindex}{1}% + \substring[e]{\@svstring}{\the@@letterindex}{\the@@letterindex}% + \@retokenizechar{\thestring}{\roman{@@letterindex}nexttoken}% + \expandafter\def\csname buildtoken\roman{@@letterindex}% + \expandafter\endcsname\expandafter% + {\csname buildtoken\roman{@previousindex}\expandafter\endcsname% + \csname\roman{@@letterindex}nexttoken\endcsname}% + }% + \expandafter\def\expandafter\buildtokenq\expandafter{% + \csname buildtoken\roman{@@letterindex}\endcsname}% + \def\thestring{\buildtokenq}% + \if v#1\thestring\fi +} + + +\newcommand\stringlength[2][v]{\+% + \@getstringlength{#2}{@@stringsize}% + \edef\theresult{\arabic{@@stringsize}}% + \if v#1\theresult\fi% +\?} + +\newcommand\findchars[3][v]{\+% + \@getstringlength{#2}{@@stringsize}% + \setcounter{@charsfound}{0}% + \setcounter{@@letterindex}{0}% + \whiledo{\value{@@letterindex} < \value{@@stringsize}}{% + \addtocounter{@@letterindex}{1}% + \testmatchingchar{#2}{\arabic{@@letterindex}}{#3}% + \ifmatchingchar\addtocounter{@charsfound}{1}\fi + }% + \edef\theresult{\arabic{@charsfound}}% + \if q#1\else\theresult\fi% +\?} + +\newcommand\whereischar[3][v]{\+% + \@getstringlength{#2}{@@stringsize}% + \edef\@theresult{0}% + \setcounter{@@letterindex}{0}% + \whiledo{\value{@@letterindex} < \value{@@stringsize}}{% + \addtocounter{@@letterindex}{1}% + \testmatchingchar{#2}{\arabic{@@letterindex}}{#3}% + \ifmatchingchar% + \edef\@theresult{\the@@letterindex}% + \setcounter{@@letterindex}{\the@@stringsize}% + \fi + }% + \edef\theresult{\@theresult}% + \if q#1\else\theresult\fi% +\?} + +\newcommand\whereisword[3][v]{\+% + \setcounter{@skipped}{0}% + \edef\@@@@teststring{#2}% + \edef\@matchstring{#3}% + \@getstringlength{#2}{@@stringsize}% + \@getstringlength{#3}{@matchsize}% + \setcounter{@matchmax}{\the@@stringsize}% + \addtocounter{@matchmax}{-\the@matchsize}% + \addtocounter{@matchmax}{1}% + \setcounter{@flag}{0}% + \substring[e]{#3}{1}{1}% + \edef\matchchar{\thestring}% + \whiledo{\the@flag = 0}{% + \whereischar[q]{\@@@@teststring}{\matchchar}% + \setcounter{@matchloc}{\theresult}% + \ifthenelse{\equal{0}{\value{@matchloc}}}% + {% + \setcounter{@flag}{1}% + }% + {% + \setcounter{@matchend}{\theresult}% + \addtocounter{@matchend}{\value{@matchsize}}% + \addtocounter{@matchend}{-1}% + \substring[e]{\@@@@teststring}{\the@matchloc}{\the@matchend}% + \ifthenelse{\equal{\thestring}{\@matchstring}}% + {% + \setcounter{@flag}{1}% + \addtocounter{@matchloc}{\the@skipped}% + \edef\theresult{\the@matchloc}% + }% + {% + \addtocounter{@skipped}{\the@matchloc}% + \addtocounter{@matchloc}{1}% + \ifthenelse{\value{@matchloc} > \value{@matchmax}}% + {% + \setcounter{@flag}{1}% + \edef\theresult{0}% + }% + {% + \substring[e]{\@@@@teststring}{\the@matchloc}{\@MAXSTRINGSIZE}% + \edef\@@@@teststring{\thestring}% + }% + }% + }% + }% + \if q#1\else\theresult\fi% +\?} + +\newcommand\findwords[3][v]{% + \+\edef\@@teststring{#2}\?% + \edef\@@@teststring{\@@teststring}% + \setcounter{@charsfound}{0}% + \whiledo{\the@charsfound > -1}{% + \whereisword[q]{\@@teststring}{#3}% + \setcounter{@matchloc}{\theresult}% + \ifthenelse{\the@matchloc = 0}% + {% + \edef\theresult{\the@charsfound}% + \setcounter{@charsfound}{-1}% + }% + {% + \addtocounter{@charsfound}{1}% + \addtocounter{@matchloc}{\the@matchsize}% + \ifthenelse{\the@matchloc > \the@@stringsize}% + {% + \edef\theresult{\the@charsfound}% + \setcounter{@charsfound}{-1}% + }% + {% + \substring[e]{\@@@teststring}{\the@matchloc}{\@MAXSTRINGSIZE}% + \edef\@@teststring{\thestring}% + \edef\@@@teststring{\@@teststring}% + }% + }% + }% + \if q#1\else\theresult\fi% +} + +\newcounter{@@matchloc} +\newcommand\convertword[4][v]{% + \+\edef\@@teststring{#2}% + \edef\@fromstring{#3}% + \edef\@tostring{#4}\?% + \edef\@@@teststring{\@@teststring}% + \def\@buildfront{}% + \edef\@buildstring{\@@teststring}% + \setcounter{@charsfound}{0}% + \whiledo{\the@charsfound > -1}{% +\whereisword[q]{\@@teststring}{\@fromstring}% + \setcounter{@matchloc}{\theresult}% + \ifthenelse{\the@matchloc = 0}% + {% + \setcounter{@charsfound}{-1}% + }% + {% + \addtocounter{@charsfound}{1}% + \addtocounter{@matchloc}{-1}% + \substring[e]{\@@@teststring}{1}{\the@matchloc}% + \edef\@buildfront{\@buildfront\thestring}% + \addtocounter{@matchloc}{1}% + \addtocounter{@matchloc}{\the@matchsize}% + \ifthenelse{\the@matchloc > \the@@stringsize}% + {% + \setcounter{@charsfound}{-1}% + \edef\@buildstring{\@buildfront\@tostring}% + }% + {% + \substring[e]{\@@@teststring}{\the@matchloc}{\@MAXSTRINGSIZE}% + \edef\@@teststring{\thestring}% + \edef\@@@teststring{\@@teststring}% + \edef\@buildstring{\@buildfront\@tostring\@@@teststring}% + \edef\@buildfront{\@buildfront\@tostring}% + }% + }% + }% + \substring[#1]{\@buildstring}{1}{\@MAXSTRINGSIZE}% +} + +\newcommand\wordcount[2][v]{\+% + \edef\@argv{#2} + \@getstringlength{\@argv}{@stringsize} + \setcounter{@iargc}{0} + \whiledo{\value{@stringsize} > 0}{% + \addtocounter{@iargc}{1}% + \removeword[e]{\@argv}% + \edef\@argv{\thestring}% + \@getstringlength{\@argv}{@stringsize}% + } + \edef\theresult{\arabic{@iargc}}% + \if v#1\theresult\fi% +\?} + +\newcommand\getargs[2][q]{\+% + \if v#1\def\@mode{q}\else\def\@mode{#1}\fi + \edef\@argv{#2}% + \@getstringlength{\@argv}{@stringsize}% + \setcounter{@iargc}{0}% + \whiledo{\value{@stringsize} > 0}{% + \addtocounter{@iargc}{1}% + \getaword[\@mode]{\@argv}{1}% + \expandafter\edef\csname arg\roman{@iargc}\endcsname{\thestring}% + \removeword[e]{\@argv}% + \edef\@argv{\thestring}% + \@getstringlength{\@argv}{@stringsize}% + } + \edef\narg{\arabic{@iargc}}% +\?} + +%%%%% COMMANDS TO TEST STRINGS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\PrimarySignalChar{@} +\def\SecondarySignalChar{`} + +\newcommand\isnextbyte[3][v]{% + \let\SignalChar\PrimarySignalChar% + \edef\@x{\if #2#3\else\SignalChar\fi}% + \edef\@x{\if \SignalChar\@x F\else T\fi}% + \let\SignalChar\SecondarySignalChar% + \edef\@y{\if #2#3\else\SignalChar\fi}% + \edef\@y{\if \SignalChar\@y F\else T\fi}% + \ifthenelse{\equal{\@x\@y}{\@y\@x}} + {\edef\theresult{\@x}}% + {\edef\theresult{T}}% + \if q#1\else\theresult\fi +} + +\newif\ifmatchingchar +\newcommand\testmatchingchar[3]{% + \substring[e]{#1}{#2}{#2}\+% + \isnextbyte[q]{\EscapeChar}{#3}% + \if T\theresult% + \isnextbyte[q]{\EscapeChar}{\thestring}% + \if T\theresult% + \edef\@testcode{\expandafter\@DiscardNextChar\expandafter{#3}}% + \edef\@teststring{\@DiscardNextChar{\thestring}}% + \if \@teststring\@testcode\matchingchartrue\else\matchingcharfalse\fi + \else + \matchingcharfalse% + \fi + \else + \if \thestring#3\matchingchartrue\else\matchingcharfalse\fi + \fi +\?} + +\newif\ifcapitalized +\newcommand\testcapitalized[1]{\+% + \isnextbyte[q]{\EscapeChar}{#1}% + \if T\theresult% + \def\EncodingTreatment{e}% + \edef\rotatingword{#1}% + \def\AlphaCapsTreatment{2}% + \@defineactions% + \edef\@stringA{\ESCrotate{\expandafter\@gobble\rotatingword}}% + \def\AlphaCapsTreatment{1}% + \@defineactions% + \edef\@stringB{\ESCrotate{\expandafter\@gobble\rotatingword}}% + \else + \def\AlphaCapsTreatment{2}% + \edef\@stringA{\rotate{#1}}% + \def\AlphaCapsTreatment{1}% + \edef\@stringB{\rotate{#1}}% + \fi + \ifthenelse{\equal{\@stringA}{\@stringB}}% + {\capitalizedfalse}{\capitalizedtrue}\?% + \defaultTreatments% +} + +\newif\ifuncapitalized +\newcommand\testuncapitalized[1]{\+% + \isnextbyte[q]{\EscapeChar}{#1}% + \if T\theresult% + \def\EncodingTreatment{e}% + \edef\rotatingword{#1}% + \def\AlphaTreatment{2}% + \@defineactions% + \edef\@stringA{\ESCrotate{\expandafter\@gobble\rotatingword}}% + \def\AlphaTreatment{1}% + \@defineactions% + \edef\@stringB{\ESCrotate{\expandafter\@gobble\rotatingword}}% + \else + \def\AlphaTreatment{2}% + \edef\@stringA{\rotate{#1}}% + \def\AlphaTreatment{1}% + \edef\@stringB{\rotate{#1}}% + \fi + \ifthenelse{\equal{\@stringA}{\@stringB}}% + {\uncapitalizedfalse}{\uncapitalizedtrue}\?% + \defaultTreatments% +} + +\newif\ifleadingalpha +\newcommand\testleadingalpha[1]{% + \testcapitalized{#1}% + \ifcapitalized + \leadingalphatrue% + \else + \testuncapitalized{#1}% + \ifuncapitalized + \leadingalphatrue% + \else + \leadingalphafalse% + \fi + \fi +} + +\newif\ifuppercase +\newcommand\testuppercase[1]{% + \Treatments{1}{1}{0}{0}{0}{0}% + \substring[e]{#1}{1}{\@MAXSTRINGSIZE}% + \edef\@stringA{\thestring}% + \def\AlphaTreatment{2}% + \substring[e]{#1}{1}{\@MAXSTRINGSIZE}% + \edef\@stringB{\thestring}% + \ifthenelse{\equal{\@stringA}{\@stringB}}% + {% + \@getstringlength{\@stringA}{@stringsize}% + \ifthenelse{\value{@stringsize} = 0}% + {\uppercasefalse}{\uppercasetrue}% + }% + {\uppercasefalse}% + \defaultTreatments% +} + +\newif\ifsolelyuppercase +\newcommand\testsolelyuppercase[1]{% + \stringencode{#1}% + \edef\@stringA{\thestring}% + \solelyuppercase[e]{#1}% + \edef\@stringB{\thestring}% + \ifthenelse{\equal{\@stringA}{\@stringB}}% + {% + \noblanks[q]{\@stringA}% + \@getstringlength{\thestring}{@stringsize}% + \ifthenelse{\value{@stringsize} = 0}% + {\solelyuppercasefalse}{\solelyuppercasetrue}% + }% + {\solelyuppercasefalse}% + \defaultTreatments% +} + +\newif\iflowercase +\newcommand\testlowercase[1]{% + \Treatments{1}{1}{0}{0}{0}{0}% + \substring[e]{#1}{1}{\@MAXSTRINGSIZE}% + \edef\@stringA{\thestring}% + \def\AlphaCapsTreatment{2}% + \substring[e]{#1}{1}{\@MAXSTRINGSIZE}% + \edef\@stringB{\thestring}% + \ifthenelse{\equal{\@stringA}{\@stringB}}% + {% + \@getstringlength{\@stringA}{@stringsize}% + \ifthenelse{\value{@stringsize} = 0}% + {\lowercasefalse}{\lowercasetrue}% + }% + {\lowercasefalse}% + \defaultTreatments% +} + +\newif\ifsolelylowercase +\newcommand\testsolelylowercase[1]{% + \stringencode{#1}% + \edef\@stringA{\thestring}% + \solelylowercase[e]{#1}% + \edef\@stringB{\thestring}% + \ifthenelse{\equal{\@stringA}{\@stringB}}% + {% + \noblanks[q]{\@stringA}% + \@getstringlength{\thestring}{@stringsize}% + \ifthenelse{\value{@stringsize} = 0}% + {\solelylowercasefalse}{\solelylowercasetrue}% + }% + {\solelylowercasefalse}% + \defaultTreatments% +} + +\newif\ifalphabetic +\newcommand\testalphabetic[1]{% + \stringencode{#1}% + \edef\@stringA{\thestring}% + \alphabetic[e]{#1}% + \edef\@stringB{\thestring}% + \ifthenelse{\equal{\@stringA}{\@stringB}}% + {% + \noblanks[q]{\@stringA}% + \@getstringlength{\thestring}{@stringsize}% + \ifthenelse{\value{@stringsize} = 0}% + {\alphabeticfalse}{\alphabetictrue}% + }% + {\alphabeticfalse}% + \defaultTreatments% +} + +%%%%% SUPPORT ROUTINES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand\rotate[1]{\@rotate{#1}} + +\newcommand\ESCrotate[1]{% + \if\@fromcode#1\@tostring\else + \if\PipeCode#1\@pipeaction\else + \if\DollarCode#1\@dollaraction\else + \if\CaratCode#1\@carataction\else + \if\CircumflexCode#1\@circumflexaction\else + \if\TildeCode#1\@tildeaction\else + \if\UmlautCode#1\@umlautaction\else + \if\GraveCode#1\@graveaction\else + \if\AcuteCode#1\@acuteaction\else + \if\MacronCode#1\@macronaction\else + \if\OverdotCode#1\@overdotaction\else + \if\LeftBraceCode#1\@leftbraceaction\else + \if\RightBraceCode#1\@rightbraceaction\else + \if\UnderscoreCode#1\@underscoreaction\else + \if\DaggerCode#1\@daggeraction\else + \if\DoubleDaggerCode#1\@doubledaggeraction\else + \if\SectionSymbolCode#1\@sectionsymbolaction\else + \if\PilcrowCode#1\@pilcrowaction\else + \if\LBCode#1\@lbaction\else + \if\RBCode#1\@rbaction\else + \if\BreveCode#1\@breveaction\else + \if\CaronCode#1\@caronaction\else + \if\DoubleAcuteCode#1\@doubleacuteaction\else + \if\CedillaCode#1\@cedillaaction\else + \if\UnderdotCode#1\@underdotaction\else + \if\ArchJoinCode#1\@archjoinaction\else + \if\LineUnderCode#1\@lineunderaction\else + \if\CopyrightCode#1\@copyrightaction\else + \if\PoundsCode#1\@poundsaction\else + \if\AEscCode#1\@AEscaction\else + \if\aescCode#1\@aescaction\else + \if\OEthelCode#1\@OEthelaction\else + \if\oethelCode#1\@oethelaction\else + \if\AngstromCode#1\@Angstromaction\else + \if\angstromCode#1\@angstromaction\else + \if\SlashedOCode#1\@slashedOaction\else + \if\SlashedoCode#1\@slashedoaction\else + \if\BarredlCode#1\@barredlaction\else + \if\BarredLCode#1\@barredLaction\else + \if\EszettCode#1\@eszettaction\else + \expandafter\@gobble#1\undecipherable% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@getnextword[2][v]{% + \defaultTreatments% + \def\SeekBlankSpace{2}% + \substring[#1]{#2}{1}{\@MAXSTRINGSIZE}% + \def\SeekBlankSpace{0}% +} + +\newcommand\@retokenizechar[2]{% + \isnextbyte[q]{\EscapeChar}{#1}% + \if T\theresult% + \edef\@ESCcode{\expandafter\@gobble#1}% + \if\PipeCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\Pipe}\else + \if\DollarCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\$}\else + \if\CaratCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\Carat}\else + \if\CircumflexCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\^}\else + \if\TildeCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\~}\else + \if\UmlautCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\"}\else + \if\GraveCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\`}\else + \if\AcuteCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\'}\else + \if\MacronCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\=}\else + \if\OverdotCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\.}\else + \if\LeftBraceCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\{}\else + \if\RightBraceCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\}}\else + \if\UnderscoreCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\_}\else + \if\DaggerCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\dag}\else + \if\DoubleDaggerCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\ddag}\else + \if\SectionSymbolCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\S}\else + \if\PilcrowCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\P}\else + \if\LBCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\SaveLB}\else + \if\RBCode\@ESCcode% + \expandafter\def\csname#2\endcsname{\SaveRB}\else + \if\BreveCode\@ESCcode\expandafter\def\csname#2\endcsname{\u}\else + \if\CaronCode\@ESCcode\expandafter\def\csname#2\endcsname{\v}\else + \if\DoubleAcuteCode\@ESCcode\expandafter\def\csname#2\endcsname{\H}\else + \if\CedillaCode\@ESCcode\expandafter\def\csname#2\endcsname{\c}\else + \if\UnderdotCode\@ESCcode\expandafter\def\csname#2\endcsname{\d}\else + \if\ArchJoinCode\@ESCcode\expandafter\def\csname#2\endcsname{\t}\else + \if\LineUnderCode\@ESCcode\expandafter\def\csname#2\endcsname{\b}\else + \if\CopyrightCode\@ESCcode\expandafter\def\csname#2\endcsname{\copyright}\else + \if\PoundsCode\@ESCcode\expandafter\def\csname#2\endcsname{\pounds}\else + \if\AEscCode\@ESCcode\expandafter\def\csname#2\endcsname{\AE}\else + \if\aescCode\@ESCcode\expandafter\def\csname#2\endcsname{\ae}\else + \if\OEthelCode\@ESCcode\expandafter\def\csname#2\endcsname{\OE}\else + \if\oethelCode\@ESCcode\expandafter\def\csname#2\endcsname{\oe}\else + \if\AngstromCode\@ESCcode\expandafter\def\csname#2\endcsname{\AA}\else + \if\angstromCode\@ESCcode\expandafter\def\csname#2\endcsname{\aa}\else + \if\SlashedOCode\@ESCcode\expandafter\def\csname#2\endcsname{\O}\else + \if\SlashedoCode\@ESCcode\expandafter\def\csname#2\endcsname{\o}\else + \if\BarredlCode\@ESCcode\expandafter\def\csname#2\endcsname{\l}\else + \if\BarredLCode\@ESCcode\expandafter\def\csname#2\endcsname{\L}\else + \if\EszettCode\@ESCcode\expandafter\def\csname#2\endcsname{\ss}\else + \expandafter\def\csname#2\endcsname{\undecipherable}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \else + \expandafter\ifx\expandafter\% + \expandafter\def\csname#2\endcsname{\&}\else + \expandafter\ifx\expandafter\%#1% + \expandafter\def\csname#2\endcsname{\%}\else + \expandafter\ifx\expandafter\##1% + \expandafter\def\csname#2\endcsname{\#}\else + \if\EncodedBlankSpace#1\expandafter\def\csname#2\endcsname{~}\else + \expandafter\edef\csname#2\endcsname{#1}% + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@defineactions{% + \if e\EncodingTreatment% + \edef\@blankaction{\EncodedBlankSpace}% + \def\@dollaraction{\EncodedDollar}% + \def\@pipeaction{\EncodedPipe}% + \def\@carataction{\EncodedCarat}% + \def\@circumflexaction{\EncodedCircumflex}% + \def\@tildeaction{\EncodedTilde}% + \def\@umlautaction{\EncodedUmlaut}% + \def\@graveaction{\EncodedGrave}% + \def\@acuteaction{\EncodedAcute}% + \def\@macronaction{\EncodedMacron}% + \def\@overdotaction{\EncodedOverdot}% + \def\@breveaction{\EncodedBreve}% + \def\@caronaction{\EncodedCaron}% + \def\@doubleacuteaction{\EncodedDoubleAcute}% + \def\@cedillaaction{\EncodedCedilla}% + \def\@underdotaction{\EncodedUnderdot}% + \def\@archjoinaction{\EncodedArchJoin}% + \def\@lineunderaction{\EncodedLineUnder}% + \def\@copyrightaction{\EncodedCopyright}% + \def\@poundsaction{\EncodedPounds}% + \def\@leftbraceaction{\EncodedLeftBrace}% + \def\@rightbraceaction{\EncodedRightBrace}% + \def\@underscoreaction{\EncodedUnderscore}% + \def\@daggeraction{\EncodedDagger}% + \def\@doubledaggeraction{\EncodedDoubleDagger}% + \def\@sectionsymbolaction{\EncodedSectionSymbol}% + \def\@pilcrowaction{\EncodedPilcrow}% + \def\@eszettaction{\EncodedEszett}% + \def\@lbaction{\EncodedLB}% + \def\@rbaction{\EncodedRB}% + \if 2\AlphaCapsTreatment% + \def\@AEscaction{\Encodedaesc}% + \def\@OEthelaction{\Encodedoethel}% + \def\@Angstromaction{\Encodedangstrom}% + \def\@slashedOaction{\EncodedSlashedo}% + \def\@barredLaction{\EncodedBarredl}% + \else + \def\@AEscaction{\EncodedAEsc}% + \def\@OEthelaction{\EncodedOEthel}% + \def\@Angstromaction{\EncodedAngstrom}% + \def\@slashedOaction{\EncodedSlashedO}% + \def\@barredLaction{\EncodedBarredL}% + \fi + \if 2\AlphaTreatment% + \def\@aescaction{\EncodedAEsc}% + \def\@oethelaction{\EncodedOEthel}% + \def\@angstromaction{\EncodedAngstrom}% + \def\@slashedoaction{\EncodedSlashedO}% + \def\@barredlaction{\EncodedBarredL}% + \else + \def\@aescaction{\Encodedaesc}% + \def\@oethelaction{\Encodedoethel}% + \def\@angstromaction{\Encodedangstrom}% + \def\@slashedoaction{\EncodedSlashedo}% + \def\@barredlaction{\EncodedBarredl}% + \fi + \else + \def\@blankaction{\BlankSpace}% + \def\@dollaraction{\Dollar}% + \def\@pipeaction{\Pipe}% + \def\@carataction{\Carat}% + \def\@circumflexaction{\Circumflex}% + \def\@tildeaction{\Tilde}% + \def\@umlautaction{\Umlaut}% + \def\@graveaction{\Grave}% + \def\@acuteaction{\Acute}% + \def\@macronaction{\Macron}% + \def\@overdotaction{\Overdot}% + \def\@breveaction{\Breve}% + \def\@caronaction{\Caron}% + \def\@doubleacuteaction{\DoubleAcute}% + \def\@cedillaaction{\Cedilla}% + \def\@underdotaction{\Underdot}% + \def\@archjoinaction{\ArchJoin}% + \def\@lineunderaction{\LineUnder}% + \def\@copyrightaction{\Copyright}% + \def\@poundsaction{\Pounds}% + \def\@leftbraceaction{\LeftBrace}% + \def\@rightbraceaction{\RightBrace}% + \def\@underscoreaction{\Underscore}% + \def\@daggeraction{\Dagger}% + \def\@doubledaggeraction{\DoubleDagger}% + \def\@sectionsymbolaction{\SectionSymbol}% + \def\@pilcrowaction{\Pilcrow}% + \def\@eszettaction{\Eszett}% + \def\@lbaction{\UnencodedLB}% + \def\@rbaction{\UnencodedRB}% + \if 2\AlphaCapsTreatment% + \def\@AEscaction{\aesc}% + \def\@OEthelaction{\oethel}% + \def\@Angstromaction{\angstrom}% + \def\@slashedOaction{\Slashedo}% + \def\@barredLaction{\Barredl}% + \else + \def\@AEscaction{\AEsc}% + \def\@OEthelaction{\OEthel}% + \def\@Angstromaction{\Angstrom}% + \def\@slashedOaction{\SlashedO}% + \def\@barredLaction{\BarredL}% + \fi + \if 2\AlphaTreatment% + \def\@aescaction{\AEsc}% + \def\@oethelaction{\OEthel}% + \def\@angstromaction{\Angstrom}% + \def\@slashedoaction{\SlashedO}% + \def\@barredlaction{\BarredL}% + \else + \def\@aescaction{\aesc}% + \def\@oethelaction{\oethel}% + \def\@angstromaction{\angstrom}% + \def\@slashedoaction{\Slashedo}% + \def\@barredlaction{\Barredl}% + \fi + \fi + \if 0\BlankTreatment% + \edef\@blankaction{}% + \fi + \if 0\SymbolTreatment% + \def\@dollaraction{}% + \def\@pipeaction{}% + \def\@carataction{}% + \def\@circumflexaction{}% + \def\@tildeaction{}% + \def\@umlautaction{}% + \def\@graveaction{}% + \def\@acuteaction{}% + \def\@macronaction{}% + \def\@overdotaction{}% + \def\@breveaction{}% + \def\@caronaction{}% + \def\@doubleacuteaction{}% + \def\@cedillaaction{}% + \def\@underdotaction{}% + \def\@archjoinaction{}% + \def\@lineunderaction{}% + \def\@copyrightaction{}% + \def\@poundsaction{}% + \def\@leftbraceaction{}% + \def\@rightbraceaction{}% + \def\@underscoreaction{}% + \def\@daggeraction{}% + \def\@doubledaggeraction{}% + \def\@sectionsymbolaction{}% + \def\@pilcrowaction{}% + \def\@lbaction{}% + \def\@rbaction{}% + \fi + \if 0\AlphaCapsTreatment% + \def\@AEscaction{}% + \def\@OEthelaction{}% + \def\@Angstromaction{}% + \def\@slashedOaction{}% + \def\@barredLaction{}% + \fi + \if 0\AlphaTreatment% + \def\@aescaction{}% + \def\@oethelaction{}% + \def\@angstromaction{}% + \def\@slashedoaction{}% + \def\@barredlaction{}% + \def\@eszettaction{}% + \fi +} + +\newcommand\@forcecapson{% + \def\AlphaTreatment{2}% + \def\AlphaCapsTreatment{1}% +} + +\newcommand\@relaxcapson{% + \let\AlphaTreatment\SaveAlphaTreatment% + \let\AlphaCapsTreatment\SaveAlphaCapsTreatment% + \@defineactions% +} + +\newcommand\@decodepointer[2][\value{@stringsize}]{% + \isnextbyte[q]{$}{#2}% + \if T\theresult% + \isnextbyte[q]{-}{\expandafter\@gobble#2}% + \if T\theresult% + \setcounter{@@@letterindex}{#1}% + \@gobblearg{#2}{2}% + \addtocounter{@@@letterindex}{-\gobbledword}% + \edef\fromtoindex{\value{@@@letterindex}}% + \else + \edef\fromtoindex{#1}% + \fi + \else + \edef\fromtoindex{#2}% + \fi +} + +\newcommand\@getstringlength[2]{% + \edef\@@teststring{#1\endofstring}% + \ifthenelse{\equal{\@@teststring}{\endofstring}}% + {\setcounter{#2}{0}}% + {% + \setcounter{@gobblesize}{1}% + \whiledo{\value{@gobblesize} < \@MAXSTRINGSIZE}{% + \@gobblearg{\@@teststring}{1}% + \edef\@@teststring{\gobbledword}% + \ifthenelse{\equal{\@@teststring}{\endofstring}}% + {\setcounter{#2}{\value{@gobblesize}}% + \setcounter{@gobblesize}{\@MAXSTRINGSIZE}}% + {\addtocounter{@gobblesize}{1}}% + }% + }% +} + +\newcommand\@gobblearg[2]{% + \setcounter{@letterindex}{0}% + \setcounter{@gobbleindex}{#2}% + \edef\gobbledword{#1}% + \whiledo{\value{@letterindex} < \value{@gobbleindex}}{% + \isnextbyte[q]{\EscapeChar}{\gobbledword}% + \if T\theresult% + \edef\gobbledword{\@DiscardNextChar{\gobbledword}}% + \fi + \edef\gobbledword{\@DiscardNextChar{\gobbledword}}% + \addtocounter{@letterindex}{1}% + }% +} + +\newcommand\@DiscardNextChar[1]{% + \expandafter\if\expandafter\BlankSpace#1\else + \expandafter\@gobble#1% + \fi +} + +\newcommand\@convertsymboltostring[4][v]{% + \def\@fromcode{#3}% + \def\@tostring{#4}% + \def\EncodingTreatment{e}% + \substring[e]{#2}{1}{\@MAXSTRINGSIZE}% + \@convertoff% + \if e#1\else\substring[#1]{\thestring}{1}{\@MAXSTRINGSIZE}\fi% +} + +\newcommand\@convertbytetostring[4][v]{% + \def\@frombyte{#3}% + \def\@tostring{#4}% + \def\EncodingTreatment{e}% + \substring[e]{#2}{1}{\@MAXSTRINGSIZE}% + \@convertoff% + \if e#1\else\substring[#1]{\thestring}{1}{\@MAXSTRINGSIZE}\fi% +} + +\newcommand\@treatleadingspaces[3][v]{\+% + \defaultTreatments% + \edef\thestring{#2}% + \@getstringlength{\thestring}{@stringsize}% + \setcounter{@maxrotation}{\value{@stringsize}}% + \setcounter{@letterindex}{0}% + \whiledo{\value{@letterindex} < \value{@maxrotation}}{% + \addtocounter{@letterindex}{1}% + \isnextbyte[q]{\EncodedBlankSpace}{\thestring}% + \if F\theresult\isnextbyte[q]{\BlankSpace}{\thestring}\fi% + \if T\theresult% + \isnextbyte[q]{#3}{x}% + \if F\theresult% + \edef\thestring{\rotate{\thestring}}% + \else + \@gobblearg{\thestring}{1}% + \edef\thestring{\gobbledword}% + \fi + \else + \setcounter{@maxrotation}{\value{@letterindex}}% + \fi + }\?% + \substring[#1]{\thestring}{1}{\@MAXSTRINGSIZE}% +} + +\newcommand\@convertoff{\def\@frombyte{xy}\def\@tostring{}% + \def\@fromcode{xy}} +\@convertoff + +\newcommand\@rotate[1]{% + \if \@frombyte#1\@tostring\else + \if 0\SymbolTreatment% + \@removeExpandableSymbols{#1}% + \else + \@rotateExpandableSymbols{#1}% + \fi + \fi +} + +\newcommand\@rotateExpandableSymbols[1]{% + \expandafter\ifx\expandafter\\&\else + \expandafter\ifx\expandafter\%#1\%\else + \expandafter\ifx\expandafter\##1\#\else + \@rotateBlankSpaces{#1}% + \fi + \fi + \fi +} + +\newcommand\@removeExpandableSymbols[1]{% + \expandafter\ifx\expandafter\\else + \expandafter\ifx\expandafter\%#1\else + \expandafter\ifx\expandafter\##1\else + \@rotateBlankSpaces{#1}% + \fi + \fi + \fi +} + +\newcommand\@rotateBlankSpaces[1]{% + \expandafter\ifx\expandafter$#1$\else% <---RETAIN GOING INTO/FROM MATH MODE + \if \EncodedBlankSpace#1\@blankaction\else% <--- FINDS REENCODED TILDE + \if \BlankSpace#1\@blankaction\else + \if 2\AlphaTreatment% + \@chcaseAlpha{#1}% + \else + \if 0\AlphaTreatment% + \@removeAlpha{#1}% + \else + \@rotateAlpha{#1}% + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@rotateAlpha[1]{% + \if a#1a\else + \if b#1b\else + \if c#1c\else + \if d#1d\else + \if e#1e\else + \if f#1f\else + \if g#1g\else + \if h#1h\else + \if i#1i\else + \if j#1j\else + \if k#1k\else + \if l#1l\else + \if m#1m\else + \if n#1n\else + \if o#1o\else + \if p#1p\else + \if q#1q\else + \if r#1r\else + \if s#1s\else + \if t#1t\else + \if u#1u\else + \if v#1v\else + \if w#1w\else + \if x#1x\else + \if y#1y\else + \if z#1z\else + \if 2\AlphaCapsTreatment% + \@chcaseAlphaCaps{#1}% + \else + \if 0\AlphaCapsTreatment% + \@removeAlphaCaps{#1}% + \else + \@rotateAlphaCaps{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@removeAlpha[1]{% + \if a#1\else + \if b#1\else + \if c#1\else + \if d#1\else + \if e#1\else + \if f#1\else + \if g#1\else + \if h#1\else + \if i#1\else + \if j#1\else + \if k#1\else + \if l#1\else + \if m#1\else + \if n#1\else + \if o#1\else + \if p#1\else + \if q#1\else + \if r#1\else + \if s#1\else + \if t#1\else + \if u#1\else + \if v#1\else + \if w#1\else + \if x#1\else + \if y#1\else + \if z#1\else + \if 2\AlphaCapsTreatment% + \@chcaseAlphaCaps{#1}% + \else + \if 0\AlphaCapsTreatment% + \@removeAlphaCaps{#1}% + \else + \@rotateAlphaCaps{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@chcaseAlpha[1]{% + \if a#1A\else + \if b#1B\else + \if c#1C\else + \if d#1D\else + \if e#1E\else + \if f#1F\else + \if g#1G\else + \if h#1H\else + \if i#1I\else + \if j#1J\else + \if k#1K\else + \if l#1L\else + \if m#1M\else + \if n#1N\else + \if o#1O\else + \if p#1P\else + \if q#1Q\else + \if r#1R\else + \if s#1S\else + \if t#1T\else + \if u#1U\else + \if v#1V\else + \if w#1W\else + \if x#1X\else + \if y#1Y\else + \if z#1Z\else + \if 2\AlphaCapsTreatment% + \@chcaseAlphaCaps{#1}% + \else + \if 0\AlphaCapsTreatment% + \@removeAlphaCaps{#1}% + \else + \@rotateAlphaCaps{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@rotateAlphaCaps[1]{% + \if A#1A\else + \if B#1B\else + \if C#1C\else + \if D#1D\else + \if E#1E\else + \if F#1F\else + \if G#1G\else + \if H#1H\else + \if I#1I\else + \if J#1J\else + \if K#1K\else + \if L#1L\else + \if M#1M\else + \if N#1N\else + \if O#1O\else + \if P#1P\else + \if Q#1Q\else + \if R#1R\else + \if S#1S\else + \if T#1T\else + \if U#1U\else + \if V#1V\else + \if W#1W\else + \if X#1X\else + \if Y#1Y\else + \if Z#1Z\else + \if 0\NumeralTreatment% + \@removeNumerals{#1}% + \else + \@rotateNumerals{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@removeAlphaCaps[1]{% + \if A#1\else + \if B#1\else + \if C#1\else + \if D#1\else + \if E#1\else + \if F#1\else + \if G#1\else + \if H#1\else + \if I#1\else + \if J#1\else + \if K#1\else + \if L#1\else + \if M#1\else + \if N#1\else + \if O#1\else + \if P#1\else + \if Q#1\else + \if R#1\else + \if S#1\else + \if T#1\else + \if U#1\else + \if V#1\else + \if W#1\else + \if X#1\else + \if Y#1\else + \if Z#1\else + \if 0\NumeralTreatment% + \@removeNumerals{#1}% + \else + \@rotateNumerals{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@chcaseAlphaCaps[1]{% + \if A#1a\else + \if B#1b\else + \if C#1c\else + \if D#1d\else + \if E#1e\else + \if F#1f\else + \if G#1g\else + \if H#1h\else + \if I#1i\else + \if J#1j\else + \if K#1k\else + \if L#1l\else + \if M#1m\else + \if N#1n\else + \if O#1o\else + \if P#1p\else + \if Q#1q\else + \if R#1r\else + \if S#1s\else + \if T#1t\else + \if U#1u\else + \if V#1v\else + \if W#1w\else + \if X#1x\else + \if Y#1y\else + \if Z#1z\else + \if 0\NumeralTreatment% + \@removeNumerals{#1}% + \else + \@rotateNumerals{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@rotateNumerals[1]{% + \if 1#11\else + \if 2#12\else + \if 3#13\else + \if 4#14\else + \if 5#15\else + \if 6#16\else + \if 7#17\else + \if 8#18\else + \if 9#19\else + \if 0#10\else + \if 0\PunctuationTreatment% + \@removePunctuation{#1}% + \else + \@rotatePunctuation{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@removeNumerals[1]{% + \if 1#1\else + \if 2#1\else + \if 3#1\else + \if 4#1\else + \if 5#1\else + \if 6#1\else + \if 7#1\else + \if 8#1\else + \if 9#1\else + \if 0#1\else + \if 0\PunctuationTreatment% + \@removePunctuation{#1}% + \else + \@rotatePunctuation{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@rotatePunctuation[1]{% + \if ;#1;\else + \if :#1:\else + \if '#1'\else + \if "#1"\else + \if ,#1,\else + \if .#1.\else + \if ?#1?\else + \if `#1`\else + \if !#1!\else + \if 0\SymbolTreatment% + \@removeDirectSymbols{#1}% + \else + \@rotateDirectSymbols{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@removePunctuation[1]{% + \if ;#1\else + \if :#1\else + \if '#1\else + \if "#1\else + \if ,#1\else + \if .#1\else + \if ?#1\else + \if `#1\else + \if !#1\else + \if 0\SymbolTreatment% + \@removeDirectSymbols{#1}% + \else + \@rotateDirectSymbols{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@rotateDirectSymbols[1]{% + \if /#1/\else + \if @#1@\else + \if *#1*\else + \if (#1(\else + \if )#1)\else + \if -#1-\else + \if _#1_\else + \if =#1=\else + \if +#1+\else + \if [#1[\else + \if ]#1]\else + \if ^#1^\else% <--FOR SUPERSCRIPTS, NOT \^ + \if <#1<\else + \if >#1>\else + \if |#1|\else + \@rotateUndecipherable{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@removeDirectSymbols[1]{% + \if /#1\else + \if @#1\else + \if *#1\else + \if (#1\else + \if )#1\else + \if -#1\else + \if _#1\else + \if =#1\else + \if +#1\else + \if [#1\else + \if ]#1\else + \if ^#1\else% <--FOR SUPERSCRIPTS, NOT \^ + \if <#1\else + \if >#1\else + \if |#1\else + \@rotateUndecipherable{#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +\newcommand\@rotateUndecipherable[1]{% + \expandafter\@gobble#1\undecipherable% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput +%% +%% End of file `stringstrings.sty'. |