ZEDA  1.6.18
Data Structures | Macros | Typedefs | Functions
zeda_ztk.h File Reference

ZTK (Z's tag-and-key) file format. More...

#include <zeda/zeda_strlist.h>
Include dependency graph for zeda_ztk.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _zFileStack
 
struct  ZTKKeyField
 key field of ZTK format. More...
 
struct  __ZTKKeyFieldListCell
 
struct  __ZTKKeyFieldList
 
struct  ZTKTagField
 tagged field of ZTK format. More...
 
struct  __ZTKTagFieldListCell
 
struct  __ZTKTagFieldList
 
struct  ZTK
 ZTK format processor. More...
 
struct  ZTKPrp
 properties of a class described by a set of tag/key string and call-back functions. More...
 

Macros

#define ZTKValPtr(ztk)   (ztk)->val_cp
 return a pointer to the current value string of the current key field of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
#define ZTKVal(ztk)   ( (ztk)->val_cp ? (ztk)->val_cp->data : "" )
 return the current value string of the current key field of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
#define ZTKValCmp(ztk, str)   ( strcmp( ZTKVal(ztk), str ) == 0 )
 check if a string is the same with the current value string of the current key field of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
#define ZTKKey(ztk)   ( (ztk)->kf_cp ? (ztk)->kf_cp->data.key : "" )
 return the current key of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
#define ZTKKeyCmp(ztk, str)   ( strcmp( ZTKKey(ztk), str ) == 0 )
 check if a string is the same with the current key of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
#define ZTKTag(ztk)   ( (ztk)->tf_cp ? (ztk)->tf_cp->data.tag : "" )
 return the current tag in a tag-and-key list of a ZTK format processor. More...
 
#define ZTKTagCmp(ztk, str)   ( strcmp( ZTKTag(ztk), str ) == 0 )
 check if a string is the same with the current tag in a tag-and-key list of a ZTK format processor. More...
 
#define ZTKRewind(ztk)   ZTKTagRewind( ztk )
 rewind a tag-and-key list of a ZTK format processor. More...
 
#define ZTKPrint(ztk)   ZTKFPrint( stdout, ztk )
 
#define ZTKEvalKey(obj, arg, ztk, prp)   _ZTKEvalKey( obj, arg, ztk, prp, sizeof(prp)/sizeof(ZTKPrp) )
 
#define ZTKPrpKeyFPrint(fp, obj, prp)   _ZTKPrpKeyFPrint( fp, obj, prp, sizeof(prp)/sizeof(ZTKPrp) )
 
#define ZTKEvalTag(obj, arg, ztk, prp)   _ZTKEvalTag( obj, arg, ztk, prp, sizeof(prp)/sizeof(ZTKPrp) )
 
#define ZTKPrpTagFPrint(fp, obj, prp)   _ZTKPrpTagFPrint( fp, obj, prp, sizeof(prp)/sizeof(ZTKPrp) )
 

Typedefs

typedef struct _zFileStack zFileStack
 
typedef struct __ZTKKeyFieldListCell ZTKKeyFieldListCell
 
typedef struct __ZTKKeyFieldList ZTKKeyFieldList
 
typedef struct __ZTKTagFieldListCell ZTKTagFieldListCell
 
typedef struct __ZTKTagFieldList ZTKTagFieldList
 

Functions

void zFileStackInit (zFileStack *stack)
 
zFileStackzFileStackPush (zFileStack *head, char *pathname)
 
zFileStackzFileStackPop (zFileStack *head)
 
void zFileStackDestroy (zFileStack *head)
 
void ZTKKeyFieldFPrint (FILE *fp, ZTKKeyField *kf)
 
ZTKKeyFieldListCellZTKKeyFieldListNew (ZTKKeyFieldList *list, char *key)
 
void ZTKKeyFieldListDestroy (ZTKKeyFieldList *list)
 
void ZTKTagFieldFPrint (FILE *fp, ZTKTagField *tf)
 
ZTKTagFieldListCellZTKTagFieldListNew (char buf[])
 
void ZTKTagFieldListDestroy (ZTKTagFieldList *list)
 
void ZTKTagFieldListFPrint (FILE *fp, ZTKTagFieldList *list)
 
ZTKZTKInit (ZTK *ztk)
 initialize a ZTK format processor. More...
 
void ZTKDestroy (ZTK *ztk)
 destroy a ZTK format processor. More...
 
bool ZTKParseFP (ZTK *ztk, FILE *fp)
 scan and parse a file stream into a tag-and-key list of a ZTK format processor. More...
 
bool ZTKParse (ZTK *ztk, char *path)
 scan a file and parse it into a tag-and-key list of a ZTK format processor. More...
 
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 processor. More...
 
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 of a ZTK format processor. More...
 
zStrListCellZTKValNext (ZTK *ztk)
 move to the next value string in the current key field of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
zStrListCellZTKValRewind (ZTK *ztk)
 rewind the list of value strings of the current key field of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
ZTKKeyFieldListCellZTKKeyNext (ZTK *ztk)
 move to the next key field of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
ZTKKeyFieldListCellZTKKeyRewind (ZTK *ztk)
 rewind the list of key fields of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
ZTKTagFieldListCellZTKTagNext (ZTK *ztk)
 move to the next tagged field in a tag-and-key list of a ZTK format processor. More...
 
ZTKTagFieldListCellZTKTagRewind (ZTK *ztk)
 rewind the list of tagged field in a tag-and-key list of a ZTK format processor. More...
 
int ZTKInt (ZTK *ztk)
 retrieve an integer value from the current key field of the current tagged field in a tag-and-key list of a ZTK format processor. More...
 
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 a ZTK format processor. More...
 
void ZTKFPrint (FILE *fp, ZTK *ztk)
 print out ZTK to a file. More...
 
void * _ZTKEvalKey (void *obj, void *arg, ZTK *ztk, ZTKPrp prp[], int num)
 
void _ZTKPrpKeyFPrint (FILE *fp, void *obj, ZTKPrp prp[], int num)
 
void * _ZTKEvalTag (void *obj, void *arg, ZTK *ztk, ZTKPrp prp[], int num)
 
void _ZTKPrpTagFPrint (FILE *fp, void *obj, ZTKPrp prp[], int num)
 

Detailed Description

ZTK (Z's tag-and-key) file format.

Author
Zhidao

Macro Definition Documentation

◆ ZTKValPtr

#define ZTKValPtr (   ztk)    (ztk)->val_cp

return a pointer to the current value string of the current key field of the current tagged field in a tag-and-key list of a ZTK format processor.

◆ ZTKVal

#define ZTKVal (   ztk)    ( (ztk)->val_cp ? (ztk)->val_cp->data : "" )

return the current value string of the current key field of the current tagged field in a tag-and-key list of a ZTK format processor.

◆ ZTKValCmp

#define ZTKValCmp (   ztk,
  str 
)    ( strcmp( ZTKVal(ztk), str ) == 0 )

check if a string is the same with the current value string of the current key field of the current tagged field in a tag-and-key list of a ZTK format processor.

◆ ZTKKey

#define ZTKKey (   ztk)    ( (ztk)->kf_cp ? (ztk)->kf_cp->data.key : "" )

return the current key of the current tagged field in a tag-and-key list of a ZTK format processor.

◆ ZTKKeyCmp

#define ZTKKeyCmp (   ztk,
  str 
)    ( strcmp( ZTKKey(ztk), str ) == 0 )

check if a string is the same with the current key of the current tagged field in a tag-and-key list of a ZTK format processor.

◆ ZTKTag

#define ZTKTag (   ztk)    ( (ztk)->tf_cp ? (ztk)->tf_cp->data.tag : "" )

return the current tag in a tag-and-key list of a ZTK format processor.

◆ ZTKTagCmp

#define ZTKTagCmp (   ztk,
  str 
)    ( strcmp( ZTKTag(ztk), str ) == 0 )

check if a string is the same with the current tag in a tag-and-key list of a ZTK format processor.

◆ ZTKRewind

#define ZTKRewind (   ztk)    ZTKTagRewind( ztk )

rewind a tag-and-key list of a ZTK format processor.

◆ ZTKPrint

#define ZTKPrint (   ztk)    ZTKFPrint( stdout, ztk )

◆ ZTKEvalKey

#define ZTKEvalKey (   obj,
  arg,
  ztk,
  prp 
)    _ZTKEvalKey( obj, arg, ztk, prp, sizeof(prp)/sizeof(ZTKPrp) )

◆ ZTKPrpKeyFPrint

#define ZTKPrpKeyFPrint (   fp,
  obj,
  prp 
)    _ZTKPrpKeyFPrint( fp, obj, prp, sizeof(prp)/sizeof(ZTKPrp) )

◆ ZTKEvalTag

#define ZTKEvalTag (   obj,
  arg,
  ztk,
  prp 
)    _ZTKEvalTag( obj, arg, ztk, prp, sizeof(prp)/sizeof(ZTKPrp) )

◆ ZTKPrpTagFPrint

#define ZTKPrpTagFPrint (   fp,
  obj,
  prp 
)    _ZTKPrpTagFPrint( fp, obj, prp, sizeof(prp)/sizeof(ZTKPrp) )

Typedef Documentation

◆ zFileStack

typedef struct _zFileStack zFileStack

◆ ZTKKeyFieldListCell

◆ ZTKKeyFieldList

◆ ZTKTagFieldListCell

◆ ZTKTagFieldList

Function Documentation

◆ zFileStackInit()

void zFileStackInit ( zFileStack stack)

◆ zFileStackPush()

zFileStack* zFileStackPush ( zFileStack head,
char *  pathname 
)

◆ zFileStackPop()

zFileStack* zFileStackPop ( zFileStack head)

◆ zFileStackDestroy()

void zFileStackDestroy ( zFileStack head)

◆ ZTKKeyFieldFPrint()

void ZTKKeyFieldFPrint ( FILE *  fp,
ZTKKeyField kf 
)

◆ ZTKKeyFieldListNew()

ZTKKeyFieldListCell* ZTKKeyFieldListNew ( ZTKKeyFieldList list,
char *  key 
)

◆ ZTKKeyFieldListDestroy()

void ZTKKeyFieldListDestroy ( ZTKKeyFieldList list)

◆ ZTKTagFieldFPrint()

void ZTKTagFieldFPrint ( FILE *  fp,
ZTKTagField tf 
)

◆ ZTKTagFieldListNew()

ZTKTagFieldListCell* ZTKTagFieldListNew ( char  buf[])

◆ ZTKTagFieldListDestroy()

void ZTKTagFieldListDestroy ( ZTKTagFieldList list)

◆ ZTKTagFieldListFPrint()

void ZTKTagFieldListFPrint ( FILE *  fp,
ZTKTagFieldList list 
)

◆ ZTKInit()

ZTK* ZTKInit ( ZTK ztk)

initialize a ZTK format processor.

◆ ZTKDestroy()

void ZTKDestroy ( ZTK ztk)

destroy a ZTK format processor.

◆ ZTKParseFP()

bool ZTKParseFP ( ZTK ztk,
FILE *  fp 
)

scan and parse a file stream into a tag-and-key list of a ZTK format processor.

◆ ZTKParse()

bool ZTKParse ( ZTK ztk,
char *  path 
)

scan a file and parse it into a tag-and-key list of a ZTK format processor.

◆ ZTKCountTag()

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 processor.

◆ ZTKCountKey()

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 of a ZTK format processor.

◆ ZTKValNext()

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 list of a ZTK format processor.

◆ ZTKValRewind()

zStrListCell* ZTKValRewind ( ZTK ztk)

rewind the list of value strings of the current key field of the current tagged field in a tag-and-key list of a ZTK format processor.

◆ ZTKKeyNext()

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 processor.

◆ ZTKKeyRewind()

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 processor.

◆ ZTKTagNext()

ZTKTagFieldListCell* ZTKTagNext ( ZTK ztk)

move to the next tagged field in a tag-and-key list of a ZTK format processor.

◆ ZTKTagRewind()

ZTKTagFieldListCell* ZTKTagRewind ( ZTK ztk)

rewind the list of tagged field in a tag-and-key list of a ZTK format processor.

◆ ZTKInt()

int ZTKInt ( ZTK ztk)

retrieve an integer value from the current key field of the current tagged field in a tag-and-key list of a ZTK format processor.

◆ ZTKDouble()

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 a ZTK format processor.

◆ ZTKFPrint()

void ZTKFPrint ( FILE *  fp,
ZTK ztk 
)

print out ZTK to a file.

◆ _ZTKEvalKey()

void* _ZTKEvalKey ( void *  obj,
void *  arg,
ZTK ztk,
ZTKPrp  prp[],
int  num 
)

◆ _ZTKPrpKeyFPrint()

void _ZTKPrpKeyFPrint ( FILE *  fp,
void *  obj,
ZTKPrp  prp[],
int  num 
)

◆ _ZTKEvalTag()

void* _ZTKEvalTag ( void *  obj,
void *  arg,
ZTK ztk,
ZTKPrp  prp[],
int  num 
)

◆ _ZTKPrpTagFPrint()

void _ZTKPrpTagFPrint ( FILE *  fp,
void *  obj,
ZTKPrp  prp[],
int  num 
)