Skip to content

Commit 2e46d22

Browse files
committed
revised Preload for Julia v1.5 compatibility #32
1 parent 4d292d9 commit 2e46d22

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

src/Reduce.jl

+28-24
Original file line numberDiff line numberDiff line change
@@ -367,31 +367,35 @@ function Load()
367367
return nothing
368368
end
369369

370-
function Preload()
371-
global rs=PSL()
372-
offs = ""
373-
for o in offlist
374-
global offs
375-
o != :nat && (offs = offs*"off $o; ")
376-
end
377-
write(rs.input,"off nat; $EOTstr;\n")
378-
banner = readuntil(rs.output,EOT) |> String
379-
readavailable(rs.output)
380-
rcsl = occursin(" CSL ",banner)
381-
if Sys.iswindows()
382-
banner = replace(banner,r"\r" => "")
383-
println(split(String(banner),'\n')[rcsl ? 1 : end-3])
384-
else
385-
ReduceCheck(banner)
386-
println(split(String(banner),'\n')[rcsl ? 1 : end-3])
370+
if VERSION < v"1.5"
371+
Preload() = (global rs=PSL(); global s; eval(s); atexit(()->kill(rs)))
372+
else
373+
function Preload()
374+
global rs=PSL()
375+
offs = ""
376+
for o in offlist
377+
global offs
378+
o != :nat && (offs = offs*"off $o; ")
379+
end
380+
write(rs.input,"off nat; $EOTstr;\n")
381+
banner = readuntil(rs.output,EOT) |> String
382+
readavailable(rs.output)
383+
rcsl = occursin(" CSL ",banner)
384+
if Sys.iswindows()
385+
banner = replace(banner,r"\r" => "")
386+
println(split(String(banner),'\n')[rcsl ? 1 : end-3])
387+
else
388+
ReduceCheck(banner)
389+
println(split(String(banner),'\n')[rcsl ? 1 : end-3])
390+
end
391+
load_package(:rlfi)
392+
offs |> RExpr |> rcall
393+
rcall(R"on savestructr")
394+
show(devnull,"text/latex",R"int(sinh(e**i*z),z)")
395+
R"x" == R"x"
396+
ListPrint(0)
397+
atexit(()->kill(rs))
387398
end
388-
load_package(:rlfi)
389-
offs |> RExpr |> rcall
390-
rcall(R"on savestructr")
391-
show(devnull,"text/latex",R"int(sinh(e**i*z),z)")
392-
R"x" == R"x"
393-
ListPrint(0)
394-
atexit(()->kill(rs))
395399
end
396400

397401
global preload = false

0 commit comments

Comments
 (0)