kjs Library API Documentation

context.h

00001 // -*- c-basic-offset: 2 -*- 00002 /* 00003 * This file is part of the KDE libraries 00004 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 00005 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 00006 * Copyright (C) 2003 Apple Computer, Inc. 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public License 00019 * along with this library; see the file COPYING.LIB. If not, write to 00020 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00021 * Boston, MA 02111-1307, USA. 00022 * 00023 */ 00024 00025 #ifndef KJS_CONTEXT_H 00026 #define KJS_CONTEXT_H 00027 00028 #include "function.h" 00029 00030 namespace KJS { 00031 00035 class ContextImp { 00036 friend class Context; 00037 friend class StatementNode; 00038 public: 00039 // TODO: remove glob parameter. deducable from exec. 00040 ContextImp(Object &glob, InterpreterImp *interpreter, Object &thisV, int _sourceId, CodeType type = GlobalCode, 00041 ContextImp *callingContext = 0L, FunctionImp *func = 0L, const List *args = 0); 00042 virtual ~ContextImp(); 00043 00044 const ScopeChain &scopeChain() const { return scope; } 00045 Object variableObject() const { return variable; } 00046 void setVariableObject(const Object &v) { variable = v; } 00047 Object thisValue() const { return thisVal; } 00048 ContextImp *callingContext() { return _callingContext; } 00049 ObjectImp *activationObject() { return activation.imp(); } 00050 FunctionImp *function() const { return _function; } 00051 const List *arguments() const { return _arguments; } 00052 00053 void pushScope(const Object &s) { scope.push(s.imp()); } 00054 void popScope() { scope.pop(); } 00055 LabelStack *seenLabels() { return &ls; } 00056 00057 void mark(); 00058 00059 void pushTryCatch() { tryCatch++; }; 00060 void popTryCatch() { tryCatch--; }; 00061 bool inTryCatch() const; 00062 00063 void setLines(int l0, int l1) { line0 = l0; line1 = l1; } 00064 00065 CodeType type() const { return codeType; } 00066 00067 private: 00068 InterpreterImp *_interpreter; 00069 ContextImp *_callingContext; 00070 FunctionImp *_function; 00071 const List *_arguments; 00072 Object activation; 00073 00074 ScopeChain scope; 00075 Object variable; 00076 Object thisVal; 00077 00078 LabelStack ls; 00079 CodeType codeType; 00080 00081 int tryCatch; 00082 int sourceId; 00083 int line0; 00084 int line1; 00085 Identifier functionName; 00086 List args; 00087 }; 00088 00089 } // namespace KJS 00090 00091 #endif
KDE Logo
This file is part of the documentation for kjs Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 16 17:22:13 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003