|
|
@ -40,12 +40,18 @@ |
|
|
#define MAX_MAIN_SIZE 256 |
|
|
#define MAX_MAIN_SIZE 256 |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifndef INK_STEP_BATCH_COUNT |
|
|
|
|
|
#define INK_STEP_BATCH_COUNT 1 |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
struct label { |
|
|
struct label { |
|
|
int active; |
|
|
int active; |
|
|
int dest; |
|
|
int dest; |
|
|
char* name; |
|
|
char* name; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void noop(void) {} |
|
|
|
|
|
|
|
|
#ifdef NOSTDLIB |
|
|
#ifdef NOSTDLIB |
|
|
|
|
|
|
|
|
static size_t strlen(const char* c) { |
|
|
static size_t strlen(const char* c) { |
|
|
@ -436,15 +442,15 @@ static char* ink_itoa(struct context* _, int cpy) { |
|
|
|
|
|
|
|
|
#ifndef NOSTDLIB |
|
|
#ifndef NOSTDLIB |
|
|
static void* ink_malloc(struct context* _, size_t sz) { |
|
|
static void* ink_malloc(struct context* _, size_t sz) { |
|
|
_=_; |
|
|
|
|
|
|
|
|
(void)(_); |
|
|
return malloc(sz); |
|
|
return malloc(sz); |
|
|
} |
|
|
} |
|
|
static void* ink_realloc(struct context* _, void* ptr, size_t sz) { |
|
|
static void* ink_realloc(struct context* _, void* ptr, size_t sz) { |
|
|
_=_; |
|
|
|
|
|
|
|
|
(void)(_); |
|
|
return realloc(ptr, sz); |
|
|
return realloc(ptr, sz); |
|
|
} |
|
|
} |
|
|
static void ink_free(struct context* _, void* ptr) { |
|
|
static void ink_free(struct context* _, void* ptr) { |
|
|
_=_; |
|
|
|
|
|
|
|
|
(void)(_); |
|
|
free(ptr); |
|
|
free(ptr); |
|
|
} |
|
|
} |
|
|
static int ink_putchar(struct context* _, int c) { |
|
|
static int ink_putchar(struct context* _, int c) { |
|
|
@ -498,7 +504,7 @@ static int ink_consume_one(int* end, struct context* pContext, char* r, int is_s |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
is_str = is_str; |
|
|
|
|
|
|
|
|
(void)(is_str); |
|
|
if(*end == 0) { |
|
|
if(*end == 0) { |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
@ -986,7 +992,7 @@ static int ink_parse(struct context* pContext, struct elem* executable_buffer, i |
|
|
function_buffer_top += 1; |
|
|
function_buffer_top += 1; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
next_token: i=i; |
|
|
|
|
|
|
|
|
next_token: noop(); |
|
|
} |
|
|
} |
|
|
#ifndef NOEXTRACHECKS |
|
|
#ifndef NOEXTRACHECKS |
|
|
if(mode == MODE_FUNCTION || mode == MODE_DO) { |
|
|
if(mode == MODE_FUNCTION || mode == MODE_DO) { |
|
|
@ -2084,10 +2090,15 @@ static void dump_stack(struct context* ctx) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void collect_noop() {} |
|
|
|
|
|
|
|
|
static void collect_noop(struct context* ctx, void* array) { |
|
|
|
|
|
(void)(ctx); |
|
|
|
|
|
(void)(array); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static struct ink_collection_list gc_noop() { |
|
|
|
|
|
struct ink_collection_list c; |
|
|
|
|
|
|
|
|
static struct ink_collection_list gc_noop(struct context* ctx, void* array) { |
|
|
|
|
|
struct ink_collection_list c; |
|
|
|
|
|
(void)(ctx); |
|
|
|
|
|
(void)(array); |
|
|
c.elements = NULL; |
|
|
c.elements = NULL; |
|
|
c.count = 0; |
|
|
c.count = 0; |
|
|
return c; |
|
|
return c; |
|
|
@ -2235,7 +2246,7 @@ static void push_delimited_array(struct context* ctx) { |
|
|
/* Don't copy the delimiter */ |
|
|
/* Don't copy the delimiter */ |
|
|
idx -= 1; |
|
|
idx -= 1; |
|
|
|
|
|
|
|
|
ary->elements = malloc(sizeof(struct elem) * idx); |
|
|
|
|
|
|
|
|
ary->elements = ctx->malloc(ctx, sizeof(struct elem) * idx); |
|
|
#ifndef NOEXTRACHECKS |
|
|
#ifndef NOEXTRACHECKS |
|
|
if(ary->elements == NULL) { |
|
|
if(ary->elements == NULL) { |
|
|
currentRoutine->panic = -541; |
|
|
currentRoutine->panic = -541; |
|
|
@ -2507,3 +2518,7 @@ int ink_std_library(struct context* ctx) { |
|
|
|
|
|
|
|
|
return v; |
|
|
return v; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifdef INK_DUMMY_MAIN |
|
|
|
|
|
int main() {} |
|
|
|
|
|
#endif |