1 | #include "mdd.h" |
---|
2 | |
---|
3 | /* |
---|
4 | * MDD Package |
---|
5 | * |
---|
6 | * $Id: mdd_quit.c,v 1.12 2009/04/11 02:07:47 fabio Exp $ |
---|
7 | * |
---|
8 | * Author: Timothy Kam |
---|
9 | * |
---|
10 | * Copyright 1992 by the Regents of the University of California. |
---|
11 | * |
---|
12 | * All rights reserved. Permission to use, copy, modify and distribute |
---|
13 | * this software is hereby granted, provided that the above copyright |
---|
14 | * notice and this permission notice appear in all copies. This software |
---|
15 | * is made available as is, with no warranties. |
---|
16 | */ |
---|
17 | |
---|
18 | void |
---|
19 | mdd_quit(mdd_manager *mgr) |
---|
20 | { |
---|
21 | int i; |
---|
22 | mvar_type one_mvar_struct; |
---|
23 | bvar_type one_bvar_struct; |
---|
24 | bdd_external_hooks *hook; |
---|
25 | array_t *mvar_list = mdd_ret_mvar_list(mgr); |
---|
26 | array_t *bvar_list = mdd_ret_bvar_list(mgr); |
---|
27 | |
---|
28 | |
---|
29 | for (i=0; i<array_n(mvar_list); i++) { |
---|
30 | one_mvar_struct = array_fetch(mvar_type, mvar_list, i); |
---|
31 | FREE(one_mvar_struct.name); |
---|
32 | FREE(one_mvar_struct.encoding); |
---|
33 | array_free(one_mvar_struct.bvars); |
---|
34 | } |
---|
35 | array_free(mvar_list); |
---|
36 | for (i=0; i<array_n(bvar_list); i++) { |
---|
37 | one_bvar_struct = array_fetch(bvar_type, bvar_list, i); |
---|
38 | mdd_free(one_bvar_struct.node); |
---|
39 | } |
---|
40 | array_free(bvar_list); |
---|
41 | |
---|
42 | hook = bdd_get_external_hooks(mgr); |
---|
43 | FREE(hook->mdd); |
---|
44 | |
---|
45 | bdd_end(mgr); |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | /* Removes all MDD variables from a manager. The underlying BDD manager is |
---|
50 | unaffected. |
---|
51 | */ |
---|
52 | void |
---|
53 | mdd_restart(mdd_manager *mgr) |
---|
54 | { |
---|
55 | mvar_type one_mvar_struct; |
---|
56 | bvar_type one_bvar_struct; |
---|
57 | array_t *mvar_list = mdd_ret_mvar_list(mgr); |
---|
58 | array_t *bvar_list = mdd_ret_bvar_list(mgr); |
---|
59 | |
---|
60 | while (array_n(mvar_list)) { |
---|
61 | one_mvar_struct = array_fetch_last(mvar_type, mvar_list); |
---|
62 | FREE(one_mvar_struct.name); |
---|
63 | FREE(one_mvar_struct.encoding); |
---|
64 | array_free(one_mvar_struct.bvars); |
---|
65 | array_remove_last(mvar_list); |
---|
66 | } |
---|
67 | while (array_n(bvar_list)) { |
---|
68 | one_bvar_struct = array_fetch_last(bvar_type, bvar_list); |
---|
69 | mdd_free(one_bvar_struct.node); |
---|
70 | array_remove_last(bvar_list); |
---|
71 | } |
---|
72 | |
---|
73 | } /* mdd_restart */ |
---|
74 | |
---|
75 | /*---------------------------------------------------------------------------*/ |
---|
76 | /* Static function prototypes */ |
---|
77 | /*---------------------------------------------------------------------------*/ |
---|