コード例 #1
0
/*
 * Print model, including the aliased terms
 * - one line per term
 * - if model->has_alias is true, then the value of all terms in
 *   the alias table is displayed
 * - if model->has_alias is false, then this is the same as model_print
 */
void model_print_full(FILE *f, model_t *model) {
  evaluator_t eval;
  ivector_t v;
  term_t *a;
  uint32_t n;

  if (model->has_alias && model->alias_map != NULL) {
    init_evaluator(&eval, model);

    // collect all terms that have a name
    init_ivector(&v, 0);
    model_collect_terms(model, true, model->terms, term_to_print, &v);

    n = v.size;
    a = v.data;
    eval_print_bool_assignments(f, &eval, a, n);
    eval_print_arithmetic_assignments(f, &eval, a, n);
    eval_print_bitvector_assignments(f, &eval, a, n);
    eval_print_constant_assignments(f, &eval, a, n);
    eval_print_tuple_assignments(f, &eval, a, n);
    eval_print_function_assignments(f, &eval, a, n);
    vtbl_print_queued_functions(f, &model->vtbl, true);
    delete_evaluator(&eval);
    delete_ivector(&v);
  } else {
    model_print(f, model);
  }
}
コード例 #2
0
/*
 * Test
 * - create values of type tau
 * - n: max number of fresh values to try (assumed positive)
 */
static void test_type(type_t tau, uint32_t n) {
  value_t v;
  uint32_t i;

  printf("==== Test fresh values of type ");
  print_type(stdout, &types, tau);
  printf(" ====\n");
  printf("cardinality: %"PRIu32"\n\n", type_card(&types, tau));

  i = 0;
  do {
    v = make_fresh_value(&maker, tau);
    if (v == null_value) break;
    i ++;
    printf("val[%"PRIu32"] = ", i);
    vtbl_print_object(stdout, &vtbl, v);
    printf("\n");
    if (vtbl_queue_is_nonempty(&vtbl)) {
      vtbl_print_queued_functions(stdout, &vtbl, true);
      printf("\n");
    }
  } while (i <n);

  printf("\n---> got %"PRIu32" fresh values\n\n", i);
}
コード例 #3
0
/*
 * Print the model->map table
 */
void model_print(FILE *f, model_t *model) {
  ivector_t v;
  term_t *a;
  uint32_t n;

  init_ivector(&v, 0);
  model_collect_terms(model, false, model->terms, term_to_print, &v);

  n = v.size;
  a = v.data;
  model_print_bool_assignments(f, model, a, n);
  model_print_arithmetic_assignments(f, model, a, n);
  model_print_bitvector_assignments(f, model, a, n);
  model_print_constant_assignments(f, model, a, n);
  model_print_tuple_assignments(f, model, a, n);
  model_print_function_assignments(f, model, a, n);
  vtbl_print_queued_functions(f, &model->vtbl, true);
  delete_ivector(&v);
}
コード例 #4
0
static void test_enum_type(type_t tau) {
  uint32_t i, n;
  value_t x;

  assert(is_finite_type(&types, tau) && type_card_is_exact(&types, tau));

  n = type_card(&types, tau);
  printf("==== Enumerating elements of type ");
  print_type(stdout, &types, tau);
  printf(" ====\n");
  printf("cardinality: %"PRIu32"\n", n);
  for (i=0; i<n; i++) {
    x = vtbl_gen_object(&vtbl, tau, i);
    printf("elem[%"PRIu32"] = ", i);
    vtbl_print_object(stdout, &vtbl, x);
    printf("\n");
    if (vtbl_queue_is_nonempty(&vtbl)) {
      vtbl_print_queued_functions(stdout, &vtbl, true);
      printf("\n");
    }
  }
  printf("\n");
}