]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/web/texi-web.bst
290c8614e192b15a0a84953be8e608041cdb5fd9
[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 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 % PEH - the 2 same lines below are because I replaced &nbsp; with a space
358 FUNCTION {tie.or.space.connect}
359 { duplicate$ text.length$ #3 <
360     { " " }
361     { " " }
362   if$
363   swap$ * *
364 }
365
366 FUNCTION {either.or.check}
367 { empty$
368     'pop$
369     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
370   if$
371 }
372
373 FUNCTION {format.bvolume}
374 { volume empty$
375     { "" }
376     { "volume" volume tie.or.space.connect
377       series empty$
378         'skip$
379         { " of " * series emphasize * }
380       if$
381       "volume and number" number either.or.check
382     }
383   if$
384 }
385
386 FUNCTION {format.number.series}
387 { volume empty$
388     { number empty$
389         { series field.or.null }
390         { output.state mid.sentence =
391             { "number" }
392             { "Number" }
393           if$
394           number tie.or.space.connect
395           series empty$
396             { "there's a number but no series in " cite$ * warning$ }
397             { " in " * series * }
398           if$
399         }
400       if$
401     }
402     { "" }
403   if$
404 }
405
406 FUNCTION {format.edition}
407 { edition empty$
408     { "" }
409     { output.state mid.sentence =
410         { edition "l" change.case$ " edition" * }
411         { edition "t" change.case$ " edition" * }
412       if$
413     }
414   if$
415 }
416
417 INTEGERS { multiresult }
418
419 FUNCTION {multi.page.check}
420 { 't :=
421   #0 'multiresult :=
422     { multiresult not
423       t empty$ not
424       and
425     }
426     { t #1 #1 substring$
427       duplicate$ "-" =
428       swap$ duplicate$ "," =
429       swap$ "+" =
430       or or
431         { #1 'multiresult := }
432         { t #2 global.max$ substring$ 't := }
433       if$
434     }
435   while$
436   multiresult
437 }
438
439 FUNCTION {format.pages}
440 { pages empty$
441     { "" }
442     { pages multi.page.check
443         { "pages" pages n.dashify tie.or.space.connect }
444         { "page" pages tie.or.space.connect }
445       if$
446     }
447   if$
448 }
449
450 FUNCTION {format.vol.num.pages}
451 { volume field.or.null
452   number empty$
453     'skip$
454     { "(" number * ")" * *
455       volume empty$
456         { "there's a number but no volume in " cite$ * warning$ }
457         'skip$
458       if$
459     }
460   if$
461   pages empty$
462     'skip$
463     { duplicate$ empty$
464         { pop$ format.pages }
465         { ":" * pages n.dashify * }
466       if$
467     }
468   if$
469 }
470
471 FUNCTION {format.chapter.pages}
472 { chapter empty$
473     'format.pages
474     { type empty$
475         { "chapter" }
476         { type "l" change.case$ }
477       if$
478       chapter tie.or.space.connect
479       pages empty$
480         'skip$
481         { ", " * format.pages * }
482       if$
483     }
484   if$
485 }
486
487 FUNCTION {format.in.ed.booktitle}
488 { booktitle empty$
489     { "" }
490     { editor empty$
491         { "In " booktitle emphasize * }
492         { "In " format.editors * ", " * booktitle emphasize * }
493       if$
494     }
495   if$
496 }
497
498 FUNCTION {empty.misc.check}
499 { author empty$ title empty$ howpublished empty$
500   month empty$ year empty$ note empty$
501   and and and and and
502   key empty$ not and
503     { "all relevant fields are empty in " cite$ * warning$ }
504     'skip$
505   if$
506 }
507
508 FUNCTION {format.thesis.type}
509 { type empty$
510     'skip$
511     { pop$
512       type "t" change.case$
513     }
514   if$
515 }
516
517 FUNCTION {format.tr.number}
518 { type empty$
519     { "Technical Report" }
520     'type
521   if$
522   number empty$
523     { "t" change.case$ }
524     { number tie.or.space.connect }
525   if$
526 }
527
528 FUNCTION {format.article.crossref}
529 { key empty$
530     { journal empty$
531         { "need key or journal for " cite$ * " to crossref " * crossref *
532           warning$
533           ""
534         }
535         { "In {\em " journal * "\/}" * }
536       if$
537     }
538     { "In " key * }
539   if$
540   " \cite{" * crossref * "}" *
541 }
542
543 FUNCTION {format.crossref.editor}
544 { editor #1 "{vv~}{ll}" format.name$
545   editor num.names$ duplicate$
546   #2 >
547     { pop$ " et al." * }
548     { #2 <
549         'skip$
550         { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
551             { " et al." * }
552             { " and " * editor #2 "{vv~}{ll}" format.name$ * }
553           if$
554         }
555       if$
556     }
557   if$
558 }
559
560 FUNCTION {format.book.crossref}
561 { volume empty$
562     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
563       "In "
564     }
565     { "Volume" volume tie.or.space.connect
566       " of " *
567     }
568   if$
569   editor empty$
570   editor field.or.null author field.or.null =
571   or
572     { key empty$
573         { series empty$
574             { "need editor, key, or series for " cite$ * " to crossref " *
575               crossref * warning$
576               "" *
577             }
578             { "{\em " * series * "\/}" * }
579           if$
580         }
581         { key * }
582       if$
583     }
584     { format.crossref.editor * }
585   if$
586   " \cite{" * crossref * "}" *
587 }
588
589 FUNCTION {format.incoll.inproc.crossref}
590 { editor empty$
591   editor field.or.null author field.or.null =
592   or
593     { key empty$
594         { booktitle empty$
595             { "need editor, key, or booktitle for " cite$ * " to crossref " *
596               crossref * warning$
597               ""
598             }
599             { "In {\em " booktitle * "\/}" * }
600           if$
601         }
602         { "In " key * }
603       if$
604     }
605     { "In " format.crossref.editor * }
606   if$
607   " \cite{" * crossref * "}" *
608 }
609
610
611 % DFK added
612 % top of stack is the string we want to be a quoted paragraph
613 FUNCTION {format.quotedParagraph}
614 { duplicate$ empty$
615     { skip$ }
616     { "<P><QUOTE> " swap$ * "  </QUOTE></P>" *}
617   if$
618 }
619
620
621 % DFK added, to support comment, private, keyword, etc
622 % next-to-top is field name (eg, "Comment")
623 % top is field value (eg, value of comment)
624 % both are popped; resulting top is either empty,
625 %    or string describing field
626 FUNCTION {format.dfkfield}
627 { duplicate$ empty$
628         { pop$ pop$ "" }
629         { swap$
630           "<strong> " swap$ * ":</strong> " * swap$ * }
631   if$
632 }
633
634 % DFK added
635 FUNCTION {dfk.stuff}
636 { new.block
637   "Abstract" abstract format.dfkfield format.quotedParagraph write$ newline$
638   "Keyword" keyword format.dfkfield format.quotedParagraph write$ newline$
639   "Comment" comment format.dfkfield format.quotedParagraph write$ newline$
640 }
641
642 % DFK: added a call to dfk.stuff in all entry-type functions below
643
644 FUNCTION {article}
645 { output.bibitem
646   format.authors "author" output.check
647   new.block
648   format.title "title" output.check
649   new.block
650   crossref missing$
651     { journal emphasize "journal" output.check
652       format.vol.num.pages output
653       format.date "year" output.check
654     }
655     { format.article.crossref output.nonnull
656       format.pages output
657     }
658   if$
659   new.block
660   note output
661   fin.entry
662   dfk.stuff
663 }
664
665 FUNCTION {book}
666 { output.bibitem
667   author empty$
668     { format.editors "author and editor" output.check }
669     { format.authors output.nonnull
670       crossref missing$
671         { "author and editor" editor either.or.check }
672         'skip$
673       if$
674     }
675   if$
676   new.block
677   format.btitle "title" output.check
678   crossref missing$
679     { format.bvolume output
680       new.block
681       format.number.series output
682       new.sentence
683       publisher "publisher" output.check
684       address output
685     }
686     { new.block
687       format.book.crossref output.nonnull
688     }
689   if$
690   format.edition output
691   format.date "year" output.check
692   new.block
693   note output
694   fin.entry
695   dfk.stuff
696 }
697
698 FUNCTION {booklet}
699 { output.bibitem
700   format.authors output
701   new.block
702   format.title "title" output.check
703   howpublished address new.block.checkb
704   howpublished output
705   address output
706   format.date output
707   new.block
708   note output
709   fin.entry
710   dfk.stuff
711 }
712
713 FUNCTION {inbook}
714 { output.bibitem
715   author empty$
716     { format.editors "author and editor" output.check }
717     { format.authors output.nonnull
718       crossref missing$
719         { "author and editor" editor either.or.check }
720         'skip$
721       if$
722     }
723   if$
724   new.block
725   format.btitle "title" output.check
726   crossref missing$
727     { format.bvolume output
728       format.chapter.pages "chapter and pages" output.check
729       new.block
730       format.number.series output
731       new.sentence
732       publisher "publisher" output.check
733       address output
734     }
735     { format.chapter.pages "chapter and pages" output.check
736       new.block
737       format.book.crossref output.nonnull
738     }
739   if$
740   format.edition output
741   format.date "year" output.check
742   new.block
743   note output
744   fin.entry
745   dfk.stuff
746 }
747
748 FUNCTION {incollection}
749 { output.bibitem
750   format.authors "author" output.check
751   new.block
752   format.title "title" output.check
753   new.block
754   crossref missing$
755     { format.in.ed.booktitle "booktitle" output.check
756       format.bvolume output
757       format.number.series output
758       format.chapter.pages output
759       new.sentence
760       publisher "publisher" output.check
761       address output
762       format.edition output
763       format.date "year" output.check
764     }
765     { format.incoll.inproc.crossref output.nonnull
766       format.chapter.pages output
767     }
768   if$
769   new.block
770   note output
771   fin.entry
772   dfk.stuff
773 }
774
775 FUNCTION {inproceedings}
776 { output.bibitem
777   format.authors "author" output.check
778   new.block
779   format.title "title" output.check
780   new.block
781   crossref missing$
782     { format.in.ed.booktitle "booktitle" output.check
783       format.bvolume output
784       format.number.series output
785       format.pages output
786       address empty$
787         { organization publisher new.sentence.checkb
788           organization output
789           publisher output
790           format.date "year" output.check
791         }
792         { address output.nonnull
793           format.date "year" output.check
794           new.sentence
795           organization output
796           publisher output
797         }
798       if$
799     }
800     { format.incoll.inproc.crossref output.nonnull
801       format.pages output
802     }
803   if$
804   new.block
805   note output
806   fin.entry
807   dfk.stuff
808 }
809
810 FUNCTION {conference} { inproceedings }
811
812 FUNCTION {manual}
813 { output.bibitem
814   author empty$
815     { organization empty$
816         'skip$
817         { organization output.nonnull
818           address output
819         }
820       if$
821     }
822     { format.authors output.nonnull }
823   if$
824   new.block
825   format.btitle "title" output.check
826   author empty$
827     { organization empty$
828         { address new.block.checka
829           address output
830         }
831         'skip$
832       if$
833     }
834     { organization address new.block.checkb
835       organization output
836       address output
837     }
838   if$
839   format.edition output
840   format.date output
841   new.block
842   note output
843   fin.entry
844   dfk.stuff
845 }
846
847 FUNCTION {mastersthesis}
848 { output.bibitem
849   format.authors "author" output.check
850   new.block
851   format.title "title" output.check
852   new.block
853   "Master's thesis" format.thesis.type output.nonnull
854   school "school" output.check
855   address output
856   format.date "year" output.check
857   new.block
858   note output
859   fin.entry
860   dfk.stuff
861 }
862
863 FUNCTION {misc}
864 { output.bibitem
865   format.authors output
866   title howpublished new.block.checkb
867   format.title output
868   howpublished new.block.checka
869   howpublished output
870   format.date output
871   new.block
872   note output
873   fin.entry
874   dfk.stuff
875   empty.misc.check
876 }
877
878 FUNCTION {phdthesis}
879 { output.bibitem
880   format.authors "author" output.check
881   new.block
882   format.btitle "title" output.check
883   new.block
884   "PhD thesis" format.thesis.type output.nonnull
885   school "school" output.check
886   address output
887   format.date "year" output.check
888   new.block
889   note output
890   fin.entry
891   dfk.stuff
892 }
893
894 FUNCTION {proceedings}
895 { output.bibitem
896   editor empty$
897     { organization output }
898     { format.editors output.nonnull }
899   if$
900   new.block
901   format.btitle "title" output.check
902   format.bvolume output
903   format.number.series output
904   address empty$
905     { editor empty$
906         { publisher new.sentence.checka }
907         { organization publisher new.sentence.checkb
908           organization output
909         }
910       if$
911       publisher output
912       format.date "year" output.check
913     }
914     { address output.nonnull
915       format.date "year" output.check
916       new.sentence
917       editor empty$
918         'skip$
919         { organization output }
920       if$
921       publisher output
922     }
923   if$
924   new.block
925   note output
926   fin.entry
927   dfk.stuff
928 }
929
930 FUNCTION {techreport}
931 { output.bibitem
932   format.authors "author" output.check
933   new.block
934   format.title "title" output.check
935   new.block
936   format.tr.number output.nonnull
937   institution "institution" output.check
938   address output
939   format.date "year" output.check
940   new.block
941   note output
942   fin.entry
943   dfk.stuff
944 }
945
946 FUNCTION {unpublished}
947 { output.bibitem
948   format.authors "author" output.check
949   new.block
950   format.title "title" output.check
951   new.block
952   note "note" output.check
953   format.date output
954   fin.entry
955   dfk.stuff
956 }
957
958 FUNCTION {default.type} { misc }
959
960 MACRO {jan} {"January"}
961
962 MACRO {feb} {"February"}
963
964 MACRO {mar} {"March"}
965
966 MACRO {apr} {"April"}
967
968 MACRO {may} {"May"}
969
970 MACRO {jun} {"June"}
971
972 MACRO {jul} {"July"}
973
974 MACRO {aug} {"August"}
975
976 MACRO {sep} {"September"}
977
978 MACRO {oct} {"October"}
979
980 MACRO {nov} {"November"}
981
982 MACRO {dec} {"December"}
983
984 MACRO {acmcs} {"ACM Computing Surveys"}
985
986 MACRO {acta} {"Acta Informatica"}
987
988 MACRO {cacm} {"Communications of the ACM"}
989
990 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
991
992 MACRO {ibmsj} {"IBM Systems Journal"}
993
994 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
995
996 MACRO {ieeetc} {"IEEE Transactions on Computers"}
997
998 MACRO {ieeetcad}
999  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1000
1001 MACRO {ipl} {"Information Processing Letters"}
1002
1003 MACRO {jacm} {"Journal of the ACM"}
1004
1005 MACRO {jcss} {"Journal of Computer and System Sciences"}
1006
1007 MACRO {scp} {"Science of Computer Programming"}
1008
1009 MACRO {sicomp} {"SIAM Journal on Computing"}
1010
1011 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1012
1013 MACRO {tods} {"ACM Transactions on Database Systems"}
1014
1015 MACRO {tog} {"ACM Transactions on Graphics"}
1016
1017 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1018
1019 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1020
1021 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1022
1023 MACRO {tcs} {"Theoretical Computer Science"}
1024
1025 READ
1026
1027 FUNCTION {sortify}
1028 { purify$
1029   "l" change.case$
1030 }
1031
1032 INTEGERS { len }
1033
1034 FUNCTION {chop.word}
1035 { 's :=
1036   'len :=
1037   s #1 len substring$ =
1038     { s len #1 + global.max$ substring$ }
1039     's
1040   if$
1041 }
1042
1043 INTEGERS { et.al.char.used }
1044
1045 FUNCTION {initialize.et.al.char.used}
1046 { #0 'et.al.char.used :=
1047 }
1048
1049 EXECUTE {initialize.et.al.char.used}
1050
1051 FUNCTION {format.lab.names}
1052 { 's :=
1053   s num.names$ 'numnames :=
1054   numnames #1 >
1055     { numnames #4 >
1056         { #3 'namesleft := }
1057         { numnames 'namesleft := }
1058       if$
1059       #1 'nameptr :=
1060       ""
1061         { namesleft #0 > }
1062         { nameptr numnames =
1063             { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1064                 { "{\etalchar{+}}" *
1065                   #1 'et.al.char.used :=
1066                 }
1067                 { s nameptr "{v{}}{l{}}" format.name$ * }
1068               if$
1069             }
1070             { s nameptr "{v{}}{l{}}" format.name$ * }
1071           if$
1072           nameptr #1 + 'nameptr :=
1073           namesleft #1 - 'namesleft :=
1074         }
1075       while$
1076       numnames #4 >
1077         { "{\etalchar{+}}" *
1078           #1 'et.al.char.used :=
1079         }
1080         'skip$
1081       if$
1082     }
1083     { s #1 "{v{}}{l{}}" format.name$
1084       duplicate$ text.length$ #2 <
1085         { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
1086         'skip$
1087       if$
1088     }
1089   if$
1090 }
1091
1092 FUNCTION {author.key.label}
1093 { author empty$
1094     { key empty$
1095         { cite$ #1 #3 substring$ }
1096         { key #3 text.prefix$ }
1097       if$
1098     }
1099     { author format.lab.names }
1100   if$
1101 }
1102
1103 FUNCTION {author.editor.key.label}
1104 { author empty$
1105     { editor empty$
1106         { key empty$
1107             { cite$ #1 #3 substring$ }
1108             { key #3 text.prefix$ }
1109           if$
1110         }
1111         { editor format.lab.names }
1112       if$
1113     }
1114     { author format.lab.names }
1115   if$
1116 }
1117
1118 FUNCTION {author.key.organization.label}
1119 { author empty$
1120     { key empty$
1121         { organization empty$
1122             { cite$ #1 #3 substring$ }
1123             { "The " #4 organization chop.word #3 text.prefix$ }
1124           if$
1125         }
1126         { key #3 text.prefix$ }
1127       if$
1128     }
1129     { author format.lab.names }
1130   if$
1131 }
1132
1133 FUNCTION {editor.key.organization.label}
1134 { editor empty$
1135     { key empty$
1136         { organization empty$
1137             { cite$ #1 #3 substring$ }
1138             { "The " #4 organization chop.word #3 text.prefix$ }
1139           if$
1140         }
1141         { key #3 text.prefix$ }
1142       if$
1143     }
1144     { editor format.lab.names }
1145   if$
1146 }
1147
1148 FUNCTION {calc.label}
1149 { type$ "book" =
1150   type$ "inbook" =
1151   or
1152     'author.editor.key.label
1153     { type$ "proceedings" =
1154         'editor.key.organization.label
1155         { type$ "manual" =
1156             'author.key.organization.label
1157             'author.key.label
1158           if$
1159         }
1160       if$
1161     }
1162   if$
1163   duplicate$
1164   year field.or.null purify$ #-1 #2 substring$
1165   *
1166   'label :=
1167   year field.or.null purify$ #-1 #4 substring$
1168   *
1169   sortify 'sort.label :=
1170 }
1171
1172 FUNCTION {sort.format.names}
1173 { 's :=
1174   #1 'nameptr :=
1175   ""
1176   s num.names$ 'numnames :=
1177   numnames 'namesleft :=
1178     { namesleft #0 > }
1179     { nameptr #1 >
1180         { "   " * }
1181         'skip$
1182       if$
1183       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
1184       nameptr numnames = t "others" = and
1185         { "et al" * }
1186         { t sortify * }
1187       if$
1188       nameptr #1 + 'nameptr :=
1189       namesleft #1 - 'namesleft :=
1190     }
1191   while$
1192 }
1193
1194 FUNCTION {sort.format.title}
1195 { 't :=
1196   "A " #2
1197     "An " #3
1198       "The " #4 t chop.word
1199     chop.word
1200   chop.word
1201   sortify
1202   #1 global.max$ substring$
1203 }
1204
1205 FUNCTION {author.sort}
1206 { author empty$
1207     { key empty$
1208         { "to sort, need author or key in " cite$ * warning$
1209           ""
1210         }
1211         { key sortify }
1212       if$
1213     }
1214     { author sort.format.names }
1215   if$
1216 }
1217
1218 FUNCTION {author.editor.sort}
1219 { author empty$
1220     { editor empty$
1221         { key empty$
1222             { "to sort, need author, editor, or key in " cite$ * warning$
1223               ""
1224             }
1225             { key sortify }
1226           if$
1227         }
1228         { editor sort.format.names }
1229       if$
1230     }
1231     { author sort.format.names }
1232   if$
1233 }
1234
1235 FUNCTION {author.organization.sort}
1236 { author empty$
1237     { organization empty$
1238         { key empty$
1239             { "to sort, need author, organization, or key in " cite$ * warning$
1240               ""
1241             }
1242             { key sortify }
1243           if$
1244         }
1245         { "The " #4 organization chop.word sortify }
1246       if$
1247     }
1248     { author sort.format.names }
1249   if$
1250 }
1251
1252 FUNCTION {editor.organization.sort}
1253 { editor empty$
1254     { organization empty$
1255         { key empty$
1256             { "to sort, need editor, organization, or key in " cite$ * warning$
1257               ""
1258             }
1259             { key sortify }
1260           if$
1261         }
1262         { "The " #4 organization chop.word sortify }
1263       if$
1264     }
1265     { editor sort.format.names }
1266   if$
1267 }
1268
1269 FUNCTION {presort}
1270 { calc.label
1271   sort.label
1272   "    "
1273   *
1274   type$ "book" =
1275   type$ "inbook" =
1276   or
1277     'author.editor.sort
1278     { type$ "proceedings" =
1279         'editor.organization.sort
1280         { type$ "manual" =
1281             'author.organization.sort
1282             'author.sort
1283           if$
1284         }
1285       if$
1286     }
1287   if$
1288   *
1289   "    "
1290   *
1291   year field.or.null sortify
1292   *
1293   "    "
1294   *
1295   title field.or.null
1296   sort.format.title
1297   *
1298 % DFK throw away stuff above and use cite$ for sort key
1299   pop$
1300   cite$
1301   #1 entry.max$ substring$
1302   'sort.key$ :=
1303 }
1304
1305 ITERATE {presort}
1306
1307 SORT
1308
1309 STRINGS { longest.label last.sort.label next.extra }
1310
1311 INTEGERS { longest.label.width last.extra.num }
1312
1313 FUNCTION {initialize.longest.label}
1314 { "" 'longest.label :=
1315   #0 int.to.chr$ 'last.sort.label :=
1316   "" 'next.extra :=
1317   #0 'longest.label.width :=
1318   #0 'last.extra.num :=
1319 }
1320
1321 FUNCTION {forward.pass}
1322 { last.sort.label sort.label =
1323     { last.extra.num #1 + 'last.extra.num :=
1324       last.extra.num int.to.chr$ 'extra.label :=
1325     }
1326     { "a" chr.to.int$ 'last.extra.num :=
1327       "" 'extra.label :=
1328       sort.label 'last.sort.label :=
1329     }
1330   if$
1331 }
1332
1333 FUNCTION {reverse.pass}
1334 { next.extra "b" =
1335     { "a" 'extra.label := }
1336     'skip$
1337   if$
1338   label extra.label * 'label :=
1339   label width$ longest.label.width >
1340     { label 'longest.label :=
1341       label width$ 'longest.label.width :=
1342     }
1343     'skip$
1344   if$
1345   extra.label 'next.extra :=
1346 }
1347
1348 EXECUTE {initialize.longest.label}
1349
1350 ITERATE {forward.pass}
1351
1352 REVERSE {reverse.pass}
1353
1354 % DFK removed code about et.al.char
1355 % DFK changed to texinfo
1356 FUNCTION {begin.bib}
1357 { "@c bib -> itexi intro" write$ newline$
1358   "@itemize" write$ newline$
1359 }
1360
1361 EXECUTE {begin.bib}
1362
1363 EXECUTE {init.state.consts}
1364
1365 ITERATE {call.type$}
1366
1367 % DFK changed to texinfo
1368 FUNCTION {end.bib}
1369 { newline$
1370   "@end itemize" write$ newline$
1371   "@c bib -> itexi end" write$ newline$
1372 }
1373
1374 EXECUTE {end.bib}