/* ParseFields.h -- interface to parsing for plot classes @(#) ParseFields.h 1.6 05/08/19 SwRI */ /* guard against multiple inclusion */ #ifndef ParseFields_h #define ParseFields_h #include /* for FILE,etc. */ typedef char boole; /* 1 byte boolean */ /* macros for struct field offsets */ #define FieldAddress(base,offset) \ (((char *)base) + offset) #define FieldOffset(ptr_type,field) \ ((unsigned int)(((char *)&(((ptr_type)NULL)->field)) - ((char *)NULL))) #define FieldOffsetOf(struct_type,field) \ FieldOffset(struct_type *,field) /* ParseSpec -- specifies nested parse */ typedef void (*RESTORE_FUN)(FILE *,char *,void *,int); typedef struct ParseSpecS { char *tag; /* token's name */ unsigned int offset; /* offset bytes into base */ RESTORE_FUN create; /* restores field in struct */ } ParseSpec; /* BooleRestore -- restore boolean field */ void BooleRestore(FILE *fp,char *line,void *parent,int offset) ; /* DoubleRestore -- restore double field */ void DoubleRestore(FILE *fp,char *line,void *parent,int offset) ; /* FloatRestore -- restore float field */ void FloatRestore(FILE *fp,char *line,void *parent,int offset) ; /* IntRestore -- restore int field */ void IntRestore(FILE *fp,char *line,void *parent,int offset) ; /* NilTok */ ParseSpec * NilTok() ; /* ParseFields -- read and parse fields of data structure */ void ParseFields( FILE *fp, void *parent, ParseSpec *tok) ; /* ParseFieldsInBlock -- read and parse fields until EndStr */ void ParseFieldsInBlock( FILE *fp, void *parent, ParseSpec *tok, char *EndStr) ; /* ShortRestore -- restore short field */ void ShortRestore(FILE *fp,char *line,void *parent,int offset) ; /* StrDupRestore -- restore strings */ void StrDupRestore(FILE *fp,char *line,void *parent,int offset) ; /* StringRestore -- restore strings */ void StringRestore(FILE *fp,char *line,void *parent,int offset) ; #endif