[esnacc-dev] [RFC PATCH 1/5] snacc: Change c and c++ api
Aaron Conole
aconole at bytheb.org
Tue Jan 3 22:25:12 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 | 168 --------------------------------------
snacc.h.in | 189 +++++++++++++++++++++++++++++++++++++++++++
10 files changed, 217 insertions(+), 205 deletions(-)
delete mode 100644 policy.h
delete mode 100644 snacc.h
create mode 100644 snacc.h.in
diff --git a/Makefile.am b/Makefile.am
index 60853fc..f5875fc 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
deleted file mode 100644
index d324a08..0000000
--- a/snacc.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * file: snacc.h
- *
- * INSERT_VDA_COMMENTS
- *
- * $Header: /baseline/SNACC/snacc.h,v 1.13 2004/03/22 20:04:00 gronej Exp $
- * $Log: snacc.h,v $
- * Revision 1.13 2004/03/22 20:04:00 gronej
- * took IBM references out of the code (to the best of our knowledge, we don't use any of it anymore)
- *
- * Revision 1.12 2003/12/17 19:05:02 gronej
- * SNACC baseline merged with PER v1_7 tag
- *
- * Revision 1.11.2.1 2003/11/05 14:58:53 gronej
- * working PER code merged with esnacc_1_6
- *
- * Revision 1.11 2003/02/21 12:13:16 leonberp
- * cleaned up project settings for 1.5 release
- *
- * Revision 1.10 2002/12/16 17:23:11 mcphersc
- * DISABLED TCL
- *
- * Revision 1.9 2002/12/13 17:43:43 mcphersc
- * Modified the defines for META and TCL for use with the configure script
- *
- * Revision 1.8 2002/12/13 17:31:56 mcphersc
- * Modified TCL/META defines
- *
- * Revision 1.7 2002/12/10 14:21:19 mcphersc
- * *** empty log message ***
- *
- * Revision 1.6 2002/12/10 13:41:10 mcphersc
- * Added undefine of TCL for compiler code only.
- *
- * Revision 1.5 2002/09/04 18:33:43 vracarl
- * got rid of c++ comments
- *
- * Revision 1.4 2002/05/10 16:25:43 leonberp
- * latest changes for release 2.2
- *
- * Revision 1.3 2002/01/10 20:04:41 sfl
- * Updates to Unix ./configure script so that config.h is named
- * config_Used.h (similar to config_win32.h for windows). This allows the
- * run-time libs and includes to use a unique include, but still be
- * dynamically built for the individual platform.
- *
- * Revision 1.2 2000/10/24 14:54:37 rwc
- * Updated to remove high-level warnings (level 4 on MSVC++) for an easier build.
- * SOME warnings persist due to difficulty in modifying the SNACC compiler to
- * properly build clean source; also some files are built by Lex/Yacc.
- *
- * Revision 1.1.1.1 2000/08/21 20:35:45 leonberp
- * First CVS Version of SNACC.
- *
- * Revision 1.7 1997/04/07 13:13:18 wan
- * Made more C++ readable (credits to Steve Walker)
- *
- * Revision 1.6 1997/02/28 13:39:35 wan
- * Modifications collected for new version 1.3: Bug fixes, tk4.2.
- *
- * Revision 1.5 1997/02/15 20:38:48 rj
- * In member functions, return *this after calling abort() for stupid compilers that don't seem to know about volatile abort() (they would otherwise abort with an error).
- *
- * Revision 1.4 1995/07/24 15:06:52 rj
- * configure checks for mem* functions. define replacements using b* functions, if necessary.
- *
- */
-
-#ifndef _SNACC_H_
-#define _SNACC_H_
-
-#define GLASS 1
-#define KHO 1
-
-#define memzero(p, len) memset(p, 0, len)
-
-#ifdef __cplusplus
-
-#ifdef VOLATILE_RETRUN
-# define RETURN_THIS_FOR_COMPILERS_WITHOUT_VOLATILE_FUNCTIONS return *this;
-#else
-# define RETURN_THIS_FOR_COMPILERS_WITHOUT_VOLATILE_FUNCTIONS
-#endif
-
-#else /* !__cplusplus */
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#endif /* __cplusplus */
-
-/*
- * Inspired by gdb 4.0, for better or worse...
- * (grabbed from Barry Brachman - MS)
- *
- * These macros munge C routine declarations such
- * that they work for ANSI or non-ANSI C compilers
- */
-#ifndef __USE_NON_ANSI_C__
-
-#define PROTO( X) X
-#define PARAMS( arglist, args) (args)
-#define NOPARAMS() (void)
-#define _AND_ ,
-#define DOTS , ...
-
-#else /* __USE_ANSI_C__ */
-
-#define PROTO( X) ()
-#define PARAMS( arglist, args) arglist args;
-#define NOPARAMS() ()
-#define _AND_ ;
-#define DOTS
-#define void char
-
-#endif /* __USE_ANSI_C__ */
-
-#include "policy.h"
-
-#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
- #endif
-#elif defined (ENABLE_TCL) && defined (HAVE_TCL)
- #define TCL 1;
- #define META 1;
-#endif
-
-#ifdef ENABLE_META
-#ifndef META
- #define META 1
-#endif
-#endif
-
-#define COMMA ,
-
-#define if_IBM_ENC( code)
-
-
-#ifdef META
-#define if_META( code) code
-#else
-#define if_META( code)
-#endif
-
-#if defined(TCL) && defined (META)
-#define if_TCL( code) code
-#else
-#define if_TCL( code)
-#endif
-
-#if __GNUC__
-#define ESNACC_UNUSED __attribute__((__unused__))
-#else
-#define ESNACC_UNUSED
-#endif
-
-#ifdef WIN32
-#define inline __inline
-#endif
-
-#endif /* _SNACC_H_ */
diff --git a/snacc.h.in b/snacc.h.in
new file mode 100644
index 0000000..fd68178
--- /dev/null
+++ b/snacc.h.in
@@ -0,0 +1,189 @@
+/*
+ * file: snacc.h
+ *
+ * INSERT_VDA_COMMENTS
+ *
+ * $Header: /baseline/SNACC/snacc.h,v 1.13 2004/03/22 20:04:00 gronej Exp $
+ * $Log: snacc.h,v $
+ * Revision 1.13 2004/03/22 20:04:00 gronej
+ * took IBM references out of the code (to the best of our knowledge, we don't use any of it anymore)
+ *
+ * Revision 1.12 2003/12/17 19:05:02 gronej
+ * SNACC baseline merged with PER v1_7 tag
+ *
+ * Revision 1.11.2.1 2003/11/05 14:58:53 gronej
+ * working PER code merged with esnacc_1_6
+ *
+ * Revision 1.11 2003/02/21 12:13:16 leonberp
+ * cleaned up project settings for 1.5 release
+ *
+ * Revision 1.10 2002/12/16 17:23:11 mcphersc
+ * DISABLED TCL
+ *
+ * Revision 1.9 2002/12/13 17:43:43 mcphersc
+ * Modified the defines for META and TCL for use with the configure script
+ *
+ * Revision 1.8 2002/12/13 17:31:56 mcphersc
+ * Modified TCL/META defines
+ *
+ * Revision 1.7 2002/12/10 14:21:19 mcphersc
+ * *** empty log message ***
+ *
+ * Revision 1.6 2002/12/10 13:41:10 mcphersc
+ * Added undefine of TCL for compiler code only.
+ *
+ * Revision 1.5 2002/09/04 18:33:43 vracarl
+ * got rid of c++ comments
+ *
+ * Revision 1.4 2002/05/10 16:25:43 leonberp
+ * latest changes for release 2.2
+ *
+ * Revision 1.3 2002/01/10 20:04:41 sfl
+ * Updates to Unix ./configure script so that config.h is named
+ * config_Used.h (similar to config_win32.h for windows). This allows the
+ * run-time libs and includes to use a unique include, but still be
+ * dynamically built for the individual platform.
+ *
+ * Revision 1.2 2000/10/24 14:54:37 rwc
+ * Updated to remove high-level warnings (level 4 on MSVC++) for an easier build.
+ * SOME warnings persist due to difficulty in modifying the SNACC compiler to
+ * properly build clean source; also some files are built by Lex/Yacc.
+ *
+ * Revision 1.1.1.1 2000/08/21 20:35:45 leonberp
+ * First CVS Version of SNACC.
+ *
+ * Revision 1.7 1997/04/07 13:13:18 wan
+ * Made more C++ readable (credits to Steve Walker)
+ *
+ * Revision 1.6 1997/02/28 13:39:35 wan
+ * Modifications collected for new version 1.3: Bug fixes, tk4.2.
+ *
+ * Revision 1.5 1997/02/15 20:38:48 rj
+ * In member functions, return *this after calling abort() for stupid compilers that don't seem to know about volatile abort() (they would otherwise abort with an error).
+ *
+ * Revision 1.4 1995/07/24 15:06:52 rj
+ * configure checks for mem* functions. define replacements using b* functions, if necessary.
+ *
+ */
+
+#ifndef _SNACC_H_
+#define _SNACC_H_
+
+#define GLASS 1
+#define KHO 1
+
+#define memzero(p, len) memset(p, 0, len)
+
+#ifdef __cplusplus
+
+#ifdef VOLATILE_RETRUN
+# define RETURN_THIS_FOR_COMPILERS_WITHOUT_VOLATILE_FUNCTIONS return *this;
+#else
+# define RETURN_THIS_FOR_COMPILERS_WITHOUT_VOLATILE_FUNCTIONS
+#endif
+
+#else /* !__cplusplus */
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#endif /* __cplusplus */
+
+/*
+ * Inspired by gdb 4.0, for better or worse...
+ * (grabbed from Barry Brachman - MS)
+ *
+ * These macros munge C routine declarations such
+ * that they work for ANSI or non-ANSI C compilers
+ */
+#ifndef __USE_NON_ANSI_C__
+
+#define PROTO( X) X
+#define PARAMS( arglist, args) (args)
+#define NOPARAMS() (void)
+#define _AND_ ,
+#define DOTS , ...
+
+#else /* __USE_ANSI_C__ */
+
+#define PROTO( X) ()
+#define PARAMS( arglist, args) arglist args;
+#define NOPARAMS() ()
+#define _AND_ ;
+#define DOTS
+#define void char
+
+#endif /* __USE_ANSI_C__ */
+
+/*
+ * 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
+ #endif
+#elif defined (ENABLE_TCL) && defined (HAVE_TCL)
+ #define TCL 1;
+ #define META 1;
+#endif
+
+#ifdef ENABLE_META
+#ifndef META
+ #define META 1
+#endif
+#endif
+
+#define COMMA ,
+
+#define if_IBM_ENC( code)
+
+
+#ifdef META
+#define if_META( code) code
+#else
+#define if_META( code)
+#endif
+
+#if defined(TCL) && defined (META)
+#define if_TCL( code) code
+#else
+#define if_TCL( code)
+#endif
+
+#if __GNUC__
+#define ESNACC_UNUSED __attribute__((__unused__))
+#else
+#define ESNACC_UNUSED
+#endif
+
+#ifdef WIN32
+#define inline __inline
+#endif
+
+#endif /* _SNACC_H_ */
--
2.7.4
More information about the dev
mailing list