interpreter.h

来自「konqueror3 embedded版本, KDE环境下的当家浏览器的嵌入式版」· C头文件 代码 · 共 499 行 · 第 1/2 页

H
499
字号
     * @param code The code to evaluate     * @param thisV The value to pass in as the "this" value for the script     * execution. This should either be Null() or an Object.     * @return A completion object representing the result of the execution.     */    Completion evaluate(const UString &code, const Value &thisV = Value());    /**     * @internal     *     * Returns the implementation object associated with this interpreter.     * Only useful for internal KJS operations.     */    InterpreterImp *imp();    /**     * Returns the builtin "Object" object. This is the object that was set     * as a property of the global object during construction; if the property     * is replaced by script code, this method will still return the original     * object.     *     * @return The builtin "Object" object     */    Object builtinObject() const;    /**     * Returns the builtin "Function" object.     */    Object builtinFunction() const;    /**     * Returns the builtin "Array" object.     */    Object builtinArray() const;    /**     * Returns the builtin "Boolean" object.     */    Object builtinBoolean() const;    /**     * Returns the builtin "String" object.     */    Object builtinString() const;    /**     * Returns the builtin "Number" object.     */    Object builtinNumber() const;    /**     * Returns the builtin "Date" object.     */    Object builtinDate() const;    /**     * Returns the builtin "RegExp" object.     */    Object builtinRegExp() const;    /**     * Returns the builtin "Error" object.     */    Object builtinError() const;    /**     * Returns the builtin "Object.prototype" object.     */    Object builtinObjectPrototype() const;    /**     * Returns the builtin "Function.prototype" object.     */    Object builtinFunctionPrototype() const;    /**     * Returns the builtin "Array.prototype" object.     */    Object builtinArrayPrototype() const;    /**     * Returns the builtin "Boolean.prototype" object.     */    Object builtinBooleanPrototype() const;    /**     * Returns the builtin "String.prototype" object.     */    Object builtinStringPrototype() const;    /**     * Returns the builtin "Number.prototype" object.     */    Object builtinNumberPrototype() const;    /**     * Returns the builtin "Date.prototype" object.     */    Object builtinDatePrototype() const;    /**     * Returns the builtin "RegExp.prototype" object.     */    Object builtinRegExpPrototype() const;    /**     * Returns the builtin "Error.prototype" object.     */    Object builtinErrorPrototype() const;    /**     * The initial value of "Error" global property     */    Object builtinEvalError() const;    Object builtinRangeError() const;    Object builtinReferenceError() const;    Object builtinSyntaxError() const;    Object builtinTypeError() const;    Object builtinURIError() const;    Object builtinEvalErrorPrototype() const;    Object builtinRangeErrorPrototype() const;    Object builtinReferenceErrorPrototype() const;    Object builtinSyntaxErrorPrototype() const;    Object builtinTypeErrorPrototype() const;    Object builtinURIErrorPrototype() const;    enum CompatMode { NativeMode, IECompat, NetscapeCompat };    /**     * Call this to enable a compatibility mode with another browser.     * (by default konqueror is in "native mode").     * Currently, in KJS, this only changes the behavior of Date::getYear()     * which returns the full year under IE.     */    void setCompatMode(CompatMode mode);    CompatMode compatMode() const;    /**     * Run the garbage collection. Returns true when at least one object     * was collected; false otherwise.     */    static bool collect();    /**     * Called by InterpreterImp during the mark phase of the garbage collector     * Default implementation does nothing, this exist for classes that reimplement Interpreter.     */    virtual void mark() {}    /**     * Provides a way to distinguish derived classes.     * Only useful if you reimplement Interpreter and if different kind of     * interpreters are created in the same process.     * The base class returns 0, the ECMA-bindings interpreter returns 1.     */    virtual int rtti() { return 0; }#ifdef KJS_DEBUG_MEM    /**     * @internal     */    static void finalCheck();#endif  private:    InterpreterImp *rep;    /**     * This constructor is not implemented, in order to prevent     * copy-construction of Interpreter objects. You should always pass around     * pointers to an interpreter instance instead.     */    Interpreter(const Interpreter&);    /**     * This constructor is not implemented, in order to prevent assignment of     * Interpreter objects. You should always pass around pointers to an     * interpreter instance instead.     */    Interpreter operator=(const Interpreter&);  protected:    virtual void virtual_hook( int id, void* data );  };  /**   * Represents the current state of script execution. This object allows you   * obtain a handle the interpreter that is currently executing the script,   * and also the current execution state context.   */  class KJS_EXPORT ExecState {    friend class InterpreterImp;    friend class FunctionImp;    friend class GlobalFuncImp;    friend class TryNode;    friend class VarDeclNode;    friend class FuncDeclNode;  public:    /**     * Returns the interpreter associated with this execution state     *     * @return The interpreter executing the script     */    // ### make non-const or provide an overload pair    Interpreter *dynamicInterpreter() const { return _interpreter; }    // for compatibility    Interpreter *interpreter() const { return dynamicInterpreter(); }    /**     * Returns the interpreter associated with the current scope's     * global object     *     * @return The interpreter currently in scope     */    Interpreter *lexicalInterpreter() const;    /**     * Returns the execution context associated with this execution state     *     * @return The current execution state context     */    Context context() const { return _context; }    void setException(const Value &e);    void clearException();    Value exception() const { return _exception; }    // ### make const    bool hadException();    /*     * request for ending execution with an exception     */    static void requestTerminate() { terminate_request = true; }    /*     * optional confirmation for ending execution after requestTerminate()     */    static bool (*confirmTerminate)();  private:    ExecState(Interpreter *interp, ContextImp *con)        : _interpreter(interp), _context(con) { }    Interpreter *_interpreter;    ContextImp *_context;    Value _exception;    static bool terminate_request;  };} // namespace#endif // _KJS_INTERPRETER_H_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?