| 1 | 
greg | 
1.1 | 
#ifndef lint | 
| 2 | 
  | 
  | 
static const char       RCSid[] = "$Id$"; | 
| 3 | 
  | 
  | 
#endif | 
| 4 | 
  | 
  | 
/* | 
| 5 | 
  | 
  | 
 *  Routines for primitive output | 
| 6 | 
  | 
  | 
 * | 
| 7 | 
  | 
  | 
 *      1/10/85 | 
| 8 | 
  | 
  | 
 */ | 
| 9 | 
  | 
  | 
 | 
| 10 | 
  | 
  | 
 | 
| 11 | 
  | 
  | 
#include  "meta.h" | 
| 12 | 
  | 
  | 
 | 
| 13 | 
  | 
  | 
 | 
| 14 | 
  | 
  | 
FILE  *pout = NULL;             /* the primitive output stream */ | 
| 15 | 
  | 
  | 
 | 
| 16 | 
  | 
  | 
 | 
| 17 | 
  | 
  | 
plseg(a0, xstart, ystart, xend, yend)           /* plot line segment */ | 
| 18 | 
  | 
  | 
 | 
| 19 | 
  | 
  | 
int     a0, xstart, ystart, xend, yend; | 
| 20 | 
  | 
  | 
 | 
| 21 | 
  | 
  | 
{ | 
| 22 | 
  | 
  | 
    PRIMITIVE   p; | 
| 23 | 
  | 
  | 
    int         reverse; | 
| 24 | 
  | 
  | 
 | 
| 25 | 
  | 
  | 
    if (xstart < xend) { | 
| 26 | 
  | 
  | 
        p.xy[XMN] = xstart; | 
| 27 | 
  | 
  | 
        p.xy[XMX] = xend; | 
| 28 | 
  | 
  | 
        reverse = FALSE; | 
| 29 | 
  | 
  | 
    } else { | 
| 30 | 
  | 
  | 
        p.xy[XMN] = xend; | 
| 31 | 
  | 
  | 
        p.xy[XMX] = xstart; | 
| 32 | 
  | 
  | 
        reverse = TRUE; | 
| 33 | 
  | 
  | 
    } | 
| 34 | 
  | 
  | 
 | 
| 35 | 
  | 
  | 
    if (ystart < yend) { | 
| 36 | 
  | 
  | 
        p.xy[YMN] = ystart; | 
| 37 | 
  | 
  | 
        p.xy[YMX] = yend; | 
| 38 | 
  | 
  | 
    } else { | 
| 39 | 
  | 
  | 
        p.xy[YMN] = yend; | 
| 40 | 
  | 
  | 
        p.xy[YMX] = ystart; | 
| 41 | 
  | 
  | 
        reverse = ystart > yend && !reverse; | 
| 42 | 
  | 
  | 
    } | 
| 43 | 
  | 
  | 
 | 
| 44 | 
  | 
  | 
    p.com = PLSEG; | 
| 45 | 
  | 
  | 
    p.arg0 = (reverse << 6) | a0; | 
| 46 | 
  | 
  | 
    p.args = NULL; | 
| 47 | 
  | 
  | 
 | 
| 48 | 
  | 
  | 
    writep(&p, pout); | 
| 49 | 
  | 
  | 
 | 
| 50 | 
  | 
  | 
} | 
| 51 | 
  | 
  | 
 | 
| 52 | 
  | 
  | 
 | 
| 53 | 
  | 
  | 
 | 
| 54 | 
  | 
  | 
 | 
| 55 | 
  | 
  | 
 | 
| 56 | 
  | 
  | 
 | 
| 57 | 
  | 
  | 
pprim(co, a0, xmin, ymin, xmax, ymax, s)        /* print primitive */ | 
| 58 | 
  | 
  | 
 | 
| 59 | 
  | 
  | 
int     co, a0, xmin, ymin, xmax, ymax; | 
| 60 | 
  | 
  | 
char    *s; | 
| 61 | 
  | 
  | 
 | 
| 62 | 
  | 
  | 
{ | 
| 63 | 
  | 
  | 
    PRIMITIVE   p; | 
| 64 | 
  | 
  | 
 | 
| 65 | 
  | 
  | 
    p.com = co; | 
| 66 | 
  | 
  | 
    p.arg0 = a0; | 
| 67 | 
  | 
  | 
    p.xy[XMN] = xmin; | 
| 68 | 
  | 
  | 
    p.xy[YMN] = ymin; | 
| 69 | 
  | 
  | 
    p.xy[XMX] = xmax; | 
| 70 | 
  | 
  | 
    p.xy[YMX] = ymax; | 
| 71 | 
  | 
  | 
    p.args = s; | 
| 72 | 
  | 
  | 
 | 
| 73 | 
  | 
  | 
    writep(&p, pout); | 
| 74 | 
  | 
  | 
 | 
| 75 | 
  | 
  | 
} | 
| 76 | 
  | 
  | 
 | 
| 77 | 
  | 
  | 
 | 
| 78 | 
  | 
  | 
 | 
| 79 | 
  | 
  | 
 | 
| 80 | 
  | 
  | 
pglob(co, a0, s)                        /* print global */ | 
| 81 | 
  | 
  | 
 | 
| 82 | 
  | 
  | 
int  co, a0; | 
| 83 | 
  | 
  | 
char  *s; | 
| 84 | 
  | 
  | 
 | 
| 85 | 
  | 
  | 
{ | 
| 86 | 
  | 
  | 
    PRIMITIVE  p; | 
| 87 | 
  | 
  | 
     | 
| 88 | 
  | 
  | 
    p.com = co; | 
| 89 | 
  | 
  | 
    p.arg0 = a0; | 
| 90 | 
  | 
  | 
    p.xy[XMN] = p.xy[YMN] = p.xy[XMX] = p.xy[YMX] = -1; | 
| 91 | 
  | 
  | 
    p.args = s; | 
| 92 | 
  | 
  | 
 | 
| 93 | 
  | 
  | 
    writep(&p, pout); | 
| 94 | 
  | 
  | 
 | 
| 95 | 
  | 
  | 
} |