00001 #include "mdd.h" 00002 00003 /* 00004 * MDD Package 00005 * 00006 * $Id: mdd_quit.c,v 1.12 2009/04/11 02:07:47 fabio Exp $ 00007 * 00008 * Author: Timothy Kam 00009 * 00010 * Copyright 1992 by the Regents of the University of California. 00011 * 00012 * All rights reserved. Permission to use, copy, modify and distribute 00013 * this software is hereby granted, provided that the above copyright 00014 * notice and this permission notice appear in all copies. This software 00015 * is made available as is, with no warranties. 00016 */ 00017 00018 void 00019 mdd_quit(mdd_manager *mgr) 00020 { 00021 int i; 00022 mvar_type one_mvar_struct; 00023 bvar_type one_bvar_struct; 00024 bdd_external_hooks *hook; 00025 array_t *mvar_list = mdd_ret_mvar_list(mgr); 00026 array_t *bvar_list = mdd_ret_bvar_list(mgr); 00027 00028 00029 for (i=0; i<array_n(mvar_list); i++) { 00030 one_mvar_struct = array_fetch(mvar_type, mvar_list, i); 00031 FREE(one_mvar_struct.name); 00032 FREE(one_mvar_struct.encoding); 00033 array_free(one_mvar_struct.bvars); 00034 } 00035 array_free(mvar_list); 00036 for (i=0; i<array_n(bvar_list); i++) { 00037 one_bvar_struct = array_fetch(bvar_type, bvar_list, i); 00038 mdd_free(one_bvar_struct.node); 00039 } 00040 array_free(bvar_list); 00041 00042 hook = bdd_get_external_hooks(mgr); 00043 FREE(hook->mdd); 00044 00045 bdd_end(mgr); 00046 } 00047 00048 00049 /* Removes all MDD variables from a manager. The underlying BDD manager is 00050 unaffected. 00051 */ 00052 void 00053 mdd_restart(mdd_manager *mgr) 00054 { 00055 mvar_type one_mvar_struct; 00056 bvar_type one_bvar_struct; 00057 array_t *mvar_list = mdd_ret_mvar_list(mgr); 00058 array_t *bvar_list = mdd_ret_bvar_list(mgr); 00059 00060 while (array_n(mvar_list)) { 00061 one_mvar_struct = array_fetch_last(mvar_type, mvar_list); 00062 FREE(one_mvar_struct.name); 00063 FREE(one_mvar_struct.encoding); 00064 array_free(one_mvar_struct.bvars); 00065 array_remove_last(mvar_list); 00066 } 00067 while (array_n(bvar_list)) { 00068 one_bvar_struct = array_fetch_last(bvar_type, bvar_list); 00069 mdd_free(one_bvar_struct.node); 00070 array_remove_last(bvar_list); 00071 } 00072 00073 } /* mdd_restart */ 00074 00075 /*---------------------------------------------------------------------------*/ 00076 /* Static function prototypes */ 00077 /*---------------------------------------------------------------------------*/