KJS-API
Go to the documentation of this file.
24 #include "kjs/interpreter.h"
25 #include "kjs/completion.h"
26 #include "kjs/object.h"
27 #include "kjs/JSVariableObject.h"
43 void deref() {
if (--rc == 0)
delete this; }
47 : hnd(new KJSResultHandle())
75 return !hnd->errMsg.isNull();
91 Interpreter* ip =
new Interpreter();
100 assert(gv->isObject());
101 JSObject* go =
static_cast<JSObject*
>(gv);
102 assert(go->isGlobalObject());
103 Interpreter* ip =
new Interpreter(static_cast<JSGlobalObject*>(go));
105 assert(go->prototype()->isObject());
106 JSObject* p =
static_cast<JSObject*
>(go->prototype());
107 JSObject* objectProto = ip->builtinObjectPrototype();
108 p->setPrototype(objectProto);
125 if (otherIp != thisIp) {
164 int startingLineNumber,
170 JSValue* tv = thisValue ?
JSVALUE(thisValue) : 0;
171 KJS::Completion c = ip->evaluate(
toUString(sourceURL), startingLineNumber,
175 if (c.complType() == Throw) {
176 ExecState* exec = ip->globalExec();
179 JSObject* resObj = c.value()->toObject(exec);
180 CString message = resObj->toString(exec).UTF8String();
181 int line = resObj->toObject(exec)->get(exec,
"line")->toUInt32(exec);
183 if (!sourceURL.isEmpty())
184 fprintf(stderr,
"%s (line %d): ", qPrintable(sourceURL), line);
185 fprintf(stderr,
"%s\n", msg.c_str());
187 fprintf(stderr,
"evaluate() threw an exception\n");
188 res.hnd->errMsg = msg;
190 if (c.isValueCompletion())
200 return evaluate(
"<string>", 0, code, thisValue);
204 int* errLine, QString* errMsg)
208 UString codeOut, msg;
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Jul 16 2013 17:49:15 by
doxygen 1.8.1.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.