Пример #1
0
JSBool JSJSGlobalObject::fromjs_isTimerValid(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
  // get instance
  JSGlobalObject *object = static_cast<JSGlobalObject *>(reinterpret_cast<JSScriptable *>(JS_GetPrivate(cx, obj)));
  if (!object) {
    JSScriptable::js_throwNullCallException(JSJSGlobalObject::classDescriptor.name, JSJSGlobalObject::functionTable[4].name);
    return JS_FALSE;
  }
  // record context
  object->js_setCurrentContext(cx);
  // JSTimer *timer
  JSObject *p0;
  if (!JS_ValueToObject(cx, argv[0], &p0))
    return JS_FALSE;
  argv[0] = OBJECT_TO_JSVAL(p0);
  JSTimer *p0o = NULL;
  if (p0) {
    JSScriptable *pobj = reinterpret_cast<JSScriptable*>(JS_GetPrivate(cx, p0));
    if (!pobj) {
      object->js_throwNullParamException(0, JSJSGlobalObject::functionTable[4].name, JSJSGlobalObject::classDescriptor.name);
      return JS_FALSE;
    }
    p0o = static_cast<JSTimer *>(pobj->js_getInterface(JS_JSTimer_GUID));
    if (!p0o) {
      object->js_throwParamTypeException(0, JSJSTimer::classDescriptor.name, JSJSGlobalObject::functionTable[4].name, JSJSGlobalObject::classDescriptor.name);
      return JS_FALSE;
    }
  }
  // call method
  ASSERT(object != NULL);
  bool rv = object->isTimerValid(p0o);
  // handle return value
  *rval = BOOLEAN_TO_JSVAL(rv);
  // success
  return JS_TRUE;
}
Пример #2
0
JSBool JSJSGlobalObject::fromjs_shutdown(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
  // get instance
  JSGlobalObject *object = static_cast<JSGlobalObject *>(reinterpret_cast<JSScriptable *>(JS_GetPrivate(cx, obj)));
  if (!object) {
    JSScriptable::js_throwNullCallException(JSJSGlobalObject::classDescriptor.name, JSJSGlobalObject::functionTable[5].name);
    return JS_FALSE;
  }
  // record context
  object->js_setCurrentContext(cx);
  // call method
  ASSERT(object != NULL);
  object->shutdown();
  // success
  return JS_TRUE;
}
Пример #3
0
JSBool JSJSGlobalObject::fromjs_createTimer(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
  // get instance
  JSGlobalObject *object = static_cast<JSGlobalObject *>(reinterpret_cast<JSScriptable *>(JS_GetPrivate(cx, obj)));
  if (!object) {
    JSScriptable::js_throwNullCallException(JSJSGlobalObject::classDescriptor.name, JSJSGlobalObject::functionTable[2].name);
    return JS_FALSE;
  }
  // record context
  object->js_setCurrentContext(cx);
  // call method
  ASSERT(object != NULL);
  JSTimer * rv = object->createTimer();
  // handle return value
  if (!rv) *rval = JSVAL_VOID;
  else *rval = OBJECT_TO_JSVAL(rv->js_getJSObject(cx));
  // success
  return JS_TRUE;
}
Пример #4
0
JSBool JSJSGlobalObject::fromjs_alert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) {
  // get instance
  JSGlobalObject *object = static_cast<JSGlobalObject *>(reinterpret_cast<JSScriptable *>(JS_GetPrivate(cx, obj)));
  if (!object) {
    JSScriptable::js_throwNullCallException(JSJSGlobalObject::classDescriptor.name, JSJSGlobalObject::functionTable[1].name);
    return JS_FALSE;
  }
  // record context
  object->js_setCurrentContext(cx);
  // const char *str
  JSString * p0;
  p0 = JS_ValueToString(cx, argv[0]);
  argv[0] = STRING_TO_JSVAL(p0);
  const char *p0b = JS_GetStringBytes(p0);
  // call method
  ASSERT(object != NULL);
  object->alert(p0b);
  // success
  return JS_TRUE;
}