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

Comparing ray/src/cv/mgflib/context.c (file contents):
Revision 1.2 by greg, Wed Jun 22 15:33:44 1994 UTC vs.
Revision 1.4 by greg, Fri Jun 24 09:32:49 1994 UTC

# Line 29 | Line 29 | C_COLOR                *c_ccolor = &c_uncolor;
29   C_MATERIAL      *c_cmaterial = &c_unmaterial;
30   C_VERTEX        *c_cvertex = &c_unvertex;
31  
32 < static LUTAB    clr_tab;                /* color lookup table */
33 < static LUTAB    mat_tab;                /* material lookup table */
34 < static LUTAB    vtx_tab;                /* vertex lookup table */
32 > static LUTAB    clr_tab = LU_SINIT(free,free);  /* color lookup table */
33 > static LUTAB    mat_tab = LU_SINIT(free,free);  /* material lookup table */
34 > static LUTAB    vtx_tab = LU_SINIT(free,free);  /* vertex lookup table */
35  
36  
37   int
# Line 43 | Line 43 | register char  **av;
43  
44          switch (mg_entity(av[0])) {
45          case MG_E_COLOR:        /* get/set color context */
46 +                if (ac > 4)
47 +                        return(MG_EARGC);
48                  if (ac == 1) {          /* set unnamed color context */
49                          c_uncolor = c_dfcolor;
50                          c_ccolor = &c_uncolor;
# Line 107 | Line 109 | register char  **av;
109  
110          switch (mg_entity(av[0])) {
111          case MG_E_MATERIAL:     /* get/set material context */
112 +                if (ac > 4)
113 +                        return(MG_EARGC);
114                  if (ac == 1) {          /* set unnamed material context */
115                          c_unmaterial = c_dfmaterial;
116                          c_cmaterial = &c_unmaterial;
# Line 221 | Line 225 | register char  **av;
225  
226          switch (mg_entity(av[0])) {
227          case MG_E_VERTEX:       /* get/set vertex context */
228 +                if (ac > 4)
229 +                        return(MG_EARGC);
230                  if (ac == 1) {          /* set unnamed vertex context */
231                          c_unvertex = c_dfvertex;
232                          c_cvertex = &c_unvertex;
# Line 284 | Line 290 | register char  **av;
290   }
291  
292  
287 static void
288 freectx(lp)                     /* free a context table entry */
289 register LUENT  *lp;
290 {
291        free((MEM_PTR)lp->key);
292        free((MEM_PTR)lp->data);
293 }
294
295
293   void
294   c_clearall()                    /* empty context tables */
295   {
296          c_uncolor = c_dfcolor;
297          c_ccolor = &c_uncolor;
298 <        lu_done(&clr_tab, freectx);
298 >        lu_done(&clr_tab);
299          c_unmaterial = c_dfmaterial;
300          c_cmaterial = &c_unmaterial;
301 <        lu_done(&mat_tab, freectx);
301 >        lu_done(&mat_tab);
302          c_unvertex = c_dfvertex;
303          c_cvertex = &c_unvertex;
304 <        lu_done(&vtx_tab, freectx);
304 >        lu_done(&vtx_tab);
305   }
306  
307  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines