|
|
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: # pages
288: if ( pages[b]) {
289: if ( pages[b] ~ /[,-]/ )
290: printf "%spp. %s", punc, pages[b];
291: else printf "%sp. %s", punc,pages[b];
292: }
293: # date,
294: printf "%s%s", punc, date[b];
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: if (city[b])
387: printf "%s%s", punc, city[b] ;
388: # date,
389: printf "%s%s", punc, date[b];
390: # pages
391: if ( pages[b]) {
392: if ( pages[b] ~ /[,-]/ )
393: printf "%spp. %s", punc, pages[b];
394: else printf "%sp. %s", punc, pages[b];
395: }
396: }
397:
398: func proceedings(b) {
399:
400: punc = "";
401: # authorlist,
402: if(authors[b] >0) {
403: authorlist(b);
404: punc = ",\n";
405: }
406:
407: # editorlist Ed.,
408: else if(editors[b]) {
409: printf punc;
410: editorlist(b);
411: if (editors[b] == 1) printf ", Ed."
412: else if (editors[b] > 1) printf ", Eds."
413: punc = ",\n";
414: }
415: # publisher,
416: else if(issuer[b]) {
417: printf "%s%s", punc, issuer[b];
418: punc = ",\n";
419: }
420: # italics(title),
421: if(title[b]) {
422: printf "%s\\f2\\&%s\\f1\\&", punc,title[b];
423: punc = ",\n";
424: }
425: # vol. #, no. #,
426: if (volstr[b])
427: printf "%s%s", punc, volstr[b] ;
428: else if (volume[b])
429: printf "%sVol. %s", punc, volume[b] ;
430: if(numstr[b])
431: printf "%s%s", punc, numstr[b];
432: else if (number[b])
433: printf "%sNo. %s", punc, number[b] ;
434: if(partstr[b])
435: printf "%s%s", punc, partstr[b];
436: else if (part[b])
437: printf "%sPt. %s", punc, part[b] ;
438: # publisher,
439: if(issuer[b])
440: if(authors[b] || editors[b])
441: printf "%s%s", punc, issuer[b];
442: # location,
443: if (city[b])
444: printf "%s%s", punc, city[b] ;
445: # (date)
446: if (date[b])
447: printf "%s(%s)", punc, date[b];
448: }
449:
450:
451: func techreport(b) {
452:
453: punc = "";
454: # authorlist,
455: if(authors[b]) {
456: authorlist(b);
457: punc = ",\n";
458: }
459: # ``Title,''
460: if(title[b]) {
461: if(nroff)
462: printf "%s\"%s,\"\n", punc, title[b] ;
463: else
464: printf "%s``%s,''\n", punc, title[b] ;
465: }
466: # report,
467: printf "%s", report[b];
468: punc = ",\n";
469: # publisher,
470: if (issuer[b]) printf "%s%s", punc, issuer[b] ;
471: # date
472: printf "%s%s", punc, date[b] ;
473: }
474:
475:
476: func tm(b) {
477:
478: punc = "";
479: # authorlist,
480: if(authors[b]) {
481: authorlist(b);
482: punc = ",\n";
483: }
484: # italics(title),
485: if(title[b]) {
486: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
487: punc = ",\n";
488: }
489: # tmno,
490: printf punc;
491: if(rp)
492: printf "AT&T Bell Laboratories internal memorandum";
493: else
494: printf "%s", tmno[b];
495: punc = ",\n";
496: # date
497: printf "%s%s", punc, date[b] ;
498: }
499:
500:
501: func manual(b) {
502: punc = "";
503: # authorlist,
504: if(authors[b] >0) {
505: authorlist(b);
506: punc = ",\n";
507: }
508: # editorlist ed.,
509: else if(editors[b]) {
510: printf punc;
511: editorlist(b);
512: if (editors[b] == 1) printf ", Ed."
513: else if (editors[b] > 1) printf ", Eds."
514: punc = ",\n"
515: }
516: # publisher,
517: else if(issuer[b]) {
518: printf "%s%s", punc, issuer[b];
519: punc = ",\n";
520: }
521: # italic(title),
522: if(title[b]) {
523: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
524: punc = ",\n";
525: }
526: # Vol. volume,
527: if(volstr[b])
528: printf "%s%s", punc, volstr[b];
529: else if(volume[b])
530: printf "%sVol. %s", punc, volume[b];
531: # publisher,
532: if(issuer[b])
533: if(authors[b] || editors[b]) {
534: printf "%s%s", punc, issuer[b];
535: punc = ",\n";
536: }
537: # location
538: if (city[b])
539: printf "%s%s", punc, city[b] ;
540: # date,
541: printf "%s%s", punc, date[b];
542: # pages
543: if (pages[b]) {
544: if ( pages[b] ~ /[,-]/ )
545: printf "%spp. %s", punc, pages[b];
546: else
547: printf "%sp. %s", punc, pages[b];
548: }
549: }
550:
551: func pamphlet(b)
552: {
553:
554: punc = "";
555: # authorlist,
556: if(authors[b] >0) {
557: authorlist(b);
558: punc = ",\n";
559: }
560:
561: # publisher,
562: else if(issuer[b]) {
563: printf "%s%s", punc, issuer[b];
564: punc = ",\n";
565: }
566: # ``Title,''
567: if(title[b]) {
568: if(nroff) {
569: printf "%s\"%s", punc, title[b] ;
570: punc = ",\"\n";
571: }
572: else {
573: printf "%s``%s", punc, title[b] ;
574: punc = ",''\n";
575: }
576: }
577: # publisher,
578: if(issuer[b]) {
579: if(authors[b] || editors[b]) {
580: printf "%s%s", punc, issuer[b];
581: punc = ",\n";
582: }
583: }
584: # location,
585: if (city[b]) {
586: printf "%s%s", punc, city[b] ;
587: punc = ",\n";
588: }
589: # date
590: if (date[b]) {
591: printf "%s%s", punc, date[b];
592: punc = ",\n";
593: }
594: }
595:
596: func default(b) {
597: punc = "";
598: # authorlist,
599: if(authors[b] >0) {
600: authorlist(b);
601: punc = ",\n";
602: }
603:
604: # publisher,
605: else if(issuer[b]) {
606: printf "%s%s", punc, issuer[b];
607: punc = ",\n";
608: }
609: # Title,
610: if(title[b]) {
611: printf "%s\\f2\\&%s\\f1\\&", punc, title[b] ;
612: punc = ",\n";
613: }
614: # Vol. volume,
615: if(volstr[b])
616: printf "%s%s", punc, volstr[b];
617: else if(volume[b])
618: printf "%sVol. %s", punc, volume[b];
619: # publisher,
620: if(issuer[b]) {
621: if(authors[b] || editors[b]) {
622: printf "%s%s", punc, issuer[b];
623: punc = ",\n";
624: }
625: }
626: # location,
627: if (city[b]) {
628: printf "%s%s", punc, city[b] ;
629: punc = ",\n";
630: }
631: # pages
632: if (pages[b]) {
633: if ( pages[b] ~ /[,-]/ ) {
634: printf "%spp. %s", punc, pages[b];
635: punc = ",\n";
636: }
637: else {
638: printf "%sp. %s", punc, pages[b];
639: punc = ",\n";
640: }
641: }
642: # date,
643: if (date[b]) {
644: printf "%s%s", punc, date[b];
645: }
646: }
647:
648:
649: ##
650: ## authorlist
651: ## First
652: ## First and Second
653: ## First, Second,..., and Last
654: ##
655: func authorlist(b) {
656: if ( authors[b] == 0 ) ;
657: else if ( authors[b] == 1 ) {
658: printf Afull[b,1] ;
659: if(aetal[b]) printf ", et al.";
660: }
661: else if ( authors[b] == 2 ) printf Afull[b,1] " and " Afull[b,2];
662: else {
663: for ( j = 1; j < authors[b]; j++ ) print Afull[b,j] ", ";
664: printf "and " Afull[b,authors[b]];
665: }
666: }
667:
668:
669: ##
670: ## editorlist
671: ## First
672: ## First and Second
673: ## First, Second,..., and Last
674: ##
675: func editorlist(b) {
676: if ( editors[b] == 0 ) ;
677: else if ( editors[b] == 1 ) {
678: printf E[b,1] ;
679: if(eetal[b]) printf ", et al.";
680: }
681: else if ( editors[b] == 2 ) printf E[b,1] " and " E[b,2];
682: else {
683: for ( j = 1; j < editors[b]; j++ ) print E[b,j] ", ";
684: printf "and " E[b,editors[b]];
685: }
686: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.