summaryrefslogtreecommitdiffstats
path: root/src/misc/vec/vecPtr.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/vec/vecPtr.h')
-rw-r--r--src/misc/vec/vecPtr.h60
1 files changed, 53 insertions, 7 deletions
diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h
index ed2a481e..0f024f68 100644
--- a/src/misc/vec/vecPtr.h
+++ b/src/misc/vec/vecPtr.h
@@ -607,6 +607,26 @@ static inline void Vec_PtrFreeFree( Vec_Ptr_t * p )
/**Function*************************************************************
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static void Vec_PtrFreeFunc( Vec_Ptr_t * p, void (*pFuncItemFree)(void *) ) ___unused;
+static void Vec_PtrFreeFunc( Vec_Ptr_t * p, void (*pFuncItemFree)(void *) )
+{
+ void * pItem; int i;
+ Vec_PtrForEachEntry( void *, p, pItem, i )
+ if ( pItem ) pFuncItemFree( pItem );
+ Vec_PtrFree( p );
+}
+
+/**Function*************************************************************
+
Synopsis [Copies the interger array.]
Description []
@@ -626,6 +646,26 @@ static inline void Vec_PtrCopy( Vec_Ptr_t * pDest, Vec_Ptr_t * pSour )
/**Function*************************************************************
+ Synopsis [Print names stored in the array.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline void Vec_PtrPrintNames( Vec_Ptr_t * p )
+{
+ char * pName; int i;
+ printf( "Vector has %d entries: {", Vec_PtrSize(p) );
+ Vec_PtrForEachEntry( char *, p, pName, i )
+ printf( "%s ", pName );
+ printf( " }\n" );
+}
+
+/**Function*************************************************************
+
Synopsis []
Description []
@@ -651,6 +691,12 @@ static inline void Vec_PtrPushTwo( Vec_Ptr_t * p, void * Entry1, void * Entry2 )
Vec_PtrPush( p, Entry1 );
Vec_PtrPush( p, Entry2 );
}
+static inline void Vec_PtrAppend( Vec_Ptr_t * vVec1, Vec_Ptr_t * vVec2 )
+{
+ void * Entry; int i;
+ Vec_PtrForEachEntry( void *, vVec2, Entry, i )
+ Vec_PtrPush( vVec1, Entry );
+}
/**Function*************************************************************
@@ -912,8 +958,8 @@ static int Vec_PtrSortComparePtr( void ** pp1, void ** pp2 )
SeeAlso []
***********************************************************************/
-static void Vec_PtrSort( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)() ) ___unused;
-static void Vec_PtrSort( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)() )
+static void Vec_PtrSort( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)(const void *, const void *) ) ___unused;
+static void Vec_PtrSort( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)(const void *, const void *) )
{
if ( p->nSize < 2 )
return;
@@ -936,8 +982,8 @@ static void Vec_PtrSort( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)() )
SeeAlso []
***********************************************************************/
-static void Vec_PtrUniqify( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)() ) ___unused;
-static void Vec_PtrUniqify( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)() )
+static void Vec_PtrUniqify( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)(const void *, const void *) ) ___unused;
+static void Vec_PtrUniqify( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)(const void *, const void *) )
{
int i, k;
if ( p->nSize < 2 )
@@ -948,15 +994,15 @@ static void Vec_PtrUniqify( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)() )
p->pArray[k++] = p->pArray[i];
p->nSize = k;
}
-static void Vec_PtrUniqify2( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)(void**, void**), void (*Vec_PtrObjFree)(void*), Vec_Int_t * vCounts ) ___unused;
-static void Vec_PtrUniqify2( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)(void**, void**), void (*Vec_PtrObjFree)(void*), Vec_Int_t * vCounts )
+static void Vec_PtrUniqify2( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)(const void *, const void *), void (*Vec_PtrObjFree)(void*), Vec_Int_t * vCounts ) ___unused;
+static void Vec_PtrUniqify2( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)(const void *, const void *), void (*Vec_PtrObjFree)(void*), Vec_Int_t * vCounts )
{
int i, k;
if ( vCounts )
Vec_IntFill( vCounts, 1, 1 );
if ( p->nSize < 2 )
return;
- Vec_PtrSort( p, (int (*)())Vec_PtrSortCompare );
+ Vec_PtrSort( p, Vec_PtrSortCompare );
for ( i = k = 1; i < p->nSize; i++ )
if ( Vec_PtrSortCompare(p->pArray+i, p->pArray+k-1) != 0 )
{