diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-03-08 18:58:54 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-03-08 18:58:54 -0800 |
commit | ae091e695e50f0fa92d7e1e9484baf086e06a5a5 (patch) | |
tree | c5d317a83854c75b37c51f3d06c6ec4eb0a88f63 | |
parent | 467f8b651ad178a55d3c108f0544dd2accfb6d9a (diff) | |
download | abc-ae091e695e50f0fa92d7e1e9484baf086e06a5a5.tar.gz abc-ae091e695e50f0fa92d7e1e9484baf086e06a5a5.tar.bz2 abc-ae091e695e50f0fa92d7e1e9484baf086e06a5a5.zip |
Integrating box library.
-rw-r--r-- | src/map/if/if.h | 1 | ||||
-rw-r--r-- | src/map/if/ifLibBox.c | 32 | ||||
-rw-r--r-- | src/misc/extra/extraUtilFile.c | 1 |
3 files changed, 34 insertions, 0 deletions
diff --git a/src/map/if/if.h b/src/map/if/if.h index a22c4841..578866cb 100644 --- a/src/map/if/if.h +++ b/src/map/if/if.h @@ -515,6 +515,7 @@ extern If_LibBox_t * If_LibBoxRead( char * pFileName ); extern If_LibBox_t * If_LibBoxRead2( char * pFileName ); extern void If_LibBoxPrint( FILE * pFile, If_LibBox_t * p ); extern void If_LibBoxWrite( char * pFileName, If_LibBox_t * p ); +extern int If_LibBoxLoad( char * pFileName ); /*=== ifMan.c =============================================================*/ extern If_Man_t * If_ManStart( If_Par_t * pPars ); extern void If_ManRestart( If_Man_t * p ); diff --git a/src/map/if/ifLibBox.c b/src/map/if/ifLibBox.c index f420cf36..9423d4f9 100644 --- a/src/map/if/ifLibBox.c +++ b/src/map/if/ifLibBox.c @@ -20,6 +20,7 @@ #include "if.h" #include "misc/extra/extra.h" +#include "base/main/main.h" ABC_NAMESPACE_IMPL_START @@ -359,6 +360,37 @@ void If_LibBoxWrite( char * pFileName, If_LibBox_t * p ) fclose( pFile ); } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int If_LibBoxLoad( char * pFileName ) +{ + FILE * pFile; + If_LibBox_t * pLib; + char * pFileNameOther; + // check if library can be read + pFileNameOther = Extra_FileNameGenericAppend( pFileName, ".cdl" ); + pFile = fopen( pFileNameOther, "r" ); + if ( pFile == NULL ) + return 0; + fclose( pFile ); + // read library + pLib = If_LibBoxRead2( pFileNameOther ); + // replace the current library + If_LibBoxFree( (If_LibBox_t *)Abc_FrameReadLibBox() ); + Abc_FrameSetLibBox( pLib ); + return 1; +} + + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c index 721cbb12..cab36e29 100644 --- a/src/misc/extra/extraUtilFile.c +++ b/src/misc/extra/extraUtilFile.c @@ -146,6 +146,7 @@ char * Extra_FileNameExtension( char * FileName ) char * Extra_FileNameAppend( char * pBase, char * pSuffix ) { static char Buffer[500]; + assert( strlen(pBase) + strlen(pSuffix) < 500 ); sprintf( Buffer, "%s%s", pBase, pSuffix ); return Buffer; } |