Commit 7406337e authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

[glib] Use template files to create poppler-enums

parent 29bc9d1d
......@@ -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_@ENUMSHORT@ (@enum_name@_get_type())\n" \
--eprod "GType @enum_name@_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@Type@Value _@enum_name@_values[] = {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n};\n\n" \
--vtail "GType\n@enum_name@_get_type (void)\n{\n" \
--vtail " static GType type = 0;\n\n" \
--vtail " if (G_UNLIKELY (type == 0))\n" \
--vtail " type = g_@type@_register_static (\"@EnumName@\", _@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 \
......
/*** 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
@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@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_@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 ***/
/*** 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@_get_type (void) G_GNUC_CONST;
#define POPPLER_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* !POPPLER_ENUMS_H */
/*** END file-tail ***/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment