[esnacc-dev] [PATCH 1/5] snacc: Change c and c++ api

Aaron Conole aconole at bytheb.org
Mon Feb 27 20:36:41 UTC 2017


This is an API breaking change which moves snacc.h into the c-lib and cxx-lib
include directories.  A future follow up will adjust the code generators
to point to the include paths.

Signed-off-by: Aaron Conole <aconole at bytheb.org>
---
 Makefile.am                  |  2 +-
 c-lib/.gitignore             |  2 ++
 c-lib/automake.mk            | 14 +++++++++++---
 cxx-lib/.gitignore           |  2 ++
 cxx-lib/automake.mk          | 14 ++++++++++++--
 debian/libesnacc-dev.install |  2 --
 policy.h                     | 27 ---------------------------
 redhat/esnacc.spec.in        |  2 --
 snacc.h => snacc.h.in        | 25 +++++++++++++++++++++++--
 9 files changed, 51 insertions(+), 39 deletions(-)
 delete mode 100644 policy.h
 rename snacc.h => snacc.h.in (92%)

diff --git a/Makefile.am b/Makefile.am
index df2666c..08928b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,7 +61,7 @@ MAN_FRAGMENTS =
 MAN_ROOTS =
 noinst_DATA =
 noinst_HEADERS =
-nobase_include_HEADERS = snacc.h policy.h
+nobase_include_HEADERS =
 lib_LTLIBRARIES =
 noinst_man_MANS =
 noinst_PROGRAMS =
diff --git a/c-lib/.gitignore b/c-lib/.gitignore
index b1af50e..1231747 100644
--- a/c-lib/.gitignore
+++ b/c-lib/.gitignore
@@ -2,3 +2,5 @@
 .libs
 .deps
 libesnacc.pc
+inc/snacc.h
+inc/snacc.h.in
diff --git a/c-lib/automake.mk b/c-lib/automake.mk
index 4393e9f..677d231 100644
--- a/c-lib/automake.mk
+++ b/c-lib/automake.mk
@@ -1,6 +1,10 @@
 lib_LTLIBRARIES += c-lib/libcasn1.la
 
+BUILT_SOURCES += c-lib/inc/snacc.h
+
 c_lib_libcasn1_la_SOURCES = \
+	c-lib/inc/snacc.h \
+	c-lib/inc/snacc.h.in \
 	c-lib/src/asn1init.c \
 	c-lib/src/asn-octs.c \
 	c-lib/src/mem.c \
@@ -71,6 +75,7 @@ nobase_include_HEADERS += c-lib/inc/asn-any.h \
 	c-lib/inc/min-buf.h \
 	c-lib/inc/nibble-alloc.h \
 	c-lib/inc/print.h \
+	c-lib/inc/snacc.h \
 	c-lib/inc/sbuf.h \
 	c-lib/inc/snaccCder.h \
 	c-lib/inc/str-stk.h \
@@ -85,7 +90,6 @@ nobase_include_HEADERS += c-lib/inc/asn-any.h \
 	c-lib/inc/tbl-util.h
 
 c_lib_libcasn1_la_CFLAGS = \
-	-I$(top_srcdir) \
 	-I$(top_srcdir)/c-lib \
 	-I$(top_srcdir)/c-lib/src \
 	-I$(top_srcdir)/c-lib/inc
@@ -96,7 +100,11 @@ c_lib_libcasn1_la_LDFLAGS = \
 	$(all_lib_LDFLAGS)
 
 EXTRA_DIST += \
-	c-lib/libesnacc.pc.in
+	c-lib/libesnacc.pc.in \
+	c-lib/inc/snacc.h.in
 
 pkgconfig_DATA += c-lib/libesnacc.pc
-DISTCLEANFILES += c-lib/libesnacc.pc
+DISTCLEANFILES += c-lib/libesnacc.pc c-lib/inc/snacc.h
+
+c-lib/inc/snacc.h.in: snacc.h.in
+	cp $< $@
diff --git a/cxx-lib/.gitignore b/cxx-lib/.gitignore
index f841655..82f7b10 100644
--- a/cxx-lib/.gitignore
+++ b/cxx-lib/.gitignore
@@ -2,3 +2,5 @@
 .libs
 .deps
 libesnaccxx.pc
+inc/snacc.h
+inc/snacc.h.in
diff --git a/cxx-lib/automake.mk b/cxx-lib/automake.mk
index 249f2dc..4495a77 100644
--- a/cxx-lib/automake.mk
+++ b/cxx-lib/automake.mk
@@ -1,5 +1,7 @@
 lib_LTLIBRARIES += cxx-lib/libcxxasn1.la
 
+BUILT_SOURCES += cxx-lib/inc/snacc.h
+
 nobase_include_HEADERS += cxx-lib/inc/asn-buf.h \
 	cxx-lib/inc/asn-chartraits.h \
 	cxx-lib/inc/asn-config.h \
@@ -10,11 +12,14 @@ nobase_include_HEADERS += cxx-lib/inc/asn-buf.h \
 	cxx-lib/inc/asn-usefultypes.h \
 	cxx-lib/inc/init.h \
 	cxx-lib/inc/meta.h \
+	cxx-lib/inc/snacc.h \
 	cxx-lib/inc/snaccdll.h \
 	cxx-lib/inc/snaccexcept.h \
 	cxx-lib/inc/tcl-if.h
 
 cxx_lib_libcxxasn1_la_SOURCES = \
+	cxx-lib/inc/snacc.h \
+	cxx-lib/inc/snacc.h.in \
 	cxx-lib/src/asn-null.cpp \
 	cxx-lib/src/asn-oid.cpp \
 	cxx-lib/src/asn-RelativeOid.cpp \
@@ -80,7 +85,12 @@ cxx_lib_libcxxasn1_la_LDFLAGS = \
 	$(cxx_lib_libcxxasn1_la_WIN32_LDFLAGS)
 
 EXTRA_DIST += \
-	cxx-lib/libesnaccxx.pc.in
+	cxx-lib/libesnaccxx.pc.in \
+	cxx-lib/inc/snacc.h.in
 
 pkgconfig_DATA += cxx-lib/libesnaccxx.pc
-DISTCLEANFILES += cxx-lib/libesnaccxx.pc
+DISTCLEANFILES += cxx-lib/libesnaccxx.pc cxx-lib/inc/snacc.h
+
+cxx-lib/inc/snacc.h.in: snacc.h.in
+	cp $< $@
+
diff --git a/debian/libesnacc-dev.install b/debian/libesnacc-dev.install
index 046154d..b4a6dfb 100644
--- a/debian/libesnacc-dev.install
+++ b/debian/libesnacc-dev.install
@@ -1,7 +1,5 @@
 debian/tmp/usr/include/c-lib/inc
 debian/tmp/usr/include/cxx-lib/inc
-debian/tmp/usr/include/snacc.h
-debian/tmp/usr/include/policy.h
 debian/tmp/usr/lib/libcasn1.a
 debian/tmp/usr/lib/libcasn1.la
 debian/tmp/usr/lib/libcxxasn1.a
diff --git a/policy.h b/policy.h
deleted file mode 100644
index a92e019..0000000
--- a/policy.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * file: policy.h
- *
- */
-
-/*
- * enable the snacc compiler's Tcl interface generating code?
- * set it to 0 or 1.
- */
-#ifndef NO_TCL
-#define NO_TCL		0
-#endif
-
-/*
- * enable code for meta code generation?
- * the Tcl code needs it.
- */
-#ifndef NO_META
-#define NO_META		NO_TCL
-#endif
-
-/*
- * enable code for CORBA IDL generation?
- */
-#ifndef IDL
-#define IDL		1
-#endif
diff --git a/redhat/esnacc.spec.in b/redhat/esnacc.spec.in
index 290a21c..245d3f8 100644
--- a/redhat/esnacc.spec.in
+++ b/redhat/esnacc.spec.in
@@ -79,8 +79,6 @@ make DESTDIR=%{buildroot} install
 %files devel
 %_includedir/c-lib/inc
 %_includedir/cxx-lib/inc
-%_includedir/snacc.h
-%_includedir/policy.h
 %_libdir/lib*.a
 %_libdir/lib*.la
 %{_libdir}/pkgconfig/libesnacc.pc
diff --git a/snacc.h b/snacc.h.in
similarity index 92%
rename from snacc.h
rename to snacc.h.in
index d324a08..1b7a03a 100644
--- a/snacc.h
+++ b/snacc.h.in
@@ -119,13 +119,34 @@
 
 #endif /* __USE_ANSI_C__ */
 
-#include "policy.h"
+/*
+ * enable the snacc compiler's Tcl interface generating code?
+ * set it to 0 or 1.
+ */
+#ifndef NO_TCL
+#define NO_TCL		0
+#endif
+
+/*
+ * enable code for meta code generation?
+ * the Tcl code needs it.
+ */
+#ifndef NO_META
+#define NO_META		NO_TCL
+#endif
+
+/*
+ * enable code for CORBA IDL generation?
+ */
+#ifndef IDL
+#define IDL		1
+#endif
 
 #if COMPILER
 	// If we have TCL on this system then add TCL to the compiler
 	#if defined (HAVE_TCLNOT)
 		#define TCL	HAVE_TCL
-		#define META	1	
+		#define META	1
 	#endif
 #elif defined (ENABLE_TCL) && defined (HAVE_TCL)
 	#define TCL 1;
-- 
2.9.3




More information about the dev mailing list