Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skInterpreter.h

00001 /*
00002   Copyright 1996-2001
00003   Simon Whiteside
00004 
00005 * $Id: skInterpreter_h-source.html,v 1.19 2001/11/05 19:22:33 sdw Exp $
00006 */
00007 #ifndef skINTERPRETER_H
00008 #define skINTERPRETER_H
00009 
00010 #include "skRValue.h"
00011 #include "skiExecutable.h"
00012 #include "skNull.h"
00013 
00014 class CLASSEXPORT skRValueArray;
00015 class CLASSEXPORT skParseNode;
00016 class CLASSEXPORT skStringList;
00017 class CLASSEXPORT skMethodDefNode;
00018 class CLASSEXPORT skTraceCallback;
00019 class CLASSEXPORT skStatementStepper;
00020 
00028 class CLASSEXPORT skInterpreter : public skExecutable
00029 { 
00030  public:
00031   //------------------------
00032   // Parsing and Executing methods
00033   //------------------------
00034 
00044   skMethodDefNode * parseString(const skString& location,const skString& code); 
00055   skMethodDefNode * parseExternalParams(const skString& location,skStringList& paramNames,const skString& code);
00068   void executeString(const skString& location,skiExecutable * obj,const skString& code,skRValueArray&  args,skRValue& return_value,skMethodDefNode ** parseTree);
00069 
00082   void executeStringExternalParams(const skString& location,skiExecutable * obj,skStringList& paramNames,const skString& code,skRValueArray&  args,skRValue& r,skMethodDefNode ** keepParseTree);
00083 
00093   void executeParseTree(const skString& location,skiExecutable * obj,skMethodDefNode * parseTree,skRValueArray&  args,skRValue& return_value);
00094   //------------------------
00095   // Global Variable methods
00096   //------------------------
00097    
00103   void addGlobalVariable(const skString& name,skRValue value);
00108   void removeGlobalVariable(const skString& name);
00115   bool findGlobalVariable(const skString& name,skRValue& return_value);
00116 
00117   //--------------------------------------------------------
00118   // Interpreter is an Executable which exposes some fields
00119   //--------------------------------------------------------
00120     
00125   bool setValue(const skString& s,const skString& attribute,const skRValue& v);
00126     
00127   //---------------------------------
00128   // accessing the global interpreter
00129   //---------------------------------
00130 
00134   static skInterpreter * getInterpreter();
00138   static void setInterpreter(skInterpreter *);
00139     
00140   //------------------------
00141   // Tracing methods
00142   //------------------------
00143 
00147   void trace(const skString& msg);
00151   void setTraceCallback(skTraceCallback * callback);
00152 
00156   void setStatementStepper(skStatementStepper * stepper);
00157 
00159   void runtimeError(const skString& msg); 
00160 
00161   //---------------------------
00162   // Constructor and Destructor
00163   //---------------------------
00164     
00168   skInterpreter();
00172   ~skInterpreter();
00173     
00174   class P_Interpreter * pimp;
00175 
00179   static skNull g_Null;
00180 
00181  private:
00182 
00183   //--------------------
00184   // copying not allowed
00185   //--------------------
00186 
00190   skInterpreter(const skInterpreter&);
00194   skInterpreter& operator=(const skInterpreter&);
00195 };      
00196 
00197 
00198 #endif
00199 
00200 

Generated at Mon Nov 5 19:22:25 2001 for Simkin by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000