KJS Namespace Reference


Classes

class  ArrayInstanceImp
class  ArrayPrototypeImp
class  ArrayProtoFuncImp
class  ArrayObjectImp
class  BooleanInstanceImp
class  BooleanPrototypeImp
class  BooleanProtoFuncImp
class  BooleanObjectImp
class  Collector
 Garbage collector. More...
class  Completion
 Completion objects are used to convey the return status and value from functions.Handle for a Completion type. More...
class  ContextImp
 Execution context. More...
class  DateInstanceImp
class  DatePrototypeImp
class  DateProtoFuncImp
class  DateObjectImp
class  DateObjectFuncImp
class  Debugger
class  ErrorInstanceImp
class  ErrorPrototypeImp
class  ErrorProtoFuncImp
class  ErrorObjectImp
class  NativeErrorPrototypeImp
class  NativeErrorImp
class  InternalFunctionImp
 Base class for all function objects. More...
class  FunctionPrototypeImp
 The initial value of Function.prototype (and thus all objects created with the Function constructor). More...
class  FunctionProtoFuncImp
class  FunctionObjectImp
class  Identifier
 Represents an Identifier for a Javascript object. More...
class  UndefinedImp
class  NullImp
class  BooleanImp
class  StringImp
class  NumberImp
class  LabelStack
 The "label set" in Ecma-262 spec. More...
class  SourceCode
class  Parser
class  InterpreterImp
class  DebuggerImp
class  FunctionImp
 Implementation class for functions implemented in JS. More...
class  DeclaredFunctionImp
class  ArgumentsImp
class  ActivationImp
class  GlobalFuncImp
class  Context
 Represents an execution context, as specified by section 10 of the ECMA spec. More...
class  Interpreter
 Interpreter objects can be used to evaluate ECMAScript code. More...
class  ExecState
 Represents the current state of script execution. More...
class  Lexer
struct  ListImpBase
class  List
 Native list type. More...
class  ListIterator
 Iterator for KJS::List objects. More...
struct  HashEntry
 An entry in a hash table. More...
struct  HashTable
 A hash table Usually the hashtable is generated by the create_hash_table script, from a .table file. More...
class  Lookup
 Fast keyword lookup. More...
class  MathObjectImp
class  MathFuncImp
class  Node
class  StatementNode
class  NullNode
class  BooleanNode
class  NumberNode
class  StringNode
class  RegExpNode
class  ThisNode
class  ResolveNode
class  GroupNode
class  ElementNode
class  ArrayNode
class  PropertyValueNode
class  PropertyNode
class  ObjectLiteralNode
class  AccessorNode1
class  AccessorNode2
class  ArgumentListNode
class  ArgumentsNode
class  NewExprNode
class  FunctionCallNode
class  PostfixNode
class  DeleteNode
class  VoidNode
class  TypeOfNode
class  PrefixNode
class  UnaryPlusNode
class  NegateNode
class  BitwiseNotNode
class  LogicalNotNode
class  MultNode
class  AddNode
class  AppendStringNode
class  ShiftNode
class  RelationalNode
class  EqualNode
class  BitOperNode
class  BinaryLogicalNode
 expr1 && expr2, expr1 || expr2 More...
class  ConditionalNode
 The ternary operator, "logical ? expr1 : expr2". More...
class  AssignNode
class  CommaNode
class  StatListNode
class  AssignExprNode
class  VarDeclNode
class  VarDeclListNode
class  VarStatementNode
class  BlockNode
class  EmptyStatementNode
class  ExprStatementNode
class  IfNode
class  DoWhileNode
class  WhileNode
class  ForNode
class  ForInNode
class  ContinueNode
class  BreakNode
class  ReturnNode
class  WithNode
class  CaseClauseNode
class  ClauseListNode
class  CaseBlockNode
class  SwitchNode
class  LabelNode
class  ThrowNode
class  CatchNode
class  FinallyNode
class  TryNode
class  ParameterNode
class  FunctionBodyNode
class  FuncDeclNode
class  FuncExprNode
class  SourceElementsNode
class  NumberInstanceImp
class  NumberPrototypeImp
class  NumberProtoFuncImp
class  NumberObjectImp
struct  ClassInfo
 Class Information. More...
class  Object
 Represents an Object. More...
class  ObjectImp
class  Error
 Factory methods for error objects. More...
class  ObjectPrototypeImp
class  ObjectProtoFuncImp
class  ObjectObjectImp
class  SavedProperties
 Saved Properties. More...
struct  PropertyMapHashTableEntry
 A hashtable entry for the PropertyMap. More...
class  PropertyMap
 Javascript Property Map. More...
class  Reference
 Defines a Javascript reference. More...
class  ReferenceListIterator
 An iterator for a ReferenceList. More...
class  ReferenceList
 A list of Reference objects. More...
class  RegExp
class  RegExpPrototypeImp
class  RegExpProtoFuncImp
class  RegExpImp
class  RegExpObjectImp
class  ScopeChainNode
 A scope chain node. More...
class  ScopeChain
 A scope chain object. More...
class  SimpleNumber
class  StringInstanceImp
class  StringPrototypeImp
class  StringProtoFuncImp
class  StringObjectImp
class  StringObjectFuncImp
struct  UChar
 Unicode character. More...
class  UCharReference
 Dynamic reference to a string character. More...
class  CString
 8 bit char based string class More...
class  UString
 Unicode string class. More...
class  ValueImp
 ValueImp is the base type for all primitives (Undefined, Null, Boolean, String, Number) and objects in ECMAScript. More...
class  Value
 Value objects are act as wrappers ("smart pointers") around ValueImp objects and their descendents. More...
class  Undefined
 Represents an primitive Undefined value. More...
class  Null
 Represents an primitive Null value. More...
class  Boolean
 Represents an primitive Boolean value. More...
class  String
 Represents an primitive String value. More...
class  Number
 Represents an primitive Number value. More...

Enumerations

enum  ComplType {
  Normal, Break, Continue, ReturnValue,
  Throw
}
enum  CodeType { GlobalCode = 0, EvalCode = 1, FunctionCode = 2 }
enum  ListImpState { unusedInPool = 0, usedInPool, usedOnHeap, immortal }
enum  Operator {
  OpEqual, OpEqEq, OpNotEq, OpStrEq,
  OpStrNEq, OpPlusEq, OpMinusEq, OpMultEq,
  OpDivEq, OpPlusPlus, OpMinusMinus, OpLess,
  OpLessEq, OpGreater, OpGreaterEq, OpAndEq,
  OpXOrEq, OpOrEq, OpModEq, OpAnd,
  OpOr, OpBitAnd, OpBitXOr, OpBitOr,
  OpLShift, OpRShift, OpURShift, OpIn,
  OpInstanceOf
}
enum  Attribute {
  None = 0, ReadOnly = 1 << 1, DontEnum = 1 << 2, DontDelete = 1 << 3,
  Internal = 1 << 4, Function = 1 << 5
}
enum  ErrorType {
  GeneralError = 0, EvalError = 1, RangeError = 2, ReferenceError = 3,
  SyntaxError = 4, TypeError = 5, URIError = 6
}
enum  Type {
  UnspecifiedType = 0, UndefinedType = 1, NullType = 2, BooleanType = 3,
  StringType = 4, NumberType = 5, ObjectType = 6
}

Functions

double parseDate (const UString &u)
double makeTime (struct tm *t, double ms, bool utc)
double KRFCDate_parseDate (const UString &_date)
double timeClip (double t)
bool operator== (const Identifier &a, const Identifier &b)
bool operator!= (const Identifier &a, const Identifier &b)
bool operator== (const Identifier &a, const char *b)
double roundValue (ExecState *exec, const Value &v)
void printInfo (ExecState *exec, const char *s, const Value &o, int lineno)
bool operator== (const Context &c1, const Context &c2)
bool operator!= (const Context &c1, const Context &c2)
static ListImp * allocateListImp ()
static void deallocateListImp (ListImp *imp)
template<class FuncImp>
Value lookupOrCreateFunction (ExecState *exec, const Identifier &propertyName, const ObjectImp *thisObj, int token, int params, int attr)
template<class FuncImp, class ThisImp, class ParentImp>
Value lookupGet (ExecState *exec, const Identifier &propertyName, const HashTable *table, const ThisImp *thisObj)
template<class FuncImp, class ParentImp>
Value lookupGetFunction (ExecState *exec, const Identifier &propertyName, const HashTable *table, const ObjectImp *thisObj)
template<class ThisImp, class ParentImp>
Value lookupGetValue (ExecState *exec, const Identifier &propertyName, const HashTable *table, const ThisImp *thisObj)
template<class ThisImp, class ParentImp>
void lookupPut (ExecState *exec, const Identifier &propertyName, const Value &value, int attr, const HashTable *table, ThisImp *thisObj)
template<class ClassCtor>
KJS::Object cacheGlobalObject (ExecState *exec, const Identifier &propertyName)
bool isNaN (double d)
bool isInf (double d)
bool isPosInf (double d)
bool isNegInf (double d)
bool equal (ExecState *exec, const Value &v1, const Value &v2)
bool strictEqual (ExecState *exec, const Value &v1, const Value &v2)
int relation (ExecState *exec, const Value &v1, const Value &v2)
int maxInt (int d1, int d2)
int minInt (int d1, int d2)
Value add (ExecState *exec, const Value &v1, const Value &v2, char oper)
Value mult (ExecState *exec, const Value &v1, const Value &v2, char oper)
bool operator== (const KJS::CString &c1, const KJS::CString &c2)
bool operator== (const UString &s1, const UString &s2)
bool operator== (const UString &s1, const char *s2)
bool operator< (const UString &s1, const UString &s2)
int compare (const UString &s1, const UString &s2)
KJS_EXPORT bool operator== (const UChar &c1, const UChar &c2)
KJS_EXPORT bool operator!= (const UChar &c1, const UChar &c2)
bool operator!= (const UString &s1, const UString &s2)
KJS_EXPORT bool operator!= (const UString &s1, const char *s2)
KJS_EXPORT bool operator== (const char *s1, const UString &s2)
KJS_EXPORT bool operator!= (const char *s1, const UString &s2)
KJS_EXPORT bool operator!= (const CString &s1, const CString &s2)
KJS_EXPORT UString operator+ (const UString &s1, const UString &s2)

Variables

static const char arrayTableStrings []
static struct HashEntry arrayTableEntries []
HashTable arrayTable = { 2, 17, arrayTableEntries, 17, arrayTableStrings}
const int MINIMUM_CELL_SIZE = 56
const int BLOCK_SIZE = (8 * 4096)
const int SPARE_EMPTY_BLOCKS = 2
const int MIN_ARRAY_SIZE = 14
const int GROWTH_FACTOR = 2
const int LOW_WATER_FACTOR = 4
const int ALLOCATIONS_PER_COLLECTION = 1000
const int CELL_ARRAY_LENGTH = (MINIMUM_CELL_SIZE / sizeof(double)) + (MINIMUM_CELL_SIZE % sizeof(double) != 0 ? sizeof(double) : 0)
const int CELL_SIZE = CELL_ARRAY_LENGTH * sizeof(double)
const int CELLS_PER_BLOCK = ((BLOCK_SIZE * 8 - sizeof(int) * 8 - sizeof(void *) * 8) / (CELL_SIZE * 8))
static CollectorHeap heap = {NULL, 0, 0, 0, NULL, 0, 0, 0, 0}
static const char dateTableStrings []
static struct HashEntry dateTableEntries []
HashTable dateTable = { 2, 71, dateTableEntries, 61, dateTableStrings}
const Identifier argumentsPropertyName ("arguments")
const Identifier calleePropertyName ("callee")
const Identifier callerPropertyName ("caller")
const Identifier constructorPropertyName ("constructor")
const Identifier lengthPropertyName ("length")
const Identifier messagePropertyName ("message")
const Identifier namePropertyName ("name")
const Identifier prototypePropertyName ("prototype")
const Identifier specialPrototypePropertyName ("__proto__")
const Identifier toLocaleStringPropertyName ("toLocaleString")
const Identifier toStringPropertyName ("toString")
const Identifier valueOfPropertyName ("valueOf")
static const int _minTableSize = 64
KJS_EXPORT const Identifier argumentsPropertyName
KJS_EXPORT const Identifier calleePropertyName
KJS_EXPORT const Identifier callerPropertyName
KJS_EXPORT const Identifier constructorPropertyName
KJS_EXPORT const Identifier lengthPropertyName
KJS_EXPORT const Identifier messagePropertyName
KJS_EXPORT const Identifier namePropertyName
KJS_EXPORT const Identifier prototypePropertyName
KJS_EXPORT const Identifier specialPrototypePropertyName
KJS_EXPORT const Identifier toLocaleStringPropertyName
KJS_EXPORT const Identifier toStringPropertyName
KJS_EXPORT const Identifier valueOfPropertyName
static const kjs_double_t NaN_Bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } }
static const kjs_double_t Inf_Bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }
const double NaN = NaN_Bytes.d
const double Inf = Inf_Bytes.d
static const double D16 = 65536.0
static const double D32 = 4294967296.0
static const char mainTableStrings []
static struct HashEntry mainTableEntries []
HashTable mainTable = { 2, 50, mainTableEntries, 44, mainTableStrings}
const int poolSize = 32
const int inlineValuesSize = 4
const int poolSizeMask = poolSize - 1
static ListImp pool [poolSize]
static int poolCursor
static const char mathTableStrings []
static struct HashEntry mathTableEntries []
HashTable mathTable = { 2, 34, mathTableEntries, 31, mathTableStrings}
static const char numberTableStrings []
static struct HashEntry numberTableEntries []
HashTable numberTable = { 2, 6, numberTableEntries, 5, numberTableStrings}
static const char stringTableStrings []
static struct HashEntry stringTableEntries []
HashTable stringTable = { 2, 38, stringTableEntries, 28, stringTableStrings}
const double NaN
const double Inf
KJS_EXPORT KJS::UChar KJS_PACKED
const double NaN
const double Inf

Enumeration Type Documentation

Attributes (only applicable to the Object type).

See ECMA 262-3 8.6.1

Enumerator:
ReadOnly  property can be only read, not written
DontEnum  property doesn't appear in (for .. in ..)
DontDelete  property can't be deleted
Internal  an internal property, set to by pass checks

Definition at line 49 of file object.h.

The three different types of code that can be executed in a Context.

These are:

  • GlobalCode - code executed as a result of a call to Interpreter::evaluate().
  • EvalCode - executed by a call to the builtin eval() function
  • FunctionCode - inside a function call (ECMAScript functions only; does not include builtin native functions or funcitons supplied by the host environment

Definition at line 49 of file interpreter.h.

Completion types.

Definition at line 36 of file completion.h.

Types of Native Errors available.

For custom errors, GeneralError should be used.

Definition at line 616 of file object.h.

enum KJS::Type

Primitive types.

Definition at line 61 of file value.h.


Function Documentation

Value KJS::add ( ExecState exec,
const Value v1,
const Value v2,
char  oper 
)

Additive operator.

Either performs an addition or substraction of v1 and v2.

Parameters:
exec execution state.
v1 First operand.
v2 Second operand.
oper '+' or '-' for an addition or substraction, respectively.
Returns:
The result of the operation.

Definition at line 226 of file operations.cpp.

template<class ClassCtor>
KJS::Object KJS::cacheGlobalObject ( ExecState *  exec,
const Identifier &  propertyName 
) [inline]

This template method retrieves or create an object that is unique (for a given interpreter) The first time this is called (for a given property name), the Object will be constructed, and set as a property of the interpreter's global object.

Later calls will simply retrieve that cached object. Note that the object constructor must take 1 argument, exec.

Definition at line 261 of file lookup.h.

bool KJS::isInf ( double  d  ) 

Returns:
True if d is infinite (platform support required).

Definition at line 67 of file operations.cpp.

bool KJS::isNaN ( double  d  ) 

Returns:
True if d is not a number (platform support required).

Definition at line 56 of file operations.cpp.

template<class FuncImp, class ThisImp, class ParentImp>
Value KJS::lookupGet ( ExecState *  exec,
const Identifier &  propertyName,
const HashTable *  table,
const ThisImp *  thisObj 
) [inline]

Helper method for property lookups.

This method does it all (looking in the hashtable, checking for function overrides, creating the function or retrieving from cache, calling getValueProperty in case of a non-function property, forwarding to parent if unknown property).

Template arguments:

  • FuncImp the class which implements this object's functions
  • ThisImp the class of "this". It must implement the getValueProperty(exec,token) method, for non-function properties.
  • ParentImp the class of the parent, to propagate the lookup.

Method arguments:

Parameters:
exec execution state, as usual
propertyName the property we're looking for
table the static hashtable for this class
thisObj "this"

Definition at line 175 of file lookup.h.

template<class FuncImp, class ParentImp>
Value KJS::lookupGetFunction ( ExecState *  exec,
const Identifier &  propertyName,
const HashTable *  table,
const ObjectImp *  thisObj 
) [inline]

Simplified version of lookupGet in case there are only functions.

Using this instead of lookupGet prevents 'this' from implementing a dummy getValueProperty.

Definition at line 194 of file lookup.h.

template<class ThisImp, class ParentImp>
Value KJS::lookupGetValue ( ExecState *  exec,
const Identifier &  propertyName,
const HashTable *  table,
const ThisImp *  thisObj 
) [inline]

Simplified version of lookupGet in case there are no functions, only "values".

Using this instead of lookupGet removes the need for a FuncImp class.

Definition at line 214 of file lookup.h.

template<class ThisImp, class ParentImp>
void KJS::lookupPut ( ExecState *  exec,
const Identifier &  propertyName,
const Value &  value,
int  attr,
const HashTable *  table,
ThisImp *  thisObj 
) [inline]

This one is for "put".

Lookup hash entry for property to be set, and set the value.

Definition at line 232 of file lookup.h.

Value KJS::mult ( ExecState exec,
const Value v1,
const Value v2,
char  oper 
)

Multiplicative operator.

Either multiplies/divides v1 and v2 or calculates the remainder from an division.

Parameters:
exec execution state.
v1 First operand.
v2 Second operand.
oper '*', '/' or '' for a multiplication, division or modulo operation.
Returns:
The result of the operation.

Definition at line 250 of file operations.cpp.

int KJS::relation ( ExecState exec,
const Value v1,
const Value v2 
)

This operator performs an abstract relational comparison of the two arguments that can be of arbitrary type.

If possible, conversions to the string or number type will take place before the comparison.

Returns:
1 if v1 is "less-than" v2, 0 if the relation is "greater-than-or- equal". -1 if the result is undefined.

Definition at line 189 of file operations.cpp.


Variable Documentation

struct HashEntry KJS::arrayTableEntries[] [static]

Initial value:

 {
   { 0, 0, 0, 0, -1 },
   { 55, ArrayProtoFuncImp::Slice, DontEnum|Function, 2, -1 },
   { 0, 0, 0, 0, -1 },
   { 41, ArrayProtoFuncImp::Concat, DontEnum|Function, 1, -1 },
   { 33, ArrayProtoFuncImp::UnShift, DontEnum|Function, 1, -1 },
   { 1, ArrayProtoFuncImp::ToLocaleString, DontEnum|Function, 0, -1 },
   { 66, ArrayProtoFuncImp::Push, DontEnum|Function, 1, -1 },
   { 61, ArrayProtoFuncImp::Join, DontEnum|Function, 1, -1 },
   { 16, ArrayProtoFuncImp::ToString, DontEnum|Function, 0, -1 },
   { 0, 0, 0, 0, -1 },
   { 0, 0, 0, 0, -1 },
   { 48, ArrayProtoFuncImp::Splice, DontEnum|Function, 2, -1 },
   { 76, ArrayProtoFuncImp::Pop, DontEnum|Function, 0, -1 },
   { 0, 0, 0, 0, -1 },
   { 71, ArrayProtoFuncImp::Sort, DontEnum|Function, 1, -1 },
   { 35, ArrayProtoFuncImp::Shift, DontEnum|Function, 0, -1 },
   { 25, ArrayProtoFuncImp::Reverse, DontEnum|Function, 0, -1 }
}

Definition at line 25 of file array_object.lut.h.

const char KJS::arrayTableStrings[] [static]

Initial value:

 {
    "\0"
    "toLocaleString\0"
    "toString\0"
    "reverse\0"
    "unshift\0"
    "concat\0"
    "splice\0"
    "slice\0"
    "join\0"
    "push\0"
    "sort\0"
    "pop\0"
}

Definition at line 9 of file array_object.lut.h.

struct KJS_EXPORT KJS::UChar KJS::KJS_PACKED

Unicode character.

UChar represents a 16 bit Unicode character. It's internal data representation is compatible to XChar2b and QChar. It's therefore possible to exchange data with X and Qt with shallow copies.

const char KJS::mathTableStrings[] [static]

Initial value:

 {
    "\0"
    "SQRT1_2\0"
    "LOG10E\0"
    "random\0"
    "LOG2E\0"
    "SQRT2\0"
    "atan2\0"
    "floor\0"
    "round\0"
    "LN10\0"
    "acos\0"
    "asin\0"
    "atan\0"
    "ceil\0"
    "sqrt\0"
    "LN2\0"
    "abs\0"
    "exp\0"
    "log\0"
    "max\0"
    "min\0"
    "pow\0"
    "PI\0"
}

Definition at line 9 of file math_object.lut.h.

Initial value:

 {
   { 19, NumberObjectImp::PosInfinity, DontEnum|DontDelete|ReadOnly, 0, -1 },
   { 37, NumberObjectImp::MaxValue, DontEnum|DontDelete|ReadOnly, 0, -1 },
   { 0, 0, 0, 0, -1 },
   { 57, NumberObjectImp::NaNValue, DontEnum|DontDelete|ReadOnly, 0, 5 },
   { 47, NumberObjectImp::MinValue, DontEnum|DontDelete|ReadOnly, 0, -1 },
   { 1, NumberObjectImp::NegInfinity, DontEnum|DontDelete|ReadOnly, 0, -1 }
}

Definition at line 19 of file number_object.lut.h.

const char KJS::numberTableStrings[] [static]

Initial value:

 {
    "\0"
    "NEGATIVE_INFINITY\0"
    "POSITIVE_INFINITY\0"
    "MAX_VALUE\0"
    "MIN_VALUE\0"
    "NaN\0"
}

Definition at line 9 of file number_object.lut.h.

KDE Home | KDE Accessibility Home | Description of Access Keys