diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2005-09-08 08:01:00 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2005-09-08 08:01:00 -0700 |
commit | eb4cdcdcb4db6e468aa02a7949217fa6da245217 (patch) | |
tree | 34223999f598d157831c030392666a937b020992 /src/base/main | |
parent | 1260d20cc05fe2d21088cc047c460e85ccdb3b14 (diff) | |
download | abc-eb4cdcdcb4db6e468aa02a7949217fa6da245217.tar.gz abc-eb4cdcdcb4db6e468aa02a7949217fa6da245217.tar.bz2 abc-eb4cdcdcb4db6e468aa02a7949217fa6da245217.zip |
Version abc50908
Diffstat (limited to 'src/base/main')
-rw-r--r-- | src/base/main/main.c | 65 | ||||
-rw-r--r-- | src/base/main/main.h | 6 |
2 files changed, 68 insertions, 3 deletions
diff --git a/src/base/main/main.c b/src/base/main/main.c index 0622a3bd..d44dade9 100644 --- a/src/base/main/main.c +++ b/src/base/main/main.c @@ -20,6 +20,9 @@ #include "mainInt.h" +// this line should be included in the library project +#define _LIB + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -30,6 +33,8 @@ static int TypeCheck( Abc_Frame_t * pAbc, char * s); /// FUNCTION DEFITIONS /// //////////////////////////////////////////////////////////////////////// +#ifndef _LIB + /**Function************************************************************* Synopsis [The main() procedure.] @@ -64,8 +69,8 @@ int main( int argc, char * argv[] ) fInitRead = 0; fFinalWrite = 0; sInFile = sOutFile = NULL; - sprintf( sReadCmd, "read_blif_mv" ); - sprintf( sWriteCmd, "write_blif_mv" ); + sprintf( sReadCmd, "read" ); + sprintf( sWriteCmd, "write" ); util_getopt_reset(); while ((c = util_getopt(argc, argv, "c:hf:F:o:st:T:x")) != EOF) { @@ -226,6 +231,62 @@ usage: return 1; } +#endif + +/**Function************************************************************* + + Synopsis [Initialization procedure for the library project.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_Start() +{ + Abc_Frame_t * pAbc; + + // added to detect memory leaks: +#ifdef _DEBUG + _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); +#endif + + // get global frame (singleton pattern) + // will be initialized on first call + pAbc = Abc_FrameGetGlobalFrame(); + + // source the resource file + Abc_UtilsSource( pAbc ); +} + +/**Function************************************************************* + + Synopsis [Deallocation procedure for the library project.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_Stop() +{ + Abc_Frame_t * pAbc; + int fStatus = 0; + + // if the memory should be freed, quit packages + if ( fStatus == -2 ) + { + pAbc = Abc_FrameGetGlobalFrame(); + // perform uninitializations + Abc_FrameEnd( pAbc ); + // stop the framework + Abc_FrameDeallocate( pAbc ); + } +} /**Function******************************************************************** diff --git a/src/base/main/main.h b/src/base/main/main.h index 0d47dec5..6a2db817 100644 --- a/src/base/main/main.h +++ b/src/base/main/main.h @@ -73,7 +73,11 @@ typedef struct Abc_Frame_t_ Abc_Frame_t; /// FUNCTION DEFITIONS /// //////////////////////////////////////////////////////////////////////// -/*=== mvFrame.c ===========================================================*/ +/*=== main.c ===========================================================*/ +extern void Abc_Start(); +extern void Abc_Stop(); + +/*=== mainFrame.c ===========================================================*/ extern Abc_Ntk_t * Abc_FrameReadNet( Abc_Frame_t * p ); extern FILE * Abc_FrameReadOut( Abc_Frame_t * p ); extern FILE * Abc_FrameReadErr( Abc_Frame_t * p ); |