From 3bfba53afbedbe2c705d2ecab2df191e1267fd4e Mon Sep 17 00:00:00 2001 From: mgcaret Date: Fri, 27 Dec 2019 11:05:26 -0800 Subject: [PATCH] optimize unit tester to use clear as EMPTY-STACK --- fcode-modules/tester.fs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fcode-modules/tester.fs b/fcode-modules/tester.fs index d5f190e..e855a2e 100644 --- a/fcode-modules/tester.fs +++ b/fcode-modules/tester.fs @@ -31,8 +31,11 @@ VARIABLE VERBOSE FALSE VERBOSE ! \ TRUE VERBOSE ! -: EMPTY-STACK \ ( ... -- ) EMPTY STACK: HANDLES UNDERFLOWED STACK TOO. - DEPTH ?DUP IF DUP 0< IF NEGATE 0 DO 0 LOOP ELSE 0 DO DROP LOOP THEN THEN ; +\ : EMPTY-STACK \ ( ... -- ) EMPTY STACK: HANDLES UNDERFLOWED STACK TOO. +\ DEPTH ?DUP IF DUP 0< IF NEGATE 0 DO 0 LOOP ELSE 0 DO DROP LOOP THEN THEN ; +\ THE IEEE-1275 CLEAR word works the same but the standard does not define +\ an FCode for it... +defer EMPTY-STACK s" ' clear" eval to EMPTY-STACK VARIABLE #ERRORS 0 #ERRORS ! @@ -50,6 +53,8 @@ CREATE ACTUAL-RESULTS 20 CELLS ALLOT : T{ \ ( -- ) SYNTACTIC SUGAR. ; +\ FCode tokenizer will issue a warning for this +\ it can be ignored : -> \ ( ... -- ) RECORD DEPTH AND CONTENT OF STACK. DEPTH DUP ACTUAL-DEPTH ! \ RECORD DEPTH ?DUP IF \ IF THERE IS SOMETHING ON STACK