/* testcode.c -- run a word on a node, for tests. See testcode.h. */ #include "v4/testcode.h" long v4_test_call(v4_node *n, v4_exec_state *es, v4_heat *h, v4_cell entry, long max_words) { long words = 0; n->stopped = 0; /* a stop left by an earlier call is over */ v4_rstack_push(&n->rs, V4_TEST_HALT); n->p = entry; while (n->p != V4_TEST_HALT) { if (words >= max_words) return -1; (void)v4_exec_step_word(n, es, h); if (n->stopped) return -1; /* an address fault with no handler (D-14) */ words++; } return words; }