diff --git a/glue.rs b/glue.rs index ba4f49e2b..e5a9258e2 100644 --- a/glue.rs +++ b/glue.rs @@ -9,7 +9,7 @@ use jsapi::*; use jsfriendapi::JSJitInfo; use jsval::JSVal; -type c_bool = libc::c_int; +pub type c_bool = libc::c_int; pub struct ProxyTraps { pub getPropertyDescriptor: Option c_bool>, diff --git a/jsapi.rs b/jsapi.rs index 80dc2d1f3..d2a49be38 100644 --- a/jsapi.rs +++ b/jsapi.rs @@ -92,67 +92,67 @@ pub struct JSMutableHandleValue { } pub type JSRawObject = *mut JSObject; pub type JSPropertyOp = - Option JSBool>; pub type JSStrictPropertyOp = - Option JSBool>; pub type JSNewEnumerateOp = - Option JSBool>; pub type JSEnumerateOp = - Option JSBool>; pub type JSResolveOp = - Option JSBool>; pub type JSNewResolveOp = - Option JSBool>; pub type JSConvertOp = - Option JSBool>; pub type JSTypeOfOp = - Option JSType>; pub struct JSFreeOp { pub runtime: *mut JSRuntime, } pub type JSFinalizeOp = - Option; pub struct JSStringFinalizer { - pub finalize: Option, } pub type JSCheckAccessOp = - Option JSBool>; pub type JSHasInstanceOp = - Option JSBool>; pub type JSTraceOp = - Option; pub type JSTraceNamePrinter = - Option; pub type JSEqualityOp = - Option JSBool>; pub type JSNative = - Option JSBool>; pub type Enum_JSContextOp = c_uint; pub static JSCONTEXT_NEW: c_uint = 0; pub static JSCONTEXT_DESTROY: c_uint = 1; pub type JSContextOp = Enum_JSContextOp; pub type JSContextCallback = - Option JSBool>; pub type Enum_JSGCStatus = c_uint; @@ -160,22 +160,22 @@ pub static JSGC_BEGIN: c_uint = 0; pub static JSGC_END: c_uint = 1; pub type JSGCStatus = Enum_JSGCStatus; pub type JSGCCallback = - Option; pub type Enum_JSFinalizeStatus = c_uint; pub static JSFINALIZE_START: c_uint = 0; pub static JSFINALIZE_END: c_uint = 1; pub type JSFinalizeStatus = Enum_JSFinalizeStatus; pub type JSFinalizeCallback = - Option; pub type JSTraceDataOp = - Option; pub type JSOperationCallback = - Option JSBool>; + Option JSBool>; pub type JSErrorReporter = - Option; pub type Enum_JSExnType = c_int; pub static JSEXN_NONE: c_int = -1; @@ -195,64 +195,64 @@ pub struct JSErrorFormatString { pub exnType: int16_t, } pub type JSErrorCallback = - Option *JSErrorFormatString>; pub type JSLocaleToUpperCase = - Option JSBool>; pub type JSLocaleToLowerCase = - Option JSBool>; pub type JSLocaleCompare = - Option JSBool>; pub type JSLocaleToUnicode = - Option JSBool>; pub type JSDestroyPrincipalsOp = - Option; + Option; pub type JSSubsumePrincipalsOp = - Option JSBool>; pub type JSObjectPrincipalsFinder = - Option *mut JSPrincipals>; pub type JSCSPEvalChecker = - Option JSBool>; + Option JSBool>; pub type JSWrapObjectCallback = - Option *mut JSObject>; pub type JSPreWrapCallback = - Option *mut JSObject>; pub type JSSameCompartmentWrapObjectCallback = - Option *mut JSObject>; pub type JSDestroyCompartmentCallback = - Option; pub type JSCompartmentNameCallback = - Option; pub type ReadStructuredCloneOp = - Option *mut JSObject>; pub type WriteStructuredCloneOp = - Option JSBool>; pub type StructuredCloneErrorOp = - Option; pub type JSIterateCompartmentCallback = - Option; pub type JSEnumerateDiagnosticMemoryCallback = - Option JSBool>; pub type Enum_JSGCRootType = c_uint; @@ -260,10 +260,10 @@ pub static JS_GC_ROOT_VALUE_PTR: c_uint = 0; pub static JS_GC_ROOT_GCTHING_PTR: c_uint = 1; pub type JSGCRootType = Enum_JSGCRootType; pub type JSGCRootMapFun = - Option c_int>; pub type JSTraceCallback = - Option; pub struct JSTracer { pub runtime: *mut JSRuntime, diff --git a/jsfriendapi.rs b/jsfriendapi.rs index b16595808..39ffa792f 100644 --- a/jsfriendapi.rs +++ b/jsfriendapi.rs @@ -21,7 +21,6 @@ pub fn JS_ObjectToOuterObject(cx: *mut JSContext, //pub type JSJitInfo = JSJitInfo_struct; -#[nolink] pub mod bindgen { use jsapi::{JSContext, JSObject, JSClass, JSRuntime}; use libc::uintptr_t; diff --git a/jsval.rs b/jsval.rs index e898ea3f0..c648bc024 100644 --- a/jsval.rs +++ b/jsval.rs @@ -5,7 +5,7 @@ use jsapi::{JSObject, JSString, JSGCTraceKind, JSTRACE_OBJECT, JSTRACE_STRING}; use libc::c_void; -use std::cast; +use std::mem; static JSVAL_TAG_SHIFT: int = 47; @@ -86,7 +86,7 @@ pub fn Int32Value(i: i32) -> JSVal { #[inline(always)] pub fn DoubleValue(f: f64) -> JSVal { - let bits: u64 = unsafe { cast::transmute(f) }; + let bits: u64 = unsafe { mem::transmute(f) }; assert!(bits <= JSVAL_SHIFTED_TAG_MAX_DOUBLE as u64) JSVal { v: bits diff --git a/rust.rs b/rust.rs index 7e641627d..8f2b80530 100644 --- a/rust.rs +++ b/rust.rs @@ -125,13 +125,13 @@ impl Cx { } } - pub fn set_error_reporter(&self, reportfn: extern "C" unsafe fn(*mut JSContext, *c_char, *mut JSErrorReport)) { + pub fn set_error_reporter(&self, reportfn: unsafe extern "C" fn(*mut JSContext, *c_char, *mut JSErrorReport)) { unsafe { JS_SetErrorReporter(self.ptr, Some(reportfn)); } } - pub fn evaluate_script(&self, glob: *mut JSObject, script: ~str, filename: ~str, line_num: uint) + pub fn evaluate_script(&self, glob: *mut JSObject, script: String, filename: String, line_num: uint) -> Result<(),()> { let script_utf16 = script.to_utf16(); filename.to_c_str().with_ref(|filename_cstr| { @@ -158,7 +158,7 @@ impl Cx { pub extern fn reportError(_cx: *mut JSContext, msg: *c_char, report: *mut JSErrorReport) { unsafe { let fnptr = (*report).filename; - let fname = if fnptr.is_not_null() {from_c_str(fnptr)} else {"none".to_owned()}; + let fname = if fnptr.is_not_null() {from_c_str(fnptr)} else {"none".to_string()}; let lineno = (*report).lineno; let msg = from_c_str(msg); error!("Error at {:s}:{}: {:s}\n", fname, lineno, msg);