139 |
}; |
}; |
140 |
typedef Ref<ConstIntVariable,Node> ConstIntVariableRef; |
typedef Ref<ConstIntVariable,Node> ConstIntVariableRef; |
141 |
|
|
142 |
|
class BuiltInIntVariable : public IntVariable { |
143 |
|
String name; |
144 |
|
VMIntRelPtr* ptr; |
145 |
|
public: |
146 |
|
BuiltInIntVariable(const String& name, VMIntRelPtr* ptr); |
147 |
|
void assign(Expression* expr); |
148 |
|
int evalInt(); |
149 |
|
void dump(int level = 0); |
150 |
|
}; |
151 |
|
typedef Ref<BuiltInIntVariable,Node> BuiltInIntVariableRef; |
152 |
|
|
153 |
class PolyphonicIntVariable : public IntVariable { |
class PolyphonicIntVariable : public IntVariable { |
154 |
public: |
public: |
155 |
PolyphonicIntVariable(ParserContext* ctx); |
PolyphonicIntVariable(ParserContext* ctx); |
157 |
}; |
}; |
158 |
typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef; |
typedef Ref<PolyphonicIntVariable,Node> PolyphonicIntVariableRef; |
159 |
|
|
160 |
class IntArrayVariable : public Variable { |
class IntArrayVariable : public Variable, virtual public VMIntArrayExpr { |
161 |
ArrayList<int> values; |
ArrayList<int> values; |
162 |
public: |
public: |
163 |
IntArrayVariable(ParserContext* ctx, int size); |
IntArrayVariable(ParserContext* ctx, int size); |
164 |
IntArrayVariable(ParserContext* ctx, int size, ArgsRef values); |
IntArrayVariable(ParserContext* ctx, int size, ArgsRef values); |
165 |
void assign(Expression* expr) {} // ignore scalar assignment |
void assign(Expression* expr) {} // ignore scalar assignment |
166 |
String evalCastToStr() { return ""; } // ignore cast to string |
String evalCastToStr() { return ""; } // ignore scalar cast to string |
167 |
ExprType_t exprType() const { return INT_ARR_EXPR; } |
ExprType_t exprType() const { return INT_ARR_EXPR; } |
168 |
const int arraySize() const { return values.size(); } |
virtual int arraySize() const { return values.size(); } |
169 |
|
virtual int evalIntElement(uint i); |
170 |
|
virtual void assignIntElement(uint i, int value); |
171 |
|
void dump(int level = 0); |
172 |
|
protected: |
173 |
|
IntArrayVariable(ParserContext* ctx, bool bConst); |
174 |
|
}; |
175 |
|
typedef Ref<IntArrayVariable,Node> IntArrayVariableRef; |
176 |
|
|
177 |
|
class BuiltInIntArrayVariable : public IntArrayVariable { |
178 |
|
String name; |
179 |
|
VMInt8Array* array; |
180 |
|
public: |
181 |
|
BuiltInIntArrayVariable(const String& name, VMInt8Array* array); |
182 |
|
int arraySize() const { return array->size; } |
183 |
int evalIntElement(uint i); |
int evalIntElement(uint i); |
184 |
void assignIntElement(uint i, int value); |
void assignIntElement(uint i, int value); |
185 |
void dump(int level = 0); |
void dump(int level = 0); |
186 |
}; |
}; |
187 |
typedef Ref<IntArrayVariable,Node> IntArrayVariableRef; |
typedef Ref<BuiltInIntArrayVariable,Node> BuiltInIntArrayVariableRef; |
188 |
|
|
189 |
class IntArrayElement : public IntVariable { |
class IntArrayElement : public IntVariable { |
190 |
IntArrayVariableRef array; |
IntArrayVariableRef array; |
522 |
|
|
523 |
void* scanner; |
void* scanner; |
524 |
std::istream* is; |
std::istream* is; |
525 |
std::vector<ParserIssue> errors; |
std::vector<ParserIssue> vErrors; |
526 |
std::vector<ParserIssue> warnings; |
std::vector<ParserIssue> vWarnings; |
527 |
std::vector<ParserIssue> issues; |
std::vector<ParserIssue> vIssues; |
528 |
|
|
529 |
std::set<String> builtinPreprocessorConditions; |
std::set<String> builtinPreprocessorConditions; |
530 |
std::set<String> userPreprocessorConditions; |
std::set<String> userPreprocessorConditions; |
543 |
|
|
544 |
ArrayList<int>* globalIntMemory; |
ArrayList<int>* globalIntMemory; |
545 |
ArrayList<String>* globalStrMemory; |
ArrayList<String>* globalStrMemory; |
546 |
|
int requiredMaxStackSize; |
547 |
|
|
548 |
VMFunctionProvider* functionProvider; |
VMFunctionProvider* functionProvider; |
549 |
|
|
552 |
ParserContext(VMFunctionProvider* parent) : |
ParserContext(VMFunctionProvider* parent) : |
553 |
scanner(NULL), is(NULL), |
scanner(NULL), is(NULL), |
554 |
globalIntVarCount(0), globalStrVarCount(0), polyphonicIntVarCount(0), |
globalIntVarCount(0), globalStrVarCount(0), polyphonicIntVarCount(0), |
555 |
globalIntMemory(NULL), globalStrMemory(NULL), functionProvider(parent), |
globalIntMemory(NULL), globalStrMemory(NULL), requiredMaxStackSize(-1), |
556 |
execContext(NULL) |
functionProvider(parent), execContext(NULL) |
557 |
{ |
{ |
558 |
} |
} |
559 |
virtual ~ParserContext() { destroyScanner(); } |
virtual ~ParserContext(); |
560 |
VariableRef globalVar(const String& name); |
VariableRef globalVar(const String& name); |
561 |
IntVariableRef globalIntVar(const String& name); |
IntVariableRef globalIntVar(const String& name); |
562 |
StringVariableRef globalStrVar(const String& name); |
StringVariableRef globalStrVar(const String& name); |
568 |
bool setPreprocessorCondition(const char* name); |
bool setPreprocessorCondition(const char* name); |
569 |
bool resetPreprocessorCondition(const char* name); |
bool resetPreprocessorCondition(const char* name); |
570 |
bool isPreprocessorConditionSet(const char* name); |
bool isPreprocessorConditionSet(const char* name); |
571 |
|
std::vector<ParserIssue> issues() const OVERRIDE; |
572 |
|
std::vector<ParserIssue> errors() const OVERRIDE; |
573 |
|
std::vector<ParserIssue> warnings() const OVERRIDE; |
574 |
|
VMEventHandler* eventHandler(uint index) OVERRIDE; |
575 |
|
VMEventHandler* eventHandlerByName(const String& name) OVERRIDE; |
576 |
|
void registerBuiltInConstIntVariables(const std::map<String,int>& vars); |
577 |
|
void registerBuiltInIntVariables(const std::map<String,VMIntRelPtr*>& vars); |
578 |
|
void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars); |
579 |
}; |
}; |
580 |
|
|
581 |
class ExecContext : public VMExecContext { |
class ExecContext : public VMExecContext { |
622 |
stackFrame = -1; |
stackFrame = -1; |
623 |
} |
} |
624 |
|
|
625 |
int suspensionTimeMicroseconds() const { |
int suspensionTimeMicroseconds() const OVERRIDE { |
626 |
return suspendMicroseconds; |
return suspendMicroseconds; |
627 |
} |
} |
628 |
}; |
}; |