From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- info/examples/tip/csar.tip | 114 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 info/examples/tip/csar.tip (limited to 'info/examples/tip/csar.tip') diff --git a/info/examples/tip/csar.tip b/info/examples/tip/csar.tip new file mode 100644 index 0000000000..9a451407b7 --- /dev/null +++ b/info/examples/tip/csar.tip @@ -0,0 +1,114 @@ +% This macro source file is from the four volume series +% "TeX in Practice" by Stephan von Bechtolsheim, published +% 1993 by Springer-Verlag, New York. +% Copyright 1993 Stephan von Bechtolsheim. +% No warranty or liability is assumed. +% This macro may be copied freely if no fees other than +% media cost or shipping charges are charged and as long +% as this copyright and the following source code itself +% is not changed. Please see the series for further information. +% +% Version: 1.0 +% Date: May 1, 1993 +% +% +% This source code is documented in 19.2.2, p. III-78. +% Original source in file "tokens2.TEX", starting line 640. +\wlog{L: "csar.tip" ["tokens2.TEX," l. 640, p. III-78]}% +% This file DOES belong to format "texip." +\InputD{doloop.tip} +\InputD{rangetst.tip} +\InputD{compst.tip} +\InputD{strleng.tip} +\catcode`\@ = 11 +\newcount\@CreateArrayCount +\def\CCreateArray #1#2#3{% + \NameEdef{#1-low}{\number#2}% + \NameEdef{#1-high}{#3}% + \ifnum #3<#2 + \errmessage{\string\CCreateArray: low array boundary + \number#2 is larger than upper array boundary + \number#3}% + \fi + \DoLoop{\@CreateArrayCount}{#2}{1}{#3}{% + \NameDef{#1-\the\@CreateArrayCount}{}% + } +} +\newcount\@ConvertStringIntoArrayLength +\newcount\@ConvertStringIntoArrayCount +\def\ConvertStringIntoArray #1#2{% + \def\@ConvertArrayName{#1}% + \edef\@ConvertArrayString{#2}% + \StringLength{\@ConvertArrayString}% + \@ConvertStringIntoArrayLength = \StringLengthResult + \advance\@ConvertStringIntoArrayLength by -1 + \CCreateArray{\@ConvertArrayName}% + {0}{\the\@ConvertStringIntoArrayLength}% + \@ConvertStringIntoArrayCount = 0 + \expandafter\@ConvertStringIntoArray + \@ConvertArrayString\@ConvertEnd +} +\def\@ConvertStringIntoArray #1#2\@ConvertEnd{% + \CLoadArrayElementEdef{\@ConvertArrayName}% + {\the\@ConvertStringIntoArrayCount}{#1}% + \if\EmptyStringConditional{#2}% + \def\@ConvertStringIntoArrayNext{}% + \else + \advance\@ConvertStringIntoArrayCount by 1\relax + \def\@ConvertStringIntoArrayNext{% + \@ConvertStringIntoArray #2\@ConvertEnd% + }% + \fi + \@ConvertStringIntoArrayNext +} +\def\CCheckIndex #1#2{% + \expandafter\ifx\csname #1-low\endcsname\relax + \errmessage{\string\CCheckIndex: no array #1.}% + \fi + \ifnum #2<\NameUse{#1-low}% + \errmessage{Index #2 for array #1 too small.}% + \fi + \ifnum #2>\NameUse{#1-high}% + \errmessage{Index #2 for array #1 too large.}% + \fi +} +\def\CArrayAccess #1#2#3{% + \CCheckIndex{#1}{#2}% + \edef#3{\NameUse{#1-#2}}% +} +\newcount\@CArrayAccessIntervalCount +\def\CArrayAccessInterval #1#2#3#4{% + \CCheckIndex{#1}{#2}% + \CCheckIndex{#1}{#3}% + \ifnum #2>#3\relax + \errmessage{\string\CArrayAccessInterval: low index + (\PoundSignText 2) > high index + (PoundSignText 3).}% + \fi + \def#4{}% + \DoLoop + {\@CArrayAccessIntervalCount}{#2}{1}{#3}{% + \CArrayAccess{#1}{\the\@CArrayAccessIntervalCount}% + {\@CArrayAccessInterval}% + \edef#4{#4\@CArrayAccessInterval}% + }% +} +\def\CLoadArrayElement #1#2#3{% + \CCheckIndex{#1}{#2}% + \NameDef{#1-#2}{#3}% +} +\def\CLoadArrayElementEdef #1#2#3{% + \CCheckIndex{#1}{#2}% + \NameEdef{#1-#2}{#3}% +} +\newcount\@CShowArrayCount +\def\CShowArray #1{% + \DoLoop + {\@CShowArrayCount}% + {\NameUse{#1-low}}% + {1}% + {\NameUse{#1-high}}% + {\wlog{Index \the\@CShowArrayCount: + \NameUse{#1-\the\@CShowArrayCount}}}% +} +\catcode`\@ = 12 -- cgit v1.2.3