summaryrefslogtreecommitdiffstats
path: root/src/map/if
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-03-08 18:58:54 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2013-03-08 18:58:54 -0800
commitae091e695e50f0fa92d7e1e9484baf086e06a5a5 (patch)
treec5d317a83854c75b37c51f3d06c6ec4eb0a88f63 /src/map/if
parent467f8b651ad178a55d3c108f0544dd2accfb6d9a (diff)
downloadabc-ae091e695e50f0fa92d7e1e9484baf086e06a5a5.tar.gz
abc-ae091e695e50f0fa92d7e1e9484baf086e06a5a5.tar.bz2
abc-ae091e695e50f0fa92d7e1e9484baf086e06a5a5.zip
Integrating box library.
Diffstat (limited to 'src/map/if')
-rw-r--r--src/map/if/if.h1
-rw-r--r--src/map/if/ifLibBox.c32
2 files changed, 33 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 ///
////////////////////////////////////////////////////////////////////////