#include <stdio.h>
Go to the source code of this file.
typedef struct Vec_Att_t_ Vec_Att_t |
enum Vec_AttrType_t |
CFile****************************************************************
FileName [vecAtt.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Resizable arrays.]
Synopsis [Array of user-specified attiributes.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [
] INCLUDES /// PARAMETERS ///
Definition at line 35 of file vecAtt.h.
00035 { 00036 VEC_ATTR_NONE = 0, // 0 00037 VEC_ATTR_COPY, // 1 00038 VEC_ATTR_LOCAL_AIG, // 2 00039 VEC_ATTR_LOCAL_SOP, // 3 00040 VEC_ATTR_LOCAL_BDD, // 4 00041 VEC_ATTR_GLOBAL_AIG, // 5 00042 VEC_ATTR_GLOBAL_SOP, // 6 00043 VEC_ATTR_GLOBAL_BDD, // 7 00044 VEC_ATTR_LEVEL, // 8 00045 VEC_ATTR_LEVEL_REV, // 9 00046 VEC_ATTR_RETIME_LAG, // 10 00047 VEC_ATTR_FRAIG, // 11 00048 VEC_ATTR_MVVAR, // 12 00049 VEC_ATTR_DATA1, // 13 00050 VEC_ATTR_DATA2, // 14 00051 VEC_ATTR_TOTAL_NUM // 15 00052 } Vec_AttrType_t;
static Vec_Att_t* Vec_AttAlloc | ( | int | fInteger, | |
int | nSize, | |||
void * | pMan, | |||
void(*)(void *) | pFuncFreeMan, | |||
void *(*)(void *) | pFuncStartObj, | |||
void(*)(void *, void *) | pFuncFreeObj | |||
) | [inline, static] |
MACRO DEFINITIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Allocates a vector with the given capacity.]
Description []
SideEffects []
SeeAlso []
Definition at line 91 of file vecAtt.h.
00096 { 00097 Vec_Att_t * p; 00098 p = ALLOC( Vec_Att_t, 1 ); 00099 memset( p, 0, sizeof(Vec_Att_t) ); 00100 p->pMan = pMan; 00101 p->pFuncFreeMan = pFuncFreeMan; 00102 p->pFuncStartObj = pFuncStartObj; 00103 p->pFuncFreeObj = pFuncFreeObj; 00104 p->nCap = nSize? nSize : 16; 00105 if ( fInteger ) 00106 { 00107 p->pArrayInt = ALLOC( int, p->nCap ); 00108 memset( p->pArrayInt, 0xff, sizeof(int) * p->nCap ); 00109 } 00110 else 00111 { 00112 p->pArrayPtr = ALLOC( void *, p->nCap ); 00113 memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap ); 00114 } 00115 return p; 00116 }
static void** Vec_AttArray | ( | Vec_Att_t * | p | ) | [inline, static] |
static int* Vec_AttArrayInt | ( | Vec_Att_t * | p | ) | [inline, static] |
static void Vec_AttClear | ( | Vec_Att_t * | p | ) | [inline, static] |
Function*************************************************************
Synopsis [Clears the vector.]
Description []
SideEffects []
SeeAlso []
Definition at line 172 of file vecAtt.h.
00173 { 00174 // free the attributes of objects 00175 if ( p->pFuncFreeObj ) 00176 { 00177 int i; 00178 if ( p->pArrayInt ) 00179 { 00180 if ( p->pFuncFreeObj ) 00181 for ( i = 0; i < p->nCap; i++ ) 00182 if ( p->pArrayInt[i] ) 00183 p->pFuncFreeObj( p->pMan, (void *)p->pArrayInt[i] ); 00184 } 00185 else 00186 { 00187 if ( p->pFuncFreeObj ) 00188 for ( i = 0; i < p->nCap; i++ ) 00189 if ( p->pArrayPtr[i] ) 00190 p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] ); 00191 } 00192 } 00193 if ( p->pArrayInt ) 00194 memset( p->pArrayInt, 0xff, sizeof(int) * p->nCap ); 00195 else 00196 memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap ); 00197 00198 }
static void* Vec_AttEntry | ( | Vec_Att_t * | p, | |
int | i | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Returns the entry.]
Description []
SideEffects []
SeeAlso []
Definition at line 307 of file vecAtt.h.
00308 { 00309 assert( p->pArrayPtr ); 00310 if ( i >= p->nCap ) 00311 Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i + 10 ); 00312 if ( p->pArrayPtr[i] == NULL && p->pFuncStartObj ) 00313 p->pArrayPtr[i] = p->pFuncStartObj( p->pMan ); 00314 return p->pArrayPtr[i]; 00315 }
static int Vec_AttEntryInt | ( | Vec_Att_t * | p, | |
int | i | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Returns the entry.]
Description []
SideEffects []
SeeAlso []
static void* Vec_AttFree | ( | Vec_Att_t * | p, | |
int | fFreeMan | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Frees the vector.]
Description []
SideEffects []
SeeAlso []
Definition at line 129 of file vecAtt.h.
00130 { 00131 void * pMan; 00132 if ( p == NULL ) 00133 return NULL; 00134 // free the attributes of objects 00135 if ( p->pFuncFreeObj ) 00136 { 00137 int i; 00138 if ( p->pArrayInt ) 00139 { 00140 for ( i = 0; i < p->nCap; i++ ) 00141 if ( p->pArrayInt[i] ) 00142 p->pFuncFreeObj( p->pMan, (void *)p->pArrayInt[i] ); 00143 } 00144 else 00145 { 00146 for ( i = 0; i < p->nCap; i++ ) 00147 if ( p->pArrayPtr[i] ) 00148 p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] ); 00149 } 00150 } 00151 // free the memory manager 00152 pMan = fFreeMan? NULL : p->pMan; 00153 if ( p->pMan && fFreeMan ) 00154 p->pFuncFreeMan( p->pMan ); 00155 FREE( p->pArrayInt ); 00156 FREE( p->pArrayPtr ); 00157 FREE( p ); 00158 return pMan; 00159 }
static void Vec_AttFreeEntry | ( | Vec_Att_t * | p, | |
int | i | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Deletes one entry from the attribute manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 211 of file vecAtt.h.
00212 { 00213 if ( i >= p->nCap ) 00214 return; 00215 if ( p->pMan ) 00216 { 00217 if ( p->pArrayInt[i] && p->pFuncFreeObj ) 00218 p->pFuncFreeObj( p->pMan, (void *)p->pArrayInt[i] ); 00219 if ( p->pArrayPtr[i] && p->pFuncFreeObj ) 00220 p->pFuncFreeObj( p->pMan, (void *)p->pArrayPtr[i] ); 00221 } 00222 if ( p->pArrayInt ) 00223 p->pArrayInt[i] = ~(unsigned)0; 00224 else 00225 p->pArrayPtr[i] = NULL; 00226 }
static void Vec_AttGrow | ( | Vec_Att_t * | p, | |
int | nCapMin | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Resizes the vector to the given capacity.]
Description []
SideEffects []
SeeAlso []
Definition at line 239 of file vecAtt.h.
00240 { 00241 if ( p->nCap >= nCapMin ) 00242 return; 00243 if ( p->pArrayInt ) 00244 { 00245 p->pArrayInt = REALLOC( int, p->pArrayInt, nCapMin ); 00246 memset( p->pArrayInt + p->nCap, 0xff, sizeof(int) * (nCapMin - p->nCap) ); 00247 } 00248 else 00249 { 00250 p->pArrayPtr = REALLOC( void *, p->pArrayPtr, nCapMin ); 00251 memset( p->pArrayPtr + p->nCap, 0, sizeof(void *) * (nCapMin - p->nCap) ); 00252 } 00253 p->nCap = nCapMin; 00254 }
static void* Vec_AttMan | ( | Vec_Att_t * | p | ) | [inline, static] |
static void Vec_AttWriteEntry | ( | Vec_Att_t * | p, | |
int | i, | |||
void * | pEntry | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Writes the entry into its place.]
Description [Only works if the manager is not defined.]
SideEffects []
SeeAlso []
Definition at line 267 of file vecAtt.h.
00268 { 00269 assert( p->pArrayPtr ); 00270 assert( p->pFuncStartObj == NULL ); 00271 if ( i >= p->nCap ) 00272 Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i + 10 ); 00273 p->pArrayPtr[i] = pEntry; 00274 }
static void Vec_AttWriteEntryInt | ( | Vec_Att_t * | p, | |
int | i, | |||
int | Entry | |||
) | [inline, static] |
Function*************************************************************
Synopsis [Writes the entry into its place.]
Description [Only works if the manager is not defined.]
SideEffects []
SeeAlso []
Definition at line 287 of file vecAtt.h.
00288 { 00289 assert( p->pArrayInt ); 00290 assert( p->pFuncStartObj == NULL ); 00291 if ( i >= p->nCap ) 00292 Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i + 10 ); 00293 p->pArrayInt[i] = Entry; 00294 }