Beispiel #1
0
// mtree walk function for creating ttree nodes
// used by _t_new_from_m
void _m_2tfn(H h,N *n,void *data,MwalkState *s,Maddr ap) {

    T **tP = (T**) &(((struct {T *t;} *)data)->t);
    T *t =  h.a.l ? (s[h.a.l-1].user.t) : NULL;
    int is_run_node = (n->flags&TFLAG_RUN_NODE);

    T *nt;

    if (n->flags & TFLAG_SURFACE_IS_TREE && !(n->flags & TFLAG_SURFACE_IS_RECEPTOR)) {
        if (is_run_node) raise_error("not implemented");
        nt = _t_newt(t,n->symbol,_t_new_from_m(*(H *)n->surface));
    }
    else if (n->flags & TFLAG_ALLOCATED) {
        nt = __t_new(t,n->symbol,n->surface,n->size,is_run_node);
    }
    else {
        nt = __t_new(t,n->symbol,&n->surface,n->size,is_run_node);
    }
    nt->context.flags |= (~TFLAG_ALLOCATED)&(n->flags);

    if (is_run_node) {
        ((rT *)nt)->cur_child = n->cur_child;
    }
    *tP = nt;

    s[h.a.l].user.t = nt;
}
Beispiel #2
0
T *__a_unserializet(char *dir_path,char *name) {
    char fn[1000];
    __a_vm_fn(fn,dir_path,name);
    S *s = readFile(fn,0);
    H h = _m_unserialize(s);
    free(s);
    T *t = _t_new_from_m(h);
    _m_free(h);
    return t;
}