|
|
1.1 root 1: ###
2: ### ieee reference formatting style
3: ###
4:
5: BEGIN {
6: PASS = ""; # only one pass thru document
7: sortflag = 0; # reference_placement bibliography is not sorted
8: STYLE = ieee;
9: SKEY = "adt";
10: }
11:
12: #######################################################
13: #
14: # Functions required by general awk script
15: #
16: #######################################################
17:
18: ##
19: ## Set author and editor fields
20: ## for reference
21: ## for possible sorting
22:
23: func setauthor(b,a) {
24: Afull[b,a] = F_MLast();
25: Asort[b] = Asort[b] LastFM()" ";
26: }
27:
28:
29: func seteditor(b,a) {
30: E[b,a] = F_MLast();
31: Esort[b] = Esort[b] LastFM() " ";
32: }
33:
34: ##
35: ## citations
36: ## print a citation list
37: ## troff superscripted numbers
38: ## nroff numbers in square brackets
39: ##
40: func citations(tpunc) {
41:
42: seq = "no";
43: sep = "";
44:
45: # troff citation
46:
47: if(nroff == 0) {
48: tcite = "";
49: begin_super = "\\^\\s-2\\v'-0.4m'\\f1\\&";
50: end_super = "\\fP\\v'0.4m'\\s+2"
51: if(quote(tpunc) || period(tpunc))
52: end_super = end_super "\\ ";
53:
54: # format the list of citations, putting in commas and hypens
55:
56: for(i=1; i<=cites; i++) {
57: seq = sequence(i,cites);
58: if (seq == "in") continue;
59: if (seq == "end") {
60: sep = "-";
61: seq = "no";
62: }
63: tcite = tcite sep makemark(i);
64: sep = ",\\ ";
65: }
66: printf "%s%s%s%s", tpunc, begin_super, tcite, end_super;
67: }
68:
69: # nroff citation
70:
71: else {
72: ncite = "\n";
73: if(quote(tpunc)) {
74: ncite = tpunc " ";
75: tpunc = "\\ ";
76: }
77: else if(tpunc == "(") {
78: ncite = tpunc;
79: tpunc = "";
80: }
81:
82: # format the list of citations, putting in commas and hypens
83:
84: for(i=1; i<=cites; i++) {
85: seq = sequence(i,cites);
86: if (seq == "in") continue;
87: if (seq == "end") {
88: sep = "-";
89: seq = "no";
90: }
91: ncite = ncite sep "[" makemark(i) "]";
92: sep = ", ";
93: }
94: printf "%s%s", ncite, tpunc;
95: }
96: }
97:
98: func quote(punc) {
99: if(tpunc == "\"" || tpunc == "'") return 1;
100: return 0;
101: }
102:
103: func period(punc) {
104: if (tpunc == "." || tpunc == "!" || tpunc == "?") return 1;
105: return 0;
106: }
107:
108:
109: ##
110: ## makemark
111: ## return citation mark: identical citations have the same number
112: ##
113: func makemark(m) {
114: return(uniqno[bibptr[m]]);
115: }
116:
117:
118: ##
119: ## bibindex
120: ## print citation mark for the bibliography;
121: ## return an index for accessing rest of citation
122: ##
123: func bibindex(b) {
124: printf ".sp .5\n.ti -\\w'" b ".\\ \\ \\ 'u\n";
125: printf b ".\\ \\ \\ " ;
126: if (sortflag) return sortorder[b];
127: else return b;
128: }
129:
130:
131: #############################################
132: #
133: # Reference types
134: #
135: ############################################
136:
137:
138: func book(b) {
139: punc = "";
140: # authorlist,
141: if(authors[b]) {
142: authorlist(b);
143: punc = ",\n";
144: }
145: # italic(title),
146: if(title[b]) {
147: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
148: punc = ",\n";
149: # Vol. #,
150: if(volstr[b])
151: printf "%s%s", punc, volstr[b];
152: else if(volume[b])
153: printf "%sVol. %s", punc, volume[b];
154: }
155: # publisher,
156: printf "%s%s", punc, issuer[b] ;
157: punc = ",\n";
158: # location,
159: if (city[b])
160: printf "%s%s", punc, city[b] ;
161: # date,
162: printf "%s%s", punc, date[b] ;
163: # pages
164: if ( pages[b]) {
165: if ( pages[b] ~ /[,-]/ )
166: printf "%spp. %s", punc, pages[b];
167: else printf "%sp. %s", punc, pages[b];
168: }
169: }
170:
171:
172: func editedbook(b) {
173:
174: punc = "";
175: # authorlist, Ed.,
176: if(authors[b]) {
177: authorlist(b);
178: if(authors[b] <2)
179: printf ", Ed.";
180: else
181: printf ", Eds.";
182: punc = ",\n";
183: }
184: # italic(title),
185: if(title[b]) {
186: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
187: punc = ",\n";
188: # Vol. #,
189: if(volstr[b])
190: printf "%s%s", punc, volstr[b];
191: else if(volume[b])
192: printf "%sVol. %s", punc, volume[b];
193: }
194: # publisher,
195: printf "%s%s", punc, issuer[b] ;
196: punc = ",\n";
197: # location,
198: if (city[b])
199: printf "%s%s", punc, city[b] ;
200: # date,
201: printf "%s%s", punc, date[b] ;
202: # pages
203: if ( pages[b]) {
204: if ( pages[b] ~ /[,-]/ )
205: printf "%spp. %s", punc, pages[b];
206: else printf "%sp. %s", punc, pages[b];
207: }
208: }
209:
210: func thesis(b) {
211: punc = "";
212: # authorlist,
213: if(authors[b]) {
214: authorlist(b);
215: punc = ",\n";
216: }
217: # italic(title),
218: if(title[b]) {
219: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
220: punc = ",\n";
221: }
222: # thesis,
223: printf punc;
224: if(reftype[b] == "phdthesis")
225: printf "PhD Thesis";
226: else
227: printf "Master's Thesis";
228: punc = ",\n";
229: # report number,
230: if(report[b])
231: printf "%s%s", punc, report[b];
232: # school,
233: printf "%s%s", punc, issuer[b];
234: # date
235: printf "%s%s", punc, date[b] ;
236: }
237:
238: func review(b) {
239: article(b);
240: }
241:
242:
243: func article(b) {
244:
245: punc = "";
246: # authorlist,
247: if(authors[b]) {
248: authorlist(b);
249: punc = ",\n";
250: }
251: # ``Title,''
252: if(title[b]) {
253: if(nroff)
254: printf "%s\"%s,\"", punc, title[b] ;
255: else
256: printf "%s``%s,''", punc, title[b] ;
257: punc = "\n";
258: }
259: # Reviewed title and author
260: if(booktitle[b]) {
261: printf "%sReview of \\f2\\&%s\\f1\\&", punc, booktitle[b];
262: if(editors[b]) {
263: printf " by ";
264: editorlist(b);
265: }
266: if (issuer[b]) {
267: printf " %s", issuer[b];
268: }
269: printf ",\n";
270: }
271: # italics(journal),
272: printf "\\f2\\&%s\\f1\\&", journal[b];
273: punc = ",\n";
274: # vol. #, no. #, Pt. #
275: if (volstr[b])
276: printf "%s%s", punc, volstr[b] ;
277: else if (volume[b])
278: printf "%sVol. %s", punc, volume[b] ;
279: if(numstr[b])
280: printf "%s%s", punc, numstr[b];
281: else if (number[b])
282: printf "%sNo. %s", punc, number[b] ;
283: if(partstr[b])
284: printf "%s%s", punc, partstr[b];
285: else if (part[b])
286: printf "%sPt. %s", punc, part[b] ;
287: # date,
288: printf "%s%s", punc, date[b];
289: # pages
290: if ( pages[b]) {
291: if ( pages[b] ~ /[,-]/ )
292: printf "%spp. %s", punc, pages[b];
293: else printf "%sp. %s", punc,pages[b];
294: }
295: }
296:
297:
298:
299: func incollection(b) {
300:
301: punc = "";
302: # authorlist,
303: if(authors[b]) {
304: authorlist(b);
305: punc = ",\n";
306: }
307: # ``Title,''
308: if(title[b]) {
309: if(nroff)
310: printf "%s\"%s,\"\n", punc, title[b] ;
311: else
312: printf "%s``%s,''\n", punc, title[b] ;
313: }
314: # in italics(booktitle),
315: printf "in \\f2\\&%s\\f1\\&", booktitle[b];
316: punc = ",\n";
317: # Vol. #,
318: if(volstr[b])
319: printf "%s%s", punc, volstr[b];
320: else if(volume[b])
321: printf "%sVol. %s", punc, volume[b];
322: # editorlist, eds.,
323: if(editors[b]) {
324: printf punc;
325: editorlist(b);
326: if (editors[b] == 1) printf ", Ed."
327: else if (editors[b] > 1) printf ", Eds."
328: }
329: # publisher, location,
330: printf "%s%s", punc, issuer[b]
331: if (city[b])
332: printf ", %s", city[b] ;
333: # date,
334: printf "%s%s", punc, date[b];
335: # pages
336: if ( pages[b]) {
337: if ( pages[b] ~ /[,-]/ )
338: printf "%spp. %s", punc,pages[b];
339: else printf "%sp. %s", punc,pages[b];
340: }
341: }
342:
343:
344: func inproceedings(b) {
345:
346: punc = "";
347: # authorlist,
348: if(authors[b]) {
349: authorlist(b);
350: punc = ",\n";
351: }
352: # ``Title,''
353: if(title[b]) {
354: if(nroff)
355: printf "%s\"%s,\"\n", punc, title[b] ;
356: else
357: printf "%s``%s,''\n", punc, title[b] ;
358: }
359: # italics(journal),
360: printf "\\f2\\&%s\\f1\\&", journal[b];
361: punc = ",\n";
362: # vol. #, no. #,
363: if (volstr[b])
364: printf "%s%s", punc, volstr[b] ;
365: else if (volume[b])
366: printf "%sVol. %s", punc, volume[b] ;
367: if(numstr[b])
368: printf "%s%s", punc, numstr[b];
369: else if (number[b])
370: printf "%sNo. %s", punc, number[b] ;
371: if(partstr[b])
372: printf "%s%s", punc, partstr[b];
373: else if (part[b])
374: printf "%sPt. %s", punc, part[b] ;
375: # editorlist, eds.,
376: if(editors[b]) {
377: printf punc;
378: editorlist(b);
379: if (editors[b] == 1) printf ", Ed."
380: else if (editors[b] > 1) printf ", Eds."
381: }
382: # publisher,
383: if(issuer[b])
384: if(authors[b] || editors[b])
385: printf "%s%s", punc, issuer[b];
386: # date,
387: printf "%s%s", punc, date[b];
388: # pages
389: if ( pages[b]) {
390: if ( pages[b] ~ /[,-]/ )
391: printf "%spp. %s", punc, pages[b];
392: else printf "%sp. %s", punc, pages[b];
393: }
394: }
395:
396: func proceedings(b) {
397:
398: punc = "";
399: # authorlist,
400: if(authors[b] >0) {
401: authorlist(b);
402: punc = ",\n";
403: }
404:
405: # editorlist Ed.,
406: else if(editors[b]) {
407: printf punc;
408: editorlist(b);
409: if (editors[b] == 1) printf ", Ed."
410: else if (editors[b] > 1) printf ", Eds."
411: punc = ",\n";
412: }
413: # publisher,
414: else if(issuer[b]) {
415: printf "%s%s", punc, issuer[b];
416: punc = ",\n";
417: }
418: # italics(title),
419: if(title[b]) {
420: printf "%s\\f2\\&%s\\f1\\&", punc,title[b];
421: punc = ",\n";
422: }
423: # vol. #, no. #,
424: if (volstr[b])
425: printf "%s%s", punc, volstr[b] ;
426: else if (volume[b])
427: printf "%sVol. %s", punc, volume[b] ;
428: if(numstr[b])
429: printf "%s%s", punc, numstr[b];
430: else if (number[b])
431: printf "%sNo. %s", punc, number[b] ;
432: if(partstr[b])
433: printf "%s%s", punc, partstr[b];
434: else if (part[b])
435: printf "%sPt. %s", punc, part[b] ;
436: # publisher,
437: if(issuer[b])
438: if(authors[b] || editors[b])
439: printf "%s%s", punc, issuer[b];
440: # location,
441: if (city[b])
442: printf "%s%s", punc, city[b] ;
443: # (date)
444: if (date[b])
445: printf "%s(%s)", punc, date[b];
446: }
447:
448:
449: func techreport(b) {
450:
451: punc = "";
452: # authorlist,
453: if(authors[b]) {
454: authorlist(b);
455: punc = ",\n";
456: }
457: # ``Title,''
458: if(title[b]) {
459: if(nroff)
460: printf "%s\"%s,\"\n", punc, title[b] ;
461: else
462: printf "%s``%s,''\n", punc, title[b] ;
463: }
464: # report,
465: printf "%s", report[b];
466: punc = ",\n";
467: # publisher,
468: if (issuer[b]) printf "%s%s", punc, issuer[b] ;
469: # date
470: printf "%s%s", punc, date[b] ;
471: }
472:
473:
474: func tm(b) {
475:
476: punc = "";
477: # authorlist,
478: if(authors[b]) {
479: authorlist(b);
480: punc = ",\n";
481: }
482: # italics(title),
483: if(title[b]) {
484: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
485: punc = ",\n";
486: }
487: # tmno,
488: printf punc;
489: if(rp)
490: printf "AT&T Bell Laboratories internal memorandum";
491: else
492: printf "%s", tmno[b];
493: punc = ",\n";
494: # date
495: printf "%s%s", punc, date[b] ;
496: }
497:
498:
499: func manual(b) {
500: punc = "";
501: # authorlist,
502: if(authors[b] >0) {
503: authorlist(b);
504: punc = ",\n";
505: }
506: # editorlist ed.,
507: else if(editors[b]) {
508: printf punc;
509: editorlist(b);
510: if (editors[b] == 1) printf ", Ed."
511: else if (editors[b] > 1) printf ", Eds."
512: punc = ",\n"
513: }
514: # publisher,
515: else if(issuer[b]) {
516: printf "%s%s", punc, issuer[b];
517: punc = ",\n";
518: }
519: # italic(title),
520: if(title[b]) {
521: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
522: punc = ",\n";
523: }
524: # Vol. volume,
525: if(volstr[b])
526: printf "%s%s", punc, volstr[b];
527: else if(volume[b])
528: printf "%sVol. %s", punc, volume[b];
529: # publisher,
530: if(issuer[b])
531: if(authors[b] || editors[b]) {
532: printf "%s%s", punc, issuer[b];
533: punc = ",\n";
534: }
535: # location
536: if (city[b])
537: printf "%s%s", punc, city[b] ;
538: # date,
539: printf "%s%s", punc, date[b];
540: # pages
541: if (pages[b]) {
542: if ( pages[b] ~ /[,-]/ )
543: printf "%spp. %s", punc, pages[b];
544: else
545: printf "%sp. %s", punc, pages[b];
546: }
547: }
548:
549: func pamphlet(b)
550: {
551:
552: punc = "";
553: # authorlist,
554: if(authors[b] >0) {
555: authorlist(b);
556: punc = ",\n";
557: }
558:
559: # publisher,
560: else if(issuer[b]) {
561: printf "%s%s", punc, issuer[b];
562: punc = ",\n";
563: }
564: # ``Title,''
565: if(title[b]) {
566: if(nroff) {
567: printf "%s\"%s", punc, title[b] ;
568: punc = ",\"\n";
569: }
570: else {
571: printf "%s``%s", punc, title[b] ;
572: punc = ",''\n";
573: }
574: }
575: # publisher,
576: if(issuer[b]) {
577: if(authors[b] || editors[b]) {
578: printf "%s%s", punc, issuer[b];
579: punc = ",\n";
580: }
581: }
582: # location,
583: if (city[b]) {
584: printf "%s%s", punc, city[b] ;
585: punc = ",\n";
586: }
587: # date
588: if (date[b]) {
589: printf "%s%s", punc, date[b];
590: punc = ",\n";
591: }
592: }
593:
594: func default(b) {
595: punc = "";
596: # authorlist,
597: if(authors[b] >0) {
598: authorlist(b);
599: punc = ",\n";
600: }
601:
602: # publisher,
603: else if(issuer[b]) {
604: printf "%s%s", punc, issuer[b];
605: punc = ",\n";
606: }
607: # Title,
608: if(title[b]) {
609: printf "%s\\f2\\&%s\\f1\\&", punc, title[b] ;
610: punc = ",\n";
611: }
612: # Vol. volume,
613: if(volstr[b])
614: printf "%s%s", punc, volstr[b];
615: else if(volume[b])
616: printf "%sVol. %s", punc, volume[b];
617: # publisher,
618: if(issuer[b]) {
619: if(authors[b] || editors[b]) {
620: printf "%s%s", punc, issuer[b];
621: punc = ",\n";
622: }
623: }
624: # location,
625: if (city[b]) {
626: printf "%s%s", punc, city[b] ;
627: punc = ",\n";
628: }
629: # date,
630: if (date[b]) {
631: printf "%s%s", punc, date[b];
632: punc = ",\n";
633: }
634: # pages
635: if (pages[b]) {
636: if ( pages[b] ~ /[,-]/ )
637: printf "%spp. %s", punc, pages[b];
638: else
639: printf "%sp. %s", punc, pages[b];
640: }
641: }
642:
643:
644: ##
645: ## authorlist
646: ## First
647: ## First and Second
648: ## First, Second,..., and Last
649: ##
650: func authorlist(b) {
651: if ( authors[b] == 0 ) ;
652: else if ( authors[b] == 1 ) {
653: printf Afull[b,1] ;
654: if(aetal[b]) printf ", et al.";
655: }
656: else if ( authors[b] == 2 ) printf Afull[b,1] " and " Afull[b,2];
657: else {
658: for ( j = 1; j < authors[b]; j++ ) print Afull[b,j] ", ";
659: printf "and " Afull[b,authors[b]];
660: }
661: }
662:
663:
664: ##
665: ## editorlist
666: ## First
667: ## First and Second
668: ## First, Second,..., and Last
669: ##
670: func editorlist(b) {
671: if ( editors[b] == 0 ) ;
672: else if ( editors[b] == 1 ) {
673: printf E[b,1] ;
674: if(eetal[b]) printf ", et al.";
675: }
676: else if ( editors[b] == 2 ) printf E[b,1] " and " E[b,2];
677: else {
678: for ( j = 1; j < editors[b]; j++ ) print E[b,j] ", ";
679: printf "and " E[b,editors[b]];
680: }
681: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.