...
...
@@ -0,0 +1,3238 @@
1
+%%% -*-BibTeX-*-
2
+%%% ====================================================================
3
+%%% @BibTeX-style-file{
4
+%%% author = "Nelson H. F. Beebe, Boris Veytsman and Gerald Murray",
5
+%%% version = "2.1",
6
+%%% date = "14 June 2017",
7
+%%% filename = "ACM-Reference-Format.bst",
8
+%%% email = "borisv@lk.net, boris@varphi.com",
9
+%%% codetable = "ISO/ASCII",
10
+%%% keywords = "ACM Transactions bibliography style; BibTeX",
11
+%%% license = "public domain",
12
+%%% supported = "yes",
13
+%%% abstract = "",
14
+%%% }
15
+%%% ====================================================================
16
+
17
+%%% Revision history: see source in git
18
+
19
+ENTRY
20
+ { address
21
+ advisor
22
+ archiveprefix
23
+ author
24
+ booktitle
25
+ chapter
26
+ city
27
+ date
28
+ edition
29
+ editor
30
+ eprint
31
+ howpublished
32
+ institution
33
+ journal
34
+ key
35
+ month
36
+ note
37
+ number
38
+ organization
39
+ pages
40
+ primaryclass
41
+ publisher
42
+ school
43
+ series
44
+ title
45
+ type
46
+ volume
47
+ year
48
+ % New keys recognized
49
+ issue % UTAH: used in, e.g., ACM SIGSAM Bulletin and ACM Communications in Computer Algebra
50
+ articleno
51
+ eid
52
+ day % UTAH: needed for newspapers, weeklies, bi-weeklies
53
+ doi % UTAH
54
+ url % UTAH
55
+ bookpages % UTAH
56
+ numpages
57
+ lastaccessed % UTAH: used only for @Misc{...}
58
+ coden % UTAH
59
+ isbn % UTAH
60
+ isbn-13 % UTAH
61
+ issn % UTAH
62
+ lccn % UTAH
63
+ }
64
+ {}
65
+ { label.year extra.label sort.year sort.label basic.label.year}
66
+
67
+INTEGERS { output.state before.all mid.sentence after.sentence after.block }
68
+
69
+INTEGERS { show-isbn-10-and-13 } % initialized below in begin.bib
70
+
71
+INTEGERS { nameptr namesleft numnames }
72
+
73
+INTEGERS { multiresult }
74
+
75
+INTEGERS { len }
76
+
77
+INTEGERS { last.extra.num }
78
+
79
+STRINGS { s t t.org u }
80
+
81
+STRINGS { last.label next.extra }
82
+
83
+STRINGS { p1 p2 p3 page.count }
84
+
85
+
86
+FUNCTION { not }
87
+{
88
+ { #0 }
89
+ { #1 }
90
+ if$
91
+}
92
+
93
+FUNCTION { and }
94
+{
95
+ 'skip$
96
+ { pop$ #0 }
97
+ if$
98
+}
99
+
100
+FUNCTION { or }
101
+{
102
+ { pop$ #1 }
103
+ 'skip$
104
+ if$
105
+}
106
+
107
+
108
+FUNCTION { dump.stack.1 }
109
+{
110
+ duplicate$ "STACK[top] = [" swap$ * "]" * warning$
111
+}
112
+
113
+FUNCTION { dump.stack.2 }
114
+{
115
+ duplicate$ "STACK[top ] = [" swap$ * "]" * warning$
116
+ swap$
117
+ duplicate$ "STACK[top-1] = [" swap$ * "]" * warning$
118
+ swap$
119
+}
120
+
121
+FUNCTION { empty.or.unknown }
122
+{
123
+ %% Examine the top stack entry, and push 1 if it is empty, or
124
+ %% consists only of whitespace, or is a string beginning with two
125
+ %% queries (??), and otherwise, push 0.
126
+ %%
127
+ %% This function provides a replacement for empty$, with the
128
+ %% convenient feature that unknown values marked by two leading
129
+ %% queries are treated the same as missing values, and thus, do not
130
+ %% appear in the output .bbl file, and yet, their presence in .bib
131
+ %% file(s) serves to mark values which are temporarily missing, but
132
+ %% are expected to be filled in eventually once more data is
133
+ %% obtained. The TeX User Group and BibNet bibliography archives
134
+ %% make extensive use of this practice.
135
+ %%
136
+ %% An empty string cannot serve the same purpose, because just as in
137
+ %% statistics data processing, an unknown value is not the same as an
138
+ %% empty value.
139
+ %%
140
+ %% At entry: stack = ... top:[string]
141
+ %% At exit: stack = ... top:[0 or 1]
142
+
143
+ duplicate$ empty$
144
+ { pop$ #1 }
145
+ { #1 #2 substring$ "??" = }
146
+ if$
147
+}
148
+
149
+FUNCTION { writeln }
150
+{
151
+ %% In BibTeX style files, the sequences
152
+ %%
153
+ %% ... "one" "two" output
154
+ %% ... "one" "two" output.xxx
155
+ %%
156
+ %% ship "one" to the output file, possibly following by punctuation,
157
+ %% leaving the stack with
158
+ %%
159
+ %% ... "two"
160
+ %%
161
+ %% There is thus a one-string lag in output processing that must be
162
+ %% carefully handled to avoid duplicating a string in the output
163
+ %% file. Unless otherwise noted, all output.xxx functions leave
164
+ %% just one new string on the stack, and that model should be born
165
+ %% in mind when reading or writing function code.
166
+ %%
167
+ %% BibTeX's asynchronous buffering of output from strings from the
168
+ %% stack is confusing because newline$ bypasses the buffer. It
169
+ %% would have been so much easier for newline to be a character
170
+ %% rather than a state of the output-in-progress.
171
+ %%
172
+ %% The documentation in btxhak.dvi is WRONG: it says
173
+ %%
174
+ %% newline$ Writes onto the bbl file what's accumulated in the
175
+ %% output buffer. It writes a blank line if and only
176
+ %% if the output buffer is empty. Since write$ does
177
+ %% reasonable line breaking, you should use this
178
+ %% function only when you want a blank line or an
179
+ %% explicit line break.
180
+ %%
181
+ %% write$ Pops the top (string) literal and writes it on the
182
+ %% output buffer (which will result in stuff being
183
+ %% written onto the bbl file when the buffer fills
184
+ %% up).
185
+ %%
186
+ %% Examination of the BibTeX source code shows that write$ does
187
+ %% indeed behave as claimed, but newline$ sends a newline character
188
+ %% directly to the output file, leaving the stack unchanged. The
189
+ %% first line "Writes onto ... buffer." is therefore wrong.
190
+ %%
191
+ %% The original BibTeX style files almost always use "write$ newline$"
192
+ %% in that order, so it makes sense to hide that pair in a private
193
+ %% function like this one, named after a statement in Pascal,
194
+ %% the programming language embedded in the BibTeX Web program.
195
+
196
+ write$ % output top-of-stack string
197
+ newline$ % immediate write of newline (not via stack)
198
+}
199
+
200
+FUNCTION { init.state.consts }
201
+{
202
+ #0 'before.all :=
203
+ #1 'mid.sentence :=
204
+ #2 'after.sentence :=
205
+ #3 'after.block :=
206
+}
207
+
208
+FUNCTION { output.nonnull }
209
+{ % Stack in: ... R S T Stack out: ... R T File out: S<comma><space>
210
+ 's :=
211
+ output.state mid.sentence =
212
+ {
213
+ ", " * write$
214
+ }
215
+ {
216
+ output.state after.block =
217
+ {
218
+ add.period$ writeln
219
+ "\newblock " write$
220
+ }
221
+ {
222
+ output.state before.all =
223
+ {
224
+ write$
225
+ }
226
+ {
227
+ add.period$ " " * write$
228
+ }
229
+ if$
230
+ }
231
+ if$
232
+ mid.sentence 'output.state :=
233
+ }
234
+ if$
235
+ s
236
+}
237
+
238
+FUNCTION { output.nonnull.dot.space }
239
+{ % Stack in: ... R S T Stack out: ... R T File out: S<dot><space>
240
+ 's :=
241
+ output.state mid.sentence = % { "<DEBUG output.nonnull.dot.space>. " * write$ }
242
+ {
243
+ ". " * write$
244
+ }
245
+ {
246
+ output.state after.block =
247
+ {
248
+ add.period$ writeln "\newblock " write$
249
+ }
250
+ {
251
+ output.state before.all =
252
+ {
253
+ write$
254
+ }
255
+ {
256
+ add.period$ " " * write$
257
+ }
258
+ if$
259
+ }
260
+ if$
261
+ mid.sentence 'output.state :=
262
+ }
263
+ if$
264
+ s
265
+}
266
+
267
+FUNCTION { output.nonnull.remove }
268
+{ % Stack in: ... R S T Stack out: ... R T File out: S<space>
269
+ 's :=
270
+ output.state mid.sentence =
271
+ {
272
+ " " * write$
273
+ }
274
+ {
275
+ output.state after.block =
276
+ {
277
+ add.period$ writeln "\newblock " write$
278
+ }
279
+ {
280
+ output.state before.all =
281
+ {
282
+ write$
283
+ }
284
+ {
285
+ add.period$ " " * write$
286
+ }
287
+ if$
288
+ }
289
+ if$
290
+ mid.sentence 'output.state :=
291
+ }
292
+ if$
293
+ s
294
+}
295
+
296
+FUNCTION { output.nonnull.removenospace }
297
+{ % Stack in: ... R S T Stack out: ... R T File out: S
298
+ 's :=
299
+ output.state mid.sentence =
300
+ {
301
+ "" * write$
302
+ }
303
+ {
304
+ output.state after.block =
305
+ {
306
+ add.period$ writeln "\newblock " write$
307
+ }
308
+ {
309
+ output.state before.all =
310
+ {
311
+ write$
312
+ }
313
+ {
314
+ add.period$ " " * write$
315
+ }
316
+ if$
317
+ }
318
+ if$
319
+ mid.sentence 'output.state :=
320
+ }
321
+ if$
322
+ s
323
+}
324
+
325
+FUNCTION { output }
326
+{ % discard top token if empty, else like output.nonnull
327
+ duplicate$ empty.or.unknown
328
+ 'pop$
329
+ 'output.nonnull
330
+ if$
331
+}
332
+
333
+FUNCTION { output.dot.space }
334
+{ % discard top token if empty, else like output.nonnull.dot.space
335
+ duplicate$ empty.or.unknown
336
+ 'pop$
337
+ 'output.nonnull.dot.space
338
+ if$
339
+}
340
+
341
+FUNCTION { output.removenospace }
342
+{ % discard top token if empty, else like output.nonnull.removenospace
343
+ duplicate$ empty.or.unknown
344
+ 'pop$
345
+ 'output.nonnull.removenospace
346
+ if$
347
+}
348
+
349
+FUNCTION { output.check }
350
+{ % like output, but warn if key name on top-of-stack is not set
351
+ 't :=
352
+ duplicate$ empty.or.unknown
353
+ { pop$ "empty " t * " in " * cite$ * warning$ }
354
+ 'output.nonnull
355
+ if$
356
+}
357
+
358
+FUNCTION { bibinfo.output.check }
359
+{ % like output.check, adding bibinfo field
360
+ 't :=
361
+ duplicate$ empty.or.unknown
362
+ { pop$ "empty " t * " in " * cite$ * warning$ }
363
+ { "\bibinfo{" t "}{" * * swap$ * "}" *
364
+ output.nonnull }
365
+ if$
366
+}
367
+
368
+FUNCTION { output.check.dot.space }
369
+{ % like output.dot.space, but warn if key name on top-of-stack is not set
370
+ 't :=
371
+ duplicate$ empty.or.unknown
372
+ { pop$ "empty " t * " in " * cite$ * warning$ }
373
+ 'output.nonnull.dot.space
374
+ if$
375
+}
376
+
377
+FUNCTION { fin.block }
378
+{ % functionally, but not logically, identical to fin.entry
379
+ add.period$
380
+ writeln
381
+}
382
+
383
+FUNCTION { fin.entry }
384
+{
385
+ add.period$
386
+ writeln
387
+}
388
+
389
+FUNCTION { new.sentence }
390
+{ % update sentence state, with neither output nor stack change
391
+ output.state after.block =
392
+ 'skip$
393
+ {
394
+ output.state before.all =
395
+ 'skip$
396
+ { after.sentence 'output.state := }
397
+ if$
398
+ }
399
+ if$
400
+}
401
+
402
+FUNCTION { fin.sentence }
403
+{
404
+ add.period$
405
+ write$
406
+ new.sentence
407
+ ""
408
+}
409
+
410
+FUNCTION { new.block }
411
+{
412
+ output.state before.all =
413
+ 'skip$
414
+ { after.block 'output.state := }
415
+ if$
416
+}
417
+
418
+FUNCTION { output.coden } % UTAH
419
+{ % output non-empty CODEN as one-line sentence (stack untouched)
420
+ coden empty.or.unknown
421
+ { }
422
+ { "\showCODEN{" coden * "}" * writeln }
423
+ if$
424
+}
425
+
426
+FUNCTION { format.articleno }
427
+{
428
+ articleno empty.or.unknown not eid empty.or.unknown not and
429
+ { "Both articleno and eid are defined for " cite$ * warning$ }
430
+ 'skip$
431
+ if$
432
+ articleno empty.or.unknown eid empty.or.unknown and
433
+ { "" }
434
+ {
435
+ numpages empty.or.unknown
436
+ { "articleno or eid field, but no numpages field, in "
437
+ cite$ * warning$ }
438
+ { }
439
+ if$
440
+ eid empty.or.unknown
441
+ { "Article \bibinfo{articleno}{" articleno * "}" * }
442
+ { "Article \bibinfo{articleno}{" eid * "}" * }
443
+ if$
444
+ }
445
+ if$
446
+}
447
+
448
+FUNCTION { format.year }
449
+{ % push year string or "[n. d.]" onto output stack
450
+ %% Because year is a mandatory field, we always force SOMETHING
451
+ %% to be output
452
+ "\bibinfo{year}{"
453
+ year empty.or.unknown
454
+ { "[n. d.]" }
455
+ { year }
456
+ if$
457
+ * "}" *
458
+}
459
+
460
+FUNCTION { format.day.month }
461
+{ % push "day month " or "month " or "" onto output stack
462
+ day empty.or.unknown
463
+ {
464
+ month empty.or.unknown
465
+ { "" }
466
+ { "\bibinfo{date}{" month * "} " *}
467
+ if$
468
+ }
469
+ {
470
+ month empty.or.unknown
471
+ { "" }
472
+ { "\bibinfo{date}{" day * " " * month * "} " *}
473
+ if$
474
+ }
475
+ if$
476
+}
477
+
478
+FUNCTION { format.day.month.year } % UTAH
479
+{ % if month is empty, push "" else push "(MON.)" or "(DD MON.)"
480
+ % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
481
+ % acm-*.bst addition: prefix parenthesized date string with
482
+ % ", Article nnn "
483
+ articleno empty.or.unknown eid empty.or.unknown and
484
+ { "" }
485
+ { output.state after.block =
486
+ {", " format.articleno * }
487
+ { format.articleno }
488
+ if$
489
+ }
490
+ if$
491
+ " (" * format.day.month * format.year * ")" *
492
+}
493
+
494
+FUNCTION { output.day.month.year } % UTAH
495
+{ % if month is empty value, do nothing; else output stack top and
496
+ % leave with new top string "(MON.)" or "(DD MON.)"
497
+ % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
498
+ format.day.month.year
499
+ output.nonnull.remove
500
+}
501
+
502
+FUNCTION { strip.doi } % UTAH
503
+{ % Strip any Web address prefix to recover the bare DOI, leaving the
504
+ % result on the output stack, as recommended by CrossRef DOI
505
+ % documentation.
506
+ % For example, reduce "http://doi.acm.org/10.1145/1534530.1534545" to
507
+ % "10.1145/1534530.1534545". That is later typeset and displayed as
508
+ % doi:10.1145/1534530.1534545 as the LAST item in the reference list
509
+ % entry. Publisher Web sites wrap this with a suitable link to a real
510
+ % URL to resolve the DOI, and the master https://doi.org/ address is
511
+ % preferred, since publisher-specific URLs can disappear in response
512
+ % to economic events. All journals are encouraged by the DOI
513
+ % authorities to use that typeset format and link procedures for
514
+ % uniformity across all publications that include DOIs in reference
515
+ % lists.
516
+ % The numeric prefix is guaranteed to start with "10.", so we use
517
+ % that as a test.
518
+ % 2017-02-04 Added stripping of https:// (Boris)
519
+ doi #1 #3 substring$ "10." =
520
+ { doi }
521
+ {
522
+ doi 't := % get modifiable copy of DOI
523
+
524
+ % Change https:// to http:// to strip both prefixes (BV)
525
+
526
+ t #1 #8 substring$ "https://" =
527
+ { "http://" t #9 t text.length$ #8 - substring$ * 't := }
528
+ { }
529
+ if$
530
+
531
+ t #1 #7 substring$ "http://" =
532
+ {
533
+ t #8 t text.length$ #7 - substring$ 't :=
534
+
535
+ "INTERNAL STYLE-FILE ERROR" 's :=
536
+
537
+ % search for next "/" and assign its suffix to s
538
+
539
+ { t text.length$ }
540
+ {
541
+ t #1 #1 substring$ "/" =
542
+ {
543
+ % save rest of string as true DOI (should be 10.xxxx/yyyy)
544
+ t #2 t text.length$ #1 - substring$ 's :=
545
+ "" 't := % empty string t terminates the loop
546
+ }
547
+ {
548
+ % discard first character and continue loop: t <= substring(t,2,last)
549
+ t #2 t text.length$ #1 - substring$ 't :=
550
+ }
551
+ if$
552
+ }
553
+ while$
554
+
555
+ % check for valid DOI (should be 10.xxxx/yyyy)
556
+ s #1 #3 substring$ "10." =
557
+ { }
558
+ { "unrecognized DOI substring " s * " in DOI value [" * doi * "]" * warning$ }
559
+ if$
560
+
561
+ s % push the stripped DOI on the output stack
562
+
563
+ }
564
+ {
565
+ "unrecognized DOI value [" doi * "]" * warning$
566
+ doi % push the unrecognized original DOI on the output stack
567
+ }
568
+ if$
569
+ }
570
+ if$
571
+}
572
+
573
+%
574
+% Change by BV: added standard prefix to URL
575
+%
576
+FUNCTION { output.doi } % UTAH
577
+{ % output non-empty DOI as one-line sentence (stack untouched)
578
+ doi empty.or.unknown
579
+ { }
580
+ {
581
+ %% NB: We want URLs at beginning of line to reduce likelihood of
582
+ %% BibTeX's nasty line wrapping after column 79, which then requires
583
+ %% manual (or automated) editing of the .bbl file to repair.
584
+ %% The \url{} macro strips percent-newlines, and is thus safe in
585
+ %% the presence of the line wrapping, but \path|...| and
586
+ %% \verb|...| do not.
587
+ "\showDOI{%" writeln
588
+ "\url{https://doi.org/" strip.doi * "}}" * writeln
589
+ }
590
+ if$
591
+}
592
+
593
+FUNCTION { output.isbn } % UTAH
594
+{ % output non-empty ISBN-10 and/or ISBN-13 as one-line sentences (stack untouched)
595
+ show-isbn-10-and-13
596
+ {
597
+ %% show both 10- and 13-digit ISBNs
598
+ isbn empty.or.unknown
599
+ { }
600
+ {
601
+ "\showISBNx{" isbn * "}" * writeln
602
+ }
603
+ if$
604
+ isbn-13 empty.or.unknown
605
+ { }
606
+ {
607
+ "\showISBNxiii{" isbn-13 * "}" * writeln
608
+ }
609
+ if$
610
+ }
611
+ {
612
+ %% show 10-digit ISBNs only if 13-digit ISBNs not available
613
+ isbn-13 empty.or.unknown
614
+ {
615
+ isbn empty.or.unknown
616
+ { }
617
+ {
618
+ "\showISBNx{" isbn * "}" * writeln
619
+ }
620
+ if$
621
+ }
622
+ {
623
+ "\showISBNxiii{" isbn-13 * "}" * writeln
624
+ }
625
+ if$
626
+ }
627
+ if$
628
+}
629
+
630
+FUNCTION { output.issn } % UTAH
631
+{ % output non-empty ISSN as one-line sentence (stack untouched)
632
+ issn empty.or.unknown
633
+ { }
634
+ { "\showISSN{" issn * "}" * writeln }
635
+ if$
636
+}
637
+
638
+FUNCTION { output.issue }
639
+{ % output non-empty issue number as a one-line sentence (stack untouched)
640
+ issue empty.or.unknown
641
+ { }
642
+ { "Issue " issue * "." * writeln }
643
+ if$
644
+}
645
+
646
+FUNCTION { output.lccn } % UTAH
647
+{ % return with stack untouched
648
+ lccn empty.or.unknown
649
+ { }
650
+ { "\showLCCN{" lccn * "}" * writeln }
651
+ if$
652
+}
653
+
654
+FUNCTION { output.note } % UTAH
655
+{ % return with stack empty
656
+ note empty.or.unknown
657
+ { }
658
+ { "\shownote{" note add.period$ * "}" * writeln }
659
+ if$
660
+}
661
+
662
+FUNCTION { output.note.check } % UTAH
663
+{ % return with stack empty
664
+ note empty.or.unknown
665
+ { "empty note in " cite$ * warning$ }
666
+ { "\shownote{" note add.period$ * "}" * writeln }
667
+ if$
668
+}
669
+
670
+FUNCTION { output.eprint } %
671
+{ % return with stack empty
672
+ eprint empty.or.unknown
673
+ { }
674
+ { "\showeprint"
675
+ archiveprefix empty.or.unknown
676
+ { }
677
+ { "[" archiveprefix "l" change.case$ "]" * * * }
678
+ if$
679
+ "{" *
680
+ primaryclass empty.or.unknown
681
+ { }
682
+ { primaryclass "/" * *}
683
+ if$
684
+ eprint "}" * *
685
+ writeln
686
+ }
687
+ if$
688
+}
689
+
690
+
691
+%
692
+% Changes by BV 2011/04/15. Do not output
693
+% url if doi is defined
694
+%
695
+FUNCTION { output.url } % UTAH
696
+{ % return with stack untouched
697
+ % output URL and associated lastaccessed fields
698
+ doi empty.or.unknown
699
+ {
700
+ url empty.or.unknown
701
+ { }
702
+ {
703
+ %% NB: We want URLs at beginning of line to reduce likelihood of
704
+ %% BibTeX's nasty line wrapping after column 79, which would require
705
+ %% manual (or automated) editing of the .bbl file to repair. However,
706
+ %% the \url{} macro handles the unwrapping job automatically.
707
+ "\showURL{%" writeln
708
+ lastaccessed empty.or.unknown
709
+ { "" }
710
+ { "Retrieved " lastaccessed * " from " * }
711
+ if$
712
+
713
+ %% The URL field may contain a semicolon-separated list of Web
714
+ %% addresses, and we locate and wrap each of them in \url{...}.
715
+ %% The simplistic approach of putting the entire list into the
716
+ %% macro argument is that the semicolons are typeset in a
717
+ %% typewriter font, and no space follows them.
718
+ %%
719
+ %% We therefore replace the original code
720
+ %% "\url{" * url * "}}" * writeln
721
+ %% with this character-at-a-time loop:
722
+
723
+ "\url{" *
724
+
725
+ url 't := % get modifiable copy of URL list
726
+
727
+ { t text.length$ }
728
+ {
729
+ t #1 #1 substring$ ";" =
730
+ { % then split argument at separator
731
+ "};" * writeln
732
+ "\url{"
733
+ }
734
+ { % else concatenate nonblank character to argument
735
+ t #1 #1 substring$ " " =
736
+ { }
737
+ { t #1 #1 substring$ * }
738
+ if$
739
+ }
740
+ if$
741
+
742
+ t #2 t text.length$ #1 - substring$ 't :=
743
+ }
744
+ while$
745
+
746
+ "}}" * writeln
747
+ }
748
+ if$
749
+ }
750
+ { }
751
+ if$
752
+}
753
+
754
+FUNCTION { output.year.check }
755
+{ % warn if year empty, output top string and leave " YEAR<label>" on stack in mid-sentence
756
+ year empty.or.unknown
757
+ { "empty year in " cite$ * warning$
758
+ write$
759
+ " \bibinfo{year}{[n. d.]}"
760
+ "\natexlab{" extra.label * "}" * *
761
+ mid.sentence 'output.state :=
762
+ }
763
+ { write$
764
+ " \bibinfo{year}{" year * "}" *
765
+ "\natexlab{" extra.label * "}" * *
766
+ mid.sentence 'output.state :=
767
+ }
768
+ if$
769
+}
770
+
771
+
772
+FUNCTION { le }
773
+{
774
+ %% test whether first number is less than or equal to second number
775
+ %% stack in: n1 n2
776
+ %% stack out: if n1 <= n2 then 1 else 0
777
+
778
+ %% "DEBUG: le " cite$ * warning$
779
+ > { #0 } { #1 } if$
780
+}
781
+
782
+FUNCTION { ge }
783
+{
784
+ %% test whether first number is greater than or equal to second number
785
+ %% stack in: n1 n2
786
+ %% stack out: if n1 >= n2 then 1 else 0
787
+
788
+ %% "DEBUG: ge " cite$ * warning$
789
+ < { #0 } { #1 } if$
790
+}
791
+
792
+FUNCTION { is.leading.digit }
793
+{
794
+ %% test whether first character of string is a digit
795
+ %% stack in: string
796
+ %% stack out: if first-char-is-digit then 1 else 0
797
+
798
+ #1 #1 substring$ % replace string by string[1:1]
799
+ duplicate$ % string[1:1] string[1:1]
800
+ chr.to.int$
801
+ "0" chr.to.int$ swap$ le % "0" <= string[1:1] --> 0-or-1
802
+ swap$ % 0-or-1 string[1:1]
803
+ chr.to.int$
804
+ "9" chr.to.int$ le % string[1:1} <= "9" --> 0-or-1
805
+ and
806
+}
807
+
808
+FUNCTION { skip.digits }
809
+{
810
+ %% skip over leading digits in string
811
+ %% stack in: string
812
+ %% stack out: rest-of-string leading-digits
813
+
814
+ %% "DEBUG: enter skip.digits " cite$ * warning$
815
+
816
+ %% dump.stack.1
817
+
818
+ duplicate$
819
+ 't :=
820
+ 't.org :=
821
+ "" 'u :=
822
+
823
+ { t text.length$ }
824
+ {
825
+ %% "=================DEBUG: skip.digits t = [" t * "]" * warning$
826
+ t is.leading.digit
827
+ { t #2 t text.length$ #1 - substring$ }
828
+ {
829
+ t 'u :=
830
+ ""
831
+ }
832
+ if$
833
+ 't :=
834
+ }
835
+ while$
836
+
837
+ u % rest of string
838
+ t.org #1 t.org text.length$ u text.length$ - substring$ % leading digits
839
+
840
+ %% "DEBUG: t.org = [" t.org * "]" * warning$
841
+ %% "DEBUG: u = [" u * "]" * warning$
842
+
843
+ %% dump.stack.2
844
+
845
+ %% "DEBUG: leave skip.digits " cite$ * warning$
846
+}
847
+
848
+FUNCTION { skip.nondigits }
849
+{
850
+ %% skip over leading nondigits in string
851
+ %% stack in: string
852
+ %% stack out: rest-of-string
853
+
854
+ %% "DEBUG: enter skip.nondigits " cite$ * warning$
855
+
856
+ 't :=
857
+ "" 'u :=
858
+
859
+ { t text.length$ }
860
+ {
861
+ %% "=================DEBUG: skip.nondigits t = [" t * "]" * warning$
862
+ t is.leading.digit
863
+ {
864
+ t 'u :=
865
+ ""
866
+ }
867
+ { t #2 t text.length$ #1 - substring$ }
868
+ if$
869
+ 't :=
870
+ }
871
+ while$
872
+
873
+ u % rest of string
874
+
875
+ %% dump.stack.1
876
+ %% "DEBUG: leave skip.nondigits " cite$ * warning$
877
+}
878
+
879
+FUNCTION { parse.next.number }
880
+{
881
+ %% stack in: string
882
+ %% stack out: rest-of-string next-numeric-part-of-string
883
+ %% Example:
884
+ %% stack in: "123:1--123:59"
885
+ %% stack out: ":1--123:59" "123"
886
+
887
+ 's :=
888
+ s skip.nondigits 's :=
889
+ s skip.digits
890
+}
891
+
892
+FUNCTION { reduce.pages.to.page.count }
893
+{
894
+ %% Stack in: arbitrary-and-unused
895
+ %% Stack out: unchanged
896
+ %%
897
+ %% For the new-style pagination with article number and numpages or
898
+ %% pages, we expect to have BibTeX entries containing something like
899
+ %% articleno = "17",
900
+ %% pages = "1--23",
901
+ %% with output "Article 17, 23 pages",
902
+ %% or
903
+ %% articleno = "17",
904
+ %% numpages = "23",
905
+ %% with output "Article 17, 23 pages",
906
+ %% or
907
+ %% articleno = "17",
908
+ %% pages = "17:1--17:23",
909
+ %% with output "Article 17, 23 pages",
910
+ %%
911
+ %% If articleno is missing or empty, then we should output "1--23",
912
+ %% "23" (with a warning of a missing articleno), or "17:1--17:23",
913
+ %% respectively.
914
+
915
+ %% "DEBUG: enter reduce.pages.to.page.count " cite$ * warning$
916
+
917
+ %% "DEBUG: pages = [" pages * "]" * warning$
918
+
919
+ pages
920
+ parse.next.number 'p1 :=
921
+ parse.next.number 'p2 :=
922
+ parse.next.number 'p3 :=
923
+ parse.next.number 'page.count :=
924
+
925
+ duplicate$
926
+ empty.or.unknown
927
+ { }
928
+ {
929
+ duplicate$ "unexpected trailing garbage [" swap$ *
930
+ "] after n:p1--n:p2 in pages = [" *
931
+ pages *
932
+ "] in " *
933
+ cite$ *
934
+ warning$
935
+ }
936
+ if$
937
+
938
+ pop$
939
+
940
+ %% "DEBUG: reduce.pages.to.page.count: "
941
+ %% " p1 = " p1 * *
942
+ %% " p2 = " p2 * *
943
+ %% " p3 = " p3 * *
944
+ %% " p4 = " page.count * *
945
+ %% " in " cite$ * * warning$
946
+
947
+ p1 p3 = p2 "1" = and numpages empty.or.unknown and
948
+ { "INFO: reduced pages = [" pages * "] to numpages = [" * page.count * "]" * warning$ }
949
+ {
950
+ numpages empty.or.unknown
951
+ { pages }
952
+ { numpages }
953
+ if$
954
+ 'page.count :=
955
+ }
956
+ if$
957
+
958
+ p1 "1" = p3 empty.or.unknown and numpages empty.or.unknown and
959
+ {
960
+ p2 'page.count :=
961
+ "INFO: reduced pages = [" pages * "] to numpages = [" * page.count * "]" * warning$
962
+ }
963
+ {
964
+ numpages empty.or.unknown
965
+ { pages }
966
+ { numpages }
967
+ if$
968
+ 'page.count :=
969
+ }
970
+ if$
971
+
972
+ %% "DEBUG: leave reduce.pages.to.page.count " cite$ * warning$
973
+}
974
+
975
+FUNCTION { new.block.checkb }
976
+{ % issue a new.block only if at least one of top two stack strings is not empty
977
+ empty.or.unknown
978
+ swap$ empty.or.unknown
979
+ and
980
+ 'skip$
981
+ 'new.block
982
+ if$
983
+}
984
+
985
+FUNCTION { field.or.null }
986
+{ % convert empty value to null string, else return value
987
+ duplicate$ empty.or.unknown
988
+ { pop$ "" }
989
+ 'skip$
990
+ if$
991
+}
992
+
993
+
994
+
995
+FUNCTION { emphasize }
996
+{ % emphasize a non-empty top string on the stack (WITHOUT italic correction)
997
+ duplicate$ empty.or.unknown
998
+ { pop$ "" }
999
+ { "{\em " swap$ * "}" * }
1000
+ if$
1001
+}
1002
+
1003
+FUNCTION { emphasize.with.italic.correction }
1004
+{ % convert empty string to null string, or emphasize with a trailing italic correction
1005
+ duplicate$ empty.or.unknown
1006
+ { pop$ "" }
1007
+ { "{\em " swap$ * "\/}" * }
1008
+ if$
1009
+}
1010
+
1011
+FUNCTION { comma }
1012
+{ % convert empty string to null string, or brace string and add trailing comma
1013
+ duplicate$ empty.or.unknown
1014
+ { pop$ "" }
1015
+ { "{" swap$ * "}," * }
1016
+ if$
1017
+}
1018
+
1019
+FUNCTION { format.names }
1020
+{
1021
+ % Format bibliographical entries with the first author last name first,
1022
+ % and subsequent authors with initials followed by last name.
1023
+ % All names are formatted in this routine.
1024
+
1025
+ 's :=
1026
+ #1 'nameptr := % nameptr = 1;
1027
+ s num.names$ 'numnames := % numnames = num.name$(s);
1028
+ numnames 'namesleft :=
1029
+ { namesleft #0 > }
1030
+ { nameptr #1 =
1031
+ %NO: BAD ORDER: {"{" s nameptr "{ff~}{ll}{, jj}{, vv}" format.name$ * "}" * 't := }
1032
+ %NO: BAD ORDER: {"{" s nameptr "{ff~}{ll}{, jj}{, vv}" format.name$ * "}" * 't := }
1033
+ {"\bibinfo{person}{" s nameptr "{ff }{vv }{ll}{, jj}" format.name$ * "}" * 't := }
1034
+ {"\bibinfo{person}{" s nameptr "{ff }{vv }{ll}{, jj}" format.name$ * "}" * 't := }
1035
+ if$
1036
+ nameptr #1 >
1037
+ {
1038
+ namesleft #1 >
1039
+ { ", " * t * }
1040
+ {
1041
+ numnames #2 >
1042
+ { "," * }
1043
+ 'skip$
1044
+ if$
1045
+ t "\bibinfo{person}{others}" =
1046
+ { " {et~al\mbox{.}}" * } % jrh: avoid spacing problems
1047
+ { " {and} " * t * } % from Chicago Manual of Style
1048
+ if$
1049
+ }
1050
+ if$
1051
+ }
1052
+ 't
1053
+ if$
1054
+ nameptr #1 + 'nameptr := % nameptr += 1;
1055
+ namesleft #1 - 'namesleft := % namesleft =- 1;
1056
+ }
1057
+ while$
1058
+}
1059
+
1060
+FUNCTION { my.full.label }
1061
+{
1062
+ 's :=
1063
+ #1 'nameptr := % nameptr = 1;
1064
+ s num.names$ 'numnames := % numnames = num.name$(s);
1065
+ numnames 'namesleft :=
1066
+ { namesleft #0 > }
1067
+
1068
+ { s nameptr "{vv~}{ll}" format.name$ 't := % get the next name
1069
+ nameptr #1 >
1070
+ {
1071
+ namesleft #1 >
1072
+ { ", " * t * }
1073
+ {
1074
+ numnames #2 >
1075
+ { "," * }
1076
+ 'skip$
1077
+ if$
1078
+ t "others" =
1079
+ { " et~al\mbox{.}" * } % jrh: avoid spacing problems
1080
+ { " and " * t * } % from Chicago Manual of Style
1081
+ if$
1082
+ }
1083
+ if$
1084
+ }
1085
+ 't
1086
+ if$
1087
+ nameptr #1 + 'nameptr := % nameptr += 1;
1088
+ namesleft #1 - 'namesleft := % namesleft =- 1;
1089
+ }
1090
+ while$
1091
+
1092
+}
1093
+
1094
+FUNCTION { format.names.fml }
1095
+{
1096
+ % Format names in "familiar" format, with first initial followed by
1097
+ % last name. Like format.names, ALL names are formatted.
1098
+ % jtb: The names are NOT put in small caps
1099
+
1100
+ 's :=
1101
+ #1 'nameptr := % nameptr = 1;
1102
+ s num.names$ 'numnames := % numnames = num.name$(s);
1103
+ numnames 'namesleft :=
1104
+ { namesleft #0 > }
1105
+
1106
+ {
1107
+ "\bibinfo{person}{" s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ * "}" * 't :=
1108
+
1109
+ nameptr #1 >
1110
+ {
1111
+ namesleft #1 >
1112
+ { ", " * t * }
1113
+ {
1114
+ numnames #2 >
1115
+ { "," * }
1116
+ 'skip$
1117
+ if$
1118
+ t "\bibinfo{person}{others}" =
1119
+ { " {et~al\mbox{.}}" * }
1120
+ { " {and} " * t * }
1121
+ if$
1122
+ }
1123
+ if$
1124
+ }
1125
+ 't
1126
+ if$
1127
+ nameptr #1 + 'nameptr := % nameptr += 1;
1128
+ namesleft #1 - 'namesleft := % namesleft =- 1;
1129
+ }
1130
+ while$
1131
+}
1132
+
1133
+FUNCTION { format.authors }
1134
+{
1135
+ author empty.or.unknown
1136
+ { "" }
1137
+ {
1138
+ "\bibfield{author}{"
1139
+ author format.names add.period$ * "}" *} % jtb: add period if none before
1140
+ if$
1141
+}
1142
+
1143
+FUNCTION { format.key }
1144
+{
1145
+ empty.or.unknown
1146
+ { key field.or.null }
1147
+ { "" }
1148
+ if$
1149
+}
1150
+
1151
+FUNCTION { format.no.key }
1152
+{
1153
+ empty.or.unknown
1154
+ { "" }
1155
+ { "" }
1156
+ if$
1157
+}
1158
+
1159
+FUNCTION { format.editors.fml }
1160
+{
1161
+ % Format editor names for use in the "in" types: inbook, incollection,
1162
+ % inproceedings: first initial, then last names. When editors are the
1163
+ % LABEL for an entry, then format.editor is used which lists editors
1164
+ % by last name first.
1165
+
1166
+ editor empty.or.unknown
1167
+ { "" }
1168
+ {
1169
+ "\bibfield{editor}{"
1170
+ editor format.names.fml
1171
+ * "}" *
1172
+ editor num.names$ #1 >
1173
+ { " (Eds.)" * }
1174
+ { " (Ed.)" * }
1175
+ if$
1176
+ }
1177
+ if$
1178
+}
1179
+
1180
+FUNCTION { format.editors }
1181
+{ % format editor names for use in labels, last names first.
1182
+ editor empty.or.unknown
1183
+ { "" }
1184
+ {
1185
+ "\bibfield{editor}{"
1186
+ editor format.names
1187
+ * "}" *
1188
+ editor num.names$ #1 >
1189
+ { " (Eds.)." * }
1190
+ { " (Ed.)." * }
1191
+ if$
1192
+ }
1193
+ if$
1194
+}
1195
+
1196
+FUNCTION { format.articletitle }
1197
+{
1198
+ title empty.or.unknown
1199
+ { "" }
1200
+ % Use this to preserve lettercase in titles:
1201
+ { "\showarticletitle{" title * "}" * }
1202
+ % Use this for downcase title style:
1203
+ % { \showarticletitle{" title "t" change.case$ * "}" * }
1204
+ if$
1205
+}
1206
+
1207
+FUNCTION { format.title }
1208
+{
1209
+ title empty.or.unknown
1210
+ { "" }
1211
+ % Use this to preserve lettercase in titles:
1212
+ { "\bibinfo{title}{" title * "}" * }
1213
+ % Use this for downcase title style:
1214
+ % { title "t" change.case$ }
1215
+ if$
1216
+}
1217
+
1218
+FUNCTION { n.dashify }
1219
+{
1220
+ 't :=
1221
+ ""
1222
+ { t empty.or.unknown not }
1223
+ {
1224
+ t #1 #1 substring$ "-" =
1225
+ {
1226
+ t #1 #2 substring$ "--" = not
1227
+ { "--" *
1228
+ t #2 global.max$ substring$ 't :=
1229
+ }
1230
+ {
1231
+ { t #1 #1 substring$ "-" = }
1232
+ {
1233
+ "-" *
1234
+ t #2 global.max$ substring$ 't :=
1235
+ }
1236
+ while$
1237
+ }
1238
+ if$
1239
+ }
1240
+ {
1241
+ t #1 #1 substring$ *
1242
+ t #2 global.max$ substring$ 't :=
1243
+ }
1244
+ if$
1245
+ }
1246
+ while$
1247
+}
1248
+
1249
+FUNCTION { format.btitle }
1250
+{
1251
+ "\bibinfo{booktitle}{"
1252
+ edition empty.or.unknown
1253
+ { title emphasize }
1254
+ { title empty.or.unknown
1255
+ { title emphasize } % jtb: what is this supposed to do ?!?
1256
+ { "{\em " title * "\/} (\bibinfo{edition}{" * edition "l" change.case$ *
1257
+ "} ed.)" * } % jtb: no parens for ed.
1258
+ if$
1259
+ }
1260
+ if$
1261
+ * "}" *
1262
+}
1263
+
1264
+FUNCTION { format.emphasize.booktitle }
1265
+{ % push "" or "{\em booktitle}" or "{\em booktitle}, (second ed.)" on stack
1266
+ "\bibinfo{booktitle}{"
1267
+ edition empty.or.unknown
1268
+ { booktitle emphasize }
1269
+ { booktitle empty.or.unknown
1270
+ { "" }
1271
+ { "{\em " booktitle * "} (\bibinfo{edition}{" *
1272
+ edition "l" change.case$ * "} ed.)" * }
1273
+ if$
1274
+ }
1275
+ if$
1276
+ * "}" *
1277
+}
1278
+
1279
+FUNCTION { format.city }
1280
+{
1281
+ % jtb: if the preceding string (the title of the conference) is non-empty,
1282
+ % jtb: append the location, otherwise leave empty (so as to trigger the
1283
+ % jtb: error message in output.check
1284
+
1285
+ duplicate$ empty.or.unknown
1286
+ { }
1287
+ {
1288
+ city empty.or.unknown
1289
+ {
1290
+ date empty.or.unknown
1291
+ { }
1292
+ { " (" * date * ")" * }
1293
+ if$
1294
+ }
1295
+ {
1296
+ date empty.or.unknown
1297
+ { " (" * city * ")" * }
1298
+ { " (" * city * ", " * date * ")" * }
1299
+ if$
1300
+ }
1301
+ if$
1302
+ }
1303
+ if$
1304
+}
1305
+
1306
+FUNCTION { tie.or.space.connect }
1307
+{
1308
+ duplicate$ text.length$ #3 <
1309
+ { "~" }
1310
+ { " " }
1311
+ if$
1312
+ swap$ * *
1313
+}
1314
+
1315
+FUNCTION { either.or.check }
1316
+{
1317
+ empty.or.unknown
1318
+ 'pop$
1319
+ { "can't use both " swap$ * " fields in " * cite$ * warning$ }
1320
+ if$
1321
+}
1322
+
1323
+FUNCTION { format.bvolume }
1324
+{
1325
+ % jtb: If there is a series, this is added and the volume trails after it.
1326
+ % jtb: Otherwise, "Vol" is Capitalized.
1327
+
1328
+ volume empty.or.unknown
1329
+ { "" }
1330
+ {
1331
+ series empty.or.unknown
1332
+ { "Vol.~\bibinfo{volume}{" volume "}" * *}
1333
+ { "\bibinfo{series}{" series "}, " * *
1334
+ "Vol.~\bibinfo{volume}{" volume "}" * * *}
1335
+ if$
1336
+ "volume and number" number either.or.check
1337
+ }
1338
+ if$
1339
+}
1340
+
1341
+FUNCTION { format.bvolume.noseries }
1342
+{
1343
+ volume empty.or.unknown
1344
+ { "" }
1345
+ { "Vol.~\bibinfo{volume}{" volume "}" * *
1346
+ "volume and number" number either.or.check
1347
+ }
1348
+ if$
1349
+}
1350
+
1351
+FUNCTION { format.series }
1352
+{
1353
+ series empty.or.unknown
1354
+ {""}
1355
+ {" {\em (\bibinfo{series}{" * series "})}" *}
1356
+ if$
1357
+}
1358
+
1359
+FUNCTION { format.number.series }
1360
+{
1361
+ volume empty.or.unknown
1362
+ {
1363
+ number empty.or.unknown
1364
+ {
1365
+ volume empty.or.unknown
1366
+ { "" }
1367
+ {
1368
+ series empty.or.unknown
1369
+ { "" }
1370
+ { " (\bibinfo{series}{" series * "})" * }
1371
+ if$
1372
+ }
1373
+ if$
1374
+ } % { series field.or.null }
1375
+ {
1376
+ output.state mid.sentence =
1377
+ { "Number" } % gnp - changed to mixed case always
1378
+ { "Number" }
1379
+ if$
1380
+ number tie.or.space.connect series empty.or.unknown
1381
+ { "there's a number but no series in " cite$ * warning$ }
1382
+ { " in \bibinfo{series}{" * series * "}" * }
1383
+ if$
1384
+ }
1385
+ if$
1386
+ }
1387
+ {
1388
+ ""
1389
+ }
1390
+ if$
1391
+}
1392
+
1393
+FUNCTION { multi.page.check }
1394
+{
1395
+ 't :=
1396
+ #0 'multiresult :=
1397
+ { multiresult not
1398
+ t empty.or.unknown not
1399
+ and
1400
+ }
1401
+ { t #1 #1 substring$
1402
+ duplicate$ "-" =
1403
+ swap$ duplicate$ "," =
1404
+ swap$ "+" =
1405
+ or or
1406
+ { #1 'multiresult := }
1407
+ { t #2 global.max$ substring$ 't := }
1408
+ if$
1409
+ }
1410
+ while$
1411
+ multiresult
1412
+}
1413
+
1414
+FUNCTION { format.pages }
1415
+{
1416
+ pages empty.or.unknown
1417
+ { "" }
1418
+ { "\bibinfo{pages}{"
1419
+ pages multi.page.check
1420
+ { pages n.dashify } % gnp - removed () % jtb: removed pp.
1421
+ { pages }
1422
+ if$
1423
+ * "}" *
1424
+ }
1425
+ if$
1426
+}
1427
+
1428
+FUNCTION { format.pages.check.without.articleno }
1429
+{ %% format pages field only if articleno is absent
1430
+ %% Stack out: pages-specification
1431
+ numpages missing$ pages missing$ and
1432
+ { "page numbers missing in both pages and numpages fields in " cite$ * warning$ }
1433
+ { }
1434
+ if$
1435
+
1436
+ articleno empty.or.unknown eid empty.or.unknown and
1437
+ {
1438
+ pages missing$
1439
+ { numpages }
1440
+ { format.pages }
1441
+ if$
1442
+ }
1443
+ { "" }
1444
+ if$
1445
+}
1446
+
1447
+FUNCTION { format.pages.check }
1448
+{
1449
+ pages empty.or.unknown
1450
+ { "page numbers missing in " cite$ * warning$ "" }
1451
+ { pages n.dashify }
1452
+ if$
1453
+}
1454
+
1455
+FUNCTION { format.bookpages }
1456
+{
1457
+ bookpages empty.or.unknown
1458
+ { "" }
1459
+ { bookpages "book pages" tie.or.space.connect }
1460
+ if$
1461
+}
1462
+
1463
+FUNCTION { format.named.pages }
1464
+{
1465
+ pages empty.or.unknown
1466
+ { "" }
1467
+ { format.pages "pages" tie.or.space.connect }
1468
+ if$
1469
+}
1470
+
1471
+%
1472
+% Changed by Boris Veytsman, 2011-03-13
1473
+% Now the word "pages" is printed even if
1474
+% there field pages is not empty.
1475
+%
1476
+
1477
+FUNCTION { format.page.count }
1478
+{
1479
+ page.count empty.or.unknown
1480
+ { "" }
1481
+ { "\bibinfo{numpages}{" page.count * "}~pages" * }
1482
+ if$
1483
+}
1484
+
1485
+FUNCTION { format.articleno.numpages }
1486
+{
1487
+ %% There are seven possible outputs, depending on which fields are set.
1488
+ %%
1489
+ %% These four are handled here:
1490
+ %%
1491
+ %% articleno, numpages, pages -> "Article articleno-value, numpages-value pages"
1492
+ %% articleno, numpages -> "Article articleno-value, numpages-value pages"
1493
+ %% articleno, pages -> "Article articleno-value, reduced-pages-value pages"
1494
+ %% articleno -> "Article articleno-value" and warn about missing numpages
1495
+ %%
1496
+ %% The remaining three have already been handled by
1497
+ %% format.pages.check.without.articleno:
1498
+ %%
1499
+ %% numpages, pages -> "pages-value"
1500
+ %% numpages -> "numpages-value"
1501
+ %% pages -> "pages-value"
1502
+
1503
+ articleno empty.or.unknown eid empty.or.unknown and
1504
+ {
1505
+ numpages empty.or.unknown
1506
+ { }
1507
+ { "numpages field, but no articleno or eid field, in "
1508
+ cite$ * warning$ }
1509
+ if$
1510
+ ""
1511
+ }
1512
+ {
1513
+ numpages empty.or.unknown
1514
+ {
1515
+ pages empty.or.unknown
1516
+ {
1517
+ "articleno or eid, but no pages or numpages field in "
1518
+ cite$ * warning$
1519
+ "" 'page.count :=
1520
+ }
1521
+ { reduce.pages.to.page.count }
1522
+ if$
1523
+ }
1524
+ { numpages 'page.count := }
1525
+ if$
1526
+
1527
+ %% The Article number is now handled in format.day.month.year because
1528
+ %% ACM prefers the style "Digital Libraries 12, 3, Article 5 (July 2008)"
1529
+ %% over "Digital Libraries 12, 3 (July 2008), Article 5"
1530
+ %% format.articleno output
1531
+ format.page.count
1532
+ }
1533
+ if$
1534
+}
1535
+
1536
+FUNCTION {calc.format.page.count}
1537
+{
1538
+ numpages empty.or.unknown
1539
+ {
1540
+ pages empty.or.unknown
1541
+ {
1542
+ "" 'page.count :=
1543
+ }
1544
+ { reduce.pages.to.page.count }
1545
+ if$
1546
+ }
1547
+ { numpages 'page.count := }
1548
+ if$
1549
+ format.page.count
1550
+}
1551
+
1552
+
1553
+
1554
+FUNCTION { format.journal.volume.number.day.month.year }
1555
+{
1556
+ % By Young (and Spencer)
1557
+ % GNP - fixed bugs with missing volume, number, and/or pages
1558
+ %
1559
+ % Format journal, volume, number, pages for article types.
1560
+ %
1561
+ journal empty.or.unknown
1562
+ { "no journal in " cite$ * warning$
1563
+ "" }
1564
+% { journal emphasize.with.italic.correction }
1565
+ {
1566
+ "\bibinfo{journal}{"
1567
+ journal "Journal of the ACM" =
1568
+ { "{\it J. ACM}" }
1569
+ {
1570
+ journal "American Mathematical Society Translations" =
1571
+ { "{\it Amer. Math. Soc. Transl.}" }
1572
+ {
1573
+ journal "Bulletin of the American Mathematical Society" =
1574
+ { "{\it Bull. Amer. Math. Soc.}" }
1575
+ {
1576
+ journal "Proceedings of the American Mathematical Society" =
1577
+ { "{\it Proc. Amer. Math. Soc.}" }
1578
+ {
1579
+ journal "Transactions of the American Mathematical Society" =
1580
+ { "{\it Trans. Amer. Math. Soc.}" }
1581
+ {
1582
+ journal "Communications of the {ACM}" =
1583
+ { "{\it Commun. {ACM}}" }
1584
+ {
1585
+ journal "{ACM} Computing Surveys" =
1586
+ { "{\it Comput. Surveys}" }
1587
+ {
1588
+ journal "{ACM} Transactions on Mathematical Software" =
1589
+ { "{\it {ACM} Trans. Math. Software}" }
1590
+ {
1591
+ journal "{ACM} {SIGNUM} Newsletter" =
1592
+ { "{\it {ACM} {SIGNUM} Newslett.}" }
1593
+ {
1594
+ journal "American Journal of Sociology" =
1595
+ { "{\it Amer. J. Sociology}" }
1596
+ {
1597
+ journal "Journal of the American Statistical Association" =
1598
+ { "{\it J. Amer. Statist. Assoc.}" }
1599
+ {
1600
+ journal "Applied Mathematics and Computation" =
1601
+ { "{\it Appl. Math. Comput.}" }
1602
+ {
1603
+ journal "American Mathematical Monthly" =
1604
+ { "{\it Amer. Math. Monthly}" }
1605
+ {
1606
+ journal "British Journal of Mathematical and Statistical Psychology" =
1607
+ { "{\it Brit. J. Math. Statist. Psych.}" }
1608
+ {
1609
+ journal "Canadian Mathematical Bulletin" =
1610
+ { "{\it Canad. Math. Bull.}" }
1611
+ {
1612
+ journal "Journal of Computational and Applied Mathematics" =
1613
+ { "{\it J. Comput. Appl. Math.}" }
1614
+ {
1615
+ journal "Journal of Computational Physics" =
1616
+ { "{\it J. Comput. Phys.}" }
1617
+ {
1618
+ journal "Computers and Structures" =
1619
+ { "{\it Comput. \& Structures}" }
1620
+ {
1621
+ journal "The Computer Journal" =
1622
+ { "{\it Comput. J.}" }
1623
+ {
1624
+ journal "Journal of Computer and System Sciences" =
1625
+ { "{\it J. Comput. System Sci.}" }
1626
+ {
1627
+ journal "Contemporary Mathematics" =
1628
+ { "{\it Contemp. Math.}" }
1629
+ {
1630
+ journal "Crelle's Journal" =
1631
+ { "{\it Crelle's J.}" }
1632
+ {
1633
+ journal "Giornale di Mathematiche" =
1634
+ { "{\it Giorn. Mat.}" }
1635
+ {
1636
+ journal "{IEEE} Transactions on Computers" =
1637
+ { "{\it {IEEE} Trans. Comput.}" }
1638
+ {
1639
+ journal "{IEEE} Transactions on Automatic Control" =
1640
+ { "{\it {IEEE} Trans. Automat. Control}" }
1641
+ {
1642
+ journal "Proceedings of the {IEEE}" =
1643
+ { "{\it Proc. {IEEE}}" }
1644
+ {
1645
+ journal "{IEEE} Transactions on Aerospace and Electronic Systems" =
1646
+ { "{\it {IEEE} Trans. Aerospace Electron. Systems}" }
1647
+ {
1648
+ journal "{IMA} Journal of Numerical Analysis" =
1649
+ { "{\it {IMA} J. Numer. Anal.}" }
1650
+ {
1651
+ journal "Information Processing Letters" =
1652
+ { "{\it Inform. Process. Lett.}" }
1653
+ {
1654
+ journal "Journal of the Institute of Mathematics and its Applications" =
1655
+ { "{\it J. Inst. Math. Appl.}" }
1656
+ {
1657
+ journal "International Journal of Control" =
1658
+ { "{\it Internat. J. Control}" }
1659
+ {
1660
+ journal "International Journal for Numerical Methods in Engineering" =
1661
+ { "{\it Internat. J. Numer. Methods Engrg.}" }
1662
+ {
1663
+ journal "International Journal of Supercomputing Applications" =
1664
+ { "{\it Internat. J. Supercomputing Applic.}" }
1665
+ {
1666
+ journal "Journal of Research of the National Bureau of Standards" =
1667
+ { "{\it J. Res. Nat. Bur. Standards}" }
1668
+ {
1669
+ journal "Linear Algebra and its Applications" =
1670
+ { "{\it Linear Algebra Appl.}" }
1671
+ {
1672
+ journal "Journal of Mathematical Analysis and Applications" =
1673
+ { "{\it J. Math. Anal. Appl.}" }
1674
+ {
1675
+ journal "Mathematische Annalen" =
1676
+ { "{\it Math. Ann.}" }
1677
+ {
1678
+ journal "Journal of Mathematical Physics" =
1679
+ { "{\it J. Math. Phys.}" }
1680
+ {
1681
+ journal "Mathematics of Computation" =
1682
+ { "{\it Math. Comp.}" }
1683
+ {
1684
+ journal "Mathematica Scandinavica" =
1685
+ { "{\it Math. Scand.}" }
1686
+ {
1687
+ journal "Mathematical Tables and Other Aids to Computation" =
1688
+ { "{\it Math. Tables Aids Comput.}" }
1689
+ {
1690
+ journal "Numerische Mathematik" =
1691
+ { "{\it Numer. Math.}" }
1692
+ {
1693
+ journal "Pacific Journal of Mathematics" =
1694
+ { "{\it Pacific J. Math.}" }
1695
+ {
1696
+ journal "Journal of Parallel and Distributed Computing" =
1697
+ { "{\it J. Parallel and Distrib. Comput.}" }
1698
+ {
1699
+ journal "Parallel Computing" =
1700
+ { "{\it Parallel Comput.}" }
1701
+ {
1702
+ journal "Philosophical Magazine" =
1703
+ { "{\it Philos. Mag.}" }
1704
+ {
1705
+ journal "Proceedings of the National Academy of Sciences of the USA" =
1706
+ { "{\it Proc. Nat. Acad. Sci. U. S. A.}" }
1707
+ {
1708
+ journal "Quarterly Journal of Mathematics, Oxford, Series (2)" =
1709
+ { "{\it Quart. J. Math. Oxford Ser. (2)}" }
1710
+ {
1711
+ journal "Quarterly of Applied Mathematics" =
1712
+ { "{\it Quart. Appl. Math.}" }
1713
+ {
1714
+ journal "Review of the International Statisical Institute" =
1715
+ { "{\it Rev. Inst. Internat. Statist.}" }
1716
+ {
1717
+ journal "Journal of the Society for Industrial and Applied Mathematics" =
1718
+ { "{\it J. Soc. Indust. Appl. Math.}" }
1719
+ {
1720
+ journal "Journal of the Society for Industrial and Applied Mathematics, Series B, Numerical Analysis" =
1721
+ { "{\it J. Soc. Indust. Appl. Math. Ser. B Numer. Anal.}" }
1722
+ {
1723
+ journal "{SIAM} Journal on Algebraic and Discrete Methods" =
1724
+ { "{\it {SIAM} J. Algebraic Discrete Methods}" }
1725
+ {
1726
+ journal "{SIAM} Journal on Applied Mathematics" =
1727
+ { "{\it {SIAM} J. Appl. Math.}" }
1728
+ {
1729
+ journal "{SIAM} Journal on Computing" =
1730
+ { "{\it {SIAM} J. Comput.}" }
1731
+ {
1732
+ journal "{SIAM} Journal on Matrix Analysis and Applications" =
1733
+ { "{\it {SIAM} J. Matrix Anal. Appl.}" }
1734
+ {
1735
+ journal "{SIAM} Journal on Numerical Analysis" =
1736
+ { "{\it {SIAM} J. Numer. Anal.}" }
1737
+ {
1738
+ journal "{SIAM} Review" =
1739
+ { "{\it {SIAM} Rev.}" }
1740
+ {
1741
+ journal "{SIAM} Journal on Scientific and Statistical Computing" =
1742
+ { "{\it {SIAM} J. Sci. Statist. Comput.}" }
1743
+ {
1744
+ journal "Software Practice and Experience" =
1745
+ { "{\it Software Prac. Experience}" }
1746
+ {
1747
+ journal "Statistical Science" =
1748
+ { "{\it Statist. Sci.}" }
1749
+ {
1750
+ journal "{USSR} Computational Mathematics and Mathematical Physics" =
1751
+ { "{\it {U. S. S. R.} Comput. Math. and Math. Phys.}" }
1752
+ {
1753
+ journal "Journal of {VLSI} and Computer Systems" =
1754
+ { "{\it J. {VLSI} Comput. Syst.}" }
1755
+ {
1756
+ journal "Zeitschrift fur Angewandte Mathematik und Mechanik" =
1757
+ { "{\it Z. Angew. Math. Mech.}" }
1758
+ {
1759
+ journal "Zeitschrift fur Angewandte Mathematik und Physik" =
1760
+ { "{\it Z. Angew. Math. Phys.}" }
1761
+ {
1762
+ journal "ACM Computing Surveys" =
1763
+ { "{\it Comput. Surveys}" }
1764
+ {
1765
+ journal "ACM Transactions on Mathematical Software" =
1766
+ { "{\it ACM Trans. Math. Software}" }
1767
+ {
1768
+ journal "ACM {SIGNUM} Newsletter" =
1769
+ { "{\it ACM {SIGNUM} Newslett.}" }
1770
+ {
1771
+ journal "IEEE Transactions on Computers" =
1772
+ { "{\it IEEE Trans. Comput.}" }
1773
+ {
1774
+ journal "IEEE Transactions on Automatic Control" =
1775
+ { "{\it IEEE Trans. Automat. Control}" }
1776
+ {
1777
+ journal "Proceedings of the IEEE" =
1778
+ { "{\it Proc. IEEE}" }
1779
+ {
1780
+ journal "IEEE Transactions on Aerospace and Electronic Systems" =
1781
+ { "{\it IEEE Trans. Aerospace Electron. Systems}" }
1782
+ {
1783
+ journal "IMA Journal of Numerical Analysis" =
1784
+ { "{\it IMA J. Numer. Anal.}" }
1785
+ {
1786
+ journal "SIAM Journal on Algebraic and Discrete Methods" =
1787
+ { "{\it SIAM J. Algebraic Discrete Methods}" }
1788
+ {
1789
+ journal "SIAM Journal on Applied Mathematics" =
1790
+ { "{\it SIAM J. Appl. Math.}" }
1791
+ {
1792
+ journal "SIAM Journal on Computing" =
1793
+ { "{\it SIAM J. Comput.}" }
1794
+ {
1795
+ journal "SIAM Journal on Matrix Analysis and Applications" =
1796
+ { "{\it SIAM J. Matrix Anal. Appl.}" }
1797
+ {
1798
+ journal "SIAM Journal on Numerical Analysis" =
1799
+ { "{\it SIAM J. Numer. Anal.}" }
1800
+ {
1801
+ journal "SIAM Review" =
1802
+ { "{\it SIAM Rev.}" }
1803
+ {
1804
+ journal "SIAM Journal on Scientific and Statistical Computing" =
1805
+ { "{\it SIAM J. Sci. Statist. Comput.}" }
1806
+ {
1807
+ journal "USSR Computational Mathematics and Mathematical Physics" =
1808
+ { "{\it U. S. S. R. Comput. Math. and Math. Phys.}" }
1809
+ {
1810
+ journal "Journal of VLSI and Computer Systems" =
1811
+ { "{\it J. VLSI Comput. Syst.}" }
1812
+ {
1813
+ journal "Communications of the ACM" =
1814
+ { "{\it Commun. ACM}" }
1815
+ %% If no match with cases needing special handling, just output journal name
1816
+ { journal emphasize.with.italic.correction }
1817
+ if$
1818
+ }
1819
+ if$
1820
+ }
1821
+ if$
1822
+ }
1823
+ if$
1824
+ }
1825
+ if$
1826
+ }
1827
+ if$
1828
+ }
1829
+ if$
1830
+ }
1831
+ if$
1832
+ }
1833
+ if$
1834
+ }
1835
+ if$
1836
+ }
1837
+ if$
1838
+ }
1839
+ if$
1840
+ }
1841
+ if$
1842
+ }
1843
+ if$
1844
+ }
1845
+ if$
1846
+ }
1847
+ if$
1848
+ }
1849
+ if$
1850
+ }
1851
+ if$
1852
+ }
1853
+ if$
1854
+ }
1855
+ if$
1856
+ }
1857
+ if$
1858
+ }
1859
+ if$
1860
+ }
1861
+ if$
1862
+ }
1863
+ if$
1864
+ }
1865
+ if$
1866
+ }
1867
+ if$
1868
+ }
1869
+ if$
1870
+ }
1871
+ if$
1872
+ }
1873
+ if$
1874
+ }
1875
+ if$
1876
+ }
1877
+ if$
1878
+ }
1879
+ if$
1880
+ }
1881
+ if$
1882
+ }
1883
+ if$
1884
+ }
1885
+ if$
1886
+ }
1887
+ if$
1888
+ }
1889
+ if$
1890
+ }
1891
+ if$
1892
+ }
1893
+ if$
1894
+ }
1895
+ if$
1896
+ }
1897
+ if$
1898
+ }
1899
+ if$
1900
+ }
1901
+ if$
1902
+ }
1903
+ if$
1904
+ }
1905
+ if$
1906
+ }
1907
+ if$
1908
+ }
1909
+ if$
1910
+ }
1911
+ if$
1912
+ }
1913
+ if$
1914
+ }
1915
+ if$
1916
+ }
1917
+ if$
1918
+ }
1919
+ if$
1920
+ }
1921
+ if$
1922
+ }
1923
+ if$
1924
+ }
1925
+ if$
1926
+ }
1927
+ if$
1928
+ }
1929
+ if$
1930
+ }
1931
+ if$
1932
+ }
1933
+ if$
1934
+ }
1935
+ if$
1936
+ }
1937
+ if$
1938
+ }
1939
+ if$
1940
+ }
1941
+ if$
1942
+ }
1943
+ if$
1944
+ }
1945
+ if$
1946
+ }
1947
+ if$
1948
+ }
1949
+ if$
1950
+ }
1951
+ if$
1952
+ }
1953
+ if$
1954
+ }
1955
+ if$
1956
+ }
1957
+ if$
1958
+ }
1959
+ if$
1960
+ }
1961
+ if$
1962
+ }
1963
+ if$
1964
+ }
1965
+ if$
1966
+ }
1967
+ if$
1968
+ }
1969
+ if$
1970
+ }
1971
+ if$
1972
+ }
1973
+ if$
1974
+ }
1975
+ if$
1976
+ }
1977
+ if$
1978
+ }
1979
+ if$
1980
+ }
1981
+ if$
1982
+ * "}" *
1983
+ }
1984
+ if$
1985
+
1986
+ number empty.or.unknown
1987
+ {
1988
+ volume empty.or.unknown
1989
+ { "no number and no volume in " cite$ * warning$ "" * }
1990
+ { " " * " \bibinfo{volume}{" * volume * "}" * }
1991
+ if$
1992
+ }
1993
+ {
1994
+ volume empty.or.unknown
1995
+ {
1996
+ "unusual to have number, but no volume, for " cite$ * warning$
1997
+ " \bibinfo{number}{" * number * "}" *
1998
+ }
1999
+ { " \bibinfo{volume}{" * volume * "}, \bibinfo{number}{" *
2000
+ number * "}" *}
2001
+ if$
2002
+ }
2003
+ if$
2004
+ after.block 'output.state :=
2005
+
2006
+ % Sometimes proceedings are published in journals
2007
+ % In this case we do not want to put year, day and month here
2008
+
2009
+ type$ "inproceedings" =
2010
+ { }
2011
+ {format.day.month.year * }
2012
+ if$
2013
+}
2014
+
2015
+FUNCTION { format.chapter.pages }
2016
+{
2017
+ chapter empty.or.unknown
2018
+ 'format.pages
2019
+ { type empty.or.unknown
2020
+ { "Chapter" } % gnp - changed to mixed case
2021
+ { type "t" change.case$ }
2022
+ if$
2023
+ chapter tie.or.space.connect
2024
+ pages empty.or.unknown
2025
+ {"page numbers missing in " cite$ * warning$} % gnp - added check
2026
+ { ", " * format.pages * }
2027
+ if$
2028
+ }
2029
+ if$
2030
+}
2031
+
2032
+FUNCTION { format.in.emphasize.booktitle }
2033
+{ % jtb: format for collections or proceedings not appearing in a journal
2034
+ booktitle empty.or.unknown
2035
+ { "" }
2036
+ { "In " format.emphasize.booktitle * }
2037
+ if$
2038
+}
2039
+
2040
+FUNCTION { format.in.booktitle }
2041
+{ % jtb: format for proceedings appearing in a journal
2042
+ booktitle empty.or.unknown
2043
+ { "" }
2044
+ { "In \bibinfo{booktitle}{" booktitle * "}" * }
2045
+ if$
2046
+}
2047
+
2048
+FUNCTION { format.in.ed.booktitle }
2049
+{
2050
+ booktitle empty.or.unknown
2051
+ { "" }
2052
+ { editor empty.or.unknown
2053
+ { "In " format.emphasize.booktitle * }
2054
+ % jtb: swapped editor location
2055
+ { "In " format.emphasize.booktitle * ", " * format.editors.fml * }
2056
+ if$
2057
+ }
2058
+ if$
2059
+}
2060
+
2061
+FUNCTION { format.thesis.type }
2062
+{ % call with default type on stack top
2063
+ type empty.or.unknown
2064
+ 'skip$ % use default type
2065
+ {
2066
+ pop$ % discard default type
2067
+ % NO: it is silly to have to brace protect every degree type!: type "t" change.case$
2068
+ type
2069
+ }
2070
+ if$
2071
+}
2072
+
2073
+FUNCTION { format.tr.number }
2074
+{
2075
+ "\bibinfo{type}{"
2076
+ type empty.or.unknown
2077
+ { "{T}echnical {R}eport" }
2078
+ 'type
2079
+ if$
2080
+ "}" * *
2081
+ number empty.or.unknown
2082
+ { "t" change.case$ }
2083
+ %% LOOKS BAD: { "." * number tie.or.space.connect }
2084
+ %% Prefer "Research report RJ687." to "Research report. RJ687."
2085
+ { number tie.or.space.connect }
2086
+ if$
2087
+}
2088
+
2089
+FUNCTION { format.advisor }
2090
+{
2091
+ advisor empty.or.unknown
2092
+ { "" }
2093
+ { "Advisor(s) " advisor * }
2094
+ if$
2095
+}
2096
+
2097
+FUNCTION { format.article.crossref }
2098
+{ "See"
2099
+ "\citeN{" * crossref * "}" *
2100
+}
2101
+
2102
+FUNCTION { format.crossref.editor }
2103
+{
2104
+ editor #1 "{vv~}{ll}" format.name$
2105
+ editor num.names$ duplicate$
2106
+ #2 >
2107
+ { pop$ " et~al\mbox{.}" * } % jrh: avoid spacing problems
2108
+ { #2 <
2109
+ 'skip$
2110
+ { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
2111
+ { " et~al\mbox{.}" * } % jrh: avoid spacing problems
2112
+ { " and " * editor #2 "{vv~}{ll}" format.name$ * }
2113
+ if$
2114
+ }
2115
+ if$
2116
+ }
2117
+ if$
2118
+}
2119
+
2120
+FUNCTION { format.book.crossref }
2121
+{
2122
+ volume empty.or.unknown
2123
+ { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
2124
+ "In "
2125
+ }
2126
+ { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
2127
+ " of " *
2128
+ }
2129
+ if$
2130
+ editor empty.or.unknown
2131
+ editor field.or.null author field.or.null =
2132
+ or
2133
+ { key empty.or.unknown
2134
+ { series empty.or.unknown
2135
+ { "need editor, key, or series for " cite$ * " to crossref " *
2136
+ crossref * warning$
2137
+ "" *
2138
+ }
2139
+ { "{\em " * series * "\/}" * }
2140
+ if$
2141
+ }
2142
+ { key * }
2143
+ if$
2144
+ }
2145
+ { format.crossref.editor * }
2146
+ if$
2147
+ " \citeN{" * crossref * "}" *
2148
+}
2149
+
2150
+FUNCTION { format.incoll.inproc.crossref }
2151
+{ "See"
2152
+ " \citeN{" * crossref * "}" *
2153
+}
2154
+
2155
+FUNCTION { format.lab.names }
2156
+{
2157
+ % format.lab.names:
2158
+ %
2159
+ % determines "short" names for the abbreviated author information.
2160
+ % "Long" labels are created in calc.label, using the routine my.full.label
2161
+ % to format author and editor fields.
2162
+ %
2163
+ % There are 4 cases for labels. (n=3 in the example)
2164
+ % a) one author Foo
2165
+ % b) one to n Foo, Bar and Baz
2166
+ % c) use of "and others" Foo, Bar et al.
2167
+ % d) more than n Foo et al.
2168
+
2169
+ 's :=
2170
+ s num.names$ 'numnames :=
2171
+ numnames #2 > % change number to number of others allowed before
2172
+ % forcing "et al".
2173
+ { s #1 "{vv~}{ll}" format.name$ " et~al\mbox{.}" * } % jrh: \mbox{} added
2174
+ {
2175
+ numnames #1 - 'namesleft :=
2176
+ #2 'nameptr :=
2177
+ s #1 "{vv~}{ll}" format.name$
2178
+ { namesleft #0 > }
2179
+ { nameptr numnames =
2180
+ { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
2181
+ { " et~al\mbox{.}" * } % jrh: avoid spacing problems
2182
+ { " and " * s nameptr "{vv~}{ll}" format.name$ * }
2183
+ if$
2184
+ }
2185
+ { ", " * s nameptr "{vv~}{ll}" format.name$ * }
2186
+ if$
2187
+ nameptr #1 + 'nameptr :=
2188
+ namesleft #1 - 'namesleft :=
2189
+ }
2190
+ while$
2191
+ }
2192
+ if$
2193
+}
2194
+
2195
+FUNCTION { author.key.label }
2196
+{
2197
+ author empty.or.unknown
2198
+ { key empty.or.unknown
2199
+ { "no key, author in " cite$ * warning$
2200
+ cite$ #1 #3 substring$ }
2201
+ 'key
2202
+ if$
2203
+ }
2204
+ { author format.lab.names }
2205
+ if$
2206
+}
2207
+
2208
+FUNCTION { editor.key.organization.label }
2209
+{ % added - gnp. Provide label formatting by organization if editor is null.
2210
+ editor empty.or.unknown
2211
+ { organization empty.or.unknown
2212
+ { key empty.or.unknown
2213
+ { "no key, editor or organization in " cite$ * warning$
2214
+ cite$ #1 #3 substring$ }
2215
+ 'key
2216
+ if$
2217
+ }
2218
+ { organization }
2219
+ if$
2220
+ }
2221
+ { editor format.lab.names }
2222
+ if$
2223
+}
2224
+
2225
+FUNCTION { author.editor.key.label }
2226
+{
2227
+ author empty.or.unknown
2228
+ { editor empty.or.unknown
2229
+ { key empty.or.unknown
2230
+ { "no key, author, or editor in " cite$ * warning$
2231
+ cite$ #1 #3 substring$ }
2232
+ 'key
2233
+ if$
2234
+ }
2235
+ { editor format.lab.names }
2236
+ if$
2237
+ }
2238
+ { author format.lab.names }
2239
+ if$
2240
+}
2241
+
2242
+FUNCTION { author.editor.key.organization.label }
2243
+{ % added - gnp. Provide label formatting by organization if author is null.
2244
+ author empty.or.unknown
2245
+ { editor empty.or.unknown
2246
+ { organization empty.or.unknown
2247
+ { key empty.or.unknown
2248
+ { "no key, author, editor or organization in " cite$ * warning$
2249
+ cite$ #1 #3 substring$ }
2250
+ 'key
2251
+ if$
2252
+ }
2253
+ { organization }
2254
+ if$
2255
+ }
2256
+ { editor format.lab.names }
2257
+ if$
2258
+ }
2259
+ { author format.lab.names }
2260
+ if$
2261
+}
2262
+
2263
+% Calculate label and leave it on stack
2264
+FUNCTION { calc.basic.label }
2265
+{
2266
+ type$ "book" =
2267
+ type$ "inbook" =
2268
+ or
2269
+ type$ "article" =
2270
+ or
2271
+ 'author.editor.key.label
2272
+ { type$ "proceedings" =
2273
+ type$ "periodical" =
2274
+ or
2275
+ 'editor.key.organization.label
2276
+ { type$ "manual" =
2277
+ 'author.editor.key.organization.label
2278
+ 'author.key.label
2279
+ if$
2280
+ }
2281
+ if$
2282
+ }
2283
+ if$
2284
+ duplicate$
2285
+ year empty.or.unknown
2286
+ { "[n. d.]" }
2287
+ { year field.or.null purify$ #-1 #4 substring$}
2288
+ if$
2289
+ *
2290
+ 'basic.label.year :=
2291
+}
2292
+
2293
+FUNCTION { calc.label }
2294
+{
2295
+ % Changed - GNP. See also author.editor.organization.sort, editor.organization.sort
2296
+ % Form label for BibTeX entry. The classification of which fields are used
2297
+ % for which type of entry (book, inbook, etc.) are taken from alpha.bst.
2298
+ % The change here from newapa is to also include organization as a
2299
+ % citation label if author or editor is missing.
2300
+
2301
+ calc.basic.label
2302
+
2303
+ author empty.or.unknown % generate the full label citation information.
2304
+ {
2305
+ editor empty.or.unknown
2306
+ {
2307
+ organization empty.or.unknown
2308
+ {
2309
+ key empty.or.unknown
2310
+ {
2311
+ "no author, editor, organization, or key in " cite$ * warning$
2312
+ "??"
2313
+ }
2314
+ { key }
2315
+ if$
2316
+ }
2317
+ { organization }
2318
+ if$
2319
+ }
2320
+ { editor my.full.label }
2321
+ if$
2322
+ }
2323
+ { author my.full.label }
2324
+ if$
2325
+
2326
+ % leave label on the stack, to be popped when required.
2327
+
2328
+ "}{" * swap$ * "}{" *
2329
+ % year field.or.null purify$ #-1 #4 substring$ *
2330
+ %
2331
+ % save the year for sort processing afterwards (adding a, b, c, etc.)
2332
+ %
2333
+ year empty.or.unknown
2334
+ { "[n. d.]" }
2335
+ { year field.or.null purify$ #-1 #4 substring$}
2336
+ if$
2337
+ 'label.year :=
2338
+}
2339
+
2340
+
2341
+FUNCTION { output.bibitem }
2342
+{
2343
+ newline$
2344
+ "\bibitem[\protect\citeauthoryear{" write$
2345
+ calc.label write$
2346
+ sort.year write$
2347
+ "}]%" writeln
2348
+ " {" write$
2349
+ cite$ write$
2350
+ "}" writeln
2351
+ ""
2352
+ before.all 'output.state :=
2353
+}
2354
+
2355
+
2356
+FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint }
2357
+{ % enter and return with stack empty
2358
+ %% We switch now from buffered output to output of complete lines, so
2359
+ %% that the Issue .. URL data have their own lines, and are less likely
2360
+ %% to be line-wrapped by BibTeX's short-sighted algorithm, which wraps
2361
+ %% lines longer than 79 characters, backtracking to what it thinks is
2362
+ %% a break point in the string. Any such wrapping MUST be undone to
2363
+ %% prevent percent-newline from appearing in DOIs and URLs. The
2364
+ %% output data are intentionally wrapped in \showxxx{} macros at
2365
+ %% beginning of line, and that supply their own punctuation (if they
2366
+ %% are not defined to suppress output entirely), to make it easier for
2367
+ %% other software to recover them from .bbl files.
2368
+ %%
2369
+ %% It also makes it possible to later change the macro definitions
2370
+ %% to suppress particular output values, or alter their appearance.
2371
+ %%
2372
+ %% Note that it is possible for theses, technical reports, and
2373
+ %% manuals to have ISBNs, and anything that has an ISBN may also
2374
+ %% have an ISSN. When there are no values for these keys, there
2375
+ %% is no output generated for them here.
2376
+
2377
+ "\newblock" writeln
2378
+ after.block 'output.state :=
2379
+
2380
+ output.issue
2381
+ output.isbn
2382
+ output.coden % CODEN is functionally like ISSN, so output them sequentially
2383
+ output.issn
2384
+ output.lccn
2385
+ output.doi % DOI is ALWAYS last according to CrossRef DOI documentation
2386
+ output.eprint
2387
+ output.url % but ACM wants URL last
2388
+}
2389
+
2390
+FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint.note }
2391
+{ % enter with stack empty, return with empty string on stack
2392
+ output.issue.doi.coden.isxn.lccn.url.eprint
2393
+ note empty.or.unknown
2394
+ { }
2395
+ {
2396
+ "\newblock" writeln
2397
+ output.note
2398
+ }
2399
+ if$
2400
+ ""
2401
+}
2402
+
2403
+FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint.note.check }
2404
+{ % enter with stack empty, return with empty string on stack
2405
+ output.issue.doi.coden.isxn.lccn.url.eprint
2406
+ note empty.or.unknown
2407
+ { }
2408
+ {
2409
+ "\newblock" writeln
2410
+ output.note.check
2411
+ }
2412
+ if$
2413
+ ""
2414
+}
2415
+
2416
+FUNCTION { article }
2417
+{
2418
+ output.bibitem
2419
+
2420
+ author empty.or.unknown
2421
+ {
2422
+ editor empty.or.unknown
2423
+ { "neither author and editor supplied for " cite$ * warning$ }
2424
+ { format.editors "editor" output.check }
2425
+ if$
2426
+ }
2427
+ { format.authors "author" output.check }
2428
+ if$
2429
+
2430
+ author format.no.key output % added
2431
+ output.year.check % added
2432
+ new.block
2433
+ format.articletitle "title" output.check
2434
+ new.block
2435
+ howpublished empty.or.unknown
2436
+ { }
2437
+ { "\bibinfo{howpublished}{" howpublished "}" * * output }
2438
+ if$
2439
+
2440
+ crossref missing$
2441
+ { format.journal.volume.number.day.month.year output}
2442
+ {
2443
+ "cross reference in @Article{...} is unusual" warning$
2444
+ format.article.crossref output.nonnull
2445
+ }
2446
+ if$
2447
+
2448
+ format.pages.check.without.articleno output
2449
+ format.articleno.numpages output
2450
+ fin.block
2451
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2452
+ fin.entry
2453
+}
2454
+
2455
+FUNCTION { book }
2456
+{
2457
+ output.bibitem
2458
+ author empty.or.unknown
2459
+ { format.editors "author and editor" output.check }
2460
+ { format.authors output.nonnull
2461
+ crossref missing$
2462
+ { "author and editor" editor either.or.check }
2463
+ 'skip$
2464
+ if$
2465
+ }
2466
+ if$
2467
+ output.year.check % added
2468
+ new.block
2469
+ format.btitle "title" output.check
2470
+ crossref missing$
2471
+ { new.sentence % jtb: start a new sentence for series/volume
2472
+ format.bvolume output
2473
+ new.block
2474
+ format.number.series output
2475
+ new.sentence
2476
+ publisher "publisher" bibinfo.output.check
2477
+ address "address" bibinfo.output.check % jtb: require address
2478
+ fin.sentence
2479
+ pages empty.or.unknown
2480
+ { format.bookpages } % use bookpages when pages empty
2481
+ { format.pages.check "pages" tie.or.space.connect }
2482
+ if$
2483
+ output
2484
+ }
2485
+ { new.block
2486
+ format.book.crossref output.nonnull
2487
+ }
2488
+ if$
2489
+ fin.block
2490
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2491
+ fin.entry
2492
+}
2493
+
2494
+FUNCTION { booklet }
2495
+{
2496
+ output.bibitem
2497
+ format.authors output
2498
+ author format.key output % added
2499
+ output.year.check % added
2500
+ new.block
2501
+ format.title "title" output.check
2502
+ new.block
2503
+ howpublished empty.or.unknown
2504
+ { }
2505
+ { "\bibinfo{howpublished}{" howpublished "}" * * output }
2506
+ if$
2507
+ address output
2508
+ fin.block
2509
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2510
+ fin.entry
2511
+}
2512
+
2513
+FUNCTION { inbook }
2514
+{
2515
+ output.bibitem
2516
+ author empty.or.unknown
2517
+ { format.editors
2518
+ "author and editor" output.check
2519
+ }
2520
+ { format.authors output.nonnull
2521
+ crossref missing$
2522
+ { "author and editor" editor either.or.check }
2523
+ 'skip$
2524
+ if$
2525
+ }
2526
+ if$
2527
+ output.year.check % added
2528
+ new.block
2529
+ format.btitle "title" output.check
2530
+ crossref missing$
2531
+ { new.sentence % jtb: start a new sentence for series/volume
2532
+ format.bvolume output
2533
+ new.block
2534
+ format.number.series output
2535
+ new.sentence
2536
+ publisher "publisher" bibinfo.output.check
2537
+ address "address" bibinfo.output.check % jtb: require address
2538
+ format.bookpages output
2539
+ format.chapter.pages
2540
+ "chapter and pages" output.check % jtb: moved from before publisher
2541
+ }
2542
+ {
2543
+ format.bookpages output
2544
+ format.chapter.pages "chapter and pages" output.check
2545
+ new.block
2546
+ format.book.crossref output.nonnull
2547
+ }
2548
+ if$
2549
+ fin.block
2550
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2551
+ fin.entry
2552
+}
2553
+
2554
+FUNCTION { incollection }
2555
+{
2556
+ output.bibitem
2557
+ format.authors "author" output.check
2558
+ author format.key output % added
2559
+ output.year.check % added
2560
+ new.block
2561
+ format.articletitle "title" output.check
2562
+ new.block
2563
+ crossref missing$
2564
+ { format.in.ed.booktitle "booktitle" output.check
2565
+ new.sentence % jtb: start a new sentence for series/volume
2566
+ format.bvolume output
2567
+ format.number.series output
2568
+ new.sentence
2569
+ publisher "publisher" bibinfo.output.check
2570
+ address "address" bibinfo.output.check % jtb: require address
2571
+ format.bookpages output
2572
+ format.chapter.pages output % gnp - was special.output.nonnull
2573
+ % left out comma before page numbers
2574
+ % jtb: moved from before publisher
2575
+ }
2576
+ {
2577
+ format.incoll.inproc.crossref output.nonnull
2578
+ format.chapter.pages output
2579
+ }
2580
+ if$
2581
+ fin.block
2582
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2583
+ fin.entry
2584
+}
2585
+
2586
+FUNCTION { inproceedings }
2587
+{
2588
+ output.bibitem
2589
+ format.authors "author" output.check
2590
+ author format.key output % added
2591
+ output.year.check % added
2592
+ new.block
2593
+ format.articletitle "title" output.check
2594
+ howpublished empty.or.unknown
2595
+ { }
2596
+ { "\bibinfo{howpublished}{" howpublished "}" * * output.dot.space }
2597
+ if$
2598
+ crossref missing$
2599
+ {
2600
+ journal missing$ % jtb: proceedings appearing in journals
2601
+ { format.in.emphasize.booktitle format.city "booktitle" output.check.dot.space
2602
+ format.series output.removenospace
2603
+ format.editors.fml output % BV 2011/09/27 Moved dot to comma
2604
+ format.bvolume.noseries output
2605
+ new.sentence
2606
+ organization output
2607
+ publisher "publisher" bibinfo.output.check % jtb: require publisher (?)
2608
+ address "address" bibinfo.output.check % jtb: require address
2609
+ format.bookpages output
2610
+ }
2611
+ {
2612
+ format.in.booktitle format.city "booktitle" output.check
2613
+ format.editors.fml output
2614
+ new.sentence
2615
+ format.journal.volume.number.day.month.year output
2616
+ }
2617
+ if$
2618
+ format.articleno output
2619
+ format.pages.check.without.articleno output
2620
+ }
2621
+ {
2622
+ format.incoll.inproc.crossref output.nonnull
2623
+ format.articleno output
2624
+ format.pages.check.without.articleno output
2625
+ }
2626
+ if$
2627
+ format.articleno.numpages output
2628
+ fin.block
2629
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2630
+ fin.entry
2631
+}
2632
+
2633
+FUNCTION { conference } { inproceedings }
2634
+
2635
+FUNCTION { manual }
2636
+{
2637
+ output.bibitem
2638
+ author empty.or.unknown
2639
+ { editor empty.or.unknown
2640
+ { organization "organization" output.check
2641
+ organization format.key output } % if all else fails, use key
2642
+ { format.editors "author and editor" output.check }
2643
+ if$
2644
+ }
2645
+ { format.authors output.nonnull }
2646
+ if$
2647
+ output.year.check % added
2648
+ new.block
2649
+ format.btitle "title" output.check
2650
+ organization address new.block.checkb
2651
+ % jtb: back to normal style: organization, address
2652
+ organization "organization" output.check
2653
+ address output
2654
+ fin.block
2655
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2656
+ fin.entry
2657
+}
2658
+
2659
+FUNCTION { mastersthesis }
2660
+{
2661
+ output.bibitem
2662
+ format.authors "author" output.check
2663
+ author format.key output % added
2664
+ output.year.check % added
2665
+ new.block
2666
+ format.title emphasize "title" output.check % NB: ACM style requires emphasized thesis title
2667
+ new.block
2668
+ "\bibinfo{thesistype}{Master's\ thesis}" format.thesis.type output
2669
+ new.sentence
2670
+ school "school" bibinfo.output.check
2671
+ address empty.or.unknown
2672
+ { }
2673
+ { "\bibinfo{address}{" address * "}" * output }
2674
+ if$
2675
+ new.block
2676
+ format.advisor output
2677
+ fin.block
2678
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2679
+ fin.entry
2680
+}
2681
+
2682
+FUNCTION { misc }
2683
+{
2684
+ output.bibitem
2685
+ format.authors "author" output.check
2686
+ author format.key output % added
2687
+ output.year.check % added
2688
+ title howpublished new.block.checkb
2689
+ format.title output
2690
+ new.block
2691
+ howpublished empty.or.unknown
2692
+ { }
2693
+ { "\bibinfo{howpublished}{" howpublished "}" * * output }
2694
+ if$
2695
+ "" output.nonnull.dot.space
2696
+ output.day.month.year
2697
+ calc.format.page.count output
2698
+ fin.block
2699
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2700
+ fin.entry
2701
+}
2702
+
2703
+FUNCTION { online } { misc }
2704
+
2705
+FUNCTION { game } { misc }
2706
+
2707
+
2708
+FUNCTION { phdthesis }
2709
+{
2710
+ output.bibitem
2711
+ format.authors "author" output.check
2712
+ author format.key output % added
2713
+ output.year.check % added
2714
+ new.block
2715
+ format.title emphasize "title" output.check % NB: ACM style requires emphasized thesis title
2716
+ new.block
2717
+ "\bibinfo{thesistype}{Ph.D. Dissertation}" format.thesis.type output
2718
+ new.sentence
2719
+ school "school" bibinfo.output.check
2720
+ address empty.or.unknown
2721
+ { }
2722
+ { "\bibinfo{address}{" address * "}" * output }
2723
+ if$
2724
+ new.block
2725
+ format.advisor output
2726
+ fin.block
2727
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2728
+ fin.entry
2729
+}
2730
+
2731
+FUNCTION {format.date}
2732
+{ year empty.or.unknown
2733
+ { month empty.or.unknown
2734
+ {
2735
+ "" % output empty date if year/month both empty
2736
+ day empty.or.unknown
2737
+ { }
2738
+ { "there's a day but no month or year in " cite$ * warning$ }
2739
+ if$
2740
+ }
2741
+ { "there's a month but no year in " cite$ * warning$
2742
+ month
2743
+ day empty.or.unknown
2744
+ { }
2745
+ { " " * day * }
2746
+ if$
2747
+ }
2748
+ if$
2749
+ }
2750
+ { month empty.or.unknown
2751
+ {
2752
+ year % output only year if month empty
2753
+ day empty.or.unknown
2754
+ { }
2755
+ { "there's a day and year but no month in " cite$ * warning$ }
2756
+ if$
2757
+ }
2758
+ {
2759
+ month " " *
2760
+ day empty.or.unknown
2761
+ { }
2762
+ { day * ", " * }
2763
+ if$
2764
+ year *
2765
+ }
2766
+ if$
2767
+ }
2768
+ if$
2769
+}
2770
+
2771
+FUNCTION {new.block.checka}
2772
+{
2773
+ empty.or.unknown
2774
+ 'skip$
2775
+ 'new.block
2776
+ if$
2777
+}
2778
+
2779
+FUNCTION { periodical }
2780
+{
2781
+ output.bibitem
2782
+ editor empty.or.unknown
2783
+ { organization output }
2784
+ { format.editors output.nonnull }
2785
+ if$
2786
+ new.block
2787
+ output.year.check
2788
+ new.sentence
2789
+ format.articletitle "title" output.check
2790
+ format.journal.volume.number.day.month.year output
2791
+ calc.format.page.count output
2792
+ fin.entry
2793
+}
2794
+
2795
+FUNCTION { proceedings }
2796
+{
2797
+ output.bibitem
2798
+ editor empty.or.unknown
2799
+ { organization output
2800
+ organization format.key output } % gnp - changed from author format.key
2801
+ { format.editors output.nonnull }
2802
+ if$
2803
+ % author format.key output % gnp - removed (should be either
2804
+ % editor or organization
2805
+ output.year.check % added (newapa)
2806
+ new.block
2807
+ format.btitle format.city "title" output.check % jtb: added city
2808
+ new.sentence
2809
+ format.bvolume output
2810
+ format.number.series output
2811
+ new.sentence
2812
+ organization output
2813
+ % jtb: normal order: publisher, address
2814
+ publisher empty.or.unknown
2815
+ { }
2816
+ { "\bibinfo{publisher}{" publisher * "}" * output }
2817
+ if$
2818
+ address empty.or.unknown
2819
+ { }
2820
+ { "\bibinfo{address}{" address * "}" * output }
2821
+ if$
2822
+ fin.block
2823
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2824
+ fin.entry
2825
+}
2826
+
2827
+FUNCTION { techreport }
2828
+{
2829
+ output.bibitem
2830
+ format.authors "author" output.check
2831
+ author format.key output % added
2832
+ output.year.check % added
2833
+ new.block
2834
+ format.btitle "title" output.check
2835
+ new.block
2836
+% format.tr.number output % jtb: moved month ...
2837
+ format.tr.number output new.sentence % Gerry - need dot 2011/09/28
2838
+ institution "institution" bibinfo.output.check
2839
+ address empty.or.unknown
2840
+ { }
2841
+ { "\bibinfo{address}{" address "}" * * output }
2842
+ if$
2843
+ new.sentence
2844
+ format.named.pages output
2845
+ % ACM omits year at end in transactions style
2846
+ % format.day.month.year output.nonnull.dot.space % jtb: ... to here (no parens)
2847
+ fin.block
2848
+ output.issue.doi.coden.isxn.lccn.url.eprint.note
2849
+ fin.entry
2850
+}
2851
+
2852
+FUNCTION { unpublished }
2853
+{
2854
+ output.bibitem
2855
+ format.authors
2856
+ "author" output.check
2857
+ author format.key output % added
2858
+ output.year.check % added
2859
+ new.block
2860
+ format.title "title" output.check
2861
+ fin.sentence
2862
+ output.day.month.year % UTAH
2863
+ calc.format.page.count output
2864
+ fin.block
2865
+ output.issue.doi.coden.isxn.lccn.url.eprint.note.check
2866
+ fin.entry
2867
+}
2868
+
2869
+FUNCTION { default.type } { misc }
2870
+
2871
+%%% ACM journal-style month definitions: full name if 1--5 letters, else
2872
+%%% abbreviation of 3 or 4 characters and a dot
2873
+
2874
+MACRO {jan} {"Jan."}
2875
+
2876
+MACRO {feb} {"Feb."}
2877
+
2878
+MACRO {mar} {"March"}
2879
+
2880
+MACRO {apr} {"April"}
2881
+
2882
+MACRO {may} {"May"}
2883
+
2884
+MACRO {jun} {"June"}
2885
+
2886
+MACRO {jul} {"July"}
2887
+
2888
+MACRO {aug} {"Aug."}
2889
+
2890
+MACRO {sep} {"Sept."}
2891
+
2892
+MACRO {oct} {"Oct."}
2893
+
2894
+MACRO {nov} {"Nov."}
2895
+
2896
+MACRO {dec} {"Dec."}
2897
+
2898
+
2899
+
2900
+READ
2901
+
2902
+FUNCTION { sortify }
2903
+{
2904
+ purify$
2905
+ "l" change.case$
2906
+}
2907
+
2908
+FUNCTION { chop.word }
2909
+{
2910
+ 's :=
2911
+ 'len :=
2912
+ s #1 len substring$ =
2913
+ { s len #1 + global.max$ substring$ }
2914
+ 's
2915
+ if$
2916
+}
2917
+
2918
+FUNCTION { sort.format.names }
2919
+{
2920
+ 's :=
2921
+ #1 'nameptr :=
2922
+ ""
2923
+ s num.names$ 'numnames :=
2924
+ numnames 'namesleft :=
2925
+ { namesleft #0 > }
2926
+ { nameptr #1 >
2927
+ { " " * }
2928
+ 'skip$
2929
+ if$
2930
+ s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't :=
2931
+ nameptr numnames = t "others" = and
2932
+ { " et~al" * }
2933
+ { t sortify * }
2934
+ if$
2935
+ nameptr #1 + 'nameptr :=
2936
+ namesleft #1 - 'namesleft :=
2937
+ }
2938
+ while$
2939
+}
2940
+
2941
+FUNCTION { sort.format.title }
2942
+{
2943
+ 't :=
2944
+ "A " #2
2945
+ "An " #3
2946
+ "The " #4 t chop.word
2947
+ chop.word
2948
+ chop.word
2949
+ sortify
2950
+ #1 global.max$ substring$
2951
+}
2952
+
2953
+FUNCTION { author.sort }
2954
+{
2955
+ author empty.or.unknown
2956
+ { key empty.or.unknown
2957
+ { "to sort, need author or key in " cite$ * warning$
2958
+ "" }
2959
+ { key sortify }
2960
+ if$
2961
+ }
2962
+ { author sort.format.names }
2963
+ if$
2964
+}
2965
+
2966
+FUNCTION { author.editor.sort }
2967
+{
2968
+ author empty.or.unknown
2969
+ {
2970
+ editor empty.or.unknown
2971
+ {
2972
+ key empty.or.unknown
2973
+ { "to sort, need author, editor, or key in " cite$ * warning$
2974
+ ""
2975
+ }
2976
+ { key sortify }
2977
+ if$
2978
+ }
2979
+ { editor sort.format.names }
2980
+ if$
2981
+ }
2982
+ { author sort.format.names }
2983
+ if$
2984
+}
2985
+
2986
+FUNCTION { editor.organization.sort }
2987
+{
2988
+ % added - GNP. Stack editor or organization for sorting (from alpha.bst).
2989
+ % Unlike alpha.bst, we need entire names, not abbreviations
2990
+
2991
+ editor empty.or.unknown
2992
+ { organization empty.or.unknown
2993
+ { key empty.or.unknown
2994
+ { "to sort, need editor, organization, or key in " cite$ * warning$
2995
+ ""
2996
+ }
2997
+ { key sortify }
2998
+ if$
2999
+ }
3000
+ { organization sortify }
3001
+ if$
3002
+ }
3003
+ { editor sort.format.names }
3004
+ if$
3005
+}
3006
+
3007
+FUNCTION { author.editor.organization.sort }
3008
+{
3009
+ % added - GNP. Stack author or organization for sorting (from alpha.bst).
3010
+ % Unlike alpha.bst, we need entire names, not abbreviations
3011
+
3012
+ author empty.or.unknown
3013
+ {
3014
+ editor empty.or.unknown
3015
+ { organization empty.or.unknown
3016
+ { key empty.or.unknown
3017
+ { "to sort, need author, editor, or key in " cite$ * warning$
3018
+ ""
3019
+ }
3020
+ { key sortify }
3021
+ if$
3022
+ }
3023
+ { organization sortify }
3024
+ if$
3025
+ }
3026
+ { editor sort.format.names }
3027
+ if$
3028
+ }
3029
+ { author sort.format.names }
3030
+ if$
3031
+}
3032
+
3033
+FUNCTION { presort }
3034
+{
3035
+ % Presort creates the bibentry's label via a call to calc.label, and then
3036
+ % sorts the entries based on entry type. Chicago.bst adds support for
3037
+ % including organizations as the sort key; the following is stolen from
3038
+ % alpha.bst.
3039
+
3040
+ calc.label
3041
+ basic.label.year
3042
+ swap$
3043
+ " "
3044
+ swap$
3045
+ * *
3046
+ " "
3047
+ *
3048
+ sortify
3049
+ year field.or.null purify$ #-1 #4 substring$ * % add year
3050
+ " "
3051
+ *
3052
+ type$ "book" =
3053
+ type$ "inbook" =
3054
+ or
3055
+ type$ "article" =
3056
+ or
3057
+ 'author.editor.sort
3058
+ { type$ "proceedings" =
3059
+ type$ "periodical" =
3060
+ or
3061
+ 'editor.organization.sort
3062
+ { type$ "manual" =
3063
+ 'author.editor.organization.sort
3064
+ 'author.sort
3065
+ if$
3066
+ }
3067
+ if$
3068
+ }
3069
+ if$
3070
+ #1 entry.max$ substring$ % added for newapa
3071
+ 'sort.label := % added for newapa
3072
+ sort.label % added for newapa
3073
+ *
3074
+ " "
3075
+ *
3076
+ title field.or.null
3077
+ sort.format.title
3078
+ *
3079
+ #1 entry.max$ substring$
3080
+ 'sort.key$ :=
3081
+}
3082
+
3083
+
3084
+
3085
+ITERATE { presort }
3086
+
3087
+SORT % by label, year, author/editor, title
3088
+
3089
+FUNCTION { initialize.extra.label.stuff }
3090
+{ #0 int.to.chr$ 'last.label :=
3091
+ "" 'next.extra :=
3092
+ #0 'last.extra.num :=
3093
+}
3094
+
3095
+FUNCTION { forward.pass }
3096
+{
3097
+ % Pass through all entries, comparing current entry to last one.
3098
+ % Need to concatenate year to the stack (done by calc.label) to determine
3099
+ % if two entries are the same (see presort)
3100
+
3101
+ last.label
3102
+ % OLD:calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
3103
+ % NEW:
3104
+ calc.basic.label year field.or.null purify$ #-1 #4 substring$ * % add year
3105
+ #1 entry.max$ substring$ = % are they equal?
3106
+ { last.extra.num #1 + 'last.extra.num :=
3107
+ last.extra.num int.to.chr$ 'extra.label :=
3108
+ }
3109
+ { "a" chr.to.int$ 'last.extra.num :=
3110
+ "" 'extra.label :=
3111
+ % OLD: calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
3112
+ % NEW:
3113
+ calc.basic.label year field.or.null purify$ #-1 #4 substring$ * % add year
3114
+ #1 entry.max$ substring$ 'last.label := % assign to last.label
3115
+ }
3116
+ if$
3117
+}
3118
+
3119
+FUNCTION { reverse.pass }
3120
+{
3121
+ next.extra "b" =
3122
+ { "a" 'extra.label := }
3123
+ 'skip$
3124
+ if$
3125
+ label.year extra.label * 'sort.year :=
3126
+ extra.label 'next.extra :=
3127
+}
3128
+
3129
+EXECUTE {initialize.extra.label.stuff}
3130
+
3131
+ITERATE {forward.pass}
3132
+
3133
+REVERSE {reverse.pass}
3134
+
3135
+FUNCTION { bib.sort.order }
3136
+{
3137
+ sort.label
3138
+ " "
3139
+ *
3140
+ year field.or.null sortify
3141
+ *
3142
+ " "
3143
+ *
3144
+ title field.or.null
3145
+ sort.format.title
3146
+ *
3147
+ #1 entry.max$ substring$
3148
+ 'sort.key$ :=
3149
+}
3150
+
3151
+ITERATE { bib.sort.order }
3152
+
3153
+SORT % by sort.label, year, title --- giving final bib. order.
3154
+
3155
+FUNCTION { begin.bib }
3156
+{
3157
+ %% Set to #0 show 13-digit ISBN in preference to 10-digit ISBN.
3158
+ %% Set to #1 to show both 10-digit and 13-digit ISBNs.
3159
+ #1 'show-isbn-10-and-13 :=
3160
+
3161
+ "%%% -*-BibTeX-*-" writeln
3162
+ "%%% Do NOT edit. File created by BibTeX with style" writeln
3163
+ "%%% ACM-Reference-Format-Journals [18-Jan-2012]." writeln
3164
+ "" writeln
3165
+
3166
+ preamble$ empty.or.unknown
3167
+ 'skip$
3168
+ { preamble$ writeln }
3169
+ if$
3170
+ "\begin{thebibliography}{00}" writeln
3171
+ "" writeln
3172
+ "%%% ====================================================================" writeln
3173
+ "%%% NOTE TO THE USER: you can override these defaults by providing" writeln
3174
+ "%%% customized versions of any of these macros before the \bibliography" writeln
3175
+ "%%% command. Each of them MUST provide its own final punctuation," writeln
3176
+ "%%% except for \shownote{}, \showDOI{}, and \showURL{}. The latter two" writeln
3177
+ "%%% do not use final punctuation, in order to avoid confusing it with" writeln
3178
+ "%%% the Web address." writeln
3179
+ "%%%" writeln
3180
+ "%%% To suppress output of a particular field, define its macro to expand" writeln
3181
+ "%%% to an empty string, or better, \unskip, like this:" writeln
3182
+ "%%%" writeln
3183
+ "%%% \newcommand{\showDOI}[1]{\unskip} % LaTeX syntax" writeln
3184
+ "%%%" writeln
3185
+ "%%% \def \showDOI #1{\unskip} % plain TeX syntax" writeln
3186
+ "%%%" writeln
3187
+ "%%% ====================================================================" writeln
3188
+ "" writeln
3189
+
3190
+ %% ACM publications do not use CODEN, ISSN, and LCCN data, so their default
3191
+ %% macro wrappers expand to \unskip, discarding their values and unwanted
3192
+ %% space.
3193
+ %%
3194
+ %% For other publications, prior definitions like these may be useful:
3195
+ %%
3196
+ %% Plain TeX:
3197
+ %% \def \showCODEN #1{CODEN #1.}
3198
+ %% \def \showISSN #1{ISSN #1.}
3199
+ %% \def \showLCCN #1{LCCN #1.}
3200
+ %%
3201
+ %% LaTeX:
3202
+ %% \newcommand{\showCODEN}[1]{CODEN #1.}
3203
+ %% \newcommand{\showISSN}[1]#1{ISSN #1.}
3204
+ %% \newcommand{\showLCCN}[1]{LCCN #1.}
3205
+
3206
+ "\ifx \showCODEN \undefined \def \showCODEN #1{\unskip} \fi" writeln
3207
+ "\ifx \showDOI \undefined \def \showDOI #1{#1}\fi" writeln
3208
+ % ACM styles omit ISBNs, but they can be included by suitable definitions of
3209
+ % \showISBNx and \showISBNxiii before the .bbl file is read
3210
+ "\ifx \showISBNx \undefined \def \showISBNx #1{\unskip} \fi" writeln
3211
+ "\ifx \showISBNxiii \undefined \def \showISBNxiii #1{\unskip} \fi" writeln
3212
+ "\ifx \showISSN \undefined \def \showISSN #1{\unskip} \fi" writeln
3213
+ "\ifx \showLCCN \undefined \def \showLCCN #1{\unskip} \fi" writeln
3214
+ "\ifx \shownote \undefined \def \shownote #1{#1} \fi" writeln % NB: final period supplied by add.period$ above
3215
+ "\ifx \showarticletitle \undefined \def \showarticletitle #1{#1} \fi" writeln
3216
+ "\ifx \showURL \undefined \def \showURL {\relax} \fi" writeln
3217
+ "% The following commands are used for tagged output and should be " writeln
3218
+ "% invisible to TeX" writeln
3219
+ "\providecommand\bibfield[2]{#2}" writeln
3220
+ "\providecommand\bibinfo[2]{#2}" writeln
3221
+ "\providecommand\natexlab[1]{#1}" writeln
3222
+ "\providecommand\showeprint[2][]{arXiv:#2}" writeln
3223
+}
3224
+
3225
+EXECUTE {begin.bib}
3226
+
3227
+EXECUTE {init.state.consts}
3228
+
3229
+ITERATE {call.type$}
3230
+
3231
+FUNCTION { end.bib }
3232
+{
3233
+ newline$
3234
+ "\end{thebibliography}"
3235
+ writeln
3236
+}
3237
+
3238
+EXECUTE {end.bib}
...
...