]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/web/texi-web.bst
Metronome-mark: align on key-signature too.
[lilypond.git] / Documentation / web / texi-web.bst
1 % 18/aug/2010:
2 %    - changed into texi-long.bst by Graham Percival for GNU LilyPond
3 %    - only a minimum of changes were made; some html remains in
4 %      this file, but it does not appear in our output
5 % BibTeX bibliography style `html-long'
6 %   spits out texinfo-formatted bibliography in place of bbl output
7 % by David Kotz dfk@cs.dartmouth.edu
8 % $Id: html-long.bst,v 1.4 2005/07/21 21:29:50 hjunes Exp $
9 %    modified from
10 % BibTeX standard bibliography style `alpha'
11         % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
12         % Copyright (C) 1985, all rights reserved.
13         % Copying of this file is authorized only if either
14         % (1) you make absolutely no changes to your copy, including name, or
15         % (2) if you do make changes, you name it something other than
16         % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
17         % This restriction helps ensure that all standard styles are identical.
18         % The file btxbst.doc has the documentation for this style.
19
20 % DFK added abstract, comment, earlier, keyword, later, URL
21 ENTRY
22   { abstract
23     address
24     author
25     booktitle
26     chapter
27     comment
28     earlier
29     edition
30     editor
31     howpublished
32     institution
33     journal
34     key
35     keyword
36     later
37     month
38     note
39     number
40     organization
41     pages
42     private
43     publisher
44     school
45     series
46     title
47     type
48     URL
49     volume
50     year
51   }
52   {}
53   { label extra.label sort.label }
54
55 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
56
57 FUNCTION {init.state.consts}
58 { #0 'before.all :=
59   #1 'mid.sentence :=
60   #2 'after.sentence :=
61   #3 'after.block :=
62 }
63
64 STRINGS { s t }
65
66 FUNCTION {output.nonnull}
67 { 's :=
68   output.state mid.sentence =
69     { ", " * write$ }
70     { output.state after.block =
71         { add.period$ write$
72           newline$
73         }
74         { output.state before.all =
75              'write$
76              { add.period$ " " * write$ }
77             if$
78         }
79       if$
80       mid.sentence 'output.state :=
81     }
82   if$
83   s
84 }
85
86 FUNCTION {output}
87 { duplicate$ empty$
88     'pop$
89     'output.nonnull
90   if$
91 }
92
93 FUNCTION {output.check}
94 { 't :=
95   duplicate$ empty$
96     { pop$ "empty " t * " in " * cite$ * warning$ }
97     'output.nonnull
98   if$
99 }
100
101 % DFK changed to use cite$ for the label
102 % DFK changed to texinfo, and use URL to make cite key a link
103 FUNCTION {output.bibitem}
104 { newline$
105   URL empty$
106     { "@item " write$
107     }
108     { "" quote$ * cite$ * quote$ * " HREF=" * quote$ *
109         URL * quote$ * "> " * cite$ * ":</A></DT>" * write$
110     }
111   if$
112   newline$
113 %  "" write$ newline$
114   ""
115   before.all 'output.state :=
116 }
117
118 % DFK changed to HTML
119 FUNCTION {fin.entry}
120 { add.period$
121   write$
122   newline$
123   earlier empty$
124         'skip$
125         { "<br>" write$ newline$
126           "See also earlier version <A HREF=" quote$ * "#" * earlier * quote$ *
127                 ">" * earlier * "</A>." * write$ newline$
128         }
129   if$
130   later empty$
131         'skip$
132         { "<br>" write$ newline$
133           "See also later version <A HREF=" quote$ * "#" * later * quote$ *
134                 ">" * later * "</A>." * write$ newline$
135         }
136   if$
137 %  "" write$ newline$
138 }
139
140 FUNCTION {new.block}
141 { output.state before.all =
142     'skip$
143     { after.block 'output.state := }
144   if$
145 }
146
147 FUNCTION {new.sentence}
148 { output.state after.block =
149     'skip$
150     { output.state before.all =
151         'skip$
152         { after.sentence 'output.state := }
153       if$
154     }
155   if$
156 }
157
158 FUNCTION {not}
159 {   { #0 }
160     { #1 }
161   if$
162 }
163
164 FUNCTION {and}
165 {   'skip$
166     { pop$ #0 }
167   if$
168 }
169
170 FUNCTION {or}
171 {   { pop$ #1 }
172     'skip$
173   if$
174 }
175
176 FUNCTION {new.block.checka}
177 { empty$
178     'skip$
179     'new.block
180   if$
181 }
182
183 FUNCTION {new.block.checkb}
184 { empty$
185   swap$ empty$
186   and
187     'skip$
188     'new.block
189   if$
190 }
191
192 FUNCTION {new.sentence.checka}
193 { empty$
194     'skip$
195     'new.sentence
196   if$
197 }
198
199 FUNCTION {new.sentence.checkb}
200 { empty$
201   swap$ empty$
202   and
203     'skip$
204     'new.sentence
205   if$
206 }
207
208 FUNCTION {field.or.null}
209 { duplicate$ empty$
210     { pop$ "" }
211     'skip$
212   if$
213 }
214
215 % DFK changed to texinfo
216 FUNCTION {emphasize}
217 { duplicate$ empty$
218     { pop$ "" }
219     { "@emph{" swap$ * "}" * }
220   if$
221 }
222
223 % DFK added for texinfo strong emphasis
224 FUNCTION {strong}
225 { duplicate$ empty$
226     { pop$ "" }
227     { "@strong{" swap$ * "}" * }
228   if$
229 }
230
231 INTEGERS { nameptr namesleft numnames }
232
233 % DFK added this, to strip {} and ~ from titles and authors
234 % It's not a great idea, because it will screw up in math mode and some
235 % special characters... but it makes most things much prettier.
236 FUNCTION {author.title.purify}
237 { 't :=
238   ""
239     { t empty$ not }
240     { t #1 #1 substring$ "{" =
241       t #1 #1 substring$ "}" = or
242         'skip$
243         { t #1 #1 substring$ "~" =
244             { " " * }
245             { t #1 #1 substring$ * }
246         if$
247         }
248       if$
249       t #2 global.max$ substring$ 't :=
250     }
251   while$
252 }
253
254 FUNCTION {format.names}
255 { 's :=
256   #1 'nameptr :=
257   s num.names$ 'numnames :=
258   numnames 'namesleft :=
259     { namesleft #0 > }
260     { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
261       nameptr #1 >
262         { namesleft #1 >
263             { ", " * t * }
264             { numnames #2 >
265                 { "," * }
266                 'skip$
267               if$
268               t "others" =
269                 { " et&nbsp;al." * }
270                 { " and " * t * }
271               if$
272             }
273           if$
274         }
275         't
276       if$
277       nameptr #1 + 'nameptr :=
278       namesleft #1 - 'namesleft :=
279     }
280   while$
281 }
282
283 FUNCTION {format.authors}
284 { author empty$
285     { "" }
286     { author format.names  author.title.purify }
287   if$
288 }
289
290 FUNCTION {format.editors}
291 { editor empty$
292     { "" }
293     { editor format.names author.title.purify
294       editor num.names$ #1 >
295         { ", editors" * }
296         { ", editor" * }
297       if$
298     }
299   if$
300 }
301
302 % DFK added strong, so it will be bold.
303 FUNCTION {format.title}
304 { title empty$
305     { "" }
306     { title "t" change.case$  author.title.purify strong }
307   if$
308 }
309
310 FUNCTION {n.dashify}
311 { 't :=
312   ""
313     { t empty$ not }
314     { t #1 #1 substring$ "-" =
315         { t #1 #2 substring$ "--" = not
316             { "--" *
317               t #2 global.max$ substring$ 't :=
318             }
319             {   { t #1 #1 substring$ "-" = }
320                 { "-" *
321                   t #2 global.max$ substring$ 't :=
322                 }
323               while$
324             }
325           if$
326         }
327         { t #1 #1 substring$ *
328           t #2 global.max$ substring$ 't :=
329         }
330       if$
331     }
332   while$
333 }
334
335 FUNCTION {format.date}
336 { year empty$
337     { month empty$
338         { "" }
339         { "there's a month but no year in " cite$ * warning$
340           month
341         }
342       if$
343     }
344     { month empty$
345         'year
346         { month " " * year * }
347       if$
348     }
349   if$
350 }
351
352 % DFK changed emphasize to strong
353 FUNCTION {format.btitle}
354 { title author.title.purify strong
355 }
356
357 FUNCTION {tie.or.space.connect}
358 { duplicate$ text.length$ #3 <
359     { "&nbsp;" }
360     { " " }
361   if$
362   swap$ * *
363 }
364
365 FUNCTION {either.or.check}
366 { empty$
367     'pop$
368     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
369   if$
370 }
371
372 FUNCTION {format.bvolume}
373 { volume empty$
374     { "" }
375     { "volume" volume tie.or.space.connect
376       series empty$
377         'skip$
378         { " of " * series emphasize * }
379       if$
380       "volume and number" number either.or.check
381     }
382   if$
383 }
384
385 FUNCTION {format.number.series}
386 { volume empty$
387     { number empty$
388         { series field.or.null }
389         { output.state mid.sentence =
390             { "number" }
391             { "Number" }
392           if$
393           number tie.or.space.connect
394           series empty$
395             { "there's a number but no series in " cite$ * warning$ }
396             { " in " * series * }
397           if$
398         }
399       if$
400     }
401     { "" }
402   if$
403 }
404
405 FUNCTION {format.edition}
406 { edition empty$
407     { "" }
408     { output.state mid.sentence =
409         { edition "l" change.case$ " edition" * }
410         { edition "t" change.case$ " edition" * }
411       if$
412     }
413   if$
414 }
415
416 INTEGERS { multiresult }
417
418 FUNCTION {multi.page.check}
419 { 't :=
420   #0 'multiresult :=
421     { multiresult not
422       t empty$ not
423       and
424     }
425     { t #1 #1 substring$
426       duplicate$ "-" =
427       swap$ duplicate$ "," =
428       swap$ "+" =
429       or or
430         { #1 'multiresult := }
431         { t #2 global.max$ substring$ 't := }
432       if$
433     }
434   while$
435   multiresult
436 }
437
438 FUNCTION {format.pages}
439 { pages empty$
440     { "" }
441     { pages multi.page.check
442         { "pages" pages n.dashify tie.or.space.connect }
443         { "page" pages tie.or.space.connect }
444       if$
445     }
446   if$
447 }
448
449 FUNCTION {format.vol.num.pages}
450 { volume field.or.null
451   number empty$
452     'skip$
453     { "(" number * ")" * *
454       volume empty$
455         { "there's a number but no volume in " cite$ * warning$ }
456         'skip$
457       if$
458     }
459   if$
460   pages empty$
461     'skip$
462     { duplicate$ empty$
463         { pop$ format.pages }
464         { ":" * pages n.dashify * }
465       if$
466     }
467   if$
468 }
469
470 FUNCTION {format.chapter.pages}
471 { chapter empty$
472     'format.pages
473     { type empty$
474         { "chapter" }
475         { type "l" change.case$ }
476       if$
477       chapter tie.or.space.connect
478       pages empty$
479         'skip$
480         { ", " * format.pages * }
481       if$
482     }
483   if$
484 }
485
486 FUNCTION {format.in.ed.booktitle}
487 { booktitle empty$
488     { "" }
489     { editor empty$
490         { "In " booktitle emphasize * }
491         { "In " format.editors * ", " * booktitle emphasize * }
492       if$
493     }
494   if$
495 }
496
497 FUNCTION {empty.misc.check}
498 { author empty$ title empty$ howpublished empty$
499   month empty$ year empty$ note empty$
500   and and and and and
501   key empty$ not and
502     { "all relevant fields are empty in " cite$ * warning$ }
503     'skip$
504   if$
505 }
506
507 FUNCTION {format.thesis.type}
508 { type empty$
509     'skip$
510     { pop$
511       type "t" change.case$
512     }
513   if$
514 }
515
516 FUNCTION {format.tr.number}
517 { type empty$
518     { "Technical Report" }
519     'type
520   if$
521   number empty$
522     { "t" change.case$ }
523     { number tie.or.space.connect }
524   if$
525 }
526
527 FUNCTION {format.article.crossref}
528 { key empty$
529     { journal empty$
530         { "need key or journal for " cite$ * " to crossref " * crossref *
531           warning$
532           ""
533         }
534         { "In {\em " journal * "\/}" * }
535       if$
536     }
537     { "In " key * }
538   if$
539   " \cite{" * crossref * "}" *
540 }
541
542 FUNCTION {format.crossref.editor}
543 { editor #1 "{vv~}{ll}" format.name$
544   editor num.names$ duplicate$
545   #2 >
546     { pop$ " et&nbsp;al." * }
547     { #2 <
548         'skip$
549         { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
550             { " et&nbsp;al." * }
551             { " and " * editor #2 "{vv~}{ll}" format.name$ * }
552           if$
553         }
554       if$
555     }
556   if$
557 }
558
559 FUNCTION {format.book.crossref}
560 { volume empty$
561     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
562       "In "
563     }
564     { "Volume" volume tie.or.space.connect
565       " of " *
566     }
567   if$
568   editor empty$
569   editor field.or.null author field.or.null =
570   or
571     { key empty$
572         { series empty$
573             { "need editor, key, or series for " cite$ * " to crossref " *
574               crossref * warning$
575               "" *
576             }
577             { "{\em " * series * "\/}" * }
578           if$
579         }
580         { key * }
581       if$
582     }
583     { format.crossref.editor * }
584   if$
585   " \cite{" * crossref * "}" *
586 }
587
588 FUNCTION {format.incoll.inproc.crossref}
589 { editor empty$
590   editor field.or.null author field.or.null =
591   or
592     { key empty$
593         { booktitle empty$
594             { "need editor, key, or booktitle for " cite$ * " to crossref " *
595               crossref * warning$
596               ""
597             }
598             { "In {\em " booktitle * "\/}" * }
599           if$
600         }
601         { "In " key * }
602       if$
603     }
604     { "In " format.crossref.editor * }
605   if$
606   " \cite{" * crossref * "}" *
607 }
608
609
610 % DFK added
611 % top of stack is the string we want to be a quoted paragraph
612 FUNCTION {format.quotedParagraph}
613 { duplicate$ empty$
614     { skip$ }
615     { "<P><QUOTE> " swap$ * "  </QUOTE></P>" *}
616   if$
617 }
618
619
620 % DFK added, to support comment, private, keyword, etc
621 % next-to-top is field name (eg, "Comment")
622 % top is field value (eg, value of comment)
623 % both are popped; resulting top is either empty,
624 %    or string describing field
625 FUNCTION {format.dfkfield}
626 { duplicate$ empty$
627         { pop$ pop$ "" }
628         { swap$
629           "<strong> " swap$ * ":</strong> " * swap$ * }
630   if$
631 }
632
633 % DFK added
634 FUNCTION {dfk.stuff}
635 { new.block
636   "Abstract" abstract format.dfkfield format.quotedParagraph write$ newline$
637   "Keyword" keyword format.dfkfield format.quotedParagraph write$ newline$
638   "Comment" comment format.dfkfield format.quotedParagraph write$ newline$
639 }
640
641 % DFK: added a call to dfk.stuff in all entry-type functions below
642
643 FUNCTION {article}
644 { output.bibitem
645   format.authors "author" output.check
646   new.block
647   format.title "title" output.check
648   new.block
649   crossref missing$
650     { journal emphasize "journal" output.check
651       format.vol.num.pages output
652       format.date "year" output.check
653     }
654     { format.article.crossref output.nonnull
655       format.pages output
656     }
657   if$
658   new.block
659   note output
660   fin.entry
661   dfk.stuff
662 }
663
664 FUNCTION {book}
665 { output.bibitem
666   author empty$
667     { format.editors "author and editor" output.check }
668     { format.authors output.nonnull
669       crossref missing$
670         { "author and editor" editor either.or.check }
671         'skip$
672       if$
673     }
674   if$
675   new.block
676   format.btitle "title" output.check
677   crossref missing$
678     { format.bvolume output
679       new.block
680       format.number.series output
681       new.sentence
682       publisher "publisher" output.check
683       address output
684     }
685     { new.block
686       format.book.crossref output.nonnull
687     }
688   if$
689   format.edition output
690   format.date "year" output.check
691   new.block
692   note output
693   fin.entry
694   dfk.stuff
695 }
696
697 FUNCTION {booklet}
698 { output.bibitem
699   format.authors output
700   new.block
701   format.title "title" output.check
702   howpublished address new.block.checkb
703   howpublished output
704   address output
705   format.date output
706   new.block
707   note output
708   fin.entry
709   dfk.stuff
710 }
711
712 FUNCTION {inbook}
713 { output.bibitem
714   author empty$
715     { format.editors "author and editor" output.check }
716     { format.authors output.nonnull
717       crossref missing$
718         { "author and editor" editor either.or.check }
719         'skip$
720       if$
721     }
722   if$
723   new.block
724   format.btitle "title" output.check
725   crossref missing$
726     { format.bvolume output
727       format.chapter.pages "chapter and pages" output.check
728       new.block
729       format.number.series output
730       new.sentence
731       publisher "publisher" output.check
732       address output
733     }
734     { format.chapter.pages "chapter and pages" output.check
735       new.block
736       format.book.crossref output.nonnull
737     }
738   if$
739   format.edition output
740   format.date "year" output.check
741   new.block
742   note output
743   fin.entry
744   dfk.stuff
745 }
746
747 FUNCTION {incollection}
748 { output.bibitem
749   format.authors "author" output.check
750   new.block
751   format.title "title" output.check
752   new.block
753   crossref missing$
754     { format.in.ed.booktitle "booktitle" output.check
755       format.bvolume output
756       format.number.series output
757       format.chapter.pages output
758       new.sentence
759       publisher "publisher" output.check
760       address output
761       format.edition output
762       format.date "year" output.check
763     }
764     { format.incoll.inproc.crossref output.nonnull
765       format.chapter.pages output
766     }
767   if$
768   new.block
769   note output
770   fin.entry
771   dfk.stuff
772 }
773
774 FUNCTION {inproceedings}
775 { output.bibitem
776   format.authors "author" output.check
777   new.block
778   format.title "title" output.check
779   new.block
780   crossref missing$
781     { format.in.ed.booktitle "booktitle" output.check
782       format.bvolume output
783       format.number.series output
784       format.pages output
785       address empty$
786         { organization publisher new.sentence.checkb
787           organization output
788           publisher output
789           format.date "year" output.check
790         }
791         { address output.nonnull
792           format.date "year" output.check
793           new.sentence
794           organization output
795           publisher output
796         }
797       if$
798     }
799     { format.incoll.inproc.crossref output.nonnull
800       format.pages output
801     }
802   if$
803   new.block
804   note output
805   fin.entry
806   dfk.stuff
807 }
808
809 FUNCTION {conference} { inproceedings }
810
811 FUNCTION {manual}
812 { output.bibitem
813   author empty$
814     { organization empty$
815         'skip$
816         { organization output.nonnull
817           address output
818         }
819       if$
820     }
821     { format.authors output.nonnull }
822   if$
823   new.block
824   format.btitle "title" output.check
825   author empty$
826     { organization empty$
827         { address new.block.checka
828           address output
829         }
830         'skip$
831       if$
832     }
833     { organization address new.block.checkb
834       organization output
835       address output
836     }
837   if$
838   format.edition output
839   format.date output
840   new.block
841   note output
842   fin.entry
843   dfk.stuff
844 }
845
846 FUNCTION {mastersthesis}
847 { output.bibitem
848   format.authors "author" output.check
849   new.block
850   format.title "title" output.check
851   new.block
852   "Master's thesis" format.thesis.type output.nonnull
853   school "school" output.check
854   address output
855   format.date "year" output.check
856   new.block
857   note output
858   fin.entry
859   dfk.stuff
860 }
861
862 FUNCTION {misc}
863 { output.bibitem
864   format.authors output
865   title howpublished new.block.checkb
866   format.title output
867   howpublished new.block.checka
868   howpublished output
869   format.date output
870   new.block
871   note output
872   fin.entry
873   dfk.stuff
874   empty.misc.check
875 }
876
877 FUNCTION {phdthesis}
878 { output.bibitem
879   format.authors "author" output.check
880   new.block
881   format.btitle "title" output.check
882   new.block
883   "PhD thesis" format.thesis.type output.nonnull
884   school "school" output.check
885   address output
886   format.date "year" output.check
887   new.block
888   note output
889   fin.entry
890   dfk.stuff
891 }
892
893 FUNCTION {proceedings}
894 { output.bibitem
895   editor empty$
896     { organization output }
897     { format.editors output.nonnull }
898   if$
899   new.block
900   format.btitle "title" output.check
901   format.bvolume output
902   format.number.series output
903   address empty$
904     { editor empty$
905         { publisher new.sentence.checka }
906         { organization publisher new.sentence.checkb
907           organization output
908         }
909       if$
910       publisher output
911       format.date "year" output.check
912     }
913     { address output.nonnull
914       format.date "year" output.check
915       new.sentence
916       editor empty$
917         'skip$
918         { organization output }
919       if$
920       publisher output
921     }
922   if$
923   new.block
924   note output
925   fin.entry
926   dfk.stuff
927 }
928
929 FUNCTION {techreport}
930 { output.bibitem
931   format.authors "author" output.check
932   new.block
933   format.title "title" output.check
934   new.block
935   format.tr.number output.nonnull
936   institution "institution" output.check
937   address output
938   format.date "year" output.check
939   new.block
940   note output
941   fin.entry
942   dfk.stuff
943 }
944
945 FUNCTION {unpublished}
946 { output.bibitem
947   format.authors "author" output.check
948   new.block
949   format.title "title" output.check
950   new.block
951   note "note" output.check
952   format.date output
953   fin.entry
954   dfk.stuff
955 }
956
957 FUNCTION {default.type} { misc }
958
959 MACRO {jan} {"January"}
960
961 MACRO {feb} {"February"}
962
963 MACRO {mar} {"March"}
964
965 MACRO {apr} {"April"}
966
967 MACRO {may} {"May"}
968
969 MACRO {jun} {"June"}
970
971 MACRO {jul} {"July"}
972
973 MACRO {aug} {"August"}
974
975 MACRO {sep} {"September"}
976
977 MACRO {oct} {"October"}
978
979 MACRO {nov} {"November"}
980
981 MACRO {dec} {"December"}
982
983 MACRO {acmcs} {"ACM Computing Surveys"}
984
985 MACRO {acta} {"Acta Informatica"}
986
987 MACRO {cacm} {"Communications of the ACM"}
988
989 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
990
991 MACRO {ibmsj} {"IBM Systems Journal"}
992
993 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
994
995 MACRO {ieeetc} {"IEEE Transactions on Computers"}
996
997 MACRO {ieeetcad}
998  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
999
1000 MACRO {ipl} {"Information Processing Letters"}
1001
1002 MACRO {jacm} {"Journal of the ACM"}
1003
1004 MACRO {jcss} {"Journal of Computer and System Sciences"}
1005
1006 MACRO {scp} {"Science of Computer Programming"}
1007
1008 MACRO {sicomp} {"SIAM Journal on Computing"}
1009
1010 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1011
1012 MACRO {tods} {"ACM Transactions on Database Systems"}
1013
1014 MACRO {tog} {"ACM Transactions on Graphics"}
1015
1016 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1017
1018 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1019
1020 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1021
1022 MACRO {tcs} {"Theoretical Computer Science"}
1023
1024 READ
1025
1026 FUNCTION {sortify}
1027 { purify$
1028   "l" change.case$
1029 }
1030
1031 INTEGERS { len }
1032
1033 FUNCTION {chop.word}
1034 { 's :=
1035   'len :=
1036   s #1 len substring$ =
1037     { s len #1 + global.max$ substring$ }
1038     's
1039   if$
1040 }
1041
1042 INTEGERS { et.al.char.used }
1043
1044 FUNCTION {initialize.et.al.char.used}
1045 { #0 'et.al.char.used :=
1046 }
1047
1048 EXECUTE {initialize.et.al.char.used}
1049
1050 FUNCTION {format.lab.names}
1051 { 's :=
1052   s num.names$ 'numnames :=
1053   numnames #1 >
1054     { numnames #4 >
1055         { #3 'namesleft := }
1056         { numnames 'namesleft := }
1057       if$
1058       #1 'nameptr :=
1059       ""
1060         { namesleft #0 > }
1061         { nameptr numnames =
1062             { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1063                 { "{\etalchar{+}}" *
1064                   #1 'et.al.char.used :=
1065                 }
1066                 { s nameptr "{v{}}{l{}}" format.name$ * }
1067               if$
1068             }
1069             { s nameptr "{v{}}{l{}}" format.name$ * }
1070           if$
1071           nameptr #1 + 'nameptr :=
1072           namesleft #1 - 'namesleft :=
1073         }
1074       while$
1075       numnames #4 >
1076         { "{\etalchar{+}}" *
1077           #1 'et.al.char.used :=
1078         }
1079         'skip$
1080       if$
1081     }
1082     { s #1 "{v{}}{l{}}" format.name$
1083       duplicate$ text.length$ #2 <
1084         { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
1085         'skip$
1086       if$
1087     }
1088   if$
1089 }
1090
1091 FUNCTION {author.key.label}
1092 { author empty$
1093     { key empty$
1094         { cite$ #1 #3 substring$ }
1095         { key #3 text.prefix$ }
1096       if$
1097     }
1098     { author format.lab.names }
1099   if$
1100 }
1101
1102 FUNCTION {author.editor.key.label}
1103 { author empty$
1104     { editor empty$
1105         { key empty$
1106             { cite$ #1 #3 substring$ }
1107             { key #3 text.prefix$ }
1108           if$
1109         }
1110         { editor format.lab.names }
1111       if$
1112     }
1113     { author format.lab.names }
1114   if$
1115 }
1116
1117 FUNCTION {author.key.organization.label}
1118 { author empty$
1119     { key empty$
1120         { organization empty$
1121             { cite$ #1 #3 substring$ }
1122             { "The " #4 organization chop.word #3 text.prefix$ }
1123           if$
1124         }
1125         { key #3 text.prefix$ }
1126       if$
1127     }
1128     { author format.lab.names }
1129   if$
1130 }
1131
1132 FUNCTION {editor.key.organization.label}
1133 { editor empty$
1134     { key empty$
1135         { organization empty$
1136             { cite$ #1 #3 substring$ }
1137             { "The " #4 organization chop.word #3 text.prefix$ }
1138           if$
1139         }
1140         { key #3 text.prefix$ }
1141       if$
1142     }
1143     { editor format.lab.names }
1144   if$
1145 }
1146
1147 FUNCTION {calc.label}
1148 { type$ "book" =
1149   type$ "inbook" =
1150   or
1151     'author.editor.key.label
1152     { type$ "proceedings" =
1153         'editor.key.organization.label
1154         { type$ "manual" =
1155             'author.key.organization.label
1156             'author.key.label
1157           if$
1158         }
1159       if$
1160     }
1161   if$
1162   duplicate$
1163   year field.or.null purify$ #-1 #2 substring$
1164   *
1165   'label :=
1166   year field.or.null purify$ #-1 #4 substring$
1167   *
1168   sortify 'sort.label :=
1169 }
1170
1171 FUNCTION {sort.format.names}
1172 { 's :=
1173   #1 'nameptr :=
1174   ""
1175   s num.names$ 'numnames :=
1176   numnames 'namesleft :=
1177     { namesleft #0 > }
1178     { nameptr #1 >
1179         { "   " * }
1180         'skip$
1181       if$
1182       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
1183       nameptr numnames = t "others" = and
1184         { "et al" * }
1185         { t sortify * }
1186       if$
1187       nameptr #1 + 'nameptr :=
1188       namesleft #1 - 'namesleft :=
1189     }
1190   while$
1191 }
1192
1193 FUNCTION {sort.format.title}
1194 { 't :=
1195   "A " #2
1196     "An " #3
1197       "The " #4 t chop.word
1198     chop.word
1199   chop.word
1200   sortify
1201   #1 global.max$ substring$
1202 }
1203
1204 FUNCTION {author.sort}
1205 { author empty$
1206     { key empty$
1207         { "to sort, need author or key in " cite$ * warning$
1208           ""
1209         }
1210         { key sortify }
1211       if$
1212     }
1213     { author sort.format.names }
1214   if$
1215 }
1216
1217 FUNCTION {author.editor.sort}
1218 { author empty$
1219     { editor empty$
1220         { key empty$
1221             { "to sort, need author, editor, or key in " cite$ * warning$
1222               ""
1223             }
1224             { key sortify }
1225           if$
1226         }
1227         { editor sort.format.names }
1228       if$
1229     }
1230     { author sort.format.names }
1231   if$
1232 }
1233
1234 FUNCTION {author.organization.sort}
1235 { author empty$
1236     { organization empty$
1237         { key empty$
1238             { "to sort, need author, organization, or key in " cite$ * warning$
1239               ""
1240             }
1241             { key sortify }
1242           if$
1243         }
1244         { "The " #4 organization chop.word sortify }
1245       if$
1246     }
1247     { author sort.format.names }
1248   if$
1249 }
1250
1251 FUNCTION {editor.organization.sort}
1252 { editor empty$
1253     { organization empty$
1254         { key empty$
1255             { "to sort, need editor, organization, or key in " cite$ * warning$
1256               ""
1257             }
1258             { key sortify }
1259           if$
1260         }
1261         { "The " #4 organization chop.word sortify }
1262       if$
1263     }
1264     { editor sort.format.names }
1265   if$
1266 }
1267
1268 FUNCTION {presort}
1269 { calc.label
1270   sort.label
1271   "    "
1272   *
1273   type$ "book" =
1274   type$ "inbook" =
1275   or
1276     'author.editor.sort
1277     { type$ "proceedings" =
1278         'editor.organization.sort
1279         { type$ "manual" =
1280             'author.organization.sort
1281             'author.sort
1282           if$
1283         }
1284       if$
1285     }
1286   if$
1287   *
1288   "    "
1289   *
1290   year field.or.null sortify
1291   *
1292   "    "
1293   *
1294   title field.or.null
1295   sort.format.title
1296   *
1297 % DFK throw away stuff above and use cite$ for sort key
1298   pop$
1299   cite$
1300   #1 entry.max$ substring$
1301   'sort.key$ :=
1302 }
1303
1304 ITERATE {presort}
1305
1306 SORT
1307
1308 STRINGS { longest.label last.sort.label next.extra }
1309
1310 INTEGERS { longest.label.width last.extra.num }
1311
1312 FUNCTION {initialize.longest.label}
1313 { "" 'longest.label :=
1314   #0 int.to.chr$ 'last.sort.label :=
1315   "" 'next.extra :=
1316   #0 'longest.label.width :=
1317   #0 'last.extra.num :=
1318 }
1319
1320 FUNCTION {forward.pass}
1321 { last.sort.label sort.label =
1322     { last.extra.num #1 + 'last.extra.num :=
1323       last.extra.num int.to.chr$ 'extra.label :=
1324     }
1325     { "a" chr.to.int$ 'last.extra.num :=
1326       "" 'extra.label :=
1327       sort.label 'last.sort.label :=
1328     }
1329   if$
1330 }
1331
1332 FUNCTION {reverse.pass}
1333 { next.extra "b" =
1334     { "a" 'extra.label := }
1335     'skip$
1336   if$
1337   label extra.label * 'label :=
1338   label width$ longest.label.width >
1339     { label 'longest.label :=
1340       label width$ 'longest.label.width :=
1341     }
1342     'skip$
1343   if$
1344   extra.label 'next.extra :=
1345 }
1346
1347 EXECUTE {initialize.longest.label}
1348
1349 ITERATE {forward.pass}
1350
1351 REVERSE {reverse.pass}
1352
1353 % DFK removed code about et.al.char
1354 % DFK changed to texinfo
1355 FUNCTION {begin.bib}
1356 { "@c bib -> itexi intro" write$ newline$
1357   "@itemize" write$ newline$
1358 }
1359
1360 EXECUTE {begin.bib}
1361
1362 EXECUTE {init.state.consts}
1363
1364 ITERATE {call.type$}
1365
1366 % DFK changed to texinfo
1367 FUNCTION {end.bib}
1368 { newline$
1369   "@end itemize" write$ newline$
1370   "@c bib -> itexi end" write$ newline$
1371 }
1372
1373 EXECUTE {end.bib}