void CAESAR_ITERATE_STATE(CAESAR_TYPE_STATE s1, CAESAR_TYPE_LABEL l, CAESAR_TYPE_STATE s2, void (*callback) (CAESAR_TYPE_STATE, CAESAR_TYPE_LABEL, CAESAR_TYPE_STATE)) { int i,c; if (edge_encode && s1->state[0]<0) return; if (edge_encode){ int labels[state_labels]; GBgetStateLabelsAll(model,s1->state,labels); { callback_struct_t context = { s1, l, s2, labels, callback }; c=GBgetTransitionsAll(model,s1->state,iterate_transition,&context); if (c==0){ int ofs=edge_labels; for(i=0;i<edge_labels;i++) l->label[i]=-1; for(i=0;i<N;i++) { l->label[ofs+i] = s1->state[i]; /* for dummy deadlock s2->state[i] = - 1; */ /* for selfloop deadlock */ s2->state[i]=s1->state[i]; } ofs+=N; for(i=0;i<state_labels;i++) l->label[ofs+i] = labels[i]; callback(s1,l,s2); } } } else { callback_struct_t context = { s1, l, s2, NULL, callback }; c=GBgetTransitionsAll(model,s1->state,iterate_transition,&context); } }
static void explore_state_index(void*context,int idx,int*src){ model_t model=(model_t)context; int labels[state_labels]; if (state_labels){ GBgetStateLabelsAll(model,src,labels); } if(write_lts){ if(write_state){ enum_vec(output_handle,src,labels); } else { enum_seg(output_handle,0,idx,labels); } } switch(call_mode){ case UseBlackBox: GBgetTransitionsAll(model,src,index_next,&idx); break; case UseGreyBox: for(int i=0;i<K;i++){ GBgetTransitionsLong(model,i,src,index_next,&idx); } break; } explored++; if (explored%1000==0 && RTverbosity>=2) Warning(info,"explored %d visited %d trans %d",explored,visited,trans); }
void CAESAR_PRINT_STATE(CAESAR_TYPE_FILE f,CAESAR_TYPE_STATE s) { int i; chunk c; int labels[state_labels]; if (state_format==0) { fprintf(f, "state ["); for(i=0; i < N; i++) { if (i>0) fprintf(f, ","); fprintf(f, "%d", s->state[i]); } fprintf(f, "]\n"); } else if (state_format==1) { GBgetStateLabelsAll(model,s->state,labels); fprintf(f, "state <"); for(i=0; i < state_labels; i++) { if (i>0) fprintf(f, ";"); c=GBchunkGet(model,lts_type_get_state_label_typeno(ltstype,i),labels[i]); char str[c.len*2+6]; chunk2string(c,sizeof str,str); fprintf(f, "%s", str); } fprintf(f, ">"); } }
static void write_trace_state(trc_env_t *env, int *state) { int labels[env->state_labels]; if (env->state_labels) GBgetStateLabelsAll(env->model, state, labels); lts_write_state (env->trace_handle, 0, state, labels); }
void ta_pbfs (wctx_t *ctx) { alg_local_t *loc = ctx->local; alg_global_t *sm = ctx->global; size_t count; raw_data_t state_data; int labels[SL]; do { loc->counters.level_size = 0; // count states in next level loc->flip = 1 - loc->flip; for (size_t i = 0; i < W; i++) { size_t current = (i << 1) + loc->flip; while ((state_data = isba_pop_int (sm->queues[current])) && !run_is_stopped (ctx->run)) { if (grab_waiting(ctx, state_data)) { ta_explore_state (ctx); if (EXPECT_FALSE(loc->lts && write_state)){ state_data_t pins_state = state_info_pins_state (ctx->state); if (SL > 0) GBgetStateLabelsAll (ctx->model, pins_state, labels); lts_write_state (loc->lts, ctx->id, pins_state, labels); } } } } count = sbfs_level (ctx, loc->counters.level_size); } while (count && !run_is_stopped(ctx->run)); }
void CAESAR_DELTA_STATE(CAESAR_TYPE_FILE f,CAESAR_TYPE_STATE s1,CAESAR_TYPE_STATE s2) { int i; chunk c; int labels1[state_labels]; int labels2[state_labels]; if (state_format==0) { fprintf(f, "state ["); for(i=0; i < N; i++) { if (i>0) fprintf(f, ","); if (s1->state[i] == s2->state[i]) fprintf(f, "-"); else fprintf(f, "%d:=%d", s1->state[i], s2->state[i]); } fprintf(f, "]\n"); } else if (state_format==1) { GBgetStateLabelsAll(model,s1->state,labels1); GBgetStateLabelsAll(model,s2->state,labels2); fprintf(f, "state <"); for(i=0; i < state_labels; i++) { if (i>0) fprintf(f, ";"); if (s1->state[i] == s2->state[i]) fprintf(f, "-"); else { c=GBchunkGet(model,lts_type_get_state_label_typeno(ltstype,i),labels1[i]); { char str[c.len*2+6]; chunk2string(c,sizeof str,str); fprintf(f, "%s", str); } fprintf(f, ":="); c=GBchunkGet(model,lts_type_get_state_label_typeno(ltstype,i),labels2[i]); { char str[c.len*2+6]; chunk2string(c,sizeof str,str); fprintf(f, "%s", str); } } } fprintf(f, ">"); } }
static void sl_group (model_t model, sl_group_enum_t group, int *state, int *labels) { switch (group) { case GB_SL_ALL: GBgetStateLabelsAll(model, state, labels); return; case GB_SL_GUARDS: get_guard_all(model, state, labels); return; default: return; } }