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

Comparing ray/src/cv/mgflib/parser.c (file contents):
Revision 1.27 by greg, Fri Feb 28 20:11:29 2003 UTC vs.
Revision 1.28 by schorsch, Sat Nov 15 17:54:06 2003 UTC

# Line 59 | Line 59 | int    mg_nqcdivs = MG_NQCD;   /* number of divisions per q
59   #define e_ies e_any_toss
60                                  /* alternate handler routines */
61  
62 < static int      e_any_toss(),           /* discard unneeded entity */
63 <                e_ies(),                /* IES luminaire file */
64 <                e_cct(),                /* color temperature */
65 <                e_cmix(),               /* color mixtures */
66 <                e_cspec();              /* color spectra */
62 > static void make_axes(FVECT u, FVECT v, FVECT w);
63 > static int put_cxy(void);
64 > static int put_cspec(void);
65  
66 + static int e_any_toss(int ac, char **av); /* discard an unwanted entity */
67 + static int e_cspec(int ac, char **av); /* handle spectral color */
68 + static int e_cmix(int ac, char **av); /* handle mixing of colors */
69 + static int e_cct(int ac, char **av); /* handle color temperature */
70 +
71 +
72                                  /* alternate handler support functions */
73  
74 < static int      (*e_supp[MG_NENTITIES])();
74 > static int      (*e_supp[MG_NENTITIES])(int ac, char **av);
75  
76   static char     FLTFMT[] = "%.12g";
77  
# Line 75 | Line 79 | static int     warpconends;            /* hack for generating good n
79  
80  
81   void
82 < mg_init()                       /* initialize alternate entity handlers */
82 > mg_init(void)                   /* initialize alternate entity handlers */
83   {
84          unsigned long   ineed = 0, uneed = 0;
85          register int    i;
# Line 176 | Line 180 | mg_init()                      /* initialize alternate entity handlers */
180  
181  
182   int
183 < mg_entity(name)                 /* get entity number from its name */
184 < char    *name;
183 > mg_entity(                      /* get entity number from its name */
184 >        char    *name
185 > )
186   {
187          static LUTAB    ent_tab = LU_SINIT(NULL,NULL);  /* lookup table */
188          register char   *cp;
# Line 197 | Line 202 | char   *name;
202  
203  
204   int
205 < mg_handle(en, ac, av)           /* pass entity to appropriate handler */
206 < register int    en;
207 < int     ac;
208 < char    **av;
205 > mg_handle(              /* pass entity to appropriate handler */
206 >        register int    en,
207 >        int     ac,
208 >        char    **av
209 > )
210   {
211          int     rv;
212  
# Line 218 | Line 224 | char   **av;
224  
225  
226   int
227 < mg_open(ctx, fn)                        /* open new input file */
228 < register MG_FCTXT       *ctx;
229 < char    *fn;
227 > mg_open(                        /* open new input file */
228 >        register MG_FCTXT       *ctx,
229 >        char    *fn
230 > )
231   {
232          static int      nfids;
233          register char   *cp;
# Line 251 | Line 258 | char   *fn;
258  
259  
260   void
261 < mg_close()                      /* close input file */
261 > mg_close(void)                  /* close input file */
262   {
263          register MG_FCTXT       *ctx = mg_file;
264  
# Line 262 | Line 269 | mg_close()                     /* close input file */
269  
270  
271   void
272 < mg_fgetpos(pos)                 /* get current position in input file */
273 < register MG_FPOS        *pos;
272 > mg_fgetpos(                     /* get current position in input file */
273 >        register MG_FPOS        *pos
274 > )
275   {
276          pos->fid = mg_file->fid;
277          pos->lineno = mg_file->lineno;
# Line 272 | Line 280 | register MG_FPOS       *pos;
280  
281  
282   int
283 < mg_fgoto(pos)                   /* reposition input file pointer */
284 < register MG_FPOS        *pos;
283 > mg_fgoto(                       /* reposition input file pointer */
284 >        register MG_FPOS        *pos
285 > )
286   {
287          if (pos->fid != mg_file->fid)
288                  return(MG_ESEEK);
# Line 289 | Line 298 | register MG_FPOS       *pos;
298  
299  
300   int
301 < mg_read()                       /* read next line from file */
301 > mg_read(void)                   /* read next line from file */
302   {
303          register int    len = 0;
304  
# Line 308 | Line 317 | mg_read()                      /* read next line from file */
317  
318  
319   int
320 < mg_parse()                      /* parse current input line */
320 > mg_parse(void)                  /* parse current input line */
321   {
322          char    abuf[MG_MAXLINE];
323          char    *argv[MG_MAXARGC];
# Line 339 | Line 348 | mg_parse()                     /* parse current input line */
348  
349  
350   int
351 < mg_load(fn)                     /* load an MGF file */
352 < char    *fn;
351 > mg_load(                        /* load an MGF file */
352 >        char    *fn
353 > )
354   {
355          MG_FCTXT        cntxt;
356          int     rval;
# Line 369 | Line 379 | char   *fn;
379  
380  
381   int
382 < mg_defuhand(ac, av)             /* default handler for unknown entities */
383 < int     ac;
384 < char    **av;
382 > mg_defuhand(            /* default handler for unknown entities */
383 >        int     ac,
384 >        char    **av
385 > )
386   {
387          if (mg_nunknown++ == 0)         /* report first incident */
388                  fprintf(stderr, "%s: %d: %s: %s\n", mg_file->fname,
# Line 381 | Line 392 | char   **av;
392  
393  
394   void
395 < mg_clear()                      /* clear parser history */
395 > mg_clear(void)                  /* clear parser history */
396   {
397          c_clearall();                   /* clear context tables */
398          while (mg_file != NULL)         /* reset our file context */
# Line 395 | Line 406 | mg_clear()                     /* clear parser history */
406  
407  
408   static int
409 < e_any_toss(ac, av)              /* discard an unwanted entity */
410 < int     ac;
411 < char    **av;
409 > e_any_toss(             /* discard an unwanted entity */
410 >        int     ac,
411 >        char    **av
412 > )
413   {
414          return(MG_OK);
415   }
416  
417  
418   int
419 < e_include(ac, av)               /* include file */
420 < int     ac;
421 < char    **av;
419 > e_include(              /* include file */
420 >        int     ac,
421 >        char    **av
422 > )
423   {
424          char    *xfarg[MG_MAXARGC];
425          MG_FCTXT        ictx;
# Line 457 | Line 470 | char   **av;
470  
471  
472   int
473 < e_faceh(ac, av)                 /* replace face+holes with single contour */
474 < int     ac;
475 < char    **av;
473 > e_faceh(                        /* replace face+holes with single contour */
474 >        int     ac,
475 >        char    **av
476 > )
477   {
478          char    *newav[MG_MAXARGC];
479          int     lastp = 0;
# Line 489 | Line 503 | char   **av;
503  
504  
505   static void
506 < make_axes(u, v, w)              /* compute u and v given w (normalized) */
507 < FVECT   u, v, w;
506 > make_axes(              /* compute u and v given w (normalized) */
507 >        FVECT   u,
508 >        FVECT   v,
509 >        FVECT   w
510 > )
511   {
512          register int    i;
513  
# Line 506 | Line 523 | FVECT  u, v, w;
523  
524  
525   int
526 < e_sph(ac, av)                   /* expand a sphere into cones */
527 < int     ac;
528 < char    **av;
526 > e_sph(                  /* expand a sphere into cones */
527 >        int     ac,
528 >        char    **av
529 > )
530   {
531          static char     p2x[24], p2y[24], p2z[24], r1[24], r2[24];
532          static char     *v1ent[5] = {mg_ename[MG_E_VERTEX],"_sv1","=","_sv2"};
# Line 558 | Line 576 | char   **av;
576  
577  
578   int
579 < e_torus(ac, av)                 /* expand a torus into cones */
580 < int     ac;
581 < char    **av;
579 > e_torus(                        /* expand a torus into cones */
580 >        int     ac,
581 >        char    **av
582 > )
583   {
584          static char     p2[3][24], r1[24], r2[24];
585          static char     *v1ent[5] = {mg_ename[MG_E_VERTEX],"_tv1","=","_tv2"};
# Line 650 | Line 669 | char   **av;
669  
670  
671   int
672 < e_cyl(ac, av)                   /* replace a cylinder with equivalent cone */
673 < int     ac;
674 < char    **av;
672 > e_cyl(                  /* replace a cylinder with equivalent cone */
673 >        int     ac,
674 >        char    **av
675 > )
676   {
677          static char     *avnew[6] = {mg_ename[MG_E_CONE]};
678  
# Line 667 | Line 687 | char   **av;
687  
688  
689   int
690 < e_ring(ac, av)                  /* turn a ring into polygons */
691 < int     ac;
692 < char    **av;
690 > e_ring(                 /* turn a ring into polygons */
691 >        int     ac,
692 >        char    **av
693 > )
694   {
695          static char     p3[3][24], p4[3][24];
696          static char     *nzent[5] = {mg_ename[MG_E_NORMAL],"0","0","0"};
# Line 765 | Line 786 | char   **av;
786  
787  
788   int
789 < e_cone(ac, av)                  /* turn a cone into polygons */
790 < int     ac;
791 < char    **av;
789 > e_cone(                 /* turn a cone into polygons */
790 >        int     ac,
791 >        char    **av
792 > )
793   {
794          static char     p3[3][24], p4[3][24], n3[3][24], n4[3][24];
795          static char     *v1ent[5] = {mg_ename[MG_E_VERTEX],"_cv1","="};
# Line 935 | Line 957 | char   **av;
957  
958  
959   int
960 < e_prism(ac, av)                 /* turn a prism into polygons */
961 < int     ac;
962 < char    **av;
960 > e_prism(                        /* turn a prism into polygons */
961 >        int     ac,
962 >        char    **av
963 > )
964   {
965          static char     p[3][24];
966          static char     *vent[5] = {mg_ename[MG_E_VERTEX],NULL,"="};
# Line 1042 | Line 1065 | char   **av;
1065  
1066  
1067   static int
1068 < put_cxy()                       /* put out current xy chromaticities */
1068 > put_cxy(void)                   /* put out current xy chromaticities */
1069   {
1070          static char     xbuf[24], ybuf[24];
1071          static char     *ccom[4] = {mg_ename[MG_E_CXY], xbuf, ybuf};
# Line 1054 | Line 1077 | put_cxy()                      /* put out current xy chromaticities */
1077  
1078  
1079   static int
1080 < put_cspec()                     /* put out current color spectrum */
1080 > put_cspec(void)                 /* put out current color spectrum */
1081   {
1082          char    wl[2][6], vbuf[C_CNSS][24];
1083          char    *newav[C_CNSS+4];
# Line 1081 | Line 1104 | put_cspec()                    /* put out current color spectrum */
1104  
1105  
1106   static int
1107 < e_cspec(ac, av)                 /* handle spectral color */
1108 < int     ac;
1109 < char    **av;
1107 > e_cspec(                        /* handle spectral color */
1108 >        int     ac,
1109 >        char    **av
1110 > )
1111   {
1112                                  /* convert to xy chromaticity */
1113          c_ccvt(c_ccolor, C_CSXY);
# Line 1095 | Line 1119 | char   **av;
1119  
1120  
1121   static int
1122 < e_cmix(ac, av)                  /* handle mixing of colors */
1123 < int     ac;
1124 < char    **av;
1122 > e_cmix(                 /* handle mixing of colors */
1123 >        int     ac,
1124 >        char    **av
1125 > )
1126   {
1127          /*
1128           * Contorted logic works as follows:
# Line 1118 | Line 1143 | char   **av;
1143  
1144  
1145   static int
1146 < e_cct(ac, av)                   /* handle color temperature */
1147 < int     ac;
1148 < char    **av;
1146 > e_cct(                  /* handle color temperature */
1147 >        int     ac,
1148 >        char    **av
1149 > )
1150   {
1151          /*
1152           * Logic is similar to e_cmix here.  Support handler has already

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines