22 #include "ceptr_error.h"
25 #include "ceptr_types.h"
28 #define TREE_CHILDREN_BLOCK 5
29 #define TREE_PATH_TERMINATOR 0xFFFFFFFF
31 enum TreeSurfaceFlags {TFLAG_ALLOCATED=0x0001,TFLAG_SURFACE_IS_TREE=0x0002,TFLAG_SURFACE_IS_RECEPTOR = 0x0004,TFLAG_SURFACE_IS_SCAPE=0x0008,TFLAG_SURFACE_IS_CPTR=0x0010,TFLAG_DELETED=0x0020,TFLAG_RUN_NODE=0x0040,TFLAG_REFERENCE=0x8000};
34 T *
__t_new(
T *t,
Symbol symbol,
void *surface,
size_t size,
bool is_run_node);
35 #define _t_new(p,sy,su,s) __t_new(p,sy,su,s,0)
37 #define _t_newc(parent,symbol,c) __t_newc(parent,symbol,c,0)
39 #define _t_newi(p,sy,su) __t_newi(p,sy,su,0)
41 #define _t_newi64(p,sy,su) __t_newi64(p,sy,su,0)
43 #define _t_news(parent,symbol,surface) __t_news(parent,symbol,surface,0)
45 #define _t_new_str(parent,symbol,str) __t_new_str(parent,symbol,str,0)
48 #define _t_newr(p,s) __t_newr(p,s,0)
64 void __t_free_children(
T *t);
72 T *__t_tokenize(
char *s);
75 #define _t_fill_template(t,i) __t_fill_template(t,i,false)
90 #define _t_find(t,sym) __t_find(t,sym,1)
115 T * _t_unserialize(
SemTable *sem,
void **surfaceP,
size_t *lengthP,
T *t);
124 #define DO_KIDS(t,x) {int i,_c=_t_children(t);for(i=1;i<=_c;i++){x;}}
126 #define root_check(c) if (c->structure.parent != 0) {raise_error("can't add a node that isn't a root!");}
T * _t_new_root(Symbol symbol)
T * _t_next_sibling(T *t)
T * _t_new_scape(T *parent, Symbol symbol, Scape *s)
void _t_morph(T *dst, T *src)
T * _t_build2(SemTable *sem, T *t,...)
T * __t_newi(T *parent, Symbol symbol, int surface, bool is_run_node)
int _t_write(SemTable *sem, T *t, Stream *stream)
T * _t_path_walk(T *t, int **pathP, int *lenP)
bool __t_fill_template(T *template, T *items, bool as_run_node)
int _t_hash_equal(TreeHash h1, TreeHash h2)
T * _t_detach_by_idx(T *t, int i)
int _t_path_depth(int *p)
T * _t_new_receptor(T *parent, Symbol symbol, Receptor *r)
TreeHash _t_hash(SemTable *sem, T *t)
T * __t_newr(T *parent, Symbol symbol, bool is_run_node)
void _t_serialize(SemTable *sem, T *t, void **surfaceP, size_t *sizeP)
T * __t_new(T *t, Symbol symbol, void *surface, size_t size, bool is_run_node)
T * _t_child(T *t, int i)
T * _t_newp(T *parent, Symbol symbol, Process surface)
T * _t_swap(T *t, int i, T *r)
void _t_pathcpy(int *dst_p, int *src_p)
streams abstraction header file
void _t_insert_at(T *t, int *path, T *i)
size_t __t_serialize(SemTable *sem, T *t, void **bufferP, size_t offset, size_t current_size, int compact)
T * __t_new_str(T *parent, Symbol symbol, char *str, bool is_run_node)
T * _t_newt(T *parent, Symbol symbol, T *t)
void _t_replace_node(T *t, T *r)
char * _t2rawjson(SemTable *sem, T *t, int level, char *buf)
Defines types and vars for system defined semantics.
void * _t_get_surface(T *t, int *p)
T * __t_find(T *t, Symbol sym, int start_child)
T * __t_newi64(T *parent, Symbol symbol, long surface, bool is_run_node)
T * _t_parse(SemTable *sem, T *parent, char *s,...)
int _t_path_equal(int *p1, int *p2)
auto-generated system definitions
char * _t2json(SemTable *sem, T *t, int level, char *buf)
void __t_morph(T *t, Symbol s, void *surface, size_t length, int allocate)
void _t_replace(T *t, int i, T *r)
void _t_detach_by_ptr(T *t, T *c)
T * __t_news(T *parent, Symbol symbol, SemanticID surface, bool is_run_node)
T * _t_build(SemTable *sem, T *t,...)
T * __t_newc(T *t, Symbol symbol, char c, bool is_run_node)
T * _t_new_cptr(T *parent, Symbol symbol, void *s)
char * _t_sprint_path(int *fp, char *buf)