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.3 by greg, Fri Jun 4 17:02:19 1993 UTC vs.
Revision 2.7 by greg, Wed Oct 22 02:06:34 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   */
7  
8 < #include  "standard.h"
8 > #include  <ctype.h>
9  
10 + #include  "platform.h"
11 + #include  "standard.h"
12   #include  "object.h"
14
13   #include  "otypes.h"
14  
17 #include  <ctype.h>
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   {
# 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 78 | Line 70 | int  (*f)();
70          thisobj.omod = OVOID;
71                                          /* get type */
72          fgetword(sbuf, MAXSTR, fp);
73 <        if (!strcmp(sbuf, ALIASID))
82 <                thisobj.otype = -1;
83 <        else if ((thisobj.otype = otype(sbuf)) < 0) {
73 >        if ((thisobj.otype = otype(sbuf)) < 0) {
74                  sprintf(errmsg, "(%s): unknown type \"%s\"", name, sbuf);
75                  error(USER, errmsg);
76          }
# Line 88 | Line 78 | int  (*f)();
78          fgetword(sbuf, MAXSTR, fp);
79          thisobj.oname = sbuf;
80                                          /* get arguments */
81 <        if (thisobj.otype == -1) {
81 >        if (thisobj.otype == MOD_ALIAS) {
82                  fscanf(fp, "%*s");
83                  return;
84          }
# Line 100 | Line 90 | int  (*f)();
90                                          /* call function */
91          (*f)(&thisobj);
92                                          /* free memory */
103        if (thisobj.os != NULL)
104                switch (thisobj.otype) {
105                case OBJ_CONE:
106                case OBJ_CUP:
107                case OBJ_CYLINDER:
108                case OBJ_TUBE:
109                case OBJ_RING:
110                        freecone(&thisobj);
111                        break;
112                case OBJ_FACE:
113                        freeface(&thisobj);
114                        break;
115                case OBJ_INSTANCE:
116                        freeinstance(&thisobj);
117                        break;
118                }
93          freefargs(&thisobj.oargs);
94 +        free_os(&thisobj);
95   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines