2007-08-20 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/Makefile.am: * clutter/clutter-enum-types.h.in: * clutter/clutter-enum-types.c.in: Use template files for glib-mkenums; this makes the Makefile template a bit more clean and the enum types generation more customisable (e.g. when GLib 2.14 has been released, we can use g_once_init_enter() and g_once_init_leave() to have thread-safe GType functions for the enum types as well).
This commit is contained in:
parent
7ab6f4e338
commit
155c22b93a
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2007-08-20 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/Makefile.am:
|
||||
* clutter/clutter-enum-types.h.in:
|
||||
* clutter/clutter-enum-types.c.in: Use template files for
|
||||
glib-mkenums; this makes the Makefile template a bit more
|
||||
clean and the enum types generation more customisable (e.g.
|
||||
when GLib 2.14 has been released, we can use g_once_init_enter()
|
||||
and g_once_init_leave() to have thread-safe GType functions
|
||||
for the enum types as well).
|
||||
|
||||
2007-08-20 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-version.h.in: Fix CLUTTER_CHECK_VERSION()
|
||||
|
@ -99,37 +99,21 @@ clutter-marshal.c: clutter-marshal.h Makefile
|
||||
clutter-enum-types.h: stamp-clutter-enum-types.h
|
||||
@true
|
||||
stamp-clutter-enum-types.h: $(source_h) Makefile
|
||||
$(GLIB_MKENUMS) \
|
||||
--fhead "#ifndef __CLUTTER_ENUM_TYPES_H__\n" \
|
||||
--fhead "#define __CLUTTER_ENUM_TYPES_H__\n\n" \
|
||||
--fhead "G_BEGIN_DECLS\n\n" \
|
||||
--ftail "G_END_DECLS\n\n" \
|
||||
--ftail "#endif\n" \
|
||||
--fprod "/* --- @filename@ --- */\n" \
|
||||
--eprod "#define CLUTTER_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n" \
|
||||
--eprod "GType @enum_name@_get_type (void);\n\n" \
|
||||
$(source_h) >> xgen-ceth \
|
||||
&& (cmp xgen-ceth clutter-enum-types.h || cp xgen-ceth clutter-enum-types.h) \
|
||||
&& rm -f xgen-ceth \
|
||||
&& echo timestamp > $(@F)
|
||||
( cd $(srcdir) && \
|
||||
$(GLIB_MKENUMS) \
|
||||
--template $(srcdir)/clutter-enum-types.h.in \
|
||||
$(source_h) ) >> xgen-ceth && \
|
||||
(cmp xgen-ceth clutter-enum-types.h || cp xgen-ceth clutter-enum-types.h) && \
|
||||
rm -f xgen-ceth && \
|
||||
echo timestamp > $(@F)
|
||||
|
||||
clutter-enum-types.c: clutter-enum-types.h
|
||||
$(GLIB_MKENUMS) \
|
||||
--fhead "#include <glib-object.h>\n" \
|
||||
--fhead "#include \"clutter-enum-types.h\"\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 (!type)\n" \
|
||||
--vtail " type = g_@type@_register_static (\"@EnumName@\", _@enum_name@_values);\n\n" \
|
||||
--vtail " return type;\n}\n\n" \
|
||||
$(source_h) >> xgen-cetc \
|
||||
&& cp xgen-cetc clutter-enum-types.c \
|
||||
&& rm -f xgen-cetc
|
||||
( cd $(srcdir) && \
|
||||
$(GLIB_MKENUMS) \
|
||||
--template $(srcdir)/clutter-enum-types.c.in \
|
||||
$(source_h) ) >> xgen-cetc && \
|
||||
cp xgen-cetc clutter-enum-types.c && \
|
||||
rm -f xgen-cetc
|
||||
|
||||
CLEANFILES = $(STAMPFILES)
|
||||
|
||||
@ -207,4 +191,8 @@ DISTCLEANFILES = \
|
||||
clutter-version.h \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = clutter-marshal.list clutter-version.h.in
|
||||
EXTRA_DIST = \
|
||||
clutter-marshal.list \
|
||||
clutter-version.h.in \
|
||||
clutter-enum-types.h.in \
|
||||
clutter-enum-types.c.in
|
||||
|
30
clutter/clutter-enum-types.c.in
Normal file
30
clutter/clutter-enum-types.c.in
Normal file
@ -0,0 +1,30 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#include "clutter-enum-types.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 GType enum_type_id = 0;
|
||||
if (G_UNLIKELY (!enum_type_id))
|
||||
{
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN value-production ***/
|
||||
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
|
||||
/*** END value-production ***/
|
||||
|
||||
/*** BEGIN value-tail ***/
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
enum_type_id = g_@type@_register_static("@EnumName@", values);
|
||||
}
|
||||
return enum_type_id;
|
||||
}
|
||||
/*** END value-tail ***/
|
26
clutter/clutter-enum-types.h.in
Normal file
26
clutter/clutter-enum-types.h.in
Normal file
@ -0,0 +1,26 @@
|
||||
/*** BEGIN file-header ***/
|
||||
#ifndef __CLUTTER_ENUM_TYPES_H__
|
||||
#define __CLUTTER_ENUM_TYPES_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
/* enumerations from "@filename@" */
|
||||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* !__CLUTTER_ENUM_TYPES_H__ */
|
||||
/*** END file-tail ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
#define CLUTTER_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
|
||||
|
||||
/*** END value-header ***/
|
||||
|
Loading…
Reference in New Issue
Block a user