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

Comparing ray/src/common/modobject.c (file contents):
Revision 2.2 by greg, Sat Nov 21 21:35:38 1992 UTC vs.
Revision 2.3 by greg, Mon Feb 12 17:14:59 1996 UTC

# Line 25 | Line 25 | static struct ohtab {
25   static int  otndx();
26  
27  
28 #ifdef  GETOBJ
28   int
29 < object(oname)                   /* get an object number from its name */
30 < char  *oname;
29 > objndx(op)                      /* get object number from pointer */
30 > register OBJREC  *op;
31   {
32 <        register int  ndx;
32 >        register int  i, j;
33  
34 <        ndx = otndx(oname, &objtab);
35 <        return(objtab.htab[ndx]);
34 >        for (i = nobjects>>6; i >= 0; i--) {
35 >                j = op - objblock[i];
36 >                if (j >= 0 && j < 077)
37 >                        return((i<<6) + j);
38 >        }
39 >        return(OVOID);
40   }
38 #endif
41  
42  
43   int
44 + lastmod(obj, mname)             /* find modifier definition before obj */
45 + OBJECT  obj;
46 + char  *mname;
47 + {
48 +        register OBJREC  *op;
49 +        register int  i;
50 +
51 +        for (i = obj; i-- > 0; ) {
52 +                op = objptr(i);
53 +                if (ismodifier(op->otype) && !strcmp(op->oname, mname))
54 +                        return(i);
55 +        }
56 +        return(OVOID);
57 + }
58 +
59 +
60 + int
61   modifier(mname)                 /* get a modifier number from its name */
62   char  *mname;
63   {
# Line 49 | Line 68 | char  *mname;
68   }
69  
70  
71 + #ifdef  GETOBJ
72 + int
73 + object(oname)                   /* get an object number from its name */
74 + char  *oname;
75 + {
76 +        register int  ndx;
77 +
78 +        ndx = otndx(oname, &objtab);
79 +        return(objtab.htab[ndx]);
80 + }
81 + #endif
82 +
83 +
84   insertobject(obj)               /* insert new object into our list */
85   register OBJECT  obj;
86   {
87          register int  i;
88  
57 #ifdef  GETOBJ
58        i = otndx(objptr(obj)->oname, &objtab);
59        objtab.htab[i] = obj;
60 #endif
89          if (ismodifier(objptr(obj)->otype)) {
90                  i = otndx(objptr(obj)->oname, &modtab);
91                  modtab.htab[i] = obj;
92          }
93 + #ifdef  GETOBJ
94 +        else {
95 +                i = otndx(objptr(obj)->oname, &objtab);
96 +                objtab.htab[i] = obj;
97 +        }
98 + #endif
99          for (i = 0; addobjnotify[i] != NULL; i++)
100                  (*addobjnotify[i])(obj);
101   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines