00001 /* 00002 * YaST2: Core system 00003 * 00004 * Description: 00005 * YaST2 execution environment, i.e. processing context. 00006 * Contains reference to the current block, the current statement, 00007 * the current file name and backtrace. 00008 * This information can be used for logging, debugger etc. 00009 * 00010 * Authors: 00011 * Stanislav Visnovsky <visnov@suse.cz> 00012 * 00013 */ 00014 00015 #ifndef _execution_environment_h 00016 #define _execution_environment_h 00017 00018 #include <stack> 00019 #include <string> 00020 00021 #include "ycp/YStatement.h" 00022 00023 using namespace std; 00024 00025 struct CallFrame; 00026 00035 class ExecutionEnvironment { 00036 private: 00037 int m_linenumber; 00038 string m_filename; 00039 bool m_forced_filename; 00040 YStatementPtr m_statement; 00041 stack<CallFrame*> m_backtrace; 00042 00043 public: 00044 ExecutionEnvironment () : m_forced_filename (false), m_statement(NULL) {}; 00045 ~ExecutionEnvironment() {}; 00046 00050 int linenumber () const; 00051 00055 void setLinenumber (int line); 00056 00060 const string filename () const; 00061 00065 void setFilename (const string & filename); 00066 00070 YStatementPtr statement () const; 00071 00075 void setStatement (YStatementPtr s); 00076 00083 void pushframe (string called_function); 00084 00088 void popframe (); 00089 00096 string backtrace (uint skip = 0); 00097 }; 00098 00099 #endif /* _execution_environment_h */