summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/adrlist/adrlist.sty
blob: 7f92324e5c53f15d62c55db538836d8420ad7ec6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
%% 
%% This is file `adrlist.sty',
%% generated with the docstrip utility.
%% 
%% The original source files were:
%% 
%% adrlist.dtx 
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% You are *not* allowed to modify this file.
%% 
%% You are *not* allowed to distribute this file.
%% For distribution of the original source see
%% the terms for copying and modification in the file  adrlist.dtx.
%% 
\ProvidesPackage{adrlist}[1995/12/21]
\RequirePackage{ifthen}
\newboolean{AddressLoop}
\newboolean{Rest}\setboolean{Rest}{true}
\newcounter{Communication}
\newcommand{\ifstringcompare}[4]{%
  \begingroup
    \let\protect=\noexpand
    \edef\0{#1}\edef\1{#2}%
  \expandafter\endgroup\ifx\0\1#3\else#4\fi}
\newcommand{\concat}[2]{#1\\#2}
\def\keyword#1:#2|{#1}
\def\contents#1:#2|{#2}
\newcommand{\ForEachAddress}[2]
{
 \newread\File \openin\File=#1
 \whiledo{\boolean{Rest}}
 { \ReadNextAddress{\File}
   \ifthenelse{\boolean{Rest}}{#2}{}
 }
 \closein\File
}
\newcommand{\ReadNextAddress}[1]{
 \ifthenelse{\boolean{Rest}}{
   \read#1 to \Title
   \ifeof#1\setboolean{Rest}{false}
   \else % If last address already is read, EOF should appear here
     \ifthenelse{\boolean{Rest}}
                {\read#1 to \Opening
                 \ifeof#1\setboolean{Rest}{false}\fi
                }{}
     \ifthenelse{\boolean{Rest}}
                {\read#1 to \Sex
                 \ifeof#1\setboolean{Rest}{false}\fi
                }{}
     \ifthenelse{\boolean{Rest}}
                {\read#1 to \Firstname
                 \ifeof#1\setboolean{Rest}{false}\fi
                }{}
     \ifthenelse{\boolean{Rest}}
                {\read#1 to \Name
                 \ifeof#1\setboolean{Rest}{false}\fi
                }{}
     \ifthenelse{\boolean{Rest}}
                {\read#1 to \Dummy
                 \ifeof#1\setboolean{Rest}{false}\fi
                }{}
     \setboolean{AddressLoop}{true}
     \def\Emptystring{} \let\Address=\Emptystring
     \def\Delimiter{-- end address -- }
     \whiledo{\boolean{AddressLoop}}
     {
       \ifRest \read#1 to \Buffer \fi
       \ifeof#1\setboolean{Rest}{false}\fi
       \ifstringcompare{\Buffer}{\Delimiter}
                       {\setboolean{AddressLoop}{false}}{}
       \ifthenelse{\boolean{AddressLoop}}
       {
         \ifstringcompare{\Emptystring}{\Address}
         {
           \let\Address=\Buffer % Don't add delimiters the first time
         }
         {
            \begingroup     % keep redefinition of \\ local
            \let\protect=\noexpand
            \def\\{\noexpand\\}% make \\ not expandable
           \edef\x{\endgroup
            \def\noexpand\Address{\concat\Address\Buffer}%
           }\x
         }
       }{}
    }
    \def\KeyWTelephone{Telephone}
    \def\KeyWTelefax{Telefax}
    \def\KeyWEMail{EMail}
    \setcounter{Communication}{0}
    \whiledo{\value{Communication}<4}%
    {
      \ifthenelse{\boolean{Rest}}{
        \read#1 to \Buffer
        \edef\KeyW{\expandafter\keyword\Buffer|}
        \ifstringcompare{\KeyW}{\KeyWTelephone}
        {
          \edef\Telephone{\expandafter\contents\Buffer|}
        }
        {
          \ifstringcompare{\KeyW}{\KeyWTelefax}
          {
            \edef\Telefax{\expandafter\contents\Buffer|}
          }
          {
            \ifstringcompare{\KeyW}{\KeyWEMail}
            {
              \edef\EMail{\expandafter\contents\Buffer|}
            }
            {
              \edef\PrivateNumber{\expandafter\contents\Buffer|}
            }
          }
        }
        \ifeof#1\setboolean{Rest}{false}\fi
      }{}
      \stepcounter{Communication}
   }
   \fi
 }{}
}
\endinput
%% 
%% End of file `adrlist.sty'.