forked from servo/servo
-
Notifications
You must be signed in to change notification settings - Fork 0
Codegen output
jdm edited this page Feb 14, 2013
·
3 revisions
/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
fn GetProtoObject(aCx: *JSContext, aGlobal: *JSObject, aReceiver: *JSObject) -> *JSObject {
unsafe {
/* Get the interface prototype object for this class. This will create the
object as needed. */
/* aGlobal and aReceiver are usually the same, but they can be different
too. For example a sandbox often has an xray wrapper for a window as the
prototype of the sandbox's global. In that case aReceiver is the xray
wrapper and aGlobal is the sandbox's global.
*/
/* Make sure our global is sane. Hopefully we can remove this sometime */
if ((*JS_GetClass(aGlobal)).flags & JSCLASS_DOM_GLOBAL) == 0 {
return ptr::null();
}
/* Check to see whether the interface objects are already installed */
let protoOrIfaceArray: *mut *JSObject = cast::transmute(GetProtoOrIfaceArray(aGlobal));
let cachedObject: *JSObject = *protoOrIfaceArray.offset(prototypes::id::ClientRect as uint);
if cachedObject.is_null() {
let tmp: *JSObject = CreateInterfaceObjects(aCx, aGlobal, aReceiver);
*protoOrIfaceArray.offset(prototypes::id::ClientRect as uint) = tmp;
tmp
} else {
cachedObject
}
}
}
/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
use dom::bindings::clientrect::*;
use dom::bindings::utils::*;
use js::*;
use js::glue::bindgen::*;
use js::jsapi::*;
use js::jsapi::bindgen::*;
use js::jsfriendapi::bindgen::*;
extern fn get_top(cx: *JSContext, obj: *JSObject, self: *ClientRectImpl, vp: *mut JSVal) -> bool {
unsafe {
let result: f32;
result = (*self).Top();
*vp = RUST_JS_NumberValue(result as f64);
return true;
}
}
const top_getterinfo: JSJitInfo = JSJitInfo {
op: get_top,
protoID: prototypes::id::ClientRect as u32,
depth: 0,
isInfallible: true, /* False in setters. */
isConstant: false /* Only relevant for getters. */
};
extern fn get_right(cx: *JSContext, obj: *JSObject, self: *ClientRectImpl, vp: *mut JSVal) -> bool {
unsafe {
let result: f32;
result = (*self).Right();
*vp = RUST_JS_NumberValue(result as f64);
return true;
}
}
const right_getterinfo: JSJitInfo = JSJitInfo {
op: get_right,
protoID: prototypes::id::ClientRect as u32,
depth: 0,
isInfallible: true, /* False in setters. */
isConstant: false /* Only relevant for getters. */
};
extern fn get_bottom(cx: *JSContext, obj: *JSObject, self: *ClientRectImpl, vp: *mut JSVal) -> bool {
unsafe {
let result: f32;
result = (*self).Bottom();
*vp = RUST_JS_NumberValue(result as f64);
return true;
}
}
const bottom_getterinfo: JSJitInfo = JSJitInfo {
op: get_bottom,
protoID: prototypes::id::ClientRect as u32,
depth: 0,
isInfallible: true, /* False in setters. */
isConstant: false /* Only relevant for getters. */
};
extern fn get_left(cx: *JSContext, obj: *JSObject, self: *ClientRectImpl, vp: *mut JSVal) -> bool {
unsafe {
let result: f32;
result = (*self).Left();
*vp = RUST_JS_NumberValue(result as f64);
return true;
}
}
const left_getterinfo: JSJitInfo = JSJitInfo {
op: get_left,
protoID: prototypes::id::ClientRect as u32,
depth: 0,
isInfallible: true, /* False in setters. */
isConstant: false /* Only relevant for getters. */
};
extern fn get_width(cx: *JSContext, obj: *JSObject, self: *ClientRectImpl, vp: *mut JSVal) -> bool {
unsafe {
let result: f32;
result = (*self).Width();
*vp = RUST_JS_NumberValue(result as f64);
return true;
}
}
const width_getterinfo: JSJitInfo = JSJitInfo {
op: get_width,
protoID: prototypes::id::ClientRect as u32,
depth: 0,
isInfallible: true, /* False in setters. */
isConstant: false /* Only relevant for getters. */
};
extern fn get_height(cx: *JSContext, obj: *JSObject, self: *ClientRectImpl, vp: *mut JSVal) -> bool {
unsafe {
let result: f32;
result = (*self).Height();
*vp = RUST_JS_NumberValue(result as f64);
return true;
}
}
const height_getterinfo: JSJitInfo = JSJitInfo {
op: get_height,
protoID: prototypes::id::ClientRect as u32,
depth: 0,
isInfallible: true, /* False in setters. */
isConstant: false /* Only relevant for getters. */
};
extern fn genericGetter(cx: *JSContext, argc: uint, vp: *JSVal) -> JSBool {
unsafe {
let obj: *JSObject = JS_THIS_OBJECT(cx, vp);
if obj.is_null() {
return false as JSBool;
}
let self: @ClientRectImpl;
self = unwrap::<@ClientRectImpl>(obj);
let _info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));
let tmp: *rust_box<ClientRectImpl> = cast::reinterpret_cast(&self);
return CallJitPropertyOp(_info, cx, obj, ptr::addr_of(&(*tmp).payload) as *libc::c_void, vp);
}
}
extern fn _finalize(fop: *JSFreeOp, obj: *JSObject) {
unsafe {
let val = JS_GetReservedSlot(obj, 0);
let _: @ClientRectImpl = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
}
}
const PrototypeClassName__: [u8 * 20] = ['C' as u8, 'l' as u8, 'i' as u8, 'e' as u8, 'n' as u8, 't' as u8, 'R' as u8, 'e' as u8, 'c' as u8, 't' as u8, 'P' as u8, 'r' as u8, 'o' as u8, 't' as u8, 'o' as u8, 't' as u8, 'y' as u8, 'p' as u8, 'e' as u8, 0 as u8];
const PrototypeClass: JSClass = JSClass {
name: &PrototypeClassName__ as *u8 as *libc::c_char,
flags: (1 & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT, //JSCLASS_HAS_RESERVED_SLOTS(1)
addProperty: crust::JS_PropertyStub, /* addProperty */
delProperty: crust::JS_PropertyStub, /* delProperty */
getProperty: crust::JS_PropertyStub, /* getProperty */
setProperty: crust::JS_StrictPropertyStub, /* setProperty */
enumerate: crust::JS_EnumerateStub,
resolve: crust::JS_ResolveStub,
convert: crust::JS_ConvertStub,
finalize: 0 as *u8, /* finalize */
checkAccess: 0 as *u8, /* checkAccess */
call: 0 as *u8, /* call */
hasInstance: 0 as *u8, /* hasInstance */
construct: 0 as *u8, /* construct */
trace: 0 as *u8, /* trace */
reserved: (0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 05
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 10
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 15
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 20
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 25
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 30
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 35
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void) // 40
};
const top_name: [u8 * 4] = ['t' as u8, 'o' as u8, 'p' as u8, 0 as u8];
const right_name: [u8 * 6] = ['r' as u8, 'i' as u8, 'g' as u8, 'h' as u8, 't' as u8, 0 as u8];
const bottom_name: [u8 * 7] = ['b' as u8, 'o' as u8, 't' as u8, 't' as u8, 'o' as u8, 'm' as u8, 0 as u8];
const left_name: [u8 * 5] = ['l' as u8, 'e' as u8, 'f' as u8, 't' as u8, 0 as u8];
const width_name: [u8 * 6] = ['w' as u8, 'i' as u8, 'd' as u8, 't' as u8, 'h' as u8, 0 as u8];
const height_name: [u8 * 7] = ['h' as u8, 'e' as u8, 'i' as u8, 'g' as u8, 'h' as u8, 't' as u8, 0 as u8];
const sAttributes: [JSPropertySpec * 7] = [
{ name: &top_name as *u8 as *libc::c_char, tinyid: 0, flags: ((JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) & 0xFF) as u8, getter: {op: genericGetter, info: &top_getterinfo as *JSJitInfo}, setter: {op: 0 as *u8, info: 0 as *JSJitInfo} },
{ name: &right_name as *u8 as *libc::c_char, tinyid: 0, flags: ((JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) & 0xFF) as u8, getter: {op: genericGetter, info: &right_getterinfo as *JSJitInfo}, setter: {op: 0 as *u8, info: 0 as *JSJitInfo} },
{ name: &bottom_name as *u8 as *libc::c_char, tinyid: 0, flags: ((JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) & 0xFF) as u8, getter: {op: genericGetter, info: &bottom_getterinfo as *JSJitInfo}, setter: {op: 0 as *u8, info: 0 as *JSJitInfo} },
{ name: &left_name as *u8 as *libc::c_char, tinyid: 0, flags: ((JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) & 0xFF) as u8, getter: {op: genericGetter, info: &left_getterinfo as *JSJitInfo}, setter: {op: 0 as *u8, info: 0 as *JSJitInfo} },
{ name: &width_name as *u8 as *libc::c_char, tinyid: 0, flags: ((JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) & 0xFF) as u8, getter: {op: genericGetter, info: &width_getterinfo as *JSJitInfo}, setter: {op: 0 as *u8, info: 0 as *JSJitInfo} },
{ name: &height_name as *u8 as *libc::c_char, tinyid: 0, flags: ((JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_NATIVE_ACCESSORS) & 0xFF) as u8, getter: {op: genericGetter, info: &height_getterinfo as *JSJitInfo}, setter: {op: 0 as *u8, info: 0 as *JSJitInfo} },
{ name: 0 as *libc::c_char, tinyid: 0, flags: 0, getter: {op: 0 as *u8, info: 0 as *JSJitInfo}, setter: {op: 0 as *u8, info: 0 as *JSJitInfo} }
];
fn CreateInterfaceObjects(aCx: *JSContext, aGlobal: *JSObject, aReceiver: *JSObject) -> *JSObject {
unsafe {
let parentProto: *JSObject = JS_GetObjectPrototype(aCx, aGlobal);
if parentProto.is_null() {
return ptr::null();
}
return CreateInterfaceObjects2(aCx, aGlobal, aReceiver, parentProto,
&PrototypeClass, ptr::null(), ThrowingConstructor, 0,
&Class.dom_class,
ptr::null(), ptr::to_unsafe_ptr(&sAttributes[0]),
ptr::null(), ptr::null(),
"ClientRect");
}
}
fn DefineDOMInterface(aCx: *JSContext, aReceiver: *JSObject, aEnabled: *mut bool) -> bool {
unsafe {
let global: *JSObject = JS_GetGlobalForObject(aCx, aReceiver);
*aEnabled = true;
return GetProtoObject(aCx, global, aReceiver).is_not_null();
}
}
const NativeHooks: NativePropertyHooks = NativePropertyHooks { resolve_own_property: 0 as *u8, resolve_property: /*ResolveProperty*/ 0 as *u8, enumerate_own_properties: 0 as *u8, enumerate_properties: /*EnumerateProperties*/ 0 as *u8, proto_hooks: 0 as *NativePropertyHooks };
const Class_name: [u8 * 11] = ['C' as u8, 'l' as u8, 'i' as u8, 'e' as u8, 'n' as u8, 't' as u8, 'R' as u8, 'e' as u8, 'c' as u8, 't' as u8, 0 as u8];
const Class: DOMJSClass = DOMJSClass {
base: JSClass { name: &Class_name as *u8 as *libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | ((1 & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT), //JSCLASS_HAS_RESERVED_SLOTS(1),
addProperty: crust::JS_PropertyStub, /* addProperty */
delProperty: crust::JS_PropertyStub, /* delProperty */
getProperty: crust::JS_PropertyStub, /* getProperty */
setProperty: crust::JS_StrictPropertyStub, /* setProperty */
enumerate: crust::JS_EnumerateStub,
resolve: crust::JS_ResolveStub,
convert: crust::JS_ConvertStub,
finalize: _finalize, /* finalize */
checkAccess: 0 as *u8, /* checkAccess */
call: 0 as *u8, /* call */
hasInstance: 0 as *u8, /* hasInstance */
construct: 0 as *u8, /* construct */
trace: 0 as *u8, /* trace */
reserved: (0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 05
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 10
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 15
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 20
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 25
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 30
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 35
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void) // 40
},
dom_class: DOMClass {
interface_chain: [ prototypes::id::ClientRect ] ,
unused: false, native_hooks: &NativeHooks as *NativePropertyHooks
}
};