Debian Codegraph @

Examples/bdd_volatility

raw
1 bdd_ptr bddpaths[10];
2
3 /* function that updates BDD pointers floating around in user's code;
4 the remaining ones are kept in the sub_results list below */
5
6 void update_bddpaths(unsigned (*new_place) (unsigned node)) {
7 int j;
8
9 /* update the pointers in bddpaths */
10
11 for (j = 0; j < exp_count; j++)
12 bddpaths[j] = new_place(bddpaths[j]);
13 }
14
15 /* we can only update pointers that are not stored as local
16 variables, so values of local variables are thrown onto a stack */
17
18 DECLARE_SEQUENTIAL_LIST(sub_results, unsigned);
19
20 bdd_ptr makepath(bdd_manager *bddm, ...,
21 void (*update_bddpaths)
22 (unsigned (*new_place) (unsigned node))) {
23
24 ...
25 bdd_ptr res, sub_res, default_state_ptr;
26
27 sub_res = makepath(bddm, n+1, leaf_value, update_bddpaths);
28
29 /* push BDD pointer sub_res on list sub_results */
30
31 PUSH_SEQUENTIAL_LIST(sub_results, unsigned, sub_res);
32
33 /* insert a new hashed node; thus potentially changing the pointer
34 to the node known as sub_res above, and also potentially changing
35 the pointers in bddpaths[10]. But bdd_find_leaf_hashed automatically
36 updates all pointers in the sub_results list, since it was provided
37 as an argument. Also, the function update_bddpaths is called when a
38 doubling of the table takes place and an appropriate renaming function
39 new_place is supplied by bdd_find_leaf_hashed */
40
41 default_state_ptr =
42 bdd_find_leaf_hashed(bddm,
43 default_state,
44 SEQUENTIAL_LIST(sub_results),
45 update_bddpaths);
46
47 /* restore the value of sub_res */
48
49 POP_SEQUENTIAL_LIST(sub_results, unsigned, sub_res);
50 ...
51 }