[gnome-characters] libgc: Prepare for enum types



commit 7ef4484aaa6dd52469fb7837dcfaed9ebcec0f7c
Author: Daiki Ueno <dueno src gnome org>
Date:   Mon Feb 8 16:05:40 2016 +0900

    libgc: Prepare for enum types

 configure.ac                |    2 ++
 lib/Makefile.am             |   11 +++++++++--
 lib/gc-enumtypes.c.template |   35 +++++++++++++++++++++++++++++++++++
 lib/gc-enumtypes.h.template |   25 +++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6786626..47a42b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,8 @@ if test x$enable_coverage = xyes; then
 fi
 AM_CONDITIONAL([ENABLE_COVERAGE], [test x$enable_coverage = xyes])
 
+AM_PATH_GLIB_2_0
+
 GLIB_TESTS
 
 GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 3217371..60596ac 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -14,8 +14,15 @@ pkglib_LTLIBRARIES = libgc.la
 
 libgc_la_LIBADD = $(LIBGC_LIBS) $(LTLIBICONV) $(LTLIBUNISTRING) $(PANGOFT2_LIBS) 
$(builddir)/../gllib/libgnu.la
 libgc_la_LDFLAGS = -avoid-version
-libgc_la_sources = gc.h gc.c
-libgc_la_SOURCES = $(libgc_la_sources) confusables.h scripts.h
+libgc_la_sources = gc.h gc.c gc-enumtypes.c
+libgc_la_SOURCES = $(libgc_la_sources) confusables.h scripts.h gc-enumtypes.h
+
+BUILT_SOURCES = gc-enumtypes.h gc-enumtypes.c
+
+gc-enumtypes.h: gc.h gc-enumtypes.h.template
+       $(AM_V_GEN) $(GLIB_MKENUMS) --identifier-prefix Gc --symbol-prefix gc --template 
gc-enumtypes.h.template gc.h > $ -t && mv $ -t $@ || rm $ -t
+gc-enumtypes.c: gc.h gc-enumtypes.c.template
+       $(AM_V_GEN) $(GLIB_MKENUMS) --identifier-prefix Gc --symbol-prefix gc --template 
gc-enumtypes.c.template gc.h > $ -t && mv $ -t $@ || rm $ -t
 
 include $(INTROSPECTION_MAKEFILE)
 INTROSPECTION_GIRS = Gc-1.0.gir
diff --git a/lib/gc-enumtypes.c.template b/lib/gc-enumtypes.c.template
new file mode 100644
index 0000000..67b3331
--- /dev/null
+++ b/lib/gc-enumtypes.c.template
@@ -0,0 +1,35 @@
+/*** BEGIN file-header ***/
+#include "gc.h"
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+ enum_name@_get_type (void)
+{
+    static GType etype = 0;
+    if (G_UNLIKELY(etype == 0)) {
+        static const G Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+            { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+            { 0, NULL, NULL }
+        };
+        etype = g_ type@_register_static (g_intern_static_string ("@EnumName@"), values);
+    }
+    return etype;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+
+/*** END file-tail ***/
diff --git a/lib/gc-enumtypes.h.template b/lib/gc-enumtypes.h.template
new file mode 100644
index 0000000..ebab3f3
--- /dev/null
+++ b/lib/gc-enumtypes.h.template
@@ -0,0 +1,25 @@
+/*** BEGIN file-header ***/
+#ifndef GPGME_GLIB_ENUMTYPES_H_
+#define GPGME_GLIB_ENUMTYPES_H_
+
+#include <glib-object.h>
+#include "gc.h"
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name _get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX _TYPE_@ENUMSHORT@ (@enum_name _get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* GPGME_GLIB_ENUMTYPES_H_ */
+/*** END file-tail ***/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]