master
Ondřej Hruška 3 years ago
parent 5db9ae83d3
commit 7bc96a8f58
  1. 10
      src/fh_stack.c
  2. 2
      testfiles/combinedtest.f

@ -2,6 +2,14 @@
// TODO stacks should grow down, not up!
void show_rs(struct fh_thread_s *fh)
{
LOG("\x1b[32;1mRS:\x1b[m");
for (int i = 0; i < fh->return_stack_top; i++) {
LOG(" %d ", fh->return_stack[i]);
}
}
enum fh_error ds_roll(struct fh_thread_s *fh, int n)
{
if (fh->data_stack_top <= n) {
@ -72,6 +80,7 @@ enum fh_error rs_pop(struct fh_thread_s *fh, uint32_t *out)
}
*out = fh->return_stack[--fh->return_stack_top];
LOG("RS pop %d (0x%08x)", *out, *out);
show_rs(fh);
return FH_OK;
}
@ -121,5 +130,6 @@ enum fh_error rs_push(struct fh_thread_s *fh, uint32_t in)
}
fh->return_stack[fh->return_stack_top++] = in;
UPDATE_HWM(fh->return_stack_hwm, fh->return_stack_top);
show_rs(fh);
return FH_OK;
}

@ -870,8 +870,10 @@ T{ 2 SCANS !
345 RESCAN?
-> 345 345 }T
1 debug
: GS2 5 SCANS ! S" 123 RESCAN?" EVALUATE ;
T{ GS2 -> 123 123 123 123 123 }T
xx
: GS3 WORD COUNT SWAP C@ ;
T{ BL GS3 HELLO -> 5 CHAR H }T

Loading…
Cancel
Save