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