|
|
1.1 ! root 1: # ! 2: # general - general style awk script ! 3: # every style script must begin with this general header ! 4: # ! 5: ! 6: ! 7: ! 8: ! 9: BEGIN { ! 10: ! 11: # ! 12: # used by fixname for parsing name string ! 13: # ! 14: verbatim="%verbatim[ ]*((\\([^\\)]*\\))|(\\[[^\\]]*\\])|(<[^>]*>)|({[^}]*}))" ! 15: ! 16: titles["Mr."] = 1; ! 17: titles["Mr"] = 1; ! 18: titles["Mrs."] = 1; ! 19: titles["Mrs"] = 1; ! 20: titles["Ms."] = 1; ! 21: titles["Ms"] = 1; ! 22: titles["Dr."] = 1; ! 23: titles["Dr"] = 1; ! 24: titles["Fr."] = 1; ! 25: titles["Fr"] = 1; ! 26: titles["Rev."] = 1; ! 27: titles["Rev"] = 1; ! 28: ! 29: postfix["I"] = 1; ! 30: postfix["II"] = 1; ! 31: postfix["III"] = 1; ! 32: postfix["IV"] = 1; ! 33: postfix["Jr."] = 1; ! 34: postfix["Jr"] = 1; ! 35: postfix["M.D."] = 1; ! 36: postfix["MD"] = 1; ! 37: postfix["S.J."] = 1; ! 38: postfix["SJ"] = 1; ! 39: ! 40: prefix["Mac"] = 1; ! 41: prefix["Mc"] = 1; ! 42: prefix["Van"] = 1; ! 43: prefix["Von"] = 1; ! 44: prefix["mac"] = 1; ! 45: prefix["mc"] = 1; ! 46: prefix["van"] = 1; ! 47: prefix["von"] = 1; ! 48: prefix["di"] = 1; ! 49: prefix["Di"] = 1; ! 50: prefix["de"] = 1; ! 51: prefix["De"] = 1; ! 52: prefix["D'"] = 1; ! 53: prefix["d'"] = 1; ! 54: prefix["Der"] = 1; ! 55: prefix["der"] = 1; ! 56: prefix["Del"] = 1; ! 57: prefix["del"] = 1; ! 58: prefix["La"] = 1; ! 59: prefix["la"] = 1; ! 60: prefix["L'"] = 1; ! 61: prefix["l'"] = 1; ! 62: ! 63: ! 64: ! 65: Monthcode["Foo"] = 00; ! 66: Monthcode["Jan"] = 01; ! 67: Monthcode["Feb"] = 02; ! 68: Monthcode["Mar"] = 03; ! 69: Monthcode["Apr"] = 04; ! 70: Monthcode["May"] = 05; ! 71: Monthcode["Jun"] = 06; ! 72: Monthcode["Jul"] = 07; ! 73: Monthcode["Aug"] = 08; ! 74: Monthcode["Sep"] = 09; ! 75: Monthcode["Oct"] = 10; ! 76: Monthcode["Nov"] = 11; ! 77: Monthcode["Dec"] = 12; ! 78: } ! 79: ! 80: ! 81: ## ! 82: ## Control and reference information from prefer ! 83: ## ! 84: ! 85: $1 == "%LETS_GO" { ! 86: print PASS; ! 87: if($2 == "nroff") nroff = 1; ! 88: if($3 == "rp") rp = 1; ! 89: } ! 90: ! 91: ! 92: $1 == "%BEGIN_CITE" { ! 93: bibno++; ! 94: cbibno++; ! 95: assoc = ""; ! 96: allauthors[bibno] = ""; ! 97: } ! 98: ! 99: $1 == "%T" { # check for refer format ! 100: if(refertitle == 0) { ! 101: print "Warning: reference data is in refer format; use pconvert to change to refer format" | "cat >&2"; ! 102: } ! 103: refertitle++; ! 104: } ! 105: ! 106: /^%/ { sub(/[ \t]*$/,""); } ! 107: ! 108: $1 == "%author" { ! 109: if($2 ~ /^et/ && $3 ~ /^al/) { ! 110: aetal[bibno] = 1; ! 111: } ! 112: else { ! 113: a = ++authors[bibno]; ! 114: fixname(); ! 115: setauthor(bibno,a); ! 116: if(!aflag) ! 117: assoc = assoc Afull[bibno,a]; ! 118: allauthors[bibno] = allauthors[bibno] Afull[bibno,a]; ! 119: } ! 120: } ! 121: ! 122: ! 123: $1 == "%booktitle" { booktitle[bibno] = getrest();} ! 124: ! 125: $1 == "%address" { city[bibno] = getrest(); } ! 126: ! 127: $1 == "%date" { # assumes Month Day, Year ! 128: year[bibno] = $NF; ! 129: if(NF > 2) { ! 130: month[bibno] = substr($2,1,3); ! 131: if(NF == 4) { ! 132: day[bibno] = $3; ! 133: sub(",","",day[bibno]); ! 134: } ! 135: date[bibno] = getrest(); ! 136: } ! 137: else date[bibno] = $NF; ! 138: if(!aflag) ! 139: assoc = assoc date[bibno]; ! 140: } ! 141: ! 142: $1 == "%editor" { ! 143: if($2 ~ /^et/ && $3 ~ /^al/) ! 144: eetal[bibno] = 1; ! 145: else { ! 146: e = ++editors[bibno]; ! 147: fixname(); ! 148: seteditor(bibno,e); ! 149: } ! 150: } ! 151: ! 152: $1 == "%publisher" { issuer[bibno] = getrest(); } ! 153: ! 154: $1 == "%journal" { journal[bibno] = getrest(); } ! 155: ! 156: $1 == "%number" { ! 157: number[bibno] = $2; ! 158: if(NF > 2) numstr[bibno] = getrest(); ! 159: } ! 160: ! 161: $1 == "%other" { other[bibno] = getrest(); } ! 162: ! 163: $1 == "%pages" { ! 164: pages[bibno] = getrest(); ! 165: gsub(/- /,"-",pages[bibno]); ! 166: gsub(/ -/,"-",pages[bibno]); ! 167: } ! 168: ! 169: $1 == "%part" { ! 170: part[bibno] = $2 ! 171: if(NF > 2) partstr[bibno] = getrest(); ! 172: } ! 173: ! 174: $1 == "%report" { report[bibno] = getrest(); } ! 175: ! 176: $1 == "%tm" { tmno[bibno] = getrest(); } ! 177: ! 178: $1 == "%type" { reftype[bibno] = $2; } ! 179: ! 180: $1 == "%title" { ! 181: title[bibno] = getrest(); ! 182: if(!aflag) ! 183: assoc = assoc title[bibno]; ! 184: } ! 185: ! 186: $1 == "%volume" { ! 187: volume[bibno] = $2; ! 188: if(NF > 2) volstr[bibno] = getrest(); ! 189: } ! 190: ! 191: $1 == "%also_begin" { ! 192: if(++aflag == 1) { ! 193: savebibno = bibno; ! 194: } ! 195: bibno = savebibno " " ++also[savebibno]; ! 196: allauthors[bibno] = ""; ! 197: pre_also[bibno] = getrest(); ! 198: } ! 199: ! 200: ! 201: $1 == "%also_end" { ! 202: aflag--; ! 203: if(reftype[bibno] == "not_found" || reftype[savebibno] == "not_found") { ! 204: erasebib(bibno); ! 205: also[savebibno]--; ! 206: } ! 207: ! 208: else { ! 209: if(title[savebibno] == title[bibno]) ! 210: title[bibno] = ""; ! 211: if(allauthors[savebibno] == allauthors[bibno]) ! 212: authors[bibno] = 0; ! 213: post_also[bibno] = getrest(); ! 214: } ! 215: if(aflag) ! 216: bibno = savebibno " " aflag; ! 217: else ! 218: bibno = savebibno; ! 219: } ! 220: ! 221: $1 == "%no_cite" { no_cite[cbibno] = 1; } ! 222: ! 223: $1 == "%no_author" { no_author[cbibno] = 1; } ! 224: ! 225: $1 == "%no_date" { no_date[cbibno] = 1; } ! 226: ! 227: $1 == "%pre_text" { pre_text[cbibno] = getrest(); } ! 228: ! 229: $1 == "%post_text" { post_text[cbibno] = getrest(); } ! 230: ! 231: $1 == "%END_CITE" { ! 232: if(reftype[bibno] == "not_found") { ! 233: erasebib(bibno); ! 234: erasecite(cbibno); ! 235: bibno--; ! 236: cbibno--; ! 237: } ! 238: else { ! 239: assoc = assoc reftype[bibno]; ! 240: if (biblist[assoc] != 0) { ! 241: erasebib(bibno); ! 242: bibno--; ! 243: } ! 244: else ! 245: biblist[assoc] = bibno; ! 246: uniqno[cbibno] = biblist[assoc]; ! 247: ! 248: if (no_cite[cbibno] != 1) { ! 249: cites++; ! 250: bibptr[cites] = cbibno; ! 251: } ! 252: } ! 253: } ! 254: ! 255: $1 == "%END_LIST" { ! 256: if (cites > 0) { ! 257: citations($2); ! 258: cites = 0; ! 259: } ! 260: else printf $2; ! 261: print $1; ! 262: } ! 263: ! 264: $1 == "%BIBLIO" { ! 265: if(bibno > 0 && $2 != "no_bib") { ! 266: if(sortflag && PASS == "") ! 267: bibsort(SKEY); ! 268: bibliography(); ! 269: } ! 270: print "%END_BIB"; ! 271: } ! 272: ! 273: $1 == "%WHOLEBIB" { ! 274: if(bibno > 0) { ! 275: if ($2) { ! 276: sortflag = 1; ! 277: if($2 == "sort") ! 278: bibsort(SKEY); ! 279: else ! 280: bibsort($2); ! 281: } ! 282: else sortflag = 0; ! 283: bibliography(); ! 284: } ! 285: print "%END_BIB"; ! 286: } ! 287: ! 288: ! 289: ## ! 290: ## For two passes ! 291: ## ! 292: $1 == "%END_CITE2" { ! 293: cbibno++ ! 294: if (no_cite[cbibno] != 1) { ! 295: cites++; ! 296: bibptr[cites] = cbibno; ! 297: ! 298: } ! 299: } ! 300: ! 301: $1 == "%END_LIST1" { ! 302: cites = 0; ! 303: print $2 "%END_LIST"; ! 304: } ! 305: ! 306: ! 307: $1 == "%BIBLIO1" { ! 308: if(sortflag) ! 309: bibsort(SKEY); ! 310: cbibno = 0; ! 311: } ! 312: ! 313: $1 == "%DBINCLUDE" { ! 314: cbibno +=$2; ! 315: } ! 316: ! 317: ! 318: ! 319: ############################################## ! 320: ## ! 321: ## functions ! 322: ## ! 323: ############################################## ! 324: ! 325: ## ! 326: ## Sort the entire bibliography by the stated keys ! 327: ## ! 328: func bibsort(keys) ! 329: { ! 330: if (bibno == 0) return; ! 331: ! 332: "echo $$" | getline pid; ! 333: sortout = "/tmp/sort" pid; ! 334: sort = "sort -f -o " sortout; ! 335: for(k=1; k <=3; k++) ! 336: key[k] = substr(keys,k,1); ! 337: for(i = 1; i <= bibno; i++) { ! 338: for(k=1; k <=3; k++) { ! 339: if(key[k] == "a") { ! 340: if(authors[i] ) ! 341: printf "%s\t", Asort[i] | sort; ! 342: else if(editors[i]) ! 343: printf "%s\t", Esort[i] | sort; ! 344: else if(issuer[i]) ! 345: printf "%s\t", issuer[i] | sort; ! 346: else ! 347: printf "%s\t", title[i] | sort; ! 348: } ! 349: else if(key[k] == "d") { ! 350: printf "%s", year[i] | sort; ! 351: printf "%2s", Monthcode[month[i]] | sort; ! 352: printf "%2s\t", day[i] | sort; ! 353: } ! 354: else if(key[k] == "t") ! 355: printf "%s\t", title[i] | sort; ! 356: else ! 357: printf " \t" | sort; ! 358: } ! 359: print i | sort; ! 360: } ! 361: close(sort); ! 362: FS = "\t"; ! 363: for(i = 1; i <= bibno; i++) { ! 364: getline < sortout; ! 365: sortorder[i] = $4; ! 366: inverse[$4] = i; ! 367: } ! 368: FS = " "; ! 369: system("rm " sortout); ! 370: } ! 371: ! 372: ## ! 373: ## erase bibliographic entry ! 374: ## ! 375: func erasebib(b) ! 376: { ! 377: authors[b] = 0; ! 378: allauthors[b] = ""; ! 379: aetal[b] = 0; ! 380: editors[b] = 0; ! 381: eetal[b] = 0; ! 382: title[b] = ""; ! 383: booktitle[b] = ""; ! 384: issuer[b] = ""; ! 385: journal[b] = ""; ! 386: number[b] = ""; ! 387: other[b] = ""; ! 388: pages[b] = ""; ! 389: part[b] = ""; ! 390: report[b] = ""; ! 391: reftype[b] = ""; ! 392: volume[b] = ""; ! 393: volstr[b] = ""; ! 394: date[b] = ""; ! 395: year[b] = ""; ! 396: month[b] = "Foo"; ! 397: day[b] = "00"; ! 398: city[b] = ""; ! 399: Asort[b] = ""; ! 400: Esort[b] = ""; ! 401: also[b] = 0; ! 402: pre_also[b] = ""; ! 403: post_also[b] = ""; ! 404: } ! 405: ! 406: ! 407: ## ! 408: ## erase citation entry ! 409: ## ! 410: func erasecite(b) { ! 411: no_cite[b] = 0; ! 412: no_author[b] = 0; ! 413: no_date[b] = 0; ! 414: pre_text[b] = ""; ! 415: post_text[b] = ""; ! 416: } ! 417: ! 418: ## ! 419: ## sequence - dtermine if c is in a sequence c-1, c, c+1 ! 420: ## ! 421: func sequence(c,n) { ! 422: ! 423: # take care of endpoints 1 and n ! 424: if (c == 1) return "no"; ! 425: if (c == n) { ! 426: if(seq == "in") return "end"; ! 427: else return "no" ! 428: } ! 429: ! 430: # ignore sequence if pretext or posttext exists ! 431: ! 432: text = 0; ! 433: if (pretext[bibptr[c-1]] || posttext[bibptr[c-1]] || \ ! 434: pretext[bibptr[c]] || posttext[bibptr[c]] || \ ! 435: pretext[bibptr[c+1]] || posttext[bibptr[c+1]] ) text = 1 ; ! 436: ! 437: # detect a sequence ..1,2,3.. ! 438: ! 439: if((makemark(c-1) == makemark(c)-1) && (makemark(c+1) == makemark(c)+1)) { ! 440: if (text == 1) ! 441: if(seq == "in") return "end"; ! 442: else return "no"; ! 443: else return "in"; ! 444: } ! 445: ! 446: # detect end ..7,8,22 ! 447: ! 448: if((seq == "in") && (makemark(c+1) != makemark(c)+1)) return "end"; ! 449: } ! 450: ! 451: ! 452: ! 453: ## ! 454: ## format a list of bibliographies ! 455: ## used by both reference_placement and reference_list ! 456: ## ! 457: func bibliography() ! 458: { ! 459: print ".in .5i"; ! 460: for(i = 1; i <= bibno; i++) { ! 461: b = bibindex(i); ! 462: printref(b); ! 463: } ! 464: print ".in -5i" ! 465: print ".nr RF " bibno; ! 466: } ! 467: ! 468: ## ! 469: ## format a single reference ! 470: ## ! 471: func printref(b) { ! 472: if (reftype[b] == "book") book(b) ! 473: else if (reftype[b] == "article") article(b) ! 474: else if (reftype[b] == "review") review(b); ! 475: else if (reftype[b] == "incollection") incollection(b) ! 476: else if (reftype[b] == "inproceedings") inproceedings(b) ! 477: else if (reftype[b] == "techreport") techreport(b) ! 478: else if (reftype[b] == "phdthesis") thesis(b) ! 479: else if (reftype[b] == "mastersthesis") thesis(b) ! 480: else if (reftype[b] == "editedbook") editedbook(b) ! 481: else if (reftype[b] == "misc") default(b) ! 482: else if (reftype[b] == "pamphlet") pamphlet(b) ! 483: else if (reftype[b] == "manual") manual(b) ! 484: else if (reftype[b] == "proceedings") proceedings(b) ! 485: else if (reftype[b] == "tm") tm(b) ! 486: else if (reftype[b] == "unpublished") default(b) ! 487: else { ! 488: print "Unknown reference type " reftype[b] " for " Afull[b,1] " ... " title[b] ", " date[b] | "cat >&2"; ! 489: default(b); ! 490: } ! 491: if (other[b]) { ! 492: printf ".\n" other[b]; ! 493: if(substr(other[b],length(other[b]),1) != ".") ! 494: printf "."; ! 495: } ! 496: else printf "."; ! 497: if(also[b]) { ! 498: aprint++; ! 499: print ""; ! 500: for(ia=1; ia <= also[b]; ia++) { ! 501: prea = pre_also[b " " ia] ! 502: if(prea) { ! 503: printf prea; ! 504: if(bracket(prea) == 0) ! 505: printf " "; ! 506: } ! 507: else printf "Also " ; ! 508: printref(b " " ia); ! 509: posta = post_also[b " " ia] ! 510: if(posta) { ! 511: if(bracket(posta) == 0) ! 512: printf " "; ! 513: print posta; ! 514: } ! 515: else print ""; ! 516: } ! 517: aprint--; ! 518: } ! 519: else if(aprint == 0) print ""; ! 520: } ! 521: ! 522: func bracket(string) ! 523: { ! 524: brack = substr(string,length(string)); ! 525: if(brack ~ /[<>\(\){}\[\]]/) ! 526: return 1; ! 527: return 0; ! 528: } ! 529: ! 530: ## ! 531: ## fixverbatim ! 532: ## handle strings with %verbatim around them ! 533: ## ! 534: func fixverbatim() ! 535: { ! 536: vb = 0; ! 537: while(match($0,verbatim)) { ! 538: vb++; ! 539: beg=substr($0,1,RSTART-1); ! 540: mid=substr($0,RSTART,RLENGTH); ! 541: end=substr($0,RSTART+RLENGTH,length($0)-(RLENGTH+RSTART-1)); ! 542: gsub("%verbatim[ ]*","",mid); ! 543: mid=substr(mid,2,length(mid)-2); ! 544: gsub(" ","\\\\&",mid); ! 545: $0 = beg mid end; ! 546: } ! 547: return vb; ! 548: } ! 549: ! 550: ! 551: ! 552: ## ! 553: ## fixname ! 554: ## parse namestring from %author and %editor into ! 555: ## Given Last Title and Post ! 556: ## e.g., Given = Fred P., Last = Smith, Title = Mr., Post = Jr. ! 557: ## ! 558: func fixname() { ! 559: verbflag = fixverbatim() ! 560: Given = ""; ! 561: Last = ""; ! 562: Title = ""; ! 563: Post = ""; ! 564: if(postfix[$NF]) { #....Jr. ! 565: Post = $NF; ! 566: NF--; ! 567: if(substr($NF,length($NF),1) == ",") { ! 568: $NF = substr($NF,1,length($NF)-1); ! 569: } ! 570: } ! 571: for(i=2; i<=NF; i++) { # look for field ending with "," ! 572: if(substr($i,length($i),1) == ",") { ! 573: $i = substr($i,1,length($i)-1); ! 574: break; ! 575: } ! 576: } ! 577: if (i < NF) { # Last, Given... ! 578: for(k=2; k<i; k++) { ! 579: Last = Last $k " "; ! 580: } ! 581: Last = Last $i; ! 582: j=i+1; ! 583: if(titles[$j]) { ! 584: Title = $j; ! 585: j++; ! 586: } ! 587: for(; j<NF; j++) { ! 588: Given = Given $j " "; ! 589: } ! 590: Given = Given $NF; ! 591: } ! 592: else { # Given....Last ! 593: if(NF > 1) Last = $NF; ! 594: for(i=NF-1 ;i>1; i--) { ! 595: if(prefix[$i]) Last = $i " " Last; ! 596: else break; ! 597: } ! 598: j = 2; ! 599: if (titles[$j]) { ! 600: Title = $2; ! 601: j++; ! 602: } ! 603: if(j <= i) { ! 604: for(; j<i; j++) { ! 605: Given = Given $j " "; ! 606: } ! 607: Given = Given $i; ! 608: } ! 609: } ! 610: if(verbflag) { ! 611: gsub("\\\\&"," ",Last); ! 612: gsub("\\\\&"," ",Title); ! 613: gsub("\\\\&"," ",Post); ! 614: } ! 615: } ! 616: ! 617: ! 618: ## ! 619: ## initial - return initial of name string ! 620: ## ! 621: func initial(string) { ! 622: return(substr(string,1,1) ".") ! 623: } ! 624: ! 625: ! 626: ## ! 627: ## LastFM - Organize Name: Last, F.M., e.g. Smith, F.P. Jr. ! 628: ## ! 629: func LastFM() { ! 630: Name = ""; ! 631: punc = ""; ! 632: if(Last) { ! 633: Name = Name Last; ! 634: punc = ", "; ! 635: } ! 636: if(Given) { ! 637: if(Given ~ /\\\&/) { ! 638: gsub("\\\\&"," ",Given); ! 639: Name = Name punc Given; ! 640: } ! 641: else { ! 642: ng = split(Given,G); ! 643: Name = Name punc initial(G[1]); ! 644: for(i = 2; i <= ng; i++) ! 645: Name = Name initial(G[i]); ! 646: } ! 647: } ! 648: punc = " "; ! 649: if(Post) { ! 650: Name = Name punc Post; ! 651: } ! 652: return(Name); ! 653: ! 654: } ! 655: ! 656: ! 657: ## ! 658: ## FMLast - Organize Name: F.M. Last, e.g., F.P. Smith Jr. ! 659: ## ! 660: func FMLast() { ! 661: Name = ""; ! 662: punc = ""; ! 663: if(Given) { ! 664: if(Given ~ /\\\&/) { ! 665: gsub("\\\\&"," ",Given); ! 666: Name = Name punc Given; ! 667: } ! 668: else { ! 669: ng = split(Given,G); ! 670: Name = Name initial(G[1]); ! 671: for(i = 2; i <= ng; i++) ! 672: Name = Name initial(G[i]); ! 673: } ! 674: punc = " "; ! 675: } ! 676: if(Last) { ! 677: Name = Name punc Last; ! 678: punc = " "; ! 679: } ! 680: if(Post) { ! 681: Name = Name punc Post; ! 682: } ! 683: ! 684: return(Name); ! 685: } ! 686: ! 687: ## ! 688: ## F_M_Last - Organize Name: F.M. Last, e.g., F.P. Smith Jr. ! 689: ## ! 690: func F_M_Last() { ! 691: Name = ""; ! 692: punc = ""; ! 693: if(Given) { ! 694: if(Given ~ /\\\&/) { ! 695: gsub("\\\\&"," ",Given); ! 696: Name = Name punc Given; ! 697: } ! 698: else { ! 699: ng = split(Given,G); ! 700: Name = Name initial(G[1]); ! 701: for(i = 2; i <= ng; i++) { ! 702: Name = punc Name initial(G[i]); ! 703: punc = " "; ! 704: } ! 705: } ! 706: punc = " "; ! 707: } ! 708: if(Last) { ! 709: Name = Name punc Last; ! 710: punc = " "; ! 711: } ! 712: if(Post) { ! 713: Name = Name punc Post; ! 714: } ! 715: ! 716: return(Name); ! 717: } ! 718: ! 719: ## ! 720: ## LastF_M - Organize Name: Last, F. M., e.g. Smith F. P. Jr. ! 721: ## ! 722: func LastF_M() { ! 723: Name = ""; ! 724: punc = ""; ! 725: if(Last) { ! 726: Name = Name Last; ! 727: punc = ", "; ! 728: } ! 729: if(Given) { ! 730: if(Given ~ /\\\&/) { ! 731: gsub("\\\\&"," ",Given); ! 732: Name = Name punc Given; ! 733: } ! 734: else { ! 735: ng = split(Given,G); ! 736: Name = Name punc initial(G[1]); ! 737: for(i = 2; i <= ng; i++) ! 738: Name = Name " " initial(G[i]); ! 739: } ! 740: } ! 741: punc = " "; ! 742: if(Post) { ! 743: Name = Name punc Post; ! 744: } ! 745: return(Name); ! 746: } ! 747: ! 748: ## ! 749: ## FMLast - Organize Name: F. M. Last, e.g., F. P. Smith Jr. ! 750: ## ! 751: func F_MLast() { ! 752: Name = ""; ! 753: punc = ""; ! 754: if(Given) { ! 755: if(Given ~ /\\\&/) { ! 756: gsub("\\\\&"," ",Given); ! 757: Name = Name punc Given; ! 758: } ! 759: else { ! 760: ng = split(Given,G); ! 761: Name = Name initial(G[1]); ! 762: for(i = 2; i <= ng; i++) ! 763: Name = Name " " initial(G[i]); ! 764: } ! 765: punc = " "; ! 766: } ! 767: if(Last) { ! 768: Name = Name punc Last; ! 769: punc = " "; ! 770: } ! 771: if(Post) { ! 772: Name = Name punc Post; ! 773: } ! 774: return(Name); ! 775: } ! 776: ! 777: ! 778: ## ! 779: ## FirstMiddleLast - Organize Name: First Middle Last e.g., Fred Peter Smith Jr. ! 780: ## ! 781: func FirstMiddleLast() ! 782: { ! 783: Name = ""; ! 784: punc = ""; ! 785: if(Given) { ! 786: if(Given ~ /\\\&/) { ! 787: gsub("\\\\&"," ",Given); ! 788: } ! 789: Name = Name Given; ! 790: punc = " "; ! 791: } ! 792: if(Last) { ! 793: Name = Name punc Last; ! 794: punc = " "; ! 795: } ! 796: if(Post) { ! 797: Name = Name punc Post; ! 798: } ! 799: return(Name); ! 800: } ! 801: ! 802: ## ! 803: ## LastFirstMiddle - Organize Name: Last, First Middle Last e.g., Smith, Fred Peter, Jr. ! 804: ## ! 805: func LastFirstMiddle() ! 806: { ! 807: Name = ""; ! 808: punc = ""; ! 809: if(Last) { ! 810: Name = Name Last; ! 811: punc = ", "; ! 812: } ! 813: if(Given) { ! 814: if(Given ~ /\\\&/) { ! 815: gsub("\\\\&"," ",Given); ! 816: } ! 817: Name = Name punc Given; ! 818: punc = ", "; ! 819: } ! 820: if(Post) { ! 821: Name = Name punc Post; ! 822: } ! 823: return(Name); ! 824: } ! 825: ! 826: ! 827: ! 828: ## ! 829: ## getrest - get rest of $0 after lopping off $1. ! 830: ## ! 831: func getrest() ! 832: { ! 833: rest = substr($0,length($1)+2); ! 834: return(substr(rest,index(rest,$2))); # strip off blanks ! 835: } ! 836: ### ! 837: ### ieee reference formatting style ! 838: ### ! 839: ! 840: BEGIN { ! 841: PASS = ""; # only one pass thru document ! 842: sortflag = 0; # reference_placement bibliography is not sorted ! 843: STYLE = ieee; ! 844: SKEY = "adt"; ! 845: } ! 846: ! 847: ####################################################### ! 848: # ! 849: # Functions required by general awk script ! 850: # ! 851: ####################################################### ! 852: ! 853: ## ! 854: ## Set author and editor fields ! 855: ## for reference ! 856: ## for possible sorting ! 857: ! 858: func setauthor(b,a) { ! 859: Afull[b,a] = F_MLast(); ! 860: Asort[b] = Asort[b] LastFM()" "; ! 861: } ! 862: ! 863: ! 864: func seteditor(b,a) { ! 865: E[b,a] = F_MLast(); ! 866: Esort[b] = Esort[b] LastFM() " "; ! 867: } ! 868: ! 869: ## ! 870: ## citations ! 871: ## print a citation list ! 872: ## troff superscripted numbers ! 873: ## nroff numbers in square brackets ! 874: ## ! 875: func citations(tpunc) { ! 876: ! 877: seq = "no"; ! 878: sep = ""; ! 879: ! 880: # troff citation ! 881: ! 882: if(nroff == 0) { ! 883: tcite = ""; ! 884: begin_super = "\\^\\s-2\\v'-0.4m'\\f1\\&"; ! 885: end_super = "\\fP\\v'0.4m'\\s+2" ! 886: if(quote(tpunc) || period(tpunc)) ! 887: end_super = end_super "\\ "; ! 888: ! 889: # format the list of citations, putting in commas and hypens ! 890: ! 891: for(i=1; i<=cites; i++) { ! 892: seq = sequence(i,cites); ! 893: if (seq == "in") continue; ! 894: if (seq == "end") { ! 895: sep = "-"; ! 896: seq = "no"; ! 897: } ! 898: tcite = tcite sep makemark(i); ! 899: sep = ",\\ "; ! 900: } ! 901: printf "%s%s%s%s", tpunc, begin_super, tcite, end_super; ! 902: } ! 903: ! 904: # nroff citation ! 905: ! 906: else { ! 907: ncite = "\n"; ! 908: if(quote(tpunc)) { ! 909: ncite = tpunc " "; ! 910: tpunc = "\\ "; ! 911: } ! 912: else if(tpunc == "(") { ! 913: ncite = tpunc; ! 914: tpunc = ""; ! 915: } ! 916: ! 917: # format the list of citations, putting in commas and hypens ! 918: ! 919: for(i=1; i<=cites; i++) { ! 920: seq = sequence(i,cites); ! 921: if (seq == "in") continue; ! 922: if (seq == "end") { ! 923: sep = "-"; ! 924: seq = "no"; ! 925: } ! 926: ncite = ncite sep "[" makemark(i) "]"; ! 927: sep = ", "; ! 928: } ! 929: printf "%s%s", ncite, tpunc; ! 930: } ! 931: } ! 932: ! 933: func quote(punc) { ! 934: if(tpunc == "\"" || tpunc == "'") return 1; ! 935: return 0; ! 936: } ! 937: ! 938: func period(punc) { ! 939: if (tpunc == "." || tpunc == "!" || tpunc == "?") return 1; ! 940: return 0; ! 941: } ! 942: ! 943: ! 944: ## ! 945: ## makemark ! 946: ## return citation mark: identical citations have the same number ! 947: ## ! 948: func makemark(m) { ! 949: return(uniqno[bibptr[m]]); ! 950: } ! 951: ! 952: ! 953: ## ! 954: ## bibindex ! 955: ## print citation mark for the bibliography; ! 956: ## return an index for accessing rest of citation ! 957: ## ! 958: func bibindex(b) { ! 959: printf ".sp .5\n.ti -\\w'" b ".\\ \\ \\ 'u\n"; ! 960: printf b ".\\ \\ \\ " ; ! 961: if (sortflag) return sortorder[b]; ! 962: else return b; ! 963: } ! 964: ! 965: ! 966: ############################################# ! 967: # ! 968: # Reference types ! 969: # ! 970: ############################################ ! 971: ! 972: ! 973: func book(b) { ! 974: punc = ""; ! 975: # authorlist, ! 976: if(authors[b]) { ! 977: authorlist(b); ! 978: punc = ",\n"; ! 979: } ! 980: # italic(title), ! 981: if(title[b]) { ! 982: printf "%s\\f2\\&%s\\f1\\&", punc, title[b]; ! 983: punc = ",\n"; ! 984: # Vol. #, ! 985: if(volstr[b]) ! 986: printf "%s%s", punc, volstr[b]; ! 987: else if(volume[b]) ! 988: printf "%sVol. %s", punc, volume[b]; ! 989: } ! 990: # publisher, ! 991: printf "%s%s", punc, issuer[b] ; ! 992: punc = ",\n"; ! 993: # location, ! 994: if (city[b]) ! 995: printf "%s%s", punc, city[b] ; ! 996: # date, ! 997: printf "%s%s", punc, date[b] ; ! 998: # pages ! 999: if ( pages[b]) { ! 1000: if ( pages[b] ~ /[,-]/ ) ! 1001: printf "%spp. %s", punc, pages[b]; ! 1002: else printf "%sp. %s", punc, pages[b]; ! 1003: } ! 1004: } ! 1005: ! 1006: ! 1007: func editedbook(b) { ! 1008: ! 1009: punc = ""; ! 1010: # authorlist, Ed., ! 1011: if(authors[b]) { ! 1012: authorlist(b); ! 1013: if(authors[b] <2) ! 1014: printf ", Ed."; ! 1015: else ! 1016: printf ", Eds."; ! 1017: punc = ",\n"; ! 1018: } ! 1019: # italic(title), ! 1020: if(title[b]) { ! 1021: printf "%s\\f2\\&%s\\f1\\&", punc, title[b]; ! 1022: punc = ",\n"; ! 1023: # Vol. #, ! 1024: if(volstr[b]) ! 1025: printf "%s%s", punc, volstr[b]; ! 1026: else if(volume[b]) ! 1027: printf "%sVol. %s", punc, volume[b]; ! 1028: } ! 1029: # publisher, ! 1030: printf "%s%s", punc, issuer[b] ; ! 1031: punc = ",\n"; ! 1032: # location, ! 1033: if (city[b]) ! 1034: printf "%s%s", punc, city[b] ; ! 1035: # date, ! 1036: printf "%s%s", punc, date[b] ; ! 1037: # pages ! 1038: if ( pages[b]) { ! 1039: if ( pages[b] ~ /[,-]/ ) ! 1040: printf "%spp. %s", punc, pages[b]; ! 1041: else printf "%sp. %s", punc, pages[b]; ! 1042: } ! 1043: } ! 1044: ! 1045: func thesis(b) { ! 1046: punc = ""; ! 1047: # authorlist, ! 1048: if(authors[b]) { ! 1049: authorlist(b); ! 1050: punc = ",\n"; ! 1051: } ! 1052: # italic(title), ! 1053: if(title[b]) { ! 1054: printf "%s\\f2\\&%s\\f1\\&", punc, title[b]; ! 1055: punc = ",\n"; ! 1056: } ! 1057: # thesis, ! 1058: printf punc; ! 1059: if(reftype[b] == "phdthesis") ! 1060: printf "PhD Thesis"; ! 1061: else ! 1062: printf "Master's Thesis"; ! 1063: punc = ",\n"; ! 1064: # report number, ! 1065: if(report[b]) ! 1066: printf "%s%s", punc, report[b]; ! 1067: # school, ! 1068: printf "%s%s", punc, issuer[b]; ! 1069: # date ! 1070: printf "%s%s", punc, date[b] ; ! 1071: } ! 1072: ! 1073: func review(b) { ! 1074: article(b); ! 1075: } ! 1076: ! 1077: ! 1078: func article(b) { ! 1079: ! 1080: punc = ""; ! 1081: # authorlist, ! 1082: if(authors[b]) { ! 1083: authorlist(b); ! 1084: punc = ",\n"; ! 1085: } ! 1086: # ``Title,'' ! 1087: if(title[b]) { ! 1088: if(nroff) ! 1089: printf "%s\"%s,\"", punc, title[b] ; ! 1090: else ! 1091: printf "%s``%s,''", punc, title[b] ; ! 1092: punc = "\n"; ! 1093: } ! 1094: # Reviewed title and author ! 1095: if(booktitle[b]) { ! 1096: printf "%sReview of \\f2\\&%s\\f1\\&", punc, booktitle[b]; ! 1097: if(editors[b]) { ! 1098: printf " by "; ! 1099: editorlist(b); ! 1100: } ! 1101: if (issuer[b]) { ! 1102: printf " %s", issuer[b]; ! 1103: } ! 1104: printf ",\n"; ! 1105: } ! 1106: # italics(journal), ! 1107: printf "\\f2\\&%s\\f1\\&", journal[b]; ! 1108: punc = ",\n"; ! 1109: # vol. #, no. #, Pt. # ! 1110: if (volstr[b]) ! 1111: printf "%s%s", punc, volstr[b] ; ! 1112: else if (volume[b]) ! 1113: printf "%sVol. %s", punc, volume[b] ; ! 1114: if(numstr[b]) ! 1115: printf "%s%s", punc, numstr[b]; ! 1116: else if (number[b]) ! 1117: printf "%sNo. %s", punc, number[b] ; ! 1118: if(partstr[b]) ! 1119: printf "%s%s", punc, partstr[b]; ! 1120: else if (part[b]) ! 1121: printf "%sPt. %s", punc, part[b] ; ! 1122: # date, ! 1123: printf "%s%s", punc, date[b]; ! 1124: # pages ! 1125: if ( pages[b]) { ! 1126: if ( pages[b] ~ /[,-]/ ) ! 1127: printf "%spp. %s", punc, pages[b]; ! 1128: else printf "%sp. %s", punc,pages[b]; ! 1129: } ! 1130: } ! 1131: ! 1132: ! 1133: ! 1134: func incollection(b) { ! 1135: ! 1136: punc = ""; ! 1137: # authorlist, ! 1138: if(authors[b]) { ! 1139: authorlist(b); ! 1140: punc = ",\n"; ! 1141: } ! 1142: # ``Title,'' ! 1143: if(title[b]) { ! 1144: if(nroff) ! 1145: printf "%s\"%s,\"\n", punc, title[b] ; ! 1146: else ! 1147: printf "%s``%s,''\n", punc, title[b] ; ! 1148: } ! 1149: # in italics(booktitle), ! 1150: printf "in \\f2\\&%s\\f1\\&", booktitle[b]; ! 1151: punc = ",\n"; ! 1152: # Vol. #, ! 1153: if(volstr[b]) ! 1154: printf "%s%s", punc, volstr[b]; ! 1155: else if(volume[b]) ! 1156: printf "%sVol. %s", punc, volume[b]; ! 1157: # editorlist, eds., ! 1158: if(editors[b]) { ! 1159: printf punc; ! 1160: editorlist(b); ! 1161: if (editors[b] == 1) printf ", Ed." ! 1162: else if (editors[b] > 1) printf ", Eds." ! 1163: } ! 1164: # publisher, location, ! 1165: printf "%s%s", punc, issuer[b] ! 1166: if (city[b]) ! 1167: printf ", %s", city[b] ; ! 1168: # date, ! 1169: printf "%s%s", punc, date[b]; ! 1170: # pages ! 1171: if ( pages[b]) { ! 1172: if ( pages[b] ~ /[,-]/ ) ! 1173: printf "%spp. %s", punc,pages[b]; ! 1174: else printf "%sp. %s", punc,pages[b]; ! 1175: } ! 1176: } ! 1177: ! 1178: ! 1179: func inproceedings(b) { ! 1180: ! 1181: punc = ""; ! 1182: # authorlist, ! 1183: if(authors[b]) { ! 1184: authorlist(b); ! 1185: punc = ",\n"; ! 1186: } ! 1187: # ``Title,'' ! 1188: if(title[b]) { ! 1189: if(nroff) ! 1190: printf "%s\"%s,\"\n", punc, title[b] ; ! 1191: else ! 1192: printf "%s``%s,''\n", punc, title[b] ; ! 1193: } ! 1194: # italics(journal), ! 1195: printf "\\f2\\&%s\\f1\\&", journal[b]; ! 1196: punc = ",\n"; ! 1197: # vol. #, no. #, ! 1198: if (volstr[b]) ! 1199: printf "%s%s", punc, volstr[b] ; ! 1200: else if (volume[b]) ! 1201: printf "%sVol. %s", punc, volume[b] ; ! 1202: if(numstr[b]) ! 1203: printf "%s%s", punc, numstr[b]; ! 1204: else if (number[b]) ! 1205: printf "%sNo. %s", punc, number[b] ; ! 1206: if(partstr[b]) ! 1207: printf "%s%s", punc, partstr[b]; ! 1208: else if (part[b]) ! 1209: printf "%sPt. %s", punc, part[b] ; ! 1210: # editorlist, eds., ! 1211: if(editors[b]) { ! 1212: printf punc; ! 1213: editorlist(b); ! 1214: if (editors[b] == 1) printf ", Ed." ! 1215: else if (editors[b] > 1) printf ", Eds." ! 1216: } ! 1217: # publisher, ! 1218: if(issuer[b]) ! 1219: if(authors[b] || editors[b]) ! 1220: printf "%s%s", punc, issuer[b]; ! 1221: # date, ! 1222: printf "%s%s", punc, date[b]; ! 1223: # pages ! 1224: if ( pages[b]) { ! 1225: if ( pages[b] ~ /[,-]/ ) ! 1226: printf "%spp. %s", punc, pages[b]; ! 1227: else printf "%sp. %s", punc, pages[b]; ! 1228: } ! 1229: } ! 1230: ! 1231: func proceedings(b) { ! 1232: ! 1233: punc = ""; ! 1234: # authorlist, ! 1235: if(authors[b] >0) { ! 1236: authorlist(b); ! 1237: punc = ",\n"; ! 1238: } ! 1239: ! 1240: # editorlist Ed., ! 1241: else if(editors[b]) { ! 1242: printf punc; ! 1243: editorlist(b); ! 1244: if (editors[b] == 1) printf ", Ed." ! 1245: else if (editors[b] > 1) printf ", Eds." ! 1246: punc = ",\n"; ! 1247: } ! 1248: # publisher, ! 1249: else if(issuer[b]) { ! 1250: printf "%s%s", punc, issuer[b]; ! 1251: punc = ",\n"; ! 1252: } ! 1253: # italics(title), ! 1254: if(title[b]) { ! 1255: printf "%s\\f2\\&%s\\f1\\&", punc,title[b]; ! 1256: punc = ",\n"; ! 1257: } ! 1258: # vol. #, no. #, ! 1259: if (volstr[b]) ! 1260: printf "%s%s", punc, volstr[b] ; ! 1261: else if (volume[b]) ! 1262: printf "%sVol. %s", punc, volume[b] ; ! 1263: if(numstr[b]) ! 1264: printf "%s%s", punc, numstr[b]; ! 1265: else if (number[b]) ! 1266: printf "%sNo. %s", punc, number[b] ; ! 1267: if(partstr[b]) ! 1268: printf "%s%s", punc, partstr[b]; ! 1269: else if (part[b]) ! 1270: printf "%sPt. %s", punc, part[b] ; ! 1271: # publisher, ! 1272: if(issuer[b]) ! 1273: if(authors[b] || editors[b]) ! 1274: printf "%s%s", punc, issuer[b]; ! 1275: # location, ! 1276: if (city[b]) ! 1277: printf "%s%s", punc, city[b] ; ! 1278: # (date) ! 1279: if (date[b]) ! 1280: printf "%s(%s)", punc, date[b]; ! 1281: } ! 1282: ! 1283: ! 1284: func techreport(b) { ! 1285: ! 1286: punc = ""; ! 1287: # authorlist, ! 1288: if(authors[b]) { ! 1289: authorlist(b); ! 1290: punc = ",\n"; ! 1291: } ! 1292: # ``Title,'' ! 1293: if(title[b]) { ! 1294: if(nroff) ! 1295: printf "%s\"%s,\"\n", punc, title[b] ; ! 1296: else ! 1297: printf "%s``%s,''\n", punc, title[b] ; ! 1298: } ! 1299: # report, ! 1300: printf "%s", report[b]; ! 1301: punc = ",\n"; ! 1302: # publisher, ! 1303: if (issuer[b]) printf "%s%s", punc, issuer[b] ; ! 1304: # date ! 1305: printf "%s%s", punc, date[b] ; ! 1306: } ! 1307: ! 1308: ! 1309: func tm(b) { ! 1310: ! 1311: punc = ""; ! 1312: # authorlist, ! 1313: if(authors[b]) { ! 1314: authorlist(b); ! 1315: punc = ",\n"; ! 1316: } ! 1317: # italics(title), ! 1318: if(title[b]) { ! 1319: printf "%s\\f2\\&%s\\f1\\&", punc, title[b]; ! 1320: punc = ",\n"; ! 1321: } ! 1322: # tmno, ! 1323: printf punc; ! 1324: if(rp) ! 1325: printf "AT&T Bell Laboratories internal memorandum"; ! 1326: else ! 1327: printf "%s", tmno[b]; ! 1328: punc = ",\n"; ! 1329: # date ! 1330: printf "%s%s", punc, date[b] ; ! 1331: } ! 1332: ! 1333: ! 1334: func manual(b) { ! 1335: punc = ""; ! 1336: # authorlist, ! 1337: if(authors[b] >0) { ! 1338: authorlist(b); ! 1339: punc = ",\n"; ! 1340: } ! 1341: # editorlist ed., ! 1342: else if(editors[b]) { ! 1343: printf punc; ! 1344: editorlist(b); ! 1345: if (editors[b] == 1) printf ", Ed." ! 1346: else if (editors[b] > 1) printf ", Eds." ! 1347: punc = ",\n" ! 1348: } ! 1349: # publisher, ! 1350: else if(issuer[b]) { ! 1351: printf "%s%s", punc, issuer[b]; ! 1352: punc = ",\n"; ! 1353: } ! 1354: # italic(title), ! 1355: if(title[b]) { ! 1356: printf "%s\\f2\\&%s\\f1\\&", punc, title[b]; ! 1357: punc = ",\n"; ! 1358: } ! 1359: # Vol. volume, ! 1360: if(volstr[b]) ! 1361: printf "%s%s", punc, volstr[b]; ! 1362: else if(volume[b]) ! 1363: printf "%sVol. %s", punc, volume[b]; ! 1364: # publisher, ! 1365: if(issuer[b]) ! 1366: if(authors[b] || editors[b]) { ! 1367: printf "%s%s", punc, issuer[b]; ! 1368: punc = ",\n"; ! 1369: } ! 1370: # location ! 1371: if (city[b]) ! 1372: printf "%s%s", punc, city[b] ; ! 1373: # date, ! 1374: printf "%s%s", punc, date[b]; ! 1375: # pages ! 1376: if (pages[b]) { ! 1377: if ( pages[b] ~ /[,-]/ ) ! 1378: printf "%spp. %s", punc, pages[b]; ! 1379: else ! 1380: printf "%sp. %s", punc, pages[b]; ! 1381: } ! 1382: } ! 1383: ! 1384: func pamphlet(b) ! 1385: { ! 1386: ! 1387: punc = ""; ! 1388: # authorlist, ! 1389: if(authors[b] >0) { ! 1390: authorlist(b); ! 1391: punc = ",\n"; ! 1392: } ! 1393: ! 1394: # publisher, ! 1395: else if(issuer[b]) { ! 1396: printf "%s%s", punc, issuer[b]; ! 1397: punc = ",\n"; ! 1398: } ! 1399: # ``Title,'' ! 1400: if(title[b]) { ! 1401: if(nroff) { ! 1402: printf "%s\"%s", punc, title[b] ; ! 1403: punc = ",\"\n"; ! 1404: } ! 1405: else { ! 1406: printf "%s``%s", punc, title[b] ; ! 1407: punc = ",''\n"; ! 1408: } ! 1409: } ! 1410: # publisher, ! 1411: if(issuer[b]) { ! 1412: if(authors[b] || editors[b]) { ! 1413: printf "%s%s", punc, issuer[b]; ! 1414: punc = ",\n"; ! 1415: } ! 1416: } ! 1417: # location, ! 1418: if (city[b]) { ! 1419: printf "%s%s", punc, city[b] ; ! 1420: punc = ",\n"; ! 1421: } ! 1422: # date ! 1423: if (date[b]) { ! 1424: printf "%s%s", punc, date[b]; ! 1425: punc = ",\n"; ! 1426: } ! 1427: } ! 1428: ! 1429: func default(b) { ! 1430: punc = ""; ! 1431: # authorlist, ! 1432: if(authors[b] >0) { ! 1433: authorlist(b); ! 1434: punc = ",\n"; ! 1435: } ! 1436: ! 1437: # publisher, ! 1438: else if(issuer[b]) { ! 1439: printf "%s%s", punc, issuer[b]; ! 1440: punc = ",\n"; ! 1441: } ! 1442: # Title, ! 1443: if(title[b]) { ! 1444: printf "%s\\f2\\&%s\\f1\\&", punc, title[b] ; ! 1445: punc = ",\n"; ! 1446: } ! 1447: # Vol. volume, ! 1448: if(volstr[b]) ! 1449: printf "%s%s", punc, volstr[b]; ! 1450: else if(volume[b]) ! 1451: printf "%sVol. %s", punc, volume[b]; ! 1452: # publisher, ! 1453: if(issuer[b]) { ! 1454: if(authors[b] || editors[b]) { ! 1455: printf "%s%s", punc, issuer[b]; ! 1456: punc = ",\n"; ! 1457: } ! 1458: } ! 1459: # location, ! 1460: if (city[b]) { ! 1461: printf "%s%s", punc, city[b] ; ! 1462: punc = ",\n"; ! 1463: } ! 1464: # date, ! 1465: if (date[b]) { ! 1466: printf "%s%s", punc, date[b]; ! 1467: punc = ",\n"; ! 1468: } ! 1469: # pages ! 1470: if (pages[b]) { ! 1471: if ( pages[b] ~ /[,-]/ ) ! 1472: printf "%spp. %s", punc, pages[b]; ! 1473: else ! 1474: printf "%sp. %s", punc, pages[b]; ! 1475: } ! 1476: } ! 1477: ! 1478: ! 1479: ## ! 1480: ## authorlist ! 1481: ## First ! 1482: ## First and Second ! 1483: ## First, Second,..., and Last ! 1484: ## ! 1485: func authorlist(b) { ! 1486: if ( authors[b] == 0 ) ; ! 1487: else if ( authors[b] == 1 ) { ! 1488: printf Afull[b,1] ; ! 1489: if(aetal[b]) printf ", et al."; ! 1490: } ! 1491: else if ( authors[b] == 2 ) printf Afull[b,1] " and " Afull[b,2]; ! 1492: else { ! 1493: for ( j = 1; j < authors[b]; j++ ) print Afull[b,j] ", "; ! 1494: printf "and " Afull[b,authors[b]]; ! 1495: } ! 1496: } ! 1497: ! 1498: ! 1499: ## ! 1500: ## editorlist ! 1501: ## First ! 1502: ## First and Second ! 1503: ## First, Second,..., and Last ! 1504: ## ! 1505: func editorlist(b) { ! 1506: if ( editors[b] == 0 ) ; ! 1507: else if ( editors[b] == 1 ) { ! 1508: printf E[b,1] ; ! 1509: if(eetal[b]) printf ", et al."; ! 1510: } ! 1511: else if ( editors[b] == 2 ) printf E[b,1] " and " E[b,2]; ! 1512: else { ! 1513: for ( j = 1; j < editors[b]; j++ ) print E[b,j] ", "; ! 1514: printf "and " E[b,editors[b]]; ! 1515: } ! 1516: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.