Esempio n. 1
0
static void
output_types(FILE *tbl_file)
{
    int type_count = lts_type_get_type_count(ltstype);

    for (int i = 0; i < type_count; i++) {
        Warning(info, "dumping type %s", lts_type_get_type(ltstype, i));
        fprintf(tbl_file, "begin sort ");
        fprint_ltsmin_ident(tbl_file, lts_type_get_type(ltstype, i));
        fprintf(tbl_file, "\n");

        int values = pins_chunk_count (model,i);

        for (int j = 0; j < values; j++) {
            chunk c    = pins_chunk_get (model, i, j);
            size_t len = c.len * 2 + 6;
            char str[len];

            chunk2string(c, len, str);
            fprintf(tbl_file, "%s\n", str);
        }

        fprintf(tbl_file,"end sort\n");
    }
}
Esempio n. 2
0
static char *
str_group (check_ctx_t *ctx, int group)
{
    model_t         model = ctx->parent;
    lts_type_t      ltstype = GBgetLTStype (model);
    int             label = lts_type_find_edge_label (ltstype, LTSMIN_EDGE_TYPE_STATEMENT);
    if (label) return "NULL";
    int             type = lts_type_get_edge_label_typeno (ltstype, label);
    int             count = pins_chunk_count  (model, type);
    if (count < ctx->K) return "NULL";
    chunk           c = pins_chunk_get (model, type, group);
    return c.data;
}
Esempio n. 3
0
int
print_chunk (model_t model, char *res, int max, int typeno, int val)
{
    chunk           c;
    switch (lts_type_get_format (GBgetLTStype(model), typeno))
    {
        case LTStypeDirect:
        case LTStypeRange:
            return snprintf (res, max, "%d", val);
        case LTStypeEnum:
        case LTStypeChunk:
            c = pins_chunk_get (model, typeno, val);
            return snprintf (res, max, "%s", c.data);
        default: {
            HREassert(false);
            return -1;
        }
    }
}
Esempio n. 4
0
static void
save_snapshot_vset(FILE *f)
{
    /* Call hook */
    vset_pre_save(f, domain);

    /* Write domain */
    vdom_save(f, domain);

    /* Write initial state */
    vset_save(f, initial);

    /* Write number of transitions and all transitions */
    fwrite(&nGrps, sizeof(int), 1, f);
    for (int i=0; i<nGrps; i++) vrel_save_proj(f, group_next[i]);
    for (int i=0; i<nGrps; i++) vrel_save(f, group_next[i]);

    /* Write reachable states */
    int save_reachable = 1;
    fwrite(&save_reachable, sizeof(int), 1, f);
    vset_save(f, visited);

    /* Call hook */
    vset_post_save(f, domain);

    /* Now write action labels */
    int action_count = 0;
    if (act_label != -1) action_count = pins_chunk_count(model, action_typeno);
    fwrite(&action_count, sizeof(int), 1, f);
    for (int i=0; i<action_count; i++) {
        chunk ch = pins_chunk_get(model, action_typeno, i);
        uint32_t len = ch.len;
        char *action = ch.data;
        fwrite(&len, sizeof(uint32_t), 1, f);
        fwrite(action, sizeof(char), len, f);
    }
}