ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/xform.c
(Generate patch)

Comparing ray/src/gen/xform.c (file contents):
Revision 2.23 by greg, Sat Feb 22 02:07:24 2003 UTC vs.
Revision 2.28 by schorsch, Mon Jun 30 14:59:11 2003 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char       RCSid[] = "$Id$";
2 > static const char RCSid[] = "$Id$";
3   #endif
4   /*
5   *  xform.c - program to transform object files.
# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9   *     11/6/86          Finally added error checking!
10   */
11  
12 #include  "standard.h"
13
14 #include  "paths.h"
15
12   #include  <ctype.h>
13 + #include  <unistd.h>
14  
15 + #include  "standard.h"
16 + #include  "platform.h"
17 + #include  "paths.h"
18   #include  "object.h"
19
19   #include  "otypes.h"
20  
21   int  xac;                               /* global xform argument count */
# Line 34 | Line 33 | char  *newmod;                         /* new modifier for surfaces */
33  
34   char  *idprefix;                        /* prefix for object identifiers */
35  
36 < #define  ALIAS          NUMOTYPE        /* put alias at end of array */
36 > FUN  ofun[NUMOTYPE] = INIT_OTYPE;       /* default types and actions */
37  
39 #define  NUMTYPES       (NUMOTYPE+1)    /* total number of object types */
40
41 FUN  ofun[NUMTYPES] = INIT_OTYPE;       /* default types and actions */
42
38   short  tinvers[NUMOTYPE];               /* inverse types for surfaces */
39  
40   int  nrept = 1;                         /* number of array repetitions */
41  
42   int stdinused = 0;                      /* stdin has been used by -f option? */
43  
44 < char  mainfn[MAXPATH];                  /* main file name */
44 > char  mainfn[PATH_MAX];                 /* main file name */
45   FILE  *mainfp = NULL;                   /* main file pointer */
46  
47   #define  progname  (xav[0])
# Line 492 | Line 487 | FILE  *fin;
487   }
488  
489  
495 int
496 otype(ofname)                   /* get object function number from its name */
497 register char  *ofname;
498 {
499        register int  i;
500
501        for (i = 0; i < NUMTYPES; i++)
502                if (!strcmp(ofun[i].funame, ofname))
503                        return(i);
504
505        return(-1);             /* not found */
506 }
507
508
490   alias(fin)                      /* transfer alias */
491   FILE  *fin;
492   {
# Line 842 | Line 823 | initotypes()                   /* initialize ofun[] array */
823  
824          if (ofun[OBJ_SOURCE].funp == o_source)
825                  return;                 /* done already */
845                                        /* alias is additional */
846        ofun[ALIAS].funame = ALIASID;
847        ofun[ALIAS].flags = 0;
826                                          /* functions get new transform */
827 <        for (i = 0; i < NUMTYPES; i++)
827 >        for (i = 0; i < NUMOTYPE; i++)
828                  if (hasfunc(i))
829                          ofun[i].funp = addxform;
830                                          /* special cases */
# Line 868 | Line 846 | initotypes()                   /* initialize ofun[] array */
846          ofun[PAT_CTEXT].funp =
847          ofun[PAT_BTEXT].funp =
848          ofun[MIX_TEXT].funp = text;
849 <        ofun[ALIAS].funp = alias;
849 >        ofun[MOD_ALIAS].funp = alias;
850                                          /* surface inverses */
851          tinvers[OBJ_FACE] = OBJ_FACE;
852          tinvers[OBJ_SOURCE] = OBJ_SOURCE;
# Line 910 | Line 888 | char  *fname;
888   openmain(iname)         /* open input, changing directory for file */
889   char  *iname;
890   {
891 <        static char  origdir[MAXPATH];
892 <        static char  curfn[MAXPATH];
891 >        static char  origdir[PATH_MAX];
892 >        static char  curfn[PATH_MAX];
893          static int  diffdir;
894          register char  *fpath;
895  
# Line 937 | Line 915 | char  *iname;
915                  return;
916          }
917          if (mainfp == NULL) {                   /* first call, initialize */
918 <                getwd(origdir);
918 >                getcwd(origdir, sizeof(origdir));
919          } else if (!strcmp(iname, curfn)) {     /* just need to rewind? */
920                  rewind(mainfp);
921                  return;
# Line 951 | Line 929 | char  *iname;
929          }
930          strcpy(curfn, iname);                   /* remember input name */
931                                                  /* get full path for file */
932 <        if ((fpath = getpath(iname, getlibpath(), R_OK)) == NULL) {
932 >        if ((fpath = getpath(iname, getrlibpath(), R_OK)) == NULL) {
933                  fprintf(stderr, "%s: cannot find file \"%s\"\n",
934                                  progname, iname);
935                  exit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines