From 3db1557f45b03875a0a0b8adddcc15c4565895d2 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 11 Jun 2006 08:01:00 -0700 Subject: Version abc60611 --- src/misc/nm/module.make | 2 ++ src/misc/nm/nm.h | 2 ++ src/misc/nm/nmApi.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/misc/nm/nmInt.h | 1 + 4 files changed, 52 insertions(+) create mode 100644 src/misc/nm/module.make (limited to 'src/misc/nm') diff --git a/src/misc/nm/module.make b/src/misc/nm/module.make new file mode 100644 index 00000000..2a3820c7 --- /dev/null +++ b/src/misc/nm/module.make @@ -0,0 +1,2 @@ +SRC += src/misc/nm/nmApi.c \ + src/misc/nm/nmTable.c diff --git a/src/misc/nm/nm.h b/src/misc/nm/nm.h index 5b17aaed..9c96c8ba 100644 --- a/src/misc/nm/nm.h +++ b/src/misc/nm/nm.h @@ -52,10 +52,12 @@ extern Nm_Man_t * Nm_ManCreate( int nSize ); extern void Nm_ManFree( Nm_Man_t * p ); extern int Nm_ManNumEntries( Nm_Man_t * p ); extern char * Nm_ManStoreIdName( Nm_Man_t * p, int ObjId, char * pName, char * pSuffix ); +extern void Nm_ManDeleteIdName( Nm_Man_t * p, int ObjId ); extern char * Nm_ManCreateUniqueName( Nm_Man_t * p, int ObjId ); extern char * Nm_ManFindNameById( Nm_Man_t * p, int ObjId ); extern int Nm_ManFindIdByName( Nm_Man_t * p, char * pName, int * pSecond ); extern void Nm_ManPrintTables( Nm_Man_t * p ); +extern Vec_Int_t * Nm_ManReturnNameIds( Nm_Man_t * p ); #ifdef __cplusplus } diff --git a/src/misc/nm/nmApi.c b/src/misc/nm/nmApi.c index 72ec24e6..3a9ac074 100644 --- a/src/misc/nm/nmApi.c +++ b/src/misc/nm/nmApi.c @@ -135,6 +135,31 @@ char * Nm_ManStoreIdName( Nm_Man_t * p, int ObjId, char * pName, char * pSuffix return pEntry->Name; } +/**Function************************************************************* + + Synopsis [Creates a new entry in the name manager.] + + Description [Returns 1 if the entry with the given object ID + already exists in the name manager.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Nm_ManDeleteIdName( Nm_Man_t * p, int ObjId ) +{ + Nm_Entry_t * pEntry; + pEntry = Nm_ManTableLookupId(p, ObjId); + if ( pEntry == NULL ) + { + printf( "Nm_ManDeleteIdName(): This entry is not in the table.\n" ); + return; + } + // remove entry from the table + Nm_ManTableDelete( p, pEntry ); +} + /**Function************************************************************* @@ -255,6 +280,28 @@ void Nm_ManPrintTables( Nm_Man_t * p ) printf( "\n" ); } +/**Function************************************************************* + + Synopsis [Return the IDs of objects with names.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Vec_Int_t * Nm_ManReturnNameIds( Nm_Man_t * p ) +{ + Vec_Int_t * vNameIds; + int i; + vNameIds = Vec_IntAlloc( p->nEntries ); + for ( i = 0; i < p->nBins; i++ ) + if ( p->pBinsI2N[i] ) + Vec_IntPush( vNameIds, p->pBinsI2N[i]->ObjId ); + return vNameIds; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/misc/nm/nmInt.h b/src/misc/nm/nmInt.h index d0475c23..43901993 100644 --- a/src/misc/nm/nmInt.h +++ b/src/misc/nm/nmInt.h @@ -30,6 +30,7 @@ extern "C" { //////////////////////////////////////////////////////////////////////// #include "extra.h" +#include "vec.h" #include "nm.h" //////////////////////////////////////////////////////////////////////// -- cgit v1.2.3