always print stack length
This commit is contained in:
parent
31eba14753
commit
399ef3ab48
1 changed files with 9 additions and 8 deletions
17
pila.c
17
pila.c
|
@ -303,17 +303,18 @@ print_value(RpnState *st, Value val, bool reader_fmt)
|
||||||
void
|
void
|
||||||
stack_contents_nat(RpnState *st)
|
stack_contents_nat(RpnState *st)
|
||||||
{
|
{
|
||||||
|
printf("<%lu> ", st->sp);
|
||||||
if (st->sp == 0) {
|
if (st->sp == 0) {
|
||||||
puts("<empty stack>");
|
|
||||||
} else {
|
|
||||||
printf("<%lu> ", st->sp);
|
|
||||||
for (isize i = 0; i < st->sp; ++i) {
|
|
||||||
Value val = st->data_stack[i];
|
|
||||||
print_value(st, val, true);
|
|
||||||
putchar(' ');
|
|
||||||
}
|
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (isize i = 0; i < st->sp; ++i) {
|
||||||
|
Value val = st->data_stack[i];
|
||||||
|
print_value(st, val, true);
|
||||||
|
putchar(' ');
|
||||||
|
}
|
||||||
|
putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Reference in a new issue