mirror of
https://github.com/CPunch/Cosmo.git
synced 2026-02-08 11:40:03 +00:00
cvm.c:cosmoV_printError -> cosmoV_printBacktrace
This commit is contained in:
12
main.c
12
main.c
@@ -50,13 +50,11 @@ static bool interpret(CState *state, const char *script, const char *mod)
|
||||
|
||||
// cosmoV_compileString pushes the result onto the stack (COBJ_ERROR or COBJ_CLOSURE)
|
||||
if (cosmoV_compileString(state, script, mod)) {
|
||||
// 0 args being passed, 0 results expected
|
||||
if (!cosmoV_pcall(state, 0, 0)) {
|
||||
cosmoV_printError(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
cosmoV_printBacktrace(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cosmoV_printError(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
cosmoV_printBacktrace(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -158,7 +156,7 @@ void compileScript(CState *state, const char *in, const char *out)
|
||||
CObjFunction *func = cosmoV_readClosure(*cosmoV_getTop(state, 0))->function;
|
||||
cosmoD_dump(state, func, fileWriter, (void *)fout);
|
||||
} else {
|
||||
cosmoV_printError(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
cosmoV_printBacktrace(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
}
|
||||
|
||||
free(script);
|
||||
@@ -171,13 +169,13 @@ void loadScript(CState *state, const char *in)
|
||||
{
|
||||
FILE *file = fopen(in, "rb");
|
||||
if (!cosmoV_undump(state, fileReader, file)) {
|
||||
cosmoV_printError(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
cosmoV_printBacktrace(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
return;
|
||||
};
|
||||
|
||||
printf("[!] loaded %s!\n", in);
|
||||
if (!cosmoV_pcall(state, 0, 0))
|
||||
cosmoV_printError(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
cosmoV_printBacktrace(state, cosmoV_readError(*cosmoV_pop(state)));
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user