tablist.h (875B)
1 //#pragma lib "libtablist.a$O" 2 3 enum { 4 TLstackdepth = 256, 5 TLbufsize = 1024, 6 }; 7 8 extern Type TLnodeType; 9 10 typedef struct TLnode TLnode; 11 struct TLnode { 12 Slice *name; 13 Slice *value; 14 Slice *children; 15 TLnode *parent; 16 }; 17 18 typedef struct TLdecoder TLdecoder; 19 struct TLdecoder { 20 char *file, *buf; 21 Slice *nodes, *acc; 22 TLnode *stack[TLstackdepth]; 23 int state, indent, sp, row, col; 24 }; 25 26 typedef struct TLencoder TLencoder; 27 struct TLencoder { 28 TLnode *np; 29 Slice *ns[TLstackdepth]; 30 void* (*state)(TLencoder *, char *); 31 int sp, i, cs[TLstackdepth]; 32 }; 33 34 TLnode * allocTLnode(void); 35 void freeTLnode(TLnode *); 36 int TLnodeappend(TLnode *, TLnode *); 37 38 TLdecoder * initTLdecoder(char *); 39 int TLdecode(TLdecoder *, char *, usize); 40 41 TLencoder * initTLencoder(Slice *); 42 int TLencode(TLencoder *, char *, usize); 43 44 TLnode * TLgetnode(Slice *, char *, char *); 45 char * TLval2str(TLnode *);