From bc88ef7bcda59b15988d27517a4f4f7e0672e33b Mon Sep 17 00:00:00 2001 From: Andreas Rottmann Date: Sat, 3 Jan 2009 13:44:42 +0000 Subject: =?UTF-8?q?Bug=20556489=20=E2=80=93=20callback=20annotations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2008-01-03 Andreas Rottmann Bug 556489 – callback annotations * giscanner/transformer.py * tools/generate.c (write_callable_info): Write out the new scope, closure and destroy attributes. * giscanner/transformer.py (Transformer._type_is_callback): New method, checking if a given type is a callback. (Transformer._augment_callback_params): New method; adds information (closure, destroy) to callback parameters. (Transformer._handle_closure, Transformer._handle_destroy): New methods, auxiliary to _augment_callback_params. (Transformer._create_function): Call _augment_callback_params(). (Transformer._create_parameter): Handle scope option. (Transformer._create_typedef_callback): New method, creates a callback, and registers it in the typedef namespace (Transformer._create_typedef): Use _create_typedef_callback() instead of the plain _create_callback(). * giscanner/ast.py (Parameter): Added callback-related fields. * giscanner/girwriter.py: Write out new Parameter fields. * girepository/girnode.h (GIrNodeParam): Added fields scope, closure and destroy. * girepository/gtypelib.h (ArgBlob): Ditto. * girepository/girparser.c (start_parameter): Handle new fields. * girepository/girmodule.c (g_ir_module_build_typelib): Adjust arg_blob_size, bump major version due to this change. * girepository/girnode.c (g_ir_node_get_full_size_internal) (g_ir_node_build_typelib) * girepository/gtypelib.c (g_typelib_check_sanity): ArgBlob size adjustments. (g_ir_node_build_typelib): Fill in new ArgBlob flags from param. * girepository/girepository.h (GIScope): New enumeration, listing the different possible scopes for callbacks. * girepository/ginfo.c (g_arg_info_get_scope) (g_arg_info_get_closure, g_arg_info_get_destroy): Accessors for callback-related argument indices (callback scope, closure for a callback, destroy notification for a callback). * tests/scanner/: Added testcases for new features. svn path=/trunk/; revision=998 --- tests/scanner/annotation.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/scanner/annotation.h') diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h index 1e83ca23..87946609 100644 --- a/tests/scanner/annotation.h +++ b/tests/scanner/annotation.h @@ -22,6 +22,10 @@ typedef GList* (*AnnotationListCallback) (GList *in); typedef struct _AnnotationObject AnnotationObject; typedef struct _AnnotationObjectClass AnnotationObjectClass; +typedef void (*AnnotationForeachFunc) (AnnotationObject *object, + const char *item, + gpointer user_data); + struct _AnnotationObject { GObject parent_instance; @@ -75,6 +79,9 @@ void annotation_object_parse_args (AnnotationObject *object, char ***argv); gboolean annotation_object_string_out (AnnotationObject *object, char **str_out); +void annotation_object_foreach (AnnotationObject *object, + AnnotationForeachFunc func, + gpointer user_data); GObject* annotation_object_do_not_use (AnnotationObject *object); -- cgit v1.2.1