|
@ -778,7 +778,7 @@ int ink_step(struct context *pContext) { |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ink_compile(struct context *pContext, const char* buffer) { |
|
|
|
|
|
|
|
|
int ink_compile(struct context *pContext, const char* buffer) { |
|
|
int routine, saved, executable_buffer_top; |
|
|
int routine, saved, executable_buffer_top; |
|
|
/* Main function has a size limit of 256 (need to know that for REPL */ |
|
|
/* Main function has a size limit of 256 (need to know that for REPL */ |
|
|
struct elem executable_buffer[256]; |
|
|
struct elem executable_buffer[256]; |
|
@ -799,13 +799,13 @@ void ink_compile(struct context *pContext, const char* buffer) { |
|
|
err = ink_lex(pContext, buffer); |
|
|
err = ink_lex(pContext, buffer); |
|
|
if(err < 0) { |
|
|
if(err < 0) { |
|
|
pContext->panic = 1; |
|
|
pContext->panic = 1; |
|
|
return; |
|
|
|
|
|
|
|
|
return -1; |
|
|
} |
|
|
} |
|
|
executable_buffer_top = 0; |
|
|
executable_buffer_top = 0; |
|
|
err = ink_parse(pContext, executable_buffer, &executable_buffer_top); |
|
|
err = ink_parse(pContext, executable_buffer, &executable_buffer_top); |
|
|
if(err < 0) { |
|
|
if(err < 0) { |
|
|
pContext->panic = 1; |
|
|
pContext->panic = 1; |
|
|
return; |
|
|
|
|
|
|
|
|
return -1; |
|
|
} |
|
|
} |
|
|
if(executable_buffer_top != 0) { |
|
|
if(executable_buffer_top != 0) { |
|
|
integer = ink_itoa(pContext, routine); |
|
|
integer = ink_itoa(pContext, routine); |
|
@ -816,7 +816,7 @@ void ink_compile(struct context *pContext, const char* buffer) { |
|
|
frame.executing.value = ink_add_indigenous(pContext, main_fn, executable_buffer, executable_buffer_top); |
|
|
frame.executing.value = ink_add_indigenous(pContext, main_fn, executable_buffer, executable_buffer_top); |
|
|
if (frame.executing.value < 0) { |
|
|
if (frame.executing.value < 0) { |
|
|
pContext->panic = 1; |
|
|
pContext->panic = 1; |
|
|
return; |
|
|
|
|
|
|
|
|
return -1; |
|
|
} |
|
|
} |
|
|
frame.executing.type = INK_FUNCTION; |
|
|
frame.executing.type = INK_FUNCTION; |
|
|
frame.index = 0; |
|
|
frame.index = 0; |
|
@ -824,14 +824,14 @@ void ink_compile(struct context *pContext, const char* buffer) { |
|
|
pContext->routines[pContext->routine_current].top = 0; |
|
|
pContext->routines[pContext->routine_current].top = 0; |
|
|
if (err < 0) { |
|
|
if (err < 0) { |
|
|
pContext->panic = 1; |
|
|
pContext->panic = 1; |
|
|
return; |
|
|
|
|
|
|
|
|
return -1; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
pContext->routines[pContext->routine_current].panic = INK_ROUTINE_SUCCESS; |
|
|
pContext->routines[pContext->routine_current].panic = INK_ROUTINE_SUCCESS; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
pContext->routine_current = saved; |
|
|
pContext->routine_current = saved; |
|
|
return; |
|
|
|
|
|
|
|
|
return routine; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int ink_can_run(struct context* pContext) { |
|
|
int ink_can_run(struct context* pContext) { |
|
|