diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2005-05-19 19:05:05 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-05-19 19:05:05 +0000 |
commit | bf28278d6bd0c2b33cfff5981a19531e998bba10 (patch) | |
tree | 8f658ccd96738392eeda4d350dd234bd95ffbefe | |
parent | c1f849b9a45b173a4d9e814e42df7ed52338375e (diff) | |
download | gobject-introspection-bf28278d6bd0c2b33cfff5981a19531e998bba10.tar.gz |
Add gdk-pixbuf.gidl as an example, and fix the code to handle it.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | examples/gdk-pixbuf.gidl | 605 | ||||
-rw-r--r-- | src/generate.c | 73 | ||||
-rw-r--r-- | src/gidlnode.c | 84 | ||||
-rw-r--r-- | src/gidlparser.c | 104 |
6 files changed, 779 insertions, 98 deletions
@@ -1,5 +1,13 @@ 2005-05-19 Matthias Clasen <mclasen@redhat.com> + * src/gidlnode.c (g_idl_node_build_metadata): Correctly handle + interface types for which is_pointer is FALSE, e.g. enums. + + * src/gidlnode.c (g_idl_node_get_full_size) + * src/gidlparser.c (parse_type_internal): + * src/generate.c (write_type_info): Support unspecialized + lists, hashtables and errors. Also emit a '*' after these. + * TODO: Updates 2005-05-17 Matthias Clasen <mclasen@redhat.com> @@ -1,7 +1,8 @@ This is a very first prototype of an introspection framework for GObject. The metadata format is described in metadata-format.txt, the XML IDL format -follows the DTD in gidl.dtd. Look at the files in tests/ for IDL examples. +follows the DTD in gidl.dtd. Look at the files in tests/ for testcases, +and at examples/ for bigger examples. The code in src/ currently produces four things: - g-idl-compile, a metadata compiler. It converts one or more IDL files diff --git a/examples/gdk-pixbuf.gidl b/examples/gdk-pixbuf.gidl new file mode 100644 index 00000000..859108e6 --- /dev/null +++ b/examples/gdk-pixbuf.gidl @@ -0,0 +1,605 @@ +<?xml version="1.0"?> +<api version="1.0"> + <namespace name="GdkPixbuf"> + <enum name="GdkPixbufAlphaMode" type-name="GdkPixbufAlphaMode" get-type="gdk_pixbuf_alpha_mode_get_type"> + <member name="GDK_PIXBUF_ALPHA_BILEVEL" value="0" /> + <member name="GDK_PIXBUF_ALPHA_FULL" value="1" /> + </enum> + <enum name="GdkColorspace" type-name="GdkColorspace" get-type="gdk_colorspace_get_type"> + <member name="GDK_COLORSPACE_RGB" value="0" /> + </enum> + <callback name="GdkPixbufDestroyNotify"> + <return-type type="void" /> + <parameters> + <parameter name="pixels" type="void*" transfer="full" direction="in" /> + <parameter name="data" type="void*" transfer="none" direction="in" /> + </parameters> + </callback> + <callback name="GdkPixbufSaveFunc"> + <return-type type="gboolean" /> + <parameters> + <parameter name="buf" type="guint8[length=1]" transfer="none" direction="in" /> + <parameter name="count" type="gint" direction="in" /> + <parameter name="error" type="GError*" transfer="full" direction="out" null-ok="1" /> + <parameter name="data" type="void*" transfer="none" direction="in" /> + </parameters> + </callback> + <enum name="GdkPixbufErrorCodes" type-name="GdkPixbufError" get-type="gdk_pixbuf_error_get_type"> + <member name="GDK_PIXBUF_ERROR_CORRUPT_IMAGE" value="0" /> + <member name="GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY" value="1" /> + <member name="GDK_PIXBUF_ERROR_BAD_OPTION" value="2" /> + <member name="GDK_PIXBUF_ERROR_UNKNOWN_TYPE" value="3" /> + <member name="GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION" value="4" /> + <member name="GDK_PIXBUF_ERROR_FAILED" value="5" /> + </enum> + <enum name="GdkInterpType" type-name="GdkInterpType" get-type="gdk_interp_type_get_type"> + <member name="GDK_INTERP_NEAREST" value="0" /> + <member name="GDK_INTERP_TILES" value="1" /> + <member name="GDK_INTERP_BILINEAR" value="2" /> + <member name="GDK_INTERP_HYPER" value="3" /> + </enum> + <enum name="GdkPixbufRotation" type-name="GdkPixbufRotation" get-type="gdk_pixbuf_rotation_get_type"> + <member name="GDK_PIXBUF_ROTATE_NONE" value="0" /> + <member name="GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE" value="90" /> + <member name="GDK_PIXBUF_ROTATE_UPSIDEDOWN" value="180" /> + <member name="GDK_PIXBUF_ROTATE_CLOCKWISE" value="270" /> + </enum> + <errordomain name="GdkPixbufError" get-quark="gdk_pixbuf_error_quark" codes="GdkPixbufErrorCodes" /> + <object name="GdkPixbuf" parent="GLib.GObject" type-name="GdkPixbuf" get-type="gdk_pixbuf_get_type"> + <constructor name="new" symbol="gdk_pixbuf_new"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="colorspace" type="GdkColorspace" direction="in" /> + <parameter name="has_alpha" type="gboolean" direction="in" /> + <parameter name="bits_per_sample" type="gint" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + </parameters> + </constructor> + <constructor name="copy" symbol="gdk_pixbuf_copy"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + </parameters> + </constructor> + <constructor name="new_subpixbuf" symbol="gdk_pixbuf_new_subpixbuf"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="src_pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="src_x" type="gint" direction="in" /> + <parameter name="src_y" type="gint" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + </parameters> + </constructor> + <constructor name="new_from_file" symbol="gdk_pixbuf_new_from_file"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="filename" type="guint8*" transfer="none" direction="in" /> + <parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </constructor> + <constructor name="new_from_file_at_size" symbol="gdk_pixbuf_new_from_file_at_size"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="filename" type="gchar*" transfer="none" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + <parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </constructor> + <constructor name="new_from_file_at_scale" symbol="gdk_pixbuf_new_from_file_at_scale"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="filename" type="gchar*" transfer="none" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + <parameter name="preserve_aspect_ratio" type="gboolean" direction="in" /> + <parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </constructor> + <constructor name="new_from_data" symbol="gdk_pixbuf_new_from_data"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="data" type="void*" transfer="full" direction="in" /> + <parameter name="colorspace" type="GdkColorspace" direction="in" /> + <parameter name="has_alpha" type="gboolean" direction="in" /> + <parameter name="bits_per_sample" type="gint" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + <parameter name="rowstride" type="gint" direction="in" /> + <parameter name="destroy_fn" type="GdkPixbufDestroyNotify" direction="in" null-ok="1" /> + <parameter name="destroy_fn_data" type="void*" transfer="none" direction="in" null-ok="1" /> + </parameters> + </constructor> + <constructor name="new_from_xpm_data" symbol="gdk_pixbuf_new_from_xpm_data"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="data" type="guint8*[]" transfer="none" direction="in" /> + </parameters> + </constructor> + <constructor name="new_from_inline" symbol="gdk_pixbuf_new_from_inline"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="data_length" type="gint" direction="in" /> + <parameter name="data" type="guint8[length=0]" transfer="none" direction="in" /> + <parameter name="copy_pixels" type="gboolean" direction="in" /> + <parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </constructor> + <method name="fill" symbol="gdk_pixbuf_fill"> + <return-type type="void" /> + <parameters> + <parameter name="pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="pixel" type="guint32" direction="in" /> + </parameters> + </method> + <method name="savev" symbol="gdk_pixbuf_savev"> + <return-type type="gboolean" /> + <parameters> + <parameter name="pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="filename" type="gchar*" transfer="none" direction="in" /> + <parameter name="type" type="guint8*" transfer="none" direction="in" /> + <parameter name="option_keys" type="guint8*[zero-terminated=1]" transfer="none" direction="in" /> + <parameter name="option_values" type="guint8*[zero-terminated=1]" transfer="none" direction="in" /> + <parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </method> + <method name="save_to_callbackv" symbol="gdk_pixbuf_save_to_callbackv"> + <return-type type="gboolean" /> + <parameters> + <parameter name="pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="save_func" type="GdkPixbufSaveFunc" direction="in" /> + <parameter name="user_data" type="void*" transfer="full" direction="in" /> + <parameter name="type" type="guint8*" transfer="none" direction="in" /> + <parameter name="option_keys" type="guint8*[zero-terminated=1]" transfer="none" direction="in" /> + <parameter name="option_values" type="guint8*[zero-terminated=1]" transfer="none" direction="in" /> + <parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </method> + <method name="save_to_bufferv" symbol="gdk_pixbuf_save_to_bufferv"> + <return-type type="gboolean" /> + <parameters> + <parameter name="pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="buffer" type="guint8[length=2]" transfer="full" direction="out" /> + <parameter name="buffer_size" type="gint" direction="out" /> + <parameter name="type" type="guint8*" transfer="none" direction="in" /> + <parameter name="option_keys" type="guint8*[zero-terminated=1]" transfer="none" direction="in" /> + <parameter name="option_values" type="guint8*[zero-terminated=1]" transfer="none" direction="in" /> + <parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </method> + <method name="add_alpha" symbol="gdk_pixbuf_add_alpha"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="substitute_color" type="gboolean" direction="in" /> + <parameter name="r" type="guint8" direction="in" /> + <parameter name="g" type="guint8" direction="in" /> + <parameter name="b" type="guint8" direction="in" /> + </parameters> + </method> + <method name="copy_area" symbol="gdk_pixbuf_copy_area"> + <return-type type="void" /> + <parameters> + <parameter name="src_pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="src_x" type="gint" direction="in" /> + <parameter name="src_y" type="gint" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + <parameter name="dest_pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest_x" type="gint" direction="in" /> + <parameter name="dest_y" type="gint" direction="in" /> + </parameters> + </method> + <method name="saturate_and_pixelate" symbol="gdk_pixbuf_saturate_and_pixelate"> + <return-type type="void" /> + <parameters> + <parameter name="src" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="saturation" type="gfloat" direction="in" /> + <parameter name="pixelate" type="gboolean" direction="in" /> + </parameters> + </method> + <method name="get_option" symbol="gdk_pixbuf_get_option"> + <return-type type="guint8*" transfer="none" /> + <parameters> + <parameter name="pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="key" type="guint8*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="scale" symbol="gdk_pixbuf_scale"> + <return-type type="void" /> + <parameters> + <parameter name="src" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest_x" type="gint" direction="in" /> + <parameter name="dest_y" type="gint" direction="in" /> + <parameter name="dest_width" type="gint" direction="in" /> + <parameter name="dest_height" type="gint" direction="in" /> + <parameter name="offset_x" type="gdouble" direction="in" /> + <parameter name="offset_y" type="gdouble" direction="in" /> + <parameter name="scale_x" type="gdouble" direction="in" /> + <parameter name="scale_y" type="gdouble" direction="in" /> + <parameter name="interp_type" type="GdkInterpType" direction="in" /> + </parameters> + </method> + <method name="composite" symbol="gdk_pixbuf_composite"> + <return-type type="void" /> + <parameters> + <parameter name="src" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest_x" type="gint" direction="in" /> + <parameter name="dest_y" type="gint" direction="in" /> + <parameter name="dest_width" type="gint" direction="in" /> + <parameter name="dest_height" type="gint" direction="in" /> + <parameter name="offset_x" type="gdouble" direction="in" /> + <parameter name="offset_y" type="gdouble" direction="in" /> + <parameter name="scale_x" type="gdouble" direction="in" /> + <parameter name="scale_y" type="gdouble" direction="in" /> + <parameter name="interp_type" type="GdkInterpType" direction="in" /> + <parameter name="overall_alpha" type="gint" direction="in" /> + </parameters> + </method> + <method name="composite_color" symbol="gdk_pixbuf_composite_color"> + <return-type type="void" /> + <parameters> + <parameter name="src" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest_x" type="gint" direction="in" /> + <parameter name="dest_y" type="gint" direction="in" /> + <parameter name="dest_width" type="gint" direction="in" /> + <parameter name="dest_height" type="gint" direction="in" /> + <parameter name="offset_x" type="gdouble" direction="in" /> + <parameter name="offset_y" type="gdouble" direction="in" /> + <parameter name="scale_x" type="gdouble" direction="in" /> + <parameter name="scale_y" type="gdouble" direction="in" /> + <parameter name="interp_type" type="GdkInterpType" direction="in" /> + <parameter name="overall_alpha" type="gint" direction="in" /> + <parameter name="check_x" type="gint" direction="in" /> + <parameter name="check_y" type="gint" direction="in" /> + <parameter name="check_size" type="gint" direction="in" /> + <parameter name="color1" type="guint32" direction="in" /> + <parameter name="color2" type="guint32" direction="in" /> + </parameters> + </method> + <method name="scale_simple" symbol="gdk_pixbuf_scale_simple"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="src" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest_width" type="gint" direction="in" /> + <parameter name="dest_height" type="gint" direction="in" /> + <parameter name="interp_type" type="GdkInterpType" direction="in" /> + </parameters> + </method> + <method name="composite_color_simple" symbol="gdk_pixbuf_composite_color_simple"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="src" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="dest_width" type="gint" direction="in" /> + <parameter name="dest_height" type="gint" direction="in" /> + <parameter name="interp_type" type="GdkInterpType" direction="in" /> + <parameter name="overall_alpha" type="gint" direction="in" /> + <parameter name="check_size" type="gint" direction="in" /> + <parameter name="color1" type="guint32" direction="in" /> + <parameter name="color2" type="guint32" direction="in" /> + </parameters> + </method> + <method name="rotate_simple" symbol="gdk_pixbuf_rotate_simple"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="src" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="angle" type="GdkPixbufRotation" direction="in" /> + </parameters> + </method> + <method name="flip" symbol="gdk_pixbuf_flip"> + <return-type type="GdkPixbuf*" transfer="full" /> + <parameters> + <parameter name="src" type="GdkPixbuf*" transfer="none" direction="in" /> + <parameter name="horizontal" type="gboolean" direction="in" /> + </parameters> + </method> + <property name="n-channels" readable="1" writable="1" construct-only="1" type="gint" /> + <property name="colorspace" readable="1" writable="1" construct-only="1" type="GdkColorspace" /> + <property name="has-alpha" readable="1" writable="1" construct-only="1" type="gboolean" /> + <property name="bits-per-sample" readable="1" writable="1" construct-only="1" type="gint" /> + <property name="width" readable="1" writable="1" construct-only="1" type="gint" /> + <property name="height" readable="1" writable="1" construct-only="1" type="gint" /> + <property name="rowstride" readable="1" writable="1" construct-only="1" type="gint" /> + <property name="pixels" readable="1" writable="1" construct-only="1" type="void*" /> + </object> + <object name="GdkPixbufAnimation" parent="GLib.GObject" type-name="GdkPixbufAnimation" get-type="gdk_pixbuf_animation_get_type"> + <constructor name="new_from_file" symbol="gdk_pixbuf_animation_new_from_file"> + <return-type type="GdkPixbufAnimation*" transfer="full" /> + <parameters> + <parameter name="filename" type="gchar*" transfer="none" direction="in" /> + <parameter name="error" type="GError<GdkPixbufError,GLib.GFileError>*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </constructor> + <constructor name="non_anim_new" symbol="gdk_pixbuf_non_anim_new"> + <return-type type="GdkPixbufAnimation*" transfer="full" /> + <parameters> + <parameter name="pixbuf" type="GdkPixbuf*" transfer="none" direction="in" /> + </parameters> + </constructor> + <method name="get_width" symbol="gdk_pixbuf_animation_get_width"> + <return-type type="gint" /> + <parameters> + <parameter name="animation" type="GdkPixbufAnimation*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="get_height" symbol="gdk_pixbuf_animation_get_height"> + <return-type type="gint" /> + <parameters> + <parameter name="animation" type="GdkPixbufAnimation*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="is_static_image" symbol="gdk_pixbuf_animation_is_static_image"> + <return-type type="gboolean" /> + <parameters> + <parameter name="animation" type="GdkPixbufAnimation*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="get_static_image" symbol="gdk_pixbuf_animation_get_static_image"> + <return-type type="GdkPixbuf*" transfer="none" /> + <parameters> + <parameter name="animation" type="GdkPixbufAnimation*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="get_iter" symbol="gdk_pixbuf_animation_get_iter"> + <return-type type="GdkPixbufAnimationIter*" transfer="full" /> + <parameters> + <parameter name="animation" type="GdkPixbufAnimation*" transfer="none" direction="in" /> + <parameter name="start_time" type="GLib.GTimeVal*" transfer="none" direction="in" /> + </parameters> + </method> + <vfunc name="is_static_image"> + <return-type type="gboolean" /> + <parameters> + <parameter name="anim" type="GdkPixbufAnimation*" transfer="none" direction="in" /> + </parameters> + </vfunc> + <vfunc name="get_static_image"> + <return-type type="GdkPixbuf*" transfer="none" null-ok="1" /> + <parameters> + <parameter name="anim" type="GdkPixbufAnimation*" transfer="none" direction="in" /> + </parameters> + </vfunc> + <vfunc name="get_size"> + <return-type type="void" /> + <parameters> + <parameter name="anim" type="GdkPixbufAnimation*" transfer="none" direction="in" /> + <parameter name="width" type="gint" direction="out" /> + <parameter name="height" type="gint" direction="out" /> + </parameters> + </vfunc> + <vfunc name="get_iter"> + <return-type type="GdkPixbufAnimationIter*" transfer="full" null-ok="1" /> + <parameters> + <parameter name="anim" type="GdkPixbufAnimation*" transfer="none" direction="in" /> + <parameter name="start_time" type="GLib.GTimeVal*" transfer="none" direction="in" /> + </parameters> + </vfunc> + </object> + <object name="GdkPixbufAnimationIter" parent="GLib.GObject" type-name="GdkPixbufAnimationIter" get-type="gdk_pixbuf_animation_iter_get_type"> + <vfunc name="get_delay_time"> + <return-type type="gint" /> + <parameters> + <parameter name="iter" type="GdkPixbufAnimationIter*" transfer="none" direction="in" /> + </parameters> + </vfunc> + <vfunc name="get_pixbuf"> + <return-type type="GdkPixbuf*" transfer="none" /> + <parameters> + <parameter name="iter" type="GdkPixbufAnimationIter*" transfer="none" direction="in" /> + </parameters> + </vfunc> + <vfunc name="on_currently_loading_frame"> + <return-type type="gboolean" /> + <parameters> + <parameter name="iter" type="GdkPixbufAnimationIter*" transfer="none" direction="in" /> + </parameters> + </vfunc> + <vfunc name="advance"> + <return-type type="gboolean" /> + <parameters> + <parameter name="iter" type="GdkPixbufAnimationIter*" transfer="none" direction="in" /> + <parameter name="current_time" type="GLib.GTimeVal*" transfer="none" direction="in" /> + </parameters> + </vfunc> + </object> + <struct name="GdkPixbufFormat"> + <method name="get_name" symbol="gdk_pixbuf_format_get_name"> + <return-type type="gchar*" transfer="full" /> + <parameters> + <parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="get_description" symbol="gdk_pixbuf_format_get_description"> + <return-type type="gchar*" transfer="full" /> + <parameters> + <parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="get_mime_types" symbol="gdk_pixbuf_format_get_mime_types"> + <return-type type="guint8*[zero-terminated=1]" transfer="full" /> + <parameters> + <parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="get_extensions" symbol="gdk_pixbuf_format_get_extensions"> + <return-type type="guint8*[zero-terminated=1]" transfer="full" /> + <parameters> + <parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="is_writable" symbol="gdk_pixbuf_format_is_writable"> + <return-type type="gboolean" /> + <parameters> + <parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="is_scalable" symbol="gdk_pixbuf_format_is_scalable"> + <return-type type="gboolean" /> + <parameters> + <parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="is_disabled" symbol="gdk_pixbuf_format_is_disabled"> + <return-type type="gboolean" /> + <parameters> + <parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="set_disabled" symbol="gdk_pixbuf_format_set_disabled"> + <return-type type="void" /> + <parameters> + <parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" /> + <parameter name="disabled" type="gboolean" direction="in" /> + </parameters> + </method> + <method name="get_license" symbol="gdk_pixbuf_format_get_license"> + <return-type type="gchar*" transfer="full" /> + <parameters> + <parameter name="format" type="GdkPixbufFormat*" transfer="none" direction="in" /> + </parameters> + </method> + </struct> + <function name="get_formats" symbol="gdk_pixbuf_get_formats"> + <return-type type="GSList<GdkPixbufFormat>*" transfer="shallow" /> + </function> + <function name="get_file_info" symbol="gdk_pixbuf_format_get_file_info"> + <return-type type="GdkPixbufFormat*" transfer="none" /> + <parameters> + <parameter name="filename" type="gchar*" transfer="none" direction="in" /> + <parameter name="width" type="gint" direction="out" /> + <parameter name="height" type="gint" direction="out" /> + </parameters> + </function> + <object name="GdkPixbufLoader" parent="GLib.GObject" type-name="GdkPixbufLoader" get-type="gdk_pixbuf_loader_get_type"> + <constructor name="new" symbol="gdk_pixbuf_loader_new"> + <return-type type="GdkPixbufLoader*" transfer="full" /> + </constructor> + <constructor name="new_with_type" symbol="gdk_pixbuf_loader_new_with_type"> + <return-type type="GdkPixbufLoader*" transfer="full" /> + <parameters> + <parameter name="image_type" type="guint8*" transfer="none" direction="in" /> + <parameter name="error" type="GError*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </constructor> + <constructor name="new_with_mime+type" symbol="gdk_pixbuf_loader_new_with_type"> + <return-type type="GdkPixbufLoader*" transfer="full" /> + <parameters> + <parameter name="mime_type" type="guint8*" transfer="none" direction="in" /> + <parameter name="error" type="GError*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </constructor> + <method name="set_size" symbol="gdk_pixbuf_loader_set_size"> + <return-type type="void" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + </parameters> + </method> + <method name="write" symbol="gdk_pixbuf_loader_write"> + <return-type type="gboolean" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + <parameter name="buf" type="guint8[length=2]" transfer="none" direction="in" /> + <parameter name="count" type="gint" direction="in" /> + <parameter name="error" type="GError*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </method> + <method name="get_pixbuf" symbol="gdk_pixbuf_loader_get_pixbuf"> + <return-type type="GdkPixbuf*" transfer="none" null-ok="1" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="get_animation" symbol="gdk_pixbuf_loader_get_animation"> + <return-type type="GdkPixbufAnimation*" transfer="none" null-ok="1" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + </parameters> + </method> + <method name="close" symbol="gdk_pixbuf_loader_close"> + <return-type type="gboolean" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + <parameter name="error" type="GError*" transfer="full" direction="out" null-ok="1" /> + </parameters> + </method> + <method name="get_format" symbol="gdk_pixbuf_loader_get_format"> + <return-type type="GdkPixbufFormat*" transfer="none" null-ok="1" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + </parameters> + </method> + <signal name="size_prepared" when="LAST"> + <return-type type="void" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + <parameter name="user_data" type="void*" transfer="none" direction="in" /> + </parameters> + </signal> + <signal name="area_prepared" when="LAST"> + <return-type type="void" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + <parameter name="user_data" type="void*" transfer="none" direction="in" /> + </parameters> + </signal> + <signal name="area_updated" when="LAST"> + <return-type type="void" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + <parameter name="x" type="gint" direction="in" /> + <parameter name="y" type="gint" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + <parameter name="user_data" type="void*" transfer="none" direction="in" /> + </parameters> + </signal> + <signal name="closed" when="LAST"> + <return-type type="void" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + <parameter name="user_data" type="void*" transfer="none" direction="in" /> + </parameters> + </signal> + <vfunc name="size_prepared"> + <return-type type="void" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + </parameters> + </vfunc> + <vfunc name="area_prepared"> + <return-type type="void" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + </parameters> + </vfunc> + <vfunc name="area_updated"> + <return-type type="void" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + <parameter name="x" type="gint" direction="in" /> + <parameter name="y" type="gint" direction="in" /> + <parameter name="width" type="gint" direction="in" /> + <parameter name="height" type="gint" direction="in" /> + </parameters> + </vfunc> + <vfunc name="closed"> + <return-type type="void" /> + <parameters> + <parameter name="loader" type="GdkPixbufLoader*" transfer="none" direction="in" /> + </parameters> + </vfunc> + </object> + </namespace> +</api> diff --git a/src/generate.c b/src/generate.c index c3cb30c9..121a61c8 100644 --- a/src/generate.c +++ b/src/generate.c @@ -106,43 +106,66 @@ write_type_info (const gchar *namespace, else if (tag == 22) { type = g_type_info_get_param_type (info, 0); - g_fprintf (file, "GList<"); - write_type_info (namespace, type, file); - g_fprintf (file, ">"); - g_base_info_unref ((GIBaseInfo *)type); + g_fprintf (file, "GList"); + if (type) + { + g_fprintf (file, "<"); + write_type_info (namespace, type, file); + g_fprintf (file, ">"); + g_base_info_unref ((GIBaseInfo *)type); + } + g_fprintf (file, "*"); } else if (tag == 23) { type = g_type_info_get_param_type (info, 0); - g_fprintf (file, "GSList<"); - write_type_info (namespace, type, file); - g_fprintf (file, ">"); - g_base_info_unref ((GIBaseInfo *)type); + g_fprintf (file, "GSList"); + if (type) + { + g_fprintf (file, "<"); + write_type_info (namespace, type, file); + g_fprintf (file, ">"); + g_base_info_unref ((GIBaseInfo *)type); + } + g_fprintf (file, "*"); } else if (tag == 24) { type = g_type_info_get_param_type (info, 0); - g_fprintf (file, "GHashTable<"); - write_type_info (namespace, type, file); - g_base_info_unref ((GIBaseInfo *)type); - type = g_type_info_get_param_type (info, 1); - g_fprintf (file, ","); - write_type_info (namespace, type, file); - g_fprintf (file, ">"); - g_base_info_unref ((GIBaseInfo *)type); + g_fprintf (file, "GHashTable"); + if (type) + { + g_fprintf (file, "<"); + write_type_info (namespace, type, file); + g_base_info_unref ((GIBaseInfo *)type); + type = g_type_info_get_param_type (info, 1); + g_fprintf (file, ","); + write_type_info (namespace, type, file); + g_fprintf (file, ">"); + g_base_info_unref ((GIBaseInfo *)type); + } + g_fprintf (file, "*"); } else if (tag == 25) { - g_fprintf (file, "GError<"); - for (i = 0; i < g_type_info_get_n_error_domains (info); i++) + gint n; + + g_fprintf (file, "GError"); + n = g_type_info_get_n_error_domains (info); + if (n > 0) { - GIErrorDomainInfo *ed = g_type_info_get_error_domain (info, i); - if (i > 0) - g_fprintf (file, ","); - write_type_name (namespace, (GIBaseInfo *)ed, file); - g_base_info_unref ((GIBaseInfo *)ed); + g_fprintf (file, "<"); + for (i = 0; i < n; i++) + { + GIErrorDomainInfo *ed = g_type_info_get_error_domain (info, i); + if (i > 0) + g_fprintf (file, ","); + write_type_name (namespace, (GIBaseInfo *)ed, file); + g_base_info_unref ((GIBaseInfo *)ed); + } + g_fprintf (file, ">"); } - g_fprintf (file, ">"); + g_fprintf (file, "*"); } } @@ -234,7 +257,7 @@ write_callable_info (const gchar *namespace, } } if (g_callable_info_may_return_null (info)) - g_fprintf (file, "null-ok=\"1\""); + g_fprintf (file, " null-ok=\"1\""); g_fprintf (file, " />\n"); diff --git a/src/gidlnode.c b/src/gidlnode.c index 748f593f..be8b891b 100644 --- a/src/gidlnode.c +++ b/src/gidlnode.c @@ -539,23 +539,35 @@ g_idl_node_get_full_size (GIdlNode *node) switch (type->tag) { case 20: - size = 4 + 4 + g_idl_node_get_full_size ((GIdlNode *)type->parameter_type1); + size = 4 + 4; + if (type->parameter_type1) + size += g_idl_node_get_full_size ((GIdlNode *)type->parameter_type1); break; case 21: size = 4 + 4; break; case 22: case 23: - size = 4 + 4 + g_idl_node_get_full_size ((GIdlNode *)type->parameter_type1); + size = 4 + 4; + if (type->parameter_type1) + size += g_idl_node_get_full_size ((GIdlNode *)type->parameter_type1); break; case 24: - size = 4 + 4 + 4 - + g_idl_node_get_full_size ((GIdlNode *)type->parameter_type1) - + g_idl_node_get_full_size ((GIdlNode *)type->parameter_type2); + size = 4 + 4 + 4; + if (type->parameter_type1) + size += g_idl_node_get_full_size ((GIdlNode *)type->parameter_type1); + if (type->parameter_type2) + size += g_idl_node_get_full_size ((GIdlNode *)type->parameter_type2); break; case 25: { - gint n = g_strv_length (type->errors); + gint n; + + if (type->errors) + n = g_strv_length (type->errors); + else + n = 0; + size = 4 + 4 + 2 * (n + n % 2); } break; @@ -930,34 +942,50 @@ serialize_type (GIdlModule *module, } else if (node->tag == 22) { - g_string_append (str, "GList<"); - serialize_type (module, modules, node->parameter_type1, str); - g_string_append (str, ">"); + g_string_append (str, "GList"); + if (node->parameter_type1) + { + g_string_append (str, "<"); + serialize_type (module, modules, node->parameter_type1, str); + g_string_append (str, ">"); + } } else if (node->tag == 23) { - g_string_append (str, "GSList<"); - serialize_type (module, modules, node->parameter_type1, str); - g_string_append (str, ">"); + g_string_append (str, "GSList"); + if (node->parameter_type1) + { + g_string_append (str, "<"); + serialize_type (module, modules, node->parameter_type1, str); + g_string_append (str, ">"); + } } else if (node->tag == 24) { g_string_append (str, "GHashTable<"); - serialize_type (module, modules, node->parameter_type1, str); - g_string_append (str, ","); - serialize_type (module, modules, node->parameter_type2, str); - g_string_append (str, ">"); + if (node->parameter_type1) + { + g_string_append (str, "<"); + serialize_type (module, modules, node->parameter_type1, str); + g_string_append (str, ","); + serialize_type (module, modules, node->parameter_type2, str); + g_string_append (str, ">"); + } } else if (node->tag == 25) { - g_string_append (str, "GError<"); - for (i = 0; node->errors[i]; i++) + g_string_append (str, "GError"); + if (node->errors) { - if (i > 0) - g_string_append (str, ","); - g_string_append (str, node->errors[i]); + g_string_append (str, "<"); + for (i = 0; node->errors[i]; i++) + { + if (i > 0) + g_string_append (str, ","); + g_string_append (str, node->errors[i]); + } + g_string_append (str, ">"); } - g_string_append (str, ">"); } } @@ -1044,7 +1072,7 @@ g_idl_node_build_metadata (GIdlNode *node, InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&data[*offset2]; *offset2 += 4; - iface->pointer = 1; + iface->pointer = type->is_pointer; iface->reserved = 0; iface->tag = type->tag; iface->reserved2 = 0; @@ -1105,11 +1133,17 @@ g_idl_node_build_metadata (GIdlNode *node, blob->reserved = 0; blob->tag = type->tag; blob->reserved2 = 0; - blob->n_domains = g_strv_length (type->errors); + if (type->errors) + blob->n_domains = g_strv_length (type->errors); + else + blob->n_domains = 0; *offset2 = ALIGN_VALUE (*offset2 + 4 + 2 * blob->n_domains, 4); - for (i = 0; type->errors[i]; i++) + for (i = 0; i < blob->n_domains; i++) blob->domains[i] = find_entry (module, modules, type->errors[i]); + g_print ("%s: %d error domains: ", type->unparsed, blob->n_domains); + for (i = 0; i < blob->n_domains; i++) + g_print ("%s(%d) ", type->errors[i], blob->domains[i]); } break; diff --git a/src/gidlparser.c b/src/gidlparser.c index 8b38ed70..49a770e0 100644 --- a/src/gidlparser.c +++ b/src/gidlparser.c @@ -119,7 +119,7 @@ parse_type_internal (gchar *str, gchar **rest) { "gdouble", 11, 0 }, { "gchar", 12, 0 }, { "char", 12, 0 }, - { "GString", 13, 0 }, + { "GString", 13, 1 }, { "int", 14, 0 }, { "gint", 14, 0 }, { "uint", 15, 0 }, @@ -184,19 +184,20 @@ parse_type_internal (gchar *str, gchar **rest) *rest = g_strchug (*rest); - if (**rest != '<') - goto error; - (*rest)++; - - type->parameter_type1 = parse_type_internal (*rest, rest); - if (type->parameter_type1 == NULL) - goto error; - - *rest = g_strchug (*rest); - - if ((*rest)[0] != '>') - goto error; - (*rest)++; + if (**rest == '<') + { + (*rest)++; + + type->parameter_type1 = parse_type_internal (*rest, rest); + if (type->parameter_type1 == NULL) + goto error; + + *rest = g_strchug (*rest); + + if ((*rest)[0] != '>') + goto error; + (*rest)++; + } } else if (g_str_has_prefix (*rest, "GHashTable")) { @@ -207,27 +208,28 @@ parse_type_internal (gchar *str, gchar **rest) *rest = g_strchug (*rest); - if (**rest != '<') - goto error; - (*rest)++; - - type->parameter_type1 = parse_type_internal (*rest, rest); - if (type->parameter_type1 == NULL) - goto error; - - *rest = g_strchug (*rest); + if (**rest == '<') + { + (*rest)++; - if ((*rest)[0] != ',') - goto error; - (*rest)++; + type->parameter_type1 = parse_type_internal (*rest, rest); + if (type->parameter_type1 == NULL) + goto error; - type->parameter_type2 = parse_type_internal (*rest, rest); - if (type->parameter_type2 == NULL) - goto error; + *rest = g_strchug (*rest); + + if ((*rest)[0] != ',') + goto error; + (*rest)++; + + type->parameter_type2 = parse_type_internal (*rest, rest); + if (type->parameter_type2 == NULL) + goto error; - if ((*rest)[0] != '>') - goto error; - (*rest)++; + if ((*rest)[0] != '>') + goto error; + (*rest)++; + } } else if (g_str_has_prefix (*rest, "GError")) { @@ -238,21 +240,29 @@ parse_type_internal (gchar *str, gchar **rest) *rest = g_strchug (*rest); - if (**rest != '<') - goto error; - (*rest)++; - - end = strchr (*rest, '>'); - str = g_strndup (*rest, end - *rest); - type->errors = g_strsplit (str, ",", 0); - g_free (str); + g_print ("parsing GError\n"); + if (**rest == '<') + { + gint i; - *rest = end + 1; + (*rest)++; + + end = strchr (*rest, '>'); + str = g_strndup (*rest, end - *rest); + type->errors = g_strsplit (str, ",", 0); + g_free (str); + + *rest = end + 1; + g_print ("\t"); + for (i = 0; type->errors[i]; i++) + g_print ("%s ", type->errors[i]); + g_print ("\n"); + } } else { type->tag = 21; - type->is_interface = TRUE; + type->is_interface = TRUE; start = *rest; /* must be an interface type */ @@ -266,11 +276,11 @@ parse_type_internal (gchar *str, gchar **rest) type->interface = g_strndup (start, *rest - start); *rest = g_strchug (*rest); - if (**rest == '*') - { - type->is_pointer = TRUE; - (*rest)++; - } + if (**rest == '*') + { + type->is_pointer = TRUE; + (*rest)++; + } } *rest = g_strchug (*rest); |