--- ray/src/meta/expand.c 2003/02/22 02:07:26 1.1 +++ ray/src/meta/expand.c 2003/11/15 02:13:36 1.4 @@ -1,15 +1,15 @@ #ifndef lint -static const char RCSid[] = "$Id: expand.c,v 1.1 2003/02/22 02:07:26 greg Exp $"; +static const char RCSid[] = "$Id: expand.c,v 1.4 2003/11/15 02:13:36 schorsch Exp $"; #endif /* * Expansion routine for command implementation * on simple drivers */ +#include #include "meta.h" - /* vector characters file */ #define VINPUT "vchars.mta" @@ -26,15 +26,22 @@ static const char RCSid[] = "$Id: expand.c,v 1.1 2003/ static short *xlist; /* pointer to expansion list */ +static void exfile(FILE *fp); +static void exprim(PRIMITIVE *p); +static void sendmstr(register PRIMITIVE *p); +static void sendvstr(register PRIMITIVE *p); +static void include(int code, char *fname); +static void polyfill(PRIMITIVE *p); +static void polyedge(PRIMITIVE *p, int x1, int y1, int x2, int y2); -expand(infp, exlist) /* expand requested commands */ - -FILE *infp; -short *exlist; - +void +expand( /* expand requested commands */ +FILE *infp, +short *exlist +) { - static PRIMITIVE pincl = {PINCL, 02, -1, -1, -1, -1, VINPUT}; + static PRIMITIVE pincl = {PINCL, 02, {-1, -1, -1, -1}, VINPUT, NULL}; static short vcloaded = FALSE; xlist = exlist; @@ -54,11 +61,10 @@ short *exlist; -static -exfile(fp) /* expand the given file */ - -register FILE *fp; - +static void +exfile( /* expand the given file */ +register FILE *fp +) { PRIMITIVE curp; @@ -72,15 +78,14 @@ register FILE *fp; -static -exprim(p) /* expand primitive */ - -register PRIMITIVE *p; - +static void +exprim( /* expand primitive */ +register PRIMITIVE *p +) { int xflag = xlist[comndx(p->com)]; /* 1==expand, 0==pass, -1==discard */ - if (xflag != -1) + if (xflag != -1) { if (xflag == 1) switch (p->com) { @@ -121,17 +126,16 @@ register PRIMITIVE *p; segprim(p); else writep(p, stdout); - + } } -static -sendmstr(p) /* expand a matrix string */ - -register PRIMITIVE *p; - +static void +sendmstr( /* expand a matrix string */ +register PRIMITIVE *p +) { PRIMITIVE pout; int cheight, cwidth, cthick, ccol; @@ -161,14 +165,13 @@ register PRIMITIVE *p; -static -sendvstr(p) /* expand a vector string */ - -register PRIMITIVE *p; - +static void +sendvstr( /* expand a vector string */ +register PRIMITIVE *p +) { PRIMITIVE pout; - int xadv, yadv; + int xadv = 0, yadv = 0; char s[3]; register char *cp; @@ -233,25 +236,25 @@ register PRIMITIVE *p; -static -include(code, fname) /* load an include file */ - -int code; -char *fname; - +static void +include( /* load an include file */ +int code, +char *fname +) { - register FILE *fp; + register FILE *fp = NULL; if (fname == NULL) error(USER, "missing include file name in include"); - if (code == 2 || (fp = fopen(fname, "r")) == NULL) + if (code == 2 || (fp = fopen(fname, "r")) == NULL) { if (code != 0) fp = mfopen(fname, "r"); else { sprintf(errmsg, "cannot open user include file \"%s\"", fname); error(USER, errmsg); } + } exfile(fp); fclose(fp); @@ -260,14 +263,13 @@ char *fname; -static -polyfill(p) /* expand polygon fill command */ - -PRIMITIVE *p; - +static void +polyfill( /* expand polygon fill command */ +PRIMITIVE *p +) { - char *nextscan(); - int firstx, firsty, lastx, lasty, x, y; + char firstx, firsty, x, y; + int lastx, lasty; register char *cp; if ((cp=nextscan(nextscan(p->args,"%d",&firstx),"%d",&firsty)) == NULL) { @@ -291,12 +293,11 @@ PRIMITIVE *p; -static -polyedge(p, x1, y1, x2, y2) /* expand edge of polygon */ - -PRIMITIVE *p; -int x1, y1, x2, y2; - +static void +polyedge( /* expand edge of polygon */ +PRIMITIVE *p, +int x1, int y1, int x2, int y2 +) { int reverse; PRIMITIVE pin, pout;