21 |
#include <map> |
#include <map> |
22 |
#include <set> |
#include <set> |
23 |
#include <string.h> // for memset() |
#include <string.h> // for memset() |
24 |
|
#include <assert.h> |
25 |
#include "../common/global.h" |
#include "../common/global.h" |
26 |
#include "../common/Ref.h" |
#include "../common/Ref.h" |
27 |
#include "../common/ArrayList.h" |
#include "../common/ArrayList.h" |
28 |
|
#include "../common/optional.h" |
29 |
#include "common.h" |
#include "common.h" |
30 |
|
|
31 |
namespace LinuxSampler { |
namespace LinuxSampler { |
42 |
STMT_NOOP, |
STMT_NOOP, |
43 |
}; |
}; |
44 |
|
|
45 |
|
enum Qualifier_t { |
46 |
|
QUALIFIER_NONE = 0, |
47 |
|
QUALIFIER_CONST = 1, |
48 |
|
QUALIFIER_POLYPHONIC = (1<<1), |
49 |
|
QUALIFIER_PATCH = (1<<2), |
50 |
|
}; |
51 |
|
|
52 |
|
struct PatchVarBlock { |
53 |
|
CodeBlock nameBlock; |
54 |
|
optional<CodeBlock> exprBlock; |
55 |
|
}; |
56 |
|
|
57 |
|
/** |
58 |
|
* Convenience function used for retrieving the (assumed) data type of a given |
59 |
|
* script variable name. |
60 |
|
* |
61 |
|
* @param name - some script variable name (e.g. "$foo") |
62 |
|
* @return variable's assumed data type (e.g. INT_EXPR for example above) |
63 |
|
*/ |
64 |
|
inline ExprType_t exprTypeOfVarName(const String& name) { |
65 |
|
if (name.empty()) return (ExprType_t) -1; |
66 |
|
const char prefix = name[0]; |
67 |
|
switch (prefix) { |
68 |
|
case '$': return INT_EXPR; |
69 |
|
case '%': return INT_ARR_EXPR; |
70 |
|
case '~': return REAL_EXPR; |
71 |
|
case '?': return REAL_ARR_EXPR; |
72 |
|
case '@': return STRING_EXPR; |
73 |
|
case '!': return STRING_ARR_EXPR; |
74 |
|
} |
75 |
|
return (ExprType_t) -1; |
76 |
|
} |
77 |
|
|
78 |
|
inline ExprType_t scalarTypeOfArray(ExprType_t arrayType) { |
79 |
|
if (arrayType == INT_ARR_EXPR) return INT_EXPR; |
80 |
|
if (arrayType == REAL_ARR_EXPR) return REAL_EXPR; |
81 |
|
if (arrayType == STRING_ARR_EXPR) return STRING_EXPR; |
82 |
|
assert(false); |
83 |
|
return EMPTY_EXPR; // just to shut up the compiler |
84 |
|
} |
85 |
|
|
86 |
|
inline String qualifierStr(Qualifier_t qualifier) { |
87 |
|
switch (qualifier) { |
88 |
|
case QUALIFIER_NONE: return "none"; |
89 |
|
case QUALIFIER_CONST: return "const"; |
90 |
|
case QUALIFIER_POLYPHONIC: return "polyphonic"; |
91 |
|
case QUALIFIER_PATCH: return "patch"; |
92 |
|
} |
93 |
|
return "unknown"; |
94 |
|
} |
95 |
|
|
96 |
|
/** |
97 |
|
* Used by parser for parser error messages to provide a text with all data |
98 |
|
* types accepted by the given built-in function @a fn for the respective |
99 |
|
* function argument @a iArg. |
100 |
|
*/ |
101 |
|
String acceptedArgTypesStr(VMFunction* fn, vmint iArg); |
102 |
|
|
103 |
class Node { |
class Node { |
104 |
public: |
public: |
105 |
Node(); |
Node(); |
130 |
}; |
}; |
131 |
typedef Ref<Unit,Node> UnitRef; |
typedef Ref<Unit,Node> UnitRef; |
132 |
|
|
133 |
class ScalarNumberExpr : virtual public Unit, virtual public VMScalarNumberExpr, virtual public Expression { |
class NumberExpr : virtual public Unit, virtual public VMNumberExpr, virtual public Expression { |
134 |
public: |
public: |
135 |
}; |
}; |
136 |
typedef Ref<ScalarNumberExpr,Node> ScalarNumberExprRef; |
typedef Ref<NumberExpr,Node> NumberExprRef; |
137 |
|
|
138 |
class IntExpr : virtual public ScalarNumberExpr, virtual public VMIntExpr { |
class IntExpr : virtual public NumberExpr, virtual public VMIntExpr { |
139 |
public: |
public: |
140 |
ExprType_t exprType() const OVERRIDE { return INT_EXPR; } |
ExprType_t exprType() const OVERRIDE { return INT_EXPR; } |
141 |
vmint evalIntToUnitFactor(vmfloat unitFactor); |
vmint evalIntToUnitFactor(vmfloat unitFactor); |
143 |
}; |
}; |
144 |
typedef Ref<IntExpr,Node> IntExprRef; |
typedef Ref<IntExpr,Node> IntExprRef; |
145 |
|
|
146 |
class RealExpr : virtual public ScalarNumberExpr, virtual public VMRealExpr { |
class RealExpr : virtual public NumberExpr, virtual public VMRealExpr { |
147 |
public: |
public: |
148 |
ExprType_t exprType() const OVERRIDE { return REAL_EXPR; } |
ExprType_t exprType() const OVERRIDE { return REAL_EXPR; } |
149 |
vmfloat evalRealToUnitFactor(vmfloat unitFactor); |
vmfloat evalRealToUnitFactor(vmfloat unitFactor); |
247 |
ParserContext* ctx; |
ParserContext* ctx; |
248 |
bool isPolyphonic; |
bool isPolyphonic; |
249 |
bool isConst; |
bool isConst; |
|
bool isFinal; |
|
250 |
vmint elements = 1; |
vmint elements = 1; |
251 |
vmint memPos; |
vmint memPos; |
252 |
vmint unitFactorMemPos; |
vmint unitFactorMemPos; |
253 |
StdUnit_t unitType = VM_NO_UNIT; |
StdUnit_t unitType = VM_NO_UNIT; |
254 |
|
bool isFinal; |
255 |
}; |
}; |
256 |
|
|
257 |
class Variable : virtual public VMVariable, virtual public Expression { |
class Variable : virtual public VMVariable, virtual public Expression { |
269 |
}; |
}; |
270 |
typedef Ref<Variable,Node> VariableRef; |
typedef Ref<Variable,Node> VariableRef; |
271 |
|
|
272 |
class ScalarNumberVariable : public Variable, virtual public ScalarNumberExpr { |
class NumberVariable : public Variable, virtual public NumberExpr { |
273 |
bool polyphonic; |
bool polyphonic; |
274 |
bool finalVal; |
bool finalVal; |
275 |
protected: |
protected: |
279 |
bool isFinal() const OVERRIDE { return finalVal; } |
bool isFinal() const OVERRIDE { return finalVal; } |
280 |
vmfloat unitFactor() const OVERRIDE; |
vmfloat unitFactor() const OVERRIDE; |
281 |
protected: |
protected: |
282 |
ScalarNumberVariable(const VariableDecl& decl); |
NumberVariable(const VariableDecl& decl); |
283 |
}; |
}; |
284 |
typedef Ref<ScalarNumberVariable,Node> ScalarNumberVariableRef; |
typedef Ref<NumberVariable,Node> NumberVariableRef; |
285 |
|
|
286 |
class IntVariable : public ScalarNumberVariable, virtual public IntExpr { |
class IntVariable : public NumberVariable, virtual public IntExpr { |
287 |
public: |
public: |
288 |
IntVariable(const VariableDecl& decl); |
IntVariable(const VariableDecl& decl); |
289 |
void assign(Expression* expr) OVERRIDE; |
void assign(Expression* expr) OVERRIDE; |
292 |
}; |
}; |
293 |
typedef Ref<IntVariable,Node> IntVariableRef; |
typedef Ref<IntVariable,Node> IntVariableRef; |
294 |
|
|
295 |
class RealVariable : public ScalarNumberVariable, virtual public RealExpr { |
class RealVariable : public NumberVariable, virtual public RealExpr { |
296 |
public: |
public: |
297 |
RealVariable(const VariableDecl& decl); |
RealVariable(const VariableDecl& decl); |
298 |
void assign(Expression* expr) OVERRIDE; |
void assign(Expression* expr) OVERRIDE; |
302 |
typedef Ref<RealVariable,Node> RealVariableRef; |
typedef Ref<RealVariable,Node> RealVariableRef; |
303 |
|
|
304 |
struct IntVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17 |
struct IntVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17 |
305 |
|
// additions for RealVarDef |
306 |
|
vmint value = 0; //NOTE: sequence matters! Since this is usually initialized with VMIntExpr::evalInt() it should be before member unitFactor, since the latter is usually initialized with VMIntExpr::unitFactor() which does not evaluate the expression. |
307 |
|
vmfloat unitFactor = VM_NO_FACTOR; |
308 |
// copied from VariableDecl |
// copied from VariableDecl |
309 |
ParserContext* ctx; |
ParserContext* ctx; |
310 |
bool isPolyphonic; |
bool isPolyphonic; |
311 |
bool isConst; |
bool isConst; |
|
bool isFinal; |
|
312 |
vmint elements = 1; |
vmint elements = 1; |
313 |
vmint memPos; |
vmint memPos; |
314 |
vmint unitFactorMemPos; |
vmint unitFactorMemPos; |
315 |
StdUnit_t unitType = VM_NO_UNIT; |
StdUnit_t unitType = VM_NO_UNIT; |
316 |
// additions for RealVarDef |
bool isFinal; |
|
vmint value = 0; //NOTE: sequence matters! Since this is usually initialized with VMIntExpr::evalInt() it should be before member unitFactor, since the latter is usually initialized with VMIntExpr::unitFactor() which does not evaluate the expression. |
|
|
vmfloat unitFactor = VM_NO_FACTOR; |
|
317 |
}; |
}; |
318 |
|
|
319 |
class ConstIntVariable FINAL : public IntVariable { |
class ConstIntVariable FINAL : public IntVariable { |
329 |
typedef Ref<ConstIntVariable,Node> ConstIntVariableRef; |
typedef Ref<ConstIntVariable,Node> ConstIntVariableRef; |
330 |
|
|
331 |
struct RealVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17 |
struct RealVarDef /* : VariableDecl*/ { //NOTE: derived, aggregate initializer-lists requires C++17 |
332 |
|
// additions for RealVarDef |
333 |
|
vmfloat value = vmfloat(0); //NOTE: sequence matters! Since this is usually initialized with VMRealExpr::evalReal() it should be before member unitFactor, since the latter is usually initialized with VMRealExpr::unitFactor() which does not evaluate the expression. |
334 |
|
vmfloat unitFactor = VM_NO_FACTOR; |
335 |
// copied from VariableDecl |
// copied from VariableDecl |
336 |
ParserContext* ctx; |
ParserContext* ctx; |
337 |
bool isPolyphonic; |
bool isPolyphonic; |
338 |
bool isConst; |
bool isConst; |
|
bool isFinal; |
|
339 |
vmint elements = 1; |
vmint elements = 1; |
340 |
vmint memPos; |
vmint memPos; |
341 |
vmint unitFactorMemPos; |
vmint unitFactorMemPos; |
342 |
StdUnit_t unitType = VM_NO_UNIT; |
StdUnit_t unitType = VM_NO_UNIT; |
343 |
// additions for RealVarDef |
bool isFinal; |
|
vmfloat value = vmfloat(0); //NOTE: sequence matters! Since this is usually initialized with VMRealExpr::evalReal() it should be before member unitFactor, since the latter is usually initialized with VMRealExpr::unitFactor() which does not evaluate the expression. |
|
|
vmfloat unitFactor = VM_NO_FACTOR; |
|
344 |
}; |
}; |
345 |
|
|
346 |
class ConstRealVariable FINAL : public RealVariable { |
class ConstRealVariable FINAL : public RealVariable { |
363 |
bool isAssignable() const OVERRIDE { return ptr->isAssignable(); } |
bool isAssignable() const OVERRIDE { return ptr->isAssignable(); } |
364 |
void assign(Expression* expr) OVERRIDE; |
void assign(Expression* expr) OVERRIDE; |
365 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
366 |
vmfloat unitFactor() const OVERRIDE { return VM_NO_UNIT; } |
vmfloat unitFactor() const OVERRIDE { return VM_NO_FACTOR; } |
367 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
368 |
}; |
}; |
369 |
typedef Ref<BuiltInIntVariable,Node> BuiltInIntVariableRef; |
typedef Ref<BuiltInIntVariable,Node> BuiltInIntVariableRef; |
496 |
}; |
}; |
497 |
typedef Ref<BinaryOp,Node> BinaryOpRef; |
typedef Ref<BinaryOp,Node> BinaryOpRef; |
498 |
|
|
499 |
class ScalarNumberBinaryOp : public BinaryOp, virtual public ScalarNumberExpr { |
class NumberBinaryOp : public BinaryOp, virtual public NumberExpr { |
500 |
public: |
public: |
501 |
ScalarNumberBinaryOp(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : BinaryOp(lhs, rhs) { } |
NumberBinaryOp(NumberExprRef lhs, NumberExprRef rhs) : BinaryOp(lhs, rhs) { } |
502 |
bool isFinal() const OVERRIDE; |
bool isFinal() const OVERRIDE; |
503 |
}; |
}; |
504 |
typedef Ref<ScalarNumberBinaryOp,Node> ScalarNumberBinaryOpRef; |
typedef Ref<NumberBinaryOp,Node> NumberBinaryOpRef; |
505 |
|
|
506 |
class IntBinaryOp : public ScalarNumberBinaryOp, virtual public IntExpr { |
class IntBinaryOp : public NumberBinaryOp, virtual public IntExpr { |
507 |
public: |
public: |
508 |
IntBinaryOp(IntExprRef lhs, IntExprRef rhs) : ScalarNumberBinaryOp(lhs, rhs) { } |
IntBinaryOp(IntExprRef lhs, IntExprRef rhs) : NumberBinaryOp(lhs, rhs) { } |
509 |
}; |
}; |
510 |
typedef Ref<IntBinaryOp,Node> IntBinaryOpRef; |
typedef Ref<IntBinaryOp,Node> IntBinaryOpRef; |
511 |
|
|
512 |
class VaritypeScalarBinaryOp : public ScalarNumberBinaryOp, virtual public IntExpr, virtual public RealExpr { |
class VaritypeScalarBinaryOp : public NumberBinaryOp, virtual public IntExpr, virtual public RealExpr { |
513 |
public: |
public: |
514 |
VaritypeScalarBinaryOp(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs) : ScalarNumberBinaryOp(lhs, rhs) { } |
VaritypeScalarBinaryOp(NumberExprRef lhs, NumberExprRef rhs) : NumberBinaryOp(lhs, rhs) { } |
515 |
ExprType_t exprType() const OVERRIDE; |
ExprType_t exprType() const OVERRIDE; |
516 |
String evalCastToStr() OVERRIDE; |
String evalCastToStr() OVERRIDE; |
517 |
}; |
}; |
519 |
|
|
520 |
class Add FINAL : public VaritypeScalarBinaryOp { |
class Add FINAL : public VaritypeScalarBinaryOp { |
521 |
public: |
public: |
522 |
Add(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs); |
Add(NumberExprRef lhs, NumberExprRef rhs); |
523 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
524 |
vmfloat evalReal() OVERRIDE; |
vmfloat evalReal() OVERRIDE; |
525 |
vmfloat unitFactor() const OVERRIDE; |
vmfloat unitFactor() const OVERRIDE; |
529 |
|
|
530 |
class Sub FINAL : public VaritypeScalarBinaryOp { |
class Sub FINAL : public VaritypeScalarBinaryOp { |
531 |
public: |
public: |
532 |
Sub(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs); |
Sub(NumberExprRef lhs, NumberExprRef rhs); |
533 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
534 |
vmfloat evalReal() OVERRIDE; |
vmfloat evalReal() OVERRIDE; |
535 |
vmfloat unitFactor() const OVERRIDE; |
vmfloat unitFactor() const OVERRIDE; |
539 |
|
|
540 |
class Mul FINAL : public VaritypeScalarBinaryOp { |
class Mul FINAL : public VaritypeScalarBinaryOp { |
541 |
public: |
public: |
542 |
Mul(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs); |
Mul(NumberExprRef lhs, NumberExprRef rhs); |
543 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
544 |
vmfloat evalReal() OVERRIDE; |
vmfloat evalReal() OVERRIDE; |
545 |
vmfloat unitFactor() const OVERRIDE; |
vmfloat unitFactor() const OVERRIDE; |
549 |
|
|
550 |
class Div FINAL : public VaritypeScalarBinaryOp { |
class Div FINAL : public VaritypeScalarBinaryOp { |
551 |
public: |
public: |
552 |
Div(ScalarNumberExprRef lhs, ScalarNumberExprRef rhs); |
Div(NumberExprRef lhs, NumberExprRef rhs); |
553 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
554 |
vmfloat evalReal() OVERRIDE; |
vmfloat evalReal() OVERRIDE; |
555 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
642 |
VMFnResult* result; |
VMFnResult* result; |
643 |
public: |
public: |
644 |
FunctionCall(const char* function, ArgsRef args, VMFunction* fn); |
FunctionCall(const char* function, ArgsRef args, VMFunction* fn); |
645 |
|
virtual ~FunctionCall(); |
646 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
647 |
StmtFlags_t exec() OVERRIDE; |
StmtFlags_t exec() OVERRIDE; |
648 |
vmint evalInt() OVERRIDE; |
vmint evalInt() OVERRIDE; |
668 |
}; |
}; |
669 |
typedef Ref<NoFunctionCall,Node> NoFunctionCallRef; |
typedef Ref<NoFunctionCall,Node> NoFunctionCallRef; |
670 |
|
|
671 |
class EventHandler : virtual public Statements, virtual public VMEventHandler { |
class Subroutine : public Statements { |
672 |
StatementsRef statements; |
StatementsRef statements; |
673 |
|
public: |
674 |
|
Subroutine(StatementsRef statements); |
675 |
|
Statement* statement(uint i) OVERRIDE { return statements->statement(i); } |
676 |
|
void dump(int level = 0) OVERRIDE; |
677 |
|
}; |
678 |
|
typedef Ref<Subroutine,Node> SubroutineRef; |
679 |
|
|
680 |
|
class UserFunction : public Subroutine { |
681 |
|
public: |
682 |
|
UserFunction(StatementsRef statements); |
683 |
|
}; |
684 |
|
typedef Ref<UserFunction,Node> UserFunctionRef; |
685 |
|
|
686 |
|
class EventHandler : public Subroutine, virtual public VMEventHandler { |
687 |
bool usingPolyphonics; |
bool usingPolyphonics; |
688 |
public: |
public: |
689 |
void dump(int level = 0) OVERRIDE; |
void dump(int level = 0) OVERRIDE; |
|
StmtFlags_t exec(); |
|
690 |
EventHandler(StatementsRef statements); |
EventHandler(StatementsRef statements); |
|
Statement* statement(uint i) OVERRIDE { return statements->statement(i); } |
|
691 |
bool isPolyphonic() const OVERRIDE { return usingPolyphonics; } |
bool isPolyphonic() const OVERRIDE { return usingPolyphonics; } |
692 |
}; |
}; |
693 |
typedef Ref<EventHandler,Node> EventHandlerRef; |
typedef Ref<EventHandler,Node> EventHandlerRef; |
724 |
}; |
}; |
725 |
typedef Ref<OnController,Node> OnControllerRef; |
typedef Ref<OnController,Node> OnControllerRef; |
726 |
|
|
727 |
|
class OnRpn FINAL : public EventHandler { |
728 |
|
public: |
729 |
|
OnRpn(StatementsRef statements) : EventHandler(statements) {} |
730 |
|
VMEventHandlerType_t eventHandlerType() const OVERRIDE { return VM_EVENT_HANDLER_RPN; } |
731 |
|
String eventHandlerName() const OVERRIDE { return "rpn"; } |
732 |
|
}; |
733 |
|
typedef Ref<OnRpn,Node> OnRpnRef; |
734 |
|
|
735 |
|
class OnNrpn FINAL : public EventHandler { |
736 |
|
public: |
737 |
|
OnNrpn(StatementsRef statements) : EventHandler(statements) {} |
738 |
|
VMEventHandlerType_t eventHandlerType() const OVERRIDE { return VM_EVENT_HANDLER_NRPN; } |
739 |
|
String eventHandlerName() const OVERRIDE { return "nrpn"; } |
740 |
|
}; |
741 |
|
typedef Ref<OnNrpn,Node> OnNrpnRef; |
742 |
|
|
743 |
class EventHandlers FINAL : virtual public Node { |
class EventHandlers FINAL : virtual public Node { |
744 |
std::vector<EventHandlerRef> args; |
std::vector<EventHandlerRef> args; |
745 |
public: |
public: |
826 |
typedef Ref<SyncBlock,Node> SyncBlockRef; |
typedef Ref<SyncBlock,Node> SyncBlockRef; |
827 |
|
|
828 |
class Neg FINAL : virtual public IntExpr, virtual public RealExpr { |
class Neg FINAL : virtual public IntExpr, virtual public RealExpr { |
829 |
ScalarNumberExprRef expr; |
NumberExprRef expr; |
830 |
public: |
public: |
831 |
Neg(ScalarNumberExprRef expr) : Unit(expr->unitType()), expr(expr) { } |
Neg(NumberExprRef expr) : Unit(expr->unitType()), expr(expr) { } |
832 |
ExprType_t exprType() const OVERRIDE { return expr->exprType(); } |
ExprType_t exprType() const OVERRIDE { return expr->exprType(); } |
833 |
vmint evalInt() OVERRIDE { return (expr) ? -(expr->asInt()->evalInt()) : 0; } |
vmint evalInt() OVERRIDE { return (expr) ? -(expr->asInt()->evalInt()) : 0; } |
834 |
vmfloat evalReal() OVERRIDE { return (expr) ? -(expr->asReal()->evalReal()) : vmfloat(0); } |
vmfloat evalReal() OVERRIDE { return (expr) ? -(expr->asReal()->evalReal()) : vmfloat(0); } |
940 |
typedef Ref<BitwiseNot,Node> BitwiseNotRef; |
typedef Ref<BitwiseNot,Node> BitwiseNotRef; |
941 |
|
|
942 |
class Final FINAL : virtual public IntExpr, virtual public RealExpr { |
class Final FINAL : virtual public IntExpr, virtual public RealExpr { |
943 |
ScalarNumberExprRef expr; |
NumberExprRef expr; |
944 |
public: |
public: |
945 |
Final(ScalarNumberExprRef expr) : Unit(expr->unitType()), expr(expr) {} |
Final(NumberExprRef expr) : Unit(expr->unitType()), expr(expr) {} |
946 |
ExprType_t exprType() const OVERRIDE { return expr->exprType(); } |
ExprType_t exprType() const OVERRIDE { return expr->exprType(); } |
947 |
vmint evalInt() OVERRIDE { return expr->asInt()->evalInt(); } |
vmint evalInt() OVERRIDE { return expr->asInt()->evalInt(); } |
948 |
vmfloat evalReal() OVERRIDE { return expr->asReal()->evalReal(); } |
vmfloat evalReal() OVERRIDE { return expr->asReal()->evalReal(); } |
965 |
|
|
966 |
void* scanner; |
void* scanner; |
967 |
std::istream* is; |
std::istream* is; |
968 |
|
int nbytes; |
969 |
std::vector<ParserIssue> vErrors; |
std::vector<ParserIssue> vErrors; |
970 |
std::vector<ParserIssue> vWarnings; |
std::vector<ParserIssue> vWarnings; |
971 |
std::vector<ParserIssue> vIssues; |
std::vector<ParserIssue> vIssues; |
972 |
std::vector<CodeBlock> vPreprocessorComments; |
std::vector<CodeBlock> vPreprocessorComments; |
973 |
|
std::map<String,PatchVarBlock> patchVars; |
974 |
|
|
975 |
std::set<String> builtinPreprocessorConditions; |
std::set<String> builtinPreprocessorConditions; |
976 |
std::set<String> userPreprocessorConditions; |
std::set<String> userPreprocessorConditions; |
977 |
|
|
978 |
std::map<String,VariableRef> vartable; |
std::map<String,VariableRef> vartable; |
979 |
std::map<String,StatementsRef> userFnTable; |
std::map<String,UserFunctionRef> userFnTable; |
980 |
vmint globalIntVarCount; |
vmint globalIntVarCount; |
981 |
vmint globalRealVarCount; |
vmint globalRealVarCount; |
982 |
vmint globalStrVarCount; |
vmint globalStrVarCount; |
991 |
OnNoteRef onNote; |
OnNoteRef onNote; |
992 |
OnReleaseRef onRelease; |
OnReleaseRef onRelease; |
993 |
OnControllerRef onController; |
OnControllerRef onController; |
994 |
|
OnRpnRef onRpn; |
995 |
|
OnNrpnRef onNrpn; |
996 |
|
|
997 |
ArrayList<vmint>* globalIntMemory; |
ArrayList<vmint>* globalIntMemory; |
998 |
ArrayList<vmfloat>* globalRealMemory; |
ArrayList<vmfloat>* globalRealMemory; |
1005 |
ExecContext* execContext; |
ExecContext* execContext; |
1006 |
|
|
1007 |
ParserContext(VMFunctionProvider* parent) : |
ParserContext(VMFunctionProvider* parent) : |
1008 |
scanner(NULL), is(NULL), |
scanner(NULL), is(NULL), nbytes(0), |
1009 |
globalIntVarCount(0), globalRealVarCount(0), globalStrVarCount(0), |
globalIntVarCount(0), globalRealVarCount(0), globalStrVarCount(0), |
1010 |
globalUnitFactorCount(0), |
globalUnitFactorCount(0), |
1011 |
polyphonicIntVarCount(0), polyphonicRealVarCount(0), |
polyphonicIntVarCount(0), polyphonicRealVarCount(0), |
1022 |
RealVariableRef globalRealVar(const String& name); |
RealVariableRef globalRealVar(const String& name); |
1023 |
StringVariableRef globalStrVar(const String& name); |
StringVariableRef globalStrVar(const String& name); |
1024 |
VariableRef variableByName(const String& name); |
VariableRef variableByName(const String& name); |
1025 |
StatementsRef userFunctionByName(const String& name); |
UserFunctionRef userFunctionByName(const String& name); |
1026 |
void addErr(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt); |
void addErr(int firstLine, int lastLine, int firstColumn, int lastColumn, |
1027 |
void addWrn(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt); |
int firstByte, int lengthBytes, const char* txt); |
1028 |
void addPreprocessorComment(int firstLine, int lastLine, int firstColumn, int lastColumn); |
void addWrn(int firstLine, int lastLine, int firstColumn, int lastColumn, |
1029 |
|
int firstByte, int lengthBytes, const char* txt); |
1030 |
|
void addPreprocessorComment(int firstLine, int lastLine, int firstColumn, |
1031 |
|
int lastColumn, int firstByte, int lengthBytes); |
1032 |
void createScanner(std::istream* is); |
void createScanner(std::istream* is); |
1033 |
void destroyScanner(); |
void destroyScanner(); |
1034 |
bool setPreprocessorCondition(const char* name); |
bool setPreprocessorCondition(const char* name); |
1041 |
VMEventHandler* eventHandler(uint index) OVERRIDE; |
VMEventHandler* eventHandler(uint index) OVERRIDE; |
1042 |
VMEventHandler* eventHandlerByName(const String& name) OVERRIDE; |
VMEventHandler* eventHandlerByName(const String& name) OVERRIDE; |
1043 |
void registerBuiltInConstIntVariables(const std::map<String,vmint>& vars); |
void registerBuiltInConstIntVariables(const std::map<String,vmint>& vars); |
1044 |
|
void registerBuiltInConstRealVariables(const std::map<String,vmfloat>& vars); |
1045 |
void registerBuiltInIntVariables(const std::map<String,VMIntPtr*>& vars); |
void registerBuiltInIntVariables(const std::map<String,VMIntPtr*>& vars); |
1046 |
void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars); |
void registerBuiltInIntArrayVariables(const std::map<String,VMInt8Array*>& vars); |
1047 |
void registerBuiltInDynVariables(const std::map<String,VMDynVar*>& vars); |
void registerBuiltInDynVariables(const std::map<String,VMDynVar*>& vars); |