Annotation of researchv10no/libplot/libpen/subr.c, revision 1.1.1.1

1.1       root        1: #include "pen.h"
                      2: double DX, DY;
                      3: int res = 0;
                      4: struct penvir E[9];
                      5: struct penvir *e0 = E, *e1 = &E[1];
                      6: struct penvir *esave;
                      7: int penstate = UP;
                      8: int noscale = 1;
                      9: FILE *pltin, *pltout;
                     10: char *pens[4] = {
                     11:        "black",
                     12:        "red",
                     13:        "green",
                     14:        "blue"
                     15: };
                     16: ckerr(doit)
                     17: {
                     18:        register int i;
                     19:        static int count;
                     20: 
                     21:        if(doit) count = 0;
                     22:        if(count >= 250) count = 0;
                     23:        if(count++ != 0) return;
                     24:        fprintf(pltout,"OE;\n");
                     25:        fflush(pltout);
                     26:        i = readInt(pltin);
                     27:        if(i > 0){
                     28:                fprintf(stderr,"plotter error %d\n",i);
                     29:                exit(1);
                     30:        }
                     31: }
                     32: float theta(x1,y1,x2,y2,xc,yc,r)
                     33: double x1,y1,x2,y2,xc,yc,r;
                     34: {
                     35:        float radians, degrees;
                     36:        radians = atan2((y2-yc), (x2-xc)) - atan2((y1-yc),(x1-xc));
                     37:        if(radians < 0)radians += 2*PI;
                     38:        if(r < 0)radians = (2*PI) - radians;
                     39:        degrees = (radians * 180.) / PI;
                     40:        return( (r<0)? -degrees : degrees);
                     41: }
                     42: int
                     43: readInt(f)
                     44: FILE *f;
                     45: {
                     46:        register i, c;
                     47:        int sign = 1;
                     48:        i = 0;
                     49:        for(;;) {
                     50:                c = getc(f);
                     51:                if(c == EOF) {
                     52:                        fprintf(stderr, "eof on plotter\n");
                     53:                        exit(1);
                     54:                }
                     55:                c &= 0177;
                     56:                if(c == '-'){
                     57:                        sign = -1;
                     58:                        c = getc(f) & 0177;
                     59:                        break;
                     60:                }
                     61:                if(c >= '0' && c <= '9')
                     62:                        break;
                     63:        }
                     64:        while(c >= '0' && c <= '9') {
                     65:                i = 10*i + c - '0';
                     66:                c = getc(f) & 0177;
                     67:        }
                     68:        i *= sign;
                     69:        return(i);
                     70: }
                     71: sscpy(f,t)
                     72: struct penvir *f, *t;
                     73: {
                     74:        t->scale = f->scale;
                     75:        t->xmax = f->xmax;
                     76:        t->ymax = f->ymax;
                     77:        t->xmin = f->xmin;
                     78:        t->ymin = f->ymin;
                     79:        t->copyx = f->copyx;
                     80:        t->copyy = f->copyy;
                     81:        t->p1x = f->p1x;
                     82:        t->p1y = f->p1y;
                     83:        t->p2x = f->p2x;
                     84:        t->p2y = f->p2y;
                     85:        t->charsz = f->charsz;
                     86:        t->pen = f->pen;
                     87:        t->brush = f->brush;
                     88:        t->pentype = f->pentype;
                     89:        t->pslant = f->pslant;
                     90:        t->pgap = f->pgap;
                     91: }
                     92: float
                     93: normx(x)
                     94: double x;
                     95: {
                     96:        return(x);
                     97: }
                     98: float
                     99: normy(y)
                    100: double y;
                    101: {
                    102:        return(y);
                    103: }
                    104: unorm(){}

unix.superglobalmegacorp.com

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