--- ray/src/cv/mgflib/parser.h 1995/05/11 09:12:12 1.23 +++ ray/src/cv/mgflib/parser.h 1995/11/29 16:45:13 1.27 @@ -8,7 +8,10 @@ /* must include stdio.h before us */ - /* Entities (order doesn't really matter) */ +#define MG_VMAJOR 1 /* major version number */ +#define MG_VMINOR 0 /* minor version number */ + + /* Entities (list is only appended, never modified) */ #define MG_E_COMMENT 0 /* # */ #define MG_E_COLOR 1 /* c */ #define MG_E_CCT 2 /* cct */ @@ -37,9 +40,12 @@ #define MG_E_TS 25 /* ts */ #define MG_E_VERTEX 26 /* v */ #define MG_E_XF 27 /* xf */ + /* end of Version 1 entities */ #define MG_NENTITIES 28 /* total # entities */ +#define MG_NELIST {28} /* entity count for version 1 and up */ + #define MG_NAMELIST {"#","c","cct","cone","cmix","cspec","cxy","cyl","ed",\ "f","i","ies","ir","m","n","o","p","prism","rd",\ "ring","rs","sides","sph","td","torus","ts","v","xf"} @@ -48,14 +54,19 @@ extern char mg_ename[MG_NENTITIES][MG_MAXELEN]; - /* Handler routines for each entity */ - + /* Handler routines for each entity and unknown ones */ #ifdef NOPROTO extern int (*mg_ehand[MG_NENTITIES])(); +extern int (*mg_uhand)(); +extern int mg_defuhand(); #else extern int (*mg_ehand[MG_NENTITIES])(int argc, char **argv); +extern int (*mg_uhand)(int argc, char **argv); +extern int mg_defuhand(int, char **); #endif +extern unsigned mg_nunknown; /* count of unknown entities */ + /* Error codes */ #define MG_OK 0 /* normal return value */ #define MG_EUNK 1 /* unknown entity */ @@ -68,10 +79,12 @@ extern int (*mg_ehand[MG_NENTITIES])(int argc, char ** #define MG_EMEM 8 /* out of memory */ #define MG_ESEEK 9 /* file seek error */ #define MG_EBADMAT 10 /* bad material specification */ +#define MG_ELINE 11 /* input line too long */ +#define MG_ECNTXT 12 /* unmatched context close */ -#define MG_NERRS 11 +#define MG_NERRS 13 -extern char *mg_err[MG_NERRS]; +extern char *mg_err[MG_NERRS]; /* list of error messages */ /* * The general process for running the parser is to fill in the mg_ehand