[gegl/soc-2011-warp] add a proper automatic registration for enum using glib-mkenums
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2011-warp] add a proper automatic registration for enum using glib-mkenums
- Date: Sun, 4 Sep 2011 07:45:20 +0000 (UTC)
commit 11e198fffe15897db3d34a3a9e4b454a2cf5a45e
Author: Michael Murà <batolettre gmail com>
Date: Sun Sep 4 09:44:01 2011 +0200
add a proper automatic registration for enum using glib-mkenums
configure.ac | 6 +++++
gegl/Makefile.am | 20 +++++++++++++++++-
gegl/gegl-enums.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
gegl/gegl-enums.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++
gegl/gegl-types.c | 59 -----------------------------------------------------
gegl/gegl-types.h | 25 +--------------------
6 files changed, 137 insertions(+), 83 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b1ed2f5..e5142b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -389,6 +389,12 @@ fi
CFLAGS="$CFLAGS $MMX_EXTRA_CFLAGS $SSE_EXTRA_CFLAGS"
+################
+# Check for perl
+################
+
+AC_PATH_PROGS(PERL,perl5 perl perl5.005 perl5.004,perl)
+
########################
# Check GObject Introspection
########################
diff --git a/gegl/Makefile.am b/gegl/Makefile.am
index b027cd6..7a58137 100644
--- a/gegl/Makefile.am
+++ b/gegl/Makefile.am
@@ -38,6 +38,7 @@ GEGL_publicdir = $(includedir)/gegl-$(GEGL_API_VERSION)
GEGL_introspectable_headers = \
gegl.h \
gegl-types.h \
+ gegl-enums.h \
gegl-utils.h \
gegl-matrix.h \
gegl-lookup.h \
@@ -64,11 +65,11 @@ GEGL_introspectable_sources = \
gegl-cpuaccel.c \
gegl-dot.c \
gegl-dot-visitor.c \
+ gegl-enums.c \
gegl-init.c \
gegl-instrument.c \
gegl-utils.c \
gegl-lookup.c \
- gegl-types.c \
gegl-xml.c \
gegl-matrix.c \
\
@@ -135,3 +136,20 @@ endif # HAVE_VALA
endif # HAVE_INTROSPECTION
+#
+# rules to generate built sources
+#
+# setup autogeneration dependencies
+gen_sources = xgen-tec
+CLEANFILES = $(gen_sources)
+
+gegl-enums.c: $(srcdir)/gegl-enums.h
+ glib-mkenums \
+ --fhead "/* This is a generated file, do not edit directly */\n\n#include \"config.h\"\n#include <glib-object.h>\n#include \"gegl-enums.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@, \"@valuenick \", \"@valuenick \" }," \
+ --vtail " { 0, NULL, NULL }\n };\n etype = g_ type@_register_static (\"@EnumName \", values);\n }\n return etype;\n}\n\n" \
+ $(srcdir)/gegl-enums.h > xgen-tec \
+ && cp xgen-tec $(@F) \
+ && rm -f xgen-tec
diff --git a/gegl/gegl-enums.c b/gegl/gegl-enums.c
new file mode 100644
index 0000000..d6c432d
--- /dev/null
+++ b/gegl/gegl-enums.c
@@ -0,0 +1,51 @@
+
+/* Generated data (by glib-mkenums) */
+
+/* This is a generated file, do not edit directly */
+
+#include "config.h"
+#include <glib-object.h>
+#include "gegl-enums.h"
+
+/* enumerations from "./gegl-enums.h" */
+GType
+gegl_sampler_type_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GEGL_SAMPLER_NEAREST, "nearest", "nearest" },
+ { GEGL_SAMPLER_LINEAR, "linear", "linear" },
+ { GEGL_SAMPLER_CUBIC, "cubic", "cubic" },
+ { GEGL_SAMPLER_LANCZOS, "lanczos", "lanczos" },
+ { GEGL_SAMPLER_LOHALO, "lohalo", "lohalo" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GeglSamplerType", values);
+ }
+ return etype;
+}
+
+GType
+gegl_warp_behavior_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GEGL_WARP_BEHAVIOR_MOVE, "move", "move" },
+ { GEGL_WARP_BEHAVIOR_GROW, "grow", "grow" },
+ { GEGL_WARP_BEHAVIOR_SHRINK, "shrink", "shrink" },
+ { GEGL_WARP_BEHAVIOR_SWIRL_CW, "swirl-cw", "swirl-cw" },
+ { GEGL_WARP_BEHAVIOR_SWIRL_CCW, "swirl-ccw", "swirl-ccw" },
+ { GEGL_WARP_BEHAVIOR_ERASE, "erase", "erase" },
+ { GEGL_WARP_BEHAVIOR_SMOOTH, "smooth", "smooth" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GeglWarpBehavior", values);
+ }
+ return etype;
+}
+
+
+/* Generated data ends here */
+
diff --git a/gegl/gegl-enums.h b/gegl/gegl-enums.h
new file mode 100644
index 0000000..5c74ade
--- /dev/null
+++ b/gegl/gegl-enums.h
@@ -0,0 +1,59 @@
+/* This file is part of GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2011 Michael Murà <batolettre gmail com>
+ *
+ */
+
+/* This file hold public enum from GEGL. A proper registration for them is
+ * generated automatically with glib-mkenums.
+ *
+ * TODO: currently, description are not supported by glib-mkenums, and therefore
+ * an often ugly name is generated, and i18n is not supported.
+ * gimp-mkenums support these description, with a custom system to allow i18n,
+ * so it could be a way to achieve this.
+ */
+
+#ifndef __GEGL_ENUMS_H__
+#define __GEGL_ENUMS_H__
+
+G_BEGIN_DECLS
+
+typedef enum {
+ GEGL_SAMPLER_NEAREST = 0, /*< desc="nearest" >*/
+ GEGL_SAMPLER_LINEAR, /*< desc="linear" >*/
+ GEGL_SAMPLER_CUBIC, /*< desc="cubic" >*/
+ GEGL_SAMPLER_LANCZOS, /*< desc="lanczos" >*/
+ GEGL_SAMPLER_LOHALO /*< desc="lohalo" >*/
+} GeglSamplerType;
+GType gegl_sampler_type_get_type (void) G_GNUC_CONST;
+#define GEGL_TYPE_SAMPLER_TYPE (gegl_sampler_type_get_type())
+
+typedef enum
+{
+ GEGL_WARP_BEHAVIOR_MOVE, /*< desc="Move pixels" >*/
+ GEGL_WARP_BEHAVIOR_GROW, /*< desc="Grow area" >*/
+ GEGL_WARP_BEHAVIOR_SHRINK, /*< desc="Shrink area" >*/
+ GEGL_WARP_BEHAVIOR_SWIRL_CW, /*< desc="Swirl clockwise" >*/
+ GEGL_WARP_BEHAVIOR_SWIRL_CCW, /*< desc="Swirl counter-clockwise" >*/
+ GEGL_WARP_BEHAVIOR_ERASE, /*< desc="Erase warping" >*/
+ GEGL_WARP_BEHAVIOR_SMOOTH /*< desc="Smooth warping" >*/
+} GeglWarpBehavior;
+GType gegl_warp_behavior_get_type (void) G_GNUC_CONST;
+#define GEGL_TYPE_WARP_BEHAVIOR (gegl_warp_behavior_get_type ())
+
+G_END_DECLS
+
+#endif /* __GEGL_ENUMS_H__ */
\ No newline at end of file
diff --git a/gegl/gegl-types.h b/gegl/gegl-types.h
index da6456f..8ff5048 100644
--- a/gegl/gegl-types.h
+++ b/gegl/gegl-types.h
@@ -20,6 +20,8 @@
#ifndef __GEGL_TYPES_H__
#define __GEGL_TYPES_H__
+#include "gegl-enums.h"
+
G_BEGIN_DECLS
#define GEGL_AUTO_ROWSTRIDE 0
@@ -64,29 +66,6 @@ GType gegl_processor_get_type (void) G_GNUC_CONST;
#define GEGL_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_PROCESSOR, GeglProcessor))
#define GEGL_IS_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_PROCESSOR))
-typedef enum {
- GEGL_SAMPLER_NEAREST = 0,
- GEGL_SAMPLER_LINEAR,
- GEGL_SAMPLER_CUBIC,
- GEGL_SAMPLER_LANCZOS,
- GEGL_SAMPLER_LOHALO
-} GeglSamplerType;
-GType gegl_sampler_type_get_type (void) G_GNUC_CONST;
-#define GEGL_TYPE_SAMPLER_TYPE (gegl_sampler_type_get_type())
-
-typedef enum
-{
- GEGL_WARP_BEHAVIOR_MOVE,
- GEGL_WARP_BEHAVIOR_GROW,
- GEGL_WARP_BEHAVIOR_SHRINK,
- GEGL_WARP_BEHAVIOR_SWIRL_CW,
- GEGL_WARP_BEHAVIOR_SWIRL_CCW,
- GEGL_WARP_BEHAVIOR_ERASE,
- GEGL_WARP_BEHAVIOR_SMOOTH
-} GeglWarpBehavior;
-GType gegl_warp_behavior_get_type (void) G_GNUC_CONST;
-#define GEGL_TYPE_WARP_BEHAVIOR (gegl_warp_behavior_get_type ())
-
G_END_DECLS
#endif /* __GEGL_TYPES_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]