|
|
@ -1950,27 +1950,32 @@ static void jump_if(struct context* ctx) { |
|
|
|
} |
|
|
|
|
|
|
|
static void print_int(struct context* ctx) { |
|
|
|
struct ink_routine* currentRoutine; |
|
|
|
struct elem a; |
|
|
|
char* n; |
|
|
|
char* str; |
|
|
|
currentRoutine = ctx->routines + ctx->routine_current; |
|
|
|
#ifndef NOEXTRACHECKS |
|
|
|
if(currentRoutine->top < 1 || currentRoutine->stack[currentRoutine->top-1].type != INK_INTEGER) { |
|
|
|
currentRoutine->panic = -1; |
|
|
|
return; |
|
|
|
} |
|
|
|
#endif |
|
|
|
a = currentRoutine->stack[currentRoutine->top-1]; |
|
|
|
ink_pop(ctx); |
|
|
|
n = ink_itoa(ctx, a.value); |
|
|
|
str = n; |
|
|
|
while (*str) { |
|
|
|
ctx->putchar(ctx, *str); |
|
|
|
++str; |
|
|
|
} |
|
|
|
ctx->free(ctx, n); |
|
|
|
n = NULL; |
|
|
|
struct ink_routine* currentRoutine; |
|
|
|
struct elem a; |
|
|
|
char* n; |
|
|
|
char* str; |
|
|
|
currentRoutine = ctx->routines + ctx->routine_current; |
|
|
|
#ifndef NOEXTRACHECKS |
|
|
|
if(currentRoutine->top < 1 || currentRoutine->stack[currentRoutine->top-1].type != INK_INTEGER) { |
|
|
|
currentRoutine->panic = -1; |
|
|
|
return; |
|
|
|
} |
|
|
|
#endif |
|
|
|
a = currentRoutine->stack[currentRoutine->top-1]; |
|
|
|
ink_pop(ctx); |
|
|
|
if(a.value < 0) { |
|
|
|
ctx->putchar(ctx, '-'); |
|
|
|
n = ink_itoa(ctx, -a.value); |
|
|
|
} else { |
|
|
|
n = ink_itoa(ctx, a.value); |
|
|
|
} |
|
|
|
str = n; |
|
|
|
while (*str) { |
|
|
|
ctx->putchar(ctx, *str); |
|
|
|
++str; |
|
|
|
} |
|
|
|
ctx->free(ctx, n); |
|
|
|
n = NULL; |
|
|
|
} |
|
|
|
|
|
|
|
static void print_as_utf8(struct context* ctx) { |
|
|
|