summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/plain/gustlib/map
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-12 23:46:46 +0000
committerKarl Berry <karl@freefriends.org>2006-01-12 23:46:46 +0000
commitb1c871653d37d9c6fd0f97b048dca051b5b1db27 (patch)
tree3f925e95aa3461b9ecb75df861259a7f71bc3f23 /Master/texmf-dist/tex/plain/gustlib/map
parent82770e7491344072d5dd54ce9a78546eebe99c3f (diff)
trunk/Master/texmf-dist/tex/plain
git-svn-id: svn://tug.org/texlive/trunk@621 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/plain/gustlib/map')
-rw-r--r--Master/texmf-dist/tex/plain/gustlib/map/map.tex63
-rw-r--r--Master/texmf-dist/tex/plain/gustlib/map/split.tex63
-rw-r--r--Master/texmf-dist/tex/plain/gustlib/map/tsp-tst.mex68
-rw-r--r--Master/texmf-dist/tex/plain/gustlib/map/tsp.tex49
-rw-r--r--Master/texmf-dist/tex/plain/gustlib/map/tun-test.mex51
-rw-r--r--Master/texmf-dist/tex/plain/gustlib/map/tun.tex51
6 files changed, 345 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/plain/gustlib/map/map.tex b/Master/texmf-dist/tex/plain/gustlib/map/map.tex
new file mode 100644
index 00000000000..779ef6ae3c7
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/gustlib/map/map.tex
@@ -0,0 +1,63 @@
+% MAP.TEX
+
+% Marek Ry\'cko
+
+% Macro \map
+% for applying operations to token sequences
+
+% uses SPLIT.TEX
+
+% version 0.0 24.07.1993
+% version 0.1 1.5.1996
+% -- english description
+
+\def\map
+ % for each element E of the token list #2
+ % ``execute'' the token list #1
+ % possibly making use of the following macros:
+ % \mappre the token list before E (without E)
+ % \mapcur the token E
+ % \mappost the token list after E (without E)
+ % \mapupto the token list from the beginning till and including E
+ % \mapfrom the token list from and including E till the end
+ % \mapent the entire token list
+ %
+ % -------------\mapent----------------
+ % ---\mapfrom---------
+ % ----\mapupto-----
+ % ................E...................
+ % ----\mappre----- ---\mappost--------
+ % 
+ % |
+ % |
+ % \mapcur
+ %
+ #1% operation
+ #2% token list
+ {{%
+ \def\mapent{#2}%
+ \def\mappre{}%
+ \let\mapfrom\mapent
+ % \mappre contains already processed sequence
+ % \mapfrom contains the sequence to be processed
+ % while nonempty \mapfrom do:
+ \ifx\empty\mapfrom \mapcontfalse \else \mapconttrue \fi
+ \loop \ifmapcont
+ % \mapfrom nonempty, so it can be split:
+ % split \mapfrom to head and tail:
+ \split\mapfrom\mapcur\mappost
+ % set \mapupto as the concatenation of \mappre and \mapcur:
+ \expandafter\expandafter\expandafter
+ \def\expandafter\expandafter\expandafter
+ \mapupto\expandafter\expandafter\expandafter
+ {\expandafter\mappre\mapcur}%
+ % execute operation(s):
+ #1%
+ % define new values of \mappre and \mapfrom
+ \expandafter\def\expandafter\mappre\expandafter{\mapupto}%
+ \expandafter\def\expandafter\mapfrom\expandafter{\mappost}%
+ % \mappre contains already processed sequence
+ % \mapfrom contains the sequence to be processed
+ \ifx\empty\mapfrom \mapcontfalse \else \mapconttrue \fi
+ \repeat}}%
+\newif\ifmapcont
diff --git a/Master/texmf-dist/tex/plain/gustlib/map/split.tex b/Master/texmf-dist/tex/plain/gustlib/map/split.tex
new file mode 100644
index 00000000000..252f1d358b1
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/gustlib/map/split.tex
@@ -0,0 +1,63 @@
+% SPLIT.TEX
+
+% Marek Ry\'cko
+
+% Macro \split (and auxiliary macros)
+% for splitting token sequences
+% Macro \hdtl
+
+% version 0.0 24.07.1993
+% version 0.1 31.12.94
+% version 0.2 1.5.1996
+% -- english description
+
+\def\hdtl
+ #1% inp. t.s. (nonempty, poss blanks)
+ #2% outp. -- head
+ #3% outp. -- tail
+ {\let\reshead=#2% synonims for token-register names
+ \let\restail=#3%
+ \expandafter\gethead\the#1\endoftokens}
+\def\gethead
+ {\futurelet\thehead\analysehead}
+\def\analysehead
+ {\ifcat \noexpand\thehead \space
+ \let\followby=\followbyspace
+ \else
+ \let\followby=\followbynospace
+ \fi
+ \followby}
+\def\followbyspace
+ {\reshead={ }% space token
+ \afterassignment\gettail
+ \let\swallow= }% swallowing the head-space
+\def\gettail
+ #1\endoftokens
+ {\restail={#1}}
+\def\followbynospace
+ #1#2\endoftokens
+ {\reshead={#1}%
+ \restail={#2}}
+\def\split
+ #1% input macro name (should expand to nonemty token sequence)
+ #2% macro head (name)
+ #3% macro tail (name)
+ {%
+ % define
+ % #2 as the first token (with nested braces) of #1
+ % #3 as the tail (with nested braces) of #1
+ \expandafter\splithdtl\expandafter{#1}%
+ \expandafter\def\expandafter\splittest\expandafter{\the\splithdtl}%
+ \ifx\splittest\empty
+ \gdef#2{}%
+ \gdef#3{}%
+ \else
+ \hdtl\splithdtl\splithd\splittl
+ \expandafter\gdef\expandafter#2\expandafter{\the\splithd}%
+ \expandafter\gdef\expandafter#3\expandafter{\the\splittl}%
+ \fi
+ }
+\newtoks\splithdtl
+\newtoks\splithd
+\newtoks\splittl
+
diff --git a/Master/texmf-dist/tex/plain/gustlib/map/tsp-tst.mex b/Master/texmf-dist/tex/plain/gustlib/map/tsp-tst.mex
new file mode 100644
index 00000000000..bb887172a97
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/gustlib/map/tsp-tst.mex
@@ -0,0 +1,68 @@
+% TSP-TEST.MEX
+
+% test zestawu makr TSP
+
+% Bogus/law Jackowski i Marek Ry/cko
+% 24 lipca 1993 r., dotkni/ete 14 lutego 1997 r.
+
+\input split
+\input map
+\input tsp
+\prefixing
+
+\def\wlaz
+ {%
+ Wlaz/l pies do kuchni
+ {i\nobreak} porwa/l mi/esa /cwier{/c,}
+ {a\nobreak} jaki/s kucharz g/lupi
+ zar/aba/l go na /smier{/c.}
+ {A\nobreak} drugi kucharz m/adr{y,}
+ co lito/s/c {w\nobreak} sercu mia/l
+ postawi/l mu nagrobek
+ {i\nobreak} taki napis da}
+\edef\lista
+ {\wlaz{/l:} \wlaz{/l...}}
+
+\def\test
+ #1% odst/ep zamiast spacji
+ #2% odst/ep mi/edzy literami
+ {%
+ \def\paramtest{#1#2}
+ \ifx\paramtest\empty\else
+ % odst/ep zamiast spacji:
+ \def\tspsp {#1}
+ % odst/ep mi/edzy literami:
+ \def\tsplet {#2}
+ \fi
+ \leftline{\tt \string\def\string\tspsp\{\tspsp\}\space\space
+ \string\def\string\tsplet\{\tsplet\}}
+ \vskip2pt
+ \expandafter\tsp\expandafter{\lista}
+ \vskip6pt
+ \message{.}
+ }
+
+\font\xxx plr12 scaled \magstep1 \xxx
+\baselineskip16.4pt
+\vsize24.7cm
+\nopagenumbers
+\chardef\{"7B
+\chardef\}"7D
+
+\message{Prosz/e czeka/c.}
+
+{\tenrm
+\line{Test makra {\tt\string\tsp}\hss
+ 1 maja 1996 r.}
+\smallskip
+\hrule
+\vfill
+}
+\test {} {}% standard
+\test {0.555em plus.2777em minus.111em} {.1em}%
+\test {0.28em plus.1em minus.111em} {-.05em}%
+\test {0.22em plus.1em minus.111em} {-.06em}%
+\test {0.333em plus.167em minus.111em} {0em}%
+\leftline{\tt zwyk/ly tekst:}\vskip2pt
+\tsp {\lista}% bez u/zycia makra
+\eject\end
diff --git a/Master/texmf-dist/tex/plain/gustlib/map/tsp.tex b/Master/texmf-dist/tex/plain/gustlib/map/tsp.tex
new file mode 100644
index 00000000000..e140ed624de
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/gustlib/map/tsp.tex
@@ -0,0 +1,49 @@
+% TSP.TEX
+
+% Marek Ry\'cko
+
+% Macro \tsp
+% Text SPace
+
+% uses SPLIT.TEX
+
+% version 0.0 24.07.1993
+% version 0.2, 8.10.1993
+% -- no \input map
+% version 0.3 1.5.1996
+% -- english description
+
+
+% uses SPLIT
+% uses MAP
+
+
+\def\tsp
+ %#1%
+ {\map
+ {\ifx\mapcur\space
+ \hskip\tspsp\relax
+ \else
+ \mapcur
+ % if it is not the last element -- join using kern:
+ \ifx\mappost\empty \else
+ % ``future'' is nonempty;
+ % we put interletter spacing only if
+ % next character is not space:
+ \split\mappost\tsptest\fool
+ \ifx\tsptest\space
+ % will be space, don't put glue:
+ \else
+ % not kern to make it streachable:
+ \nobreak\hskip\tsplet\relax
+ \fi
+ \fi
+ \fi
+ }% the end of first parameter
+ %{#1}%
+ }
+% default parameters:
+% the amount of space in place of the space character:
+ \def\tspsp {0.9em plus.3em minus.2em}
+% distance between letters:
+ \def\tsplet {.1666667em}%
diff --git a/Master/texmf-dist/tex/plain/gustlib/map/tun-test.mex b/Master/texmf-dist/tex/plain/gustlib/map/tun-test.mex
new file mode 100644
index 00000000000..9034c81ef90
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/gustlib/map/tun-test.mex
@@ -0,0 +1,51 @@
+% TUN-TEST.MEX (Mazovia)
+
+% test zestawu makr TSP
+
+% Bogus/law Jackowski i Marek Ry/cko
+% 9.10.94, dotkni/ete 14 lutego 1997 r.
+
+\input split
+\input map
+\input tun
+\prefixing
+
+\def\zda
+ {Moim zdaniem ten tekst powinien by{/c} podkre{/s}lony...}
+\edef\aka
+ {%
+ \zda\
+ \zda\
+ \zda\
+ \zda\
+ \zda
+ }
+\def\tes#1%
+ {\expandafter\tun\expandafter{#1}\vskip5pt}
+\def\uf{\afterassignment\tunfont\font\tunfont}
+\footline{\hfill\tenrm\expandafter\tun\expandafter{\the\pageno}\hfill}
+\pageno1001
+
+%\def\tunsep {.25ex}%
+%\def\tunwd {.1ex}%
+\def\tunfac {1.1}%
+
+\tes\zda
+
+\uf plr17
+
+\tes\zda
+
+\uf plb10
+
+\tes\zda
+
+\uf plr17 scaled\magstep1
+\baselineskip22.4pt
+
+\tes\zda
+
+%\edef\param{\licz{157}}
+%\expandafter\tun\expandafter{\param}
+
+\end
diff --git a/Master/texmf-dist/tex/plain/gustlib/map/tun.tex b/Master/texmf-dist/tex/plain/gustlib/map/tun.tex
new file mode 100644
index 00000000000..275135adb97
--- /dev/null
+++ b/Master/texmf-dist/tex/plain/gustlib/map/tun.tex
@@ -0,0 +1,51 @@
+% TUN.TEX
+
+% Marek Ry\'cko
+
+% Macro \tun
+% Text UNderline
+
+% version 0.1, 9.10.94
+% version 0.3, 1.5.1996
+% -- english description
+
+
+% uses SPLIT
+% uses MAP
+
+
+\newbox\boxA
+\newdimen\dimenA
+\newdimen\dimenB
+
+
+\def\tun
+ %#1%
+ {\map
+ {\ifx\mapcur\space
+ \space
+ \else
+ \tunel\mapcur
+ \fi
+ }%
+ %{#1}%
+ }
+\def\tunel
+ #1% what to underline
+ {{%
+ #1%
+ \setbox\boxA\hbox{#1}%
+ \dimenA-\tunsep
+ \dimenB-\dimenA \advance\dimenB\tunwd
+ \llap{\hbox to\wd\boxA{\hss
+ \vrule height\dimenA depth\dimenB width\tunfac\wd\boxA
+ \hss}}%
+ }}
+
+% default parameters:
+% underline separator width
+ \def\tunsep {.25ex}%
+% underline width
+ \def\tunwd {.09ex}%
+% underline factor of letter width:
+ \def\tunfac {1}%