summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsterin <github@bsterin.com>2018-04-02 16:33:52 -0700
committerGitHub <noreply@github.com>2018-04-02 16:33:52 -0700
commita41a910864cb82e1374fc8920a087c35c506ed6d (patch)
treec86b44c512e59b28fc0fd2b1f96d5c2bdc124a40
parent1fc200ffacabed1796639b562181051614f5fedb (diff)
parentdc4320d7d7fa00975132f659b4a41052b3d0030f (diff)
downloadabc-a41a910864cb82e1374fc8920a087c35c506ed6d.tar.gz
abc-a41a910864cb82e1374fc8920a087c35c506ed6d.tar.bz2
abc-a41a910864cb82e1374fc8920a087c35c506ed6d.zip
Merge pull request #8 from sterin/master
Travis: build with namespaces enabled
-rw-r--r--.travis.yml15
-rw-r--r--src/demo.c27
2 files changed, 34 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml
index 3a8e243a..cf57dc38 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,6 +9,15 @@ matrix:
packages:
- libreadline-dev
+ - os: linux
+ addons:
+ apt:
+ packages:
+ - libreadline-dev
+ env:
+ MAKE_ARGS: ABC_USE_NAMESPACE=xxx
+ DEMO_ARGS: -DABC_NAMESPACE=xxx
+
- os: osx
osx_image: xcode8
before_install:
@@ -17,10 +26,10 @@ matrix:
script:
- - make -j2 abc
+ - make ${MAKE_ARGS} -j2 abc
- ./abc -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec"
- - make libabc.a
- - gcc -Wall -c src/demo.c -o demo.o
+ - make ${MAKE_ARGS} libabc.a
+ - g++ ${DEMO_ARGS} -Wall -c src/demo.c -o demo.o
- g++ -o demo demo.o libabc.a -lm -ldl -lreadline -lpthread
- ./demo i10.aig
diff --git a/src/demo.c b/src/demo.c
index eebb8aba..e6616d4b 100644
--- a/src/demo.c
+++ b/src/demo.c
@@ -25,14 +25,31 @@
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
+#if defined(ABC_NAMESPACE)
+namespace ABC_NAMESPACE
+{
+#elif defined(__cplusplus)
+extern "C"
+{
+#endif
+
// procedures to start and stop the ABC framework
// (should be called before and after the ABC procedures are called)
-extern void Abc_Start();
-extern void Abc_Stop();
+void Abc_Start();
+void Abc_Stop();
// procedures to get the ABC framework and execute commands in it
-extern void * Abc_FrameGetGlobalFrame();
-extern int Cmd_CommandExecute( void * pAbc, char * sCommand );
+typedef struct Abc_Frame_t_ Abc_Frame_t;
+
+Abc_Frame_t * Abc_FrameGetGlobalFrame();
+int Cmd_CommandExecute( Abc_Frame_t * pAbc, const char * sCommand );
+
+#if defined(ABC_NAMESPACE)
+}
+using namespace ABC_NAMESPACE;
+#elif defined(__cplusplus)
+}
+#endif
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
@@ -60,7 +77,7 @@ int main( int argc, char * argv[] )
int fPrintStats = 1;
int fVerify = 1;
// variables
- void * pAbc;
+ Abc_Frame_t * pAbc;
char * pFileName;
char Command[1000];
clock_t clkRead, clkResyn, clkVer, clk;