Przeglądaj źródła

Removed the flags mentioned in the previous commit

main
Ludovic 'Archivist' Lagouardette 1 miesiąc temu
rodzic
commit
d18fa1f3f2
2 zmienionych plików z 0 dodań i 27 usunięć
  1. +0
    -6
      CMakeLists.txt
  2. +0
    -21
      lib.c

+ 0
- 6
CMakeLists.txt Wyświetl plik

@ -10,12 +10,6 @@ add_library(ink lib.c include/ink.h)
# Uncomment to disable the redundant arithmetic # Uncomment to disable the redundant arithmetic
# add_definitions(-DNOEXTRAARITHMETIC) # add_definitions(-DNOEXTRAARITHMETIC)
# Uncomment to disable array types
# add_definitions(-DNOARRAYLIB)
# Uncomment to disable string literal
# add_definitions(-DNOSTRINGLITERALS)
# Ensures the interpreter doesn't use the standard C library functions # Ensures the interpreter doesn't use the standard C library functions
# add_definitions(-DNOSTDLIB) # add_definitions(-DNOSTDLIB)

+ 0
- 21
lib.c Wyświetl plik

@ -52,15 +52,12 @@ struct label {
static void noop(void) {} static void noop(void) {}
#ifndef NOSTRINGLITERALS
static void new_protected_array(struct context* ctx); static void new_protected_array(struct context* ctx);
static void new_array(struct context* ctx); static void new_array(struct context* ctx);
int array_push_s(struct context* ctx, struct ink_array* ary, struct elem value); int array_push_s(struct context* ctx, struct ink_array* ary, struct elem value);
static void print_array_of_codepoints(struct context* ctx); static void print_array_of_codepoints(struct context* ctx);
static void collect_array(struct context* ctx, void* array); static void collect_array(struct context* ctx, void* array);
static struct ink_collection_list gc_array(struct context* ctx, void* array); static struct ink_collection_list gc_array(struct context* ctx, void* array);
#endif
#ifdef NOSTDLIB #ifdef NOSTDLIB
@ -563,7 +560,6 @@ static int ink_consume_one(int* end, struct context* pContext, char* r, int is_s
const char* name_it; const char* name_it;
struct elem character; struct elem character;
struct ink_array ary; struct ink_array ary;
#ifndef NOSTRINGLITERALS
if(is_str) { if(is_str) {
struct ink_routine* routine = pContext->routines + pContext->routine_current; struct ink_routine* routine = pContext->routines + pContext->routine_current;
struct ink_array* ary; struct ink_array* ary;
@ -591,7 +587,6 @@ static int ink_consume_one(int* end, struct context* pContext, char* r, int is_s
*end = 0; *end = 0;
return 0; return 0;
} }
#endif
(void)(is_str); (void)(is_str);
if(*end == 0) { if(*end == 0) {
return 0; return 0;
@ -712,16 +707,11 @@ static int ink_lex(struct context *pContext, const char* buffer) {
char r[128]; char r[128];
int end; int end;
int err; int err;
#ifndef NOSTRINGLITERALS
int parses_string; int parses_string;
#endif
end = 0; end = 0;
restart_after_comment: restart_after_comment:
#ifndef NOSTRINGLITERALS
parses_string = 0; parses_string = 0;
#endif
while(*buffer != 0) { while(*buffer != 0) {
#ifndef NOSTRINGLITERALS
if(parses_string) { if(parses_string) {
switch(*buffer) { switch(*buffer) {
case '"': { case '"': {
@ -753,7 +743,6 @@ static int ink_lex(struct context *pContext, const char* buffer) {
++end; ++end;
} }
} else /* go on parsing something else if it is not a string, like this to be able to disable strings */ } else /* go on parsing something else if it is not a string, like this to be able to disable strings */
#endif
if(isspace(*buffer)) { if(isspace(*buffer)) {
if(end == 1 && r[0] == '#') { if(end == 1 && r[0] == '#') {
while(*buffer != '\n' && *buffer != 0) { while(*buffer != '\n' && *buffer != 0) {
@ -771,11 +760,9 @@ static int ink_lex(struct context *pContext, const char* buffer) {
} }
#endif #endif
} else /* ... */ } else /* ... */
#ifndef NOSTRINGLITERALS
if(end == 0 && *buffer == '"' && !parses_string) { if(end == 0 && *buffer == '"' && !parses_string) {
parses_string = 1; parses_string = 1;
} else /* ... */ } else /* ... */
#endif
{ {
r[end] = *buffer; r[end] = *buffer;
++end; ++end;
@ -2216,8 +2203,6 @@ static struct ink_collection_list gc_noop(struct context* ctx, void* array) {
return c; return c;
} }
#ifndef NOARRAYLIB
static void collect_array(struct context* ctx, void* array) { static void collect_array(struct context* ctx, void* array) {
struct ink_array* ary; struct ink_array* ary;
ary = array; ary = array;
@ -2250,7 +2235,6 @@ static void new_array(struct context* ctx) {
ink_push(ctx, e); ink_push(ctx, e);
} }
#ifndef NOSTRINGLITERALS
static void new_protected_array(struct context* ctx) { static void new_protected_array(struct context* ctx) {
int tid; int tid;
struct elem e; struct elem e;
@ -2262,7 +2246,6 @@ static void new_protected_array(struct context* ctx) {
e = ink_make_native_unsafe(ctx, tid, &ary, 1); e = ink_make_native_unsafe(ctx, tid, &ary, 1);
ink_push(ctx, e); ink_push(ctx, e);
} }
#endif
static void push_array_stack_delim(struct context* ctx) { static void push_array_stack_delim(struct context* ctx) {
int tid; int tid;
@ -2581,8 +2564,6 @@ static void arrayify_stack(struct context* ctx) {
return; return;
} }
#endif /* NOARRAYLIB */
int ink_std_library(struct context* ctx) { int ink_std_library(struct context* ctx) {
int v; int v;
v = 0; v = 0;
@ -2613,7 +2594,6 @@ int ink_std_library(struct context* ctx) {
v += ink_add_native(ctx, "%", rem_int); v += ink_add_native(ctx, "%", rem_int);
v += ink_add_native(ctx, "int.xor", xor_int); v += ink_add_native(ctx, "int.xor", xor_int);
#endif /* NOEXTRAARITHMETIC */ #endif /* NOEXTRAARITHMETIC */
#ifndef NOARRAYLIB
ink_new_type(ctx, "array_marker", 0, collect_noop, gc_noop); ink_new_type(ctx, "array_marker", 0, collect_noop, gc_noop);
v += ink_add_native(ctx, "[", push_array_stack_delim); v += ink_add_native(ctx, "[", push_array_stack_delim);
v += ink_add_native(ctx, "]", push_delimited_array); v += ink_add_native(ctx, "]", push_delimited_array);
@ -2625,7 +2605,6 @@ int ink_std_library(struct context* ctx) {
v += ink_add_native(ctx, "array.print_utf8", print_array_of_codepoints); 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, "is.array", is_array);
v += ink_add_native(ctx, "stack.to_array", arrayify_stack); v += ink_add_native(ctx, "stack.to_array", arrayify_stack);
#endif /* NOARRAYLIB */
return v; return v;
} }

Ładowanie…
Anuluj
Zapisz