Selaa lähdekoodia

Added a macro for stoopid libc that made putchar a macro

main
Ludovic 'Archivist' Lagouardette 2 kuukautta sitten
vanhempi
commit
702af1bdbf
2 muutettua tiedostoa jossa 24 lisäystä ja 19 poistoa
  1. +1
    -1
      include/ink.h
  2. +23
    -18
      lib.c

+ 1
- 1
include/ink.h Näytä tiedosto

@ -395,4 +395,4 @@ void array_push(struct context* ctx, struct ink_routine* currentRoutine, struct
#ifdef __cplusplus
};
#endif
#endif

+ 23
- 18
lib.c Näytä tiedosto

@ -1491,6 +1491,10 @@ void ink_gc(struct context* ctx) {
/**********************************************************************************************************************/
#ifdef NUKE_PUTCHAR_MACRO
#undef putchar
#endif
static void print_stacktrace(struct context* _) {
int i;
struct ink_routine* currentRoutine;
@ -2033,6 +2037,25 @@ static void clear_stack(struct context* ctx) {
return;
}
static void is_int(struct context* ctx) {
struct ink_routine *currentRoutine;
struct elem a;
currentRoutine = ctx->routines + ctx->routine_current;
#ifndef NOEXTRACHECKS
if (currentRoutine->top < 1) {
currentRoutine->panic = -1;
return;
}
#endif
a.type = INK_INTEGER;
a.value = currentRoutine->stack[currentRoutine->top - 1].type == INK_INTEGER;
ink_pop(ctx);
ink_push(ctx, a);
}
static void dump_stack(struct context* ctx) {
struct ink_routine* currentRoutine;
int index;
@ -2373,24 +2396,6 @@ static void is_array(struct context* ctx) {
ink_push(ctx, a);
}
static void is_int(struct context* ctx) {
struct ink_routine *currentRoutine;
struct elem a;
currentRoutine = ctx->routines + ctx->routine_current;
#ifndef NOEXTRACHECKS
if (currentRoutine->top < 1) {
currentRoutine->panic = -1;
return;
}
#endif
a.type = INK_INTEGER;
a.value = currentRoutine->stack[currentRoutine->top - 1].type == INK_INTEGER;
ink_pop(ctx);
ink_push(ctx, a);
}
static void print_array_of_codepoints(struct context* ctx) {
int i;
struct ink_routine *currentRoutine;

Ladataan…
Peruuta
Tallenna