From 064f3eb027eef8fbfb59c43b40989ca8b83ca8f7 Mon Sep 17 00:00:00 2001 From: Phil Burk Date: Fri, 4 Sep 2020 17:10:27 -0700 Subject: [PATCH] Add PRIVATIZE to history.fth This will hide the internal words for HISTORY. Also added some error checks to detect when we forget to call PRIVATIZE. Fixes #54 --- fth/history.fth | 1 + fth/private.fth | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fth/history.fth b/fth/history.fth index 42c2696..eed5e46 100644 --- a/fth/history.fth +++ b/fth/history.fth @@ -494,6 +494,7 @@ variable KH-INSIDE ( true if we are scrolling inside the history buffer ) THEN ; +privatize : AUTO.INIT auto.init diff --git a/fth/private.fth b/fth/private.fth index d7d465d..6c0c55e 100644 --- a/fth/private.fth +++ b/fth/private.fth @@ -24,16 +24,20 @@ variable private-stop $ 20 constant FLAG_SMUDGE : PRIVATE{ + private-start @ 0= not abort" ERROR: Missing PRIVATIZE" + private-stop @ 0= not abort" ERROR: Missing PRIVATIZE" latest private-start ! 0 private-stop ! ; + : }PRIVATE - private-stop @ 0= not abort" Extra }PRIVATE" + private-stop @ 0= not abort" ERROR: Extra }PRIVATE" latest private-stop ! ; + : PRIVATIZE ( -- , smudge all words between PRIVATE{ and }PRIVATE ) - private-start @ 0= abort" Missing PRIVATE{" - private-stop @ 0= abort" Missing }PRIVATE" + private-start @ 0= abort" ERROR: Missing PRIVATE{" + private-stop @ 0= abort" ERROR: Missing }PRIVATE" private-stop @ BEGIN dup private-start @ u> \ 19970701 -- 2.20.1