From 4470a24e8cf3827efaddcfe240c3271cf1a0d6c0 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 25 Feb 2009 18:43:14 -0500 Subject: Bug 557383 - Virtual function support In order to determine whether a method is virtual, by default we look at the class table to find a callback field. This should be fairly reliable, but we may also later need annotations to more finely control this in the case of a name clash with a signal. --- tests/scanner/foo-1.0-expected.gir | 35 +++++++++++++++++++---------------- tests/scanner/foo-1.0-expected.tgir | 27 ++++++++++++++++++++++++--- tests/scanner/foo.c | 10 +++++----- tests/scanner/foo.h | 6 +++++- 4 files changed, 53 insertions(+), 25 deletions(-) (limited to 'tests') diff --git a/tests/scanner/foo-1.0-expected.gir b/tests/scanner/foo-1.0-expected.gir index 0f6b1f1f..38bde586 100644 --- a/tests/scanner/foo-1.0-expected.gir +++ b/tests/scanner/foo-1.0-expected.gir @@ -232,16 +232,16 @@ and/or use gtk-doc annotations. --> glib:type-name="FooInterface" glib:get-type="foo_interface_get_type" glib:type-struct="InterfaceIface"> - + - - + + - + + + + @@ -359,6 +362,16 @@ and/or use gtk-doc annotations. --> + + + + + + + + + + @@ -467,21 +480,11 @@ and/or use gtk-doc annotations. --> glib:get-type="foo_sub_interface_get_type" glib:type-struct="SubInterfaceIface"> - - - - - - + - - - - - - + - + + + + + + + + + + + + @@ -271,6 +282,16 @@ + + + + + + + + + + @@ -337,11 +358,11 @@ - + - + diff --git a/tests/scanner/foo.c b/tests/scanner/foo.c index 04882603..98d2f4be 100644 --- a/tests/scanner/foo.c +++ b/tests/scanner/foo.c @@ -8,8 +8,8 @@ int foo_init_argv (int argc, char **argv); int foo_init_argv_address (int *argc, char ***argv); void foo_private_function (FooObject *foo); void foo_test_unsigned (unsigned int uint); -void foo_interface_do_foo (FooInterface *self); -void foo_do_foo (FooInterface *self); +void foo_interface_do_foo (FooInterface *self, int x); +void foo_do_foo (FooInterface *self, int x); int foo_enum_method (FooEnumType foo_enum); FooHidden * foo_hidden_copy (const FooHidden *boxed); void foo_hidden_free (FooHidden *boxed); @@ -47,9 +47,9 @@ foo_interface_get_type (void) return object_type; } -void foo_interface_do_foo (FooInterface *self) +void foo_interface_do_foo (FooInterface *self, int x) { - FOO_INTERFACE_GET_INTERFACE(self)->do_foo (self); + FOO_INTERFACE_GET_INTERFACE(self)->do_foo (self, x); } enum { @@ -191,7 +191,7 @@ foo_object_take_all (FooObject *object, int x, ...) } void -foo_do_foo (FooInterface *self) +foo_do_foo (FooInterface *self, int x) { diff --git a/tests/scanner/foo.h b/tests/scanner/foo.h index da30df38..2eeed6dc 100644 --- a/tests/scanner/foo.h +++ b/tests/scanner/foo.h @@ -48,11 +48,13 @@ struct _FooInterfaceIface { GTypeInterface parent_iface; - void (*do_foo) (FooInterface *self); + void (*do_foo) (FooInterface *self, int x); }; GType foo_interface_get_type (void) G_GNUC_CONST; +void foo_interface_do_foo (FooInterface *iface, int x); + struct _FooSubInterfaceIface { GTypeInterface parent_iface; @@ -105,6 +107,8 @@ char * foo_object_dup_name (FooObject *object); void foo_object_handle_glyph (FooObject *object, UtilityGlyph glyph); +void foo_object_virtual_method (FooObject *object, int first_param); + int foo_object_static_meth (); struct _FooSubobject -- cgit v1.2.1