Debian Codegraph @

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

raw
1 %% phone.bst
2 %% Copyright 1998-2003 Christophe Geuzaine <[email protected]>
3 %
4 % $Id: phone.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 `phone.bst'
12 % 'directory' database: only phone and fax fields
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 phone
27 cellular
28 fax
29 p.phone
30 p.cellular
31 p.fax
32 r.phone
33 r.cellular
34 r.fax
35 w.phone
36 w.cellular
37 w.fax
38 }
39 {}
40 {}
41
42 % ------------------------------------------------------------
43 % G E N E R A L
44 % ------------------------------------------------------------
45
46 FUNCTION {output}
47 { 's :=
48 s empty$
49 {}
50 { s write$
51 newline$
52 "\dirblock" write$
53 newline$
54 }
55 if$
56 }
57
58 FUNCTION {output.flag}
59 { 's :=
60 s empty$
61 {}
62 { s write$
63 newline$
64 }
65 if$
66 }
67
68 FUNCTION {not}
69 { { #0 }
70 { #1 }
71 if$
72 }
73
74 FUNCTION {and}
75 { 'skip$
76 { pop$ #0 }
77 if$
78 }
79
80 FUNCTION {or}
81 { { pop$ #1 }
82 'skip$
83 if$
84 }
85
86 FUNCTION {chop.word}
87 { 's :=
88 'len :=
89 s #1 len substring$ =
90 { s len #1 + global.max$ substring$ }
91 's
92 if$
93 }
94
95
96 % ------------------------------------------------------------
97 % S O R T I N G F U N C T I O N S
98 % ------------------------------------------------------------
99
100 FUNCTION {sortify}
101 { purify$
102 "l" change.case$
103 }
104
105 FUNCTION {sort.names}
106 { 's :=
107 #1 'nameptr :=
108 ""
109 s num.names$ 'numnames :=
110 numnames 'namesleft :=
111 { namesleft #0 > }
112 { nameptr #1 >
113 { " " * }
114 'skip$
115 if$
116 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
117 nameptr numnames = t "others" = and
118 { "et al" * }
119 { t sortify * }
120 if$
121 nameptr #1 + 'nameptr :=
122 namesleft #1 - 'namesleft :=
123 }
124 while$
125 }
126
127
128 FUNCTION {sort.raw.names}
129 { 't :=
130 "A " #2 "L'" #2
131 "An " #3 "Au " #3 "Le " #3 "La " #3
132 "The " #4 "Les " #4 "Aux " #4
133 t
134 chop.word chop.word
135 chop.word chop.word chop.word chop.word
136 chop.word chop.word chop.word
137 sortify
138 #1 global.max$ substring$
139 }
140
141 FUNCTION {name.sort}
142 { name empty$
143 { " Name field missing in entry '" cite$ * "'" * warning$ "" }
144 { name sort.names }
145 if$
146 }
147
148 FUNCTION {raw.name.sort}
149 { name empty$
150 { " Name field missing in entry '" cite$ * "'" * warning$ "" }
151 { name sort.raw.names }
152 if$
153 }
154
155 FUNCTION {presort}
156 { type$ "company" =
157 type$ "place" =
158 or
159 { raw.name.sort }
160 { name.sort }
161 if$
162 " "
163 *
164 #1 entry.max$ substring$
165 'sort.key$ :=
166 }
167
168 FUNCTION {format.first.letter}
169 { type$ "company" =
170 type$ "place" =
171 or
172 { raw.name.sort }
173 { name.sort }
174 if$
175 #1 #1 substring$
176 }
177
178
179 % ------------------------------------------------------------
180 % P R E - A N D P O S T - H E A D E R S
181 % ------------------------------------------------------------
182
183 FUNCTION {begin.bib}
184 { "\begin{thephonebook}" write$
185 newline$
186 }
187
188 FUNCTION {end.bib}
189 { newline$
190 "\end{thephonebook}" write$
191 newline$
192 }
193
194 % ------------------------------------------------------------
195 % F O R M A T S
196 % ------------------------------------------------------------
197
198 FUNCTION {format.names}
199 { 's :=
200 #1 'nameptr :=
201 s num.names$ 'numnames :=
202 numnames 'namesleft :=
203 { namesleft #0 > }
204 {
205 % CUSTOM uncomment one of the following lines to have the behaviour on the right
206 % s nameptr "{ff }{vv }{ll}{, jj}" format.name$ 't := % Christophe de Geuzaine, jr
207 % s nameptr "{f. }{vv }{ll}{, jj}" format.name$ 't := % C. de Geuzaine, jr
208 s nameptr "{vv }{ll}{ f.}{, jj}" format.name$ 't := % de Geuzaine C., jr
209 % s nameptr "{vv }{ll}{, ff}{, jj}" format.name$ 't := % de Geuzaine, Christophe, jr
210
211 nameptr #1 >
212 { namesleft #1 >
213 { ", " * t * }
214 { " {\dirandf} " * t * }
215 if$
216 }
217 't
218 if$
219 nameptr #1 + 'nameptr :=
220 namesleft #1 - 'namesleft :=
221 }
222 while$
223 }
224
225 FUNCTION {format.name}
226 { name empty$
227 { "" }
228 { name format.names }
229 if$
230 }
231
232 FUNCTION {format.phone}
233 { phone empty$
234 { "" }
235 { "\dirphoa{" phone "}" * * }
236 if$
237 }
238
239 FUNCTION {format.cellular}
240 { cellular empty$
241 { "" }
242 { "\dircela{" cellular "}" * * }
243 if$
244 }
245
246 FUNCTION {format.fax}
247 { fax empty$
248 { "" }
249 { "\dirfaxa{" fax "}" * * }
250 if$
251 }
252
253 FUNCTION {format.p.flag}
254 { p.phone empty$ not
255 p.cellular empty$ not
256 p.fax empty$ not
257 or or
258 { "\dirprif " }
259 { "" }
260 if$
261 }
262
263 FUNCTION {format.p.phone}
264 { p.phone empty$
265 { "" }
266 { "\dirpphoa{" p.phone "}" * * }
267 if$
268 }
269
270 FUNCTION {format.p.cellular}
271 { p.cellular empty$
272 { "" }
273 { "\dirpcela{" p.cellular "}" * * }
274 if$
275 }
276
277 FUNCTION {format.p.fax}
278 { p.fax empty$
279 { "" }
280 { "\dirpfaxa{" p.fax "}" * * }
281 if$
282 }
283
284 FUNCTION {format.r.flag}
285 { r.phone empty$ not
286 r.cellular empty$ not
287 r.fax empty$ not
288 or or
289 { "\dirresf " }
290 { "" }
291 if$
292 }
293
294 FUNCTION {format.r.phone}
295 { r.phone empty$
296 { "" }
297 { "\dirrphoa{" r.phone "}" * * }
298 if$
299 }
300
301 FUNCTION {format.r.cellular}
302 { r.cellular empty$
303 { "" }
304 { "\dirrcela{" r.cellular "}" * * }
305 if$
306 }
307
308 FUNCTION {format.r.fax}
309 { r.fax empty$
310 { "" }
311 { "\dirrfaxa{" r.fax "}" * * }
312 if$
313 }
314
315 FUNCTION {format.w.flag}
316 { w.phone empty$ not
317 w.cellular empty$ not
318 w.fax empty$ not
319 or or
320 { "\dirworf " }
321 { "" }
322 if$
323 }
324
325 FUNCTION {format.w.phone}
326 { w.phone empty$
327 { "" }
328 { "\dirwphoa{" w.phone "}" * * }
329 if$
330 }
331
332 FUNCTION {format.w.cellular}
333 { w.cellular empty$
334 { "" }
335 { "\dirwcela{" w.cellular "}" * * }
336 if$
337 }
338
339 FUNCTION {format.w.fax}
340 { w.fax empty$
341 { "" }
342 { "\dirwfaxa{" w.fax "}" * * }
343 if$
344 }
345
346 % ------------------------------------------------------------
347 % P E R S O N E N T R Y
348 % ------------------------------------------------------------
349
350 FUNCTION { person }
351 {
352 p.phone empty$ not
353 p.cellular empty$ not
354 p.fax empty$ not
355 r.phone empty$ not
356 r.cellular empty$ not
357 r.fax empty$ not
358 w.phone empty$ not
359 w.cellular empty$ not
360 w.fax empty$ not
361 or or or or or or or or
362 { newline$
363
364 "\dircheck{" write$
365 format.first.letter write$
366 "}" write$
367 newline$
368
369 "\diritem[" write$
370 format.name write$
371 "]{" write$
372 "d." cite$ * write$
373 "}\dirgroup" write$
374 newline$
375 "\dirblock" write$
376 newline$
377
378 format.p.flag output.flag
379 format.p.phone output
380 format.p.cellular output
381 format.p.fax output
382
383 format.r.flag output.flag
384 format.r.phone output
385 format.r.cellular output
386 format.r.fax output
387
388 format.w.flag output.flag
389 format.w.phone output
390 format.w.cellular output
391 format.w.fax output
392
393 "\direndgroup" write$
394 newline$
395 }
396 { }
397 if$
398 }
399
400 % ------------------------------------------------------------
401 % C O M P A N Y E N T R Y
402 % ------------------------------------------------------------
403
404 FUNCTION { company }
405 {
406 phone empty$ not
407 cellular empty$ not
408 fax empty$ not
409 or or
410 { newline$
411
412 "\dircheck{" write$
413 format.first.letter write$
414 "}" write$
415 newline$
416
417 "\diritem[" write$
418 name write$
419 "]{" write$
420 "d." cite$ * write$
421 "}\dirgroup" write$
422 newline$
423 "\dirblock" write$
424 newline$
425
426 format.phone output
427 format.cellular output
428 format.fax output
429
430 "\direndgroup" write$
431 newline$
432 }
433 { }
434 if$
435 }
436
437 % ------------------------------------------------------------
438 % P L A C E E N T R Y
439 % ------------------------------------------------------------
440
441 FUNCTION { place }
442 {
443 phone empty$ not
444 cellular empty$ not
445 fax empty$ not
446 or or
447 { newline$
448
449 "\dircheck{" write$
450 format.first.letter write$
451 "}" write$
452 newline$
453
454 "\diritem[" write$
455 name write$
456 "]{" write$
457 "d." cite$ * write$
458 "}\dirgroup" write$
459 newline$
460 "\dirblock" write$
461 newline$
462
463 format.phone output
464 format.cellular output
465 format.fax output
466
467 "\direndgroup" write$
468 newline$
469 }
470 { }
471 if$
472 }
473
474
475 % ------------------------------------------------------------
476 % M A I N
477 % ------------------------------------------------------------
478
479 READ
480 ITERATE {presort}
481 SORT
482 EXECUTE {begin.bib}
483 ITERATE {call.type$}
484 EXECUTE {end.bib}
485