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.29 by schorsch, Thu Jul 3 22:41:44 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 + #ifndef _WIN32
14 +  #include  <unistd.h>
15 + #endif
16  
17 + #include  "standard.h"
18 + #include  "platform.h"
19 + #include  "paths.h"
20   #include  "object.h"
19
21   #include  "otypes.h"
22  
23   int  xac;                               /* global xform argument count */
# Line 34 | Line 35 | char  *newmod;                         /* new modifier for surfaces */
35  
36   char  *idprefix;                        /* prefix for object identifiers */
37  
38 < #define  ALIAS          NUMOTYPE        /* put alias at end of array */
38 > FUN  ofun[NUMOTYPE] = INIT_OTYPE;       /* default types and actions */
39  
39 #define  NUMTYPES       (NUMOTYPE+1)    /* total number of object types */
40
41 FUN  ofun[NUMTYPES] = INIT_OTYPE;       /* default types and actions */
42
40   short  tinvers[NUMOTYPE];               /* inverse types for surfaces */
41  
42   int  nrept = 1;                         /* number of array repetitions */
43  
44   int stdinused = 0;                      /* stdin has been used by -f option? */
45  
46 < char  mainfn[MAXPATH];                  /* main file name */
46 > char  mainfn[PATH_MAX];                 /* main file name */
47   FILE  *mainfp = NULL;                   /* main file pointer */
48  
49   #define  progname  (xav[0])
# Line 492 | Line 489 | FILE  *fin;
489   }
490  
491  
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
492   alias(fin)                      /* transfer alias */
493   FILE  *fin;
494   {
# Line 842 | Line 825 | initotypes()                   /* initialize ofun[] array */
825  
826          if (ofun[OBJ_SOURCE].funp == o_source)
827                  return;                 /* done already */
845                                        /* alias is additional */
846        ofun[ALIAS].funame = ALIASID;
847        ofun[ALIAS].flags = 0;
828                                          /* functions get new transform */
829 <        for (i = 0; i < NUMTYPES; i++)
829 >        for (i = 0; i < NUMOTYPE; i++)
830                  if (hasfunc(i))
831                          ofun[i].funp = addxform;
832                                          /* special cases */
# Line 868 | Line 848 | initotypes()                   /* initialize ofun[] array */
848          ofun[PAT_CTEXT].funp =
849          ofun[PAT_BTEXT].funp =
850          ofun[MIX_TEXT].funp = text;
851 <        ofun[ALIAS].funp = alias;
851 >        ofun[MOD_ALIAS].funp = alias;
852                                          /* surface inverses */
853          tinvers[OBJ_FACE] = OBJ_FACE;
854          tinvers[OBJ_SOURCE] = OBJ_SOURCE;
# Line 910 | Line 890 | char  *fname;
890   openmain(iname)         /* open input, changing directory for file */
891   char  *iname;
892   {
893 <        static char  origdir[MAXPATH];
894 <        static char  curfn[MAXPATH];
893 >        static char  origdir[PATH_MAX];
894 >        static char  curfn[PATH_MAX];
895          static int  diffdir;
896          register char  *fpath;
897  
# Line 937 | Line 917 | char  *iname;
917                  return;
918          }
919          if (mainfp == NULL) {                   /* first call, initialize */
920 <                getwd(origdir);
920 >                getcwd(origdir, sizeof(origdir));
921          } else if (!strcmp(iname, curfn)) {     /* just need to rewind? */
922                  rewind(mainfp);
923                  return;
# Line 951 | Line 931 | char  *iname;
931          }
932          strcpy(curfn, iname);                   /* remember input name */
933                                                  /* get full path for file */
934 <        if ((fpath = getpath(iname, getlibpath(), R_OK)) == NULL) {
934 >        if ((fpath = getpath(iname, getrlibpath(), R_OK)) == NULL) {
935                  fprintf(stderr, "%s: cannot find file \"%s\"\n",
936                                  progname, iname);
937                  exit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines