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,v 1.22 2001/11/16 23:03:24 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 
00025 class CLASSEXPORT skContext 
00026 {
00027  public:
00031   skContext(const skString& location):
00032     m_Location(location)
00033     {};
00035   skString m_Location; 
00037   int m_LineNum; 
00038 };
00039 
00047 class CLASSEXPORT skInterpreter : public skExecutable
00048 { 
00049  public:
00050   //------------------------
00051   // Parsing and Executing methods
00052   //------------------------
00053 
00063   skMethodDefNode * parseString(const skString& location,const skString& code); 
00074   skMethodDefNode * parseExternalParams(const skString& location,skStringList& paramNames,const skString& code);
00087   void executeString(const skString& location,skiExecutable * obj,const skString& code,skRValueArray&  args,skRValue& return_value,skMethodDefNode ** parseTree);
00088 
00101   void executeStringExternalParams(const skString& location,skiExecutable * obj,skStringList& paramNames,const skString& code,skRValueArray&  args,skRValue& r,skMethodDefNode ** keepParseTree);
00102 
00112   void executeParseTree(const skString& location,skiExecutable * obj,skMethodDefNode * parseTree,skRValueArray&  args,skRValue& return_value);
00113   //------------------------
00114   // Global Variable methods
00115   //------------------------
00116    
00122   void addGlobalVariable(const skString& name,skRValue value);
00127   void removeGlobalVariable(const skString& name);
00134   bool findGlobalVariable(const skString& name,skRValue& return_value);
00135 
00136   //--------------------------------------------------------
00137   // Interpreter is an Executable which exposes some fields
00138   //--------------------------------------------------------
00139     
00144   bool setValue(const skString& s,const skString& attribute,const skRValue& v);
00145     
00146   //---------------------------------
00147   // accessing the global interpreter
00148   //---------------------------------
00149 
00153   static skInterpreter * getInterpreter();
00157   static void setInterpreter(skInterpreter *);
00158     
00159   //------------------------
00160   // Tracing methods
00161   //------------------------
00162 
00166   void trace(const skString& msg);
00170   void setTraceCallback(skTraceCallback * callback);
00171 
00175   void setStatementStepper(skStatementStepper * stepper);
00176 
00178   void runtimeError(skContext& ctxt,const skString& msg); 
00179 
00180   //---------------------------
00181   // Constructor and Destructor
00182   //---------------------------
00183     
00187   skInterpreter();
00191   ~skInterpreter();
00192     
00194   class P_Interpreter * pimp;
00195   
00199   static skNull g_Null;
00200 
00201  private:
00202 
00203   //--------------------
00204   // copying not allowed
00205   //--------------------
00206 
00210   skInterpreter(const skInterpreter&);
00214   skInterpreter& operator=(const skInterpreter&);
00215 };      
00216 
00217 
00218 #endif
00219 
00220 

Generated on Tue Nov 20 17:56:21 2001 for Simkin by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001