mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2024-11-22 11:56:42 +00:00
add break
This commit is contained in:
parent
91af9b4437
commit
0bef41c033
5 changed files with 28 additions and 6 deletions
|
@ -113,9 +113,15 @@ ClassFunction(arrayForEach) {
|
|||
iter->gcDoNotFree = 1;
|
||||
|
||||
Variable_t* res = genericCallDirect(args[1], NULL, 0);
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
if (scriptLastError == SCRIPT_BREAK) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iter->reference = 1;
|
||||
free(iter);
|
||||
|
|
|
@ -420,7 +420,6 @@ ParserRet_t parseScript(char* in) {
|
|||
|
||||
op.token = EquationSeperator;
|
||||
op.lineNumber = lineNumber;
|
||||
vecAdd(&lastFunc->operations, op);
|
||||
}
|
||||
else {
|
||||
SCRIPT_PARSER_ERR("Stack count is 1 or state is not a function");
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
#include <stdarg.h>
|
||||
|
||||
s64 scriptCurrentLine;
|
||||
u8 scriptLastError = 0;
|
||||
|
||||
void printScriptError(u8 errLevel, char* message, ...) {
|
||||
va_list args;
|
||||
|
||||
scriptLastError = errLevel;
|
||||
va_start(args, message);
|
||||
gfx_printf("\n\n[%s] ", (errLevel == SCRIPT_FATAL) ? "FATAL" : (errLevel == SCRIPT_PARSER_FATAL) ? "PARSE_FATAL" : "WARN");
|
||||
gfx_vprintf(message, args);
|
||||
|
|
|
@ -5,9 +5,11 @@ enum {
|
|||
SCRIPT_FATAL = 0,
|
||||
SCRIPT_PARSER_FATAL,
|
||||
SCRIPT_WARN,
|
||||
SCRIPT_BREAK,
|
||||
};
|
||||
|
||||
extern s64 scriptCurrentLine;
|
||||
extern u8 scriptLastError;
|
||||
|
||||
void printScriptError(u8 errLevel, char* message, ...);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "garbageCollector.h"
|
||||
#include "intClass.h"
|
||||
#include "standardLibrary.h"
|
||||
#include "scriptError.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifndef WIN32
|
||||
|
@ -37,8 +38,14 @@ ClassFunction(stdWhile) {
|
|||
while (result->integer.value) {
|
||||
removePendingReference(result);
|
||||
Variable_t* res = genericCallDirect(args[1], NULL, 0);
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
if (scriptLastError == SCRIPT_BREAK) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
removePendingReference(res);
|
||||
|
||||
|
@ -67,6 +74,11 @@ ClassFunction(stdExit) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ClassFunction(stdBreak) {
|
||||
scriptLastError = SCRIPT_BREAK;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
ClassFunction(stdMountSysmmc){
|
||||
if (connectMMC(MMC_CONN_EMMC))
|
||||
|
@ -108,6 +120,7 @@ enum standardFunctionIndexes {
|
|||
STD_MOUNTSYSMMC,
|
||||
STD_MOUNTSAVE,
|
||||
STD_EXIT,
|
||||
STD_BREAK,
|
||||
};
|
||||
|
||||
u8 oneIntoneFunction[] = { IntClass, FunctionClass };
|
||||
|
@ -121,6 +134,7 @@ ClassFunctionTableEntry_t standardFunctionDefenitions[] = {
|
|||
[STD_MOUNTSYSMMC] = {"mountsys", stdMountSysmmc, 1, oneStringArgStd},
|
||||
[STD_MOUNTSAVE] = {"readsave", stdMountSave, 1, oneStringArgStd},
|
||||
[STD_EXIT] = {"exit", stdExit, 0, 0},
|
||||
[STD_BREAK] = {"break", stdBreak, 0, 0},
|
||||
};
|
||||
|
||||
ClassFunctionTableEntry_t* searchStdLib(char* funcName) {
|
||||
|
|
Loading…
Reference in a new issue