Integrating box library.

This commit is contained in:
Alan Mishchenko 2013-03-08 18:58:54 -08:00
parent 467f8b651a
commit ae091e695e
3 changed files with 34 additions and 0 deletions

View File

@ -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 );

View File

@ -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 ///
////////////////////////////////////////////////////////////////////////

View File

@ -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;
}