Skip to content

Commit 7f868f2

Browse files
committed
fix: --program can load libs on demand
1 parent 8a3963d commit 7f868f2

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Cheap and fast R7RS Scheme Interpreter
44
55
SKINT is a portable interpreter for the R7RS Scheme programming language.
6-
It can be built from five C source files (10K lines of code) with a single command. There is no distributives or packages;
6+
It can be built from five C source files (10K lines of code) with a single command. There are no distributives or packages;
77
just compile the source files with your favorite C compiler, link them with the standard C runtime libraries,
88
and you're done. For some platforms, precompiled binaries are available (please see [releases](https://github.com/false-schemers/skint/releases)).
99

Diff for: pre/t.scm

+2-1
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,8 @@
25462546
(define modname (string->symbol (path-strip-extension (path-strip-directory filename))))
25472547
(define global (lambda (n) (symbol-append 'prog:// modname '? n)))
25482548
(define ial (list (cons 'import (make-location 'import))))
2549-
(define env (make-controlled-environment ial global root-environment))
2549+
(define pre (make-sld-environment *root-name-registry*))
2550+
(define env (make-controlled-environment ial global pre))
25502551
(define ci? #f) ; normal load-like behavior is the default
25512552
(define main-args (cons filename args))
25522553
(call-with-current-input-file filename ;=>

Diff for: t.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -1587,14 +1587,14 @@ char *t_code[] = {
15871587
"current-input-file)[62",
15881588

15891589
"P", "run-program",
1590-
"%2,,,,,,#0#1#2#3#4#5${${.(i10),@(y20:path-strip-directory)[01},@(y20:p"
1591-
"ath-strip-extension)[01}X5.!0.0,&1{%1.0,'(y1:?),:0^,'(y7:prog://),@(y1"
1592-
"3:symbol-append)[14}.!1'(y6:import)b,'(y6:import)c,l1.!2${@(y16:root-e"
1593-
"nvironment),.4^,.6^,@(y27:make-controlled-environment)[03}.!3f.!4.7,.7"
1594-
"c.!5${.5,.8,&2{%1${:0^,@(y12:command-line)[01}${.2,@(y14:read-code-sex"
1595-
"p)[01},,#0:1,.3,.2,&3{%1.0R8~?{${:2^,.3,@(y4:eval)[02}${:1,@(y14:read-"
1596-
"code-sexp)[01},:0^[11}]1}.!0.0^_1[11},.9,@(y28:call-with-current-input"
1597-
"-file)[02}t]8",
1590+
"%2,,,,,,,#0#1#2#3#4#5#6${${.(i11),@(y20:path-strip-directory)[01},@(y2"
1591+
"0:path-strip-extension)[01}X5.!0.0,&1{%1.0,'(y1:?),:0^,'(y7:prog://),@"
1592+
"(y13:symbol-append)[14}.!1'(y6:import)b,'(y6:import)c,l1.!2${@(y20:*ro"
1593+
"ot-name-registry*),@(y20:make-sld-environment)[01}.!3${.5^,.4^,.6^,@(y"
1594+
"27:make-controlled-environment)[03}.!4f.!5.8,.8c.!6${.6,.9,&2{%1${:0^,"
1595+
"@(y12:command-line)[01}${.2,@(y14:read-code-sexp)[01},,#0:1,.3,.2,&3{%"
1596+
"1.0R8~?{${:2^,.3,@(y4:eval)[02}${:1,@(y14:read-code-sexp)[01},:0^[11}]"
1597+
"1}.!0.0^_1[11},.(i10),@(y28:call-with-current-input-file)[02}t]9",
15981598

15991599
"P", "repl-evaluate-top-form",
16001600
"%3,,#0#1.!0${.2,&1{%!0.0:!0]1},.6,.6,&2{%0:1,:0,@(y17:evaluate-top-for"

0 commit comments

Comments
 (0)