Annotation of 3BSD/cmd/troff/font/mkfont.c, revision 1.1

1.1     ! root        1: #include "mkfont1.c"
        !             2: 
        !             3: /*
        !             4:   this program takes 102 width values
        !             5:   (one per line) in the order provided bu Graphic
        !             6:   Systems and prepares a C-compileable width table.
        !             7: */
        !             8: char ibuf[512];
        !             9: int id;
        !            10: int width[102];
        !            11: int ascii[102];
        !            12: int zero;
        !            13: int emw, hyw;
        !            14: int xxx;
        !            15: 
        !            16: main(argc,argv)
        !            17: int argc;
        !            18: char **argv;
        !            19: {
        !            20:        register i, j;
        !            21:        register char *p;
        !            22: 
        !            23:        while((--argc > 0) && ((++argv)[0][0]=='-')){
        !            24:                switch(argv[0][1]){
        !            25:                        default:
        !            26:                                continue;
        !            27:                }
        !            28:        }
        !            29:        if(argc){
        !            30:                if((id=open(argv[0],0)) < 0){
        !            31:                        printf("Cannot open: %s.\n",argv[0]);
        !            32:                        exit(1);
        !            33:                }
        !            34:        }
        !            35:        j = read(id,ibuf,512);
        !            36:        p = ibuf;
        !            37:        for(i=0; i<102; i++){
        !            38:                width[i] = atoi(p);
        !            39:                while(*p++ != '\n');
        !            40:        }
        !            41:        for(i=0; i<102; i++){
        !            42:                if(font[i].name < 0177){
        !            43:                        ascii[i] = font[i].name;
        !            44:                }else{
        !            45:                        for(j=0; chtab[j] != 0; j =+ 2){
        !            46:                                if(font[i].name == chtab[j])break;
        !            47:                        }
        !            48:                        ascii[i] = chtab[j+1] & 0377;
        !            49:                        if(chtab[j] == 'hy')hyw = width[i];
        !            50:                        if(chtab[j] == 'em')emw = width[i];
        !            51:                }
        !            52:        }
        !            53:        printf("char XXw[256-32] {\t/*XX*/\n");
        !            54:        for(i=040; i<256; i++){
        !            55:                if(i == 0377){
        !            56:                        printf("0};\n");
        !            57:                        break;
        !            58:                }
        !            59:                if(i == 0177){
        !            60:                        printf("6,\t %s\n",nametab[i-040]);
        !            61:                        continue;
        !            62:                }
        !            63:                if(i == 0226){
        !            64:                        printf("3,\t %s\n",nametab[i-040]);
        !            65:                        continue;
        !            66:                }
        !            67:                if(i == ' '){
        !            68:                        printf("12,\t %s\n",nametab[i-040]);
        !            69:                        continue;
        !            70:                }
        !            71:                if(i == '-'){
        !            72:                        printf("%d,\t %s\n",hyw,nametab[i-040]);
        !            73:                        continue;
        !            74:                }
        !            75:                for(j=0; j<102; j++){
        !            76:                        if(ascii[j] == i)break;
        !            77:                }
        !            78:                if(j == 102){
        !            79:                        printf("0,");
        !            80:                        zero++;
        !            81:                        if(nametab[i-040]){
        !            82:                                printf("\t %s\n",nametab[i-040]);
        !            83:                                zero = 0;
        !            84:                        }else if(i < 0177){
        !            85:                                printf("\t /*%c*/\n",i);
        !            86:                                zero = 0;
        !            87:                        }
        !            88:                        if(zero && !((i+1)%8)){
        !            89:                                printf("\n");
        !            90:                                zero = 0;
        !            91:                        }
        !            92:                }else{
        !            93:                        if(zero){
        !            94:                                zero = 0;
        !            95:                                printf("\n");
        !            96:                        }
        !            97:                        printf("%d",width[j]);
        !            98:                        if(font[j].ctval)printf("+0%d00, ",font[j].ctval);
        !            99:                        else printf(",\t ");
        !           100:                        printf("%s\n",nametab[i-040]);
        !           101:                }
        !           102:        }
        !           103: }

unix.superglobalmegacorp.com

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