ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/selection/SelectionEvaluator.hpp
(Generate patch)

Comparing trunk/OOPSE-3.0/src/selection/SelectionEvaluator.hpp (file contents):
Revision 1961 by tim, Tue Feb 1 06:55:00 2005 UTC vs.
Revision 1962 by tim, Tue Feb 1 22:49:23 2005 UTC

# Line 53 | Line 53 | namespace oopse {
53  
54   namespace oopse {
55  
56 + class Context {
57 +    std::string filename;
58 +    std::tring script;
59 +    std::vector<int> linenumbers;
60 +    std::vector<int> lineIndices;
61 +    std::vector<std::vector<Token> > aatoken;
62 +    int pc;
63 + }
64 +
65   /**
66   * @class SelectionEvaluator SelectionEvaluator.hpp "selection/SelectionEvaluator"
67   * @brief Evalute the tokens compiled by SelectionCompiler and return a BitSet
# Line 62 | Line 71 | class SelectionEvaluator{
71  
72          SelectionEvaluator(SimInfo* info, const std::string& script);
73  
74 +
75          BitSet evaluate();
76          
77          BitSet evaluate(int frameNo);
# Line 71 | Line 81 | class SelectionEvaluator{
81           * @return true if the result keeps the same even the frame change, otherwise return false
82           */        
83          bool isStatic();
84 <        
84 >
85 >        bool hadRuntimeError() const{
86 >            return error;
87 >        }
88 >
89 >        std::string getErrorMessage() const {
90 >            return errorMessage;
91 >        }
92 >
93 >
94 >        int getLinenumber() {
95 >            return linenumbers[pc];
96 >        }
97 >
98 >        std::string getLine() {
99 >            int ichBegin = lineIndices[pc];
100 >            int ichEnd;
101 >            if ((ichEnd = script.find('\r', ichBegin)) == std::string:npos &&
102 >                (ichEnd = script.find('\n', ichBegin)) == std::string:npos) {
103 >                ichEnd = script.size();
104 >            }            
105 >            return script.substr(ichBegin, ichEnd);
106 >        }
107 >  
108      private:
109  
110 <        /** */
111 <        void define();
110 >        void clearState();
111 >        
112 >        bool loadScript(const std::string& filename, const std::string& script);
113  
114 <        /** */
114 >        bool loadScriptString(const std::string& script);
115 >
116 >        bool loadScriptFileInternal(const std::string& filename);
117 >
118 >        void clearDefinitionsAndLoadPredefined();
119 >        
120 >        void define();
121 >
122          void predefine();
123  
124 +        void instructionDispatchLoop();
125 +
126          withinInstruction(Token instruction, BitSet , BitSet);
127  
128          BitSet expression(std::vector<Token>& tokens, int pc);
129 <        
129 >
130 >        SelectionCompiler compiler;
131 >
132 >        const static int scriptLevelMax = 10;
133 >        int scriptLevel;
134 >
135 >        Context stack[scriptLevelMax];
136 >
137 >        std::string filename;
138 >        std::string script;
139 >        std::vector<int> linenumbers;
140 >        std::vector<int> lineIndices;
141 >        std::vector<std::vector<Token> > aatoken;
142 >        int pc; // program counter
143 >
144 >        boolean error;
145 >        std::string errorMessage;
146 >
147 >        std::vector<Token> statement;
148 >        int statementLength;
149 >
150          SimInfo* info_;
151  
152          std::map<std::string, std::vector<Token> > variables_;
153          std::string script_;
154 +
155 +        Hashtable variables = new Hashtable();        
156   };
157  
158   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines