From: Tim Vaughan Date: Sun, 9 Oct 2016 00:59:49 +0000 (+1300) Subject: Added generic input buffer words IB and #IB. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=231a3650050eba3a478b814b149963eb3e0625e7;p=forth.jl.git Added generic input buffer words IB and #IB. --- diff --git a/src/forth.jl b/src/forth.jl index acd6c45..c2019d4 100644 --- a/src/forth.jl +++ b/src/forth.jl @@ -968,6 +968,14 @@ NUMTIB, NUMTIB_CFA = defNewVar("#TIB", 0) FIB_CFA = defConst("FIB", FIB) NUMFIB, NUMFIB_CFA = defNewVar("#FIB", 0) +IB_CFA = defPrimWord("IB", () -> begin + pushPS(mem[SOURCE_ID] == 0 ? TIB : FIB) +end) + +NUMIB_CFA = defPrimWord("#IB", () -> begin + pushPS(mem[SOURCE_ID] == 0 ? NUMTIB : NUMFIB) +end) + TOIN, TOIN_CFA = defNewVar(">IN", 0) SOURCE_ID, SOURCE_ID_CFA = defNewVar("SOURCE-ID", 0) diff --git a/src/lib.4th b/src/lib.4th index 224e7cb..4f0323d 100644 --- a/src/lib.4th +++ b/src/lib.4th @@ -1,5 +1,5 @@ : \ IMMEDIATE - #TIB @ >IN ! + #IB @ >IN ! ; \ We can now comment! \ Compile core definitions