( Title: Enhanced error reporting for btester.fs File: btester-errors.fs Author: David N. Williams License: Public Domain Version: 1.4.3, January 18, 2021 Generated: January 18, 2021 from tester-errors.tmpl This code assumes that btester.fs and tester-display.fs are loaded. ) VARIABLE BT-#ERRORS 0 BT-#ERRORS ! : BT-ERROR1 ( c-addr u -- ) ( Display an error message followed by the line that had the error. ) red-text 1 BT-#ERRORS +! BT-ERROR-DEFAULT normal-text ; \ ' BT-ERROR1 BT-ERROR-XT ! \ display results and goals : bt-a. ( 'buffer c-addr u -- ) blue-text type ( 'buffer) dup >r @ dup IF 1- r> cell+ swap cells over + \ display deepest first DO i b@ b. space -1 cells +LOOP ELSE r> 2drop ." none" THEN cr normal-text ; : BT-ERROR2 ( c-addr u -- ) BT-ERROR1 BT-RESULTS s" bresults: " bt-a. BT-GOALS s" bgoals: " bt-a. ; \ ' BT-ERROR2 BT-ERROR-XT ! \ fancy results and goals display : bt-fancy-a. ( 'buffer c-addr u -- ) blue-text type ( 'buffer) dup @ swap cell+ swap ?dup IF ( n) 1- 0 swap \ display deepest first DO ( 'elem) i cells over + b@ i 1+ BT-ERROR-INDEX @ = IF red-text b. blue-text ELSE b. THEN space -1 +LOOP ELSE ." none" THEN drop cr normal-text ; : BT-ERROR3 ( c-addr u -- ) BT-ERROR1 BT-RESULTS s" bresults: " bt-fancy-a. BT-GOALS s" bgoals: " bt-fancy-a. ; ' BT-ERROR3 BT-ERROR-XT ! : .bt-errors ( -- ) blue-text ." BT-ERRORS: " normal-text BT-#ERRORS @ . ; : ?.bt-errors ( -- ) VERBOSE @ IF .bt-errors THEN ;