Annotation of researchv10no/cmd/prefer/styles/newpami, revision 1.1.1.1

1.1       root        1: ###
                      2: ### pami reference formatting style
                      3: ###
                      4: 
                      5: BEGIN  {
                      6:        PASS="%TWOPASS";        # only one pass thru document
                      7:        sortflag = 1;           # reference_placement bib is sortedone
                      8:        STYLE = "pami";
                      9:        SKEY = "adt";
                     10: }
                     11: 
                     12: 
                     13: 
                     14: #######################################################
                     15: #
                     16: # Functions required by general awk script
                     17: #
                     18: #######################################################
                     19: 
                     20: 
                     21: ##
                     22: ## Set author and editor fields
                     23: ##     for reference list
                     24: ##     for citation
                     25: ##     for possible sorting
                     26: ##
                     27: 
                     28: func setauthor(b,a) {
                     29:        Afull[b,a] = FMLast();
                     30:        Asort[b] = Asort[b] LastFM() " ";
                     31: }
                     32: 
                     33: func seteditor(b,a) {
                     34:        E[b,a] = FMLast();
                     35:        Efull[b,a] = LastFM();
                     36:        Esort[b] = Esort[b] Efull[b,a] " ";
                     37: }
                     38: 
                     39: 
                     40: ##
                     41: ## citations
                     42: ##     print a citation list
                     43: ##     (Last, year; Last, year...)
                     44: ##
                     45: func citations(lastpunc) {
                     46:        seq = "no";
                     47:        punc = "\n";
                     48:        if(lastpunc == "\"" || lastpunc == "'") {
                     49:                punc = lastpunc " ";
                     50:                lastpunc = "\\ ";
                     51:        }
                     52:        if(lastpunc == "(") {
                     53:                punc = lastpunc;
                     54:                lastpunc = "";
                     55:        }
                     56:        for(i=1; i<=cites; i++) {
                     57:                cn = bibptr[i]
                     58:                seq = sequence(i,cites);
                     59:                if (seq == "in") continue;
                     60:                if (seq == "end") {
                     61:                        punc = "-";
                     62:                        seq = "no";
                     63:                }
                     64:                printf "%s[", punc;
                     65:                if (pre_text[cn]) printf "%s ", pre_text[cn];
                     66:                printf "%s", makemark(i);
                     67:                if(post_text[cn]) {
                     68:                        if (is_punc(substr(post_text[cn],1,1)) == 0) print "";
                     69:                        printf "%s", post_text[cn];
                     70:                }
                     71:                printf "]";
                     72:                punc = ", ";
                     73:        }
                     74:        printf lastpunc;
                     75: }
                     76: 
                     77: func is_punc(p)
                     78: {
                     79:        if(p == ",") return 1;
                     80:        if(p == ".") return 1;
                     81:        if(p == ";") return 1;
                     82:        return 0;
                     83: }
                     84: 
                     85: 
                     86: ##
                     87: ## makemark
                     88: ##     return citation mark: identical citations have the same number
                     89: ##
                     90: func makemark(m) {
                     91:        return(inverse[uniqno[bibptr[m]]]);
                     92: }
                     93: 
                     94: 
                     95: 
                     96: ##
                     97: ## bibindex
                     98: ##     print citation mark for the bibliography;
                     99: ##     return an index for accessing rest of citation
                    100: ##
                    101: func bibindex(b) {
                    102:        printf ".sp .5\n.ti -\\w'[" b "]\\ \\ \\ 'u\n";
                    103:        printf "[" b "]\\ \\ \\ ";
                    104:        if(sortflag) return sortorder[b];
                    105:        else return b;
                    106: }
                    107: 
                    108: 
                    109: 
                    110: #############################################
                    111: #
                    112: # Reference types
                    113: #
                    114: ############################################
                    115: 
                    116: 
                    117: func book(b) {
                    118:        # authorlist
                    119:                        if(authors[b]) {
                    120:                                printfull(b);
                    121:                                printf ",\n";
                    122:                        }
                    123:        # (italic) title.
                    124:                        if(title[b])
                    125:                                printf "\\f2\\&%s\\f1\\&.\n", title[b];
                    126:        # Vol. #.
                    127:                        if (volstr[b])
                    128:                                printf "%s.\n", volstr[b] ;
                    129:                        else if (volume[b])
                    130:                                printf "Vol. %s.\n", volume[b] ;
                    131:        # [location: ]publisher,
                    132:                        if (city[b]) printf "%s: ", city[b] ;
                    133:                        printf "%s,\n", issuer[b] ;
                    134:        # date
                    135:                        printf date[b] ;
                    136: }
                    137: 
                    138: func editedbook(b) {
                    139:        # authorlist, Ed[s].,
                    140:                        if(authors[b]) {
                    141:                                printfull(b);
                    142:                                if(authors[b] <2)
                    143:                                        printf ", Ed.,\n";
                    144:                                else
                    145:                                        printf ", Eds.,\n";
                    146:                        }
                    147:        # (italic) title.
                    148:                        if(title[b])
                    149:                                printf "\\f2\\&%s\\f1\\&.\n", title[b];
                    150:        # Vol. #.
                    151:                        if (volstr[b])
                    152:                                printf "%s.\n", volstr[b] ;
                    153:                        else if (volume[b])
                    154:                                printf "Vol. %s.\n", volume[b] ;
                    155:        # [location: ]publisher,
                    156:                        if (city[b]) printf "%s: ", city[b] ;
                    157:                        printf "%s,\n", issuer[b] ;
                    158:        # date
                    159:                        printf date[b] ;
                    160: }
                    161: 
                    162: func incollection(b) {
                    163:        # authorlist,
                    164:                        if(authors[b]) {
                    165:                                printfull(b);
                    166:                                printf ",\n";
                    167:                        }
                    168:        # ``title,''
                    169:                        if(title[b]) {
                    170:                                if(nroff)
                    171:                                        printf "\"%s,\"", title[b] ;
                    172:                                else
                    173:                                        printf "``%s,''", title[b] ;
                    174:                        }
                    175:        # in (italics) booktitle,
                    176:                        printf "In \\f2\\&%s\\f1\\&,\n", booktitle[b];
                    177:        # Vol. #,
                    178:                        if (volstr[b])
                    179:                                printf "%s,\n", volstr[b] ;
                    180:                        else if (volume[b])
                    181:                                printf "Vol. %s,\n", volume[b] ;
                    182:        # editorlist Ed.
                    183:                        if (editors[b]) {
                    184:                                editorlist(b);
                    185:                                if (editors[b] == 1) printf ", Ed.\n"
                    186:                                else if (editors[b] > 1) printf ", Eds.\n"
                    187:                        }
                    188:        # [location: ]publisher,
                    189:                        if (city[b]) printf "%s: ", city[b] ;
                    190:                        printf "%s,\n", issuer[b] ;
                    191:        # date
                    192:                        printf date[b] ;
                    193:        # pages,
                    194:                        if ( pages[b]) {
                    195:                                if ( pages[b] ~ /[,-]/ )
                    196:                                        printf ",\npp. %s", pages[b];
                    197:                                else printf ",\np. %s", pages[b];
                    198:                        }
                    199: }
                    200: 
                    201: func thesis(b) {
                    202:        # authorlist,
                    203:                        if(authors[b]) {
                    204:                                printfull(b);
                    205:                                printf ",\n";
                    206:                        }
                    207:        # ``title,''
                    208:                        if(title[b]) {
                    209:                                if(nroff)
                    210:                                        printf "\"%s,\"", title[b] ;
                    211:                                else
                    212:                                        printf "``%s,''", title[b] ;
                    213:                        }
                    214:        # thesis, publisher, 
                    215:                        if(reftype[b] == "phdthesis")
                    216:                                printf "PhD dissertation, %s", issuer[b];
                    217:                        else if(reftype[b] == "mastersthesis")
                    218:                                printf "Master's dissertation, %s", issuer[b];
                    219:        # date
                    220:                        printf ",\n%s", date[b] ;
                    221: }
                    222: 
                    223: func review(b) {
                    224:        article(b);
                    225: }
                    226: 
                    227: func article(b) {
                    228:        # authorlist,
                    229:                        if(authors[b]) {
                    230:                                printfull(b);
                    231:                                printf ",\n";
                    232:                        }
                    233:        # ``title,''
                    234:                        if(title[b]) {
                    235:                                if(nroff)
                    236:                                        printf "\"%s,\"", title[b] ;
                    237:                                else
                    238:                                        printf "``%s,''", title[b] ;
                    239:                        }
                    240:        # review
                    241:                        if(booktitle[b]) {
                    242:                                printf "Review of \\f2\\&%s\\f1\\&", booktitle[b];
                    243:                                if(editors[b]) {
                    244:                                        printf " by "
                    245:                                        editorlist(b);
                    246:                                }
                    247:                                if (issuer[b]) {
                    248:                                        printf " %s", issuer[b];
                    249:                                }
                    250:                                printf ".\n";
                    251:                        }
                    252:        # (italics) journal,
                    253:                        printf "\\f2\\&%s\\f1\\&,\n", journal[b];
                    254:        # vol. #,
                    255:                        if (volstr[b])
                    256:                                printf "%s, ", volstr[b] ;
                    257:                        else if (volume[b])
                    258:                                printf "vol. %s, ", volume[b] ;
                    259:        # no. #,
                    260:                        if(numstr[b])
                    261:                                printf "%s, ", numstr[b];
                    262:                        else if (number[b])
                    263:                                printf "no. %s, ", number[b] ;
                    264:        # pt. #,
                    265:                        if(partstr[b])
                    266:                                printf "%s, ", partstr[b];
                    267:                        else if (part[b])
                    268:                                printf "pt. %s, ", part[b] ;
                    269:        # pages,
                    270:                        if ( pages[b]) {
                    271:                                if ( pages[b] ~ /[,-]/ )
                    272:                                        printf "pp. %s, ", pages[b];
                    273:                                else printf "p. %, s", pages[b];
                    274:                        }
                    275:        # date
                    276:                        printf "%s", date[b] ;
                    277: }
                    278: 
                    279: func inproceedings(b) {
                    280:        # authorlist,
                    281:                        if(authors[b]) {
                    282:                                printfull(b);
                    283:                                printf ",\n";
                    284:                        }
                    285:        # ``title,''
                    286:                        if(title[b]) {
                    287:                                if(nroff)
                    288:                                        printf "\"%s,\"", title[b] ;
                    289:                                else
                    290:                                        printf "``%s,''", title[b] ;
                    291:                        }
                    292:        # (italics) journal,
                    293:                        printf "in \\f2\\&%s\\f1\\&,", journal[b];
                    294:        # volume,
                    295:                        if (volstr[b])
                    296:                                printf ", %s", volstr[b] ;
                    297:                        else if (volume[b])
                    298:                                printf ", Vol. %s", volume[b] ;
                    299:                        if(numstr[b])
                    300:                                printf ", %s", numstr[b];
                    301:                        else if (number[b])
                    302:                                printf ", No. %s", number[b] ;
                    303:                        if(partstr[b])
                    304:                                printf ", %s", partstr[b];
                    305:                        else if (part[b])
                    306:                                printf ", Pt. %s", part[b] ;
                    307:        # [location: ]publisher,
                    308:                        if (city[b]) printf "%s: ", city[b] ;
                    309:                        printf "%s,\n", issuer[b] ;
                    310:        # date
                    311:                        printf date[b] ;
                    312:        # pages,
                    313:                        if ( pages[b]) {
                    314:                                if ( pages[b] ~ /[,-]/ )
                    315:                                        printf ",\npp. %s", pages[b];
                    316:                                else printf ",\np. %s", pages[b];
                    317:                        }
                    318: }
                    319: 
                    320: func proceedings(b) {
                    321:        # authorlist,
                    322:                        if(authors[b]) {
                    323:                                printfull(b);
                    324:                                printf ",\n";
                    325:                        }
                    326:        # editorlist, Ed.
                    327:                        else if(editors[b]) {
                    328:                                editorlist(b);
                    329:                                if (editors[b] == 1) printf ", Ed."
                    330:                                else if (editors[b] > 1) printf ", Eds."
                    331:                                printf ",\n";
                    332:                        }
                    333:        # publisher.
                    334:                        else if(issuer[b]) {
                    335:                                printf "%s", issuer[b];
                    336:                                printf ".\n";
                    337:                        }
                    338:        # (italics) title,
                    339:                        if(title[b]) {
                    340:                                printf "\\f2\\&%s\\f1\\&", title[b];
                    341:                                printf ",\n";
                    342:                        }
                    343:        # vol. #,
                    344:                        if (volstr[b])
                    345:                                printf "%s, ", volstr[b] ;
                    346:                        else if (volume[b])
                    347:                                printf "vol. %s, ", volume[b] ;
                    348:        # no. #,
                    349:                        if(numstr[b])
                    350:                                printf "%s, ", numstr[b];
                    351:                        else if (number[b])
                    352:                                printf "no. %s, ", number[b] ;
                    353:        # pt. #,
                    354:                        if(partstr[b])
                    355:                                printf "%s, ", partstr[b];
                    356:                        else if (part[b])
                    357:                                printf "pt. %s, ", part[b] ;
                    358:        # publisher,
                    359:                        if(issuer[b]) {
                    360:                                if(authors[b] || editors[b]) {
                    361:                                        printf issuer[b];
                    362:                                        printf ",\n";
                    363:                                }
                    364:                        }
                    365:        # location,
                    366:                        if (city[b]) {
                    367:                                printf city[b] ;
                    368:                                printf ",\n";
                    369:                        }
                    370:        # date
                    371:                        if (date[b])
                    372:                                printf date[b];
                    373: }
                    374: 
                    375: func techreport(b) {
                    376:        # authorlist,
                    377:                        if(authors[b]) {
                    378:                                printfull(b);
                    379:                                printf ",\n";
                    380:                        }
                    381:        # ``title,''
                    382:                        if(title[b]) {
                    383:                                if(nroff)
                    384:                                        printf "\"%s,\"", title[b] ;
                    385:                                else
                    386:                                        printf "``%s,''", title[b] ;
                    387:                        }
                    388:        # publisher,
                    389:                        if (issuer[b]) printf ",\n%s", issuer[b] ;
                    390:        # location,
                    391:                        if (city[b]) {
                    392:                                printf city[b] ;
                    393:                                printf ",\n";
                    394:                        }
                    395:        # report number,
                    396:                        printf report[b] 
                    397:        # date
                    398:                        printf ",\n%s", date[b] ;
                    399: }
                    400: 
                    401: func tm(b) {
                    402:        # authorlist,
                    403:                        if(authors[b]) {
                    404:                                printfull(b);
                    405:                                printf ",\n";
                    406:                        }
                    407:        # ``title,''
                    408:                        if(title[b]) {
                    409:                                if(nroff)
                    410:                                        printf "\"%s,\"", title[b] ;
                    411:                                else
                    412:                                        printf "``%s,''", title[b] ;
                    413:                        }
                    414:        # report number,
                    415:                        if(rp)
                    416:                                printf "AT&T Bell Laboratories internal memorandum";
                    417:                        else
                    418:                                printf tmno[b] 
                    419:        # date
                    420:                        printf ",\n%s", date[b] ;
                    421: }
                    422: 
                    423: func manual(b) {
                    424:        # authorlist,
                    425:                        if(authors[b]) {
                    426:                                printfull(b);
                    427:                                printf ",\n";
                    428:                        }
                    429:        # editorlist, Ed.
                    430:                        else if(editors[b]) {
                    431:                                editorlist(b);
                    432:                                if (editors[b] == 1) printf ", Ed."
                    433:                                else if (editors[b] > 1) printf ", Eds."
                    434:                                printf ",\n";
                    435:                        }
                    436:        # publisher.
                    437:                        else if(issuer[b]) {
                    438:                                printf "%s", issuer[b];
                    439:                                printf ".\n";
                    440:                        }
                    441:        # (italics) title,
                    442:                        if(title[b]) {
                    443:                                printf "\\f2\\&%s\\f1\\&", title[b];
                    444:                                printf ",\n";
                    445:        # vol. #,
                    446:                                if (volstr[b])
                    447:                                        printf "%s, ", volstr[b] ;
                    448:                                else if (volume[b])
                    449:                                        printf "vol. %s, ", volume[b] ;
                    450:                        }
                    451:        # publisher,
                    452:                        if(issuer[b]) {
                    453:                                if(authors[b] || editors[b]) {
                    454:                                        printf issuer[b];
                    455:                                        printf ",\n";
                    456:                                }
                    457:                        }
                    458:        # location,
                    459:                        if (city[b]) {
                    460:                                printf city[b] ;
                    461:                                printf ",\n";
                    462:                        }
                    463:        # date
                    464:                        printf date[b];
                    465: }
                    466: 
                    467: func pamphlet(b) {
                    468:        default(b);
                    469: }
                    470: 
                    471: func default(b) {
                    472:        # authorlist
                    473:                        punc = "";
                    474:                        if(authors[b]) {
                    475:                                printfull(b);
                    476:                                punc = ",\n";
                    477:                        }
                    478:        # publisher.
                    479:                        else if(issuer[b]) {
                    480:                                printf "%s%s", punc, issuer[b];
                    481:                                punc = ".\n";
                    482:                        }
                    483:        # title,
                    484:                        if (title[b]) {
                    485:                                printf "%s%s", punc, title[b];
                    486:                                punc = ".\n";
                    487:                        }
                    488:        # volume,
                    489:                        if(volstr[b]) {
                    490:                                printf ", %s", volstr[b];
                    491:                        }
                    492:                        else if (volume[b]) {
                    493:                                printf ", Vol. %s", punc, volume[b] ;
                    494:                        }
                    495:        # publisher,
                    496:                        if(issuer[b]) {
                    497:                                printf "%s%s", punc, issuer[b];
                    498:                                punc = ", ";
                    499:                        }
                    500:        # location,
                    501:                        if (city[b]) {
                    502:                                printf "%s%s", punc, city[b] ;
                    503:                                punc = ", ";
                    504:                        }
                    505:        # date,
                    506:                        if (date[b]) {
                    507:                                printf "%s%s", punc, date[b];
                    508:                                punc = ", ";
                    509:                        }
                    510:        # pages
                    511:                        if (pages[b]) {
                    512:                                if ( pages[b] ~ /[,-]/ )
                    513:                                        printf "%spp. %s", punc, pages[b];
                    514:                                else
                    515:                                        printf "%sp. %s", punc, pages[b];
                    516:                        }
                    517: }
                    518: 
                    519: 
                    520: 
                    521: # authorlist
                    522: #      First
                    523: #      First and Second
                    524: #      First, Second, ..., and Last
                    525: 
                    526: func printfull(b) {                    
                    527:        if ( authors[b] == 0 ) ;
                    528:        else if ( authors[b] == 1 ) {
                    529:                printf  Afull[b,1] ;
                    530:                if(aetal[b]) printf ", et al.";
                    531:        }
                    532:        else if ( authors[b] == 2 ) printf  Afull[b,1] " and " Afull[b,2];
                    533:        else {
                    534:                for ( j = 1; j < authors[b]; j++ ) printf Afull[b,j] ", ";
                    535:                printf "and " Afull[b,authors[b]];
                    536:        }
                    537: }
                    538: 
                    539: func editorlist(b) {
                    540:        if ( editors[b] == 0 ) ;
                    541:        else if ( editors[b] == 1 ) printf E[b,1] ;
                    542:        else if ( editors[b] == 2 ) printf E[b,1] " and " E[b,2];
                    543:        else {
                    544:                for ( j = 1; j < editors[b]; j++ ) printf E[b,j] ", ";
                    545:                printf "and " E[b,editors[b]];
                    546:        }
                    547: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.