Improvements
h3rald h3rald@h3rald.com
Sat, 23 Nov 2024 15:02:47 +0100
M
hex.c
→
hex.c
@@ -28,6 +28,8 @@ char HEX_ERROR[256] = "";
char **HEX_ARGV; int HEX_ARGC = 0; int HEX_ERRORS = 1; +int HEX_REPL = 0; +int HEX_STDIN = 0; char *HEX_NATIVE_SYMBOLS[] = { "store",@@ -853,6 +855,10 @@
// Print the stack trace void print_stack_trace() { + if (HEX_STDIN || HEX_REPL) + { + return; + } fprintf(stderr, "[stack trace] (most recent symbol first):\n"); for (size_t i = 0; i < stackTrace.size; i++)@@ -3730,11 +3736,13 @@ }
} if (!isatty(fileno(stdin))) { + HEX_STDIN = 1; // Process piped input from stdin hex_process_stdin(); } else { + HEX_REPL = 1; // Start REPL hex_repl(); }
M
tests.hex
→
tests.hex
@@ -1,27 +1,42 @@
+0x0 "test-count" store 0x0 "successes" store 0x0 "failures" store +() "errors" store ( "current-test" store - (current-test i) + test-count 0x1 + "test-counnt" store + ( + (current-test i) + ( + "." print + successes 0x1 + "successes" store + ) + ( + "x" print + failures 0x1 + "failures" store + ) + if + ) ( - "." print - successes 0x1 + "successes" store - ) - ( + ; Store error + (test-count str " - " error) join errors append "errors" store "x" print failures 0x1 + "failures" store ) - if + try ) "test" store - - ; --- Tests (0x1 "a" store a 0x1 ==) test i +(a free 0x1) test i ; --- Report "\nSuccessful Tests: " print successes dec print "/" print successes failures + dec puts +(errors length 0 >) + errors (warn) each +when + ; --- Cleanup -"a" free +;"a" free