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