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