[geglmm] Port to Gegl-0.2
- From: Hubert FiguiÃre <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geglmm] Port to Gegl-0.2
- Date: Tue, 17 Apr 2012 15:45:52 +0000 (UTC)
commit 2fb31e93be39d0cb70f06bc5f78d646bccf0b4c4
Author: Hubert FiguiÃre <hub figuiere net>
Date: Sun Apr 15 21:47:18 2012 -0700
Port to Gegl-0.2
ChangeLog | 4 +
configure.ac | 11 +-
gegl/src/buffer-iterator.ccg | 6 +-
gegl/src/buffer-iterator.hg | 3 +-
gegl/src/buffer.ccg | 1 +
gegl/src/buffer.hg | 12 +-
gegl/src/color.hg | 1 -
gegl/src/enums.ccg | 18 +
gegl/src/enums.hg | 28 ++
gegl/src/filelist.am | 2 +-
gegl/src/gegl_enums.defs | 86 ++++-
gegl/src/gegl_methods.defs | 485 ++++++++++++++++++++-----
gegl/src/gegl_signals.defs | 20 +-
gegl/src/operation.hg | 2 +-
gegl/src/processor.hg | 4 -
tools/enum.pl | 556 ++++++++++++++++++++--------
tools/extra_defs_gen/generate_defs_gegl.cc | 6 -
tools/m4/convert_libgeglmm.m4 | 1 +
18 files changed, 949 insertions(+), 297 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 587b3c0..51a71f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-04-15 Hub FiguiÃre <hub figuiere net>
+
+ * Port to Gegl-0.2
+
2011-12-14 Hub FiguiÃre <hub figuiere net>
Wrapped GeglBufferIterator
diff --git a/configure.ac b/configure.ac
index fe573ff..705e878 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,8 +17,8 @@
#########################################################################
#We use pushdef here because we can't use shell variables before AC_INIT, but we want to use a variable with AC_INIT:
pushdef([LIBGEGLMM_MAJOR_VERSION], [0])
-pushdef([LIBGEGLMM_MINOR_VERSION], [1])
-pushdef([LIBGEGLMM_MICRO_VERSION], [8])
+pushdef([LIBGEGLMM_MINOR_VERSION], [2])
+pushdef([LIBGEGLMM_MICRO_VERSION], [0])
pushdef([LIBGEGLMM_EXTRA_VERSION], [])
pushdef([LIBGEGLMM_VERSION], LIBGEGLMM_MAJOR_VERSION.LIBGEGLMM_MINOR_VERSION.LIBGEGLMM_MICRO_VERSION[]LIBGEGLMM_EXTRA_VERSION)
AC_INIT([geglmm], LIBGEGLMM_VERSION, [gtkmm-list gnome org])
@@ -30,7 +30,7 @@ AC_CONFIG_SRCDIR([gegl/geglmmconfig.h.in])
# configure or passing V=1 to make
m4_ifdef([AM_SILENT_RULES],
[AM_SILENT_RULES([yes])],
- [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
+ [AC_SUBST([AM_DEFAULT_VERBOSITY], [0])])
#
# +1 : ? : +1 == new interface that does not break old one
@@ -43,7 +43,8 @@ dnl 0.0.22 is 2:0:0
dnl 0.1.0 is 3:0:0
dnl 0.1.6 is 3:0:1
dnl 0.1.8 is 4:0:0
-LIBGEGLMM_SO_VERSION=3:0:1
+dnl 0.2.0 is 5:0:0
+LIBGEGLMM_SO_VERSION=5:0:0
AC_SUBST([LIBGEGLMM_VERSION])
AC_SUBST(LIBGEGLMM_RELEASE)
@@ -130,7 +131,7 @@ AS_IF([test "x$USE_MAINTAINER_MODE" != xno], [MM_CHECK_PERL])
#########################################################################
# Dependancy checks
#########################################################################
-PKG_CHECK_MODULES(LIBGEGLMM, glibmm-2.4 >= 2.28 gegl >= 0.1.8)
+PKG_CHECK_MODULES(LIBGEGLMM, glibmm-2.4 >= 2.28 gegl-0.2 >= 0.2.0)
AC_SUBST(LIBGEGLMM_CFLAGS)
AC_SUBST(LIBGEGLMM_LIBS)
diff --git a/gegl/src/buffer-iterator.ccg b/gegl/src/buffer-iterator.ccg
index 20c4e41..e952a90 100644
--- a/gegl/src/buffer-iterator.ccg
+++ b/gegl/src/buffer-iterator.ccg
@@ -22,10 +22,10 @@
namespace Gegl {
-int BufferIterator::add(const Glib::RefPtr<Gegl::Buffer>& buffer, const Gegl::Rectangle& roi,
- const Babl* format, unsigned int flags)
+int BufferIterator::add(const Glib::RefPtr<Gegl::Buffer>& buffer, const Gegl::Rectangle& roi, int level,
+ const Babl* format, unsigned int flags, AbyssPolicy abyss_policy)
{
- return gegl_buffer_iterator_add(gobj(), buffer->gobj(), roi.gobj(), format, flags);
+ return gegl_buffer_iterator_add(gobj(), buffer->gobj(), roi.gobj(), level, format, flags, (GeglAbyssPolicy)abyss_policy);
}
bool BufferIterator::next()
diff --git a/gegl/src/buffer-iterator.hg b/gegl/src/buffer-iterator.hg
index 5ac84d3..9f9bf4e 100644
--- a/gegl/src/buffer-iterator.hg
+++ b/gegl/src/buffer-iterator.hg
@@ -37,7 +37,8 @@ public:
const GeglBufferIterator* gobj() const { return reinterpret_cast<const GeglBufferIterator*>(this); }
int add(const Glib::RefPtr<Buffer>& buffer, const Rectangle& roi,
- const Babl* format, unsigned int flags);
+ int level, const Babl* format, unsigned int flags,
+ AbyssPolicy abyss_policy);
bool next();
diff --git a/gegl/src/buffer.ccg b/gegl/src/buffer.ccg
index 53aba20..bc2acb2 100644
--- a/gegl/src/buffer.ccg
+++ b/gegl/src/buffer.ccg
@@ -17,6 +17,7 @@
*/
+#include <geglmm/enums.h>
#include <geglmm/buffer-iterator.h>
namespace Gegl {
diff --git a/gegl/src/buffer.hg b/gegl/src/buffer.hg
index c47cc88..e8527b6 100644
--- a/gegl/src/buffer.hg
+++ b/gegl/src/buffer.hg
@@ -21,6 +21,7 @@
#include <gegl.h>
#include <glibmm/refptr.h>
#include <geglmm/rectangle.h>
+#include <geglmm/enums.h>
_DEFS(geglmm,gegl)
_PINCLUDE(glibmm/private/object_p.h)
@@ -30,8 +31,6 @@ namespace Gegl
class BufferIterator;
-_WRAP_ENUM(SamplerType, GeglSamplerType, NO_GTYPE)
-
class Buffer
: public Glib::Object
{
@@ -65,17 +64,18 @@ public:
//pixel_count
//TODO: Add an overload if format can be NULL, and use a const & for this one.
- _WRAP_METHOD(void get(double scale, const Rectangle & rect, const Babl *format, void * dest, int rowstride) const, gegl_buffer_get)
+ _WRAP_METHOD(void get(const Rectangle & rect, double scale, const Babl *format, void * dest, int rowstride, AbyssPolicy repeat_mode) const, gegl_buffer_get)
//TODO: Add an overload if format can be NULL, and use a const & for this one.
- _WRAP_METHOD(void set(const Rectangle & rect, const Babl *format, void *src, int rowstride), gegl_buffer_set)
+ _WRAP_METHOD(void set(const Rectangle & rect, int scale_level, const Babl *format, const void *src, int rowstride), gegl_buffer_set)
_WRAP_METHOD(void copy(const Rectangle & src_rect, const Glib::RefPtr<Buffer> & dest, const Rectangle & dest_rect), gegl_buffer_copy)
_WRAP_METHOD(Glib::RefPtr<Buffer> dup() const, gegl_buffer_dup)
//TODO: Add an overload if format can be NULL, and use a const & for this one.
- _WRAP_METHOD(void sample(double x, double y, GeglMatrix2 *scale, void *dest, const Babl* format, SamplerType sampler_type), gegl_buffer_sample)
+ _WRAP_METHOD(void sample(double x, double y, GeglMatrix2 *scale, void *dest, const Babl* format, SamplerType sampler_type, AbyssPolicy repeat_mode), gegl_buffer_sample)
_WRAP_METHOD(void sample_cleanup(), gegl_buffer_sample_cleanup)
_WRAP_METHOD(static SamplerType sampler_type_from_string(const Glib::ustring & string), gegl_sampler_type_from_string)
+ _WRAP_METHOD(GeglSampler* sampler_new(const Babl* format, SamplerType sampler_type), gegl_buffer_sampler_new)
#m4 _CONVERSION(`GeglRectangle*',`const Rectangle&',`Glib::wrap($3)')
#m4 _CONVERSION(`const GeglRectangle*',`const Rectangle&',`Glib::wrap($3)')
@@ -87,7 +87,7 @@ public:
_WRAP_METHOD(const Rectangle& abyss(), gegl_buffer_get_abyss)
#m4 _CONVERSION(`GeglBufferIterator*',`BufferIterator*',`Glib::wrap($3)')
- _WRAP_METHOD(BufferIterator* create_iterator(const Rectangle &, const Babl *, guint flags), gegl_buffer_iterator_new)
+ _WRAP_METHOD(BufferIterator* create_iterator(const Rectangle &, int level, const Babl *, guint flags, AbyssPolicy abyss_policy), gegl_buffer_iterator_new)
// Properties
_WRAP_PROPERTY("px-size", int)
diff --git a/gegl/src/color.hg b/gegl/src/color.hg
index afc5992..fe2508d 100644
--- a/gegl/src/color.hg
+++ b/gegl/src/color.hg
@@ -36,7 +36,6 @@ public:
_WRAP_CREATE(const Glib::ustring & s)
_WRAP_METHOD(void get_rgba(double & r, double & g, double & b, double & a) const, gegl_color_get_rgba)
_WRAP_METHOD(void set_rgba(double r, double g, double b, double a), gegl_color_set_rgba)
- _WRAP_METHOD(void get_rgba4f(gfloat*) const, gegl_color_get_rgba4f)
_WRAP_PROPERTY("string", Glib::ustring)
};
diff --git a/gegl/src/enums.ccg b/gegl/src/enums.ccg
new file mode 100644
index 0000000..52059ea
--- /dev/null
+++ b/gegl/src/enums.ccg
@@ -0,0 +1,18 @@
+/* libgeglmm - a C++ wrapper for libgegl
+ *
+ * (c) 2012 Hubert Figuiere
+ *
+ * This library 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.
+ *
+ * This library 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/>.
+ */
+
diff --git a/gegl/src/enums.hg b/gegl/src/enums.hg
new file mode 100644
index 0000000..d37b5dc
--- /dev/null
+++ b/gegl/src/enums.hg
@@ -0,0 +1,28 @@
+/* libgeglmm - a C++ wrapper for libgegl
+ *
+ * (c) 2012 Hubert Figuiere
+ *
+ * This library 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.
+ *
+ * This library 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/>.
+ */
+
+
+_DEFS(geglmm,gegl)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gegl {
+
+_WRAP_ENUM(AbyssPolicy, GeglAbyssPolicy, NO_GTYPE)
+_WRAP_ENUM(SamplerType, GeglSamplerType, NO_GTYPE)
+
+}
\ No newline at end of file
diff --git a/gegl/src/filelist.am b/gegl/src/filelist.am
index 595f520..e8ed137 100644
--- a/gegl/src/filelist.am
+++ b/gegl/src/filelist.am
@@ -3,5 +3,5 @@
# so it's like copy-and-pasting this into each of those Makefile.am files.
files_hg = rectangle.hg node.hg processor.hg buffer.hg curve.hg color.hg\
- operation.hg path.hg matrix3.hg buffer-iterator.hg
+ operation.hg path.hg matrix3.hg buffer-iterator.hg enums.hg
diff --git a/gegl/src/gegl_enums.defs b/gegl/src/gegl_enums.defs
index f323de7..ba4ea3b 100644
--- a/gegl/src/gegl_enums.defs
+++ b/gegl/src/gegl_enums.defs
@@ -1,4 +1,12 @@
-;; From /opt/niepce/include/gegl-0.1/gegl-enums.h
+;; From gegl-enums.h
+
+;; Original typedef:
+;; typedef enum {
+;; GEGL_SAMPLER_NEAREST = 0, /*< desc="nearest" >*/
+;; GEGL_SAMPLER_LINEAR, /*< desc="linear" >*/
+;; GEGL_SAMPLER_CUBIC, /*< desc="cubic" >*/
+;; GEGL_SAMPLER_LOHALO /*< desc="lohalo" >*/
+;; } GeglSamplerType;
(define-enum-extended SamplerType
(in-module "Gegl")
@@ -7,11 +15,29 @@
'("nearest" "GEGL_SAMPLER_NEAREST" "0")
'("linear" "GEGL_SAMPLER_LINEAR" "1")
'("cubic" "GEGL_SAMPLER_CUBIC" "2")
- '("lanczos" "GEGL_SAMPLER_LANCZOS" "3")
- '("lohalo" "GEGL_SAMPLER_LOHALO" "4")
+ '("lohalo" "GEGL_SAMPLER_LOHALO" "3")
)
)
+;; Original typedef:
+;; typedef enum {
+;; GEGL_ABYSS_NONE
+;; } GeglAbyssPolicy;
+
+(define-enum-extended AbyssPolicy
+ (in-module "Gegl")
+ (c-name "GeglAbyssPolicy")
+ (values
+ '("none" "GEGL_ABYSS_NONE" "0")
+ )
+)
+
+;; Original typedef:
+;; typedef enum {
+;; GEGl_RIPPLE_WAVE_TYPE_SINE,
+;; GEGl_RIPPLE_WAVE_TYPE_SAWTOOTH
+;; } GeglRippleWaveType;
+
(define-enum-extended RippleWaveType
(in-module "Gegl")
(c-name "GeglRippleWaveType")
@@ -21,6 +47,18 @@
)
)
+;; Original typedef:
+;; 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;
+
(define-enum-extended WarpBehavior
(in-module "Gegl")
(c-name "GeglWarpBehavior")
@@ -35,22 +73,58 @@
)
)
-;; From /opt/niepce/include/gegl-0.1/gegl-types.h
+;; From gegl-types.h
-(define-enum-extended PadType
+;; Original typedef:
+;; typedef enum
+;; {
+;; GEGL_PARAM_PAD_OUTPUT = 1 << G_PARAM_USER_SHIFT,
+;; GEGL_PARAM_PAD_INPUT = 1 << (G_PARAM_USER_SHIFT + 1)
+;; } GeglPadType;
+
+(define-flags-extended PadType
(in-module "Gegl")
(c-name "GeglPadType")
(values
+ '("am-pad-output" "GEGL_PARAM_PAD_OUTPUT" "1 << G_PARAM_USER_SHIFT")
)
)
+;; Original typedef:
+;; typedef enum
+;; {
+;; GEGL_BLIT_DEFAULT = 0,
+;; GEGL_BLIT_CACHE = 1 << 0,
+;; GEGL_BLIT_DIRTY = 1 << 1
+;; } GeglBlitFlags;
+
(define-flags-extended BlitFlags
(in-module "Gegl")
(c-name "GeglBlitFlags")
(values
- '("default" "GEGL_BLIT_DEFAULT" "0")
+ '("default" "GEGL_BLIT_DEFAULT" "0x0")
'("cache" "GEGL_BLIT_CACHE" "1 << 0")
'("dirty" "GEGL_BLIT_DIRTY" "1 << 1")
)
)
+;; From gegl-cl-color.h
+
+;; Original typedef:
+;; typedef enum
+;; {
+;; GEGL_CL_COLOR_NOT_SUPPORTED = 0,
+;; GEGL_CL_COLOR_EQUAL = 1,
+;; GEGL_CL_COLOR_CONVERT = 2
+;; } gegl_cl_color_op;
+
+(define-enum-extended gegl_cl_color_op
+ (in-module "Gegl")
+ (c-name "gegl_cl_color_op")
+ (values
+ '("not-supported" "GEGL_CL_COLOR_NOT_SUPPORTED" "0")
+ '("equal" "GEGL_CL_COLOR_EQUAL" "1")
+ '("convert" "GEGL_CL_COLOR_CONVERT" "2")
+ )
+)
+
diff --git a/gegl/src/gegl_methods.defs b/gegl/src/gegl_methods.defs
index 41b42d3..d29c218 100644
--- a/gegl/src/gegl_methods.defs
+++ b/gegl/src/gegl_methods.defs
@@ -220,11 +220,19 @@
'("nearest" "GEGL_SAMPLER_NEAREST")
'("linear" "GEGL_SAMPLER_LINEAR")
'("cubic" "GEGL_SAMPLER_CUBIC")
- '("lanczos" "GEGL_SAMPLER_LANCZOS")
'("lohalo" "GEGL_SAMPLER_LOHALO")
)
)
+(define-enum AbyssPolicy
+ (in-module "Gegl")
+ (c-name "GeglAbyssPolicy")
+ (gtype-id "GEGL_TYPE_ABYSS_POLICY")
+ (values
+ '("none" "GEGL_ABYSS_NONE")
+ )
+)
+
(define-enum RippleWaveType
(in-module "Gegl")
(c-name "GeglRippleWaveType")
@@ -343,12 +351,6 @@
)
)
-(define-method destroy
- (of-object "GeglBuffer")
- (c-name "gegl_buffer_destroy")
- (return-type "none")
-)
-
(define-method get_extent
(of-object "GeglBuffer")
(c-name "gegl_buffer_get_extent")
@@ -369,11 +371,12 @@
(c-name "gegl_buffer_get")
(return-type "none")
(parameters
- '("gdouble" "scale")
'("const-GeglRectangle*" "rect")
+ '("gdouble" "scale")
'("const-Babl*" "format")
'("gpointer" "dest")
'("gint" "rowstride")
+ '("GeglAbyssPolicy" "repeat_mode")
)
)
@@ -383,18 +386,50 @@
(return-type "none")
(parameters
'("const-GeglRectangle*" "rect")
+ '("gint" "scale_level")
'("const-Babl*" "format")
- '("void*" "src")
+ '("const-void*" "src")
'("gint" "rowstride")
)
)
+(define-method set_color
+ (of-object "GeglBuffer")
+ (c-name "gegl_buffer_set_color")
+ (return-type "none")
+ (parameters
+ '("const-GeglRectangle*" "rect")
+ '("GeglColor*" "color")
+ )
+)
+
+(define-method set_pattern
+ (of-object "GeglBuffer")
+ (c-name "gegl_buffer_set_pattern")
+ (return-type "none")
+ (parameters
+ '("const-GeglRectangle*" "rect")
+ '("GeglBuffer*" "pattern")
+ '("gdouble" "x_offset")
+ '("gdouble" "y_offset")
+ )
+)
+
(define-method get_format
(of-object "GeglBuffer")
(c-name "gegl_buffer_get_format")
(return-type "const-Babl*")
)
+(define-method set_format
+ (of-object "GeglBuffer")
+ (c-name "gegl_buffer_set_format")
+ (return-type "const-Babl*")
+ (parameters
+ '("const-Babl*" "format")
+ )
+)
+
(define-method clear
(of-object "GeglBuffer")
(c-name "gegl_buffer_clear")
@@ -432,6 +467,7 @@
'("gpointer" "dest")
'("const-Babl*" "format")
'("GeglSamplerType" "sampler_type")
+ '("GeglAbyssPolicy" "repeat_mode")
)
)
@@ -454,7 +490,7 @@
(c-name "gegl_buffer_sampler_new")
(return-type "GeglSampler*")
(parameters
- '("Babl*" "format")
+ '("const-Babl*" "format")
'("GeglSamplerType" "sampler_type")
)
)
@@ -468,6 +504,7 @@
'("gdouble" "y")
'("GeglMatrix2*" "scale")
'("void*" "output")
+ '("GeglAbyssPolicy" "repeat_mode")
)
)
@@ -495,7 +532,7 @@
'("const-Babl*" "format")
'("const-GeglRectangle*" "extent")
'("gint" "rowstride")
- '("GCallback" "destroy_fn")
+ '("GDestroyNotify" "destroy_fn")
'("gpointer" "destroy_fn_data")
)
)
@@ -536,8 +573,10 @@
(return-type "GeglBufferIterator*")
(parameters
'("const-GeglRectangle*" "roi")
+ '("gint" "level")
'("const-Babl*" "format")
'("guint" "flags")
+ '("GeglAbyssPolicy" "abyss_policy")
)
)
@@ -548,11 +587,19 @@
(parameters
'("GeglBuffer*" "buffer")
'("const-GeglRectangle*" "roi")
+ '("gint" "level")
'("const-Babl*" "format")
'("guint" "flags")
+ '("GeglAbyssPolicy" "abyss_policy")
)
)
+(define-method stop
+ (of-object "GeglBufferIterator")
+ (c-name "gegl_buffer_iterator_stop")
+ (return-type "none")
+)
+
(define-method next
(of-object "GeglBufferIterator")
(c-name "gegl_buffer_iterator_next")
@@ -614,15 +661,6 @@
)
)
-(define-method get_rgba4f
- (of-object "GeglColor")
- (c-name "gegl_color_get_rgba4f")
- (return-type "none")
- (parameters
- '("gfloat*" "buf")
- )
-)
-
(define-method set_rgba
(of-object "GeglColor")
(c-name "gegl_color_set_rgba")
@@ -635,6 +673,26 @@
)
)
+(define-method set_pixel
+ (of-object "GeglColor")
+ (c-name "gegl_color_set_pixel")
+ (return-type "none")
+ (parameters
+ '("const-Babl*" "format")
+ '("const-void*" "pixel")
+ )
+)
+
+(define-method get_pixel
+ (of-object "GeglColor")
+ (c-name "gegl_color_get_pixel")
+ (return-type "none")
+ (parameters
+ '("const-Babl*" "format")
+ '("void*" "pixel")
+ )
+)
+
(define-function gegl_param_color_get_type
(c-name "gegl_param_color_get_type")
(return-type "GType")
@@ -784,6 +842,11 @@
(return-type "GType")
)
+(define-function gegl_abyss_policy_get_type
+ (c-name "gegl_abyss_policy_get_type")
+ (return-type "GType")
+)
+
(define-function gegl_ripple_wave_type_get_type
(c-name "gegl_ripple_wave_type_get_type")
(return-type "GType")
@@ -825,8 +888,8 @@
)
)
-(define-function gegl_list_properties
- (c-name "gegl_list_properties")
+(define-function gegl_operation_list_properties
+ (c-name "gegl_operation_list_properties")
(return-type "GParamSpec**")
(parameters
'("const-gchar*" "operation_type")
@@ -1151,17 +1214,73 @@
)
)
-(define-method destroy
- (of-object "GeglProcessor")
- (c-name "gegl_processor_destroy")
- (return-type "none")
-)
-
(define-function gegl_config
(c-name "gegl_config")
(return-type "GeglConfig*")
)
+(define-function gegl_apply_op
+ (c-name "gegl_apply_op")
+ (return-type "none")
+ (parameters
+ '("GeglBuffer*" "buffer")
+ '("const-gchar*" "operation_name")
+ )
+ (varargs #t)
+)
+
+(define-function gegl_filter_op
+ (c-name "gegl_filter_op")
+ (return-type "GeglBuffer*")
+ (parameters
+ '("GeglBuffer*" "source_buffer")
+ '("const-gchar*" "operation_name")
+ )
+ (varargs #t)
+)
+
+(define-function gegl_render_op
+ (c-name "gegl_render_op")
+ (return-type "none")
+ (parameters
+ '("GeglBuffer*" "source_buffer")
+ '("GeglBuffer*" "target_buffer")
+ '("const-gchar*" "operation_name")
+ )
+ (varargs #t)
+)
+
+(define-function gegl_apply_op_valist
+ (c-name "gegl_apply_op_valist")
+ (return-type "none")
+ (parameters
+ '("GeglBuffer*" "buffer")
+ '("const-gchar*" "operation_name")
+ '("va_list" "var_args")
+ )
+)
+
+(define-function gegl_filter_op_valist
+ (c-name "gegl_filter_op_valist")
+ (return-type "GeglBuffer*")
+ (parameters
+ '("GeglBuffer*" "source_buffer")
+ '("const-gchar*" "operation_name")
+ '("va_list" "var_args")
+ )
+)
+
+(define-function gegl_render_op_valist
+ (c-name "gegl_render_op_valist")
+ (return-type "none")
+ (parameters
+ '("GeglBuffer*" "source_buffer")
+ '("GeglBuffer*" "target_buffer")
+ '("const-gchar*" "operation_name")
+ '("va_list" "var_args")
+ )
+)
+
(define-function gegl_node
(c-name "gegl_node")
(return-type "GeglNode*")
@@ -1344,42 +1463,35 @@
;; From gegl-paramspecs.h
-(define-function gegl_int32_get_type
- (c-name "gegl_int32_get_type")
+(define-function gegl_param_double_get_type
+ (c-name "gegl_param_double_get_type")
(return-type "GType")
)
-(define-function gegl_param_int32_get_type
- (c-name "gegl_param_int32_get_type")
- (return-type "GType")
-)
-
-(define-function gegl_param_spec_int32
- (c-name "gegl_param_spec_int32")
+(define-function gegl_param_spec_double
+ (c-name "gegl_param_spec_double")
(return-type "GParamSpec*")
(parameters
'("const-gchar*" "name")
'("const-gchar*" "nick")
'("const-gchar*" "blurb")
- '("gint" "minimum")
- '("gint" "maximum")
- '("gint" "default_value")
+ '("gdouble" "minimum")
+ '("gdouble" "maximum")
+ '("gdouble" "default_value")
+ '("gdouble" "ui_minimum")
+ '("gdouble" "ui_maximum")
+ '("gdouble" "ui_gamma")
'("GParamFlags" "flags")
)
)
-(define-function gegl_int16_get_type
- (c-name "gegl_int16_get_type")
- (return-type "GType")
-)
-
-(define-function gegl_param_int16_get_type
- (c-name "gegl_param_int16_get_type")
+(define-function gegl_param_int_get_type
+ (c-name "gegl_param_int_get_type")
(return-type "GType")
)
-(define-function gegl_param_spec_int16
- (c-name "gegl_param_spec_int16")
+(define-function gegl_param_spec_int
+ (c-name "gegl_param_spec_int")
(return-type "GParamSpec*")
(parameters
'("const-gchar*" "name")
@@ -1388,30 +1500,9 @@
'("gint" "minimum")
'("gint" "maximum")
'("gint" "default_value")
- '("GParamFlags" "flags")
- )
-)
-
-(define-function gegl_int8_get_type
- (c-name "gegl_int8_get_type")
- (return-type "GType")
-)
-
-(define-function gegl_param_int8_get_type
- (c-name "gegl_param_int8_get_type")
- (return-type "GType")
-)
-
-(define-function gegl_param_spec_int8
- (c-name "gegl_param_spec_int8")
- (return-type "GParamSpec*")
- (parameters
- '("const-gchar*" "name")
- '("const-gchar*" "nick")
- '("const-gchar*" "blurb")
- '("guint" "minimum")
- '("guint" "maximum")
- '("guint" "default_value")
+ '("gint" "ui_minimum")
+ '("gint" "ui_maximum")
+ '("gdouble" "ui_gamma")
'("GParamFlags" "flags")
)
)
@@ -1803,6 +1894,12 @@
)
)
+(define-method get_level
+ (of-object "GeglOperationContext")
+ (c-name "gegl_operation_context_get_level")
+ (return-type "gint")
+)
+
(define-method get_source
(of-object "GeglOperationContext")
(c-name "gegl_operation_context_get_source")
@@ -1821,6 +1918,16 @@
)
)
+(define-method set_object
+ (of-object "GeglOperationContext")
+ (c-name "gegl_operation_context_set_object")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "padname")
+ '("GObject*" "data")
+ )
+)
+
(define-method take_object
(of-object "GeglOperationContext")
(c-name "gegl_operation_context_take_object")
@@ -1887,7 +1994,13 @@
(define-method get_format
(of-object "GeglTileBackend")
(c-name "gegl_tile_backend_get_format")
- (return-type "Babl*")
+ (return-type "const-Babl*")
+)
+
+(define-method peek_storage
+ (of-object "GeglTileBackend")
+ (c-name "gegl_tile_backend_peek_storage")
+ (return-type "GeglTileSource*")
)
(define-method set_extent
@@ -2020,7 +2133,7 @@
(parameters
'("gpointer" "pixel_data")
'("gint" "pixel_data_size")
- '("GeglDestroyNotify" "destroy_notify")
+ '("GDestroyNotify" "destroy_notify")
'("gpointer" "destroy_notify_data")
)
)
@@ -2089,6 +2202,12 @@
)
)
+(define-method reinit
+ (of-object "GeglTileSource")
+ (c-name "gegl_tile_source_reinit")
+ (return-type "none")
+)
+
(define-method void
(of-object "GeglTileSource")
(c-name "gegl_tile_source_void")
@@ -2266,6 +2385,150 @@
+;; From cl_d3d10.h
+
+
+
+;; From cl_ext.h
+
+
+
+;; From cl_gl_ext.h
+
+
+
+;; From cl_gl.h
+
+
+
+;; From cl.h
+
+
+
+;; From cl_platform.h
+
+
+
+;; From gegl-cl-color.h
+
+(define-function gegl_cl_color_compile_kernels
+ (c-name "gegl_cl_color_compile_kernels")
+ (return-type "none")
+)
+
+(define-function gegl_cl_color_babl
+ (c-name "gegl_cl_color_babl")
+ (return-type "gboolean")
+ (parameters
+ '("const-Babl*" "buffer_format")
+ '("size_t*" "bytes")
+ )
+)
+
+(define-function gegl_cl_color_supported
+ (c-name "gegl_cl_color_supported")
+ (return-type "gegl_cl_color_op")
+ (parameters
+ '("const-Babl*" "in_format")
+ '("const-Babl*" "out_format")
+ )
+)
+
+(define-function gegl_cl_color_conv
+ (c-name "gegl_cl_color_conv")
+ (return-type "gboolean")
+ (parameters
+ '("cl_mem" "in_tex")
+ '("cl_mem" "aux_tex")
+ '("const-size_t" "size")
+ '("const-Babl*" "in_format")
+ '("const-Babl*" "out_format")
+ )
+)
+
+
+
+;; From gegl-cl.h
+
+
+
+;; From gegl-cl-init.h
+
+(define-function gegl_cl_errstring
+ (c-name "gegl_cl_errstring")
+ (return-type "const-char*")
+ (parameters
+ '("cl_int" "err")
+ )
+)
+
+(define-function gegl_cl_init
+ (c-name "gegl_cl_init")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-function gegl_cl_is_accelerated
+ (c-name "gegl_cl_is_accelerated")
+ (return-type "gboolean")
+)
+
+(define-function gegl_cl_get_platform
+ (c-name "gegl_cl_get_platform")
+ (return-type "cl_platform_id")
+)
+
+(define-function gegl_cl_get_device
+ (c-name "gegl_cl_get_device")
+ (return-type "cl_device_id")
+)
+
+(define-function gegl_cl_get_context
+ (c-name "gegl_cl_get_context")
+ (return-type "cl_context")
+)
+
+(define-function gegl_cl_get_command_queue
+ (c-name "gegl_cl_get_command_queue")
+ (return-type "cl_command_queue")
+)
+
+(define-function gegl_cl_get_local_mem_size
+ (c-name "gegl_cl_get_local_mem_size")
+ (return-type "cl_ulong")
+)
+
+(define-function gegl_cl_get_iter_width
+ (c-name "gegl_cl_get_iter_width")
+ (return-type "size_t")
+)
+
+(define-function gegl_cl_get_iter_height
+ (c-name "gegl_cl_get_iter_height")
+ (return-type "size_t")
+)
+
+(define-function gegl_cl_compile_and_build
+ (c-name "gegl_cl_compile_and_build")
+ (return-type "gegl_cl_run_data*")
+ (parameters
+ '("const-char*" "program_source")
+ '("const-char*[]" "kernel_name")
+ )
+)
+
+
+
+;; From gegl-cl-types.h
+
+
+
+;; From opencl.h
+
+
+
;; From gegl-operation-area-filter.h
(define-function gegl_operation_area_filter_get_type
@@ -2304,16 +2567,6 @@
;; From gegl-operation.h
-(define-method add_processor
- (of-object "GeglOperationClass")
- (c-name "gegl_operation_class_add_processor")
- (return-type "none")
- (parameters
- '("GCallback" "process")
- '("const-gchar*" "string")
- )
-)
-
(define-function gegl_operation_get_type
(c-name "gegl_operation_get_type")
(return-type "GType")
@@ -2396,6 +2649,7 @@
'("GeglOperationContext*" "context")
'("const-gchar*" "output_pad")
'("const-GeglRectangle*" "roi")
+ '("gint" "level")
)
)
@@ -2442,8 +2696,8 @@
)
)
-(define-function gegl_list_properties
- (c-name "gegl_list_properties")
+(define-function gegl_operation_list_properties
+ (c-name "gegl_operation_list_properties")
(return-type "GParamSpec**")
(parameters
'("const-gchar*" "operation_type")
@@ -2451,6 +2705,63 @@
)
)
+(define-method set_key
+ (of-object "GeglOperationClass")
+ (c-name "gegl_operation_class_set_key")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "key_name")
+ '("const-gchar*" "key_value")
+ )
+)
+
+(define-method get_key
+ (of-object "GeglOperationClass")
+ (c-name "gegl_operation_class_get_key")
+ (return-type "const-gchar*")
+ (parameters
+ '("const-gchar*" "key_name")
+ )
+)
+
+(define-method set_keys
+ (of-object "GeglOperationClass")
+ (c-name "gegl_operation_class_set_keys")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "key_name")
+ )
+ (varargs #t)
+)
+
+(define-function gegl_operation_list_keys
+ (c-name "gegl_operation_list_keys")
+ (return-type "gchar**")
+ (parameters
+ '("const-gchar*" "operation_type")
+ '("guint*" "n_keys")
+ )
+)
+
+(define-function gegl_operation_set_key
+ (c-name "gegl_operation_set_key")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "operation_type")
+ '("const-gchar*" "key_name")
+ '("const-gchar*" "key_value")
+ )
+)
+
+(define-function gegl_operation_get_key
+ (c-name "gegl_operation_get_key")
+ (return-type "const-gchar*")
+ (parameters
+ '("const-gchar*" "operation_type")
+ '("const-gchar*" "key_name")
+ )
+)
+
(define-method invalidate
(of-object "GeglOperation")
(c-name "gegl_operation_invalidate")
diff --git a/gegl/src/gegl_signals.defs b/gegl/src/gegl_signals.defs
index 648be14..5cbd189 100644
--- a/gegl/src/gegl_signals.defs
+++ b/gegl/src/gegl_signals.defs
@@ -288,18 +288,6 @@
;; From GeglParamPath
-;; From GeglInt32
-
-;; From GeglParamInt32
-
-;; From GeglInt16
-
-;; From GeglParamInt16
-
-;; From GeglInt8
-
-;; From GeglParamInt8
-
;; From GeglParamString
;; From GeglParamFilePath
@@ -364,7 +352,7 @@
(define-property output
(of-object "GeglOperationSource")
(prop-type "GParamObject")
- (docs "Ouput pad for generated image buffer.")
+ (docs "Output pad for generated image buffer.")
(readable #t)
(writable #f)
(construct-only #f)
@@ -386,7 +374,7 @@
(define-property output
(of-object "GeglOperationFilter")
(prop-type "GParamObject")
- (docs "Ouput pad for generated image buffer.")
+ (docs "Output pad for generated image buffer.")
(readable #t)
(writable #f)
(construct-only #f)
@@ -406,7 +394,7 @@
(define-property output
(of-object "GeglOperationComposer")
(prop-type "GParamObject")
- (docs "Ouput pad for generated image buffer.")
+ (docs "Output pad for generated image buffer.")
(readable #t)
(writable #f)
(construct-only #f)
@@ -435,7 +423,7 @@
(define-property output
(of-object "GeglOperationComposer3")
(prop-type "GParamObject")
- (docs "Ouput pad for generated image buffer.")
+ (docs "Output pad for generated image buffer.")
(readable #t)
(writable #f)
(construct-only #f)
diff --git a/gegl/src/operation.hg b/gegl/src/operation.hg
index 1d6c5b1..837cb37 100644
--- a/gegl/src/operation.hg
+++ b/gegl/src/operation.hg
@@ -48,7 +48,7 @@ public:
_WRAP_METHOD(Glib::RefPtr<const Node> detect(int x, int y) const, gegl_operation_detect, refreturn, constversion)
_WRAP_METHOD(void attach(const Glib::RefPtr<Node> & node), gegl_operation_attach)
_WRAP_METHOD(void prepare(), gegl_operation_prepare)
- _WRAP_METHOD(bool process(GeglOperationContext * context, const Glib::ustring & output_pad, const Rectangle & result_rect), gegl_operation_process)
+ _WRAP_METHOD(bool process(GeglOperationContext * context, const Glib::ustring & output_pad, const Rectangle & roi, int level), gegl_operation_process)
_WRAP_METHOD(void create_pad(GParamSpec *param_spec), gegl_operation_create_pad)
_WRAP_METHOD(void set_format(const Glib::ustring & pad_name, const Babl *format), gegl_operation_set_format)
_WRAP_METHOD(const Babl* get_format(const Glib::ustring & pad_name), gegl_operation_get_format) //TODO: Wrap Babl.
diff --git a/gegl/src/processor.hg b/gegl/src/processor.hg
index b4fedd6..cd28f84 100644
--- a/gegl/src/processor.hg
+++ b/gegl/src/processor.hg
@@ -37,10 +37,6 @@ public:
_WRAP_METHOD(void set_rectangle(const Rectangle & rectangle), gegl_processor_set_rectangle);
_WRAP_METHOD(bool work(double & progress), gegl_processor_work);
-//TODO: This "Frees up resources used by a processing handle",
-//but does it really destroy the whole GeglProcessor? If so, how does that work/clash with reference-counting.
-//We should generally avoid having this in public C++ API.
- _WRAP_METHOD(void destroy(), gegl_processor_destroy)
_WRAP_PROPERTY("node", Glib::RefPtr<Gegl::Node>)
_WRAP_PROPERTY("chunksize", int)
_WRAP_PROPERTY("rectangle", Gegl::Rectangle &)
diff --git a/tools/enum.pl b/tools/enum.pl
index 97804c5..844b924 100755
--- a/tools/enum.pl
+++ b/tools/enum.pl
@@ -3,231 +3,467 @@
# The lisp definitions for flags does not include order.
# thus we must extract it ourselves.
# Usage: ./enum.pl /gnome/head/cvs/gconf/gconf/*.h > gconf_enums.defs
-
use warnings;
-
-my %token;
-$module="none";
-
-while ($ARGV[0] =~ /^--(\S+)/)
+use strict;
+use File::Spec;
+use Getopt::Long;
+use IO::File;
+#
+# globals.
+#
+# keeps enum values.
+my %tokens = ();
+# module name.
+my $module = "none";
+# if user used --help option.
+my $help = 0;
+# if user wants to omit deprecated stuff.
+my $omit = 0;
+#
+# prototypes.
+#
+sub parse($);
+sub process($$);
+sub form_names($$);
+#
+# main.
+#
+GetOptions('module=s' => \$module, 'help' => \$help, 'omit-deprecated'=> \$omit);
+if ($help or not @ARGV)
{
- shift @ARGV;
- $module=shift @ARGV if ($1 eq "module");
- if ($1 eq "help")
- {
- print "enum.pl [--module modname] header_files ....\n";
- exit 0;
- }
+ print "enum.pl [--module modname][--omit-deprecated] header_files ...\n";
+ exit 0;
}
-
-foreach $file (@ARGV)
+foreach my $file (@ARGV)
{
- &parse($file);
+ parse($file);
}
-
exit;
-
-
-
-# parse enums from C
-sub parse
+#
+# parse enums from C.
+#
+sub parse($)
{
- my ($file)= _;
-
- $from=0;
- open(FILE,$file);
-
- $enum=0;
- $deprecated=0;
- $comment=0;
-
- while(<FILE>)
+ my ($file) = @_;
+ my $fd = IO::File->new($file, "r");
+ unless (defined $fd)
+ {
+ print STDERR "WARNING: Unable to open file: '" . $file . "'.\n";
+ return;
+ }
+ # 1, if we are inside enum.
+ my $enum = 0;
+ # 1 or more, if we are inside deprecated lines.
+ my $deprecated = 0;
+ # 1, if we are inside multiline comment.
+ my $comment = 0;
+ # line containing whole enum preprocessed definition to be processed.
+ my $line = "";
+ # line containing whole enum raw definition.
+ my $raw_line = "";
+ # 1, if we already printed comment about basename of header file containing
+ # enums.
+ my $from = 0;
+ # 1, if only right bracket was found, not name.
+ my $rbracket_only = 0;
+ while(<$fd>)
{
+ my $tmp_rawline = $_;
+ if ($enum)
+ {
+ $raw_line .= ";; " . $tmp_rawline;
+ }
if($comment)
{
- # end of multiline comment
- $comment = 0 if(/\*\//);
+ # end of multiline comment.
+ if (m!\*/(.*)!) # / just to fix frigging highlighting in gedit
+ {
+ $comment = 0;
+ if ($enum)
+ {
+ $line .= $1;
+ }
+ }
next;
}
-
- $deprecated = 1 if(s/^#ifndef [A-Z_]+_DISABLE_DEPRECATED//);
-
- ++$deprecated if($deprecated > 0 && /^#\s*if/);
- --$deprecated if($deprecated > 0 && /^#\s*endif/);
-
- next if($deprecated > 0);
-
- # filter single-line comments
- s/\/\*.*\*\///g;
-
- # begin of multiline comment
- if(/\/\*/)
+ # omit deprecated stuff.
+ if ($omit and /^\s*#.*(if\s*!\s*defined)|(ifndef)\s*\(?\s*[A-Z_]+_DISABLE_DEPRECATED\s*\)?/)
+ {
+ ++$deprecated;
+ next;
+ }
+ ++$deprecated if ($deprecated > 0 and /^#\s*if/);
+ if ($deprecated > 0 and /^#\s*endif/)
+ {
+ --$deprecated;
+ next;
+ }
+ next if ($deprecated > 0);
+ # discard any preprocessor directives inside enums.
+ next if ($enum and /^\s*#/);
+ # filter single-line comments.
+ s!/\*.*?\*/!!g;
+ s!//.*$!!;
+ # beginning of multiline comment.
+ if (m!^(.*)/\*!)
{
$comment = 1;
+ if ($enum)
+ {
+ $line .= $1 . "\n";
+ }
next;
}
-
+ # XXX: what does it do?
s/','/\%\%COMMA\%\%/;
s/'}'/\%\%RBRACE\%\%/;
+ # we have found an enum.
if (/^\s*typedef enum/ )
{
- print ";; From $file\n\n" if (!$from);
- $from=1;
- $enum=1;
+ my $basename = File::Spec->splitpath($file);
+ print(';; From ', $basename, "\n\n") unless ($from);
+ $from = 1;
+ $enum = 1;
+ $raw_line .= ";; " . $tmp_rawline;
next;
}
-
- if ($enum && /\}/)
+ # we have found end of an enum.
+ if ($enum and /\}/ or $rbracket_only)
{
- $enum=0;
- &process($line,$_);
- $line="";
+ # if the same line also consists ';' - that means there is a typedef name
+ # between '}' and ';'.
+ if (/;/)
+ {
+ my $def = ($rbracket_only ? ("} " . $_) : ($_));
+ $enum = 0;
+ print ";; Original typedef:\n";
+ print $raw_line . "\n";
+ process($line, $def);
+ $line = "";
+ $raw_line = "";
+ $rbracket_only = 0;
+ }
+ # we assume there is no such definition formed like this:
+ # typedef enum
+ # {
+ # ...
+ # } MyTypedef
+ # ;
+ # that would be stupid.
+ else
+ {
+ $rbracket_only = 1;
+ # don't append useless lines to $line.
+ next;
+ }
}
- $line.=$_ if ($enum);
+ $line .= $_ if ($enum);
}
+ $fd->close();
}
-
-# convert enums to lisp
-sub process
+#
+# convert enums to lisp.
+#
+sub process($$)
{
- my ($line,$def)= _;
-
- $def=~s/\s*\}\s*//g;
- $def=~s/\s*;\s*$//;
- my $c_name=$def;
-
- $line=~s/\s+/ /g;
- $line=~s/\/\*.*\*\///g;
- $line=~s/\s*{\s*//;
-
- my $entity = "enum";
+ my ($line,$def) = @_;
+ # strip whitespace and closing bracket before the name and whitespace and
+ # colon after the name.
+ $def =~ s/\s*\}\s*//g;
+ $def =~ s/\s*;\s*$//;
+ my $c_name = $def;
+ # replace all excessive whitespaces with one space.
+ $line =~ s/\s+/ /g;
+ # get rid of any comments.
+ $line =~ s!/\*.*\*/!!g;
+ # get rid of opening bracket.
+ $line =~ s/\s*{\s*//;
+ # lets employ some heuristics. :)
+ my %e_h = ("enum" => 0, "flags" => 0);
+ # c_name = module + def.
$c_name =~ /^([A-Z][a-z]*)/;
- $module = $1;
- $def =~ s/$module//;
-
- @c_name=();
- @name=();
- @number=();
-
- $val=0;
- foreach $i (split(/,/,$line))
- {
- $i=~s/^\s+//;
- $i=~s/\s+$//;
- if ($i =~ /^\S+$/)
- {
- push(@c_name,$i);
- push(@number,sprintf("%d",$val));
- $token{$i}=$val;
+ $module = $1 if ($module eq "none");
+ $def =~ s/\Q$module\E//;
+ # names and their values.
+ my @c_names = ();
+ my @numbers = ();
+ # val - default value for enum, gets incremented after every value processed.
+ my $val = 0;
+ # these are just for case when enum value is equal to a some sort of unknown
+ # value - preprocessor define or other enum.
+ my $unknown_flag = 0;
+ my $unknown_val = "";
+ my $unknown_base = "";
+ my $unknown_increment = 0;
+ foreach my $i (split(/,/, $line))
+ {
+ # remove leading and trailing spaces.
+ $i =~ s/^\s+//;
+ $i =~ s/\s+$//;
+ # also remove backslashes as some people like to add them before newlines...
+ $i =~ s/\\//g;
+ # if only name exists [like MY_ENUM_VALUE].
+ if ($i =~ /^\S+$/)
+ {
+ push(@c_names, $i);
+ if ($unknown_flag)
+ {
+ push(@numbers, $unknown_val);
+ $tokens{$i} = $unknown_val;
}
- elsif ($i =~ /^(\S+)\s*=\s*(0x[0-9a-fA-F]+)$/ ||
- $i =~ /^(\S+)\s*=\s*(-?[0-9]+)$/ ||
- $i =~ /^(\S+)\s*=\s*\(?(1\s*<<\s*[0-9]+)\)?$/
- )
- {
- my ($tmp1, $tmp2) = ($1, $2);
- push(@c_name, $tmp1);
- eval("\$val = $tmp2;");
- $entity = "flags" if($tmp2 =~ /^1\s*<</ || $tmp2 =~ /^0x/);
- push(@number, $tmp2);
- $token{$tmp1} = $tmp2;
+ else
+ {
+ push(@numbers, sprintf("%d", $val));
+ $tokens{$i} = $val;
}
- elsif ($i =~ /^(\S+)\s*=\s*([ _x0-9a-fA-Z|()~]+)$/)
- {
- my ($tmp1, $tmp2) = ($1, $2);
- push(@c_name, $tmp1);
- $tmp2 =~ s/([A-Z_]+)/($token{$1})/;
- eval("\$val = $tmp2;");
- $val = "#error" if(!$val);
- $val = sprintf("0x%X", $val) if($entity eq "flags");
- push(@number, $val);
- $token{$tmp1} = $val;
+ $e_h{"enum"}++;
+ }
+ # if name with value exists [like MY_FLAG_VALUE = 0x2 or 0x5 << 22
+ # or 42 or -13 (in this case entity is still enum, not flags)
+ # or 1 << 2 or (1 << 4) or (1 << 5) - 1].
+ elsif ($i =~ /^(\S+)\s*=?\s*(0x[0-9a-fA-F]+[\s0-9a-fx<-]*)$/ or
+ $i =~ /^(\S+)\s*=?\s*(-?\s*[0-9]+)$/ or
+ $i =~ /^(\S+)\s*=?\s*(\(?1\s*<<\s*[0-9]+\s*\)?[\s0-9a-fx<-]*)$/
+ )
+ {
+ my ($tmp1, $tmp2) = ($1, $2);
+ push(@c_names, $tmp1);
+ # i do not know who thought that writing '- 1' as enum value is grrreat
+ # idea - strip whitespaces between unary minus and a digit.
+ if ($tmp2 =~ /^-\s+/)
+ {
+ $tmp2 =~ s/\s+//;
+ }
+ eval("\$val = $tmp2;");
+ if ($tmp2 =~ /^\(?1\s*<</)
+ {
+ $e_h{"flags"} += 10;
+ }
+ elsif ($tmp2 =~ /^0x/)
+ {
+ $e_h{"flags"}++;
+ }
+ else
+ {
+ $e_h{"enum"}++;
+ }
+ push(@numbers, $tmp2);
+ $tokens{$tmp1} = $val;
+ $unknown_flag = 0;
+ }
+ # if name with other name exists [like MY_FLAG_VALUE = MY_PREV_FLAG_VALUE
+ # or ~(MY_PREV_FLAG_VALUE | MY_EARLIER_VALUE | (1 << 5) - 1 | 0x200)].
+ # [MY_FLAG MY_OTHER_FLAG is also supported - note lack of equal char.]
+ elsif ($i =~ /^(\S+)\s*=?\s*([ _x0-9a-fA-Z|()<~]+)$/)
+ {
+ my ($tmp1, $tmp2) = ($1, $2);
+ push(@c_names, $tmp1);
+ # split r-values on "logical or" and for each splitted r-value check its
+ # numeric value and replace a name with it if possible.
+ my @tmps = split(/\|/, $tmp2);
+ # dont_eval is 1 if unknown token is found, so whole value is copied
+ # verbatim, without evaling.
+ my $dont_eval = 0;
+ if (@tmps > 1)
+ {
+ $e_h{"flags"}++;
+ }
+ else
+ {
+ $e_h{"enum"}++;
+ }
+ foreach my $tmpval (@tmps)
+ {
+ # if r-value is something like MY_FLAG or MY_DEFINE_VALUE3.
+ if ($tmpval =~ /([_A-Z0-9]+)/)
+ {
+ my $tmp3 = $1;
+ unless (defined($tokens{$tmp3}))
+ {
+ $dont_eval = 1;
+ print STDERR "WARNING: " . $tmp3 . " value of " . $tmp1 . " element in '" . $c_name . "' enum is an unknown token.\n" .
+ "It probably is one of below:\n" .
+ " - preprocessor value - make sure that header defining this value is included in sources wrapping " . $c_name . ".\n" .
+ " - enum value from other header or module - see 'preprocessor value'.\n" .
+ " - typo (happens rarely) - send a patch fixing this to maintainer of this module.\n";
+ # unknown value often makes a flag.
+ $e_h{"flags"}++;
+ }
+ else
+ {
+ $tmp2 =~ s/$tmp3/$tokens{$tmp3}/;
+ }
+ }
+ # else is a numeric value, so we do not do anything.
}
- elsif ($i =~ /^(\S+)\s*=\s*'(.)'$/)
+ # check if there are still same non-numerical values.
+ if ($tmp2 =~ /[_A-Z]+/)
{
- push(@c_name,$1);
- push(@number,"\'$2\'");
- $val=ord($2);
- $token{$1}=$val;
+ $dont_eval = 1;
}
- elsif ($i =~ /^(\S+)\s*=\s*(\%\%[A-Z]+\%\%)$/)
+ unless ($dont_eval)
{
- $tmp=$1;
- $_=$2;
- s/\%\%COMMA\%\%/,/;
- s/\%\%RBRACE\%\%/]/;
- push(@c_name,$tmp);
- push(@number,"\'$_\'");
- $val=ord($_);
- $token{$tmp}=$val;
+ eval("\$val = $tmp2;");
+ # TODO: "0x%X" format should not be used if, in the end, parsed typedef
+ # is an enum.
+# $val = sprintf("0x%X", $val);
+ push(@numbers, $val);
+ $tokens{$tmp1} = $val;
+ $unknown_flag = 0;
}
else
{
- #print STDERR "$i\n";
+ push(@numbers, $tmp2);
+ $unknown_flag = 1;
+ # wrapping in safety parens.
+ $unknown_base = "(" . $tmp2 . ")";
+ $unknown_increment = 0;
+ $tokens{$tmp1} = $unknown_base;
}
+ }
+ # if name with char exists (like MY_ENUM_VALUE = 'a').
+ elsif ($i =~ /^(\S+)\s*=\s*'(.)'$/)
+ {
+ push(@c_names, $1);
+ push(@numbers, "\'$2\'");
+ $val = ord($2);
+ $tokens{$1} = $val;
+ $unknown_flag = 0;
+ $e_h{"enum"}++;
+ }
+ # if... XXX: I do not know what is matched here.
+ elsif ($i =~ /^(\S+)\s*=\s*(\%\%[A-Z]+\%\%)$/)
+ {
+ my $tmp = $1;
+ $_ = $2;
+ s/\%\%COMMA\%\%/,/;
+ s/\%\%RBRACE\%\%/]/;
+ push(@c_names, $tmp);
+ push(@numbers, "\'$_\'");
+ $val = ord($_);
+ $tokens{$tmp} = $val;
+ $unknown_flag = 0;
+ $e_h{"enum"}++;
+ }
+ # it should not get here.
+ else
+ {
+ print STDERR "WARNING: I do not know how to parse it: '" . $i . "' in '" . $c_name . "'.\n";
+ }
+ if ($unknown_flag)
+ {
+ $unknown_increment++;
+ $unknown_val = $unknown_base . " + " . $unknown_increment;
+ }
+ else
+ {
$val++;
}
-
- # remove the prefix to form names
- &form_names(\ name,\ c_name);
-
+ }
+ my $entity;
+ # if there are 'Flags' at the end of C name, they are flags. if not, let
+ # heuristics decide.
+ if ($c_name =~ /Flags$/ or $e_h{"flags"} >= $e_h{"enum"})
+ {
+ $entity = "flags";
+ }
+ else
+ {
+ $entity = "enum";
+ }
+ # get nicks.
+ my $ref_names = form_names($c_name, \ c_names);
+ # set format - decimal for enums, hexadecimal for flags.
my $format = "%d";
- $format = "0x%X" if($entity eq "flags");
-
- # evaluate any unevaluated values
- my $j;
- for ($j=0;$j<$#number+1;$j++)
+ $format = "0x%X" if ($entity eq "flags");
+ # evaluate any unevaluated values and format them properly, if applicable.
+ for (my $j = 0; $j < @numbers; $j++)
{
- if ($number[$j]=~/\$/)
+ if ($numbers[$j] =~ /\$/)
{
- $number[$j]=sprintf($format, eval($number[$j]));
+ $numbers[$j] = eval($numbers[$j]);
+ }
+ if ($numbers[$j] =~ /[0-9a-fA-F]+/ and $numbers[$j] !~ /[_G-Zg-z<]/)
+ {
+ $numbers[$j] = sprintf($format, $numbers[$j]);
}
}
-
- #print ";; Enum $def\n\n";
+ # print the defs.
print "(define-$entity-extended $def\n";
print " (in-module \"$module\")\n";
print " (c-name \"$c_name\")\n";
print " (values\n";
- for ($j=0;$j<$#c_name+1;$j++)
+ for (my $j = 0; $j < @c_names; $j++)
{
- print " \'(\"$name[$j]\" \"$c_name[$j]\"";
- print " \"$number[$j]\"" if ($number[$j] ne "");
+ print " \'(\"$ref_names->[$j]\" \"$c_names[$j]\"";
+ print " \"$numbers[$j]\"" if ($numbers[$j] ne "");
print ")\n";
}
print " )\n";
print ")\n\n";
}
-
-sub form_names
+#
+# form nicks from C names.
+#
+sub form_names($$)
{
- my ($name,$c_name)= _;
-
- my $len=length($$c_name[0]) - 1;
- my $j;
-
- NAME: for ($j=0;$j<$#c_name;$j++)
+ my ($c_name, $c_names) = @_;
+ my @names = ();
+ # search for length of a prefix.
+ my $len = length($c_names->[0]) - 1;
+ # if there is more than one value in enum, just search for a common part.
+ if (@{$c_names} > 1)
+ {
+ NAME: for (my $j = 0; $j < @{$c_names} - 1; $j++)
+ {
+ while (substr($c_names->[$j], $len - 1, 1) ne "_" or
+ substr($c_names->[$j], 0, $len) ne substr($c_names->[$j + 1], 0, $len))
+ {
+ $len--;
+ last NAME if ($len <= 0);
+ }
+ }
+ }
+ # if there is only one value in enum, we have to use name of the enum.
+ elsif (@{$c_names} == 1)
{
- while (substr($$c_name[$j],$len-1,1) ne "_" ||
- substr($$c_name[$j],0,$len) ne substr($$c_name[$j+1],0,$len))
+ my @subvals = split(/_/, lc($c_names->[0]));
+ foreach my $subval (@subvals)
+ {
+ $subval = ucfirst($subval);
+ }
+ my $false_c_name = join("", @subvals);
+ while (substr($c_name, 0, $len) ne substr($false_c_name, 0, $len))
{
$len--;
- last NAME if ($len <= 0);
+ last if ($len <= 0);
+ }
+ my $tmplen = $len;
+ foreach my $subval (@subvals)
+ {
+ $len++;
+ my $l = length($subval);
+ last if ($tmplen <= $l);
+ $tmplen -= $l;
}
- #print substr($$c_name[$j],0,$len),"\n";
}
-
- my $prefix=substr($$c_name[0],0,$len);
-
- for ($j=0;$j<$#c_name+1;$j++)
+ # no values in enum means no names.
+ else
+ {
+ return \ names;
+ }
+ # get prefix with given length.
+ my $prefix = substr($c_names->[0], 0, $len);
+ # generate names.
+ for (my $j = 0; $j < @{$c_names}; $j++)
{
- $_=$$c_name[$j];
+ $_ = $c_names->[$j];
s/^$prefix//;
tr/A-Z_/a-z-/;
- push(@$name,$_);
+ push(@names, $_);
}
-
-}
+ return \ names;
+}
diff --git a/tools/extra_defs_gen/generate_defs_gegl.cc b/tools/extra_defs_gen/generate_defs_gegl.cc
index a802b1d..7971e50 100644
--- a/tools/extra_defs_gen/generate_defs_gegl.cc
+++ b/tools/extra_defs_gen/generate_defs_gegl.cc
@@ -41,12 +41,6 @@ int main (int argc, char *argv[])
<< get_defs(GEGL_TYPE_PROCESSOR)
<< get_defs(GEGL_TYPE_PATH)
<< get_defs(GEGL_TYPE_PARAM_PATH)
- << get_defs(GEGL_TYPE_INT32)
- << get_defs(GEGL_TYPE_PARAM_INT32)
- << get_defs(GEGL_TYPE_INT16)
- << get_defs(GEGL_TYPE_PARAM_INT16)
- << get_defs(GEGL_TYPE_INT8)
- << get_defs(GEGL_TYPE_PARAM_INT8)
<< get_defs(GEGL_TYPE_PARAM_STRING)
<< get_defs(GEGL_TYPE_PARAM_FILE_PATH)
<< get_defs(GEGL_TYPE_PARAM_MULTILINE)
diff --git a/tools/m4/convert_libgeglmm.m4 b/tools/m4/convert_libgeglmm.m4
index e7a3939..04c1391 100644
--- a/tools/m4/convert_libgeglmm.m4
+++ b/tools/m4/convert_libgeglmm.m4
@@ -3,6 +3,7 @@ _EQUAL(glong,long)
_CONV_ENUM(Gegl,BlitFlags)
_CONV_ENUM(Gegl,SamplerType)
+_CONV_ENUM(Gegl,AbyssPolicy)
#_CONVERSION(`GeglNode*',`const Glib::RefPtr<Node>&',Glib::wrap($3))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]