auto build some enum code.
authorDavid I. Lehn <dlehn@users.sourceforge.net>
Sun, 16 Jun 2002 23:23:28 +0000 (23:23 +0000)
committerDavid I. Lehn <dlehn@users.sourceforge.net>
Sun, 16 Jun 2002 23:23:28 +0000 (23:23 +0000)
Original commit message from CVS:
auto build some enum code.
useful for things like autogenerated python bindings.

gst/Makefile.am
gst/gst.h

index 0d26a17..760ff2d 100644 (file)
@@ -51,6 +51,7 @@ libcothreads_la_SOURCES = cothreads.c
 libgstreamer_la_SOURCES =              \
        gst.c                   \
        gstmarshal.c            \
+       gstenumtypes.c          \
        gstobject.c             \
        $(GST_AUTOPLUG_SRC)     \
        gstbin.c                \
@@ -84,7 +85,7 @@ libgstreamer_la_SOURCES =             \
        $(GST_LOADSAVE_SRC)
 
 
-BUILT_SOURCES = gstmarshal.h gstmarshal.c
+BUILT_SOURCES = gstmarshal.h gstmarshal.c gstenumtypes.h gstenumtypes.c
 
 gstmarshal.h: gstmarshal.list
        glib-genmarshal --header --prefix=gst_marshal $(srcdir)/gstmarshal.list > gstmarshal.h.tmp
@@ -97,6 +98,23 @@ gstmarshal.c: gstmarshal.list
        glib-genmarshal --body --prefix=gst_marshal $(srcdir)/gstmarshal.list >> gstmarshal.c.tmp
        mv gstmarshal.c.tmp gstmarshal.c
 
+gstenumtypes.h:
+       glib-mkenums \
+       --fhead "#ifndef __GST_ENUM_TYPES_H__\n#define __GST_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+       --fprod "/* enumerations from \"@filename@\" */\n" \
+       --vhead "GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n"         \
+       --ftail "G_END_DECLS\n\n#endif /* __GST_ENUM_TYPES_H__ */" \
+       $(libgstreamerinclude_HEADERS) > gstenumtypes.h
+
+gstenumtypes.c:
+       glib-mkenums \
+       --fhead "#include <gst/gst.h>" \
+       --fprod "\n/* enumerations from \"@filename@\" */" \
+       --vhead "GType\n@enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G@Type@Value values[] = {"     \
+       --vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+       --vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
+       $(libgstreamerinclude_HEADERS) > gstenumtypes.c
+
 # Don't want the generated marshal files in the dist
 dist-hook:
        rm -f $(distdir)/gstmarshal.c $(distdir)/gstmarshal.h
@@ -109,6 +127,7 @@ libgstreamerinclude_HEADERS =               \
        gst.h                   \
        gstconfig.h             \
        gstmarshal.h            \
+       gstenumtypes.h          \
        gstobject.h             \
        gsttypes.h              \
        gstautoplug.h           \
index 473e401..7a95a87 100644 (file)
--- a/gst/gst.h
+++ b/gst/gst.h
@@ -56,6 +56,7 @@
 #include <gst/gstparse.h>
 #include <gst/gstregistry.h>
 #include <gst/gstextratypes.h>
+#include <gst/gstenumtypes.h>
 
 #ifdef __cplusplus
 extern "C" {