mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-08 05:27:35 +02:00
type checking on load, better error message for missing includes
This commit is contained in:
parent
353594a028
commit
0746c445ed
3 changed files with 16 additions and 4 deletions
4
Makefile
4
Makefile
|
@ -62,10 +62,10 @@ endif
|
|||
|
||||
ifeq ($(USE_DL),0)
|
||||
XLDFLAGS := $(LDFLAGS) $(GCLDFLAGS) -lm
|
||||
XCFLAGS := -Wall -DUSE_DL=0 -g3 -O2 $(CFLAGS)
|
||||
XCFLAGS := -Wall -DUSE_DL=0 -g3 $(CFLAGS)
|
||||
else
|
||||
XLDFLAGS := $(LDFLAGS) $(GCLDFLAGS) -ldl -lm
|
||||
XCFLAGS := -Wall -g3 -O2 $(CFLAGS)
|
||||
XCFLAGS := -Wall -g3 $(CFLAGS)
|
||||
endif
|
||||
|
||||
INCLUDES = include/chibi/sexp.h include/chibi/config.h include/chibi/install.h
|
||||
|
|
|
@ -53,7 +53,12 @@
|
|||
(let ((mod2 (load-module (cadr x))))
|
||||
(%env-copy! env (module-env mod2) (module-exports mod2))))
|
||||
((include)
|
||||
(for-each (lambda (f) (load (find-module-file name f) env)) (cdr x)))
|
||||
(for-each
|
||||
(lambda (f)
|
||||
(cond
|
||||
((find-module-file name f) => (lambda (x) (load x env)))
|
||||
(else (error "couldn't find include" f))))
|
||||
(cdr x)))
|
||||
((body)
|
||||
(for-each (lambda (expr) (eval expr env)) (cdr x)))))
|
||||
(module-meta-data mod))
|
||||
|
|
9
eval.c
9
eval.c
|
@ -2011,10 +2011,17 @@ sexp sexp_load_dl (sexp ctx, sexp file, sexp env) {
|
|||
#endif
|
||||
|
||||
sexp sexp_load (sexp ctx, sexp source, sexp env) {
|
||||
#if USE_DL
|
||||
char *suffix;
|
||||
#endif
|
||||
sexp tmp, out=SEXP_FALSE;
|
||||
sexp_gc_var4(ctx2, x, in, res);
|
||||
if (! sexp_stringp(source))
|
||||
return sexp_type_exception(ctx, "not a string", source);
|
||||
if (! sexp_envp(env))
|
||||
return sexp_type_exception(ctx, "not an environment", env);
|
||||
#if USE_DL
|
||||
char *suffix = sexp_string_data(source)
|
||||
suffix = sexp_string_data(source)
|
||||
+ sexp_string_length(source) - strlen(sexp_so_extension);
|
||||
if (strcmp(suffix, sexp_so_extension) == 0) {
|
||||
res = sexp_load_dl(ctx, source, env);
|
||||
|
|
Loading…
Add table
Reference in a new issue