[poppler] glib/Makefile.am glib/poppler-enums.c.template glib/poppler-enums.h.template
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Sat Feb 21 02:11:13 PST 2009
glib/Makefile.am | 43 ++++++++++++-----------------------------
glib/poppler-enums.c.template | 44 ++++++++++++++++++++++++++++++++++++++++++
glib/poppler-enums.h.template | 25 +++++++++++++++++++++++
3 files changed, 82 insertions(+), 30 deletions(-)
New commits:
commit 7406337ed2d38a86308f20f8273a152538e524de
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Sat Feb 21 11:11:20 2009 +0100
[glib] Use template files to create poppler-enums
diff --git a/glib/Makefile.am b/glib/Makefile.am
index faa85a6..fe75c67 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -27,38 +27,21 @@ stamp_files = stamp-poppler-enums.h
poppler-enums.h: stamp-poppler-enums.h
@true
-stamp-poppler-enums.h: $(poppler_glib_public_headers)
- ( cd $(srcdir) && $(GLIB_MKENUMS) \
- --fhead "#ifndef __POPPLER_TYPE_ENUMS_H__\n" \
- --fhead "#define __POPPLER_TYPE_ENUMS_H__ 1\n\n" \
- --fhead "#include <glib-object.h>\n\n" \
- --fhead "G_BEGIN_DECLS\n\n" \
- --ftail "G_END_DECLS\n\n" \
- --ftail "#endif /* __POPPLER_TYPE_ENUMS_H__ */\n" \
- --fprod "\n/* --- @filename@ --- */" \
- --eprod "#define POPPLER_TYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" \
- --eprod "GType @enum_name at _get_type (void) G_GNUC_CONST;\n" \
- $(poppler_glib_public_headers) ) > xgen-$(@F) \
- && ( cmp -s xgen-$(@F) $(@F:stamp-%=%) || cp xgen-$(@F) $(@F:stamp-%=%) ) \
- && rm -f xgen-$(@F) \
+
+stamp-poppler-enums.h: poppler-enums.h.template $(poppler_glib_public_headers)
+ $(GLIB_MKENUMS) --template $< $(filter-out $<,$^) > xgen-etbh \
+ && (cmp -s xgen-etbh poppler-enums.h || cp xgen-etbh poppler-enums.h ) \
+ && rm -f xgen-etbh \
&& echo timestamp > $(@F)
-poppler-enums.c: $(poppler_glib_public_headers)
- ( cd $(srcdir) && $(GLIB_MKENUMS) \
- --fhead "#include \"poppler-enums.h\"\n\n" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
- --fprod "\n#include \"@filename@\"" \
- --vhead "static const G at Type@Value _ at enum_name@_values[] = {" \
- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
- --vtail " { 0, NULL, NULL }\n};\n\n" \
- --vtail "GType\n at enum_name@_get_type (void)\n{\n" \
- --vtail " static GType type = 0;\n\n" \
- --vtail " if (G_UNLIKELY (type == 0))\n" \
- --vtail " type = g_ at type@_register_static (\"@EnumName@\", _ at enum_name@_values);\n\n" \
- --vtail " return type;\n}\n\n" \
- $(poppler_glib_public_headers) ) > xgen-$(@F) \
- && ( cmp -s xgen-$(@F) $(@F) || cp xgen-$(@F) $(@F) ) \
- && rm -f xgen-$(@F)
+poppler-enums.c: poppler-enums.c.template $(poppler_glib_public_headers)
+ $(GLIB_MKENUMS) --template $< $(filter-out $<,$^) > xgen-etbc \
+ && (cmp -s xgen-etbc poppler-enums.c || cp xgen-etbc poppler-enums.c ) \
+ && rm -f xgen-etbc
+
+EXTRA_DIST = \
+ poppler-enums.h.template \
+ poppler-enums.c.template
poppler_glib_public_headers = \
poppler-action.h \
diff --git a/glib/poppler-enums.c.template b/glib/poppler-enums.c.template
new file mode 100644
index 0000000..26a51b4
--- /dev/null
+++ b/glib/poppler-enums.c.template
@@ -0,0 +1,44 @@
+/*** BEGIN file-header ***/
+#include <config.h>
+
+#include "poppler-enums.h"
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+#include "@filename@"
+/*** END file-production ***/
+
+
+/*** BEGIN value-header ***/
+GType
+ at enum_name@_get_type (void)
+{
+ static volatile gsize g_define_type_id__volatile = 0;
+
+ if (g_once_init_enter (&g_define_type_id__volatile)) {
+ static const G at Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ GType g_define_type_id =
+ g_ at type@_register_static (g_intern_static_string ("@EnumName@"), values);
+
+ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+ }
+
+ return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+
+/*** END file-tail ***/
diff --git a/glib/poppler-enums.h.template b/glib/poppler-enums.h.template
new file mode 100644
index 0000000..5d056dd
--- /dev/null
+++ b/glib/poppler-enums.h.template
@@ -0,0 +1,25 @@
+/*** BEGIN file-header ***/
+
+#ifndef POPPLER_ENUMS_H
+#define POPPLER_ENUMS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name at _get_type (void) G_GNUC_CONST;
+#define POPPLER_TYPE_ at ENUMSHORT@ (@enum_name at _get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* !POPPLER_ENUMS_H */
+/*** END file-tail ***/
More information about the poppler
mailing list