diff options
author | Karl Berry <karl@freefriends.org> | 2006-11-18 01:37:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-11-18 01:37:52 +0000 |
commit | 5c91b9f8a88e06f057a6a08b0a755a224d08e019 (patch) | |
tree | 57cfafb6bd6c146dcdfc911dbef8db622c6476bd /Master/texmf-dist/tex/context/base/syst-str.mkii | |
parent | 983736c2ab572e9a860c74f0f781b3decd282f13 (diff) |
context 17nov06 update
git-svn-id: svn://tug.org/texlive/trunk@2449 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/syst-str.mkii')
-rw-r--r-- | Master/texmf-dist/tex/context/base/syst-str.mkii | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/syst-str.mkii b/Master/texmf-dist/tex/context/base/syst-str.mkii new file mode 100644 index 00000000000..e50df0103bb --- /dev/null +++ b/Master/texmf-dist/tex/context/base/syst-str.mkii @@ -0,0 +1,119 @@ +%D \module +%D [ file=syst-str, +%D version=2006.09.18, +%D title=\CONTEXT\ System Macros, +%D subtitle=String Processing, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\unprotect + +%D We need a convenient way to change lccode vectors. + +\dostepwiserecurse{0}{255}{1} + {\@EA\chardef\csname-\recurselevel\endcsname\recurselevel} + +\newtoks\withminorcharacters +\newtoks\withlowercharacters +\newtoks\withuppercharacters + +\dostepwiserecurse{0}{31}{1} + {\expanded + {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname + \noexpand\to\withminorcharacters}} + +\dostepwiserecurse{32}{127}{1} + {\expanded + {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname + \noexpand\to\withlowercharacters}} + +\dostepwiserecurse{128}{255}{1} + {\expanded + {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname + \noexpand\to\withuppercharacters}} + +\chardef\obeyedlccode=`. % so <32 and >127 chars become . + +%D \macros +%D {retainlccodes} +%D +%D One way of manipulating characters is changing the their +%D \type{\lccode} and applying \type{\lowcase}. An example of +%D this can be found in \type{spec-mis}. + +\def\setownlccode #1{\lccode#1#1} +\def\setobeyedlccode#1{\lccode#1\obeyedlccode} + +\def\obeylccodes + {\let\withcharacter\setownlccode + \the\withlowercharacters + \let\withcharacter\setobeyedlccode + \the\withminorcharacters + \the\withuppercharacters + \relax} + +\def\retainlccodes + {\let\withcharacter\setownlccode + \the\withlowercharacters + \the\withminorcharacters + \the\withuppercharacters + \relax} + +%D The string macros: + +\def\replacecharacters#1#2#3% macro characters replacement + {\bgroup + \edef\ascii{#1}% + \retainlccodes + \def\docommand##1{\lccode\expandafter`\csname##1\endcsname=\expandafter`\csname#3\endcsname}% + \handletokens#2\with\docommand + \lowercase\@EA{\@EA\xdef\@EA\globalascii\@EA{\ascii}}% + \egroup + \dodoglobal\let#1\globalascii} + +% \bgroup +% \catcode`\ =\@@other % needed in order to get it visible +% \lccode`\ =`\- +% \lowercase{\xdef\globalascii{aap noot}}% +% \egroup +% +% [\globalascii] {\tttf [\globalascii]} +% +% interesting: +% +% \setvalue{xxx}{oeps} +% \setvalue{test-test}{\getvalue{xxx}oeps} +% \bgroup\lccode`\ =`\-\lowercase{\egroup\csname test test\endcsname} +% +% \setvalue{test\string~test}{\getvalue{xxx}oeps} +% \bgroup\lccode`\ =`\~\lowercase{\egroup\csname test test\endcsname} +% +% \bgroup\catcode`\~=\@@letter\lowercase{\egroup\csname test~test\endcsname} + +\def\separatestring#1\to#2% + {\bgroup + \retainlccodes + \lccode `\ =`\,% + % when typesetting: \catcode`\ =\@@other + \edef\ascii{#1}% + \lowercase\@EA{\@EA\xdef\@EA\globalascii\@EA{\ascii}}% + \egroup + \let#2\globalascii} + +\def\unspacefilename#1\to#2% + {\bgroup + \def\obeyedspace{-}% + \sanitizefilename#1\to\ascii + \retainlccodes + \lccode `\ =`\-% + % when typesetting: \catcode`\ =\@@other + \lowercase\@EA{\@EA\xdef\@EA\globalascii\@EA{\ascii}}% + \egroup + \let#2\globalascii} + +\protect \endinput |