int c_hvertex( int argc, char **argv )
C_VERTEX *c_getvert( char *name )
extern char *c_vname
extern C_VERTEX *c_cvertex
mg_ehand[MG_E_VERTEX] = c_hvertex; /* support "v" entity */ mg_ehand[MG_E_POINT] = c_hvertex; /* support "p" entity */ mg_ehand[MG_E_NORMAL] = c_hvertex; /* support "n" entity */ /* other entity handler assignments... */ mg_init(); /* initialize parser */If vertex normals are not understood by any of the program-supported entities, then the MG_E_NORMAL entry may be left with its original NULL assignment.
The c_getvert call takes the name of a defined vertex and returns a pointer to its C_VERTEX structure, defined in "parser.h" as:
typedef FLOAT FVECT[3]; /* a 3-d real vector */ typedef struct { int clock; /* incremented each change -- resettable */ FVECT p, n; /* point and normal */ } C_VERTEX; /* vertex context */The clock member will be incremented each time the value gets changed by a p or n entity, and may be reset by the controlling program if desired. This is a convenient way to keep track of whether or not a vertex has changed since its last use. To link identical vertices, one must also check that the current transform has not changed, which is uniquely identified by the global xf_context -> xid variable, but only if one is using the parser libraries transform handler. (See the xf_handler page.)
It is possible but not recommended to alter the contents of the vertex structure returned by c_getvert. Normally it is read during the interpretation of entities using named vertices.
The name of the current vertex is given by the global c_cvname variable, which is set to NULL if the unnamed vertex is current. The current vertex value is pointed to by the global variable c_cvertex, which should never be NULL.
The c_getvert function returns NULL if the specified vertex name is undefined, at which point the calling function should return an MG_EUNDEF error.