|
|
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: printf ".in \\w'" bibno ".\\ \\ \\ 'u\n" ! 460: for(i = 1; i <= bibno; i++) { ! 461: print ".KS"; ! 462: b = bibindex(i); ! 463: printref(b); ! 464: print ".KE"; ! 465: } ! 466: print ".in 0" ! 467: print ".nr RF " bibno; ! 468: } ! 469: ! 470: ## ! 471: ## format a single reference ! 472: ## ! 473: func printref(b) { ! 474: if (reftype[b] == "book") book(b) ! 475: else if (reftype[b] == "article") article(b) ! 476: else if (reftype[b] == "review") review(b); ! 477: else if (reftype[b] == "incollection") incollection(b) ! 478: else if (reftype[b] == "inproceedings") inproceedings(b) ! 479: else if (reftype[b] == "techreport") techreport(b) ! 480: else if (reftype[b] == "phdthesis") thesis(b) ! 481: else if (reftype[b] == "mastersthesis") thesis(b) ! 482: else if (reftype[b] == "editedbook") editedbook(b) ! 483: else if (reftype[b] == "misc") default(b) ! 484: else if (reftype[b] == "pamphlet") pamphlet(b) ! 485: else if (reftype[b] == "manual") manual(b) ! 486: else if (reftype[b] == "proceedings") proceedings(b) ! 487: else if (reftype[b] == "tm") tm(b) ! 488: else if (reftype[b] == "unpublished") default(b) ! 489: else { ! 490: print "Unknown reference type " reftype[b] " for " Afull[b,1] " ... " title[b] ", " date[b] | "cat >&2"; ! 491: default(b); ! 492: } ! 493: if (other[b]) { ! 494: printf ".\n" other[b]; ! 495: if(substr(other[b],length(other[b]),1) != ".") ! 496: printf "."; ! 497: } ! 498: else printf "."; ! 499: if(also[b]) { ! 500: aprint++; ! 501: print ""; ! 502: for(ia=1; ia <= also[b]; ia++) { ! 503: prea = pre_also[b " " ia] ! 504: if(prea) { ! 505: printf prea; ! 506: if(bracket(prea) == 0) ! 507: printf " "; ! 508: } ! 509: else printf "Also " ; ! 510: printref(b " " ia); ! 511: posta = post_also[b " " ia] ! 512: if(posta) { ! 513: if(bracket(posta) == 0) ! 514: printf " "; ! 515: print posta; ! 516: } ! 517: else print ""; ! 518: } ! 519: aprint--; ! 520: } ! 521: else if(aprint == 0) print ""; ! 522: } ! 523: ! 524: func bracket(string) ! 525: { ! 526: brack = substr(string,length(string)); ! 527: if(brack ~ /[<>\(\){}\[\]]/) ! 528: return 1; ! 529: return 0; ! 530: } ! 531: ! 532: ## ! 533: ## fixverbatim ! 534: ## handle strings with %verbatim around them ! 535: ## ! 536: func fixverbatim() ! 537: { ! 538: vb = 0; ! 539: while(match($0,verbatim)) { ! 540: vb++; ! 541: beg=substr($0,1,RSTART-1); ! 542: mid=substr($0,RSTART,RLENGTH); ! 543: end=substr($0,RSTART+RLENGTH,length($0)-(RLENGTH+RSTART-1)); ! 544: gsub("%verbatim[ ]*","",mid); ! 545: mid=substr(mid,2,length(mid)-2); ! 546: gsub(" ","\\\\&",mid); ! 547: $0 = beg mid end; ! 548: } ! 549: return vb; ! 550: } ! 551: ! 552: ! 553: ! 554: ## ! 555: ## fixname ! 556: ## parse namestring from %author and %editor into ! 557: ## Given Last Title and Post ! 558: ## e.g., Given = Fred P., Last = Smith, Title = Mr., Post = Jr. ! 559: ## ! 560: func fixname() { ! 561: verbflag = fixverbatim() ! 562: Given = ""; ! 563: Last = ""; ! 564: Title = ""; ! 565: Post = ""; ! 566: if(postfix[$NF]) { #....Jr. ! 567: Post = $NF; ! 568: NF--; ! 569: if(substr($NF,length($NF),1) == ",") { ! 570: $NF = substr($NF,1,length($NF)-1); ! 571: } ! 572: } ! 573: for(i=2; i<=NF; i++) { # look for field ending with "," ! 574: if(substr($i,length($i),1) == ",") { ! 575: $i = substr($i,1,length($i)-1); ! 576: break; ! 577: } ! 578: } ! 579: if (i < NF) { # Last, Given... ! 580: for(k=2; k<i; k++) { ! 581: Last = Last $k " "; ! 582: } ! 583: Last = Last $i; ! 584: j=i+1; ! 585: if(titles[$j]) { ! 586: Title = $j; ! 587: j++; ! 588: } ! 589: for(; j<NF; j++) { ! 590: Given = Given $j " "; ! 591: } ! 592: Given = Given $NF; ! 593: } ! 594: else { # Given....Last ! 595: if(NF > 1) Last = $NF; ! 596: for(i=NF-1 ;i>1; i--) { ! 597: if(prefix[$i]) Last = $i " " Last; ! 598: else break; ! 599: } ! 600: j = 2; ! 601: if (titles[$j]) { ! 602: Title = $2; ! 603: j++; ! 604: } ! 605: if(j <= i) { ! 606: for(; j<i; j++) { ! 607: Given = Given $j " "; ! 608: } ! 609: Given = Given $i; ! 610: } ! 611: } ! 612: if(verbflag) { ! 613: gsub("\\\\&"," ",Last); ! 614: gsub("\\\\&"," ",Title); ! 615: gsub("\\\\&"," ",Post); ! 616: } ! 617: } ! 618: ! 619: ! 620: ## ! 621: ## initial - return initial of name string ! 622: ## ! 623: func initial(string) { ! 624: return(substr(string,1,1) ".") ! 625: } ! 626: ! 627: ! 628: ## ! 629: ## LastFM - Organize Name: Last, F.M., e.g. Smith, F.P. Jr. ! 630: ## ! 631: func LastFM() { ! 632: Name = ""; ! 633: punc = ""; ! 634: if(Last) { ! 635: Name = Name Last; ! 636: punc = ", "; ! 637: } ! 638: if(Given) { ! 639: if(Given ~ /\\\&/) { ! 640: gsub("\\\\&"," ",Given); ! 641: Name = Name punc Given; ! 642: } ! 643: else { ! 644: ng = split(Given,G); ! 645: for(i = 1; i <= ng; i++) { ! 646: Name = Name punc initial(G[i]); ! 647: punc = ""; ! 648: } ! 649: } ! 650: punc = " "; ! 651: } ! 652: if(Post) { ! 653: Name = Name punc Post; ! 654: } ! 655: return(Name); ! 656: ! 657: } ! 658: ! 659: ! 660: ## ! 661: ## FMLast - Organize Name: F.M. Last, e.g., F.P. Smith Jr. ! 662: ## ! 663: func FMLast() { ! 664: Name = ""; ! 665: punc = ""; ! 666: if(Given) { ! 667: if(Given ~ /\\\&/) { ! 668: gsub("\\\\&"," ",Given); ! 669: Name = Name punc Given; ! 670: } ! 671: else { ! 672: ng = split(Given,G); ! 673: for(i = 1; i <= ng; i++) { ! 674: Name = Name punc initial(G[i]); ! 675: punc = ""; ! 676: } ! 677: } ! 678: punc = " "; ! 679: } ! 680: if(Last) { ! 681: Name = Name punc Last; ! 682: punc = " "; ! 683: } ! 684: if(Post) { ! 685: Name = Name punc Post; ! 686: } ! 687: ! 688: return(Name); ! 689: } ! 690: ! 691: ## ! 692: ## F_M_Last - Organize Name: F. M. Last, e.g., F. P. Smith Jr. ! 693: ## ! 694: func F_M_Last() { ! 695: Name = ""; ! 696: punc = ""; ! 697: if(Given) { ! 698: if(Given ~ /\\\&/) { ! 699: gsub("\\\\&"," ",Given); ! 700: Name = Name punc Given; ! 701: } ! 702: else { ! 703: ng = split(Given,G); ! 704: for(i = 1; i <= ng; i++) { ! 705: Name = Name punc initial(G[i]); ! 706: punc = " "; ! 707: } ! 708: } ! 709: punc = " "; ! 710: } ! 711: if(Last) { ! 712: Name = Name punc Last; ! 713: punc = " "; ! 714: } ! 715: if(Post) { ! 716: Name = Name punc Post; ! 717: } ! 718: ! 719: return(Name); ! 720: } ! 721: ! 722: ## ! 723: ## LastF_M - Organize Name: Last, F. M., e.g. Smith F. P. Jr. ! 724: ## ! 725: func LastF_M() { ! 726: Name = ""; ! 727: punc = ""; ! 728: if(Last) { ! 729: Name = Name Last; ! 730: punc = ", "; ! 731: } ! 732: if(Given) { ! 733: if(Given ~ /\\\&/) { ! 734: gsub("\\\\&"," ",Given); ! 735: Name = Name punc Given; ! 736: } ! 737: else { ! 738: ng = split(Given,G); ! 739: for(i = 1; i <= ng; i++) { ! 740: Name = Name punc initial(G[i]); ! 741: punc = " "; ! 742: } ! 743: } ! 744: punc = " "; ! 745: } ! 746: if(Post) { ! 747: Name = Name punc Post; ! 748: } ! 749: return(Name); ! 750: } ! 751: ! 752: ## ! 753: ## F_MLast - Organize Name: F. M. Last, e.g., F. P. Smith Jr. ! 754: ## [same as F_M_Last. why both?] ! 755: ## ! 756: func F_MLast() { ! 757: Name = ""; ! 758: punc = ""; ! 759: if(Given) { ! 760: if(Given ~ /\\\&/) { ! 761: gsub("\\\\&"," ",Given); ! 762: Name = Name punc Given; ! 763: } ! 764: else { ! 765: ng = split(Given,G); ! 766: for(i = 1; i <= ng; i++) { ! 767: Name = Name punc initial(G[i]); ! 768: punc = " "; ! 769: } ! 770: } ! 771: punc = " "; ! 772: } ! 773: if(Last) { ! 774: Name = Name punc Last; ! 775: punc = " "; ! 776: } ! 777: if(Post) { ! 778: Name = Name punc Post; ! 779: } ! 780: return(Name); ! 781: } ! 782: ! 783: ! 784: ## ! 785: ## FirstMiddleLast - Organize Name: First Middle Last e.g., Fred Peter Smith Jr. ! 786: ## ! 787: func FirstMiddleLast() ! 788: { ! 789: Name = ""; ! 790: punc = ""; ! 791: if(Given) { ! 792: if(Given ~ /\\\&/) { ! 793: gsub("\\\\&"," ",Given); ! 794: } ! 795: Name = Name Given; ! 796: punc = " "; ! 797: } ! 798: if(Last) { ! 799: Name = Name punc Last; ! 800: punc = " "; ! 801: } ! 802: if(Post) { ! 803: Name = Name punc Post; ! 804: } ! 805: return(Name); ! 806: } ! 807: ! 808: ## ! 809: ## LastFirstMiddle - Organize Name: Last, First Middle Last e.g., Smith, Fred Peter, Jr. ! 810: ## ! 811: func LastFirstMiddle() ! 812: { ! 813: Name = ""; ! 814: punc = ""; ! 815: if(Last) { ! 816: Name = Name Last; ! 817: punc = ", "; ! 818: } ! 819: if(Given) { ! 820: if(Given ~ /\\\&/) { ! 821: gsub("\\\\&"," ",Given); ! 822: } ! 823: Name = Name punc Given; ! 824: punc = ", "; ! 825: } ! 826: if(Post) { ! 827: Name = Name punc Post; ! 828: } ! 829: return(Name); ! 830: } ! 831: ! 832: ! 833: ! 834: ## ! 835: ## getrest - get rest of $0 after lopping off $1. ! 836: ## ! 837: func getrest() ! 838: { ! 839: rest = substr($0,length($1)+2); ! 840: return(substr(rest,index(rest,$2))); # strip off blanks ! 841: } ! 842: ### ! 843: ### att reference formatting style ! 844: ### ! 845: ! 846: BEGIN { ! 847: PASS = ""; # only one pass thru document ! 848: sortflag = 0; # reference_placement bibliography is not sorted ! 849: STYLE = "att"; ! 850: SKEY = "adt"; ! 851: } ! 852: ! 853: ! 854: ####################################################### ! 855: # ! 856: # Functions required by general awk script ! 857: # ! 858: ####################################################### ! 859: ! 860: ! 861: ## ! 862: ## Set author and editor fields ! 863: ## for reference ! 864: ## for possible sorting ! 865: ## ! 866: func setauthor(b,a) { ! 867: Afull[b,a] = F_MLast(); ! 868: Asort[b] = Asort[b] Afull[b,a] " "; ! 869: } ! 870: ! 871: ! 872: func seteditor(b,a) { ! 873: E[b,a] = F_MLast(); ! 874: Ename[b,a] = F_MLast(); ! 875: Esort[b] = Esort[b] E[b,a] " "; ! 876: } ! 877: ! 878: ! 879: ! 880: ## ! 881: ## citations ! 882: ## print a citation list ! 883: ## troff superscripted numbers ! 884: ## nroff numbers in square brackets ! 885: ## ! 886: func citations(tpunc) { ! 887: ! 888: seq = "no"; ! 889: sep = ""; ! 890: ! 891: # troff citation ! 892: ! 893: if(nroff == 0) { ! 894: tcite = ""; ! 895: begin_super = "\\^\\s-2\\v'-0.4m'\\f1\\&"; ! 896: end_super = "\\fP\\v'0.4m'\\s+2" ! 897: if(quote(tpunc) || period(tpunc)) ! 898: end_super = end_super "\\ "; ! 899: ! 900: # format the list of citations, putting in commas and hypens ! 901: ! 902: for(i=1; i<=cites; i++) { ! 903: seq = sequence(i,cites); ! 904: if (seq == "in") continue; ! 905: if (seq == "end") { ! 906: sep = "-"; ! 907: seq = "no"; ! 908: } ! 909: tcite = tcite sep makemark(i); ! 910: sep = ",\\ "; ! 911: } ! 912: printf "%s%s%s%s", tpunc, begin_super, tcite, end_super; ! 913: } ! 914: ! 915: # nroff citation ! 916: ! 917: else { ! 918: ncite = "\n"; ! 919: if(quote(tpunc)) { ! 920: ncite = tpunc " "; ! 921: tpunc = "\\ "; ! 922: } ! 923: else if(tpunc == "(") { ! 924: ncite = tpunc; ! 925: tpunc = ""; ! 926: } ! 927: ! 928: # format the list of citations, putting in commas and hypens ! 929: ! 930: for(i=1; i<=cites; i++) { ! 931: seq = sequence(i,cites); ! 932: if (seq == "in") continue; ! 933: if (seq == "end") { ! 934: sep = "-"; ! 935: seq = "no"; ! 936: } ! 937: ncite = ncite sep "[" makemark(i) "]"; ! 938: sep = ", "; ! 939: } ! 940: printf "%s%s", ncite, tpunc; ! 941: } ! 942: } ! 943: ! 944: func quote(punc) { ! 945: if(tpunc == "\"" || tpunc == "'") return 1; ! 946: return 0; ! 947: } ! 948: ! 949: func period(punc) { ! 950: if (tpunc == "." || tpunc == "!" || tpunc == "?") return 1; ! 951: return 0; ! 952: } ! 953: ! 954: ! 955: ## ! 956: ## makemark ! 957: ## return citation mark: identical citations have the same number ! 958: ## ! 959: func makemark(m) { ! 960: return(uniqno[bibptr[m]]); ! 961: } ! 962: ! 963: ! 964: ## ! 965: ## bibindex ! 966: ## print citation mark for the bibliography; ! 967: ## return an index for accessing rest of citation ! 968: ## ! 969: func bibindex(b) { ! 970: printf ".ti -\\w'" b ".\\ \\ \\ 'u\n" ! 971: printf b ".\\ \\ \\ " ! 972: if(sortflag) return sortorder[b] ! 973: else return b ! 974: } ! 975: ! 976: ! 977: ! 978: ############################################# ! 979: # ! 980: # Reference types ! 981: # ! 982: ############################################ ! 983: ! 984: ! 985: func book(b) { ! 986: punc = "" ! 987: # authorlist, ! 988: if(authors[b]) { ! 989: authorlist(b); ! 990: punc = ",\n"; ! 991: } ! 992: # italic(title), ! 993: if (title[b]) { ! 994: printf "%s\\f2\\&%s\\f1\\&", punc, title[b]; ! 995: punc = ",\n"; ! 996: } ! 997: # volume, ! 998: if(volstr[b]) { ! 999: printf "%s%s", punc, volstr[b]; ! 1000: punc = ",\n"; ! 1001: } ! 1002: else if(volume[b]) { ! 1003: printf "%sVol. %s", punc, volume[b]; ! 1004: punc = ",\n"; ! 1005: } ! 1006: # pages, ! 1007: if (pages[b]) { ! 1008: if ( pages[b] ~ /[,-]/ ) ! 1009: printf "%spp. %s", punc, pages[b]; ! 1010: else printf "%sp. %s", punc, pages[b]; ! 1011: punc = ",\n"; ! 1012: } ! 1013: # publisher, ! 1014: printf "%s%s", punc, issuer[b] ; ! 1015: punc = ",\n"; ! 1016: # location ! 1017: if (city[b]) ! 1018: printf "%s%s", punc, city[b] ; ! 1019: # (date) ! 1020: printf " (%s)", date[b] ; ! 1021: } ! 1022: ! 1023: ! 1024: func editedbook(b) { ! 1025: ! 1026: punc = ""; ! 1027: # authorlist (eds), ! 1028: if(authors[b]) { ! 1029: authorlist(b); ! 1030: if(authors[b] <2) ! 1031: printf " (ed)"; ! 1032: else ! 1033: printf " (eds)"; ! 1034: punc = ",\n"; ! 1035: } ! 1036: # italic(title), ! 1037: if (title[b]) { ! 1038: printf "%s\\f2\\&%s\\f1\\&", punc, title[b]; ! 1039: punc = ",\n"; ! 1040: } ! 1041: # volume, ! 1042: if(volstr[b]) { ! 1043: printf "%s%s", punc, volstr[b]; ! 1044: punc = ",\n"; ! 1045: } ! 1046: else if(volume[b]) { ! 1047: printf "%sVol. %s", punc, volume[b]; ! 1048: punc = ",\n"; ! 1049: } ! 1050: # publisher, ! 1051: printf "%s%s", punc, issuer[b] ; ! 1052: punc = ",\n"; ! 1053: # location, ! 1054: if (city[b] != "") ! 1055: printf "%s%s", punc, city[b] ; ! 1056: # pages ! 1057: if ( pages[b] != "" ) { ! 1058: if ( pages[b] ~ /[,-]/ ) ! 1059: printf "%spp. %s", punc, pages[b]; ! 1060: else printf "%sp. %s", punc, pages[b]; ! 1061: } ! 1062: # (date) ! 1063: printf " (%s)", date[b] ; ! 1064: } ! 1065: ! 1066: func thesis(b) { ! 1067: ! 1068: punc = "" ! 1069: # authorlist, ! 1070: if(authors[b]) { ! 1071: authorlist(b); ! 1072: punc = ",\n" ! 1073: } ! 1074: # `Title', ! 1075: if(title[b]) { ! 1076: printf "%s`%s'", punc, title[b]; ! 1077: punc = ",\n" ! 1078: } ! 1079: # thesis, ! 1080: printf punc; ! 1081: if(reftype[b] == "phdthesis") ! 1082: printf "\\fIPhD Thesis\\fR"; ! 1083: else ! 1084: printf "\\fIMaster's Thesis\\fR"; ! 1085: punc = ",\n"; ! 1086: # report number, ! 1087: if(report[b]) ! 1088: printf "%s%s", punc, report[b]; ! 1089: # school ! 1090: printf "%s%s", punc, issuer[b]; ! 1091: # (date) ! 1092: printf " (%s)", date[b] ; ! 1093: } ! 1094: ! 1095: func review(b) { ! 1096: article(b); ! 1097: } ! 1098: ! 1099: ! 1100: func article(b) { ! 1101: ! 1102: punc = ""; ! 1103: # authorlist, ! 1104: if(authors[b]) { ! 1105: authorlist(b); ! 1106: punc = ",\n" ! 1107: } ! 1108: # `Title,' ! 1109: if(title[b]) { ! 1110: if(nroff) ! 1111: printf "%s\"%s\"", punc, title[b] ; ! 1112: else ! 1113: printf "%s`%s'", punc, title[b] ; ! 1114: punc = ",\n"; ! 1115: } ! 1116: # Reviewed title and author ! 1117: if(booktitle[b]) { ! 1118: printf "%sReview of \\f2\\&%s\\f1\\&", punc, booktitle[b]; ! 1119: if(editors[b]) { ! 1120: printf " by "; ! 1121: enamelist(b); ! 1122: } ! 1123: if (issuer[b]) { ! 1124: printf " %s", issuer[b]; ! 1125: } ! 1126: punc = ",\n"; ! 1127: } ! 1128: # italics(journal) ! 1129: printf "%s\\f2\\&%s\\f1\\&", punc, journal[b]; ! 1130: punc = ",\n"; ! 1131: # bold(volume), (number Pt part), ! 1132: if (volstr[b]) ! 1133: printf "%s\\f3\\&%s\\f1\\&", punc, volstr[b] ; ! 1134: else if (volume[b]) ! 1135: printf "%s\\f3\\&%s\\f1\\&", punc, volume[b] ; ! 1136: if (numstr[b]) { ! 1137: printf "%s(%s", punc, numstr[b]; ! 1138: if(partstr[b]) ! 1139: printf " %s", partstr[b]; ! 1140: else if(part[b]) ! 1141: printf " Pt. %s", part[b]; ! 1142: printf ")"; ! 1143: } ! 1144: else if (number[b]) { ! 1145: printf "%s(%s", punc, number[b]; ! 1146: if(partstr[b]) ! 1147: printf " %s", partstr[b]; ! 1148: else if(part[b]) ! 1149: printf " Pt. %s", part[b]; ! 1150: printf ")"; ! 1151: } ! 1152: # pages, ! 1153: if (pages[b] && !volstring[b] && !volume[b]) { ! 1154: if ( pages[b] ~ /[,-]/ ) ! 1155: punc = punc "pp. "; ! 1156: else ! 1157: punc = punc "p. "; ! 1158: } ! 1159: if (pages[b]) printf "%s%s", punc, pages[b]; ! 1160: # publisher ! 1161: if(issuer[b]) ! 1162: if(authors[b] || editors[b]) ! 1163: printf "%s%s", punc, issuer[b]; ! 1164: # (date) ! 1165: if (pages[b] && !volstring[b] && !volume[b]) ! 1166: return ! 1167: printf " (%s)", date[b]; ! 1168: } ! 1169: ! 1170: ! 1171: ! 1172: ! 1173: func incollection(b) { ! 1174: ! 1175: punc = ""; ! 1176: # Authorlist ! 1177: if(authors[b]) { ! 1178: authorlist(b); ! 1179: punc = ",\n"; ! 1180: } ! 1181: # `Title,' ! 1182: if(title[b]) { ! 1183: if(nroff) ! 1184: printf "%s\"%s,\"", punc, title[b] ; ! 1185: else ! 1186: printf "%s`%s'", punc, title[b] ; ! 1187: punc = ",\n"; ! 1188: } ! 1189: # pages ! 1190: if ( pages[b]) { ! 1191: if ( pages[b] ~ /[,-]/ ) ! 1192: printf "%spp. %s ", punc, pages[b]; ! 1193: else printf "%sp. %s ", punc, pages[b]; ! 1194: punc = ""; ! 1195: } ! 1196: # in italics(booktitle), ! 1197: printf "%sin \\f2\\&%s\\f1\\&", punc, booktitle[b]; ! 1198: punc = ",\n"; ! 1199: # volume, ! 1200: if(volstr[b]) { ! 1201: printf "%s%s", punc, volstr[b]; ! 1202: } ! 1203: else if(volume[b]) { ! 1204: printf "%sVol. %s", punc, volume[b]; ! 1205: } ! 1206: # editorlist (ed), ! 1207: if(editors[b]) { ! 1208: printf punc; ! 1209: editorlist(b); ! 1210: if (editors[b] == 1) printf " (ed)" ! 1211: else if (editors[b] > 1) printf " (eds)" ! 1212: } ! 1213: # publisher, location, ! 1214: printf "%s%s", punc, issuer[b] ! 1215: if (city[b]) ! 1216: printf ", %s", city[b] ; ! 1217: # (date) ! 1218: printf " (%s)", date[b]; ! 1219: } ! 1220: ! 1221: ! 1222: func inproceedings(b) { ! 1223: ! 1224: punc = ""; ! 1225: # authorlist ! 1226: if(authors[b]) { ! 1227: authorlist(b); ! 1228: punc = ",\n"; ! 1229: } ! 1230: # `Title,' ! 1231: if(title[b]) { ! 1232: if(nroff) ! 1233: printf "%s\"%s,\"", punc,title[b] ; ! 1234: else ! 1235: printf "%s`%s'", punc,title[b] ; ! 1236: punc = ",\n"; ! 1237: } ! 1238: ! 1239: # italics(journal) ! 1240: printf "%s\\f2\\&%s\\f1\\&", punc, journal[b]; ! 1241: punc = ",\n"; ! 1242: # bold(vol)(no Pt. #), ! 1243: if (volstr[b]) ! 1244: printf "%s\\f3\\&%s\\f1\\&", punc, volstr[b] ; ! 1245: else if (volume[b]) ! 1246: printf "%s\\f3\\&%s\\f1\\&", punc, volume[b] ; ! 1247: if (numstr[b]) { ! 1248: printf "%s(%s", punc, numstr[b]; ! 1249: if(partstr[b]) ! 1250: printf " %s", partstr[b]; ! 1251: else if(part[b]) ! 1252: printf " Pt. %s", part[b]; ! 1253: printf ")"; ! 1254: } ! 1255: else if (number[b]) { ! 1256: printf "%s(%s", punc, number[b]; ! 1257: if(partstr[b]) ! 1258: printf " %s", partstr[b]; ! 1259: else if(part[b]) ! 1260: printf " Pt. %s", part[b]; ! 1261: printf ")"; ! 1262: } ! 1263: # editorlist (ed), ! 1264: if(editors[b]) { ! 1265: printf punc; ! 1266: editorlist(b); ! 1267: if (editors[b] == 1) printf " (ed)" ! 1268: else if (editors[b] > 1) printf " (eds)" ! 1269: } ! 1270: # publisher ! 1271: if(issuer[b]) ! 1272: if(authors[b] || editors[b]) ! 1273: printf "%s%s", punc, issuer[b]; ! 1274: if (city[b]) ! 1275: printf "%s%s", punc, city[b] ; ! 1276: # date ! 1277: if (date[b]) ! 1278: printf "%s(%s)", punc, date[b]; ! 1279: # pages ! 1280: if ( pages[b]) { ! 1281: if ( pages[b] ~ /[,-]/ ) ! 1282: printf "%spp. %s", punc, pages[b]; ! 1283: else printf "%sp. %s", punc, pages[b]; ! 1284: } ! 1285: } ! 1286: ! 1287: func proceedings(b) { ! 1288: punc = ""; ! 1289: # authorlist, ! 1290: if(authors[b]) { ! 1291: authorlist(b); ! 1292: punc = ",\n"; ! 1293: } ! 1294: ! 1295: # editorlist (ed), ! 1296: else if(editors[b]) { ! 1297: printf punc; ! 1298: editorlist(b); ! 1299: if (editors[b] == 1) printf " (ed)" ! 1300: else if (editors[b] > 1) printf " (eds)" ! 1301: punc = ",\n"; ! 1302: } ! 1303: # publisher, ! 1304: else if(issuer[b]) { ! 1305: printf "%s%s", punc, issuer[b]; ! 1306: punc = ",\n"; ! 1307: } ! 1308: # italics(title) ! 1309: if(title[b]) { ! 1310: printf "%s\\f2\\&%s\\f1\\&", punc,title[b]; ! 1311: punc = " "; ! 1312: } ! 1313: # bold(vol)(no Pt. #), ! 1314: if (volstr[b]) { ! 1315: printf "%s\\f3\\&%s\\f1\\&", punc,volstr[b]; ! 1316: punc = ",\n"; ! 1317: } ! 1318: else if (volume[b]) { ! 1319: printf "%s\\f3\\&%s\\f1\\&", punc,volume[b]; ! 1320: punc = ",\n"; ! 1321: } ! 1322: if (numstr[b]) { ! 1323: printf "%s(%s", punc, numstr[b]; ! 1324: if(partstr[b]) ! 1325: printf " %s", partstr[b]; ! 1326: else if(part[b]) ! 1327: printf " Pt. %s", part[b]; ! 1328: printf ")"; ! 1329: } ! 1330: else if (number[b]) { ! 1331: printf "%s(%s", punc, number[b]; ! 1332: if(partstr[b]) ! 1333: printf " %s", partstr[b]; ! 1334: else if(part[b]) ! 1335: printf " Pt. %s", part[b]; ! 1336: printf ")"; ! 1337: } ! 1338: # publisher, ! 1339: if(issuer[b]) ! 1340: if(authors[b] != 0 || editors[b] != 0) { ! 1341: printf "%s%s", punc, issuer[b]; ! 1342: punc = ",\n"; ! 1343: } ! 1344: # location, ! 1345: if (city[b]) ! 1346: printf "%s%s", punc, city[b] ; ! 1347: # date ! 1348: if (date[b]) ! 1349: printf "%s%s", punc, date[b]; ! 1350: } ! 1351: ! 1352: func techreport(b) { ! 1353: ! 1354: punc = ""; ! 1355: # authorlist, ! 1356: if(authors[b]) { ! 1357: authorlist(b); ! 1358: punc = ",\n"; ! 1359: } ! 1360: # `Title,' ! 1361: if(title[b]) { ! 1362: if(nroff) ! 1363: printf "%s\"%s,\"", punc, title[b] ; ! 1364: else ! 1365: printf "%s`%s'", punc, title[b] ; ! 1366: punc = ",\n"; ! 1367: } ! 1368: # report, ! 1369: printf "%s%s", punc, report[b]; ! 1370: punc = ",\n"; ! 1371: # publisher, ! 1372: if (issuer[b]) printf "%s%s", punc, issuer[b] ; ! 1373: # location ! 1374: if (city[b]) ! 1375: printf "%s%s", punc, city[b] ; ! 1376: # (date) ! 1377: printf " (%s)", date[b] ; ! 1378: } ! 1379: ! 1380: ! 1381: func tm(b) { ! 1382: ! 1383: punc = "" ! 1384: # authorlist ! 1385: if(authors[b]) { ! 1386: authorlist(b); ! 1387: punc = ",\n"; ! 1388: } ! 1389: # italic(title), ! 1390: if(title[b]) { ! 1391: printf "%s\\f2\\&%s\\f1\\&", punc, title[b]; ! 1392: punc = ",\n"; ! 1393: } ! 1394: # tmno ! 1395: printf punc; ! 1396: if(rp) ! 1397: printf "AT&T Bell Laboratories internal memorandum"; ! 1398: else ! 1399: printf "%s", tmno[b] ! 1400: # (date) ! 1401: printf " (%s)", date[b] ; ! 1402: } ! 1403: ! 1404: ! 1405: func manual(b) { ! 1406: punc = ""; ! 1407: # authorlist, ! 1408: if(authors[b]) { ! 1409: authorlist(b); ! 1410: punc = ",\n"; ! 1411: } ! 1412: # editorlist (ed), ! 1413: else if(editors[b] > 0) { ! 1414: printf punc; ! 1415: editorlist(b); ! 1416: if (editors[b] == 1) printf " (ed)" ! 1417: else if (editors[b] > 1) printf " (eds)" ! 1418: punc = ",\n" ! 1419: } ! 1420: # publisher, ! 1421: else if(issuer[b]) { ! 1422: printf "%s%s", punc, issuer[b]; ! 1423: punc = ",\n"; ! 1424: } ! 1425: # italic(title), ! 1426: if(title[b]) { ! 1427: printf "%s\\f2\\&%s\\f1\\&", punc, title[b]; ! 1428: punc = ",\n"; ! 1429: } ! 1430: # volume, ! 1431: if(volstr[b]) { ! 1432: printf "%s%s", punc, volstr[b]; ! 1433: } ! 1434: else if(volume[b]) { ! 1435: printf "%sVol. %s", punc, volume[b]; ! 1436: } ! 1437: # publisher, ! 1438: if(issuer[b]) ! 1439: if(authors[b] || editors[b] ) { ! 1440: printf "%s%s", punc, issuer[b]; ! 1441: punc = ",\n"; ! 1442: } ! 1443: # location, ! 1444: if (city[b]) ! 1445: printf "%s%s", punc, city[b] ; ! 1446: # pages ! 1447: if (pages[b]) { ! 1448: if ( pages[b] ~ /[,-]/ ) ! 1449: printf "%spp. %s", punc, pages[b]; ! 1450: else ! 1451: printf "%sp. %s", punc, pages[b]; ! 1452: } ! 1453: # (date) ! 1454: printf " (%s)", date[b]; ! 1455: } ! 1456: ! 1457: func pamphlet(b) ! 1458: { ! 1459: punc = ""; ! 1460: # authorlist, ! 1461: if(authors[b]) { ! 1462: authorlist(b); ! 1463: punc = ",\n"; ! 1464: } ! 1465: ! 1466: # publisher, ! 1467: else if(issuer[b]) { ! 1468: printf "%s%s", punc, issuer[b]; ! 1469: punc = ",\n"; ! 1470: } ! 1471: # `Title,' ! 1472: if(title[b]) { ! 1473: printf "%s\\f2\\&%s\\f1\\&", punc, title[b] ; ! 1474: punc = ",\n"; ! 1475: } ! 1476: # publisher, ! 1477: if(issuer[b]) { ! 1478: if(authors[b] || editors[b]) { ! 1479: printf "%s%s", punc, issuer[b]; ! 1480: } ! 1481: } ! 1482: # location ! 1483: if (city[b]) { ! 1484: printf "%s%s", punc, city[b] ; ! 1485: } ! 1486: # (date), ! 1487: if (date[b]) { ! 1488: printf " (%s)", date[b]; ! 1489: } ! 1490: } ! 1491: ! 1492: func default(b) { ! 1493: punc = ""; ! 1494: # authorlist, ! 1495: if(authors[b]) { ! 1496: authorlist(b); ! 1497: punc = ",\n"; ! 1498: } ! 1499: ! 1500: # publisher, ! 1501: else if(issuer[b]) { ! 1502: printf "%s%s", punc, issuer[b]; ! 1503: punc = ",\n"; ! 1504: } ! 1505: # title, ! 1506: if(title[b]) { ! 1507: printf "%s\\f2\\&%s\\f1\\&", punc, title[b] ; ! 1508: punc = ",\n"; ! 1509: } ! 1510: # volume, ! 1511: if(volstr[b]) { ! 1512: printf "%s%s", punc, volstr[b]; ! 1513: } ! 1514: else if(volume[b]) { ! 1515: printf "%sVol. %s", punc, volume[b]; ! 1516: } ! 1517: # publisher, ! 1518: if(issuer[b]) { ! 1519: if(authors[b] || editors[b]) { ! 1520: printf "%s%s", punc, issuer[b]; ! 1521: } ! 1522: } ! 1523: # location, ! 1524: if (city[b]) { ! 1525: printf "%s%s", punc, city[b] ; ! 1526: } ! 1527: # pages ! 1528: if (pages[b]) { ! 1529: if ( pages[b] ~ /[,-]/ ) ! 1530: printf "%spp. %s", punc, pages[b]; ! 1531: else ! 1532: printf "%sp. %s", punc, pages[b]; ! 1533: } ! 1534: # (date) ! 1535: if (date[b]) { ! 1536: printf " (%s)", date[b]; ! 1537: } ! 1538: } ! 1539: ! 1540: ! 1541: ! 1542: ## ! 1543: ## authorlist ! 1544: ## First ! 1545: ## First and Second ! 1546: ## First, Second,..., and Last ! 1547: ## ! 1548: func authorlist(b) { ! 1549: if ( authors[b] == 0 ) ; ! 1550: else if ( authors[b] == 1 ) { ! 1551: printf Afull[b,1] ; ! 1552: if(aetal[b]) printf ", et al."; ! 1553: } ! 1554: else if ( authors[b] == 2 ) printf Afull[b,1] " and " Afull[b,2]; ! 1555: else { ! 1556: for ( j = 1; j < authors[b]; j++ ) print Afull[b,j] ", "; ! 1557: printf "and " Afull[b,authors[b]]; ! 1558: } ! 1559: } ! 1560: ! 1561: ! 1562: ## ! 1563: ## editorlist ! 1564: ## First ! 1565: ## First and Second ! 1566: ## First, Second,..., and Last ! 1567: ## ! 1568: func editorlist(b) { ! 1569: if ( editors[b] == 0 ) ; ! 1570: else if ( editors[b] == 1 ) { ! 1571: printf E[b,1] ; ! 1572: if(eetal[b]) printf ", et al."; ! 1573: } ! 1574: else if ( editors[b] == 2 ) printf E[b,1] " and " E[b,2]; ! 1575: else { ! 1576: for ( j = 1; j < editors[b]; j++ ) print E[b,j] ", "; ! 1577: printf "and " E[b,editors[b]]; ! 1578: } ! 1579: } ! 1580: ! 1581: ## ! 1582: ## enamelist ! 1583: ## First ! 1584: ## First and Second ! 1585: ## First, Second,..., and Last ! 1586: ## ! 1587: func enamelist(b) { ! 1588: if ( editors[b] == 0 ) ; ! 1589: else if ( editors[b] == 1 ) { ! 1590: printf Ename[b,1] ; ! 1591: if(eetal[b]) printf ", et al."; ! 1592: } ! 1593: else if ( editors[b] == 2 ) printf Ename[b,1] " and " Ename[b,2]; ! 1594: else { ! 1595: for ( j = 1; j < editors[b]; j++ ) print Ename[b,j] ", "; ! 1596: printf "and " Ename[b,editors[b]]; ! 1597: } ! 1598: } ! 1599:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.