Exemplo n.º 1
0
CAESAR_TYPE_BOOLEAN CAESAR_VISIBLE_LABEL(CAESAR_TYPE_LABEL x) {
	CAESAR_TYPE_BOOLEAN vis = CAESAR_TRUE;
	if (edge_labels==1) {
		chunk c=GBchunkGet(model,lts_type_get_edge_label_typeno(ltstype,0),x->label[0]);
		if (c.len==3 && strncmp(c.data, LTSMIN_EDGE_VALUE_TAU, c.len)==0)
			vis =CAESAR_FALSE;
	}
	return vis;
}
Exemplo n.º 2
0
static void torx_transition(void*arg,int*lbl,int*dst){

	torx_struct_t *context=(torx_struct_t*)arg;

	int tmp=TreeFold(dbs,dst);
	chunk c=GBchunkGet(context->model,lts_type_get_edge_label_typeno(context->ltstype,0),lbl[0]);
	
	int vis = 1;
	if (c.len==3 && strncmp(c.data, "tau", c.len)==0)
		vis =0;

	/* tab-separated fields: edge vis sat lbl pred vars state */
	fprintf(stdout, "Ee\t\t%d\t1\t%*s\t\t\t%d\n", vis, c.len, c.data, tmp);
}
Exemplo n.º 3
0
CAESAR_TYPE_STRING CAESAR_STRING_LABEL(CAESAR_TYPE_LABEL l) {
	static char *s = NULL;  /* start of string */
	static char *b = NULL; /*beyond*/
	static char *tau = "i";
	char *p = NULL;  /* current insertion point */
	int u, n; /* used, needed */
	int i;
	chunk c;
	size_t clen;
	
	p = s;
	n = 5;
	if (b-p < n) { 
		u = p-s;
		s = RTrealloc(s, u+n);/* TODO: check s!=0 */
		p = s+u;
		b = s + u+n;
	}
    if (edge_labels > 0 && l->label[0]<0){
        n = 6;
        if (b-p < n) { 
            u = p-s;
            s = RTrealloc(s, u+n); /* TODO: check s!=0 */
            p = s+u;
            b = s + u+n;
        }
        sprintf(p, "delta");
        p+=strlen(p);
    } else {
        if (edge_labels > 1 || edge_encode) {
                sprintf(p, "|");
                p += strlen(p);
        }
        for(i=0; i < edge_labels; i++) {
            char *name=lts_type_get_edge_label_name(ltstype,i);
            c=GBchunkGet(model,lts_type_get_edge_label_typeno(ltstype,i),l->label[i]);
            if (c.len==3 && strncmp(c.data, LTSMIN_EDGE_VALUE_TAU, c.len)==0)
                clen=strlen(tau);
            else
                clen=c.len*2+6;
            n = strlen(name)+ 1 + clen+1+1+1; /* for name , '=' , c, ';',  '>', '\0' */
            if (b-p < n) { 
                u = p-s;
                s = RTrealloc(s, u+n); /* TODO: check s!=0 */
                p = s+u;
                b = s + u+n;
            }
            if (i>0) {
                sprintf(p, "|");
                p += strlen(p);
            }
            if (edge_labels > 1 || edge_encode ) {
                sprintf(p, "%s=",name);
                p += strlen(p);
            }
            if (c.len==3 && strncmp(c.data, LTSMIN_EDGE_VALUE_TAU, c.len)==0)
                sprintf(p, "%s", tau);
            else
                chunk2string(c,b-p,p);
            p += strlen(p);
        }
    }
    if (edge_labels > 1 || edge_encode ) {
        sprintf(p, "|");
        p += strlen(p);
    }
    if (edge_encode){
        int ofs=edge_labels;
        /*
        for(i=0;i<N;i++){
            char*name=lts_type_get_state_name(ltstype,i);
            c=GBchunkGet(model,lts_type_get_state_typeno(ltstype,i),l->label[ofs+i]);
            n=strlen(name)+c.len*2+7;
            if (b-p < n) { 
                u = p-s;
                s = realloc(s, u+n); // TODO: check s!=0
                p = s+u;
                b = s + u+n;
            }
            sprintf(p, "%s=",name);
            p+=strlen(p);
            chunk2string(c,b-p,p);
            p+=strlen(p);
            sprintf(p, "|");
            p +=strlen(p);
        }
        */
        ofs+=N;
        for(i=0;i<state_labels;i++){
            char*name=lts_type_get_state_label_name(ltstype,i);
            c=GBchunkGet(model,lts_type_get_state_label_typeno(ltstype,i),l->label[ofs+i]);
            n=strlen(name)+c.len*2+7;
            if (b-p < n) { 
                u = p-s;
                s = RTrealloc(s, u+n); /* TODO: check s!=0 */
                p = s+u;
                b = s + u+n;
            }
            sprintf(p, "%s=",name);
            p+=strlen(p);
            chunk2string(c,b-p,p);
            p+=strlen(p);
            sprintf(p, "|");
            p +=strlen(p);
       }
    }
    return s;
}