yast2-core
ExecutionEnvironment.h
Go to the documentation of this file.
1 /*
2  * YaST2: Core system
3  *
4  * Description:
5  * YaST2 execution environment, i.e. processing context.
6  * Contains reference to the current block, the current statement,
7  * the current file name and backtrace.
8  * This information can be used for logging, debugger etc.
9  *
10  * Authors:
11  * Stanislav Visnovsky <visnov@suse.cz>
12  *
13  */
14 
15 #ifndef _execution_environment_h
16 #define _execution_environment_h
17 
18 #include <stack>
19 #include <string>
20 
21 #include "y2log.h"
22 #include "ycp/YStatement.h"
23 #include "ycp/YExpression.h"
24 
25 #include <ycp/YCPValue.h>
26 
27 using namespace std;
28 
29 namespace YaST
30 {
31 
33 struct CallFrame {
34  YECallPtr function;
35  string filename;
38 
39  CallFrame(const string& f, int l, YECallPtr func, YCPValue* p)
40  : function(func), filename(f), linenumber(l), params(p)
41  {
42  }
43 };
44 
54 
55 public:
56  typedef vector<const CallFrame*> CallStack;
57 
58 private:
60  string m_filename;
62  YStatementPtr m_statement;
63  CallStack m_backtrace;
70 
71 public:
74 
78  int linenumber () const;
79 
83  void setLinenumber (int line);
84 
88  const string& filename() const;
89 
93  void setFilename (const string & filename);
94 
98  YStatementPtr statement () const;
99 
103  void setStatement (YStatementPtr s);
104 
108  bool endlessRecursion ();
109 
116  void pushframe (YECallPtr called_function, YCPValue params[]);
117 
121  void popframe ();
122 
129  void backtrace (loglevel_t level, uint skip = 0) const;
130 
137  CallStack callstack() const;
138 };
139 
140 
141  extern ExecutionEnvironment ee;
142 }
143 
144 #endif /* _execution_environment_h */
string filename
Definition: ExecutionEnvironment.h:35
int m_linenumber
Definition: ExecutionEnvironment.h:59
~ExecutionEnvironment()
Definition: ExecutionEnvironment.h:73
vector< const CallFrame * > CallStack
Definition: ExecutionEnvironment.h:56
YCPValue * params
Definition: ExecutionEnvironment.h:37
STL namespace.
size_t m_recursion_limit
Definition: ExecutionEnvironment.h:69
loglevel_t
Definition: liby2util-r/src/include/y2util/y2log.h:23
Definition: ExecutionEnvironment.h:53
Definition: quotes.cc:39
int linenumber
Definition: ExecutionEnvironment.h:36
CallFrame(const string &f, int l, YECallPtr func, YCPValue *p)
Definition: ExecutionEnvironment.h:39
YStatementPtr m_statement
Definition: ExecutionEnvironment.h:62
ExecutionEnvironment ee
Definition: ExecutionEnvironment.cc:29
string m_filename
Definition: ExecutionEnvironment.h:60
Wrapper for YCPValueRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPValueRep with the arrow operator. See YCPValueRep.
Definition: YCPValue.h:275
Function and source location, for backtraces.
Definition: ExecutionEnvironment.h:33
CallStack m_backtrace
Definition: ExecutionEnvironment.h:63
bool m_forced_filename
Definition: ExecutionEnvironment.h:61

Generated on a sunny day for yast2-core by doxygen 1.8.8