Debian Codegraph @

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

raw
1 %% address.bst
2 %% Copyright 1998-2003 Christophe Geuzaine <[email protected]>
3 %
4 % $Id: address.bst,v 1.7 2003/09/16 07:18:07 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 `address.bst'
12 % 'directory' database: all 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 nickname
27 birthday
28 birthyear
29 address % if empty, use street, city, ...
30 street
31 city
32 state
33 zip
34 country
35 phone
36 cellular
37 fax
38 email
39 url
40 account
41 p.address % if empty, use p.street, p.city, ...
42 p.street
43 p.city
44 p.state
45 p.zip
46 p.country
47 p.phone
48 p.cellular
49 p.fax
50 p.email
51 p.url
52 p.account
53 r.address % if empty, use r.street, r.city, ...
54 r.street
55 r.city
56 r.state
57 r.zip
58 r.country
59 r.phone
60 r.cellular
61 r.fax
62 r.email
63 r.url
64 r.account
65 w.title
66 w.name
67 w.address % if empty, use w.street, w.city, ...
68 w.street
69 w.city
70 w.state
71 w.zip
72 w.country
73 w.phone
74 w.cellular
75 w.fax
76 w.email
77 w.url
78 w.account
79 note
80 }
81 {}
82 { label
83 letter
84 }
85
86 % ------------------------------------------------------------
87 % G E N E R A L
88 % ------------------------------------------------------------
89
90 FUNCTION {output}
91 { 's :=
92 s empty$
93 {}
94 { s write$
95 newline$
96 "\dirblock" write$
97 newline$
98 }
99 if$
100 }
101
102 FUNCTION {output.flag}
103 { 's :=
104 s empty$
105 {}
106 { s write$
107 newline$
108 }
109 if$
110 }
111
112
113 FUNCTION {not}
114 { { #0 }
115 { #1 }
116 if$
117 }
118
119 FUNCTION {and}
120 { 'skip$
121 { pop$ #0 }
122 if$
123 }
124
125 FUNCTION {or}
126 { { pop$ #1 }
127 'skip$
128 if$
129 }
130
131 FUNCTION {chop.word}
132 { 's :=
133 'len :=
134 s #1 len substring$ =
135 { s len #1 + global.max$ substring$ }
136 's
137 if$
138 }
139
140 % ------------------------------------------------------------
141 % S O R T I N G F U N C T I O N S
142 % ------------------------------------------------------------
143
144 FUNCTION {sortify}
145 { purify$
146 "l" change.case$
147 }
148
149 FUNCTION {sort.names}
150 { 's :=
151 #1 'nameptr :=
152 ""
153 s num.names$ 'numnames :=
154 numnames 'namesleft :=
155 { namesleft #0 > }
156 { nameptr #1 >
157 { " " * }
158 'skip$
159 if$
160 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
161 nameptr numnames = t "others" = and
162 { "et al" * }
163 { t sortify * }
164 if$
165 nameptr #1 + 'nameptr :=
166 namesleft #1 - 'namesleft :=
167 }
168 while$
169 }
170
171
172 FUNCTION {sort.raw.names}
173 { 't :=
174 "A " #2 "L'" #2
175 "An " #3 "Au " #3 "Le " #3 "La " #3
176 "The " #4 "Les " #4 "Aux " #4
177 t
178 chop.word chop.word
179 chop.word chop.word chop.word chop.word
180 chop.word chop.word chop.word
181 sortify
182 #1 global.max$ substring$
183 }
184
185 FUNCTION {name.sort}
186 { name empty$
187 { " Name field missing in entry '" cite$ * "'" * warning$ "" }
188 { name sort.names }
189 if$
190 }
191
192 FUNCTION {raw.name.sort}
193 { name empty$
194 { " Name field missing in entry '" cite$ * "'" * warning$ "" }
195 { name sort.raw.names }
196 if$
197 }
198
199 FUNCTION {presort}
200 { type$ "company" =
201 type$ "place" =
202 or
203 { raw.name.sort }
204 { name.sort }
205 if$
206 " "
207 *
208 #1 entry.max$ substring$
209 'sort.key$ :=
210 }
211
212 FUNCTION {format.first.letter}
213 { type$ "company" =
214 type$ "place" =
215 or
216 { raw.name.sort }
217 { name.sort }
218 if$
219 #1 #1 substring$
220 }
221
222 % ------------------------------------------------------------
223 % P R E - A N D P O S T - H E A D E R S
224 % ------------------------------------------------------------
225
226 FUNCTION {begin.bib}
227 { "\begin{theaddressbook}" write$
228 newline$
229 }
230
231 FUNCTION {end.bib}
232 { newline$
233 "\end{theaddressbook}" write$
234 newline$
235 }
236
237 % ------------------------------------------------------------
238 % F O R M A T S
239 % ------------------------------------------------------------
240
241 FUNCTION {format.names}
242 { 's :=
243 #1 'nameptr :=
244 s num.names$ 'numnames :=
245 numnames 'namesleft :=
246 { namesleft #0 > }
247 {
248 % CUSTOM uncomment one of the following lines to have the behaviour on the right
249 s nameptr "{ff }{vv }{ll}{, jj}" format.name$ 't := % Christophe de Geuzaine, jr
250 % s nameptr "{f. }{vv }{ll}{, jj}" format.name$ 't := % C. de Geuzaine, jr
251 % s nameptr "{vv }{ll}{ f.}{, jj}" format.name$ 't := % de Geuzaine C., jr
252 % s nameptr "{vv }{ll}{, ff}{, jj}" format.name$ 't := % de Geuzaine, Christophe, jr
253
254 nameptr #1 >
255 { namesleft #1 >
256 { ", " * t * }
257 { " {\dirandf} " * t * }
258 if$
259 }
260 't
261 if$
262 nameptr #1 + 'nameptr :=
263 namesleft #1 - 'namesleft :=
264 }
265 while$
266 }
267
268
269 FUNCTION {format.dates}
270 {
271 's :=
272 #1 'nameptr :=
273 s num.names$ 'numnames :=
274 numnames 'namesleft :=
275
276 birthyear empty$
277 { #0 'numaux := }
278 { birthyear num.names$ 'numaux :=
279 numnames numaux =
280 { }
281 { " birthdays and birthyears don't match in entry '" cite$ * "'" * warning$ }
282 if$
283 }
284 if$
285
286 % CUSTOM you shoudn't change this, but rather redefine the command \Dirbirthday.
287
288 { namesleft #0 > }
289 { s nameptr "{ff}" format.name$ 't :=
290 s nameptr "{ll}" format.name$ 'u :=
291
292 nameptr #1 >
293 { namesleft #1 >
294 { ", \dirbira{" * t * "}{" * u * "}" * }
295 { " {\dirandf} \dirbira{" * t * "}{" * u * "}" * }
296 if$
297 }
298 { "\dirbira{" t * "}{" * u * "}" * }
299 if$
300
301 numaux #0 > not
302 { }
303 { birthyear nameptr "{ll}" format.name$ 'v :=
304 "\dirbiya{" * v * "}" * }
305 if$
306
307 nameptr #1 + 'nameptr :=
308 namesleft #1 - 'namesleft :=
309 numaux #1 - 'numaux :=
310 }
311 while$
312 }
313
314 FUNCTION {format.years}
315 {
316 's :=
317 #1 'nameptr :=
318 s num.names$ 'numnames :=
319 numnames 'namesleft :=
320
321 { namesleft #0 > }
322 { s nameptr "{ll}" format.name$ 't :=
323 nameptr #1 >
324 { namesleft #1 >
325 { ", \dirbyra{" * t * "}" * }
326 { " {\dirandf} \dirbyra{" * t * "}" * }
327 if$
328 }
329 { "\dirbyra{" t * "}" * }
330 if$
331 nameptr #1 + 'nameptr :=
332 namesleft #1 - 'namesleft :=
333 }
334 while$
335 }
336
337 FUNCTION {format.name}
338 { name empty$
339 { "" }
340 { name format.names }
341 if$
342 }
343
344 FUNCTION {format.nickname}
345 { nickname empty$
346 { "" }
347 { newline$
348 "\dirnica{" nickname format.names "}" * * }
349 if$
350 }
351
352 FUNCTION {format.birthday.flag}
353 { birthyear empty$ not
354 birthday empty$ not
355 or
356 { "\dirbirf" }
357 { "" }
358 if$
359 }
360
361 FUNCTION {format.birthday}
362 { birthday empty$
363 {
364 birthyear empty$
365 { "" }
366 { birthyear format.years }
367 if$
368 }
369 { birthday format.dates }
370 if$
371 }
372
373 FUNCTION {format.address}
374 { address empty$
375 {
376 street empty$ city empty$ state empty$ zip empty$ country empty$
377 and and and and
378 { "" }
379 { "\diradda{"
380 street empty$ { "" * } { street "\dirblock " * * } if$
381 city empty$ { "" * } { city " " * * } if$
382 state empty$ { "" * } { state " " * * } if$
383 zip empty$ { "" * } { zip " " * * } if$
384 country empty$ { "" * } { country * } if$
385 "}" *
386 }
387 if$
388 }
389 { "\diradda{" address "}" * * }
390 if$
391 }
392
393 FUNCTION {format.account}
394 { account empty$
395 { "" }
396 { "\diracca{" account "}" * * }
397 if$
398 }
399
400 FUNCTION {format.phone}
401 { phone empty$
402 { "" }
403 { "\dirphoa{" phone "}" * * }
404 if$
405 }
406
407 FUNCTION {format.cellular}
408 { cellular empty$
409 { "" }
410 { "\dircela{" cellular "}" * * }
411 if$
412 }
413
414 FUNCTION {format.fax}
415 { fax empty$
416 { "" }
417 { "\dirfaxa{" fax "}" * * }
418 if$
419 }
420
421 FUNCTION {format.email}
422 { email empty$
423 { "" }
424 { "\diremaa{" email "}" * * }
425 if$
426 }
427
428 FUNCTION {format.url}
429 { url empty$
430 { "" }
431 { "\dirurla{" url "}" * * }
432 if$
433 }
434
435
436 FUNCTION {format.p.flag}
437 { p.address empty$ not
438 p.street empty$ not
439 p.city empty$ not
440 p.state empty$ not
441 p.zip empty$ not
442 p.country empty$ not
443 p.phone empty$ not
444 p.cellular empty$ not
445 p.fax empty$ not
446 p.email empty$ not
447 p.url empty$ not
448 p.account empty$ not
449 or or or or or or or or or or or
450 { "\dirprif" }
451 { "" }
452 if$
453 }
454
455 FUNCTION {format.p.address}
456 { p.address empty$
457 {
458 p.street empty$ p.city empty$ p.state empty$ p.zip empty$ p.country empty$
459 and and and and
460 { "" }
461 { "\dirpadda{"
462 p.street empty$ { "" * } { p.street "\dirblock " * * } if$
463 p.city empty$ { "" * } { p.city " " * * } if$
464 p.state empty$ { "" * } { p.state " " * * } if$
465 p.zip empty$ { "" * } { p.zip " " * * } if$
466 p.country empty$ { "" * } { p.country * } if$
467 "}" *
468 }
469 if$
470 }
471 { "\dirpadda{" p.address "}" * * }
472 if$
473 }
474
475 FUNCTION {format.p.phone}
476 { p.phone empty$
477 { "" }
478 { "\dirpphoa{" p.phone "}" * * }
479 if$
480 }
481
482 FUNCTION {format.p.cellular}
483 { p.cellular empty$
484 { "" }
485 { "\dirpcela{" p.cellular "}" * * }
486 if$
487 }
488
489 FUNCTION {format.p.fax}
490 { p.fax empty$
491 { "" }
492 { "\dirpfaxa{" p.fax "}" * * }
493 if$
494 }
495
496 FUNCTION {format.p.email}
497 { p.email empty$
498 { "" }
499 { "\dirpemaa{" p.email "}" * * }
500 if$
501 }
502
503 FUNCTION {format.p.url}
504 { p.url empty$
505 { "" }
506 { "\dirpurla{" p.url "}" * * }
507 if$
508 }
509
510 FUNCTION {format.p.account}
511 { p.account empty$
512 { "" }
513 { "\dirpacca{" p.account "}" * * }
514 if$
515 }
516
517 FUNCTION {format.r.flag}
518 { r.address empty$ not
519 r.street empty$ not
520 r.city empty$ not
521 r.state empty$ not
522 r.zip empty$ not
523 r.country empty$ not
524 r.phone empty$ not
525 r.cellular empty$ not
526 r.fax empty$ not
527 r.email empty$ not
528 r.url empty$ not
529 r.account empty$ not
530 or or or or or or or or or or or
531 { "\dirresf" }
532 { "" }
533 if$
534 }
535
536 FUNCTION {format.r.address}
537 { r.address empty$
538 {
539 r.street empty$ r.city empty$ r.state empty$ r.zip empty$ r.country empty$
540 and and and and
541 { "" }
542 { "\dirpadda{"
543 r.street empty$ { "" * } { r.street "\dirblock " * * } if$
544 r.city empty$ { "" * } { r.city " " * * } if$
545 r.state empty$ { "" * } { r.state " " * * } if$
546 r.zip empty$ { "" * } { r.zip " " * * } if$
547 r.country empty$ { "" * } { r.country * } if$
548 "}" *
549 }
550 if$
551 }
552 { "\dirradda{" r.address "}" * * }
553 if$
554 }
555
556 FUNCTION {format.r.phone}
557 { r.phone empty$
558 { "" }
559 { "\dirrphoa{" r.phone "}" * * }
560 if$
561 }
562
563 FUNCTION {format.r.cellular}
564 { r.cellular empty$
565 { "" }
566 { "\dirrcela{" r.cellular "}" * * }
567 if$
568 }
569
570 FUNCTION {format.r.fax}
571 { r.fax empty$
572 { "" }
573 { "\dirrfaxa{" r.fax "}" * * }
574 if$
575 }
576
577 FUNCTION {format.r.email}
578 { r.email empty$
579 { "" }
580 { "\dirremaa{" r.email "}" * * }
581 if$
582 }
583
584 FUNCTION {format.r.url}
585 { r.url empty$
586 { "" }
587 { "\dirrurla{" r.url "}" * * }
588 if$
589 }
590
591 FUNCTION {format.r.account}
592 { r.account empty$
593 { "" }
594 { "\dirracca{" r.account "}" * * }
595 if$
596 }
597
598 FUNCTION {format.w.flag}
599 { w.title empty$ not
600 w.name empty$ not
601 w.address empty$ not
602 w.street empty$ not
603 w.city empty$ not
604 w.state empty$ not
605 w.zip empty$ not
606 w.country empty$ not
607 w.phone empty$ not
608 w.cellular empty$ not
609 w.fax empty$ not
610 w.email empty$ not
611 w.url empty$ not
612 w.account empty$ not
613 or or or or or or or or or or or or or
614 { "\dirworf" }
615 { "" }
616 if$
617 }
618
619 FUNCTION {format.w.title}
620 { w.title empty$
621 { "" }
622 { "\dirtita{" w.title "}" * * }
623 if$
624 }
625
626 FUNCTION {format.w.name}
627 { w.name empty$
628 { "" }
629 { "\dirnama{" w.name "}" * * }
630 if$
631 }
632
633 FUNCTION {format.w.address}
634 { w.address empty$
635 {
636 w.street empty$ w.city empty$ w.state empty$ w.zip empty$ w.country empty$
637 and and and and
638 { "" }
639 { "\dirpadda{"
640 w.street empty$ { "" * } { w.street "\dirblock " * * } if$
641 w.city empty$ { "" * } { w.city " " * * } if$
642 w.state empty$ { "" * } { w.state " " * * } if$
643 w.zip empty$ { "" * } { w.zip " " * * } if$
644 w.country empty$ { "" * } { w.country * } if$
645 "}" *
646 }
647 if$
648 }
649 { "\dirwadda{" w.address "}" * * }
650 if$
651 }
652
653 FUNCTION {format.w.phone}
654 { w.phone empty$
655 { "" }
656 { "\dirwphoa{" w.phone "}" * * }
657 if$
658 }
659
660 FUNCTION {format.w.cellular}
661 { w.cellular empty$
662 { "" }
663 { "\dirwcela{" w.cellular "}" * * }
664 if$
665 }
666
667 FUNCTION {format.w.fax}
668 { w.fax empty$
669 { "" }
670 { "\dirwfaxa{" w.fax "}" * * }
671 if$
672 }
673
674 FUNCTION {format.w.email}
675 { w.email empty$
676 { "" }
677 { "\dirwemaa{" w.email "}" * * }
678 if$
679 }
680
681 FUNCTION {format.w.url}
682 { w.url empty$
683 { "" }
684 { "\dirwurla{" w.url "}" * * }
685 if$
686 }
687
688 FUNCTION {format.w.account}
689 { w.account empty$
690 { "" }
691 { "\dirwacca{" w.account "}" * * }
692 if$
693 }
694
695 FUNCTION {format.note.flag}
696 { note empty$
697 { "" }
698 { "\dirnotf" }
699 if$
700 }
701
702 FUNCTION {format.note}
703 { note empty$
704 { "" }
705 { "\dirnota{" note "}" * * }
706 if$
707 }
708
709
710 % ------------------------------------------------------------
711 % P E R S O N E N T R Y
712 % ------------------------------------------------------------
713
714 FUNCTION { person }
715 {
716 newline$
717
718 "\dircheck{" write$
719 format.first.letter write$
720 "}" write$
721 newline$
722
723 "\diritem[" write$
724 format.name write$
725 "]{" write$
726 "d." cite$ * write$
727 "}\dirgroup" write$
728 format.nickname write$
729 newline$
730 "\dirblock" write$
731 newline$
732
733 format.birthday.flag output.flag
734 format.birthday output
735
736 format.p.flag output.flag
737 format.p.address output
738 format.p.phone output
739 format.p.cellular output
740 format.p.fax output
741 format.p.email output
742 format.p.url output
743 format.p.account output
744
745 format.r.flag output.flag
746 format.r.address output
747 format.r.phone output
748 format.r.cellular output
749 format.r.fax output
750 format.r.email output
751 format.r.url output
752 format.r.account output
753
754 format.w.flag output.flag
755 format.w.title output
756 format.w.name output
757 format.w.address output
758 format.w.phone output
759 format.w.cellular output
760 format.w.fax output
761 format.w.email output
762 format.w.url output
763 format.w.account output
764
765 format.note.flag output.flag
766 format.note output
767
768 "\direndgroup" write$
769 newline$
770 }
771
772 % ------------------------------------------------------------
773 % C O M P A N Y E N T R Y
774 % ------------------------------------------------------------
775
776
777 FUNCTION { company }
778 {
779 newline$
780
781 "\dircheck{" write$
782 format.first.letter write$
783 "}" write$
784 newline$
785
786 "\diritem[" write$
787 name write$
788 "]{" write$
789 "d." cite$ * write$
790 "}\dirgroup" write$
791 newline$
792 "\dirblock" write$
793 newline$
794
795 format.address output
796 format.phone output
797 format.cellular output
798 format.fax output
799 format.email output
800 format.url output
801 format.account output
802 format.note.flag output.flag
803 format.note output
804
805 "\direndgroup" write$
806 newline$
807 }
808
809 % ------------------------------------------------------------
810 % P L A C E E N T R Y
811 % ------------------------------------------------------------
812
813 FUNCTION { place }
814 {
815 newline$
816
817 "\dircheck{" write$
818 format.first.letter write$
819 "}" write$
820 newline$
821
822 "\diritem[" write$
823 name write$
824 "]{" write$
825 "d." cite$ * write$
826 "}\dirgroup" write$
827 newline$
828 "\dirblock" write$
829 newline$
830
831 format.address output
832 format.phone output
833 format.cellular output
834 format.fax output
835 format.note.flag output.flag
836 format.note output
837
838 "\direndgroup" write$
839 newline$
840 }
841
842 % ------------------------------------------------------------
843 % M A I N
844 % ------------------------------------------------------------
845
846 READ
847 ITERATE {presort}
848 SORT
849 EXECUTE {begin.bib}
850 ITERATE {call.type$}
851 EXECUTE {end.bib}
852