Annotation of researchv10no/libplot/oldplot/driver.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: 
        !             3: float deltx;
        !             4: float delty;
        !             5: char   obuf[BUFSIZ];
        !             6: 
        !             7: main(argc,argv)  char **argv; {
        !             8:        int std=1;
        !             9:        FILE *fin;
        !            10: 
        !            11:        setbuf(stdout, obuf);
        !            12:        while(argc-- > 1) {
        !            13:                if(*argv[1] == '-')
        !            14:                        switch(argv[1][1]) {
        !            15:                                case 'l':
        !            16:                                        deltx = atoi(&argv[1][2]) - 1;
        !            17:                                        break;
        !            18:                                case 'w':
        !            19:                                        delty = atoi(&argv[1][2]) - 1;
        !            20:                                        break;
        !            21:                                }
        !            22: 
        !            23:                else {
        !            24:                        std = 0;
        !            25:                        if ((fin = fopen(argv[1], "r")) == NULL) {
        !            26:                                fprintf(stderr, "can't open %s\n", argv[1]);
        !            27:                                exit(1);
        !            28:                                }
        !            29:                        fplt(fin);
        !            30:                        }
        !            31:                argv++;
        !            32:                }
        !            33:        if (std)
        !            34:                fplt( stdin );
        !            35:        exit(0);
        !            36:        }
        !            37: 
        !            38: 
        !            39: fplt(fin)  FILE *fin; {
        !            40:        int c;
        !            41:        char s[256];
        !            42:        int xi,yi,x0,y0,x1,y1,r,dx,n,i;
        !            43:        int pat[256];
        !            44: 
        !            45:        openpl();
        !            46:        while((c=getc(fin)) != EOF){
        !            47:                switch(c){
        !            48:                case 'm':
        !            49:                        xi = getsi(fin);
        !            50:                        yi = getsi(fin);
        !            51:                        move(xi,yi);
        !            52:                        break;
        !            53:                case 'l':
        !            54:                        x0 = getsi(fin);
        !            55:                        y0 = getsi(fin);
        !            56:                        x1 = getsi(fin);
        !            57:                        y1 = getsi(fin);
        !            58:                        line(x0,y0,x1,y1);
        !            59:                        break;
        !            60:                case 't':
        !            61:                        gets(s,fin);
        !            62:                        label(s);
        !            63:                        break;
        !            64:                case 'e':
        !            65:                        erase();
        !            66:                        break;
        !            67:                case 'p':
        !            68:                        xi = getsi(fin);
        !            69:                        yi = getsi(fin);
        !            70:                        point(xi,yi);
        !            71:                        break;
        !            72:                case 'n':
        !            73:                        xi = getsi(fin);
        !            74:                        yi = getsi(fin);
        !            75:                        cont(xi,yi);
        !            76:                        break;
        !            77:                case 's':
        !            78:                        x0 = getsi(fin);
        !            79:                        y0 = getsi(fin);
        !            80:                        x1 = getsi(fin);
        !            81:                        y1 = getsi(fin);
        !            82:                        space(x0,y0,x1,y1);
        !            83:                        break;
        !            84:                case 'a':
        !            85:                        xi = getsi(fin);
        !            86:                        yi = getsi(fin);
        !            87:                        x0 = getsi(fin);
        !            88:                        y0 = getsi(fin);
        !            89:                        x1 = getsi(fin);
        !            90:                        y1 = getsi(fin);
        !            91:                        arc(xi,yi,x0,y0,x1,y1);
        !            92:                        break;
        !            93:                case 'c':
        !            94:                        xi = getsi(fin);
        !            95:                        yi = getsi(fin);
        !            96:                        r = getsi(fin);
        !            97:                        circle(xi,yi,r);
        !            98:                        break;
        !            99:                case 'f':
        !           100:                        gets(s,fin);
        !           101:                        linemod(s);
        !           102:                        break;
        !           103:                case 'd':
        !           104:                        xi = getsi(fin);
        !           105:                        yi = getsi(fin);
        !           106:                        dx = getsi(fin);
        !           107:                        n = getsi(fin);
        !           108:                        for(i=0; i<n; i++)pat[i] = getsi(fin);
        !           109:                        dot(xi,yi,dx,n,pat);
        !           110:                        break;
        !           111:                        }
        !           112:                }
        !           113:        closepl();
        !           114:        }
        !           115: getsi(fin)  FILE *fin; {       /* get an integer stored in 2 ascii bytes. */
        !           116:        short a, b;
        !           117:        if((b = getc(fin)) == EOF)
        !           118:                return(EOF);
        !           119:        if((a = getc(fin)) == EOF)
        !           120:                return(EOF);
        !           121:        a = a<<8;
        !           122:        return(a|b);
        !           123: }
        !           124: gets(s,fin)  char *s;  FILE *fin; {
        !           125:        for( ; *s = getc(fin); s++)
        !           126:                if(*s == '\n')
        !           127:                        break;
        !           128:        *s = '\0';
        !           129:        return;
        !           130: }

unix.superglobalmegacorp.com

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