--- ray/src/cv/mgflib/parser.h 1995/05/11 20:17:36 1.24 +++ ray/src/cv/mgflib/parser.h 1995/11/29 19:55:42 1.28 @@ -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 1 /* 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"} @@ -49,7 +55,6 @@ extern char mg_ename[MG_NENTITIES][MG_MAXELEN]; /* Handler routines for each entity and unknown ones */ - #ifdef NOPROTO extern int (*mg_ehand[MG_NENTITIES])(); extern int (*mg_uhand)(); @@ -74,8 +79,10 @@ extern unsigned mg_nunknown; /* count of unknown enti #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]; /* list of error messages */ @@ -357,10 +364,10 @@ typedef struct xf_spec { extern XF_SPEC *xf_context; /* current transform context */ extern char **xf_argend; /* last transform argument */ -#define xf_ac(xf) ((xf)->xac) +#define xf_ac(xf) ((xf)==NULL ? 0 : (xf)->xac) #define xf_av(xf) (xf_argend - (xf)->xac) -#define xf_argc (xf_context==NULL ? 0 : xf_ac(xf_context)) +#define xf_argc xf_ac(xf_context) #define xf_argv xf_av(xf_context) /* @@ -386,6 +393,10 @@ extern void xf_clear(); /* clear xf stack */ /* The following are support routines you probably won't call directly */ +XF_SPEC *new_xf(); /* allocate new transform */ +void free_xf(); /* free a transform */ +int xf_aname(); /* name this instance */ +long comp_xfid(); /* compute unique ID */ extern void multmat4(); /* m4a = m4b X m4c */ extern void multv3(); /* v3a = v3b X m4 (vectors) */ extern void multp3(); /* p3a = p3b X m4 (points) */ @@ -402,6 +413,10 @@ extern void xf_clear(void); /* clear xf stack */ /* The following are support routines you probably won't call directly */ +XF_SPEC *new_xf(int, char **); /* allocate new transform */ +void free_xf(XF_SPEC *); /* free a transform */ +int xf_aname(struct xf_array *); /* name this instance */ +long comp_xfid(MAT4); /* compute unique ID */ extern void multmat4(MAT4, MAT4, MAT4); /* m4a = m4b X m4c */ extern void multv3(FVECT, FVECT, MAT4); /* v3a = v3b X m4 (vectors) */ extern void multp3(FVECT, FVECT, MAT4); /* p3a = p3b X m4 (points) */