( Title: Enhanced error reporting for rftester.fs File: rftester-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 rftester.fs and tester-display.fs are loaded. ) VARIABLE RFT-#ERRORS 0 RFT-#ERRORS ! : RFT-ERROR1 ( c-addr u -- ) ( Display an error message followed by the line that had the error. ) red-text 1 RFT-#ERRORS +! RFT-ERROR-DEFAULT normal-text ; \ ' RFT-ERROR1 RFT-ERROR-XT ! \ display results and goals : rft-a. ( 'buffer c-addr u -- ) blue-text type ( 'buffer) dup >r @ dup IF 1- r> cell+ swap cells over + \ display deepest first DO i rf@ rf. space -1 cells +LOOP ELSE r> 2drop ." none" THEN cr normal-text ; : RFT-ERROR2 ( c-addr u -- ) RFT-ERROR1 RFT-RESULTS s" rfresults: " rft-a. RFT-GOALS s" rfgoals: " rft-a. ; \ ' RFT-ERROR2 RFT-ERROR-XT ! \ fancy results and goals display : rft-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 + rf@ i 1+ RFT-ERROR-INDEX @ = IF red-text rf. blue-text ELSE rf. THEN space -1 +LOOP ELSE ." none" THEN drop cr normal-text ; : RFT-ERROR3 ( c-addr u -- ) RFT-ERROR1 RFT-RESULTS s" rfresults: " rft-fancy-a. RFT-GOALS s" rfgoals: " rft-fancy-a. ; ' RFT-ERROR3 RFT-ERROR-XT ! : .rft-errors ( -- ) blue-text ." RFT-ERRORS: " normal-text RFT-#ERRORS @ . ; : ?.rft-errors ( -- ) VERBOSE @ IF .rft-errors THEN ;