瀏覽代碼

Do not make a routine for executables with no code to execute

main
Ludovic 'Archivist' Lagouardette 5 月之前
父節點
當前提交
80087bc851
共有 2 個文件被更改,包括 21 次插入17 次删除
  1. +20
    -16
      lib.c
  2. +1
    -1
      test/test01.nk

+ 20
- 16
lib.c 查看文件

@ -807,22 +807,26 @@ void ink_compile(struct context *pContext, const char* buffer) {
pContext->panic = 1;
return;
}
integer = ink_itoa(pContext, routine);
integer_size = strlen(integer);
memcpy(main_fn+10, integer, integer_size);
pContext->free(integer);
main_fn[10+integer_size] = 0;
frame.executing.value = ink_add_indigenous(pContext, main_fn, executable_buffer, executable_buffer_top);
if(frame.executing.value < 0) {
pContext->panic = 1;
return;
}
frame.executing.type = INK_FUNCTION;
frame.index = 0;
err = ink_push_fn(pContext, frame);
if(err < 0) {
pContext->panic = 1;
return;
if(executable_buffer_top != 0) {
integer = ink_itoa(pContext, routine);
integer_size = strlen(integer);
memcpy(main_fn + 10, integer, integer_size);
pContext->free(integer);
main_fn[10 + integer_size] = 0;
frame.executing.value = ink_add_indigenous(pContext, main_fn, executable_buffer, executable_buffer_top);
if (frame.executing.value < 0) {
pContext->panic = 1;
return;
}
frame.executing.type = INK_FUNCTION;
frame.index = 0;
err = ink_push_fn(pContext, frame);
if (err < 0) {
pContext->panic = 1;
return;
}
} else {
pContext->routines[pContext->routine_current].panic = INK_ROUTINE_SUCCESS;
}
pContext->routine_current = saved;

+ 1
- 1
test/test01.nk 查看文件

@ -71,4 +71,4 @@ fn string.dump do
# array end it
93 print_utf8
drop drop drop
end
end

Loading…
取消
儲存