48 |
|
|
49 |
|
extern char mg_ename[MG_NENTITIES][MG_MAXELEN]; |
50 |
|
|
51 |
< |
/* Handler routines for each entity */ |
51 |
> |
/* Handler routines for each entity and unknown ones */ |
52 |
|
|
53 |
|
#ifdef NOPROTO |
54 |
|
extern int (*mg_ehand[MG_NENTITIES])(); |
55 |
+ |
extern int (*mg_uhand)(); |
56 |
+ |
extern int mg_defuhand(); |
57 |
|
#else |
58 |
|
extern int (*mg_ehand[MG_NENTITIES])(int argc, char **argv); |
59 |
+ |
extern int (*mg_uhand)(int argc, char **argv); |
60 |
+ |
extern int mg_defuhand(int, char **); |
61 |
|
#endif |
62 |
|
|
63 |
+ |
extern unsigned mg_nunknown; /* count of unknown entities */ |
64 |
+ |
|
65 |
|
/* Error codes */ |
66 |
|
#define MG_OK 0 /* normal return value */ |
67 |
|
#define MG_EUNK 1 /* unknown entity */ |
77 |
|
|
78 |
|
#define MG_NERRS 11 |
79 |
|
|
80 |
< |
extern char *mg_err[MG_NERRS]; |
80 |
> |
extern char *mg_err[MG_NERRS]; /* list of error messages */ |
81 |
|
|
82 |
|
/* |
83 |
|
* The general process for running the parser is to fill in the mg_ehand |
347 |
|
|
348 |
|
typedef struct xf_spec { |
349 |
|
long xid; /* unique transform id */ |
350 |
< |
short xav0; /* zeroeth argument in xf_argv array */ |
345 |
< |
short xac; /* transform argument count */ |
350 |
> |
short xac; /* context argument count */ |
351 |
|
short rev; /* boolean true if vertices reversed */ |
352 |
|
XF xf; /* cumulative transformation */ |
353 |
|
struct xf_array *xarr; /* transformation array pointer */ |
354 |
|
struct xf_spec *prev; /* previous transformation context */ |
355 |
|
} XF_SPEC; /* followed by argument buffer */ |
356 |
|
|
357 |
< |
extern int xf_argc; /* total # transform args. */ |
358 |
< |
extern char **xf_argv; /* transform arguments */ |
359 |
< |
extern XF_SPEC *xf_context; /* current context */ |
357 |
> |
extern XF_SPEC *xf_context; /* current transform context */ |
358 |
> |
extern char **xf_argend; /* last transform argument */ |
359 |
> |
|
360 |
> |
#define xf_ac(xf) ((xf)->xac) |
361 |
> |
#define xf_av(xf) (xf_argend - (xf)->xac) |
362 |
> |
|
363 |
> |
#define xf_argc (xf_context==NULL ? 0 : xf_ac(xf_context)) |
364 |
> |
#define xf_argv xf_av(xf_context) |
365 |
|
|
366 |
|
/* |
367 |
|
* The transformation handler should do most of the work that needs |