|
1 | | -#include <stdio.h> |
2 | | -#include <stdlib.h> |
3 | | -#include <stdbool.h> |
4 | | -#include <limits.h> |
5 | | - |
6 | | -#include "utils.h" |
7 | | -#include "cubelist.h" |
8 | | - |
9 | | - |
10 | | -// bfun* constructors |
11 | | -bfun* bf_new_var (int v); |
12 | | -bfun* bool_to_bf (bfun* b, bool bl); |
13 | | -bfun* empty_bf(bfun* b); |
14 | | - |
15 | | -// single bfun* functions |
16 | | -bfun* complement(bfun* b); |
17 | | -bfun* try_simplify(bfun* b); |
18 | | -bool has_all_dc(bfun* b); |
19 | | - |
20 | | -// combining bfun*s |
21 | | -void append_cubes(bfun* b, bfun* g); |
22 | | -bfun* or(bfun* b, bfun* g); |
23 | | - |
24 | | -// bfun*s & variables |
25 | | -void and_var(bfun* b, int var); |
26 | | -int best_split(bfun* b); |
27 | | -bfun* pos_co(bfun* b, int x); |
28 | | -bfun* neg_co(bfun* b, int x); |
29 | | - |
30 | | - |
31 | | -int main(int argc, char* argv[]) { |
32 | | - char* filename; |
33 | | - if (argc > 1) filename = argv[1]; |
34 | | - else filename = "foo"; |
35 | | - char* out_file = "out.txt"; |
36 | | - |
37 | | - int vs = 4; |
38 | | - |
39 | | - /* |
40 | | - cube* plain = new_cube(vs); |
41 | | - cube* one_false = new_cube(vs); |
42 | | - set_false(one_false, 1); |
43 | | - */ |
44 | | - cube* one_true = new_cube(vs); |
45 | | - set_true(one_true, 1); |
46 | | - cube* one_each = new_cube(vs); |
47 | | - set_false(one_each, 1); |
48 | | - set_true(one_each, 2); |
49 | | - |
50 | | - cube_list* test1 = new_cube_list(vs); |
51 | | - add_cube(test1, one_each); |
52 | | - add_cube(test1, one_true); |
53 | | - |
54 | | - printf("\nComplementing...\n"); |
55 | | - print_bfun(test1); |
56 | | - |
57 | | - bfun* result = complement(test1); |
58 | | - printf("\n************************************\n"); |
59 | | - printf("\nResult is:\n"); |
60 | | - print_bfun(result); |
61 | | - printf("\n************************************\n"); |
62 | | - |
63 | | - del_bfun(test1); |
64 | | - del_bfun(result); |
65 | | - /* |
66 | | - del_cube(plain, vs); |
67 | | - del_cube(one_true, vs); |
68 | | - del_cube(one_false, vs); |
69 | | - del_cube(one_each, vs); |
70 | | - */ |
71 | | - |
72 | | - bfun* b = read_file(filename); |
73 | | - bfun* cb = complement(b); |
74 | | - |
75 | | - printf("\n************************************\n"); |
76 | | - printf("\nResult is:\n"); |
77 | | - print_bfun(cb); |
78 | | - printf("\n************************************\n"); |
79 | | - |
80 | | - write_file(out_file, cb); |
81 | | - |
82 | | - del_bfun(b); |
83 | | - del_bfun(cb); |
84 | | -} |
85 | | - |
| 1 | +#include "bfun.h" |
86 | 2 |
|
87 | 3 | bfun* complement (bfun* b_initial) { |
88 | 4 | // does not free argument. |
|
0 commit comments