diff --git a/.changes/config.json b/.changes/config.json index 426ac09..4fcbab4 100644 --- a/.changes/config.json +++ b/.changes/config.json @@ -79,7 +79,7 @@ }, "packages": { "javascriptcore-rs-sys": { - "path": "./javascriptcore-sys", + "path": "./sys", "manager": "rust" }, "javascriptcore-rs": { diff --git a/.gitmodules b/.gitmodules index 55edcc4..3f74209 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "gir-files"] path = gir-files - url = https://github.com/wusyong/gir-files + url = https://github.com/tauri-apps/gir-files [submodule "gir"] path = gir url = https://github.com/gtk-rs/gir diff --git a/Cargo.toml b/Cargo.toml index 240e1b4..33f54b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "javascriptcore-rs" -version = "0.15.1" +version = "0.15.4" edition = "2018" description = "Rust bindings for the javacriptcore library" repository = "https://github.com/tauri-apps/javascriptcore-rs" @@ -19,8 +19,8 @@ bitflags = "^1.0" [dependencies.ffi] package = "javascriptcore-rs-sys" - path = "./javascriptcore-sys" - version = "0.3.0" + path = "./sys" + version = "0.3.2" [features] v2_28 = [ "ffi/v2_28" ] diff --git a/Gir.toml b/Gir.toml index 3f53bea..3d50add 100644 --- a/Gir.toml +++ b/Gir.toml @@ -4,14 +4,11 @@ version = "4.0" target_path = "." min_cfg_version = "2.24" work_mode = "normal" -girs_directories = [ "gir-files/" ] +girs_directories = ["gir-files/"] deprecate_by_min_version = true single_version_file = true -external_libraries = [ - "GLib", - "GObject", -] +external_libraries = ["GLib", "GObject"] generate = [ "JavaScriptCore.CheckSyntaxMode", @@ -32,7 +29,6 @@ generate = [ "JavaScriptCore.PropertyGetter", "JavaScriptCore.PropertySetter", "JavaScriptCore.Setter", - "JavaScriptCore.StringRef", "JavaScriptCore.ValuePropertyFlags", "JavaScriptCore.VariadicFunction", "JavaScriptCore.VirtualMachine", @@ -43,6 +39,8 @@ manual = [ "GLib.DestroyNotify", "GLib.OptionGroup", "GObject.Callback", + "JavaScriptCore.StringRef", + "JavaScriptCore.GlobalContextRef", ] [[object]] @@ -55,8 +53,11 @@ name = "JavaScriptCore.Value" status = "generate" generate_builder = true +[[object.function]] +name = "object_define_property_accessor" +ignore = true + [[object]] name = "JavaScriptCore.WeakValue" status = "generate" generate_builder = true - diff --git a/generator.py b/generator.py new file mode 120000 index 0000000..09c770c --- /dev/null +++ b/generator.py @@ -0,0 +1 @@ +gir/generator.py \ No newline at end of file diff --git a/gir b/gir index 05fe12c..a97e608 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit 05fe12c0b7e761181827ea455a737ef7fe9130c6 +Subproject commit a97e6087cf6b92c30daed1129afe97a22a8dac00 diff --git a/gir-files b/gir-files index d11622c..7182204 160000 --- a/gir-files +++ b/gir-files @@ -1 +1 @@ -Subproject commit d11622cc2fc47f74941f95b90576db02b97b6fcf +Subproject commit 7182204ef1086ab89e60389d03017b58dce9b410 diff --git a/src/auto/class.rs b/src/auto/class.rs index 8197bce..516703c 100644 --- a/src/auto/class.rs +++ b/src/auto/class.rs @@ -1,5 +1,5 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) -// from gir-files (https://github.com/wusyong/gir-files) +// from gir-files (https://github.com/vhdirk/gir-files) // DO NOT EDIT use glib::translate::*; @@ -21,7 +21,7 @@ impl Class { //} //#[doc(alias = "jsc_class_add_constructor_variadic")] - //pub fn add_constructor_variadic(&self, name: Option<&str>, callback: P, user_data: /*Unimplemented*/Option, return_type: glib::types::Type) -> Option { + //pub fn add_constructor_variadic(&self, name: Option<&str>, callback: /*Unimplemented*/Fn(/*Ignored*/glib::PtrArray) -> /*Unimplemented*/Fundamental: Pointer, user_data: /*Unimplemented*/Option, return_type: glib::types::Type) -> Option { // unsafe { TODO: call ffi:jsc_class_add_constructor_variadic() } //} @@ -36,7 +36,7 @@ impl Class { //} //#[doc(alias = "jsc_class_add_method_variadic")] - //pub fn add_method_variadic(&self, name: &str, callback: P, user_data: /*Unimplemented*/Option, return_type: glib::types::Type) { + //pub fn add_method_variadic(&self, name: &str, callback: /*Unimplemented*/Fn(/*Unimplemented*/Fundamental: Pointer, /*Ignored*/glib::PtrArray) -> Value, user_data: /*Unimplemented*/Option, return_type: glib::types::Type) { // unsafe { TODO: call ffi:jsc_class_add_method_variadic() } //} @@ -46,7 +46,7 @@ impl Class { //} //#[doc(alias = "jsc_class_add_property")] - //pub fn add_property(&self, name: &str, property_type: glib::types::Type, getter: Option>, setter: Option>, user_data: /*Unimplemented*/Option) { + //pub fn add_property(&self, name: &str, property_type: glib::types::Type, getter: /*Unimplemented*/Fn(/*Unimplemented*/Fundamental: Pointer) -> Value, setter: /*Unimplemented*/Fn(/*Unimplemented*/Fundamental: Pointer, &Value), user_data: /*Unimplemented*/Option) { // unsafe { TODO: call ffi:jsc_class_add_property() } //} diff --git a/src/auto/context.rs b/src/auto/context.rs index 0fcebd2..a323d94 100644 --- a/src/auto/context.rs +++ b/src/auto/context.rs @@ -1,5 +1,5 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) -// from gir-files (https://github.com/wusyong/gir-files) +// from gir-files (https://github.com/vhdirk/gir-files) // DO NOT EDIT use crate::{CheckSyntaxMode, CheckSyntaxResult, Exception, Value, VirtualMachine}; diff --git a/src/auto/enums.rs b/src/auto/enums.rs index 3b78ba5..5a4f71b 100644 --- a/src/auto/enums.rs +++ b/src/auto/enums.rs @@ -1,5 +1,5 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) -// from gir-files (https://github.com/wusyong/gir-files) +// from gir-files (https://github.com/vhdirk/gir-files) // DO NOT EDIT use glib::translate::*; diff --git a/src/auto/exception.rs b/src/auto/exception.rs index 5ff922b..41cb059 100644 --- a/src/auto/exception.rs +++ b/src/auto/exception.rs @@ -1,5 +1,5 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) -// from gir-files (https://github.com/wusyong/gir-files) +// from gir-files (https://github.com/vhdirk/gir-files) // DO NOT EDIT use crate::Context; diff --git a/src/auto/flags.rs b/src/auto/flags.rs index 40db952..9967e3a 100644 --- a/src/auto/flags.rs +++ b/src/auto/flags.rs @@ -1,5 +1,5 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) -// from gir-files (https://github.com/wusyong/gir-files) +// from gir-files (https://github.com/vhdirk/gir-files) // DO NOT EDIT use bitflags::bitflags; diff --git a/src/auto/mod.rs b/src/auto/mod.rs index 779baaa..bd8e6b8 100644 --- a/src/auto/mod.rs +++ b/src/auto/mod.rs @@ -1,5 +1,5 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) -// from gir-files (https://github.com/wusyong/gir-files) +// from gir-files (https://github.com/vhdirk/gir-files) // DO NOT EDIT mod class; diff --git a/src/auto/value.rs b/src/auto/value.rs index 0ab65ef..f4267b8 100644 --- a/src/auto/value.rs +++ b/src/auto/value.rs @@ -1,5 +1,5 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) -// from gir-files (https://github.com/wusyong/gir-files) +// from gir-files (https://github.com/vhdirk/gir-files) // DO NOT EDIT use crate::{Context, ValuePropertyFlags}; @@ -74,7 +74,7 @@ impl Value { //} //#[doc(alias = "jsc_value_new_function_variadic")] - //pub fn new_function_variadic(context: &impl IsA, name: Option<&str>, callback: P, user_data: /*Unimplemented*/Option, return_type: glib::types::Type) -> Value { + //pub fn new_function_variadic(context: &impl IsA, name: Option<&str>, callback: /*Unimplemented*/Fn(/*Ignored*/glib::PtrArray) -> Value, user_data: /*Unimplemented*/Option, return_type: glib::types::Type) -> Value { // unsafe { TODO: call ffi:jsc_value_new_function_variadic() } //} @@ -226,9 +226,6 @@ pub trait ValueExt: 'static { #[doc(alias = "jsc_value_is_undefined")] fn is_undefined(&self) -> bool; - //#[doc(alias = "jsc_value_object_define_property_accessor")] - //fn object_define_property_accessor(&self, property_name: &str, flags: ValuePropertyFlags, property_type: glib::types::Type, getter: Option>, setter: Option>, user_data: /*Unimplemented*/Option); - #[doc(alias = "jsc_value_object_define_property_data")] fn object_define_property_data( &self, @@ -364,10 +361,6 @@ impl> ValueExt for O { unsafe { from_glib(ffi::jsc_value_is_undefined(self.as_ref().to_glib_none().0)) } } - //fn object_define_property_accessor(&self, property_name: &str, flags: ValuePropertyFlags, property_type: glib::types::Type, getter: Option>, setter: Option>, user_data: /*Unimplemented*/Option) { - // unsafe { TODO: call ffi:jsc_value_object_define_property_accessor() } - //} - fn object_define_property_data( &self, property_name: &str, diff --git a/src/auto/versions.txt b/src/auto/versions.txt index 42d293c..f55fabb 100644 --- a/src/auto/versions.txt +++ b/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 05fe12c0b7e7) -from gir-files (https://github.com/wusyong/gir-files @ d11622cc2fc4) +Generated by gir (https://github.com/gtk-rs/gir @ a97e6087cf6b) +from gir-files (https://github.com/vhdirk/gir-files @ 5c5c482b7f4a) diff --git a/src/auto/virtual_machine.rs b/src/auto/virtual_machine.rs index 2f7d8b0..72aac10 100644 --- a/src/auto/virtual_machine.rs +++ b/src/auto/virtual_machine.rs @@ -1,5 +1,5 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) -// from gir-files (https://github.com/wusyong/gir-files) +// from gir-files (https://github.com/vhdirk/gir-files) // DO NOT EDIT use glib::translate::*; diff --git a/src/auto/weak_value.rs b/src/auto/weak_value.rs index 2acb385..bdabf7d 100644 --- a/src/auto/weak_value.rs +++ b/src/auto/weak_value.rs @@ -1,5 +1,5 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) -// from gir-files (https://github.com/wusyong/gir-files) +// from gir-files (https://github.com/vhdirk/gir-files) // DO NOT EDIT use crate::Value; diff --git a/src/global_context_ref.rs b/src/global_context_ref.rs new file mode 100644 index 0000000..d22cdb7 --- /dev/null +++ b/src/global_context_ref.rs @@ -0,0 +1,28 @@ +use ffi::*; +use glib::translate::*; +use std::ptr; + +pub struct GlobalContextRef { + raw: JSGlobalContextRef, +} + +impl FromGlibPtrNone for GlobalContextRef { + unsafe fn from_glib_none(ptr: JSGlobalContextRef) -> Self { + GlobalContextRef { raw: ptr } + } +} + +impl FromGlibPtrFull for GlobalContextRef { + unsafe fn from_glib_full(ptr: JSGlobalContextRef) -> Self { + GlobalContextRef { raw: ptr } + } +} + +impl<'a> ToGlibPtr<'a, JSGlobalContextRef> for GlobalContextRef { + type Storage = (); + + #[inline] + fn to_glib_none(&self) -> Stash<'a, JSGlobalContextRef, GlobalContextRef> { + Stash(self.raw, ()) + } +} diff --git a/src/lib.rs b/src/lib.rs index a888d5c..f5925d9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,18 @@ +// // Copyright 2013-2017, The Gtk-rs Project Developers. +// // See the COPYRIGHT file at the top-level directory of this distribution. +// // Licensed under the MIT license, see the LICENSE file or #![cfg_attr(feature = "dox", feature(doc_cfg))] -pub use auto::{traits::*, *}; +use ffi::*; +use glib::translate::{FromGlibPtrFull, FromGlibPtrNone}; +use std::ptr; mod auto; +pub use auto::{traits::*, *}; +mod global_context_ref; +mod string_ref; +mod value_ref; + +pub use global_context_ref::*; +pub use string_ref::*; +pub use value_ref::*; diff --git a/src/string_ref.rs b/src/string_ref.rs new file mode 100644 index 0000000..8bfae89 --- /dev/null +++ b/src/string_ref.rs @@ -0,0 +1,27 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/vhdirk/gir-files) +// DO NOT EDIT + +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct StringRef(Shared); + + match fn { + ref => |ptr| ffi::JSStringRetain(*ptr), + unref => |ptr| ffi::JSStringRelease(*ptr), + } +} + +impl StringRef { + #[doc(alias = "JSStringGetMaximumUTF8CStringSize")] + pub fn maximum_utf8_cstring_size(&self) -> usize { + unsafe { ffi::JSStringGetMaximumUTF8CStringSize(*self.to_glib_none().0) } + } + + // #[doc(alias = "JSStringGetUTF8CString")] + // pub fn getUTF8CString(&self, buffer: glib::GString, buffer_size: usize) -> usize { + // unsafe { ffi::JSStringGetUTF8CString(*self.to_glib_none().0, buffer.to_glib_f) } + // } +} diff --git a/src/value_ref.rs b/src/value_ref.rs new file mode 100644 index 0000000..72ce09a --- /dev/null +++ b/src/value_ref.rs @@ -0,0 +1,101 @@ +// // Copyright 2013-2017, The Gtk-rs Project Developers. +// // See the COPYRIGHT file at the top-level directory of this distribution. +// // Licensed under the MIT license, see the LICENSE file or +#![cfg_attr(feature = "dox", feature(doc_cfg))] + +use ffi::*; +use glib::translate::*; +use std::ptr; + +use crate::GlobalContextRef; + +pub struct ValueRef { + raw: JSValueRef, +} + +impl ValueRef { + pub fn is_boolean(&self, context: &GlobalContextRef) -> bool { + unsafe { JSValueIsBoolean(context.to_glib_none().0, self.raw) != 0 } + } + + pub fn is_null(&self, context: &GlobalContextRef) -> bool { + unsafe { JSValueIsNull(context.to_glib_none().0, self.raw) != 0 } + } + + pub fn is_undefined(&self, context: &GlobalContextRef) -> bool { + unsafe { JSValueIsUndefined(context.to_glib_none().0, self.raw) != 0 } + } + + pub fn is_number(&self, context: &GlobalContextRef) -> bool { + unsafe { JSValueIsNumber(context.to_glib_none().0, self.raw) != 0 } + } + + pub fn is_string(&self, context: &GlobalContextRef) -> bool { + unsafe { JSValueIsString(context.to_glib_none().0, self.raw) != 0 } + } + + pub fn is_object(&self, context: &GlobalContextRef) -> bool { + unsafe { JSValueIsObject(context.to_glib_none().0, self.raw) != 0 } + } + + pub fn is_array(&self, context: &GlobalContextRef) -> bool { + unsafe { JSValueIsArray(context.to_glib_none().0, self.raw) != 0 } + } + + pub fn is_date(&self, context: &GlobalContextRef) -> bool { + unsafe { JSValueIsDate(context.to_glib_none().0, self.raw) != 0 } + } + + pub fn to_number(&self, context: &GlobalContextRef) -> Option { + let mut exception = ptr::null_mut(); + let result = unsafe { JSValueToNumber(context.to_glib_none().0, self.raw, &mut exception) }; + if exception.is_null() { + Some(result) + } else { + None + } + } + + pub fn to_boolean(&self, context: &GlobalContextRef) -> bool { + unsafe { JSValueToBoolean(context.to_glib_none().0, self.raw) != 0 } + } + + pub fn to_string(&self, context: &GlobalContextRef) -> Option { + unsafe { + let mut exception = ptr::null_mut(); + let jsstring = JSValueToStringCopy(context.to_glib_none().0, self.raw, &mut exception); + + if exception.is_null() { + let cap = JSStringGetMaximumUTF8CStringSize(jsstring); + let mut buf = Vec::::with_capacity(cap); + let len = JSStringGetUTF8CString(jsstring, buf.as_mut_ptr() as _, cap); + JSStringRelease(jsstring); + buf.set_len(len - 1); + String::from_utf8(buf).ok() + } else { + None + } + } + } +} + +impl FromGlibPtrNone for ValueRef { + unsafe fn from_glib_none(ptr: JSValueRef) -> Self { + ValueRef { raw: ptr } + } +} + +impl FromGlibPtrFull for ValueRef { + unsafe fn from_glib_full(ptr: JSValueRef) -> Self { + ValueRef { raw: ptr } + } +} + +impl<'a> ToGlibPtr<'a, JSValueRef> for ValueRef { + type Storage = (); + + #[inline] + fn to_glib_none(&self) -> Stash<'a, JSValueRef, ValueRef> { + Stash(self.raw, ()) + } +} diff --git a/javascriptcore-sys/CHANGELOG.md b/sys/CHANGELOG.md similarity index 100% rename from javascriptcore-sys/CHANGELOG.md rename to sys/CHANGELOG.md diff --git a/javascriptcore-sys/Cargo.toml b/sys/Cargo.toml similarity index 89% rename from javascriptcore-sys/Cargo.toml rename to sys/Cargo.toml index dab66b6..ec278ec 100644 --- a/javascriptcore-sys/Cargo.toml +++ b/sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "javascriptcore-rs-sys" -version = "0.3.1" +version = "0.3.2" authors = [ "The Gtk-rs Project Developers" ] description = "Sys functions for the Rust bindings of the javacriptcore library" repository = "https://github.com/tauri-apps/javascriptcore-rs" @@ -17,10 +17,10 @@ version = "2.24" version = "2.28" [package.metadata.docs.rs] -features = [ "dox" ] +features = ["dox"] [lib] -name = "javascriptcore_sys" +name = "javascriptcore_rs_sys" [dependencies] libc = "0.2" @@ -35,5 +35,5 @@ shell-words = "1.0.0" tempfile = "3" [features] -v2_28 = [ ] -dox = [ ] +v2_28 = [] +dox = [] diff --git a/javascriptcore-sys/Gir.toml b/sys/Gir.toml similarity index 99% rename from javascriptcore-sys/Gir.toml rename to sys/Gir.toml index 0c2bb67..9a27153 100644 --- a/javascriptcore-sys/Gir.toml +++ b/sys/Gir.toml @@ -9,4 +9,4 @@ girs_directories = [ "../gir-files/" ] external_libraries = [ "GLib", "GObject", -] +] \ No newline at end of file diff --git a/javascriptcore-sys/LICENSE b/sys/LICENSE similarity index 100% rename from javascriptcore-sys/LICENSE rename to sys/LICENSE diff --git a/javascriptcore-sys/build.rs b/sys/build.rs similarity index 70% rename from javascriptcore-sys/build.rs rename to sys/build.rs index c76607b..53f39fb 100644 --- a/javascriptcore-sys/build.rs +++ b/sys/build.rs @@ -1,5 +1,5 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 05fe12c0b7e7) -// from ../gir-files (@ d11622cc2fc4) +// Generated by gir (https://github.com/gtk-rs/gir @ a97e6087cf6b) +// from gir-files (https://github.com/vhdirk/gir-files @ 5c5c482b7f4a) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/javascriptcore-sys/src/lib.rs b/sys/src/lib.rs similarity index 88% rename from javascriptcore-sys/src/lib.rs rename to sys/src/lib.rs index 59b77fb..e6c368a 100644 --- a/javascriptcore-sys/src/lib.rs +++ b/sys/src/lib.rs @@ -1,5 +1,5 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 05fe12c0b7e7) -// from ../gir-files (@ d11622cc2fc4) +// Generated by gir (https://github.com/gtk-rs/gir @ a97e6087cf6b) +// from gir-files (https://github.com/vhdirk/gir-files @ 5c5c482b7f4a) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] @@ -47,8 +47,8 @@ pub const JSC_OPTION_RANGE_STRING: JSCOptionType = 6; // Constants pub const JSC_MAJOR_VERSION: c_int = 2; -pub const JSC_MICRO_VERSION: c_int = 3; -pub const JSC_MINOR_VERSION: c_int = 32; +pub const JSC_MICRO_VERSION: c_int = 1; +pub const JSC_MINOR_VERSION: c_int = 34; pub const JSC_OPTIONS_USE_DFG: *const c_char = b"useDFGJIT\0" as *const u8 as *const c_char; pub const JSC_OPTIONS_USE_FTL: *const c_char = b"useFTLJIT\0" as *const u8 as *const c_char; pub const JSC_OPTIONS_USE_JIT: *const c_char = b"useJIT\0" as *const u8 as *const c_char; @@ -79,10 +79,19 @@ pub type JSCClassSetPropertyFunction = Option< *mut JSCValue, ) -> gboolean, >; +pub type JSCClassVariadicFunction = + Option *mut JSCValue>; +pub type JSCConstructor = Option gpointer>; pub type JSCExceptionHandler = Option; +pub type JSCGetter = Option *mut JSCValue>; pub type JSCOptionsFunc = Option gboolean>; +pub type JSCPropertyGetter = Option *mut JSCValue>; +pub type JSCPropertySetter = Option; +pub type JSCSetter = Option; +pub type JSCVariadicFunction = + Option *mut JSCValue>; // Records #[repr(C)] @@ -255,6 +264,21 @@ pub struct _JSCWeakValuePrivate(c_void); pub type JSCWeakValuePrivate = *mut _JSCWeakValuePrivate; +#[repr(C)] +pub struct _JSGlobalContextRef(c_void); + +pub type JSGlobalContextRef = *mut _JSGlobalContextRef; + +#[repr(C)] +pub struct _JSStringRef(c_void); + +pub type JSStringRef = *mut _JSStringRef; + +#[repr(C)] +pub struct _JSValueRef(c_void); + +pub type JSValueRef = *mut _JSValueRef; + // Classes #[repr(C)] pub struct JSCClass(c_void); @@ -343,6 +367,49 @@ impl ::std::fmt::Debug for JSCWeakValue { #[link(name = "javascriptcoregtk-4.0")] extern "C" { + //========================================================================= + // JSGlobalContextRef + //========================================================================= + pub fn JSGlobalContextRetain(context: JSGlobalContextRef); + pub fn JSGlobalContextRelease(context: JSGlobalContextRef); + + //========================================================================= + // JSStringRef + //========================================================================= + pub fn JSStringRetain(string: JSStringRef); + pub fn JSStringRelease(string: JSStringRef); + pub fn JSStringGetMaximumUTF8CStringSize(string: JSStringRef) -> size_t; + pub fn JSStringGetUTF8CString( + string: JSStringRef, + buffer: *mut *mut c_char, + buffer_size: size_t, + ) -> size_t; + + //========================================================================= + // JSValueRef + //========================================================================= + pub fn JSValueIsArray(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean; + pub fn JSValueProtect(context: JSGlobalContextRef, value: JSValueRef); + pub fn JSValueUnprotect(context: JSGlobalContextRef, value: JSValueRef); + pub fn JSValueIsBoolean(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean; + pub fn JSValueIsDate(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean; + pub fn JSValueIsObject(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean; + pub fn JSValueIsNull(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean; + pub fn JSValueIsNumber(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean; + pub fn JSValueIsString(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean; + pub fn JSValueIsUndefined(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean; + pub fn JSValueToBoolean(ctx: JSGlobalContextRef, value: JSValueRef) -> gboolean; + pub fn JSValueToNumber( + ctx: JSGlobalContextRef, + value: JSValueRef, + exception: *mut *mut JSCException, + ) -> c_double; + pub fn JSValueToStringCopy( + ctx: JSGlobalContextRef, + value: JSValueRef, + exception: *mut JSValueRef, + ) -> JSStringRef; + //========================================================================= // JSCClass //========================================================================= @@ -360,7 +427,7 @@ extern "C" { pub fn jsc_class_add_constructor_variadic( jsc_class: *mut JSCClass, name: *const c_char, - callback: gobject::GCallback, + callback: JSCConstructor, user_data: gpointer, destroy_notify: glib::GDestroyNotify, return_type: GType, @@ -388,7 +455,7 @@ extern "C" { pub fn jsc_class_add_method_variadic( jsc_class: *mut JSCClass, name: *const c_char, - callback: gobject::GCallback, + callback: JSCClassVariadicFunction, user_data: gpointer, destroy_notify: glib::GDestroyNotify, return_type: GType, @@ -407,8 +474,8 @@ extern "C" { jsc_class: *mut JSCClass, name: *const c_char, property_type: GType, - getter: gobject::GCallback, - setter: gobject::GCallback, + getter: JSCPropertyGetter, + setter: JSCPropertySetter, user_data: gpointer, destroy_notify: glib::GDestroyNotify, ); @@ -554,7 +621,7 @@ extern "C" { pub fn jsc_value_new_function_variadic( context: *mut JSCContext, name: *const c_char, - callback: gobject::GCallback, + callback: JSCVariadicFunction, user_data: gpointer, destroy_notify: glib::GDestroyNotify, return_type: GType, @@ -617,8 +684,8 @@ extern "C" { property_name: *const c_char, flags: JSCValuePropertyFlags, property_type: GType, - getter: gobject::GCallback, - setter: gobject::GCallback, + getter: JSCGetter, + setter: JSCSetter, user_data: gpointer, destroy_notify: glib::GDestroyNotify, ); diff --git a/javascriptcore-sys/tests/abi.rs b/sys/tests/abi.rs similarity index 97% rename from javascriptcore-sys/tests/abi.rs rename to sys/tests/abi.rs index 5552d93..01f00c7 100644 --- a/javascriptcore-sys/tests/abi.rs +++ b/sys/tests/abi.rs @@ -1,5 +1,5 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 05fe12c0b7e7) -// from ../gir-files (@ d11622cc2fc4) +// Generated by gir (https://github.com/gtk-rs/gir @ a97e6087cf6b) +// from gir-files (https://github.com/vhdirk/gir-files @ 5c5c482b7f4a) // DO NOT EDIT use javascriptcore_sys::*; @@ -330,8 +330,8 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[ "3", ), ("JSC_MAJOR_VERSION", "2"), - ("JSC_MICRO_VERSION", "3"), - ("JSC_MINOR_VERSION", "32"), + ("JSC_MICRO_VERSION", "1"), + ("JSC_MINOR_VERSION", "34"), ("JSC_OPTIONS_USE_DFG", "useDFGJIT"), ("JSC_OPTIONS_USE_FTL", "useFTLJIT"), ("JSC_OPTIONS_USE_JIT", "useJIT"), diff --git a/javascriptcore-sys/tests/constant.c b/sys/tests/constant.c similarity index 94% rename from javascriptcore-sys/tests/constant.c rename to sys/tests/constant.c index b0a1660..957d686 100644 --- a/javascriptcore-sys/tests/constant.c +++ b/sys/tests/constant.c @@ -1,5 +1,5 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 05fe12c0b7e7) -// from ../gir-files (@ d11622cc2fc4) +// Generated by gir (https://github.com/gtk-rs/gir @ a97e6087cf6b) +// from gir-files (https://github.com/vhdirk/gir-files @ 5c5c482b7f4a) // DO NOT EDIT #include "manual.h" diff --git a/javascriptcore-sys/tests/layout.c b/sys/tests/layout.c similarity index 92% rename from javascriptcore-sys/tests/layout.c rename to sys/tests/layout.c index 067d089..bdd7b0a 100644 --- a/javascriptcore-sys/tests/layout.c +++ b/sys/tests/layout.c @@ -1,5 +1,5 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 05fe12c0b7e7) -// from ../gir-files (@ d11622cc2fc4) +// Generated by gir (https://github.com/gtk-rs/gir @ a97e6087cf6b) +// from gir-files (https://github.com/vhdirk/gir-files @ 5c5c482b7f4a) // DO NOT EDIT #include "manual.h" diff --git a/javascriptcore-sys/tests/manual.h b/sys/tests/manual.h similarity index 100% rename from javascriptcore-sys/tests/manual.h rename to sys/tests/manual.h