2 Ревизии

Автор SHA1 Съобщение Дата
  Ludovic 'Archivist' Lagouardette 3803deda06 Merge branch 'main' of https://git.nekoit.xyz/Archivist/ink преди 3 месеца
  Ludovic 'Archivist' Lagouardette 06dd262d05 fixed C89 incompatibilities, added the check to CMake преди 3 месеца
променени са 2 файла, в които са добавени 15 реда и са изтрити 12 реда
  1. +6
    -0
      CMakeLists.txt
  2. +9
    -12
      lib.c

+ 6
- 0
CMakeLists.txt Целия файл

@ -18,6 +18,12 @@ add_executable(ink_exe main.c)
target_link_libraries(ink_exe PUBLIC ink)
target_include_directories(ink PUBLIC include)
if(MSVC)
target_compile_options(ink PRIVATE /W4 /WX)
else()
target_compile_options(ink PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()
# Benchmark is broken since the addition to coroutines
# add_executable(ink_bench bench.c)
# target_link_libraries(ink_bench PUBLIC ink)

+ 9
- 12
lib.c Целия файл

@ -355,7 +355,7 @@ struct context* ink_make_default_context(void) {
}
#endif
static int ink_consume_one(int* end, struct context* pContext, char** buffer, char* r) {
static int ink_consume_one(int* end, struct context* pContext, char* r) {
int i;
int done;
struct elem value;
@ -471,7 +471,7 @@ restart_after_comment:
end = 0;
goto restart_after_comment;
}
err = ink_consume_one(&end, pContext, o">&buffer, r);
err = ink_consume_one(&end, pContext, r);
if(err < 0) {
pContext->panic = 1;
return -8;
@ -482,7 +482,7 @@ restart_after_comment:
}
++buffer;
}
err = ink_consume_one(&end, pContext, o">&buffer, r);
err = ink_consume_one(&end, pContext, r);
if(err < 0) {
pContext->panic = 1;
return -9;
@ -1328,7 +1328,7 @@ static void lte_int(struct context* ctx) {
currentRoutine->stack[currentRoutine->top-1].value = b.value <= a.value;
}
#endif p">// NOEXTRAARITHMETIC
#endif m">/* NOEXTRAARITHMETIC */
static void lt_int(struct context* ctx) {
struct ink_routine* currentRoutine;
@ -1559,9 +1559,9 @@ static void dump_stack(struct context* ctx) {
return;
}
static void collect_noop(k">struct context* _1, void* _2) {}
static void collect_noop() {}
static struct ink_collection_list gc_noop(k">struct context* _1, void* _2) {
static struct ink_collection_list gc_noop() {
struct ink_collection_list c;
c.elements = NULL;
c.count = 0;
@ -1668,7 +1668,6 @@ static void push_delimited_array(struct context* ctx) {
ary= ink_get_value(ctx, a);
for(idx = 1; idx <= currentRoutine->top; ++idx) {
struct elem maybe_delim;
if(currentRoutine->stack[currentRoutine->top-idx].type == tid) {
break;
}
@ -1816,7 +1815,6 @@ static void is_array(struct context* ctx) {
}
static void is_int(struct context* ctx) {
int tid;
struct ink_routine *currentRoutine;
struct elem a;
@ -1837,7 +1835,6 @@ static void print_array_of_codepoints(struct context* ctx) {
struct ink_routine *currentRoutine;
struct elem a;
struct ink_array *ary;
struct elem idx;
tid = get_type_by_name(ctx, "array");
currentRoutine = ctx->routines + ctx->routine_current;
@ -1886,7 +1883,7 @@ static void arrayify_stack(struct context* ctx) {
return;
}
#endif p">// NOARRAYLIB
#endif m">/* NOARRAYLIB */
int ink_std_library(struct context* ctx) {
int v;
@ -1917,7 +1914,7 @@ int ink_std_library(struct context* ctx) {
v += ink_add_native(ctx, "=<", lte_int);
v += ink_add_native(ctx, "%", rem_int);
v += ink_add_native(ctx, "int.xor", xor_int);
#endif p">// NOEXTRAARITHMETIC
#endif m">/* NOEXTRAARITHMETIC */
#ifndef NOARRAYLIB
ink_new_type(ctx, "array", sizeof(struct ink_array), collect_array, gc_array);
ink_new_type(ctx, "array_marker", 0, collect_noop, gc_noop);
@ -1931,7 +1928,7 @@ int ink_std_library(struct context* ctx) {
v += ink_add_native(ctx, "array.print_utf8", print_array_of_codepoints);
v += ink_add_native(ctx, "is.array", is_array);
v += ink_add_native(ctx, "stack.to_array", arrayify_stack);
#endif p">// NOARRAYLIB
#endif m">/* NOARRAYLIB */
return v;
}

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