From: Corentin Noël Date: Mon, 23 Dec 2019 11:47:40 +0000 (+0100) Subject: javascriptcoregtk-4.0: Make JSC.Class usable by defining the right callback X-Git-Tag: 0.47.4~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=811787bc3f06b577de428050942f7476a70d187d;p=thirdparty%2Fvala.git javascriptcoregtk-4.0: Make JSC.Class usable by defining the right callback --- diff --git a/vapi/javascriptcoregtk-4.0.vapi b/vapi/javascriptcoregtk-4.0.vapi index 0e2cbbcc4..423024869 100644 --- a/vapi/javascriptcoregtk-4.0.vapi +++ b/vapi/javascriptcoregtk-4.0.vapi @@ -217,10 +217,10 @@ namespace JSC { public class Class : GLib.Object { [CCode (has_construct_function = false)] protected Class (); - public JSC.Value add_constructor_variadic (string? name, GLib.Callback callback, void* user_data, GLib.DestroyNotify? destroy_notify, GLib.Type return_type); - public JSC.Value add_constructorv (string? name, GLib.Callback callback, void* user_data, GLib.DestroyNotify? destroy_notify, GLib.Type return_type, [CCode (array_length_cname = "n_parameters", array_length_pos = 5.5, array_length_type = "guint")] GLib.Type[]? parameter_types); - public void add_method_variadic (string name, GLib.Callback callback, void* user_data, GLib.DestroyNotify? destroy_notify, GLib.Type return_type); - public void add_methodv (string name, GLib.Callback callback, void* user_data, GLib.DestroyNotify? destroy_notify, GLib.Type return_type, [CCode (array_length_cname = "n_parameters", array_length_pos = 5.5, array_length_type = "guint")] GLib.Type[]? parameter_types); + [CCode (cname = "jsc_class_add_constructor_variadic")] + public JSC.Value add_constructor (string? name, [CCode (delegate_target_pos = 2.33333, destroy_notify_pos = 2.66667, type = "GCallback")] owned JSC.ClassConstructorCb callback, GLib.Type return_type); + [CCode (cname = "jsc_class_add_method_variadic")] + public void add_method (string name, [CCode (delegate_target_pos = 2.33333, destroy_notify_pos = 2.66667, type = "GCallback")] owned JSC.ClassMethodCb callback, GLib.Type return_type); public void add_property (string name, GLib.Type property_type, [CCode (scope = "async")] GLib.Callback? getter, GLib.Callback? setter, void* user_data, GLib.DestroyNotify? destroy_notify); public unowned string get_name (); public unowned JSC.Class get_parent (); @@ -385,6 +385,8 @@ namespace JSC { ENUMERABLE, WRITABLE } + [CCode (cheader_filename = "jsc/jsc.h", instance_pos = 1.9, type_cname = "GCallback")] + public delegate T ClassConstructorCb (GLib.GenericArray values); [CCode (cheader_filename = "jsc/jsc.h", has_target = false)] public delegate bool ClassDeletePropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name); [CCode (array_length = false, array_null_terminated = true, cheader_filename = "jsc/jsc.h", has_target = false)] @@ -393,6 +395,8 @@ namespace JSC { public delegate JSC.Value? ClassGetPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name); [CCode (cheader_filename = "jsc/jsc.h", has_target = false)] public delegate bool ClassHasPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name); + [CCode (cheader_filename = "jsc/jsc.h", instance_pos = 2.9, type_cname = "GCallback")] + public delegate T ClassMethodCb (JSC.Class instance, GLib.GenericArray values); [CCode (cheader_filename = "jsc/jsc.h", has_target = false)] public delegate bool ClassSetPropertyFunction (JSC.Class jsc_class, JSC.Context context, void* instance, string name, JSC.Value value); [CCode (cheader_filename = "jsc/jsc.h", instance_pos = 2.9)] diff --git a/vapi/metadata/JavaScriptCore-4.0-custom.vala b/vapi/metadata/JavaScriptCore-4.0-custom.vala index 5e53d20b0..164c7e059 100644 --- a/vapi/metadata/JavaScriptCore-4.0-custom.vala +++ b/vapi/metadata/JavaScriptCore-4.0-custom.vala @@ -159,4 +159,8 @@ namespace JS { } namespace JSC { + [CCode (type_cname = "GCallback", instance_pos = 1.9)] + public delegate T ClassConstructorCb (GLib.GenericArray values); + [CCode (type_cname = "GCallback", instance_pos = 2.9)] + public delegate T ClassMethodCb (JSC.Class instance, GLib.GenericArray values); } diff --git a/vapi/metadata/JavaScriptCore-4.0.metadata b/vapi/metadata/JavaScriptCore-4.0.metadata index c0b9e071b..5e5b14f90 100644 --- a/vapi/metadata/JavaScriptCore-4.0.metadata +++ b/vapi/metadata/JavaScriptCore-4.0.metadata @@ -4,10 +4,14 @@ OPTIONS_* parent="JSC.Options" name="OPTIONS_(.+)" Class .add_property.getter closure=-1 destroy=-1 owned=false .add_property.setter closure=-1 destroy=-1 owned=false - .add_constructor_variadic.callback closure=-1 destroy=-1 owned=false - .add_constructorv.callback closure=-1 destroy=-1 owned=false - .add_method_variadic.callback closure=-1 destroy=-1 owned=false - .add_methodv.callback closure=-1 destroy=-1 owned=false + .add_constructor skip + .add_constructorv skip + .add_constructor_variadic name="add_constructor" + .add_constructor_variadic.callback type="owned JSC.ClassConstructorCb" + .add_method skip + .add_methodv skip + .add_method_variadic name="add_method" + .add_method_variadic.callback type="owned JSC.ClassMethodCb" Value .new_function_variadic.callback closure=-1 destroy=-1 owned=false .new_functionv.callback closure=-1 destroy=-1 owned=false