The Lambda Lab
/
projects
/
forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c432e60
)
Added generic input buffer words IB and #IB.
author
Tim Vaughan
<tgvaughan@gmail.com>
Sun, 9 Oct 2016 00:59:49 +0000
(13:59 +1300)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Sun, 9 Oct 2016 01:00:00 +0000
(14:00 +1300)
src/forth.jl
patch
|
blob
|
history
src/lib.4th
patch
|
blob
|
history
diff --git
a/src/forth.jl
b/src/forth.jl
index
acd6c45
..
c2019d4
100644
(file)
--- 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
(file)
--- a/
src/lib.4th
+++ b/
src/lib.4th
@@
-1,5
+1,5
@@
: \ IMMEDIATE
- #
T
IB @ >IN !
+ #IB @ >IN !
; \ We can now comment!
\ Compile core definitions