Go to the documentation of this file.
18 #ifndef INCLUDED_INTERFACE_SCRIPTED
19 #define INCLUDED_INTERFACE_SCRIPTED
24 #define BEGIN_INTERFACE_WRAPPER(iname) \
25 JSClass class_ICmp##iname = { \
26 "ICmp" #iname, JSCLASS_HAS_PRIVATE, \
27 JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
28 JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub, \
29 JSCLASS_NO_OPTIONAL_MEMBERS \
31 static JSFunctionSpec methods_ICmp##iname[] = {
33 #define END_INTERFACE_WRAPPER(iname) \
36 void ICmp##iname::InterfaceInit(ScriptInterface& scriptInterface) { \
37 JSContext* cx = scriptInterface.GetContext(); \
38 JSObject* global = JS_GetGlobalObject(cx); \
39 JS_InitClass(cx, global, NULL, &class_ICmp##iname, NULL, 0, NULL, methods_ICmp##iname, NULL, NULL); \
41 JSClass* ICmp##iname::GetJSClass() const { return &class_ICmp##iname; } \
42 void RegisterComponentInterface_##iname(ScriptInterface& scriptInterface) { \
43 ICmp##iname::InterfaceInit(scriptInterface); \
46 #define DEFINE_INTERFACE_METHOD_0(scriptname, rettype, classname, methodname) \
48 ScriptInterface::callMethod<rettype, &class_##classname, classname, &classname::methodname>, \
50 JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
52 #define DEFINE_INTERFACE_METHOD_1(scriptname, rettype, classname, methodname, arg1) \
54 ScriptInterface::callMethod<rettype, arg1, &class_##classname, classname, &classname::methodname>, \
56 JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
58 #define DEFINE_INTERFACE_METHOD_2(scriptname, rettype, classname, methodname, arg1, arg2) \
60 ScriptInterface::callMethod<rettype, arg1, arg2, &class_##classname, classname, &classname::methodname>, \
62 JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
64 #define DEFINE_INTERFACE_METHOD_3(scriptname, rettype, classname, methodname, arg1, arg2, arg3) \
66 ScriptInterface::callMethod<rettype, arg1, arg2, arg3, &class_##classname, classname, &classname::methodname>, \
68 JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
70 #define DEFINE_INTERFACE_METHOD_4(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4) \
72 ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, &class_##classname, classname, &classname::methodname>, \
74 JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
76 #define DEFINE_INTERFACE_METHOD_5(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5) \
78 ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, arg5, &class_##classname, classname, &classname::methodname>, \
80 JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
82 #define DEFINE_INTERFACE_METHOD_6(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5, arg6) \
84 ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, arg5, arg6, &class_##classname, classname, &classname::methodname>, \
86 JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
88 #define DEFINE_INTERFACE_METHOD_7(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
90 ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, arg5, arg6, arg7, &class_##classname, classname, &classname::methodname>, \
92 JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
94 #endif // INCLUDED_INTERFACE_SCRIPTED