Journal/document/acmtrans.bst
changeset 372 2c56b20032a7
equal deleted inserted replaced
371:48b231495281 372:2c56b20032a7
       
     1 % "ACM Transactions" BibTeX style, acmtrans.bst 
       
     2 %  for BibTeX version 0.99c, LaTeX version 3.141
       
     3 %  Revised 28-MARCH-1996
       
     4 %  Revised 30-JUNE-1995
       
     5 %  Revised 15-JAN-1996 
       
     6 %  $Header: acmtrans.bst,v 1.2 96/01/17 09:05:38 boyland Exp $
       
     7 %
       
     8 % Hacked by John T. Boyland at University of California, Berkeley
       
     9 % (with assistance by John R. Hauser)
       
    10 % Hacked by Andrew W. Appel and Rebecca L. Davies at Princeton University,
       
    11 % based on a "chicago.bst" by Glenn Paulley at U. Waterloo,
       
    12 % which was based on "newapa.bst" found at ymir.claremont.edu.
       
    13 %
       
    14 %   Citation format: [author-last-name year]
       
    15 %             [author-last-name and author-last-name year]
       
    16 %             [author-last-name, author-last-name, and author-last-name year]
       
    17 %             [author-last-name et al. year]
       
    18 %             [author-last-name]
       
    19 %             author-last-name [year]
       
    20 %             [author-last-name and author-last-name]
       
    21 %             [author-last-name et al.]
       
    22 %             [year] or [year,year]
       
    23 %             year or year,year
       
    24 %
       
    25 %   Reference list ordering: alphabetical by author or whatever passes
       
    26 %    for author in the absence of one.
       
    27 %
       
    28 % This BibTeX style has support for abbreviated author lists and for
       
    29 %    year-only citations.  This is done by having the citations
       
    30 %    actually look like
       
    31 %
       
    32 %    \citeauthoryear{full-author-info}{abbrev-author-info}{year}
       
    33 %
       
    34 % The LaTeX style has to have the following (or similar)
       
    35 %
       
    36 %     \let\@internalcite\cite
       
    37 %     \def\fullcite{\def\citeauthoryear##1##2##3{##1, ##3}\@internalcite}
       
    38 %     \def\fullciteA{\def\citeauthoryear##1##2##3{##1}\@internalcite}
       
    39 %     \def\shortcite{\def\citeauthoryear##1##2##3{##2, ##3}\@internalcite}
       
    40 %     \def\shortciteA{\def\citeauthoryear##1##2##3{##2}\@internalcite}
       
    41 %     \def\citeyear{\def\citeauthoryear##1##2##3{##3}\@internalcite}
       
    42 %
       
    43 % These TeX macro definitions are found in acmtrans.sty. Additional
       
    44 % commands to manipulate different components of a citation can be defined
       
    45 % so that, for example, you can list author's names without parentheses
       
    46 % if using a citation as a noun or object in a sentence.
       
    47 %
       
    48 % Features of acmtrans.bst:
       
    49 % ========================
       
    50 %
       
    51 % - all authors appear last name first.
       
    52 % - all pages are listed xx-xx, (no pp.) and are at the end of the reference
       
    53 % - publishers are identified as publisher, address
       
    54 % - conferences papers (inproceedings) may give city of conference,
       
    55 %   date of conference, and journal that the proceedings appear in.
       
    56 % - months abbreviated to max four letters (eg. Mar.)
       
    57 % - volume of a series indicated after the title of the series
       
    58 % - editors appear after edited title and are identified by a trailing "Eds."
       
    59 %   not in parentheses.  Editor names are not given in small caps.
       
    60 %   (unless there is no author line)
       
    61 % - names terminated with a period even if there is no first name.
       
    62 % - editions are indicated trailing after the work, not in parentheses.
       
    63 % - "et al." citations have a protected period to avoid bad spacing (jrh)
       
    64 % - "address" required when publisher given
       
    65 % - series (roman) and volume are in a sentence separate from (book-)title
       
    66 %
       
    67 %
       
    68 % Features of chicago.bst:
       
    69 % =======================
       
    70 %
       
    71 % - full names used in citations, but abbreviated citations are available
       
    72 %   (see above)
       
    73 % - if an entry has a "month", then the month and year are also printed
       
    74 %   as part of that bibitem.
       
    75 % - all conjunctions use "and" instead of "\&"
       
    76 % - major modification from Chicago Manual of Style (13th ed.) is that
       
    77 %   only the first author in a reference appears last name first-
       
    78 %   additional authors appear as J. Q. Public.
       
    79 % - pages are listed as "pp. xx-xx" in all entry types except
       
    80 %   article entries.
       
    81 % - book, inbook, and manual use "location: publisher" (or organization)
       
    82 %   for address and publisher. All other types list publishers separately.
       
    83 % - "pp." are used to identify page numbers for all entry types except
       
    84 %   articles.
       
    85 % - organization is used as a citation label if neither author nor editor
       
    86 %   is present (for manuals).
       
    87 % - "et al." is used for long author and editor lists, or when "others"
       
    88 %   is used.
       
    89 %
       
    90 % Modifications and bug fixes from newapa.bst:
       
    91 % ===========================================
       
    92 %
       
    93 %   - added month, year to bib entries if month is present
       
    94 %   - fixed bug with In proceedings, added necessary comma after title
       
    95 %   - all conjunctions changed to "and" from "\&"
       
    96 %   - fixed bug with author labels in my.full.label: "et al." now is
       
    97 %        generated when "others" is an author name
       
    98 %   - major modification from Chicago Manual of Style (13th ed.) is that
       
    99 %     only the first author in a reference appears last name first-
       
   100 %     additional authors appear as J. Q. Public.
       
   101 %   - pages are listed as "pp. xx-xx" in all entry types except
       
   102 %     article entries. Unnecessary (IMHO) "()" around page numbers
       
   103 %     were removed, and page numbers now don't end with a period.
       
   104 %   - created chicago.sty for use with this bibstyle (required).
       
   105 %   - fixed bugs in FUNCTION {format.vol.num.pages} for missing volume,
       
   106 %     number, and /or pages. Renamed to format.jour.vol.
       
   107 %   - fixed bug in formatting booktitles: additional period an error if
       
   108 %     book has a volume.
       
   109 %   - fixed bug: editors usually given redundant period before next clause
       
   110 %     (format.editors.dot) removed.
       
   111 %   - added label support for organizations, if both author and editor
       
   112 %     are missing (from alpha.bst). If organization is too long, then
       
   113 %     the key field is used for abbreviated citations.
       
   114 %   - In proceedings or books of several volumes, no comma was written
       
   115 %     between the "Volume x" and the page numbers (this was intentional
       
   116 %     in newapa.bst). Fixed.
       
   117 %   - Some journals may not have volumes/numbers, only month/year (eg.
       
   118 %     IEEE Computer). Fixed bug in article style that assumed volume/number
       
   119 %     was always present.
       
   120 %
       
   121 % Original documentation for newapa.sty:
       
   122 % =====================================
       
   123 %
       
   124 % This version was made by modifying the master file made by
       
   125 % Oren Patashnik (PATASHNIK@SCORE.STANFORD.EDU), and the 'named' BibTeX
       
   126 % style of Peter F. Patel-Schneider.
       
   127 %
       
   128 % Copyright (C) 1985, all rights reserved.
       
   129 % Copying of this file is authorized only if either
       
   130 % (1) you make absolutely no changes to your copy, including name, or
       
   131 % (2) if you do make changes, you name it something other than 'newapa.bst'.
       
   132 % There are undoubtably bugs in this style.  If you make bug fixes,
       
   133 % improvements, etc.  please let me know.  My e-mail address is:
       
   134 %    spencer@cgrg.ohio.state.edu or 71160.3141@compuserve.com
       
   135 %
       
   136 % This style was made from 'plain.bst', 'named.bst', and 'apalike.bst',
       
   137 % with lots of tweaking to make it look like APA style, along with tips
       
   138 % from Young Ryu and Brian Reiser's modifications of 'apalike.bst'.
       
   139 
       
   140 ENTRY
       
   141   { address
       
   142     author
       
   143     booktitle
       
   144     chapter
       
   145     city	% jtb: added
       
   146     date	% jtb: added
       
   147     edition
       
   148     editor
       
   149     howpublished
       
   150     institution
       
   151     journal
       
   152     key
       
   153     month
       
   154     note
       
   155     number
       
   156     organization
       
   157     pages
       
   158     publisher
       
   159     school
       
   160     series
       
   161     title
       
   162     type
       
   163     volume
       
   164     year
       
   165   }
       
   166   {}
       
   167   { label.year extra.label sort.year sort.label }
       
   168 
       
   169 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
       
   170 
       
   171 FUNCTION {init.state.consts}
       
   172 { #0 'before.all :=
       
   173   #1 'mid.sentence :=
       
   174   #2 'after.sentence :=
       
   175   #3 'after.block :=
       
   176 }
       
   177 
       
   178 STRINGS { s t u }
       
   179 
       
   180 FUNCTION {output.nonnull}
       
   181 { 's :=
       
   182   output.state mid.sentence =
       
   183     { ", " * write$ }
       
   184     { output.state after.block =
       
   185     { add.period$ write$
       
   186       newline$
       
   187       "\newblock " write$
       
   188     }
       
   189     { output.state before.all =
       
   190         'write$
       
   191         { add.period$ " " * write$ }
       
   192       if$
       
   193     }
       
   194       if$
       
   195       mid.sentence 'output.state :=
       
   196     }
       
   197   if$
       
   198   s
       
   199 }
       
   200 
       
   201 % Use a colon to separate output. Used only for address/publisher
       
   202 % combination in book/inbook types, address/institution for manuals,
       
   203 % and organization:publisher for proceedings (inproceedings).
       
   204 %
       
   205 FUNCTION {output.nonnull.colon}
       
   206 { 's :=
       
   207   output.state mid.sentence =
       
   208     { ": " * write$ }
       
   209     { output.state after.block =
       
   210     { add.period$ write$
       
   211       newline$
       
   212       "\newblock " write$
       
   213     }
       
   214     { output.state before.all =
       
   215         'write$
       
   216         { add.period$ " " * write$ }
       
   217       if$
       
   218     }
       
   219       if$
       
   220       mid.sentence 'output.state :=
       
   221     }
       
   222   if$
       
   223   s
       
   224 }
       
   225 
       
   226 FUNCTION {output}
       
   227 { duplicate$ empty$
       
   228     'pop$
       
   229     'output.nonnull
       
   230   if$
       
   231 }
       
   232 
       
   233 FUNCTION {output.colon}
       
   234 { duplicate$ empty$
       
   235     'pop$
       
   236     'output.nonnull.colon
       
   237   if$
       
   238 }
       
   239 
       
   240 FUNCTION {output.check}
       
   241 { 't :=
       
   242   duplicate$ empty$
       
   243     { pop$ "empty " t * " in " * cite$ * warning$ }
       
   244     'output.nonnull
       
   245   if$
       
   246 }
       
   247 
       
   248 FUNCTION {output.check.colon}
       
   249 { 't :=
       
   250   duplicate$ empty$
       
   251     { pop$ "empty " t * " in " * cite$ * warning$ }
       
   252     'output.nonnull.colon
       
   253   if$
       
   254 }
       
   255 
       
   256 FUNCTION {output.year.check}
       
   257 { year empty$
       
   258      { "empty year in " cite$ * warning$ }
       
   259      { write$
       
   260         " " year * extra.label *
       
   261        mid.sentence 'output.state :=
       
   262      }
       
   263   if$
       
   264 }
       
   265 
       
   266 
       
   267 FUNCTION {fin.entry}
       
   268 { add.period$
       
   269   write$
       
   270   newline$
       
   271 }
       
   272 
       
   273 FUNCTION {new.block}
       
   274 { output.state before.all =
       
   275     'skip$
       
   276     { after.block 'output.state := }
       
   277   if$
       
   278 }
       
   279 
       
   280 FUNCTION {new.sentence}
       
   281 { output.state after.block =
       
   282     'skip$
       
   283     { output.state before.all =
       
   284     'skip$
       
   285     { after.sentence 'output.state := }
       
   286       if$
       
   287     }
       
   288   if$
       
   289 }
       
   290 
       
   291 FUNCTION {not}
       
   292 {   { #0 }
       
   293     { #1 }
       
   294   if$
       
   295 }
       
   296 
       
   297 FUNCTION {and}
       
   298 {   'skip$
       
   299     { pop$ #0 }
       
   300   if$
       
   301 }
       
   302 
       
   303 FUNCTION {or}
       
   304 {   { pop$ #1 }
       
   305     'skip$
       
   306   if$
       
   307 }
       
   308 
       
   309 FUNCTION {new.block.checka}
       
   310 { empty$
       
   311     'skip$
       
   312     'new.block
       
   313   if$
       
   314 }
       
   315 
       
   316 FUNCTION {new.block.checkb}
       
   317 { empty$
       
   318   swap$ empty$
       
   319   and
       
   320     'skip$
       
   321     'new.block
       
   322   if$
       
   323 }
       
   324 
       
   325 FUNCTION {new.sentence.checka}
       
   326 { empty$
       
   327     'skip$
       
   328     'new.sentence
       
   329   if$
       
   330 }
       
   331 
       
   332 FUNCTION {new.sentence.checkb}
       
   333 { empty$
       
   334   swap$ empty$
       
   335   and
       
   336     'skip$
       
   337     'new.sentence
       
   338   if$
       
   339 }
       
   340 
       
   341 FUNCTION {field.or.null}
       
   342 { duplicate$ empty$
       
   343     { pop$ "" }
       
   344     'skip$
       
   345   if$
       
   346 }
       
   347 
       
   348 %
       
   349 % Emphasize the top string on the stack.
       
   350 %
       
   351 FUNCTION {emphasize}
       
   352 { duplicate$ empty$
       
   353     { pop$ "" }
       
   354     { "{\em " swap$ * "}" * }
       
   355   if$
       
   356 }
       
   357 
       
   358 %
       
   359 % Emphasize the top string on the stack, but add a trailing space.
       
   360 %
       
   361 FUNCTION {emphasize.space}
       
   362 { duplicate$ empty$
       
   363     { pop$ "" }
       
   364     { "{\em " swap$ * "\/}" * }
       
   365   if$
       
   366 }
       
   367 
       
   368 %
       
   369 % Emphasize the top string on stack, add a trailing comma and space.
       
   370 %
       
   371 FUNCTION {emphasize.comma}
       
   372 { duplicate$ empty$
       
   373     { pop$ "" }
       
   374     { "{\em " swap$ * ",\/}" * }
       
   375   if$
       
   376 }
       
   377 
       
   378 INTEGERS { nameptr namesleft numnames }
       
   379 %
       
   380 % Format bibliographical entries with the first author last name first,
       
   381 % and subsequent authors with initials followed by last name.
       
   382 % All names are formatted in this routine.
       
   383 %
       
   384 
       
   385 FUNCTION {format.names}
       
   386 { 's :=
       
   387   #1 'nameptr :=               % nameptr = 1;
       
   388   s num.names$ 'numnames :=    % numnames = num.name$(s);
       
   389   numnames 'namesleft :=
       
   390     { namesleft #0 > }
       
   391 
       
   392     { nameptr #1 =
       
   393         {"{\sc " s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ * "}" * 't := }
       
   394         {"{\sc " s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ * "}" * 't := }
       
   395       if$
       
   396       nameptr #1 >
       
   397         { namesleft #1 >
       
   398               { ", " * t * }
       
   399               { numnames #2 >
       
   400                   { "," * }
       
   401                   'skip$
       
   402                 if$
       
   403                 t "{\sc others}" =
       
   404                     { " {\sc et~al\mbox{.}}" * } % jrh: avoid spacing problems
       
   405                     { " {\sc and} " * t * } % from Chicago Manual of Style
       
   406                   if$
       
   407                }
       
   408                if$
       
   409              }
       
   410             't
       
   411         if$
       
   412         nameptr #1 + 'nameptr :=          % nameptr += 1;
       
   413         namesleft #1 - 'namesleft :=      % namesleft =- 1;
       
   414     }
       
   415   while$
       
   416 }
       
   417 
       
   418 FUNCTION {my.full.label}
       
   419 { 's :=
       
   420   #1 'nameptr :=               % nameptr = 1;
       
   421   s num.names$ 'numnames :=    % numnames = num.name$(s);
       
   422   numnames 'namesleft :=
       
   423     { namesleft #0 > }
       
   424 
       
   425     { s nameptr "{vv~}{ll}" format.name$ 't :=  % get the next name
       
   426       nameptr #1 >
       
   427         { namesleft #1 >
       
   428               { ", " * t * }
       
   429               { numnames #2 >
       
   430                   { "," * }
       
   431                   'skip$
       
   432                 if$
       
   433                 t "others" =
       
   434                     { " et~al\mbox{.}" * } % jrh: avoid spacing problems
       
   435                     { " and " * t * } % from Chicago Manual of Style
       
   436                   if$
       
   437                }
       
   438                if$
       
   439              }
       
   440             't
       
   441         if$
       
   442         nameptr #1 + 'nameptr :=          % nameptr += 1;
       
   443         namesleft #1 - 'namesleft :=      % namesleft =- 1;
       
   444     }
       
   445   while$
       
   446 
       
   447 }
       
   448 
       
   449 FUNCTION {format.names.fml}
       
   450 %
       
   451 % Format names in "familiar" format, with first initial followed by
       
   452 % last name. Like format.names, ALL names are formatted.
       
   453 % jtb: The names are NOT put in small caps
       
   454 %
       
   455 { 's :=
       
   456   #1 'nameptr :=               % nameptr = 1;
       
   457   s num.names$ 'numnames :=    % numnames = num.name$(s);
       
   458   numnames 'namesleft :=
       
   459     { namesleft #0 > }
       
   460 
       
   461     { "{" s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ * "}" * 't :=
       
   462 
       
   463       nameptr #1 >
       
   464         { namesleft #1 >
       
   465               { ", " * t * }
       
   466                { numnames #2 >
       
   467                     { "," * }
       
   468                     'skip$
       
   469                   if$
       
   470                   t "{others}" =
       
   471                         { " {et~al\mbox{.}}" * }
       
   472                         { " {and} " * t * }
       
   473 %                       { " {\&} " * t * }
       
   474                       if$
       
   475                 }
       
   476                if$
       
   477              }
       
   478             't
       
   479         if$
       
   480         nameptr #1 + 'nameptr :=          % nameptr += 1;
       
   481         namesleft #1 - 'namesleft :=      % namesleft =- 1;
       
   482     }
       
   483   while$
       
   484 }
       
   485 
       
   486 FUNCTION {format.authors}
       
   487 { author empty$
       
   488     { "" }
       
   489     { author format.names add.period$} % jtb: add period if none before
       
   490   if$
       
   491 }
       
   492 
       
   493 FUNCTION {format.key}
       
   494 { empty$
       
   495     { key field.or.null }
       
   496     { "" }
       
   497   if$
       
   498 }
       
   499 
       
   500 %
       
   501 % Format editor names for use in the "in" types: inbook, incollection,
       
   502 % inproceedings: first initial, then last names. When editors are the
       
   503 % LABEL for an entry, then format.editor is used which lists editors
       
   504 % by last name first.
       
   505 %
       
   506 FUNCTION {format.editors.fml}
       
   507 { editor empty$
       
   508     { "" }
       
   509     { editor format.names.fml
       
   510       editor num.names$ #1 >
       
   511     { ", Eds." * }	% jtb: removed parentheses
       
   512     { ", Ed." * }	% jtb: removed parentheses
       
   513       if$
       
   514     }
       
   515   if$
       
   516 }
       
   517 
       
   518 %
       
   519 % Format editor names for use in labels, last names first.
       
   520 %
       
   521 FUNCTION {format.editors}
       
   522 { editor empty$
       
   523     { "" }
       
   524     { editor format.names
       
   525       editor num.names$ #1 >
       
   526     { ", Eds." * }	% jtb: removed parentheses
       
   527     { ", Ed." * }	% jtb: removed parentheses
       
   528       if$
       
   529     }
       
   530   if$
       
   531 }
       
   532 
       
   533 FUNCTION {format.title}
       
   534 { title empty$
       
   535     { "" }
       
   536     { title "t" change.case$ }
       
   537   if$
       
   538 }
       
   539 
       
   540 % Note that the APA style requres case changes
       
   541 % in article titles. The following does not
       
   542 % change cases. If you perfer it, uncomment the
       
   543 % following and comment out the above.
       
   544 
       
   545 %FUNCTION {format.title}
       
   546 %{ title empty$
       
   547 %    { "" }
       
   548 %    { title }
       
   549 %  if$
       
   550 %}
       
   551 
       
   552 FUNCTION {n.dashify}
       
   553 { 't :=
       
   554   ""
       
   555     { t empty$ not }
       
   556     { t #1 #1 substring$ "-" =
       
   557     { t #1 #2 substring$ "--" = not
       
   558         { "--" *
       
   559           t #2 global.max$ substring$ 't :=
       
   560         }
       
   561         {   { t #1 #1 substring$ "-" = }
       
   562         { "-" *
       
   563           t #2 global.max$ substring$ 't :=
       
   564         }
       
   565           while$
       
   566         }
       
   567       if$
       
   568     }
       
   569     { t #1 #1 substring$ *
       
   570       t #2 global.max$ substring$ 't :=
       
   571     }
       
   572       if$
       
   573     }
       
   574   while$
       
   575 }
       
   576 
       
   577 FUNCTION {format.btitle}
       
   578 { edition empty$
       
   579   { title emphasize }
       
   580   { title empty$
       
   581     { title emphasize } % jtb: what is this supposed to do ?!?
       
   582     { "{\em " title * "\/}, " * edition * " ed." * } % jtb: no parens for ed.
       
   583     if$
       
   584   }
       
   585   if$
       
   586 }
       
   587 
       
   588 FUNCTION {format.emphasize.booktitle}
       
   589 { edition empty$
       
   590   { booktitle emphasize }
       
   591   { booktitle empty$
       
   592     { booktitle emphasize } % jtb: what is this supposed to do ?!?
       
   593     { "{\em " booktitle * "\/}, " * edition * " ed." * } % jtb: no ()s for ed.
       
   594     if$
       
   595     }
       
   596   if$
       
   597   }
       
   598 
       
   599 % jtb: if the preceding string (the title of the conference) is non-empty,
       
   600 % jtb: append the location, otherwise leave empty (so as to trigger the
       
   601 % jtb: error message in output.check
       
   602 FUNCTION {format.city}
       
   603 { duplicate$ empty$
       
   604   { }
       
   605   { city empty$
       
   606      { date empty$
       
   607        { }
       
   608        { " (" * date * ")" * }
       
   609        if$
       
   610      }
       
   611      { date empty$
       
   612        { " (" * city * ")" * }
       
   613        { " (" * city * ", " * date * ")" * }
       
   614        if$
       
   615      }
       
   616      if$
       
   617   }
       
   618   if$
       
   619 }
       
   620 
       
   621 FUNCTION {tie.or.space.connect}
       
   622 { duplicate$ text.length$ #3 <
       
   623     { "~" }
       
   624     { " " }
       
   625   if$
       
   626   swap$ * *
       
   627 }
       
   628 
       
   629 FUNCTION {either.or.check}
       
   630 { empty$
       
   631     'pop$
       
   632     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
       
   633   if$
       
   634 }
       
   635 
       
   636 % jtb: If there is a series, this is added and the volume trails after it.
       
   637 % jtb: Otherwise, "Vol" is Capitalized.
       
   638 FUNCTION {format.bvolume}
       
   639 { volume empty$
       
   640     { "" }
       
   641     { series empty$
       
   642         { "Vol." volume tie.or.space.connect}
       
   643         { series ", " * "vol." volume tie.or.space.connect *}
       
   644       if$
       
   645       "volume and number" number either.or.check
       
   646     }
       
   647   if$
       
   648 }
       
   649 
       
   650 FUNCTION {format.number.series}
       
   651 { volume empty$
       
   652     { number empty$
       
   653     { series field.or.null }
       
   654     { output.state mid.sentence =
       
   655         { "Number" } % gnp - changed to mixed case always
       
   656         { "Number" }
       
   657       if$
       
   658       number tie.or.space.connect
       
   659       series empty$
       
   660         { "there's a number but no series in " cite$ * warning$ }
       
   661         { " in " * series * }
       
   662       if$
       
   663     }
       
   664       if$
       
   665     }
       
   666     { "" }
       
   667   if$
       
   668 }
       
   669 
       
   670 INTEGERS { multiresult }
       
   671 
       
   672 FUNCTION {multi.page.check}
       
   673 { 't :=
       
   674   #0 'multiresult :=
       
   675     { multiresult not
       
   676       t empty$ not
       
   677       and
       
   678     }
       
   679     { t #1 #1 substring$
       
   680       duplicate$ "-" =
       
   681       swap$ duplicate$ "," =
       
   682       swap$ "+" =
       
   683       or or
       
   684     { #1 'multiresult := }
       
   685     { t #2 global.max$ substring$ 't := }
       
   686       if$
       
   687     }
       
   688   while$
       
   689   multiresult
       
   690 }
       
   691 
       
   692 FUNCTION {format.pages}
       
   693 { pages empty$
       
   694   { "" }
       
   695   { pages multi.page.check
       
   696 	{ pages n.dashify } % gnp - removed () % jtb: removed pp.
       
   697 	{ pages }
       
   698     if$
       
   699   }
       
   700   if$
       
   701 }
       
   702 
       
   703 % By Young (and Spencer)
       
   704 % GNP - fixed bugs with missing volume, number, and/or pages
       
   705 %
       
   706 % Format journal, volume, number, pages for article types.
       
   707 %
       
   708 FUNCTION {format.jour.vol}
       
   709 { journal empty$
       
   710     { "no journal in " cite$ * warning$
       
   711       "" }
       
   712     { journal emphasize.space }
       
   713     if$
       
   714   number empty$
       
   715     { volume empty$
       
   716        { "no number and no volume in " cite$ * warning$
       
   717          "" * }
       
   718        { "~{\em " * Volume * "}" * }
       
   719       if$
       
   720     }
       
   721     { volume empty$
       
   722       {"no volume for " cite$ * warning$
       
   723        "~" * number * }
       
   724       { "~" *
       
   725         volume emphasize.comma
       
   726         "~" * number * * }
       
   727       if$
       
   728      month empty$
       
   729      {} 
       
   730      {" (" * month * ")" *} 
       
   731      if$
       
   732     }
       
   733   if$
       
   734   pages empty$
       
   735     {"page numbers missing in " cite$ * warning$
       
   736      "" * } % gnp - place a null string on the stack for output
       
   737     { duplicate$ empty$
       
   738       { pop$ format.pages }
       
   739       { ", " *  pages n.dashify * } % gnp - removed pp. for articles
       
   740       if$
       
   741     }
       
   742   if$
       
   743 }
       
   744 
       
   745 FUNCTION {format.chapter.pages}
       
   746 { chapter empty$
       
   747     'format.pages
       
   748     { type empty$
       
   749         { "Chapter" } % gnp - changed to mixed case
       
   750         { type "t" change.case$ }
       
   751       if$
       
   752       chapter tie.or.space.connect
       
   753       pages empty$
       
   754         {"page numbers missing in " cite$ * warning$} % gnp - added check
       
   755         { ", " * format.pages * }
       
   756       if$
       
   757     }
       
   758   if$
       
   759 }
       
   760 
       
   761 % jtb: format for collections or proceedings not appearing in a journal
       
   762 FUNCTION {format.in.emphasize.booktitle}
       
   763 { booktitle empty$
       
   764   { "" }
       
   765   { "In " format.emphasize.booktitle * }
       
   766   if$
       
   767 }
       
   768 
       
   769 % jtb: format for proceedings appearing in a journal
       
   770 FUNCTION {format.in.booktitle}
       
   771 { booktitle empty$
       
   772   { "" }
       
   773   { "In " booktitle * }
       
   774   if$
       
   775 }
       
   776 
       
   777 FUNCTION {format.in.ed.booktitle}
       
   778 { booktitle empty$
       
   779   { "" }
       
   780   { editor empty$
       
   781     { "In " format.emphasize.booktitle * }
       
   782 		% jtb: swapped editor location
       
   783     { "In " format.emphasize.booktitle * ", " * format.editors.fml * }
       
   784     if$
       
   785   }
       
   786   if$
       
   787 }
       
   788 
       
   789 FUNCTION {format.thesis.type}
       
   790 { type empty$ 
       
   791     'skip$
       
   792 %   {pop$
       
   793    {{ "" }
       
   794    type "t" change.case$}
       
   795   if$
       
   796 }
       
   797 
       
   798 FUNCTION {format.tr.number}
       
   799 { type empty$
       
   800     { "Tech. Rep." }
       
   801     'type
       
   802   if$
       
   803   number empty$
       
   804     { "t" change.case$ }
       
   805     { number tie.or.space.connect }
       
   806   if$
       
   807 }
       
   808 
       
   809 FUNCTION {format.article.crossref}
       
   810 { "See"
       
   811   "\citeN{" * crossref * "}" *
       
   812 }
       
   813 
       
   814 FUNCTION {format.crossref.editor}
       
   815 { editor #1 "{vv~}{ll}" format.name$
       
   816   editor num.names$ duplicate$
       
   817   #2 >
       
   818     { pop$ " et~al\mbox{.}" * }		% jrh: avoid spacing problems
       
   819     { #2 <
       
   820     'skip$
       
   821     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
       
   822         { " et~al\mbox{.}" * }		% jrh: avoid spacing problems
       
   823         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
       
   824       if$
       
   825     }
       
   826       if$
       
   827     }
       
   828   if$
       
   829 }
       
   830 
       
   831 FUNCTION {format.book.crossref}
       
   832 { volume empty$
       
   833     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
       
   834       "In "
       
   835     }
       
   836     { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
       
   837       " of " *
       
   838     }
       
   839   if$
       
   840   editor empty$
       
   841   editor field.or.null author field.or.null =
       
   842   or
       
   843     { key empty$
       
   844     { series empty$
       
   845         { "need editor, key, or series for " cite$ * " to crossref " *
       
   846           crossref * warning$
       
   847           "" *
       
   848         }
       
   849         { "{\em " * series * "\/}" * }
       
   850       if$
       
   851     }
       
   852     { key * }
       
   853       if$
       
   854     }
       
   855     { format.crossref.editor * }
       
   856   if$
       
   857   " \citeN{" * crossref * "}" *
       
   858 }
       
   859 
       
   860 FUNCTION {format.incoll.inproc.crossref}
       
   861 { "See"
       
   862   " \citeN{" * crossref * "}" *
       
   863 }
       
   864 
       
   865 % format.lab.names:
       
   866 %
       
   867 % determines "short" names for the abbreviated author information.
       
   868 % "Long" labels are created in calc.label, using the routine my.full.label
       
   869 % to format author and editor fields.
       
   870 %
       
   871 % There are 4 cases for labels.   (n=3 in the example)
       
   872 % a) one author             Foo
       
   873 % b) one to n               Foo, Bar and Baz
       
   874 % c) use of "and others"    Foo, Bar et al.
       
   875 % d) more than n            Foo et al.
       
   876 %
       
   877 FUNCTION {format.lab.names}
       
   878 { 's :=
       
   879   s num.names$ 'numnames :=
       
   880   numnames #2 >    % change number to number of others allowed before
       
   881 		   % forcing "et al".
       
   882     { s #1 "{vv~}{ll}" format.name$ " et~al\mbox{.}" * } % jrh: \mbox{} added
       
   883     {
       
   884       numnames #1 - 'namesleft :=
       
   885       #2 'nameptr :=
       
   886       s #1 "{vv~}{ll}" format.name$
       
   887 	{ namesleft #0 > }
       
   888 	{ nameptr numnames =
       
   889 	    { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
       
   890 		{ " et~al\mbox{.}" * }		% jrh: avoid spacing problems
       
   891 		{ " and " * s nameptr "{vv~}{ll}" format.name$ * }
       
   892 	      if$
       
   893 	    }
       
   894 	    { ", " * s nameptr "{vv~}{ll}" format.name$ * }
       
   895 	  if$
       
   896 	  nameptr #1 + 'nameptr :=
       
   897 	  namesleft #1 - 'namesleft :=
       
   898 	}
       
   899       while$
       
   900     }
       
   901   if$
       
   902 }
       
   903 
       
   904 FUNCTION {author.key.label}
       
   905 { author empty$
       
   906     { key empty$
       
   907           { "no key, author in " cite$ * warning$
       
   908             cite$ #1 #3 substring$ }
       
   909          'key
       
   910       if$
       
   911     }
       
   912     { author format.lab.names }
       
   913   if$
       
   914 }
       
   915 
       
   916 FUNCTION {editor.key.label}
       
   917 { editor empty$
       
   918     { key empty$
       
   919           { "no key, editor in " cite$ * warning$
       
   920             cite$ #1 #3 substring$ }
       
   921           'key
       
   922         if$
       
   923      }
       
   924      { editor format.lab.names }
       
   925   if$
       
   926 }
       
   927 
       
   928 FUNCTION {author.key.organization.label}
       
   929 %
       
   930 % added - gnp. Provide label formatting by organization if author is null.
       
   931 %
       
   932 { author empty$
       
   933     { organization empty$
       
   934 	{ key empty$
       
   935 	    { "no key, author or organization in " cite$ * warning$
       
   936               cite$ #1 #3 substring$ }
       
   937 	    'key
       
   938 	  if$
       
   939 	}
       
   940         { organization }
       
   941       if$
       
   942     }
       
   943     { author format.lab.names }
       
   944   if$
       
   945 }
       
   946 
       
   947 FUNCTION {editor.key.organization.label}
       
   948 %
       
   949 % added - gnp. Provide label formatting by organization if editor is null.
       
   950 %
       
   951 { editor empty$
       
   952     { organization empty$
       
   953 	{ key empty$
       
   954 	    { "no key, editor or organization in " cite$ * warning$
       
   955               cite$ #1 #3 substring$ }
       
   956 	    'key
       
   957 	  if$
       
   958 	}
       
   959         { organization }
       
   960       if$
       
   961     }
       
   962     { editor format.lab.names }
       
   963   if$
       
   964 }
       
   965 
       
   966 FUNCTION {author.editor.key.label}
       
   967 { author empty$
       
   968     { editor empty$
       
   969           { key empty$
       
   970                { "no key, author, or editor in " cite$ * warning$
       
   971                  cite$ #1 #3 substring$ }
       
   972              'key
       
   973            if$
       
   974          }
       
   975           { editor format.lab.names }
       
   976       if$
       
   977     }
       
   978     { author format.lab.names }
       
   979   if$
       
   980 }
       
   981 
       
   982 FUNCTION {calc.label}
       
   983 %
       
   984 % Changed - GNP. See also author.organization.sort, editor.organization.sort
       
   985 % Form label for BibTeX entry. The classification of which fields are used
       
   986 % for which type of entry (book, inbook, etc.) are taken from alpha.bst.
       
   987 % The change here from newapa is to also include organization as a
       
   988 % citation label if author or editor is missing.
       
   989 %
       
   990 { type$ "book" =
       
   991   type$ "inbook" =
       
   992   or
       
   993     'author.editor.key.label
       
   994     { type$ "proceedings" =
       
   995 	'editor.key.organization.label
       
   996 	{ type$ "manual" =
       
   997 	    'author.key.organization.label
       
   998 	    'author.key.label
       
   999 	  if$
       
  1000 	}
       
  1001       if$
       
  1002     }
       
  1003   if$
       
  1004 
       
  1005   author empty$  % generate the full label citation information.
       
  1006     { editor empty$
       
  1007         { organization empty$
       
  1008            { "no author, editor, or organization in " cite$ * warning$
       
  1009              "??" }
       
  1010            { organization }
       
  1011            if$
       
  1012         }
       
  1013         { editor my.full.label }
       
  1014         if$
       
  1015     }
       
  1016     { author my.full.label }
       
  1017   if$
       
  1018 
       
  1019 % leave label on the stack, to be popped when required.
       
  1020 
       
  1021   "}{" * swap$ * "}{" *
       
  1022 %  year field.or.null purify$ #-1 #4 substring$ *
       
  1023 %
       
  1024 % save the year for sort processing afterwards (adding a, b, c, etc.)
       
  1025 %
       
  1026   year field.or.null purify$ #-1 #4 substring$
       
  1027   'label.year :=
       
  1028 }
       
  1029 
       
  1030 FUNCTION {output.bibitem}
       
  1031 { newline$
       
  1032 
       
  1033   "\bibitem[\protect\citeauthoryear{" write$
       
  1034   calc.label write$
       
  1035   sort.year write$
       
  1036   "}]{" write$
       
  1037 
       
  1038   cite$ write$
       
  1039   "}" write$
       
  1040   newline$
       
  1041   ""
       
  1042   before.all 'output.state :=
       
  1043 }
       
  1044 
       
  1045 FUNCTION {article}
       
  1046 { output.bibitem
       
  1047   format.authors
       
  1048   "author" output.check
       
  1049   author format.key output          % added
       
  1050   output.year.check                 % added
       
  1051   new.block
       
  1052   format.title
       
  1053   "title" output.check
       
  1054   new.block
       
  1055   crossref missing$
       
  1056     { format.jour.vol output
       
  1057     }
       
  1058     { format.article.crossref output.nonnull
       
  1059       format.pages output
       
  1060     }
       
  1061   if$
       
  1062   new.block
       
  1063   note output
       
  1064   fin.entry
       
  1065 }
       
  1066 
       
  1067 FUNCTION {book}
       
  1068 { output.bibitem
       
  1069   author empty$
       
  1070     { format.editors
       
  1071 	  "author and editor" output.check }
       
  1072     { format.authors
       
  1073 	  output.nonnull
       
  1074       crossref missing$
       
  1075     	{ "author and editor" editor either.or.check }
       
  1076     	'skip$
       
  1077       if$
       
  1078     }
       
  1079   if$
       
  1080   output.year.check       % added
       
  1081   new.block
       
  1082   format.btitle
       
  1083   "title" output.check
       
  1084   crossref missing$
       
  1085     { new.sentence		% jtb: start a new sentence for series/volume
       
  1086       format.bvolume output
       
  1087       new.block
       
  1088       format.number.series output
       
  1089       new.sentence
       
  1090       publisher "publisher" output.check
       
  1091       address "address" output.check	% jtb: require address
       
  1092     }
       
  1093     { new.block
       
  1094       format.book.crossref output.nonnull
       
  1095     }
       
  1096   if$
       
  1097   new.block
       
  1098   note output
       
  1099   fin.entry
       
  1100 }
       
  1101 
       
  1102 FUNCTION {booklet}
       
  1103 { output.bibitem
       
  1104   format.authors output
       
  1105   author format.key output          % added
       
  1106   output.year.check                 % added
       
  1107   new.block
       
  1108   format.title
       
  1109   "title" output.check
       
  1110   new.block
       
  1111   howpublished output
       
  1112   address output
       
  1113   new.block
       
  1114   note output
       
  1115   fin.entry
       
  1116 }
       
  1117 
       
  1118 FUNCTION {inbook}
       
  1119 { output.bibitem
       
  1120   author empty$
       
  1121     { format.editors
       
  1122       "author and editor" output.check
       
  1123     }
       
  1124     { format.authors output.nonnull
       
  1125       crossref missing$
       
  1126     { "author and editor" editor either.or.check }
       
  1127     'skip$
       
  1128       if$
       
  1129     }
       
  1130   if$
       
  1131   output.year.check                 % added
       
  1132   new.block
       
  1133   format.btitle
       
  1134   "title" output.check
       
  1135   crossref missing$
       
  1136     { new.sentence		% jtb: start a new sentence for series/volume
       
  1137       format.bvolume output
       
  1138       new.block
       
  1139       format.number.series output
       
  1140       new.sentence
       
  1141       publisher "publisher" output.check
       
  1142       address "address" output.check	% jtb: require address
       
  1143       format.chapter.pages
       
  1144       "chapter and pages" output.check	% jtb: moved from before publisher
       
  1145     }
       
  1146     { format.chapter.pages "chapter and pages" output.check
       
  1147       new.block
       
  1148       format.book.crossref output.nonnull
       
  1149     }
       
  1150   if$
       
  1151   new.block
       
  1152   note output
       
  1153   fin.entry
       
  1154 }
       
  1155 
       
  1156 FUNCTION {incollection}
       
  1157 { output.bibitem
       
  1158   format.authors
       
  1159   "author" output.check
       
  1160   author format.key output       % added
       
  1161   output.year.check              % added
       
  1162   new.block
       
  1163   format.title
       
  1164   "title" output.check
       
  1165   new.block
       
  1166   crossref missing$
       
  1167   { format.in.ed.booktitle
       
  1168     "booktitle" output.check
       
  1169     new.sentence		% jtb: start a new sentence for series/volume
       
  1170     format.bvolume output
       
  1171     format.number.series output
       
  1172     new.sentence
       
  1173     publisher "publisher" output.check
       
  1174     address "address" output.check	% jtb: require address
       
  1175     format.chapter.pages output % gnp - was special.output.nonnull
       
  1176 %                                 left out comma before page numbers
       
  1177 				% jtb: moved from before publisher
       
  1178   }
       
  1179   { format.incoll.inproc.crossref
       
  1180 	output.nonnull
       
  1181     format.chapter.pages output
       
  1182   }
       
  1183   if$
       
  1184   new.block
       
  1185   note output
       
  1186   fin.entry
       
  1187 }
       
  1188 
       
  1189 FUNCTION {inproceedings}
       
  1190 { output.bibitem
       
  1191   format.authors
       
  1192   "author" output.check
       
  1193   author format.key output            % added
       
  1194   output.year.check                   % added
       
  1195   new.block
       
  1196   format.title
       
  1197   "title" output.check
       
  1198   new.block
       
  1199   crossref missing$
       
  1200     { journal missing$		% jtb: proceedings appearing in journals
       
  1201       { format.in.emphasize.booktitle format.city "booktitle" output.check
       
  1202         format.editors.fml output
       
  1203         new.sentence		% jtb: start a new sentence for series/volume
       
  1204         format.bvolume output
       
  1205         format.number.series output
       
  1206         new.sentence
       
  1207         organization output
       
  1208         publisher "publisher" output.check % jtb: require publisher (?)
       
  1209         address "address" output.check	% jtb: require address
       
  1210         format.pages output	% jtb: moved from before publisher
       
  1211        }
       
  1212        % jtb: new:
       
  1213        { format.in.booktitle format.city "booktitle" output.check
       
  1214          format.editors.fml output
       
  1215          new.sentence
       
  1216          format.jour.vol output
       
  1217        }
       
  1218        if$
       
  1219       }
       
  1220     { format.incoll.inproc.crossref output.nonnull
       
  1221       format.pages output
       
  1222     }
       
  1223   if$
       
  1224   new.block
       
  1225   note output
       
  1226   fin.entry
       
  1227 }
       
  1228 
       
  1229 FUNCTION {conference} { inproceedings }
       
  1230 
       
  1231 FUNCTION {manual}
       
  1232 { output.bibitem
       
  1233   author empty$
       
  1234     { editor empty$
       
  1235       { organization "organization" output.check
       
  1236         organization format.key output }  % if all else fails, use key
       
  1237       { format.editors "author and editor" output.check }
       
  1238       if$
       
  1239     }
       
  1240     { format.authors output.nonnull }
       
  1241     if$
       
  1242   output.year.check                 % added
       
  1243   new.block
       
  1244   format.btitle
       
  1245   "title" output.check
       
  1246   organization address new.block.checkb
       
  1247   % jtb: back to normal style: organization, address
       
  1248   organization "organization" output.check
       
  1249   address output
       
  1250   new.block
       
  1251   note output
       
  1252   fin.entry
       
  1253 }
       
  1254 
       
  1255 FUNCTION {mastersthesis}
       
  1256 { output.bibitem
       
  1257   format.authors
       
  1258   "author" output.check
       
  1259   author format.key output          % added
       
  1260   output.year.check                 % added
       
  1261   new.block
       
  1262   format.title
       
  1263   "title" output.check
       
  1264   new.block
       
  1265   "M.S.\ thesis" format.thesis.type output.nonnull
       
  1266   school "school" output.check
       
  1267   address output
       
  1268   new.block
       
  1269   note output
       
  1270   fin.entry
       
  1271 }
       
  1272 
       
  1273 FUNCTION {misc}
       
  1274 { output.bibitem
       
  1275   format.authors output
       
  1276   author format.key output            % added
       
  1277   output.year.check                   % added
       
  1278   title howpublished new.block.checkb
       
  1279   format.title output
       
  1280   new.block
       
  1281   howpublished output
       
  1282   new.block
       
  1283   note output
       
  1284   fin.entry
       
  1285 }
       
  1286 
       
  1287 FUNCTION {phdthesis}
       
  1288 { output.bibitem
       
  1289   format.authors
       
  1290   "author" output.check
       
  1291   author format.key output            % added
       
  1292   output.year.check                   % added
       
  1293   new.block
       
  1294   format.title
       
  1295   "title" output.check
       
  1296   new.block  
       
  1297   format.thesis.type "Ph.D. thesis" output.nonnull
       
  1298   school "school" output.check
       
  1299   address output
       
  1300   new.block
       
  1301   note output
       
  1302   fin.entry
       
  1303 }
       
  1304 
       
  1305 FUNCTION {proceedings}
       
  1306 { output.bibitem
       
  1307   editor empty$
       
  1308     { organization output
       
  1309       organization format.key output }  % gnp - changed from author format.key
       
  1310     { format.editors output.nonnull }
       
  1311   if$
       
  1312 % author format.key output             % gnp - removed (should be either
       
  1313 %                                        editor or organization
       
  1314   output.year.check                    % added (newapa)
       
  1315   new.block
       
  1316   format.btitle format.city "title" output.check	% jtb: added city
       
  1317   new.sentence
       
  1318   format.bvolume output
       
  1319   format.number.series output
       
  1320   new.sentence
       
  1321   organization output
       
  1322   % jtb: normal order: publisher, address
       
  1323   publisher output
       
  1324   address output
       
  1325   new.block
       
  1326   note output
       
  1327   fin.entry
       
  1328 }
       
  1329 
       
  1330 FUNCTION {techreport}
       
  1331 { output.bibitem
       
  1332   format.authors
       
  1333   "author" output.check
       
  1334   author format.key output             % added
       
  1335   output.year.check                    % added
       
  1336   new.block
       
  1337   format.title
       
  1338   "title" output.check
       
  1339   new.block
       
  1340   format.tr.number output		% jtb: moved month ...
       
  1341   institution "institution" output.check
       
  1342   address output
       
  1343   new.sentence
       
  1344   month output				% jtb: ... to here (no parens)
       
  1345   new.block
       
  1346   note output
       
  1347   fin.entry
       
  1348 }
       
  1349 
       
  1350 FUNCTION {unpublished}
       
  1351 { output.bibitem
       
  1352   format.authors
       
  1353   "author" output.check
       
  1354   author format.key output              % added
       
  1355   output.year.check                      % added
       
  1356   new.block
       
  1357   format.title
       
  1358   "title" output.check
       
  1359   new.block
       
  1360   note "note" output.check
       
  1361   fin.entry
       
  1362 }
       
  1363 
       
  1364 FUNCTION {default.type} { misc }
       
  1365 
       
  1366 MACRO {jan} {"Jan."}
       
  1367 
       
  1368 MACRO {feb} {"Feb."}
       
  1369 
       
  1370 MACRO {mar} {"Mar."}		% jtb: corrected: was "March"
       
  1371 
       
  1372 MACRO {apr} {"Apr."}		% jtb: corrected: was "April"
       
  1373 
       
  1374 MACRO {may} {"May"}
       
  1375 
       
  1376 MACRO {jun} {"June"}
       
  1377 
       
  1378 MACRO {jul} {"July"}
       
  1379 
       
  1380 MACRO {aug} {"Aug."}
       
  1381 
       
  1382 MACRO {sep} {"Sept."}
       
  1383 
       
  1384 MACRO {oct} {"Oct."}
       
  1385 
       
  1386 MACRO {nov} {"Nov."}
       
  1387 
       
  1388 MACRO {dec} {"Dec."}
       
  1389 
       
  1390 MACRO {acmcs} {"ACM Comput. Surv."}
       
  1391 
       
  1392 MACRO {acmlett} {"ACM Lett. Program. Lang. Syst."}
       
  1393 
       
  1394 MACRO {acta} {"Acta Inf."}
       
  1395 
       
  1396 MACRO {ai} {"Artificial Intelligence"}
       
  1397 
       
  1398 MACRO {al} {"Ada Lett."}
       
  1399 
       
  1400 MACRO {acr} {"Adv. Comput. Res."}
       
  1401 
       
  1402 MACRO {bit} {"Bit"}
       
  1403 
       
  1404 MACRO {cacm} {"Commun. ACM"}
       
  1405 
       
  1406 MACRO {cj} {"Comput. J."}
       
  1407 
       
  1408 MACRO {cn} {"Comput. Netw."}
       
  1409 
       
  1410 MACRO {cl} {"Comput. Lang."}
       
  1411 
       
  1412 MACRO {ibmjrd} {"IBM J. Res. and Development"}
       
  1413 
       
  1414 MACRO {ibmsj} {"IBM Systems Journal"}
       
  1415 
       
  1416 MACRO {ict} {"Inf. Contr."}
       
  1417 
       
  1418 MACRO {ieebcs} {"IEE/BCS Softw. Eng. J."}
       
  1419 
       
  1420 MACRO {ieees} {"IEEE Softw."}
       
  1421 
       
  1422 MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
       
  1423 
       
  1424 MACRO {ieeetc} {"IEEE Trans. Comput."}
       
  1425 
       
  1426 MACRO {ieeetcad}
       
  1427  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
       
  1428 
       
  1429 MACRO {ieeetpds} {"IEEE Trans. Parall. Distrib. Syst."}
       
  1430 
       
  1431 MACRO {ieeetit} {"IEEE Trans. Inf. Theory"}
       
  1432 
       
  1433 MACRO {ipl} {"Inf. Process. Lett."}
       
  1434 
       
  1435 MACRO {icp} {"Inf. Comput."}
       
  1436 
       
  1437 MACRO {ist} {"Inf. Softw. Tech."}
       
  1438 
       
  1439 MACRO {ijsa} {"Int. J. Supercomput. Appl."}
       
  1440 
       
  1441 MACRO {ijpp} {"Int. J. Parallel Program."}
       
  1442 
       
  1443 MACRO {jlp} {"J. Logic Program."}
       
  1444 
       
  1445 MACRO {jfp} {"J. Funct. Program."}
       
  1446 
       
  1447 MACRO {jcss} {"J. Comput. Syst. Sci."}
       
  1448 
       
  1449 MACRO {jsmrp} {"J. Softw. Maint. Res. Pract."}
       
  1450 
       
  1451 MACRO {jss} {"J. Syst. Softw."}
       
  1452 
       
  1453 MACRO {jlc} {"J. Logic and Comput."}
       
  1454 
       
  1455 MACRO {jlsc} {"J. Lisp Symb. Comput."}
       
  1456 
       
  1457 MACRO {lpls} {"Lett. Program. Lang. Syst."}
       
  1458 
       
  1459 MACRO {mor} {"Math. Oper. Res."}
       
  1460 
       
  1461 MACRO {mscs} {"Math. Struct. Comput. Sci."}
       
  1462 
       
  1463 MACRO {mst} {"Math. Syst. Theor."}	% jtb: was Math. Syst. Theory
       
  1464 				% jtb: (if you ask me, I prefer the old way)
       
  1465 MACRO {ngc} {"New Gen. Comput."}
       
  1466 
       
  1467 MACRO {scp} {"Sci. Comput. Program."}
       
  1468 
       
  1469 MACRO {sicomp} {"SIAM J. Comput."}
       
  1470 
       
  1471 MACRO {spe} {"Softw. Pract. Exper."}
       
  1472 
       
  1473 MACRO {tocs} {"ACM Trans. Comput. Syst."}
       
  1474 
       
  1475 MACRO {tods} {"ACM Trans. Database Syst."}
       
  1476 
       
  1477 MACRO {tog} {"ACM Trans. Graphics"}
       
  1478 
       
  1479 MACRO {toms} {"ACM Trans. Math. Softw."}
       
  1480 
       
  1481 MACRO {toois} {"ACM Trans. Office Inf. Syst."}
       
  1482 
       
  1483 MACRO {toplas} {"ACM Trans. Program. Lang. Syst."}
       
  1484 
       
  1485 MACRO {tocl} {"ACM Trans. On Comp. Logic"}
       
  1486 
       
  1487 MACRO {tcs} {"Theor. Comput. Sci."}	% jtb: was Theor. Comp. Sci.
       
  1488 
       
  1489 MACRO {tr} {"Tech. Rep."}
       
  1490 
       
  1491 READ
       
  1492 
       
  1493 FUNCTION {sortify}
       
  1494 { purify$
       
  1495   "l" change.case$
       
  1496 }
       
  1497 
       
  1498 INTEGERS { len }
       
  1499 
       
  1500 FUNCTION {chop.word}
       
  1501 { 's :=
       
  1502   'len :=
       
  1503   s #1 len substring$ =
       
  1504     { s len #1 + global.max$ substring$ }
       
  1505     's
       
  1506   if$
       
  1507 }
       
  1508 
       
  1509 
       
  1510 
       
  1511 FUNCTION {sort.format.names}
       
  1512 { 's :=
       
  1513   #1 'nameptr :=
       
  1514   ""
       
  1515   s num.names$ 'numnames :=
       
  1516   numnames 'namesleft :=
       
  1517     { namesleft #0 > }
       
  1518     { nameptr #1 >
       
  1519           { "   " * }
       
  1520          'skip$
       
  1521       if$
       
  1522       s nameptr "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}" format.name$ 't :=
       
  1523       nameptr numnames = t "others" = and
       
  1524           { " et~al" * }
       
  1525           { t sortify * }
       
  1526       if$
       
  1527       nameptr #1 + 'nameptr :=
       
  1528       namesleft #1 - 'namesleft :=
       
  1529     }
       
  1530   while$
       
  1531 }
       
  1532 
       
  1533 FUNCTION {sort.format.title}
       
  1534 { 't :=
       
  1535   "A " #2
       
  1536     "An " #3
       
  1537       "The " #4 t chop.word
       
  1538     chop.word
       
  1539   chop.word
       
  1540   sortify
       
  1541   #1 global.max$ substring$
       
  1542 }
       
  1543 
       
  1544 FUNCTION {author.sort}
       
  1545 { author empty$
       
  1546     { key empty$
       
  1547          { "to sort, need author or key in " cite$ * warning$
       
  1548            "" }
       
  1549          { key sortify }
       
  1550       if$
       
  1551     }
       
  1552     { author sort.format.names }
       
  1553   if$
       
  1554 }
       
  1555 
       
  1556 FUNCTION {editor.sort}
       
  1557 { editor empty$
       
  1558     { key empty$
       
  1559          { "to sort, need editor or key in " cite$ * warning$
       
  1560            ""
       
  1561          }
       
  1562          { key sortify }
       
  1563       if$
       
  1564     }
       
  1565     { editor sort.format.names }
       
  1566   if$
       
  1567 }
       
  1568 
       
  1569 FUNCTION {author.editor.sort}
       
  1570 { author empty$
       
  1571     { "missing author in " cite$ * warning$
       
  1572       editor empty$
       
  1573          { key empty$
       
  1574              { "to sort, need author, editor, or key in " cite$ * warning$
       
  1575                ""
       
  1576              }
       
  1577              { key sortify }
       
  1578            if$
       
  1579          }
       
  1580          { editor sort.format.names }
       
  1581       if$
       
  1582     }
       
  1583     { author sort.format.names }
       
  1584   if$
       
  1585 }
       
  1586 
       
  1587 FUNCTION {author.organization.sort}
       
  1588 %
       
  1589 % added - GNP. Stack author or organization for sorting (from alpha.bst).
       
  1590 % Unlike alpha.bst, we need entire names, not abbreviations
       
  1591 %
       
  1592 { author empty$
       
  1593     { organization empty$
       
  1594 	{ key empty$
       
  1595 	    { "to sort, need author, organization, or key in " cite$ * warning$
       
  1596 	      ""
       
  1597 	    }
       
  1598 	    { key sortify }
       
  1599 	  if$
       
  1600 	}
       
  1601 	{ organization sortify }
       
  1602       if$
       
  1603     }
       
  1604     { author sort.format.names }
       
  1605   if$
       
  1606 }
       
  1607 
       
  1608 FUNCTION {editor.organization.sort}
       
  1609 %
       
  1610 % added - GNP. Stack editor or organization for sorting (from alpha.bst).
       
  1611 % Unlike alpha.bst, we need entire names, not abbreviations
       
  1612 %
       
  1613 { editor empty$
       
  1614     { organization empty$
       
  1615 	{ key empty$
       
  1616 	    { "to sort, need editor, organization, or key in " cite$ * warning$
       
  1617 	      ""
       
  1618 	    }
       
  1619 	    { key sortify }
       
  1620 	  if$
       
  1621 	}
       
  1622 	{ organization sortify }
       
  1623       if$
       
  1624     }
       
  1625     { editor sort.format.names }
       
  1626   if$
       
  1627 }
       
  1628 
       
  1629 FUNCTION {presort}
       
  1630 %
       
  1631 % Presort creates the bibentry's label via a call to calc.label, and then
       
  1632 % sorts the entries based on entry type. Chicago.bst adds support for
       
  1633 % including organizations as the sort key; the following is stolen from
       
  1634 % alpha.bst.
       
  1635 %
       
  1636 { calc.label sortify % recalculate bibitem label
       
  1637   year field.or.null purify$ #-1 #4 substring$ * % add year
       
  1638   "    "
       
  1639   *
       
  1640   type$ "book" =
       
  1641   type$ "inbook" =
       
  1642   or
       
  1643     'author.editor.sort
       
  1644     { type$ "proceedings" =
       
  1645 	'editor.organization.sort
       
  1646 	{ type$ "manual" =
       
  1647 	    'author.organization.sort
       
  1648 	    'author.sort
       
  1649 	  if$
       
  1650 	}
       
  1651       if$
       
  1652     }
       
  1653   if$
       
  1654   #1 entry.max$ substring$        % added for newapa
       
  1655   'sort.label :=                  % added for newapa
       
  1656   sort.label                      % added for newapa
       
  1657   *
       
  1658   "    "
       
  1659   *
       
  1660   title field.or.null
       
  1661   sort.format.title
       
  1662   *
       
  1663   #1 entry.max$ substring$
       
  1664   'sort.key$ :=
       
  1665 }
       
  1666 
       
  1667 ITERATE {presort}
       
  1668 
       
  1669 SORT             % by label, year, author/editor, title
       
  1670 
       
  1671 STRINGS { last.label next.extra }
       
  1672 
       
  1673 INTEGERS { last.extra.num }
       
  1674 
       
  1675 FUNCTION {initialize.extra.label.stuff}
       
  1676 { #0 int.to.chr$ 'last.label :=
       
  1677   "" 'next.extra :=
       
  1678   #0 'last.extra.num :=
       
  1679 }
       
  1680 
       
  1681 FUNCTION {forward.pass}
       
  1682 %
       
  1683 % Pass through all entries, comparing current entry to last one.
       
  1684 % Need to concatenate year to the stack (done by calc.label) to determine
       
  1685 % if two entries are the same (see presort)
       
  1686 %
       
  1687 { last.label
       
  1688   calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
       
  1689   #1 entry.max$ substring$ =     % are they equal?
       
  1690      { last.extra.num #1 + 'last.extra.num :=
       
  1691        last.extra.num int.to.chr$ 'extra.label :=
       
  1692      }
       
  1693      { "a" chr.to.int$ 'last.extra.num :=
       
  1694        "" 'extra.label :=
       
  1695        calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
       
  1696        #1 entry.max$ substring$ 'last.label := % assign to last.label
       
  1697      }
       
  1698   if$
       
  1699 }
       
  1700 
       
  1701 FUNCTION {reverse.pass}
       
  1702 { next.extra "b" =
       
  1703     { "a" 'extra.label := }
       
  1704      'skip$
       
  1705   if$
       
  1706   label.year extra.label * 'sort.year :=
       
  1707   extra.label 'next.extra :=
       
  1708 }
       
  1709 
       
  1710 EXECUTE {initialize.extra.label.stuff}
       
  1711 
       
  1712 ITERATE {forward.pass}
       
  1713 
       
  1714 REVERSE {reverse.pass}
       
  1715 
       
  1716 FUNCTION {bib.sort.order}
       
  1717 { sort.label
       
  1718   "    "
       
  1719   *
       
  1720   year field.or.null sortify
       
  1721   *
       
  1722   "    "
       
  1723   *
       
  1724   title field.or.null
       
  1725   sort.format.title
       
  1726   *
       
  1727   #1 entry.max$ substring$
       
  1728   'sort.key$ :=
       
  1729 }
       
  1730 
       
  1731 ITERATE {bib.sort.order}
       
  1732 
       
  1733 SORT             % by sort.label, year, title --- giving final bib. order.
       
  1734 
       
  1735 FUNCTION {begin.bib}
       
  1736 
       
  1737 { preamble$ empty$
       
  1738     'skip$
       
  1739     { preamble$ write$ newline$ }
       
  1740   if$
       
  1741   "\begin{thebibliography}{}" write$ newline$
       
  1742 }
       
  1743 
       
  1744 
       
  1745 EXECUTE {begin.bib}
       
  1746 
       
  1747 EXECUTE {init.state.consts}
       
  1748 
       
  1749 ITERATE {call.type$}
       
  1750 
       
  1751 FUNCTION {end.bib}
       
  1752 { newline$
       
  1753   "\end{thebibliography}" write$ newline$
       
  1754 }
       
  1755 
       
  1756 EXECUTE {end.bib}
       
  1757 
       
  1758 
       
  1759 
       
  1760 
       
  1761 
       
  1762 
       
  1763 
       
  1764 
       
  1765 
       
  1766 
       
  1767 
       
  1768 
       
  1769 
       
  1770