예제 #1
0
static void init_base_types(void) {
  base[0] = bool_type(&types);               // bool
  base[1] = bv_type(&types, 5);              // bv5
  base[2] = new_scalar_type(&types, 3);      // scalar3
  base[3] = new_scalar_type(&types, 1);      // scalar1
  base[4] = pair_type(base[0], base[2]);     // bool x scalar3
  base[5] = pair_type(base[3], base[0]);     // scalar1 x bool
  base[6] = fun_type1(base[0], base[2]);     // [bool -> scalar3]
  base[7] = fun_type1(base[0], base[3]);     // [bool -> scalar1]
  base[8] = fun_type1(base[2], base[0]);     // [scalar3 -> bool]
  base[9] = fun_type1(base[3], base[0]);     // [scalar1 -> bool]
  base[10] = fun_type1(base[0], base[0]);    // [bool -> bool]
  base[11] = fun_type1(base[10], base[0]);   // [[bool -> bool] -> bool]

  // some infinite types
  base[12] = new_uninterpreted_type(&types);
  base[13] = real_type(&types);
  base[14] = int_type(&types);
  base[15] = fun_type1(base[14], base[0]);          // [int -> bool]
  base[16] = fun_type2(base[0], base[0], base[14]); // [bool, bool -> int]

  // larger finite types
  base[17] = pair_type(base[1], base[1]);   // bv5 x bv5
  base[18] = bv_type(&types, 40);           // bv40

  // infinite domain, unit range
  base[19] = fun_type1(base[13], base[3]);  // [real -> scalar1]
}
예제 #2
0
/*
 * Test 3: triples of booleans
 */
static void test3(void) {
  type_t tau[3];
  particle_t a, b;
  particle_t q[40], x;
  uint32_t n;

  printf("\n"
         "***********************\n"
	 "*       TEST 3        *\n"
         "***********************\n");

  tau[0] = bool_type(&types);
  tau[1] = bool_type(&types);
  tau[2] = bool_type(&types);

  // a=true, b=false
  a = pstore_labeled_particle(&store, 0, tau[0]);
  b = pstore_labeled_particle(&store, 1, tau[0]);

  printf("\nInitial objects of type tau!%"PRId32"\n", tau[0]);
  print_particle_def(a);
  print_particle_def(b);
  printf("\n");

  // Initial array: empty
  printf("Test array: ");
  print_particle_array(q, 0);
  printf("\n");

  // create new tuples until that fails
  for (n = 0; n<40; n++) {
    x = get_distinct_tuple(&store, 3, tau, n, q);
    if (x == null_particle) {
      printf("Saturation\n");
      break;
    }
    printf("New particle:");
    print_particle_def(x);
    q[n] = x;
  }

  printf("\nFinal set\n");
  print_particle_set(pstore_find_set_for_types(&store, 3, tau));
  printf("\n\n");

}
예제 #3
0
static void init_base_types(void) {
  base[0] = bool_type(&types);             // bool
  base[1] = bv_type(&types, 5);            // bv5
  base[2] = new_scalar_type(&types, 3);    // scalar3
  base[3] = new_scalar_type(&types, 1);    // scalar1
  base[4] = pair_type(base[0], base[2]);   // bool x scalar3
  base[5] = pair_type(base[3], base[0]);   // scalar1 x bool
  base[6] = fun_type1(base[0], base[2]);   // [bool -> scalar3]
  base[7] = fun_type1(base[0], base[3]);   // [bool -> scalar1]
  base[8] = fun_type1(base[2], base[0]);   // [scalar3 -> bool]
  base[9] = fun_type1(base[3], base[0]);   // [scalar1 -> bool]
}
예제 #4
0
hdf5_oprimitive::write_hdf5_dataset
(
    bool const* t,
    std::size_t data_count,
    std::size_t object_number
)
{
    hdf5_datatype bool_type(H5T_NATIVE_CHAR);
    bool_type.resize(sizeof(bool));

    write_dataset_basic(t, data_count, bool_type, object_number);
    bool_type.close();
}
예제 #5
0
/*
 * Create some types: this must be called after init_variables
 */
static void init_types(void) {
    base[0] = bool_type(&types);
    base[1] = int_type(&types);
    base[2] = real_type(&types);
    base[3] = var[0];
    base[4] = var[1];
    base[5] = var[2];
    base[6] = pair_type(base[1], base[1]);
    base[7] = triple_type(var[3], base[0], var[3]);
    base[8] = binary_ftype(base[2], base[2], base[0]);
    base[9] = binary_ftype(var[4], var[5], base[0]);
    base[10] = ternary_ftype(base[1], base[1], base[1], base[2]);
    base[11] = ternary_ftype(base[2], base[2], base[2], base[0]);
}
예제 #6
0
/*
 * TEST6: (-> (-> (-> bool bool) bool) bool)
 */
static void test_deep_type(void) {
  type_t b, tau;

  b = bool_type(&types);
  tau = fun_type1(b, b);  // (-> bool bool)
  tau = fun_type1(tau, b);   // (-> (-> bool bool) bool)
  tau = fun_type1(tau, b);   // (-> (-> (-> bool bool) bool) bool)

  printf("*****************************\n"
	 "*   NESTED FUNCTION TYPE    *\n"
	 "*****************************\n"
	 "\n");

  test_enum_type(tau);
}
예제 #7
0
/*
 * Test 4: pairs (scalar6 x bool)
 * - start with scalar6 empty
 * - if test3 is called first, bool is saturated
 */
static void test4(void) {
  type_t tau[2];
  particle_t q[40], x;
  uint32_t n;

  printf("\n"
         "***********************\n"
	 "*       TEST 4        *\n"
         "***********************\n");

  tau[0] = new_scalar_type(&types, 6);
  tau[1] = bool_type(&types);

  // Initial array: empty
  printf("Test array: ");
  print_particle_array(q, 0);
  printf("\n");

  // create new tuples until that fails
  for (n = 0; n<40; n++) {
    x = get_distinct_tuple(&store, 2, tau, n, q);
    if (x == null_particle) {
      printf("Saturation\n");
      break;
    }
    printf("New particle:");
    print_particle_def(x);
    q[n] = x;
  }

  printf("\nFinal sets\n");
  print_particle_set(pstore_find_set_for_type(&store, tau[0]));
  printf("\n");
  print_particle_set(pstore_find_set_for_type(&store, tau[1]));
  printf("\n");
  print_particle_set(pstore_find_set_for_types(&store, 2, tau));
  printf("\n\n");

}
예제 #8
0
 static void
 call(Iterator const& first, Iterator const& last, bool& attr)
 {
     Iterator first_ = first;
     qi::parse(first_, last, bool_type(), attr);
 }