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

Comparing ray/src/ot/readobj2.c (file contents):
Revision 2.1 by greg, Tue Nov 12 17:01:03 1991 UTC vs.
Revision 2.4 by greg, Sat Feb 22 02:07:26 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  readobj2.c - routines for reading in object descriptions.
6   */
# Line 18 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15  
16   extern char  *fgetword();
17  
18 < OBJREC  *objblock[MAXOBJBLK];           /* our objects */
22 < OBJECT  nobjects = 0;                   /* # of objects */
23 < int newobject() {return(0);}
24 <
25 <
26 < readobj(input, callback)        /* read in an object file or stream */
18 > readobj2(input, callback)       /* read in an object file or stream */
19   char  *input;
20   int  (*callback)();
21   {
22          FILE  *popen();
23 <        char  *fgets(), *fgetline();
23 >        char  *fgetline();
24          FILE  *infp;
25          char  buf[512];
26          register int  c;
# Line 53 | Line 45 | int  (*callback)();
45                  } else if (c == '!') {                  /* command */
46                          ungetc(c, infp);
47                          fgetline(buf, sizeof(buf), infp);
48 <                        readobj(buf, callback);
48 >                        readobj2(buf, callback);
49                  } else {                                /* object */
50                          ungetc(c, infp);
51 <                        getobject(input, infp, callback);
51 >                        getobject2(input, infp, callback);
52                  }
53          }
54          if (input[0] == '!')
# Line 66 | Line 58 | int  (*callback)();
58   }
59  
60  
61 < getobject(name, fp, f)                  /* read the next object */
61 > getobject2(name, fp, f)                 /* read the next object */
62   char  *name;
63   FILE  *fp;
64   int  (*f)();
# Line 97 | Line 89 | int  (*f)();
89                  objerror(&thisobj, USER, errmsg);
90          }
91          thisobj.os = NULL;
100        thisobj.lastrno = -1;
92                                          /* call function */
93          (*f)(&thisobj);
94                                          /* free memory */
104        if (thisobj.os != NULL)
105                switch (thisobj.otype) {
106                case OBJ_CONE:
107                case OBJ_CUP:
108                case OBJ_CYLINDER:
109                case OBJ_TUBE:
110                case OBJ_RING:
111                        freecone(&thisobj);
112                        break;
113                case OBJ_FACE:
114                        freeface(&thisobj);
115                        break;
116                case OBJ_INSTANCE:
117                        freeinstance(&thisobj);
118                        break;
119                }
95          freefargs(&thisobj.oargs);
96 +        free_os(&thisobj);
97   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines