Debian Codegraph @

texmf-dist/doc/latex/hyper/defpattern.sty

raw
1 %%
2 %% This is file `defpattern.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% hyper.dtx (with options: `defpattern')
8 %%
9 %% File: hyper.dtx Copyright (C) 1995--1999 Michael Mehlich
10 %% This program can be redistributed and/or modified under the terms
11 %% of the LaTeX Project Public License Distributed from CTAN
12 %% archives in directory macros/latex/base/lppl.txt; either
13 %% version 1 of the License, or any later version.
14 \def\fileversion{V4.2d}
15 \def\filedate{1999/03/09}
16 \def\docdate{1999/03/09}
17 %%
18 %% \CharacterTable
19 %% {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
20 %% 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
21 %% Digits \0\1\2\3\4\5\6\7\8\9
22 %% Exclamation \! Double quote \" Hash (number) \#
23 %% Dollar \$ Percent \% Ampersand \&
24 %% Acute accent \' Left paren \( Right paren \)
25 %% Asterisk \* Plus \+ Comma \,
26 %% Minus \- Point \. Solidus \/
27 %% Colon \: Semicolon \; Less than \<
28 %% Equals \= Greater than \> Question mark \?
29 %% Commercial at \@ Left bracket \[ Backslash \\
30 %% Right bracket \] Circumflex \^ Underscore \_
31 %% Grave accent \` Left brace \{ Vertical bar \|
32 %% Right brace \} Tilde \~}
33 %%
34 \ProvidesPackage{defpattern}
35 \message{%
36 `\string\defpattern-macro %
37 (adapted from \string\howto\space%
38 (Alan Jeffrey in TeX and TUG NEWS 2(2))%
39 )%
40 '%
41 }
42 \def\xcs#1#2{\expandafter#1\csname#2\endcsname}
43 \newcount\actioncount
44 \def\defpattern#1[#2]#3{%
45 \xcs\ifx{\expandafter\gobble\string#1}\relax
46 \def#1{\erroraction#1}\fi
47 \advance\actioncount by 1\relax
48 \expandafter\defaction\expandafter{#1}{#3}{#2}%
49 \def\temp##1##2##3##4##5##6##7##8##9{\def\temp{[#2]}}%
50 \temp\empty\empty\empty\empty\empty\empty\empty\empty\empty
51 \edef#1{\noexpand\doaction\xcs\noexpand
52 {action-\the\actioncount}\temp}}
53 \def\defaction#1#2#3{%
54 \xcs\def{action-\the\actioncount}##1[#3]{\applyto{#1}{#2}}}
55 \def\gobble#1{}
56 \def\applyto#1#2#3{#3{#1}{#2}}
57 \def\doaction#1[#2][#3]{#1[#3]\success[#2]\failure[#3]}
58 \def\success#1#2[#3]\failure[#4]{#2}
59 \def\failure#1#2{#1}
60 \def\erroraction#1[#2]{%
61 \PackageError{defpattern}{I don't know how to \string#1[#2]}{}}
62 \endinput
63 %%
64 %% End of file `defpattern.sty'.