--- ray/src/gen/xform.c 2003/02/22 02:07:24 2.23 +++ ray/src/gen/xform.c 2003/06/30 14:59:11 2.28 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: xform.c,v 2.23 2003/02/22 02:07:24 greg Exp $"; +static const char RCSid[] = "$Id: xform.c,v 2.28 2003/06/30 14:59:11 schorsch Exp $"; #endif /* * xform.c - program to transform object files. @@ -9,14 +9,13 @@ static const char RCSid[] = "$Id: xform.c,v 2.23 2003/ * 11/6/86 Finally added error checking! */ -#include "standard.h" - -#include "paths.h" - #include +#include +#include "standard.h" +#include "platform.h" +#include "paths.h" #include "object.h" - #include "otypes.h" int xac; /* global xform argument count */ @@ -34,19 +33,15 @@ char *newmod; /* new modifier for surfaces */ char *idprefix; /* prefix for object identifiers */ -#define ALIAS NUMOTYPE /* put alias at end of array */ +FUN ofun[NUMOTYPE] = INIT_OTYPE; /* default types and actions */ -#define NUMTYPES (NUMOTYPE+1) /* total number of object types */ - -FUN ofun[NUMTYPES] = INIT_OTYPE; /* default types and actions */ - short tinvers[NUMOTYPE]; /* inverse types for surfaces */ int nrept = 1; /* number of array repetitions */ int stdinused = 0; /* stdin has been used by -f option? */ -char mainfn[MAXPATH]; /* main file name */ +char mainfn[PATH_MAX]; /* main file name */ FILE *mainfp = NULL; /* main file pointer */ #define progname (xav[0]) @@ -492,20 +487,6 @@ FILE *fin; } -int -otype(ofname) /* get object function number from its name */ -register char *ofname; -{ - register int i; - - for (i = 0; i < NUMTYPES; i++) - if (!strcmp(ofun[i].funame, ofname)) - return(i); - - return(-1); /* not found */ -} - - alias(fin) /* transfer alias */ FILE *fin; { @@ -842,11 +823,8 @@ initotypes() /* initialize ofun[] array */ if (ofun[OBJ_SOURCE].funp == o_source) return; /* done already */ - /* alias is additional */ - ofun[ALIAS].funame = ALIASID; - ofun[ALIAS].flags = 0; /* functions get new transform */ - for (i = 0; i < NUMTYPES; i++) + for (i = 0; i < NUMOTYPE; i++) if (hasfunc(i)) ofun[i].funp = addxform; /* special cases */ @@ -868,7 +846,7 @@ initotypes() /* initialize ofun[] array */ ofun[PAT_CTEXT].funp = ofun[PAT_BTEXT].funp = ofun[MIX_TEXT].funp = text; - ofun[ALIAS].funp = alias; + ofun[MOD_ALIAS].funp = alias; /* surface inverses */ tinvers[OBJ_FACE] = OBJ_FACE; tinvers[OBJ_SOURCE] = OBJ_SOURCE; @@ -910,8 +888,8 @@ char *fname; openmain(iname) /* open input, changing directory for file */ char *iname; { - static char origdir[MAXPATH]; - static char curfn[MAXPATH]; + static char origdir[PATH_MAX]; + static char curfn[PATH_MAX]; static int diffdir; register char *fpath; @@ -937,7 +915,7 @@ char *iname; return; } if (mainfp == NULL) { /* first call, initialize */ - getwd(origdir); + getcwd(origdir, sizeof(origdir)); } else if (!strcmp(iname, curfn)) { /* just need to rewind? */ rewind(mainfp); return; @@ -951,7 +929,7 @@ char *iname; } strcpy(curfn, iname); /* remember input name */ /* get full path for file */ - if ((fpath = getpath(iname, getlibpath(), R_OK)) == NULL) { + if ((fpath = getpath(iname, getrlibpath(), R_OK)) == NULL) { fprintf(stderr, "%s: cannot find file \"%s\"\n", progname, iname); exit(1);