10 #define __ZEDA_ZTK_H__ 128 #define ZTKValPtr(ztk) (ztk)->val_cp 130 #define ZTKVal(ztk) ( (ztk)->val_cp ? (ztk)->val_cp->data : "" ) 136 #define ZTKValCmp(ztk,str) ( strcmp( ZTKVal(ztk), str ) == 0 ) 139 #define ZTKKey(ztk) ( (ztk)->kf_cp ? (ztk)->kf_cp->data.key : "" ) 145 #define ZTKKeyCmp(ztk,str) ( strcmp( ZTKKey(ztk), str ) == 0 ) 148 #define ZTKTag(ztk) ( (ztk)->tf_cp ? (ztk)->tf_cp->data.tag : "" ) 154 #define ZTKTagCmp(ztk,str) ( strcmp( ZTKTag(ztk), str ) == 0 ) 157 #define ZTKRewind(ztk) ZTKTagRewind( ztk ) 166 #define ZTKPrint(ztk) ZTKFPrint( stdout, ztk ) 175 void *(* _eval)(
void *, int,
void *,
ZTK *);
176 void (* _fprint)(FILE *, int,
void *);
181 #define ZTKEvalKey(obj,arg,ztk,prp) _ZTKEvalKey( obj, arg, ztk, prp, sizeof(prp)/sizeof(ZTKPrp) ) 185 #define ZTKPrpKeyFPrint(fp,obj,prp) _ZTKPrpKeyFPrint( fp, obj, prp, sizeof(prp)/sizeof(ZTKPrp) ) 189 #define ZTKEvalTag(obj,arg,ztk,prp) _ZTKEvalTag( obj, arg, ztk, prp, sizeof(prp)/sizeof(ZTKPrp) ) 193 #define ZTKPrpTagFPrint(fp,obj,prp) _ZTKPrpTagFPrint( fp, obj, prp, sizeof(prp)/sizeof(ZTKPrp) ) char * str
Definition: zeda_ztk.h:173
int num
Definition: zeda_ztk.h:174
tagged field of ZTK format.
Definition: zeda_ztk.h:74
zFileStack * zFileStackPush(zFileStack *head, char *pathname)
void ZTKTagFieldFPrint(FILE *fp, ZTKTagField *tf)
ZTKKeyFieldListCell * ZTKKeyRewind(ZTK *ztk)
rewind the list of key fields of the current tagged field in a tag-and-key list of a ZTK format proce...
ZTKKeyFieldListCell * kf_cp
Definition: zeda_ztk.h:105
zStrList vallist
Definition: zeda_ztk.h:52
void ZTKFPrint(FILE *fp, ZTK *ztk)
print out ZTK to a file.
bool ZTKParse(ZTK *ztk, char *path)
scan a file and parse it into a tag-and-key list of a ZTK format processor.
double ZTKDouble(ZTK *ztk)
retrieve a real value from the current key field of the current tagged field in a tag-and-key list of...
list of tagged fields of ZTK format.
#define __END_DECLS
Definition: zeda_defs.h:30
int ZTKInt(ZTK *ztk)
retrieve an integer value from the current key field of the current tagged field in a tag-and-key lis...
FILE * fp
Definition: zeda_ztk.h:29
ZTKTagFieldListCell * ZTKTagFieldListNew(char buf[])
int ZTKCountTag(ZTK *ztk, const char *tag)
count the number of tagged fields with a specified tag in a tag-and-key list of a ZTK format processo...
zStrListCell * ZTKValRewind(ZTK *ztk)
rewind the list of value strings of the current key field of the current tagged field in a tag-and-ke...
void ZTKKeyFieldFPrint(FILE *fp, ZTKKeyField *kf)
zStrListCell * ZTKValNext(ZTK *ztk)
move to the next value string in the current key field of the current tagged field in a tag-and-key l...
bool ZTKParseFP(ZTK *ztk, FILE *fp)
scan and parse a file stream into a tag-and-key list of a ZTK format processor.
Definition: zeda_ztk.h:27
ZTKKeyFieldListCell * ZTKKeyNext(ZTK *ztk)
move to the next key field of the current tagged field in a tag-and-key list of a ZTK format processo...
ZTKTagFieldListCell * ZTKTagRewind(ZTK *ztk)
rewind the list of tagged field in a tag-and-key list of a ZTK format processor.
Definition: zeda_ztk.h:62
ZTKKeyFieldList kflist
Definition: zeda_ztk.h:76
char * pathname
Definition: zeda_ztk.h:28
void ZTKDestroy(ZTK *ztk)
destroy a ZTK format processor.
int ZTKCountKey(ZTK *ztk, const char *key)
count the number of key fields with a specified key of the current tagged field in a tag-and-key list...
zStrListCell * val_cp
Definition: zeda_ztk.h:106
void ZTKTagFieldListDestroy(ZTKTagFieldList *list)
a list of key fields of ZTK format.
void zFileStackDestroy(zFileStack *head)
char * key
Definition: zeda_ztk.h:51
struct _zFileStack * prev
Definition: zeda_ztk.h:30
zFileStack * zFileStackPop(zFileStack *head)
void ZTKKeyFieldListDestroy(ZTKKeyFieldList *list)
struct _zFileStack zFileStack
#define __BEGIN_DECLS
Definition: zeda_defs.h:26
properties of a class described by a set of tag/key string and call-back functions.
Definition: zeda_ztk.h:172
ZTKKeyFieldListCell * ZTKKeyFieldListNew(ZTKKeyFieldList *list, char *key)
ZTK * ZTKInit(ZTK *ztk)
initialize a ZTK format processor.
void ZTKTagFieldListFPrint(FILE *fp, ZTKTagFieldList *list)
ZTKTagFieldListCell * ZTKTagNext(ZTK *ztk)
move to the next tagged field in a tag-and-key list of a ZTK format processor.
void * _ZTKEvalTag(void *obj, void *arg, ZTK *ztk, ZTKPrp prp[], int num)
#define zListClass(list_t, cell_t, data_t)
generate bidirectional ring list class.
Definition: zeda_list.h:48
zFileStack fs
Definition: zeda_ztk.h:102
Definition: zeda_strlist.h:23
void zFileStackInit(zFileStack *stack)
ZTKTagFieldListCell * tf_cp
Definition: zeda_ztk.h:104
void * _ZTKEvalKey(void *obj, void *arg, ZTK *ztk, ZTKPrp prp[], int num)
#define __EXPORT
Definition: zeda_compat.h:32
key field of ZTK format.
Definition: zeda_ztk.h:50
Definition: zeda_ztk.h:86
ZTK format processor.
Definition: zeda_ztk.h:101
char * tag
Definition: zeda_ztk.h:75
ZTKTagFieldList tflist
Definition: zeda_ztk.h:103
void _ZTKPrpKeyFPrint(FILE *fp, void *obj, ZTKPrp prp[], int num)
void _ZTKPrpTagFPrint(FILE *fp, void *obj, ZTKPrp prp[], int num)
Definition: zeda_strlist.h:23