X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=scheme.4th;h=0a237daf70801753b381cf6cf50f59a377f78232;hb=052ba9e4dee21cfff8932e944b4cdecc5a504518;hp=b2efe17d61781da4fb1f5dea617a3784ae98bf08;hpb=cf26585a7a3b4bcbc7e5a234c9d5c9ff999922da;p=scheme.forth.jl.git diff --git a/scheme.4th b/scheme.4th index b2efe17..0a237da 100644 --- a/scheme.4th +++ b/scheme.4th @@ -1412,24 +1412,36 @@ include scheme-primitives.4th swap - ; -: load ( addr n -- ) +: load ( addr n -- finalResult ) open-input-file empty-parse-str + ok-symbol ( port res ) + begin - 2dup read-port + 2over read-port ( port res obj ) 2dup EOF character-type objeq? if - 2drop close-port + 2drop 2swap close-port exit then - global-env obj@ eval - 2drop + 2swap 2drop ( port obj ) + + global-env obj@ eval ( port res ) again ; +:noname ( args -- finalResult ) + 2dup 1 ensure-arg-count + car string-type ensure-arg-type + + drop pair-type + pad charlist>cstr + pad swap load +; make-primitive load + \ }}} \ ---- REPL ---- @@ -1457,9 +1469,6 @@ include scheme-primitives.4th again ; -: test s" fact.scm" ; -test load - forth definitions \ vim:fdm=marker