Debian Codegraph @

texmf-dist/bibtex/bst/directory/birthday.bst

raw
1 %% birthday.bst
2 %% Copyright 1998-2003 Christophe Geuzaine <[email protected]>
3 %
4 % $Id: birthday.bst,v 1.6 2003/09/14 09:47:49 geuzaine Exp $
5 %
6 % This program can be redistributed and/or modified under the terms
7 % of the LaTeX Project Public License distributed from CTAN
8 % archives in directory macros/latex/base/lppl.txt; either
9 % version 1 of the License, or (at your option) any later version.
10 %
11 % BibTeX bibliography style `birthday.bst'
12 % 'directory' database: only birthday field
13 %
14 % The parts you may want to customize are labeled with "CUSTOM"
15 %
16
17 INTEGERS { nameptr namesleft numnames numaux len }
18 STRINGS { s t u v }
19
20 % ------------------------------------------------------------
21 % E N T R I E S
22 % ------------------------------------------------------------
23
24 ENTRY
25 { name
26 birthday
27 birthyear
28 }
29 {}
30 {}
31
32 % ------------------------------------------------------------
33 % G E N E R A L
34 % ------------------------------------------------------------
35
36 FUNCTION {output}
37 { 's :=
38 s empty$
39 {}
40 { s write$
41 newline$
42 "\dirblock" write$
43 newline$
44 }
45 if$
46 }
47
48 FUNCTION {not}
49 { { #0 }
50 { #1 }
51 if$
52 }
53
54 FUNCTION {or}
55 { { pop$ #1 }
56 'skip$
57 if$
58 }
59
60 % ------------------------------------------------------------
61 % S O R T I N G F U N C T I O N S
62 % ------------------------------------------------------------
63
64 FUNCTION {sortify}
65 { purify$
66 "l" change.case$
67 }
68
69 FUNCTION {sort.day}
70 {
71 's :=
72 #1 'nameptr :=
73 ""
74 s num.names$ 'numnames :=
75 skip$
76 s nameptr "{ll{}}{ff{}}" format.name$ 't :=
77 t sortify *
78 #1 global.max$ substring$
79 }
80
81
82 FUNCTION {birthday.sort}
83 { type$ "person" =
84 { birthday empty$
85 { "" }
86 { birthday sort.day }
87 if$ }
88 { "" }
89 if$
90 }
91
92 FUNCTION {presort}
93 { birthday.sort
94 " "
95 *
96 #1 entry.max$ substring$
97 'sort.key$ :=
98 }
99
100 % ------------------------------------------------------------
101 % P R E - A N D P O S T - H E A D E R S
102 % ------------------------------------------------------------
103
104 FUNCTION {begin.bib}
105 { "\begin{thephonebook}" write$
106 newline$
107 }
108
109 FUNCTION {end.bib}
110 { newline$
111 "\end{thephonebook}" write$
112 newline$
113 }
114
115 % ------------------------------------------------------------
116 % F O R M A T S
117 % ------------------------------------------------------------
118
119 FUNCTION {format.names}
120 { 's :=
121 #1 'nameptr :=
122 s num.names$ 'numnames :=
123 numnames 'namesleft :=
124 { namesleft #0 > }
125 {
126 % CUSTOM uncomment one of the following lines to have the behaviour on the right
127 s nameptr "{ff }{vv }{ll}{, jj}" format.name$ 't := % Christophe de Geuzaine, jr
128 % s nameptr "{f. }{vv }{ll}{, jj}" format.name$ 't := % C. de Geuzaine, jr
129 % s nameptr "{vv }{ll}{ f.}{, jj}" format.name$ 't := % de Geuzaine C., jr
130 % s nameptr "{vv }{ll}{, ff}{, jj}" format.name$ 't := % de Geuzaine, Christophe, jr
131
132 nameptr #1 >
133 { namesleft #1 >
134 { ", " * t * }
135 { " {\dirandf} " * t * }
136 if$
137 }
138 't
139 if$
140 nameptr #1 + 'nameptr :=
141 namesleft #1 - 'namesleft :=
142 }
143 while$
144 }
145
146
147 FUNCTION {format.dates}
148 {
149 's :=
150 #1 'nameptr :=
151 s num.names$ 'numnames :=
152 numnames 'namesleft :=
153
154 birthyear empty$
155 { #0 'numaux := }
156 { birthyear num.names$ 'numaux :=
157 numnames numaux =
158 { }
159 { " birthdays and birthyears don't match in entry '" cite$ * "'" * warning$ }
160 if$
161 }
162 if$
163
164 % CUSTOM you shoudn't change this, but rather redefine the command \Dirbirthday.
165
166 { namesleft #0 > }
167 { s nameptr "{ff}" format.name$ 't :=
168 s nameptr "{ll}" format.name$ 'u :=
169
170 nameptr #1 >
171 { namesleft #1 >
172 { ", \dirbira{" * t * "}{" * u * "}" * }
173 { " {\dirandf} \dirbira{" * t * "}{" * u * "}" * }
174 if$
175 }
176 { "\dirbira{" t * "}{" * u * "}" * }
177 if$
178
179 numaux #0 > not
180 { }
181 { birthyear nameptr "{ll}" format.name$ 'v :=
182 "\dirbiya{" * v * "}" * }
183 if$
184
185 nameptr #1 + 'nameptr :=
186 namesleft #1 - 'namesleft :=
187 numaux #1 - 'numaux :=
188 }
189 while$
190 }
191
192 FUNCTION {format.years}
193 {
194 's :=
195 #1 'nameptr :=
196 s num.names$ 'numnames :=
197 numnames 'namesleft :=
198
199 { namesleft #0 > }
200 { s nameptr "{ll}" format.name$ 't :=
201 nameptr #1 >
202 { namesleft #1 >
203 { ", \dirbyra{" * t * "}" * }
204 { " {\dirandf} \dirbyra{" * t * "}" * }
205 if$
206 }
207 { "\dirbyra{" t * "}" * }
208 if$
209 nameptr #1 + 'nameptr :=
210 namesleft #1 - 'namesleft :=
211 }
212 while$
213 }
214
215 FUNCTION {format.name}
216 { name empty$
217 { "" }
218 { name format.names }
219 if$
220 }
221
222 FUNCTION {format.birthday.flag}
223 { birthyear empty$ not
224 birthday empty$ not
225 or
226 { "\dirbirf " }
227 { "" }
228 if$
229 }
230
231 FUNCTION {format.birthday}
232 { birthday empty$
233 {
234 birthyear empty$
235 { "" }
236 { birthyear format.years }
237 if$
238 }
239 { birthday format.dates }
240 if$
241 }
242
243 % ------------------------------------------------------------
244 % P E R S O N E N T R Y
245 % ------------------------------------------------------------
246
247
248 FUNCTION { person }
249 {
250 birthday empty$ not
251 { newline$
252
253 "\diritem[" write$
254 format.birthday.flag write$
255 format.birthday write$
256 "]{" write$
257 "d." cite$ * write$
258 "}\dirgroup" write$
259 newline$
260 "\dirblock" write$
261 newline$
262
263 format.name output
264
265 "\direndgroup" write$
266 newline$
267 }
268 { }
269 if$
270 }
271
272 % ------------------------------------------------------------
273 % C O M P A N Y E N T R Y
274 % ------------------------------------------------------------
275
276 FUNCTION { company }
277 {
278 }
279
280 % ------------------------------------------------------------
281 % P L A C E E N T R Y
282 % ------------------------------------------------------------
283
284 FUNCTION { place }
285 {
286 }
287
288
289 % ------------------------------------------------------------
290 % M A I N
291 % ------------------------------------------------------------
292
293 READ
294 ITERATE {presort}
295 SORT
296 EXECUTE {begin.bib}
297 ITERATE {call.type$}
298 EXECUTE {end.bib}
299