예제 #1
0
/* set up the c structures for a receptor from a semantic tree */
Receptor * __r_init(T *t) {
    Receptor *r = malloc(sizeof(Receptor));
    r->root = t;
    r->table = NULL;
    r->instances = NULL;
    r->q = _p_newq(r);
    r->state = Alive;  //@todo, check if this is true on unserialize

    T *defs = _t_child(t,1);
    r->defs.structures = _t_child(defs,1);
    r->defs.symbols = _t_child(defs,2);
    r->defs.processes = _t_child(defs,3);
    r->defs.protocols = _t_child(defs,4);
    r->defs.scapes = _t_child(defs,5);
    r->flux = _t_child(t,3);
    r->pending_signals = _t_child(t,5);
    r->pending_responses = _t_child(t,6);
    return r;
}
예제 #2
0
/* set up the c structures for a receptor from a semantic tree */
Receptor * __r_init(T *t,SemTable *sem) {
    Receptor *r = malloc(sizeof(Receptor));
    r->root = t;
    r->parent = *(int *)_t_surface(_t_child(t,ReceptorInstanceParentContextIdx));
    r->context = *(int *)_t_surface(_t_child(t,ReceptorInstanceContextNumIdx));
    r->addr.addr = r->context;  //@fixme!! for now these are the same, but this needs to get fixed
    r->sem = sem;
    r->instances = NULL;
    r->q = _p_newq(r);
    r->state = Alive;  //@todo, check if this is true on unserialize

    T *state = _t_child(t,ReceptorInstanceStateIdx);
    r->flux = _t_child(state,ReceptorFluxIdx);
    r->pending_signals = _t_child(state,ReceptorPendingSignalsIdx);
    r->pending_responses = _t_child(state,ReceptorPendingResponsesIdx);
    r->conversations = _t_child(state,ReceptorConversationsIdx);
    r->edge = NULL;
    return r;
}