コード例 #1
0
static void print_vector(int32_t *v) {
  uint32_t i, n;

  assert(v != NULL);
  n = iv_size(v);
  for (i=0; i<n; i++) {
    printf(" %"PRId32, v[i]);
  }
}
コード例 #2
0
static void print_class(int32_t *v) {
  uint32_t i, n;

  n = iv_size(v);
  assert(n >= 2);
  printf("{ x%"PRId32, v[0]);
  for (i=1; i<n; i++) {
    printf(", x%"PRId32, v[i]);
  }
  printf(" }");
}
コード例 #3
0
// all elements of v should be in the same class: check wether that's true
// in the equality queue
static void check_good_class(test_bench_t *bench, int32_t *v) {
  active_poly_table_t *table;
  equality_queue_t *queue;
  polynomial_t *p;
  uint32_t i, n;
  int32_t k, x, y;

  queue = &bench->equeue;
  table = &bench->act;

  n = iv_size(v);
  assert(n >= 2);
  k = v[0];
  assert(0 <= k && k < table->npolys);
  x = table->id[k];

  for (i=1; i<n; i++) {
    k = v[i];
    assert(0 <= k && k < table->npolys);
    y = table->id[k];

    if (root_of_var(queue, x) != root_of_var(queue, y)) {
      printf("BUG: MISSED Propagation: x%"PRId32" and x%"PRId32" should be equal\n\n", x, y);
      printf("  act[%"PRId32"]: x%"PRId32, v[0], x);
      p = bench->ptable->poly[x];
      if (p != NULL) {
	printf(" = ");
	print_poly(p);
      }
      printf("\n");
      printf("  act[%"PRId32"]: x%"PRId32, k, y);
      p = bench->ptable->poly[y];
      if (p != NULL) {
	printf(" = ");
	print_poly(p);
      }
      printf("\n\n");
      print_all_equalities(bench);
      printf("  norm(x%"PRId32") = ", x);
      print_normal_form(bench->act.norm[v[0]]);
      printf("\n");
      printf("  norm(x%"PRId32") = ", y);
      print_normal_form(bench->act.norm[k]);
      printf("\n\n");
      fflush(stdout);
      exit(1);
    }
  }
}
コード例 #4
0
ファイル: variable.c プロジェクト: yoshizow/mruby
mrb_value
mrb_obj_iv_inspect(mrb_state *mrb, struct RObject *obj)
{
  iv_tbl *t = obj->iv;
  int len = iv_size(mrb, t);

  if (len > 0) {
    const char *cn = mrb_obj_classname(mrb, mrb_obj_value(obj));
    mrb_value str = mrb_sprintf(mrb, "-<%s:%p", cn, (void*)obj);

    iv_foreach(mrb, t, inspect_i, &str);
    return str;
  }
  return mrb_any_to_s(mrb, mrb_obj_value(obj));
}
コード例 #5
0
static void print_active_class(active_poly_table_t *table, int32_t *v) {
  uint32_t i, n, k;

  n = iv_size(v);
  assert(n >= 2);

  k = v[0];
  assert(0 <= k && k < table->npolys);
  printf("{ x%"PRId32, table->id[k]);
  for (i=1; i<n; i++) {
    k = v[i];
    assert(0 <= k && k < table->npolys);
    printf(", x%"PRId32, table->id[k]);
  }
  printf(" }");
}
コード例 #6
0
ファイル: variable.c プロジェクト: koie/mruby
mrb_value
mrb_obj_iv_inspect(mrb_state *mrb, struct RObject *obj)
{
    iv_tbl *t = obj->iv;
    size_t len = iv_size(mrb, t);

    if (len > 0) {
        const char *cn = mrb_obj_classname(mrb, mrb_obj_value(obj));
        mrb_value str = mrb_str_buf_new(mrb, 30);

        mrb_str_buf_cat(mrb, str, "-<", 2);
        mrb_str_cat2(mrb, str, cn);
        mrb_str_cat(mrb, str, ":", 1);
        mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, obj));

        iv_foreach(mrb, t, inspect_i, &str);
        mrb_str_cat(mrb, str, ">", 1);
        return str;
    }
    return mrb_any_to_s(mrb, mrb_obj_value(obj));
}
コード例 #7
0
ファイル: variable.c プロジェクト: koie/mruby
size_t
mrb_gc_mark_iv_size(mrb_state *mrb, struct RObject *obj)
{
    return iv_size(mrb, obj->iv);
}