static int type_max (check_ctx_t *ctx, int idx) { model_t model = ctx->parent; lts_type_t ltstype = GBgetLTStype (model); int typeno = lts_type_get_state_typeno (ltstype, idx); int c; switch (lts_type_get_format (ltstype, typeno)) { case LTStypeDirect: GBgetInitialState (model, ctx->src2); c = ctx->src2[idx]; return c == 0 ? 1 : c; case LTStypeRange: return lts_type_get_min (ltstype, typeno); case LTStypeEnum: c = pins_chunk_count (model, typeno); HREassert (c > 0, "Empty enum table for slot: %d -- %s", idx, str_slot(ctx, NULL, idx)); return c; case LTStypeChunk: c = pins_chunk_count (model, typeno); return c == 0 ? 1 : c; case LTStypeBool: return 1; case LTStypeTrilean: return 2; case LTStypeSInt32: return (1ULL<<31) - 1; default: { HREassert(false); return -1; } } }
static const char* data_format_string(lts_type_t t,int typeno){ int f=lts_type_get_format(t,typeno); switch(f){ case LTStypeDirect: return "direct"; case LTStypeRange: { char tmp[256]; sprintf(tmp,"[%d,%d]",lts_type_get_min(t,typeno),lts_type_get_max(t,typeno)); return strdup(tmp); } case LTStypeChunk: return "chunk"; case LTStypeEnum: return "enum"; } Abort("illegal format value: %d",f); }
static int type_min (check_ctx_t *ctx, int idx) { model_t model = ctx->parent; lts_type_t ltstype = GBgetLTStype (model); int typeno = lts_type_get_state_typeno (ltstype, idx); switch (lts_type_get_format (ltstype, typeno)) { case LTStypeRange: return lts_type_get_min (ltstype, typeno); case LTStypeDirect: case LTStypeEnum: case LTStypeChunk: case LTStypeBool: case LTStypeTrilean: case LTStypeSInt32: return 0; default: { HREassert(false); return -1; } } }