2 #include <unordered_map>
14 using std::unordered_map;
26 void BaseMethods::registerConstants(
MinitScript* minitScript) {
40 MethodInternalScriptEvaluate(
MinitScript* minitScript):
43 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"statement", .optional =
false, .reference =
false, .nullable =
false }
45 MinitScript::TYPE_PSEUDO_MIXED
47 minitScript(minitScript) {}
48 const string getMethodName()
override {
49 return "internal.script.evaluate";
52 if (arguments.size() != 1) {
55 if (arguments.size() == 1) {
59 bool isPrivate()
const override {
63 minitScript->
registerMethod(
new MethodInternalScriptEvaluate(minitScript));
71 MethodInternalEvaluateMemberAccess(
MinitScript* minitScript):
74 { .type = MinitScript::TYPE_STRING, .name =
"variable", .optional =
false, .reference =
false, .nullable =
true },
75 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"this", .optional =
false, .reference =
false, .nullable =
true },
76 { .type = MinitScript::TYPE_STRING, .name =
"member", .optional =
false, .reference =
false, .nullable =
false }
78 MinitScript::TYPE_PSEUDO_MIXED,
81 minitScript(minitScript) {}
82 const string getMethodName()
override {
83 return "internal.script.evaluateMemberAccess";
96 if (arguments.size() < 3 ||
97 minitScript->
getStringValue(arguments, 2, member,
false) ==
false) {
101 auto complain =
true;
103 string thisVariableName;
105 if (arguments[0].getType() != MinitScript::TYPE_NULL && arguments[0].getStringValue(thisVariableName) ==
true) {
107 #if defined(__MINITSCRIPT_TRANSPILATION__)
108 arguments[1] = MinitScript::Variable::createReferenceVariable(&EVALUATEMEMBERACCESS_ARGUMENT0);
110 arguments[1] = minitScript->
getVariable(thisVariableName, &subStatement,
true);
115 auto functionScriptIdx = MinitScript::SCRIPTIDX_NONE;
116 if (arguments[1].getType() == MinitScript::TYPE_MAP) {
119 if (mapValue.getType() == MinitScript::TYPE_FUNCTION_ASSIGNMENT && mapValue.getFunctionValue(
function, functionScriptIdx) ==
true) {
121 if (mapValue.isPrivate() ==
true && arguments[1].isPrivateScope() ==
false) {
123 functionScriptIdx = MinitScript::SCRIPTIDX_NONE;
127 if (functionScriptIdx == MinitScript::SCRIPTIDX_NONE) functionScriptIdx = minitScript->
getFunctionScriptIdx(
function);
131 const auto& className = arguments[1].getTypeAsString();
133 if (className.empty() ==
false || functionScriptIdx != MinitScript::SCRIPTIDX_NONE) {
136 if (functionScriptIdx == MinitScript::SCRIPTIDX_NONE) {
137 #if defined(__MINITSCRIPT_TRANSPILATION__)
138 method = evaluateMemberAccessArrays[
static_cast<int>(arguments[1].getType()) -
static_cast<int>(MinitScript::TYPE_STRING)][EVALUATEMEMBERACCESS_MEMBER];
140 method = minitScript->
getMethod(className +
"::" + member);
143 if (method !=
nullptr || functionScriptIdx != MinitScript::SCRIPTIDX_NONE) {
145 vector<MinitScript::Variable> callArguments(1 + (arguments.size() - 3) / 2);
147 callArguments[0] = move(arguments[1]);
150 auto callArgumentIdx = 1;
151 for (
auto argumentIdx = 3; argumentIdx < arguments.size(); argumentIdx+=2) {
153 string argumentVariableName;
154 if (arguments[argumentIdx].getType() != MinitScript::TYPE_NULL && arguments[argumentIdx].getStringValue(argumentVariableName) ==
true) {
155 #if defined(__MINITSCRIPT_TRANSPILATION__)
156 if (method !=
nullptr) {
157 arguments[argumentIdx + 1] =
158 callArgumentIdx >= method->getArgumentTypes().size() || method->getArgumentTypes()[callArgumentIdx].reference ==
false?
159 MinitScript::Variable::createNonReferenceVariable(&EVALUATEMEMBERACCESS_ARGUMENTS[callArgumentIdx - 1]):
160 EVALUATEMEMBERACCESS_ARGUMENTS[callArgumentIdx - 1];
162 if (functionScriptIdx != MinitScript::SCRIPTIDX_NONE) {
163 arguments[argumentIdx + 1] =
164 callArgumentIdx >= minitScript->
getScripts()[functionScriptIdx].arguments.size() || minitScript->
getScripts()[functionScriptIdx].arguments[callArgumentIdx].reference ==
false?
165 MinitScript::Variable::createNonReferenceVariable(&EVALUATEMEMBERACCESS_ARGUMENTS[callArgumentIdx - 1]):
166 EVALUATEMEMBERACCESS_ARGUMENTS[callArgumentIdx - 1];
170 if (method !=
nullptr) {
171 arguments[argumentIdx + 1] = minitScript->
getVariable(argumentVariableName, &subStatement, callArgumentIdx >= method->getArgumentTypes().size()?
false:method->getArgumentTypes()[callArgumentIdx].reference);
173 if (functionScriptIdx != MinitScript::SCRIPTIDX_NONE) {
174 arguments[argumentIdx + 1] = minitScript->
getVariable(argumentVariableName, &subStatement, callArgumentIdx >= minitScript->
getScripts()[functionScriptIdx].arguments.size()?
false:minitScript->
getScripts()[functionScriptIdx].arguments[callArgumentIdx].reference);
179 callArguments[callArgumentIdx] = move(arguments[argumentIdx + 1]);
184 span callArgumentsSpan(callArguments);
186 if (method !=
nullptr) {
187 method->executeMethod(callArgumentsSpan, returnValue, subStatement);
189 if (functionScriptIdx != MinitScript::SCRIPTIDX_NONE) {
190 minitScript->
call(functionScriptIdx, callArgumentsSpan, returnValue);
194 arguments[1] = move(callArgumentsSpan[0]);
197 auto callArgumentIdx = 1;
198 for (
auto argumentIdx = 3; argumentIdx < arguments.size(); argumentIdx+=2) {
199 arguments[argumentIdx] = move(callArgumentsSpan[callArgumentIdx]);
204 if (complain ==
true) {
209 if (complain ==
true) {
215 bool isVariadic()
const override {
218 bool isPrivate()
const override {
222 minitScript->
registerMethod(
new MethodInternalEvaluateMemberAccess(minitScript));
230 MethodInternalScriptCallStacklet(
MinitScript* minitScript):
233 { .type = MinitScript::TYPE_STACKLET_ASSIGNMENT, .name =
"stacklet", .optional =
false, .reference =
false, .nullable =
false }
235 MinitScript::TYPE_PSEUDO_MIXED
237 minitScript(minitScript) {}
238 const string getMethodName()
override {
239 return "internal.script.callStacklet";
243 auto stackletScriptIdx = MinitScript::SCRIPTIDX_NONE;
244 if (arguments.size() == 1 &&
245 minitScript->
getStackletValue(arguments, 0, stacklet, stackletScriptIdx) ==
true) {
246 if (stackletScriptIdx == MinitScript::SCRIPTIDX_NONE) {
249 if (stackletScriptIdx == MinitScript::SCRIPTIDX_NONE || minitScript->
getScripts()[stackletScriptIdx].type != MinitScript::Script::TYPE_STACKLET) {
252 vector<MinitScript::Variable> callArguments(0);
253 span callArgumentsSpan(callArguments);
254 minitScript->
callStacklet(stackletScriptIdx, callArgumentsSpan, returnValue);
260 bool isPrivate()
const override {
264 minitScript->
registerMethod(
new MethodInternalScriptCallStacklet(minitScript));
276 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"value", .optional =
true, .reference =
false, .nullable =
false }
278 MinitScript::TYPE_NULL
280 minitScript(minitScript) {}
281 const string getMethodName()
override {
285 if (arguments.size() == 0 || arguments.size() == 1) {
307 { .type = MinitScript::TYPE_INTEGER, .name =
"levels", .optional =
true, .reference =
false, .nullable =
false }
310 minitScript(minitScript) {}
311 const string getMethodName()
override {
316 if ((arguments.size() == 0 || arguments.size() == 1) &&
317 MinitScript::getIntegerValue(arguments, 0, levels,
true) ==
true) {
324 vector<int> blockStacksToRemove;
325 for (
int i = blockStack.size() - 1; i >= 0; i--) {
326 if (blockStack[i].type == MinitScript::ScriptState::Block::TYPE_FOR) {
327 endType = &blockStack[i];
329 blockStacksToRemove.push_back(i);
330 if (level == levels)
break;
332 if (level < levels) {
333 blockStacksToRemove.push_back(i);
336 if (endType ==
nullptr) {
339 if (levels != level) {
344 for (
auto i: blockStacksToRemove) blockStack.erase(blockStack.begin() + i);
366 { .type = MinitScript::TYPE_INTEGER, .name =
"levels", .optional =
true, .reference =
false, .nullable =
false }
369 minitScript(minitScript) {}
370 const string getMethodName()
override {
375 if ((arguments.size() == 0 || arguments.size() == 1) &&
376 MinitScript::getIntegerValue(arguments, 0, levels,
true) ==
true) {
383 vector<int> blockStacksToRemove;
384 for (
int i = blockStack.size() - 1; i >= 0; i--) {
385 if (blockStack[i].type == MinitScript::ScriptState::Block::TYPE_FOR) {
386 endType = &blockStack[i];
388 if (level == levels) {
391 blockStacksToRemove.push_back(i);
394 if (level < levels) {
395 blockStacksToRemove.push_back(i);
398 if (endType ==
nullptr) {
401 if (levels != level) {
406 for (
auto i: blockStacksToRemove) blockStack.erase(blockStack.begin() + i);
426 const string getMethodName()
override {
430 if (arguments.size() == 0) {
435 auto& block = blockStack.back();
436 if (block.type == MinitScript::ScriptState::Block::TYPE_FUNCTION || block.type == MinitScript::ScriptState::Block::TYPE_STACKLET) {
439 if (block.type == MinitScript::ScriptState::Block::TYPE_FOR && block.parameter.getType() == MinitScript::TYPE_INTEGER) {
440 vector<MinitScript::Variable> arguments {};
441 span argumentsSpan(arguments);
443 int64_t iterationStackletScriptIdx;
444 if (block.parameter.getIntegerValue(iterationStackletScriptIdx) ==
true &&
445 iterationStackletScriptIdx != MinitScript::SCRIPTIDX_NONE) {
446 minitScript->
callStacklet(iterationStackletScriptIdx, argumentsSpan, returnValue);
451 blockStack.erase(blockStack.begin() + blockStack.size() - 1);
473 { .type = MinitScript::TYPE_INTEGER, .name =
"time", .optional =
false, .reference =
false, .nullable =
false }
476 minitScript(minitScript) {}
477 const string getMethodName()
override {
482 if (arguments.size() == 1 &&
486 auto timeWaitStarted = now;
487 auto forTimeStartedIt = scriptState.forTimeStarted.find(subStatement.
statement->
line);
488 if (forTimeStartedIt == scriptState.forTimeStarted.end()) {
491 timeWaitStarted = forTimeStartedIt->second;
495 scriptState.forTimeStarted.erase(subStatement.
statement->
line);
498 scriptState.blockStack.emplace_back(
499 MinitScript::ScriptState::Block::TYPE_FORTIME,
522 { .type = MinitScript::TYPE_BOOLEAN, .name =
"condition", .optional =
false, .reference =
false, .nullable =
false },
523 { .type = MinitScript::TYPE_STACKLET_ASSIGNMENT, .name =
"iterationStacklet", .optional =
true, .reference =
false, .nullable =
false }
526 minitScript(minitScript) {}
527 const string getMethodName()
override {
528 return "forCondition";
532 string iterationStacklet;
533 auto iterationStackletScriptIdx = MinitScript::SCRIPTIDX_NONE;
534 if ((arguments.size() == 1 || arguments.size() == 2) &&
536 minitScript->
getStackletValue(arguments, 1, iterationStacklet, iterationStackletScriptIdx,
true) ==
true) {
537 if (booleanValue ==
false) {
540 if (iterationStacklet.empty() ==
false && iterationStackletScriptIdx == MinitScript::SCRIPTIDX_NONE) {
544 if (iterationStacklet.empty() ==
false && iterationStackletScriptIdx == MinitScript::SCRIPTIDX_NONE) {
549 MinitScript::ScriptState::Block::TYPE_FOR,
573 { .type = MinitScript::TYPE_BOOLEAN, .name =
"condition", .optional =
false, .reference =
false, .nullable =
false }
576 minitScript(minitScript) {}
577 const string getMethodName()
override {
582 if (arguments.size() == 1 &&
585 if (booleanValue ==
false) {
604 { .type = MinitScript::TYPE_BOOLEAN, .name =
"condition", .optional =
false, .reference =
false, .nullable =
false }
607 minitScript(minitScript) {}
608 const string getMethodName()
override {
613 if (arguments.size() == 1 &&
619 auto& block = scriptState.blockStack.back();
620 if (block.type != MinitScript::ScriptState::Block::TYPE_IF) {
623 if (block.match ==
true || booleanValue ==
false) {
626 block.match = booleanValue;
634 minitScript->
registerMethod(
new MethodElseIfCondition(minitScript));
643 const string getMethodName()
override {
647 if (arguments.size() == 0) {
650 if (block.type != MinitScript::ScriptState::Block::TYPE_IF) {
653 if (block.match ==
true) {
673 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"value", .optional =
false, .reference =
false, .nullable =
false }
676 minitScript(minitScript) {}
677 const string getMethodName()
override {
681 if (arguments.size() == 1) {
683 scriptState.
blockStack.emplace_back(MinitScript::ScriptState::Block::TYPE_SWITCH,
false,
nullptr,
nullptr, arguments[0]);
700 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"value", .optional =
false, .reference =
false, .nullable =
false }
703 minitScript(minitScript) {}
704 const string getMethodName()
override {
708 if (arguments.size() == 1) {
713 auto& block = scriptState.blockStack.back();
714 if (block.type != MinitScript::ScriptState::Block::TYPE_SWITCH) {
717 auto match = arguments[0].getValueAsString() == block.parameter.getValueAsString();
718 if (block.match ==
true || match ==
false) {
722 scriptState.blockStack.emplace_back(MinitScript::ScriptState::Block::TYPE_CASE,
false,
nullptr,
nullptr,
MinitScript::Variable());
740 const string getMethodName()
override {
744 if (arguments.size() == 0) {
749 auto& block = scriptState.blockStack.back();
750 if (block.type != MinitScript::ScriptState::Block::TYPE_SWITCH) {
753 if (block.match ==
true) {
774 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
775 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
776 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
778 MinitScript::TYPE_BOOLEAN
780 minitScript(minitScript) {}
781 const string getMethodName()
override {
785 if (arguments.size() == 2 || arguments.size() == 3) {
787 for (
auto i = 1; i < 2; i++) {
788 if (arguments[0].getValueAsString() != arguments[i].getValueAsString()) {
798 return MinitScript::OPERATOR_EQUALS;
812 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
813 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
814 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
816 MinitScript::TYPE_BOOLEAN
818 minitScript(minitScript) {}
819 const string getMethodName()
override {
823 if (arguments.size() == 2 || arguments.size() == 3) {
825 for (
auto i = 1; i < 2; i++) {
826 if (arguments[0].getValueAsString() == arguments[i].getValueAsString()) {
836 return MinitScript::OPERATOR_NOTEQUAL;
851 { .type = MinitScript::TYPE_INTEGER, .name =
"integer", .optional =
false, .reference =
false, .nullable =
false }
853 MinitScript::TYPE_INTEGER
855 minitScript(minitScript) {}
856 const string getMethodName()
override {
860 int64_t integerValue;
861 if (arguments.size() == 1 &&
862 MinitScript::getIntegerValue(arguments, 0, integerValue) ==
true) {
882 { .type = MinitScript::TYPE_FLOAT, .name =
"float", .optional =
false, .reference =
false, .nullable =
false }
884 MinitScript::TYPE_FLOAT
886 minitScript(minitScript) {}
887 const string getMethodName()
override {
892 if (arguments.size() == 1 &&
893 MinitScript::getFloatValue(arguments, 0, floatValue) ==
true) {
911 { .type = MinitScript::TYPE_FLOAT, .name =
"float", .optional =
false, .reference =
false, .nullable =
false }
913 MinitScript::TYPE_INTEGER
915 minitScript(minitScript) {}
916 const string getMethodName()
override {
917 return "float.toIntegerValue";
921 if (arguments.size() == 1 &&
922 MinitScript::getFloatValue(arguments, 0, floatValue) ==
true) {
923 returnValue.
setValue(
static_cast<int64_t
>(*((uint32_t*)&floatValue)));
929 minitScript->
registerMethod(
new MethodFloatToIntValue(minitScript));
940 { .type = MinitScript::TYPE_INTEGER, .name =
"integer", .optional =
false, .reference =
false, .nullable =
false }
942 MinitScript::TYPE_FLOAT
944 minitScript(minitScript) {}
945 const string getMethodName()
override {
946 return "float.fromIntegerValue";
950 if (arguments.size() == 1 &&
951 MinitScript::getIntegerValue(arguments, 0, intValue) ==
true) {
952 returnValue.
setValue(*((
float*)&intValue));
958 minitScript->
registerMethod(
new MethodFloatfromIntValue(minitScript));
970 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
971 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
972 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
974 MinitScript::TYPE_BOOLEAN),
975 minitScript(minitScript) {}
976 const string getMethodName()
override {
980 if (arguments.size() == 2 || arguments.size() == 3) {
981 if (MinitScript::hasTypeForOperatorArguments(arguments, MinitScript::TYPE_STRING) ==
true) {
984 if (MinitScript::getStringValue(arguments, 0, stringValueA,
false) ==
true &&
985 MinitScript::getStringValue(arguments, 1, stringValueB,
false) ==
true) {
986 returnValue.
setValue(stringValueA > stringValueB);
988 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
"Can not compare '" + arguments[0].getValueAsString() +
"' with '" + arguments[1].getValueAsString() +
"'");
993 if (MinitScript::getFloatValue(arguments, 0, floatValueA,
false) ==
true &&
994 MinitScript::getFloatValue(arguments, 1, floatValueB,
false) ==
true) {
995 returnValue.
setValue(floatValueA > floatValueB);
997 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
"Can not compare '" + arguments[0].getValueAsString() +
"' with '" + arguments[1].getValueAsString() +
"'");
1005 return MinitScript::OPERATOR_GREATER;
1019 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
1020 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
1021 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1023 MinitScript::TYPE_BOOLEAN),
1024 minitScript(minitScript) {}
1025 const string getMethodName()
override {
1026 return "greaterEquals";
1029 if (arguments.size() == 2 || arguments.size() == 3) {
1030 if (MinitScript::hasTypeForOperatorArguments(arguments, MinitScript::TYPE_STRING) ==
true) {
1031 string stringValueA;
1032 string stringValueB;
1033 if (MinitScript::getStringValue(arguments, 0, stringValueA,
false) ==
true &&
1034 MinitScript::getStringValue(arguments, 1, stringValueB,
false) ==
true) {
1035 returnValue.
setValue(stringValueA >= stringValueB);
1037 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
"Can not compare '" + arguments[0].getValueAsString() +
"' with '" + arguments[1].getValueAsString() +
"'");
1042 if (MinitScript::getFloatValue(arguments, 0, floatValueA,
false) ==
true &&
1043 MinitScript::getFloatValue(arguments, 1, floatValueB,
false) ==
true) {
1044 returnValue.
setValue(floatValueA >= floatValueB);
1046 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
"Can not compare '" + arguments[0].getValueAsString() +
"' with '" + arguments[1].getValueAsString() +
"'");
1054 return MinitScript::OPERATOR_GREATEREQUALS;
1057 minitScript->
registerMethod(
new MethodGreaterEquals(minitScript));
1068 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
1069 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
1070 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1072 MinitScript::TYPE_BOOLEAN),
1073 minitScript(minitScript) {}
1074 const string getMethodName()
override {
1078 if (arguments.size() == 2 || arguments.size() == 3) {
1079 if (MinitScript::hasTypeForOperatorArguments(arguments, MinitScript::TYPE_STRING) ==
true) {
1080 string stringValueA;
1081 string stringValueB;
1082 if (MinitScript::getStringValue(arguments, 0, stringValueA,
false) ==
true &&
1083 MinitScript::getStringValue(arguments, 1, stringValueB,
false) ==
true) {
1084 returnValue.
setValue(stringValueA < stringValueB);
1086 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
"Can not compare '" + arguments[0].getValueAsString() +
"' with '" + arguments[1].getValueAsString() +
"'");
1091 if (MinitScript::getFloatValue(arguments, 0, floatValueA,
false) ==
true &&
1092 MinitScript::getFloatValue(arguments, 1, floatValueB,
false) ==
true) {
1093 returnValue.
setValue(floatValueA < floatValueB);
1095 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
"Can not compare '" + arguments[0].getValueAsString() +
"' with '" + arguments[1].getValueAsString() +
"'");
1103 return MinitScript::OPERATOR_LESSER;
1117 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
1118 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
1119 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1121 MinitScript::TYPE_BOOLEAN),
1122 minitScript(minitScript) {}
1123 const string getMethodName()
override {
1124 return "lesserEquals";
1127 if (arguments.size() == 2 || arguments.size() == 3) {
1128 if (MinitScript::hasTypeForOperatorArguments(arguments, MinitScript::TYPE_STRING) ==
true) {
1129 string stringValueA;
1130 string stringValueB;
1131 if (MinitScript::getStringValue(arguments, 0, stringValueA,
false) ==
true &&
1132 MinitScript::getStringValue(arguments, 1, stringValueB,
false) ==
true) {
1133 returnValue.
setValue(stringValueA <= stringValueB);
1135 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
"Can not compare '" + arguments[0].getValueAsString() +
"' with '" + arguments[1].getValueAsString() +
"'");
1140 if (MinitScript::getFloatValue(arguments, 0, floatValueA,
false) ==
true &&
1141 MinitScript::getFloatValue(arguments, 1, floatValueB,
false) ==
true) {
1142 returnValue.
setValue(floatValueA <= floatValueB);
1144 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
"Can not compare '" + arguments[0].getValueAsString() +
"' with '" + arguments[1].getValueAsString() +
"'");
1152 return MinitScript::OPERATOR_LESSEREQUALS;
1155 minitScript->
registerMethod(
new MethodLesserEquals(minitScript));
1167 { .type = MinitScript::TYPE_BOOLEAN, .name =
"boolean", .optional =
false, .reference =
false, .nullable =
false }
1169 MinitScript::TYPE_BOOLEAN
1171 minitScript(minitScript) {}
1172 const string getMethodName()
override {
1177 if (arguments.size() == 1 &&
1178 MinitScript::getBooleanValue(arguments, 0, booleanValue) ==
true) {
1179 returnValue.
setValue(booleanValue);
1196 { .type = MinitScript::TYPE_BOOLEAN, .name =
"boolean", .optional =
false, .reference =
false, .nullable =
false },
1197 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1199 MinitScript::TYPE_BOOLEAN), minitScript(minitScript) {}
1200 const string getMethodName()
override {
1204 bool booleanValue =
false;
1205 if ((arguments.size() == 1 || arguments.size() == 2) &&
1206 MinitScript::getBooleanValue(arguments, 0, booleanValue) ==
true) {
1207 returnValue.
setValue(!booleanValue);
1209 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 1, getMethodName()),
"'" + arguments[0].getValueAsString() +
"' is not a boolean value");
1213 return MinitScript::OPERATOR_NOT;
1227 { .type = MinitScript::TYPE_BOOLEAN, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
1228 { .type = MinitScript::TYPE_BOOLEAN, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
1229 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1231 MinitScript::TYPE_BOOLEAN
1233 minitScript(minitScript) {}
1234 const string getMethodName()
override {
1240 auto isBooleanValueA = MinitScript::getBooleanValue(arguments, 0, booleanValueA);
1241 auto isBooleanValueB = MinitScript::getBooleanValue(arguments, 1, booleanValueB);
1243 if ((arguments.size() == 2 || arguments.size() == 3) &&
1244 isBooleanValueA ==
true &&
1245 isBooleanValueB ==
true) {
1246 returnValue.
setValue(booleanValueA && booleanValueB);
1248 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
string(isBooleanValueA ==
false?
"Left argument '" + arguments[0].getValueAsString() +
"' is not a boolean value":
"") +
string(isBooleanValueB ==
false?
string(isBooleanValueA ==
false?
" and right argument":
"Right argument") +
" '" + arguments[1].getValueAsString() +
"' is not a boolean value":
""));
1252 return MinitScript::OPERATOR_AND;
1266 { .type = MinitScript::TYPE_BOOLEAN, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
1267 { .type = MinitScript::TYPE_BOOLEAN, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
1268 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1270 MinitScript::TYPE_BOOLEAN
1272 minitScript(minitScript) {}
1273 const string getMethodName()
override {
1279 auto isBooleanValueA = MinitScript::getBooleanValue(arguments, 0, booleanValueA);
1280 auto isBooleanValueB = MinitScript::getBooleanValue(arguments, 1, booleanValueB);
1282 if ((arguments.size() == 2 || arguments.size() == 3) &&
1283 isBooleanValueA ==
true &&
1284 isBooleanValueB ==
true) {
1285 returnValue.
setValue(booleanValueA || booleanValueB);
1287 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
string(isBooleanValueA ==
false?
"Left argument '" + arguments[0].getValueAsString() +
"' is not a boolean value":
"") +
string(isBooleanValueB ==
false?
string(isBooleanValueA ==
false?
" and right argument":
"Right argument") +
" '" + arguments[1].getValueAsString() +
"' is not a boolean value":
""));
1291 return MinitScript::OPERATOR_OR;
1306 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false }
1308 MinitScript::TYPE_STRING
1310 minitScript(minitScript) {}
1311 const string getMethodName()
override {
1315 if (arguments.size() == 1) {
1316 returnValue.
setValue(arguments[0].getTypeAsString());
1334 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false }
1336 MinitScript::TYPE_BOOLEAN
1338 minitScript(minitScript) {}
1339 const string getMethodName()
override {
1340 return "isConstant";
1343 if (arguments.size() == 1) {
1344 returnValue.
setValue(arguments[0].isConstant());
1362 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false }
1364 MinitScript::TYPE_BOOLEAN
1366 minitScript(minitScript) {}
1367 const string getMethodName()
override {
1368 return "isReference";
1371 if (arguments.size() == 1) {
1372 returnValue.
setValue(arguments[0].isReference());
1390 { .type = MinitScript::TYPE_STRING, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false }
1392 MinitScript::TYPE_BOOLEAN
1394 minitScript(minitScript) {}
1395 const string getMethodName()
override {
1396 return "hasVariable";
1400 if (arguments.size() == 1 &&
1401 MinitScript::getStringValue(arguments, 0, variable) ==
true) {
1420 { .type = MinitScript::TYPE_STRING, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false }
1422 MinitScript::TYPE_PSEUDO_MIXED
1424 minitScript(minitScript) {}
1425 const string getMethodName()
override {
1426 return "getVariable";
1430 if (arguments.size() == 1 &&
1431 MinitScript::getStringValue(arguments, 0, variable) ==
true) {
1432 returnValue = minitScript->
getVariable(variable, &subStatement);
1447 MethodGetMethodArgumentVariable(
MinitScript* minitScript):
1450 { .type = MinitScript::TYPE_STRING, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false }
1452 MinitScript::TYPE_PSEUDO_MIXED
1454 minitScript(minitScript) {}
1455 const string getMethodName()
override {
1456 return "getMethodArgumentVariable";
1460 if (arguments.size() == 1 &&
1461 MinitScript::getStringValue(arguments, 0, variable) ==
true) {
1467 bool isPrivate()
const override {
1471 minitScript->
registerMethod(
new MethodGetMethodArgumentVariable(minitScript));
1480 MethodGetVariableReference(
MinitScript* minitScript):
1483 { .type = MinitScript::TYPE_STRING, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false }
1485 MinitScript::TYPE_PSEUDO_MIXED
1487 minitScript(minitScript) {}
1488 const string getMethodName()
override {
1489 return "getVariableReference";
1493 if (arguments.size() == 1 &&
1494 MinitScript::getStringValue(arguments, 0, variable) ==
true) {
1495 returnValue = minitScript->
getVariable(variable, &subStatement,
true);
1500 bool isPrivate()
const override {
1504 minitScript->
registerMethod(
new MethodGetVariableReference(minitScript));
1516 { .type = MinitScript::TYPE_STRING, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false },
1517 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"value", .optional =
false, .reference =
false, .nullable =
false },
1518 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1520 MinitScript::TYPE_PSEUDO_MIXED
1522 minitScript(minitScript) {
1525 const string getMethodName()
override {
1526 return "setVariable";
1530 if ((arguments.size() == 2 || arguments.size() == 3) &&
1531 MinitScript::getStringValue(arguments, 0, variable) ==
true) {
1532 minitScript->
setVariable(variable, arguments[1].isConstant() ==
true?MinitScript::Variable::createNonConstVariable(&arguments[1]):arguments[1], &subStatement);
1533 returnValue.
setValue(arguments[1]);
1539 return MinitScript::OPERATOR_SET;
1551 MethodSetVariableReference(
MinitScript* minitScript):
1554 { .type = MinitScript::TYPE_STRING, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false },
1555 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"value", .optional =
false, .reference =
true, .nullable =
false }
1557 MinitScript::TYPE_PSEUDO_MIXED
1559 minitScript(minitScript) {
1562 const string getMethodName()
override {
1563 return "setVariableReference";
1567 if (arguments.size() == 2 &&
1568 MinitScript::getStringValue(arguments, 0, variable) ==
true) {
1569 minitScript->
setVariable(variable, arguments[1], &subStatement,
true);
1570 returnValue.
setValue(arguments[1]);
1575 bool isPrivate()
const override {
1579 minitScript->
registerMethod(
new MethodSetVariableReference(minitScript));
1588 MethodUnsetVariableReference(
MinitScript* minitScript):
1591 { .type = MinitScript::TYPE_STRING, .name =
"variable", .optional =
false, .reference =
false, .nullable =
false }
1594 minitScript(minitScript) {}
1595 const string getMethodName()
override {
1596 return "unsetVariableReference";
1600 if (arguments.size() == 1 &&
1601 MinitScript::getStringValue(arguments, 0, variable) ==
true) {
1607 bool isPrivate()
const override {
1611 minitScript->
registerMethod(
new MethodUnsetVariableReference(minitScript));
1623 { .type = MinitScript::TYPE_STRING, .name =
"constant", .optional =
false, .reference =
false, .nullable =
false },
1624 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"value", .optional =
false, .reference =
false, .nullable =
false }
1626 MinitScript::TYPE_PSEUDO_MIXED
1628 minitScript(minitScript) {
1631 const string getMethodName()
override {
1632 return "setConstant";
1636 if (arguments.size() == 2 &&
1637 MinitScript::getStringValue(arguments, 0, constant) ==
true) {
1638 MinitScript::setConstant(arguments[1]);
1639 minitScript->
setVariable(constant, arguments[1], &subStatement);
1640 returnValue.
setValue(arguments[1]);
1657 { .type = MinitScript::TYPE_INTEGER, .name =
"variable", .optional =
false, .reference =
true, .nullable =
false },
1658 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1660 MinitScript::TYPE_INTEGER
1662 minitScript(minitScript) {}
1663 const string getMethodName()
override {
1664 return "postfixIncrement";
1668 if ((arguments.size() == 1 || arguments.size() == 2) &&
1669 MinitScript::getIntegerValue(arguments, 0, value) ==
true) {
1670 arguments[0].setValue(value + 1);
1673 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 1, getMethodName()),
"'" + arguments[0].getValueAsString() +
"' is not a integer value");
1677 return MinitScript::OPERATOR_POSTFIX_INCREMENT;
1680 minitScript->
registerMethod(
new MethodPostfixIncrement(minitScript));
1691 { .type = MinitScript::TYPE_INTEGER, .name =
"variable", .optional =
false, .reference =
true, .nullable =
false },
1692 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1694 MinitScript::TYPE_INTEGER
1696 minitScript(minitScript) {}
1697 const string getMethodName()
override {
1698 return "postfixDecrement";
1702 if ((arguments.size() == 1 || arguments.size() == 2) &&
1703 MinitScript::getIntegerValue(arguments, 0, value) ==
true) {
1704 arguments[0].setValue(value - 1);
1707 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 1, getMethodName()),
"'" + arguments[0].getValueAsString() +
"' is not a integer value");
1711 return MinitScript::OPERATOR_POSTFIX_DECREMENT;
1714 minitScript->
registerMethod(
new MethodPostfixDecrement(minitScript));
1725 { .type = MinitScript::TYPE_INTEGER, .name =
"variable", .optional =
false, .reference =
true, .nullable =
false },
1726 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1728 MinitScript::TYPE_INTEGER
1730 minitScript(minitScript) {}
1731 const string getMethodName()
override {
1732 return "prefixIncrement";
1736 if ((arguments.size() == 1 || arguments.size() == 2) &&
1737 MinitScript::getIntegerValue(arguments, 0, value) ==
true) {
1739 arguments[0].setValue(value);
1742 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 1, getMethodName()),
"'" + arguments[0].getValueAsString() +
"' is not a integer value");
1746 return MinitScript::OPERATOR_PREFIX_INCREMENT;
1749 minitScript->
registerMethod(
new MethodPrefixIncrement(minitScript));
1760 { .type = MinitScript::TYPE_INTEGER, .name =
"variable", .optional =
false, .reference =
true, .nullable =
false },
1761 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1763 MinitScript::TYPE_INTEGER
1765 minitScript(minitScript) {}
1766 const string getMethodName()
override {
1767 return "prefixDecrement";
1771 if ((arguments.size() == 1 || arguments.size() == 2) &&
1772 MinitScript::getIntegerValue(arguments, 0, value) ==
true) {
1774 arguments[0].setValue(value);
1777 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 1, getMethodName()),
"'" + arguments[0].getValueAsString() +
"' is not a integer value");
1781 return MinitScript::OPERATOR_PREFIX_DECREMENT;
1784 minitScript->
registerMethod(
new MethodPrefixDecrement(minitScript));
1796 { .type = MinitScript::TYPE_INTEGER, .name =
"value", .optional =
false, .reference =
false, .nullable =
false },
1797 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1799 MinitScript::TYPE_INTEGER),
1800 minitScript(minitScript) {}
1801 const string getMethodName()
override {
1802 return "bitwiseNot";
1806 if ((arguments.size() == 1 || arguments.size() == 2) &&
1807 MinitScript::getIntegerValue(arguments, 0, value) ==
true) {
1810 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 1, getMethodName()),
"'" + arguments[0].getValueAsString() +
"' is not a integer value");
1814 return MinitScript::OPERATOR_BITWISENOT;
1828 { .type = MinitScript::TYPE_INTEGER, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
1829 { .type = MinitScript::TYPE_INTEGER, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
1830 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1832 MinitScript::TYPE_INTEGER),
1833 minitScript(minitScript) {}
1834 const string getMethodName()
override {
1835 return "bitwiseAnd";
1840 auto isValueAInteger = MinitScript::getIntegerValue(arguments, 0, valueA);
1841 auto isValueBInteger = MinitScript::getIntegerValue(arguments, 1, valueB);
1842 if ((arguments.size() == 2 || arguments.size() == 3) &&
1843 isValueAInteger ==
true &&
1844 isValueBInteger ==
true) {
1846 returnValue.
setValue(valueA & valueB);
1848 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
string(isValueAInteger ==
false?
"Left argument '" + arguments[0].getValueAsString() +
"' is not a integer value":
"") +
string(isValueBInteger ==
false?
string(isValueAInteger ==
false?
" and right argument":
"Right argument") +
" '" + arguments[1].getValueAsString() +
"' is not a integer value":
""));
1852 return MinitScript::OPERATOR_BITWISEAND;
1866 { .type = MinitScript::TYPE_INTEGER, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
1867 { .type = MinitScript::TYPE_INTEGER, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
1868 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1870 MinitScript::TYPE_INTEGER),
1871 minitScript(minitScript) {}
1872 const string getMethodName()
override {
1878 auto isValueAInteger = MinitScript::getIntegerValue(arguments, 0, valueA);
1879 auto isValueBInteger = MinitScript::getIntegerValue(arguments, 1, valueB);
1880 if ((arguments.size() == 2 || arguments.size() == 3) &&
1881 isValueAInteger ==
true &&
1882 isValueBInteger ==
true) {
1884 returnValue.
setValue(valueA | valueB);
1886 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
string(isValueAInteger ==
false?
"Left argument '" + arguments[0].getValueAsString() +
"' is not a integer value":
"") +
string(isValueBInteger ==
false?
string(isValueAInteger ==
false?
" and right argument":
"Right argument") +
" '" + arguments[1].getValueAsString() +
"' is not a integer value":
""));
1890 return MinitScript::OPERATOR_BITWISEOR;
1904 { .type = MinitScript::TYPE_INTEGER, .name =
"a", .optional =
false, .reference =
false, .nullable =
false },
1905 { .type = MinitScript::TYPE_INTEGER, .name =
"b", .optional =
false, .reference =
false, .nullable =
false },
1906 { .type = MinitScript::TYPE_INTEGER, .name =
"operator", .optional =
true, .reference =
false, .nullable =
false }
1908 MinitScript::TYPE_INTEGER),
1909 minitScript(minitScript) {}
1910 const string getMethodName()
override {
1911 return "bitwiseXor";
1916 auto isValueAInteger = MinitScript::getIntegerValue(arguments, 0, valueA);
1917 auto isValueBInteger = MinitScript::getIntegerValue(arguments, 1, valueB);
1918 if ((arguments.size() == 2 || arguments.size() == 3) &&
1919 isValueAInteger ==
true &&
1920 isValueBInteger ==
true) {
1922 returnValue.
setValue(valueA ^ valueB);
1924 MINITSCRIPT_METHODUSAGE_COMPLAINOM(getMethodName(), MinitScript::decodeOperator(arguments, 2, getMethodName()),
string(isValueAInteger ==
false?
"Left argument '" + arguments[0].getValueAsString() +
"' is not a integer value":
"") +
string(isValueBInteger ==
false?
string(isValueAInteger ==
false?
" and right argument":
"Right argument") +
" '" + arguments[1].getValueAsString() +
"' is not a integer value":
""));
1928 return MinitScript::OPERATOR_BITWISEXOR;
1943 { .type = MinitScript::TYPE_INTEGER, .name =
"value", .optional =
false, .reference =
false, .nullable =
false }
1945 MinitScript::TYPE_STRING
1947 minitScript(minitScript) {}
1948 const string getMethodName()
override {
1949 return "hex.encode";
1953 if (arguments.size() == 1 &&
1954 MinitScript::getIntegerValue(arguments, 0, value) ==
true) {
1972 { .type = MinitScript::TYPE_STRING, .name =
"value", .optional =
false, .reference =
false, .nullable =
false }
1974 MinitScript::TYPE_INTEGER
1976 minitScript(minitScript) {}
1977 const string getMethodName()
override {
1978 return "hex.decode";
1982 if (arguments.size() == 1 &&
1983 MinitScript::getStringValue(arguments, 0, value) ==
true) {
2001 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"a", .optional =
false, .reference =
true, .nullable =
false },
2002 { .type = MinitScript::TYPE_PSEUDO_MIXED, .name =
"b", .optional =
false, .reference =
true, .nullable =
false }
2005 minitScript(minitScript) {}
2006 const string getMethodName()
override {
2010 if (arguments.size() == 2) {
2011 MinitScript::Variable::swap(arguments[0], arguments[1]);
2025 ConcurrencyGetHardwareThreadCountMethod(
MinitScript* minitScript):
2028 MinitScript::TYPE_INTEGER
2030 minitScript(minitScript) {}
2031 const string getMethodName()
override {
2032 return "concurrency.getHardwareThreadCount";
2035 if (arguments.empty() ==
true) {
2042 minitScript->
registerMethod(
new ConcurrencyGetHardwareThreadCountMethod(minitScript));
#define MINITSCRIPT_METHODUSAGE_COMPLAINOM(methodName, operatorString, message)
#define MINITSCRIPT_METHODUSAGE_COMPLAINM(methodName, message)
#define MINITSCRIPT_METHODUSAGE_COMPLAIN(methodName)
MinitScript script base methods.
void setValue(const Variable &variable)
Set value from given variable into variable.
const Variable getMapEntry(const string &key) const
Get entry from map with given key.
void registerMethod(Method *method)
Register method.
int getFunctionScriptIdx(const string &function)
Return function script index by function name.
void gotoStatementGoto(const Statement &statement)
Go to statement goto from given statement.
bool call(int scriptIdx, span< Variable > &arguments, Variable &returnValue, bool pushScriptState)
Call function.
static bool getBooleanValue(const span< Variable > &arguments, int idx, bool &value, bool optional=false)
Get boolean value from given variable.
static void setConstant(Variable &variable)
Set variable recursively to be a constant.
bool callStacklet(int scriptIdx, span< Variable > &arguments, Variable &returnValue)
Call stacklet.
bool hasVariable(const string &variableStatement, const SubStatement *subStatement=nullptr)
Returns if variable determined by given variable statement exists.
const Variable getMethodArgumentVariable(const string &variableStatement, const SubStatement *subStatement=nullptr)
Returns variable determined by given variable statement optimized for method argument usage.
static bool getStringValue(const span< Variable > &arguments, int idx, string &value, bool optional=false)
Get string value from given variable.
const string getSubStatementInformation(const SubStatement &subStatement)
Return sub statement information.
void unsetVariable(Variable *variablePtr, const string &variableStatement, const SubStatement *subStatement=nullptr)
Unsets variable determined by given variable statement and variable pointer.
const Variable getVariable(const string &variableStatement, const SubStatement *subStatement=nullptr, bool createReference=false)
Returns variable determined by given variable statement.
Method * getMethod(const string &methodName)
Get method by method name.
void gotoStatement(const Statement &statement)
Go to statement.
void stopRunning()
Set running flag to false.
void setVariable(const string &variableStatement, const Variable &variable, const SubStatement *subStatement=nullptr, bool createReference=false)
Set variable by given variable statement and variable.
ScriptState & getScriptState()
static bool getStackletValue(const span< Variable > &arguments, int idx, string &stacklet, int &scriptIdx, bool optional=false)
Get stacklet value from given variable.
const vector< Script > & getScripts()
static bool getIntegerValue(const span< Variable > &arguments, int idx, int64_t &value, bool optional=false)
Get integer value from given variable.
static int getHardwareThreadCount()
static void printLine()
Print newline to console.
Integer to hex string conversion utility class.
static uint64_t decodeInt(const string &encodedString)
Decodes a hex string representation to an 64 bit unsigned integer.
static const string encodeInt(const uint64_t decodedInt)
Encodes an 64 bit unsigned integer to a hex string representation.
static int64_t getCurrentMillis()
Retrieve current time in milliseconds.
const Statement * breakStatement
const Statement * continueStatement
vector< Block > blockStack
unordered_map< int, int64_t > forTimeStarted
const Statement * statement