--- ray/src/cv/mgflib/parser.h 1995/05/10 17:46:05 1.22 +++ ray/src/cv/mgflib/parser.h 1995/05/11 20:17:36 1.24 @@ -48,14 +48,20 @@ 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 */ @@ -71,7 +77,7 @@ extern int (*mg_ehand[MG_NENTITIES])(int argc, char ** #define MG_NERRS 11 -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 @@ -341,17 +347,21 @@ struct xf_array { typedef struct xf_spec { long xid; /* unique transform id */ - short xav0; /* zeroeth argument in xf_argv array */ - short xac; /* transform argument count */ + short xac; /* context argument count */ short rev; /* boolean true if vertices reversed */ XF xf; /* cumulative transformation */ struct xf_array *xarr; /* transformation array pointer */ struct xf_spec *prev; /* previous transformation context */ } XF_SPEC; /* followed by argument buffer */ -extern int xf_argc; /* total # transform args. */ -extern char **xf_argv; /* transform arguments */ -extern XF_SPEC *xf_context; /* current context */ +extern XF_SPEC *xf_context; /* current transform context */ +extern char **xf_argend; /* last transform argument */ + +#define xf_ac(xf) ((xf)->xac) +#define xf_av(xf) (xf_argend - (xf)->xac) + +#define xf_argc (xf_context==NULL ? 0 : xf_ac(xf_context)) +#define xf_argv xf_av(xf_context) /* * The transformation handler should do most of the work that needs