int * DddmpIntArrayRead ( FILE *fp /* IN: input file */, int n /* IN: size of the array */ ) { int *array; int i; assert(fp!=NULL); array = DDDMP_ALLOC(int, n); if (array == NULL) { (void) fprintf (stderr, "DddmpIntArrayRead: Error allocating memory\n"); fflush (stderr); return NULL; } for (i=0; i < n; i++) { if (fscanf (fp, "%d", &array[i])==EOF) { (void) fprintf (stderr, "DddmpIntArrayRead: Error reading file - EOF found\n"); fflush (stderr); DDDMP_FREE (array); return (NULL); } } return (array); }
DdNode * Dddmp_cuddBddLoad ( DdManager *ddMgr /* IN: DD Manager */, Dddmp_VarMatchType varMatchMode /* IN: storing mode selector */, char **varmatchnames /* IN: array of variable names - by IDs */, int *varmatchauxids /* IN: array of variable auxids - by IDs */, int *varcomposeids /* IN: array of new ids accessed - by IDs */, int mode /* IN: requested input file format */, char *file /* IN: file name */, FILE *fp /* IN: file pointer */ ) { DdNode *f , **tmpArray; int i, nRoots; nRoots = Dddmp_cuddBddArrayLoad(ddMgr,DDDMP_ROOT_MATCHLIST,NULL, varMatchMode,varmatchnames,varmatchauxids,varcomposeids, mode,file,fp,&tmpArray); if (nRoots == 0) { return (NULL); } else { f = tmpArray[0]; if (nRoots > 1) { fprintf (stderr, "Warning: %d BDD roots found in file. Only first retrieved.\n", nRoots); for (i=1; i<nRoots; i++) { Cudd_RecursiveDeref (ddMgr, tmpArray[i]); } } DDDMP_FREE (tmpArray); return (f); } }
void DddmpStrArrayFree ( char **array /* IN: array of strings */, int n /* IN: size of the array */ ) { int i; if (array == NULL) { return; } for (i=0; i<n; i++) { DDDMP_FREE (array[i]); } DDDMP_FREE (array); return; }