| 6 | 
  | 
 */ | 
| 7 | 
  | 
 | 
| 8 | 
  | 
 | 
| 9 | 
+ | 
#include  <stdio.h> | 
| 10 | 
+ | 
#include  <string.h> | 
| 11 | 
  | 
#include  <fcntl.h> | 
| 12 | 
  | 
 | 
| 13 | 
+ | 
#include  "platform.h" | 
| 14 | 
  | 
#include  "meta.h" | 
| 12 | 
– | 
 | 
| 15 | 
  | 
#include  "plot.h" | 
| 14 | 
– | 
 | 
| 16 | 
  | 
#include  "span.h" | 
| 17 | 
  | 
 | 
| 18 | 
  | 
 | 
| 23 | 
  | 
 | 
| 24 | 
  | 
static PRIMITIVE  nextp; | 
| 25 | 
  | 
 | 
| 26 | 
+ | 
static void initplot(void); | 
| 27 | 
+ | 
static void plotspan(FILE *infp); | 
| 28 | 
+ | 
static void doglobal(PRIMITIVE *g); | 
| 29 | 
+ | 
static void doprim(PRIMITIVE *p); | 
| 30 | 
+ | 
static void outputspan(void); | 
| 31 | 
+ | 
static void tfill(PRIMITIVE *p); | 
| 32 | 
+ | 
static void fill(int attrib, int xmin, int ymin, int xmax, int ymax); | 
| 33 | 
+ | 
static void paintline(int x, int y, int run, int rise, int hrad, int vrad, | 
| 34 | 
+ | 
        int lpat, long run2, long rise2, int n); | 
| 35 | 
+ | 
static void nextspan(void); | 
| 36 | 
  | 
 | 
| 37 | 
  | 
 | 
| 38 | 
< | 
plot(infp)              /* plot meta-file */ | 
| 39 | 
< | 
 | 
| 40 | 
< | 
FILE  *infp; | 
| 41 | 
< | 
 | 
| 38 | 
> | 
void | 
| 39 | 
> | 
plot(           /* plot meta-file */ | 
| 40 | 
> | 
        FILE  *infp | 
| 41 | 
> | 
) | 
| 42 | 
  | 
{ | 
| 43 | 
  | 
 | 
| 44 | 
  | 
    do { | 
| 53 | 
  | 
} | 
| 54 | 
  | 
 | 
| 55 | 
  | 
 | 
| 56 | 
< | 
 | 
| 57 | 
< | 
 | 
| 47 | 
< | 
 | 
| 48 | 
< | 
initplot()                      /* initialize this plot */ | 
| 49 | 
< | 
 | 
| 56 | 
> | 
void | 
| 57 | 
> | 
initplot(void)                  /* initialize this plot */ | 
| 58 | 
  | 
{ | 
| 51 | 
– | 
 | 
| 59 | 
  | 
    thispage(); | 
| 60 | 
  | 
    outspan.xleft = 0; | 
| 61 | 
  | 
    outspan.xright = dxsize - 1; | 
| 66 | 
  | 
 | 
| 67 | 
  | 
 | 
| 68 | 
  | 
 | 
| 69 | 
< | 
 | 
| 70 | 
< | 
 | 
| 71 | 
< | 
doglobal(g)                     /* execute a global command */ | 
| 72 | 
< | 
 | 
| 66 | 
< | 
PRIMITIVE  *g; | 
| 67 | 
< | 
 | 
| 69 | 
> | 
void | 
| 70 | 
> | 
doglobal(                       /* execute a global command */ | 
| 71 | 
> | 
        PRIMITIVE  *g | 
| 72 | 
> | 
) | 
| 73 | 
  | 
{ | 
| 74 | 
  | 
    char  c; | 
| 75 | 
  | 
    int  tty; | 
| 129 | 
  | 
 | 
| 130 | 
  | 
 | 
| 131 | 
  | 
 | 
| 132 | 
< | 
 | 
| 133 | 
< | 
 | 
| 134 | 
< | 
plotspan(infp)                  /* plot next span */ | 
| 135 | 
< | 
 | 
| 131 | 
< | 
FILE  *infp; | 
| 132 | 
< | 
 | 
| 132 | 
> | 
void | 
| 133 | 
> | 
plotspan(                       /* plot next span */ | 
| 134 | 
> | 
        FILE  *infp | 
| 135 | 
> | 
) | 
| 136 | 
  | 
{ | 
| 137 | 
  | 
    PLIST  lastinq; | 
| 138 | 
  | 
    register PRIMITIVE  *p; | 
| 159 | 
  | 
} | 
| 160 | 
  | 
 | 
| 161 | 
  | 
 | 
| 162 | 
< | 
 | 
| 163 | 
< | 
 | 
| 161 | 
< | 
 | 
| 162 | 
< | 
nextspan()              /* prepare next span */ | 
| 163 | 
< | 
 | 
| 162 | 
> | 
void | 
| 163 | 
> | 
nextspan(void)          /* prepare next span */ | 
| 164 | 
  | 
{ | 
| 165 | 
  | 
    register int  i; | 
| 166 | 
  | 
    register char  *colp, *tcolp; | 
| 182 | 
  | 
} | 
| 183 | 
  | 
 | 
| 184 | 
  | 
 | 
| 185 | 
< | 
 | 
| 186 | 
< | 
outputspan()            /* output span to printer */ | 
| 185 | 
> | 
void | 
| 186 | 
> | 
outputspan(void)                /* output span to printer */ | 
| 187 | 
  | 
{ | 
| 188 | 
  | 
    register int  i; | 
| 189 | 
  | 
    register char  *colp, *tcolp; | 
| 200 | 
  | 
} | 
| 201 | 
  | 
 | 
| 202 | 
  | 
 | 
| 203 | 
< | 
 | 
| 204 | 
< | 
doprim(p)               /* plot primitive */ | 
| 205 | 
< | 
 | 
| 206 | 
< | 
register PRIMITIVE  *p; | 
| 207 | 
< | 
 | 
| 203 | 
> | 
void | 
| 204 | 
> | 
doprim(         /* plot primitive */ | 
| 205 | 
> | 
register PRIMITIVE  *p | 
| 206 | 
> | 
) | 
| 207 | 
  | 
{ | 
| 208 | 
  | 
    register PRIMITIVE  *newp; | 
| 209 | 
  | 
     | 
| 246 | 
  | 
 | 
| 247 | 
  | 
 | 
| 248 | 
  | 
 | 
| 249 | 
< | 
 | 
| 250 | 
< | 
 | 
| 251 | 
< | 
plotlseg(p)             /* plot a line segment */ | 
| 252 | 
< | 
 | 
| 254 | 
< | 
register PRIMITIVE  *p; | 
| 255 | 
< | 
 | 
| 249 | 
> | 
void | 
| 250 | 
> | 
plotlseg(               /* plot a line segment */ | 
| 251 | 
> | 
        register PRIMITIVE  *p | 
| 252 | 
> | 
) | 
| 253 | 
  | 
{ | 
| 254 | 
  | 
    register int  ti; | 
| 255 | 
  | 
    long  run2 = 0L, rise2 = 0L; | 
| 307 | 
  | 
 *  This routine paints a line with calls to fill().  The line can | 
| 308 | 
  | 
 *    start and end at arbitrary points on a longer line segment. | 
| 309 | 
  | 
 */ | 
| 310 | 
< | 
 | 
| 311 | 
< | 
paintline(x, y, run, rise, hrad, vrad, lpat, run2, rise2, n) | 
| 312 | 
< | 
 | 
| 313 | 
< | 
register int  x, y; | 
| 314 | 
< | 
int  run, rise; | 
| 315 | 
< | 
int  hrad, vrad; | 
| 316 | 
< | 
int  lpat; | 
| 317 | 
< | 
long  run2, rise2; | 
| 318 | 
< | 
int  n; | 
| 319 | 
< | 
 | 
| 310 | 
> | 
void | 
| 311 | 
> | 
paintline( | 
| 312 | 
> | 
        register int  x, | 
| 313 | 
> | 
        register int  y, | 
| 314 | 
> | 
        int  run, | 
| 315 | 
> | 
        int  rise, | 
| 316 | 
> | 
        int  hrad, | 
| 317 | 
> | 
        int  vrad, | 
| 318 | 
> | 
        int  lpat, | 
| 319 | 
> | 
        long  run2, | 
| 320 | 
> | 
        long  rise2, | 
| 321 | 
> | 
        int  n | 
| 322 | 
> | 
) | 
| 323 | 
  | 
{ | 
| 324 | 
  | 
    int  xstep, ystep; | 
| 325 | 
  | 
 | 
| 364 | 
  | 
} | 
| 365 | 
  | 
 | 
| 366 | 
  | 
 | 
| 367 | 
< | 
 | 
| 368 | 
< | 
tfill(p)                        /* fill a triangle */ | 
| 369 | 
< | 
register PRIMITIVE  *p; | 
| 367 | 
> | 
void | 
| 368 | 
> | 
tfill(                  /* fill a triangle */ | 
| 369 | 
> | 
        register PRIMITIVE  *p | 
| 370 | 
> | 
) | 
| 371 | 
  | 
{ | 
| 372 | 
  | 
    register int  x, txmin, txmax;       | 
| 373 | 
  | 
    int  xmn, ymn, tpat; | 
| 411 | 
  | 
 | 
| 412 | 
  | 
 | 
| 413 | 
  | 
 | 
| 414 | 
< | 
 | 
| 415 | 
< | 
fill(attrib, xmin, ymin, xmax, ymax)    /* fill rectangle with attribute */ | 
| 416 | 
< | 
 | 
| 417 | 
< | 
int  attrib; | 
| 418 | 
< | 
int  xmin, ymin, xmax, ymax; | 
| 419 | 
< | 
 | 
| 414 | 
> | 
void | 
| 415 | 
> | 
fill(   /* fill rectangle with attribute */ | 
| 416 | 
> | 
        int  attrib, | 
| 417 | 
> | 
        int  xmin, | 
| 418 | 
> | 
        int ymin, | 
| 419 | 
> | 
        int xmax, | 
| 420 | 
> | 
        int ymax | 
| 421 | 
> | 
) | 
| 422 | 
  | 
{ | 
| 423 | 
  | 
    int  filpat; | 
| 424 | 
  | 
    int  rpos; |