ceptr
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
tree.c File Reference

semantic tree pointer implementation More...

#include "tree.h"
#include "ceptr_error.h"
#include "hashfn.h"
#include "def.h"
#include "receptor.h"
#include "scape.h"
#include "util.h"
#include "debug.h"
#include "semtrex.h"
Include dependency graph for tree.c:

Go to the source code of this file.

#define test_buffer_overrun   if (i == 999) raise_error("buf overrun\n");
 
#define SWRITE(type, value)   type * type##P = (type *)(*bufferP +offset); *type##P=value;offset += sizeof(type);
 macro to write data by type into *bufferP and increment offset by the size of the type
 
#define SREAD(type, var_name)   type var_name = *(type *)*surfaceP;*lengthP -= sizeof(type);*surfaceP += sizeof(type);
 macro to read typed date from the surface and update length and surface values
 
#define _SREAD(type, var_name)   var_name = *(type *)*surfaceP;*lengthP -= sizeof(type);*surfaceP += sizeof(type);
 macro to read typed date from the surface and update length and surface values (assumes variable has already been declared)
 
#define _add_char2buf(c, buf)   *buf=c;buf++;*buf=0
 
#define _add_sem(buf, s)   sprintf(buf,"{ \"ctx\":%d,\"type\":%d,\"id\":%d }",s.context,s.semtype,s.id);
 
enum  buildStates { bReadSymbol, bPop, bAddRoot, bReadBase }
 
void __t_append_child (T *t, T *c)
 
T__t_init (T *parent, Symbol symbol, bool is_run_node)
 
T__t_new (T *parent, Symbol symbol, void *surface, size_t size, bool is_run_node)
 
T__t_newc (T *parent, Symbol symbol, char surface, bool is_run_node)
 
T__t_newi (T *parent, Symbol symbol, int surface, bool is_run_node)
 
T__t_newi64 (T *parent, Symbol symbol, long surface, bool is_run_node)
 
T__t_news (T *parent, Symbol symbol, SemanticID surface, bool is_run_node)
 
T_t_newt (T *parent, Symbol symbol, T *surface)
 
T__t_new_str (T *parent, Symbol symbol, char *surface, bool is_run_node)
 
T_t_new_root (Symbol symbol)
 
T__t_newr (T *parent, Symbol symbol, bool is_run_node)
 
T__t_new_special (T *parent, Symbol symbol, void *s, int flag, bool is_run_node)
 
T_t_new_receptor (T *parent, Symbol symbol, Receptor *r)
 
T_t_new_scape (T *parent, Symbol symbol, Scape *s)
 
T_t_new_cptr (T *parent, Symbol symbol, void *s)
 
T_t_newp (T *parent, Symbol symbol, Process surface)
 
void _t_add (T *t, T *c)
 
T_t_detach_by_idx (T *t, int i)
 
void _t_detach_by_ptr (T *t, T *c)
 
void __t_morph (T *t, Symbol s, void *surface, size_t size, int allocate)
 
void _t_morph (T *dst, T *src)
 
void _t_replace (T *t, int i, T *r)
 
void _t_replace_node (T *t, T *r)
 
T_t_swap (T *t, int i, T *r)
 
void _t_insert_at (T *t, int *path, T *i)
 
void __t_free_children (T *t)
 
void __t_free (T *t)
 
void _t_free (T *t)
 
T__t_clone (T *t, T *p)
 
T__t_rclone (T *t, T *p)
 
T_t_clone (T *t)
 
T_t_rclone (T *t)
 
SemanticID _getBuildType (SemTable *sem, SemanticID param, Structure *stP, T **defP)
 
T_t_build (SemTable *sem, T *parent,...)
 
T_t_build2 (SemTable *sem, T *parent,...)
 
T__t_tokenize (char *s)
 
T_t_parse (SemTable *sem, T *parent, char *s,...)
 
T__t_find_actual (T *sem_map, Symbol actual_kind, T *replacement_kind)
 
bool __t_fill_template (T *template, T *sem_map, bool as_run_node)
 
int _t_children (T *t)
 
void * _t_surface (T *t)
 
Symbol _t_symbol (T *t)
 
size_t _t_size (T *t)
 
T_t_child (T *t, int i)
 
T_t_parent (T *t)
 
T_t_root (T *t)
 
int _t_node_index (T *t)
 
T_t_next_sibling (T *t)
 
T__t_find (T *t, SemanticID sym, int start_child)
 
int _t_path_equal (int *p1, int *p2)
 
int _t_path_depth (int *p)
 
int * _t_get_path (T *t)
 
void _t_pathcpy (int *dst_p, int *src_p)
 
T_t_get (T *t, int *p)
 
T_t_getv (T *t,...)
 
void * _t_get_surface (T *t, int *p)
 
char * _t_sprint_path (int *fp, char *buf)
 
T_t_path_walk (T *t, int **pathP, int *lenP)
 
TreeHash _t_hash (SemTable *sem, T *t)
 
int _t_hash_equal (TreeHash h1, TreeHash h2)
 
UUIDt __uuid_gen ()
 
int __uuid_equal (UUIDt *u1, UUIDt *u2)
 
size_t __t_serialize (SemTable *sem, T *t, void **bufferP, size_t offset, size_t current_size, int compact)
 
void _t_serialize (SemTable *sem, T *t, void **surfaceP, size_t *lengthP)
 
T_t_unserialize (SemTable *sem, void **surfaceP, size_t *lengthP, T *t)
 
char * _t2rawjson (SemTable *sem, T *t, int level, char *buf)
 
char * _t2json (SemTable *sem, T *t, int level, char *buf)
 
int __t_writeln (T *t, Stream *stream)
 
int _t_write (SemTable *sem, T *t, Stream *stream)
 

Detailed Description

semantic tree pointer implementation

Definition in file tree.c.