From ae091e695e50f0fa92d7e1e9484baf086e06a5a5 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 8 Mar 2013 18:58:54 -0800 Subject: Integrating box library. --- src/map/if/if.h | 1 + src/map/if/ifLibBox.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'src/map/if') 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 /// //////////////////////////////////////////////////////////////////////// -- cgit v1.2.3