Преглед на файлове

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

main
Ludovic 'Archivist' Lagouardette преди 6 месеца
родител
ревизия
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

Зареждане…
Отказ
Запис