1 |
/* |
/* |
2 |
* Copyright (c) 2014 - 2017 Christian Schoenebeck and Andreas Persson |
* Copyright (c) 2014 - 2019 Christian Schoenebeck and Andreas Persson |
3 |
* |
* |
4 |
* http://www.linuxsampler.org |
* http://www.linuxsampler.org |
5 |
* |
* |
16 |
namespace LinuxSampler { |
namespace LinuxSampler { |
17 |
|
|
18 |
bool isNoOperation(StatementRef statement) { |
bool isNoOperation(StatementRef statement) { |
19 |
NoOperation* noOp = dynamic_cast<NoOperation*>(&*statement); |
return statement->statementType() == STMT_NOOP; |
|
return noOp; |
|
20 |
} |
} |
21 |
|
|
22 |
Node::Node() { |
Node::Node() { |
34 |
return ToString(evalInt()); |
return ToString(evalInt()); |
35 |
} |
} |
36 |
|
|
37 |
/*String IntArrayExpr::evalCastToStr() { |
String IntArrayExpr::evalCastToStr() { |
38 |
String s = "{"; |
String s = "{"; |
39 |
for (int i = 0; i < arraySize(); ++i) { |
for (int i = 0; i < arraySize(); ++i) { |
40 |
int val = evalIntElement(i); |
int val = evalIntElement(i); |
43 |
} |
} |
44 |
s += "}"; |
s += "}"; |
45 |
return s; |
return s; |
46 |
}*/ |
} |
47 |
|
|
48 |
int IntLiteral::evalInt() { |
int IntLiteral::evalInt() { |
49 |
return value; |
return value; |
520 |
printf("Built-In Int Array Variable '%s'\n", name.c_str()); |
printf("Built-In Int Array Variable '%s'\n", name.c_str()); |
521 |
} |
} |
522 |
|
|
523 |
IntArrayElement::IntArrayElement(IntArrayVariableRef array, IntExprRef arrayIndex) |
IntArrayElement::IntArrayElement(IntArrayExprRef array, IntExprRef arrayIndex) |
524 |
: IntVariable(NULL, false, false, 0), array(array), index(arrayIndex) |
: IntVariable(NULL, false, false, 0), array(array), index(arrayIndex) |
525 |
{ |
{ |
526 |
} |
} |
976 |
vIssues.push_back(w); |
vIssues.push_back(w); |
977 |
} |
} |
978 |
|
|
979 |
|
void ParserContext::addPreprocessorComment(int firstLine, int lastLine, int firstColumn, int lastColumn) { |
980 |
|
CodeBlock block; |
981 |
|
block.firstLine = firstLine; |
982 |
|
block.lastLine = lastLine; |
983 |
|
block.firstColumn = firstColumn; |
984 |
|
block.lastColumn = lastColumn; |
985 |
|
vPreprocessorComments.push_back(block); |
986 |
|
} |
987 |
|
|
988 |
bool ParserContext::setPreprocessorCondition(const char* name) { |
bool ParserContext::setPreprocessorCondition(const char* name) { |
989 |
if (builtinPreprocessorConditions.count(name)) return false; |
if (builtinPreprocessorConditions.count(name)) return false; |
990 |
if (userPreprocessorConditions.count(name)) return false; |
if (userPreprocessorConditions.count(name)) return false; |
1016 |
return vWarnings; |
return vWarnings; |
1017 |
} |
} |
1018 |
|
|
1019 |
|
std::vector<CodeBlock> ParserContext::preprocessorComments() const { |
1020 |
|
return vPreprocessorComments; |
1021 |
|
} |
1022 |
|
|
1023 |
VMEventHandler* ParserContext::eventHandler(uint index) { |
VMEventHandler* ParserContext::eventHandler(uint index) { |
1024 |
if (!handlers) return NULL; |
if (!handlers) return NULL; |
1025 |
return handlers->eventHandler(index); |
return handlers->eventHandler(index); |
1066 |
} |
} |
1067 |
} |
} |
1068 |
|
|
1069 |
|
ExecContext::ExecContext() : |
1070 |
|
status(VM_EXEC_NOT_RUNNING), flags(STMT_SUCCESS), stackFrame(-1), |
1071 |
|
suspendMicroseconds(0), instructionsCount(0) |
1072 |
|
{ |
1073 |
|
exitRes.value = NULL; |
1074 |
|
} |
1075 |
|
|
1076 |
|
void ExecContext::forkTo(VMExecContext* ectx) const { |
1077 |
|
ExecContext* child = dynamic_cast<ExecContext*>(ectx); |
1078 |
|
|
1079 |
|
child->polyphonicIntMemory.copyFlatFrom(polyphonicIntMemory); |
1080 |
|
child->status = VM_EXEC_SUSPENDED; |
1081 |
|
child->flags = STMT_SUCCESS; |
1082 |
|
child->stack.copyFlatFrom(stack); |
1083 |
|
child->stackFrame = stackFrame; |
1084 |
|
child->suspendMicroseconds = 0; |
1085 |
|
child->instructionsCount = 0; |
1086 |
|
} |
1087 |
|
|
1088 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |