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:
2cda7c0
)
Working on compatibility with julia 0.7
author
Tim Vaughan
<tgvaughan@gmail.com>
Mon, 3 Sep 2018 09:58:56 +0000
(11:58 +0200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Tue, 4 Sep 2018 08:39:56 +0000
(10:39 +0200)
src/forth.jl
patch
|
blob
|
history
diff --git
a/src/forth.jl
b/src/forth.jl
index
3882a53
..
3e043f8
100644
(file)
--- a/
src/forth.jl
+++ b/
src/forth.jl
@@
-1,6
+1,6
@@
module forth
module forth
-import
Base
.REPLCompletions, Base.invokelatest
+import
REPL
.REPLCompletions, Base.invokelatest
# VM mem size
size_mem = 1000000 # 1 mega-int
# VM mem size
size_mem = 1000000 # 1 mega-int
@@
-34,7
+34,7
@@
mem[CURRENT] = FORTH_LATEST-1 # Compile words to system dict initially
DICT = mem[H] # Save bottom of dictionary as constant
# VM registers
DICT = mem[H] # Save bottom of dictionary as constant
# VM registers
-
type
Reg
+
mutable struct
Reg
RSP::Int64 # Return stack pointer
PSP::Int64 # Parameter/data stack pointer
IP::Int64 # Instruction pointer
RSP::Int64 # Return stack pointer
PSP::Int64 # Parameter/data stack pointer
IP::Int64 # Instruction pointer
@@
-114,7
+114,7
@@
stringAsInts(str::AbstractString) = [Int(c) for c in collect(str)]
function defPrim(f::Function; name="nameless")
push!(primitives, f)
function defPrim(f::Function; name="nameless")
push!(primitives, f)
- push!(primNames, replace(name, "\004"
,
"EOF"))
+ push!(primNames, replace(name, "\004"
=>
"EOF"))
return -length(primitives)
end
return -length(primitives)
end
@@
-722,7
+722,7
@@
EMIT_CFA = defPrimWord("EMIT", () -> begin
end)
function raw_mode!(mode::Bool)
end)
function raw_mode!(mode::Bool)
- if ccall(:jl_tty_set_mode, Int32, (Ptr{
Void
}, Int32), STDIN.handle, mode) != 0
+ if ccall(:jl_tty_set_mode, Int32, (Ptr{
Nothing
}, Int32), STDIN.handle, mode) != 0
throw("FATAL: Terminal unable to enter raw mode.")
end
end
throw("FATAL: Terminal unable to enter raw mode.")
end
end
@@
-1341,7
+1341,7
@@
function run(fileName=nothing; initialize=true)
catch ex
println(string("Error in primitive '", getPrimName(jmp), "' at address ", jmp))
catch ex
println(string("Error in primitive '", getPrimName(jmp), "' at address ", jmp))
- showerror(
STDOUT
, ex)
+ showerror(
stdout
, ex)
println()
# QUIT
println()
# QUIT