~ chicken-core (chicken-5) 1e1c9640d3be4b131c1904a885f75f462d11164c


commit 1e1c9640d3be4b131c1904a885f75f462d11164c
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Wed Jul 28 14:31:32 2010 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Wed Jul 28 14:31:32 2010 +0200

    version check for setup.defaults; expanded in manual on import libraries; trivial changes

diff --git a/chicken-install.scm b/chicken-install.scm
index 1ed773e2..97367826 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -62,6 +62,8 @@
       "irregex.import.so"
       "types.db"))
 
+  (define-constant +setup.defaults-version+ 1)
+
   (define *program-path*
     (or (and-let* ((p (get-environment-variable "CHICKEN_PREFIX")))
           (make-pathname p "bin") )
@@ -113,6 +115,16 @@
 		(unless (and (list? x) (positive? (length x)))
 		  (broken x))
 		(case (car x)
+		  ((version)
+		   (cond ((not (pair? (cdr x))) (broken x))
+			 ((not (= (cadr x) +setup.defaults-version+))
+			  (error 
+			   (sprintf 
+			       "version of installed `setup.defaults' does not match setup-API version (~a)"
+			     +setup.default-version+)
+			   (cadr x)))
+			 ;; ignored
+			 ))
 		  ((server)
 		   (set! *default-sources* 
 		     (append *default-sources* (list (cdr x)))))
diff --git a/distribution/manifest b/distribution/manifest
index c0687166..affd61e9 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -109,7 +109,6 @@ tests/srfi-4-tests.scm
 tests/srfi-18-tests.scm
 tests/hash-table-tests.scm
 tests/apply-test.scm
-tests/man-or-boy.scm
 tests/embedded1.c
 tests/embedded2.scm
 tests/fixnum-tests.scm
diff --git a/library.scm b/library.scm
index 462da595..e3ab347d 100644
--- a/library.scm
+++ b/library.scm
@@ -2575,10 +2575,6 @@ EOF
 					     (cond [(string=? "eof" tok) #!eof]
 						   [(member tok '("optional" "rest" "key"))
 						    (build-symbol (##sys#string-append "#!" tok)) ]
-						   [(string=? "current-line" tok)
-						       (##sys#slot port 4)]
-						   [(string=? "current-file" tok)
-						       (port-name port)]
 						   [else 
 						    (let ((a (assq (string->symbol tok) read-marks)))
 						      (if a
diff --git a/manual/Modules b/manual/Modules
index 5bcc378f..766bfd3e 100644
--- a/manual/Modules
+++ b/manual/Modules
@@ -311,6 +311,12 @@ load it manually:
   #;1> (import test)
   #;2> 
 
+Note that you must us import libraries if you compile code
+that depends on other modules. The compiler will not execute
+the modules that are refered to by compiled code, and thus
+the binding information and exported syntax of the former
+must be available separately.
+
 
 === Caveats
 
diff --git a/manual/faq b/manual/faq
index 5793c6a0..7abf0381 100644
--- a/manual/faq
+++ b/manual/faq
@@ -487,15 +487,46 @@ and thus allows inlining of them.
 
 ==== Can I load compiled code at runtime?
 
-Yes.
-You can load compiled at code at runtime with {{load}} just as
-well as you can load Scheme source code.
-Compiled code will, of course, run faster.
-
-To do this, pass to {{load}} a path for a shared object.
-Use a form such as {{(load "foo.so")}} and run
-{{csc -shared foo.scm}} to produce {{foo.so}} from {{foo.scm}} (at
-which point {{foo.scm}} will no longer be required).
+Yes. You can load compiled at code at runtime with {{load}} just as
+well as you can load Scheme source code.  Compiled code will, of
+course, run faster.
+
+To do this, pass to {{load}} a path for a shared object.  Use a form
+such as {{(load "foo.so")}} and run {{csc -shared foo.scm}} to produce
+{{foo.so}} from {{foo.scm}} (at which point {{foo.scm}} will no longer
+be required).
+
+If you have compiled code that contains a {{module}} definition, then
+executing the code will "register" the module to allow importing the
+bindings provided by the module into a running Scheme process.
+The information required to use a module is in this case embedded in
+the compiled code. Compiling another program that uses this (compiled) 
+module is more difficult: the used module will not necessarily be loaded
+into the compiler, so the registration will not be executed. In this
+case the information about what bindings the compiled module exports
+must be separated from the actual code that executes at runtime.
+To make this possible, compiling a module can be done in such a
+manner that an "import library" is created. This is a file that
+contains the binding information of the module and we can use it
+to compile a file that refers to that module. An example can perhaps
+make this clearer:
+
+  ;; my-module.scm
+  
+  (module my-module (...) ...)
+
+  ;; use-my-module.scm
+
+  (import my-module)
+  ...
+
+Compile the module and generate an import library for the "my-module" module:
+
+  % csc -s my-module.scm -emit-import-library my-module
+
+Compile the program that uses the module:
+
+  % csc use-my-module.scm
 
 ==== Why is my program which uses regular expressions so slow?
 
diff --git a/setup.defaults b/setup.defaults
index cac61eb1..3dce8dc2 100644
--- a/setup.defaults
+++ b/setup.defaults
@@ -1,6 +1,9 @@
 ;;;; setup.defaults - defaults for chicken-install -*- Scheme -*-
 
 
+(version 1)
+
+
 ;; list of servers in the order in which they will be processed
 ;
 ; (server (location URL) (transport TRANSPORT))
diff --git a/tests/man-or-boy.scm b/tests/man-or-boy.scm
index 60bb6f27..73391f2b 100644
--- a/tests/man-or-boy.scm
+++ b/tests/man-or-boy.scm
@@ -22,12 +22,14 @@
   (if (<= k 0)
       (+ (x4) (x5))
       (B)))
- 
-(assert
- (= -175416
-    (A 20
-       (lambda () 1) 
-       (lambda () -1)
-       (lambda () -1)
-       (lambda () 1)
-       (lambda () 0))))
+
+(do ((i 1000 (sub1 i)))
+    ((zero? i))
+  (assert
+   (= -175416
+      (A 20
+	 (lambda () 1) 
+	 (lambda () -1)
+	 (lambda () -1)
+	 (lambda () 1)
+	 (lambda () 0)))))
\ No newline at end of file
diff --git a/tests/runbench.sh b/tests/runbench.sh
index 6ad82b92..87be9d1a 100644
--- a/tests/runbench.sh
+++ b/tests/runbench.sh
@@ -9,6 +9,8 @@ TEST_DIR=`pwd`
 export DYLD_LIBRARY_PATH=${TEST_DIR}/..
 export LD_LIBRARY_PATH=${TEST_DIR}/..
 
+echo 
+
 CHICKEN=../chicken
 COMPILE_OPTIONS="-O5 -d0 -disable-interrupts -b"
 
@@ -29,38 +31,34 @@ run()
     /usr/bin/time "$timeopts" ./a.out "$1" "$2" "$3"
 }
 
-echo
+echo "****************************************"
 
 compiler_options="-C -Wa,-W"
 compile="../csc -w -compiler $CHICKEN -I.. -L.. -include-path .. -o a.out $COMPILE_OPTIONS"
 
-echo -n "null ... "
+echo "======================================== null ... "
 $compile null.scm -O5
 run -:Hd
 
-echo -n "compilation ... "
+echo "======================================== compilation ... "
 /usr/bin/time "$timeopts" $compile compiler.scm
 
-echo -n "compiler ... "
+echo "======================================== compiler ... "
 run -:Hd
 
-echo -n "slatex ... "
+echo "======================================== slatex ... "
 $compile slatex.scm
 mkdir -p slatexdir
 rm -f slatexdir/*
 run
 
-echo -n "grep ... "
+echo "======================================== grep ... "
 $compile sgrep.scm
 run compiler.scm
 
-echo -n "fft/boxed ... "
+echo "======================================== fft/boxed ... "
 $compile fft.scm
 run
-echo -n "fft/unboxed ... "
+echo "======================================== fft/unboxed ... "
 $compile fft.scm -D unboxed
 run
-
-echo -n "man-or-boy ... "
-$compile man-or-boy.scm
-run -:d
Trap