From 3d2ed02bd1a45f86939839c71bd38a98e67e55fa Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen
Date: Sun, 9 Apr 2017 01:28:54 +0200
Subject: [PATCH] Add chicken.load module
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
this should put the following identifiers under the chicken.load
module:
➤ csi -n -R chicken.load -p 'load load-noisily load-relative load-library set-dynamic-load-mode!'
#
#
#
#
#
---
README | 1 +
chicken-install.scm | 1 +
defaults.make | 2 +-
distribution/manifest | 2 ++
eval.scm | 2 +-
load.scm | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
modules.scm | 1 +
rules.make | 7 ++++++-
8 files changed, 62 insertions(+), 3 deletions(-)
create mode 100644 load.scm
diff --git a/README b/README
index 9d1c1374..b7dbba03 100644
--- a/README
+++ b/README
@@ -294,6 +294,7 @@
| | |-- chicken.io.import.so
| | |-- chicken.irregex.import.so
| | |-- chicken.keyword.import.so
+ | | |-- chicken.load.import.so
| | |-- chicken.locative.import.so
| | |-- chicken.lolevel.import.so
| | |-- chicken.memory.import.so
diff --git a/chicken-install.scm b/chicken-install.scm
index cad0b00a..88ea7ba0 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -64,6 +64,7 @@
"chicken.io.import.so"
"chicken.irregex.import.so"
"chicken.keyword.import.so"
+ "chicken.load.import.so"
"chicken.locative.import.so"
"chicken.lolevel.import.so"
"chicken.memory.import.so"
diff --git a/defaults.make b/defaults.make
index 37f69a37..763ae146 100644
--- a/defaults.make
+++ b/defaults.make
@@ -266,7 +266,7 @@ CHICKEN_PROGRAM_OPTIONS += $(if $(PROFILE_OBJECTS),-profile)
PRIMITIVE_IMPORT_LIBRARIES = chicken chicken.csi chicken.foreign
DYNAMIC_IMPORT_LIBRARIES = setup-api setup-download srfi-4
DYNAMIC_CHICKEN_IMPORT_LIBRARIES = bitwise errno file.posix fixnum flonum \
- format gc io keyword locative memory posix pretty-print process \
+ format gc io keyword load locative memory posix pretty-print process \
process.signal process-context random time time.posix
DYNAMIC_CHICKEN_COMPILER_IMPORT_LIBRARIES = user-pass
DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES = continuation data-structures \
diff --git a/distribution/manifest b/distribution/manifest
index 43d058a8..6df2a82a 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -302,6 +302,8 @@ chicken.irregex.import.scm
chicken.irregex.import.c
chicken.keyword.import.scm
chicken.keyword.import.c
+chicken.load.import.scm
+chicken.load.import.c
chicken.locative.import.scm
chicken.locative.import.c
chicken.lolevel.import.scm
diff --git a/eval.scm b/eval.scm
index 72977a8e..117e8f0a 100644
--- a/eval.scm
+++ b/eval.scm
@@ -88,7 +88,7 @@
(define-constant core-units
'(chicken-syntax chicken-ffi-syntax continuation data-structures eval
- expand extras file files internal irregex library lolevel pathname
+ expand extras file load files internal irregex library lolevel pathname
port posix srfi-4 tcp repl read-syntax))
(define-constant cygwin-default-dynamic-load-libraries '("cygchicken-0"))
diff --git a/load.scm b/load.scm
new file mode 100644
index 00000000..465e9a33
--- /dev/null
+++ b/load.scm
@@ -0,0 +1,49 @@
+;;;; load.scm - Eval on files
+;
+; Copyright (c) 2008-2017, The CHICKEN Team
+; Copyright (c) 2000-2007, Felix L. Winkelmann
+; All rights reserved.
+;
+; Redistribution and use in source and binary forms, with or without
+; modification, are permitted provided that the following conditions are
+; met:
+;
+; Redistributions of source code must retain the above copyright
+; notice, this list of conditions and the following disclaimer.
+;
+; Redistributions in binary form must reproduce the above copyright
+; notice, this list of conditions and the following disclaimer in the
+; documentation and/or other materials provided with the distribution.
+;
+; Neither the name of the author nor the names of its contributors may
+; be used to endorse or promote products derived from this software
+; without specific prior written permission.
+;
+; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+; HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+; BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+; OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+; TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+; USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+; DAMAGE.
+
+
+(declare
+ (unit load)
+ (uses eval)
+ (fixnum) ;; TODO: do we need (fixnum) here?
+ (disable-interrupts)) ;; TODO: do we need (disable-interrupts) here?
+
+(module chicken.load
+ (load
+ load-noisily
+ load-relative
+ load-library
+ set-dynamic-load-mode!)
+
+(import chicken chicken.eval))
diff --git a/modules.scm b/modules.scm
index 91099db1..8f0e36ce 100644
--- a/modules.scm
+++ b/modules.scm
@@ -960,6 +960,7 @@
(##sys#register-module-alias 'io 'chicken.io)
(##sys#register-module-alias 'irregex 'chicken.irregex)
(##sys#register-module-alias 'keyword 'chicken.keyword)
+(##sys#register-module-alias 'load 'chicken.load)
(##sys#register-module-alias 'locative 'chicken.locative)
(##sys#register-module-alias 'lolevel 'chicken.lolevel)
(##sys#register-module-alias 'memory 'chicken.memory)
diff --git a/rules.make b/rules.make
index acd8bf37..e50a110d 100644
--- a/rules.make
+++ b/rules.make
@@ -37,7 +37,7 @@ SETUP_API_OBJECTS_1 = setup-api setup-download
LIBCHICKEN_SCHEME_OBJECTS_1 = \
library eval read-syntax repl data-structures pathname port file \
- files extras lolevel tcp srfi-4 continuation $(POSIXFILE) \
+ files extras load lolevel tcp srfi-4 continuation $(POSIXFILE) \
internal irregex scheduler debugger-client profiler stub expand \
modules chicken-syntax chicken-ffi-syntax build-version
LIBCHICKEN_OBJECTS_1 = $(LIBCHICKEN_SCHEME_OBJECTS_1) runtime
@@ -534,6 +534,7 @@ $(eval $(call declare-emitted-import-lib-dependency,chicken.format,extras))
$(eval $(call declare-emitted-import-lib-dependency,chicken.io,extras))
$(eval $(call declare-emitted-import-lib-dependency,chicken.pretty-print,extras))
$(eval $(call declare-emitted-import-lib-dependency,chicken.random,extras))
+$(eval $(call declare-emitted-import-lib-dependency,chicken.load,library))
$(eval $(call declare-emitted-import-lib-dependency,chicken.locative,lolevel))
$(eval $(call declare-emitted-import-lib-dependency,chicken.memory,lolevel))
@@ -754,6 +755,8 @@ files.c: files.scm \
chicken.foreign.import.scm \
chicken.irregex.import.scm \
chicken.pathname.import.scm
+load.c: load.scm \
+ chicken.eval.import.scm
lolevel.c: lolevel.scm \
chicken.foreign.import.scm
pathname.c: pathname.scm \
@@ -834,6 +837,8 @@ file.c: $(SRCDIR)file.scm $(SRCDIR)common-declarations.scm
$(bootstrap-lib) -emit-import-library chicken.file
files.c: $(SRCDIR)files.scm $(SRCDIR)common-declarations.scm
$(bootstrap-lib) -emit-import-library chicken.files
+load.c: $(SRCDIR)load.scm $(SRCDIR)common-declarations.scm
+ $(bootstrap-lib) -emit-import-library chicken.load
lolevel.c: $(SRCDIR)lolevel.scm $(SRCDIR)common-declarations.scm
$(bootstrap-lib) \
-emit-import-library chicken.locative \
--
2.12.1