~ chicken-core (chicken-5) 1b7ffe2138160fa26766c24d3bd56e1bd9b20e86


commit 1b7ffe2138160fa26766c24d3bd56e1bd9b20e86
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Wed Feb 11 09:17:47 2015 +1300
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Wed Feb 11 09:17:47 2015 +1300

    Convert the extras unit into a module
    
    Includes minor workarounds in build-version.scm and posix-common.scm to
    avoid depending on extras (and associated bootstrapping problems).

diff --git a/README b/README
index 84d4e9fc..8ea79754 100644
--- a/README
+++ b/README
@@ -285,6 +285,7 @@
 	|   |   `-- 7
 	|   |       |-- chicken.import.so
 	|   |       |-- chicken.data-structures.import.so
+	|   |       |-- chicken.extras.import.so
 	|   |       |-- chicken.files.import.so
 	|   |       |-- chicken.lolevel.import.so
 	|   |       |-- chicken.ports.import.so
@@ -292,7 +293,6 @@
 	|   |       |-- chicken.tcp.import.so
 	|   |       |-- chicken.utils.import.so
 	|   |       |-- csi.import.so
-	|   |       |-- extras.import.so
 	|   |       |-- foreign.import.so
 	|   |       |-- irregex.import.so
 	|   |       |-- modules.db
diff --git a/batch-driver.scm b/batch-driver.scm
index a44da93a..82c9b6b8 100644
--- a/batch-driver.scm
+++ b/batch-driver.scm
@@ -40,8 +40,9 @@
      user-options-pass user-read-pass user-preprocessor-pass user-pass
      user-post-analysis-pass)
 
-(import chicken scheme extras
+(import chicken scheme
 	chicken.data-structures
+	chicken.extras
 	chicken.files
 	chicken.compiler.support
 	chicken.compiler.compiler-syntax
diff --git a/build-version.scm b/build-version.scm
index 1040e0a4..5dc66c65 100644
--- a/build-version.scm
+++ b/build-version.scm
@@ -36,10 +36,12 @@
    (lambda (x r c)
      (let ((fn (cadr x)))
        (and (file-exists? fn)
-	    (let ((ver (with-input-from-file (cadr x) read-line)))
-	      (if (or (eof-object? ver) (string=? ver ""))
-		  #f
-		  ver)))))))
+	    (call-with-input-file (cadr x)
+	     (lambda (p)
+	       (let ((ver ((##sys#slot (##sys#slot p 2) 8) p 256))) ; read-line
+		 (if (or (eof-object? ver) (string=? ver ""))
+		     #f
+		     ver)))))))))
 
 (define (##sys#build-tag)   (foreign-value "C_BUILD_TAG" c-string))
 (define ##sys#build-id      (read-version "buildid"))
diff --git a/chicken-bug.scm b/chicken-bug.scm
index c0be407c..197f78e3 100644
--- a/chicken-bug.scm
+++ b/chicken-bug.scm
@@ -26,8 +26,8 @@
 
 (require-library posix tcp data-structures utils extras)
 
-(import extras
-	chicken.data-structures
+(import chicken.data-structures
+	chicken.extras
 	chicken.posix
 	chicken.tcp
 	chicken.utils)
diff --git a/chicken-install.scm b/chicken-install.scm
index 3c3170fd..9560154a 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -29,11 +29,12 @@
 
 (module main ()
 
-  (import scheme chicken irregex extras)
+  (import scheme chicken irregex)
   (import setup-download setup-api)
 
   (import foreign)
   (import chicken.data-structures
+	  chicken.extras
 	  chicken.files
 	  chicken.ports
 	  chicken.posix
@@ -47,6 +48,7 @@
       "setup-download.so" "setup-download.import.so"
       "chicken.import.so"
       "chicken.data-structures.import.so"
+      "chicken.extras.import.so"
       "chicken.files.import.so"
       "chicken.lolevel.import.so"
       "chicken.ports.import.so"
@@ -55,7 +57,6 @@
       "chicken.utils.import.so"
       "srfi-1.import.so"
       "srfi-4.import.so"
-      "extras.import.so"
       "foreign.import.so"
       "csi.import.so"
       "irregex.import.so"
diff --git a/chicken-status.scm b/chicken-status.scm
index a780841a..4b602f61 100644
--- a/chicken-status.scm
+++ b/chicken-status.scm
@@ -30,8 +30,9 @@
 (module main ()
   
   (import scheme chicken foreign)
-  (import irregex setup-api extras)
+  (import irregex setup-api)
   (import chicken.data-structures
+	  chicken.extras
 	  chicken.files
 	  chicken.ports
 	  chicken.posix)
diff --git a/common-declarations.scm b/common-declarations.scm
index 8f920e10..843177bc 100644
--- a/common-declarations.scm
+++ b/common-declarations.scm
@@ -32,7 +32,8 @@
   (define-syntax d
     (syntax-rules ()
       ((_ arg1)
-       (when (##sys#fudge 13) (pp arg1))) ; debug-mode
+       (when (##sys#fudge 13) ; debug-mode
+         (chicken.extras#pp arg1)))
       ((_ arg1 more ...)
        (when (##sys#fudge 13)
 	 (print arg1 more ...))))))
diff --git a/core.scm b/core.scm
index 4c51c2f2..23230902 100644
--- a/core.scm
+++ b/core.scm
@@ -314,10 +314,11 @@
      constant-table immutable-constants inline-table line-number-database-2
      line-number-database-size)
 
-(import chicken scheme foreign extras
+(import chicken scheme foreign
 	chicken.compiler.scrutinizer
 	chicken.compiler.support
-	chicken.data-structures)
+	chicken.data-structures
+	chicken.extras)
 
 (define (d arg1 . more)
   (when (##sys#fudge 13)		; debug mode?
diff --git a/csc.scm b/csc.scm
index 916a09bc..3beb6633 100644
--- a/csc.scm
+++ b/csc.scm
@@ -30,6 +30,7 @@
   (uses data-structures utils files extras))
 
 (import chicken.data-structures
+	chicken.extras
 	chicken.files
 	chicken.utils)
 
diff --git a/csi.scm b/csi.scm
index 6685af44..f7a594d2 100644
--- a/csi.scm
+++ b/csi.scm
@@ -55,6 +55,7 @@ EOF
 	history-add history-ref history-clear history-show) )
 
 (import chicken.data-structures
+	chicken.extras
 	chicken.ports)
 
 
diff --git a/defaults.make b/defaults.make
index 07eca241..d99865a5 100644
--- a/defaults.make
+++ b/defaults.make
@@ -268,10 +268,10 @@ CHICKEN_PROGRAM_OPTIONS += $(if $(PROFILE_OBJECTS),-profile)
 # import libraries
 
 PRIMITIVE_IMPORT_LIBRARIES = chicken srfi-4
-PRIMITIVE_IMPORT_LIBRARIES += extras foreign csi irregex
+PRIMITIVE_IMPORT_LIBRARIES += foreign csi irregex
 PRIMITIVE_IMPORT_LIBRARIES += setup-api setup-download
 POSIX_IMPORT_LIBRARY = posix
-DYNAMIC_IMPORT_LIBRARIES = data-structures files lolevel ports tcp utils
+DYNAMIC_IMPORT_LIBRARIES = data-structures extras files lolevel ports tcp utils
 
 # targets
 
diff --git a/distribution/manifest b/distribution/manifest
index 8edaf0bd..cae1947a 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -240,6 +240,8 @@ chicken.import.scm
 chicken.import.c
 chicken.data-structures.import.scm
 chicken.data-structures.import.c
+chicken.extras.import.scm
+chicken.extras.import.c
 chicken.files.import.scm
 chicken.files.import.c
 chicken.lolevel.import.scm
@@ -255,10 +257,8 @@ chicken.utils.import.c
 foreign.import.scm
 foreign.import.c
 srfi-4.import.scm
-extras.import.scm
 irregex.import.scm
 srfi-4.import.c
-extras.import.c
 irregex.import.c
 csi.import.scm
 csi.import.c
diff --git a/extras.import.scm b/extras.import.scm
deleted file mode 100644
index da49b53f..00000000
--- a/extras.import.scm
+++ /dev/null
@@ -1,48 +0,0 @@
-;;;; extras.import.scm - import library for "extras" module
-;
-; Copyright (c) 2008-2015, The CHICKEN Team
-; 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.
-
-
-(##sys#register-primitive-module
- 'extras
- '(format
-   fprintf
-   pp
-   pretty-print
-   pretty-print-width
-   printf
-   random
-   randomize
-   read-buffered
-   read-byte
-   read-file
-   read-line
-   read-lines
-   read-string
-   read-string!
-   read-token
-   sprintf
-   write-byte
-   write-line
-   write-string))
diff --git a/extras.scm b/extras.scm
index 32c0f885..975bdac0 100644
--- a/extras.scm
+++ b/extras.scm
@@ -29,9 +29,13 @@
  (unit extras)
  (uses data-structures))
 
-(declare
-  (hide fprintf0 generic-write) )
+(module chicken.extras
+  (format fprintf pp pretty-print pretty-print-width printf
+   random randomize read-buffered read-byte read-file read-line
+   read-lines read-string read-string! read-token sprintf
+   write-byte write-line write-string)
 
+(import scheme chicken)
 (import chicken.data-structures)
 
 (include "common-declarations.scm")
@@ -655,3 +659,4 @@
 
 (register-feature! 'srfi-28)
 
+)
diff --git a/files.scm b/files.scm
index ec62d9a8..685a9542 100644
--- a/files.scm
+++ b/files.scm
@@ -61,8 +61,9 @@ EOF
    pathname-strip-extension normalize-pathname)
 
 (import scheme chicken foreign)
-(import extras irregex)
-(import chicken.data-structures)
+(import irregex)
+(import chicken.data-structures
+	chicken.extras)
 
 (include "common-declarations.scm")
 
diff --git a/modules.scm b/modules.scm
index d6649322..d732e880 100644
--- a/modules.scm
+++ b/modules.scm
@@ -914,6 +914,7 @@
 
 (##sys#register-module-alias 'r5rs 'scheme)
 (##sys#register-module-alias 'data-structures 'chicken.data-structures)
+(##sys#register-module-alias 'extras 'chicken.extras)
 (##sys#register-module-alias 'files 'chicken.files)
 (##sys#register-module-alias 'lolevel 'chicken.lolevel)
 (##sys#register-module-alias 'ports 'chicken.ports)
diff --git a/ports.scm b/ports.scm
index 8a5cfdcb..e419bc2a 100644
--- a/ports.scm
+++ b/ports.scm
@@ -54,7 +54,7 @@
    with-output-to-string)
 
 (import scheme chicken)
-(import extras)
+(import chicken.extras)
 
 (include "common-declarations.scm")
 
diff --git a/posix-common.scm b/posix-common.scm
index 70772baa..fd4a8c58 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -203,12 +203,15 @@ EOF
   (er-macro-transformer
    (lambda (x r c)
      ;; no need to rename here
-     (let ((name (cadr x)))
+     (let* ((mode (cadr x))
+	    (name (symbol->string mode)))
        `(##core#begin
 	 (declare
 	   (foreign-declare
-	    ,(sprintf "#ifndef ~a~%#define ~a S_IFREG~%#endif~%" name name)))
-	 (define-foreign-variable ,name unsigned-int))))))
+	     ,(string-append "#ifndef " name "\n"
+			     "#define " name " S_IFREG\n"
+			     "#endif\n")))
+	 (define-foreign-variable ,mode unsigned-int))))))
 
 (stat-mode S_IFLNK)
 (stat-mode S_IFREG)
diff --git a/rules.make b/rules.make
index 618bc804..addef24d 100644
--- a/rules.make
+++ b/rules.make
@@ -532,6 +532,7 @@ c-platform.c: c-platform.scm mini-srfi-1.scm \
 		chicken.compiler.support.import.scm \
 		chicken.compiler.core.import.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.files.import.scm
 c-backend.c: c-backend.scm mini-srfi-1.scm \
 		chicken.compiler.c-platform.import.scm \
@@ -541,13 +542,16 @@ c-backend.c: c-backend.scm mini-srfi-1.scm \
 core.c: core.scm mini-srfi-1.scm \
 		chicken.compiler.scrutinizer.import.scm \
 		chicken.compiler.support.import.scm \
-		chicken.data-structures.import.scm
+		chicken.data-structures.import.scm \
+		chicken.extras.import.scm
 optimizer.c: optimizer.scm mini-srfi-1.scm \
 		chicken.compiler.support.import.scm \
-		chicken.data-structures.import.scm
+		chicken.data-structures.import.scm \
+		chicken.extras.import.scm
 scrutinizer.c: scrutinizer.scm mini-srfi-1.scm \
 		chicken.compiler.support.import.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.files.import.scm \
 		chicken.ports.import.scm
 lfa2.c: lfa2.scm mini-srfi-1.scm \
@@ -560,6 +564,7 @@ chicken-ffi-syntax.c: chicken-ffi-syntax.scm \
 		chicken.data-structures.import.scm
 support.c: support.scm mini-srfi-1.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.files.import.scm \
 		chicken.ports.import.scm
 csc.c: csc.scm \
@@ -568,21 +573,25 @@ csc.c: csc.scm \
 		chicken.utils.import.scm
 csi.c: csi.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.ports.import.scm
 chicken-bug.c: chicken-bug.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.tcp.import.scm \
 		chicken.utils.import.scm
 chicken-profile.c: chicken-profile.scm \
 		chicken.data-structures.import.scm
 chicken-status.c: chicken-status.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.files.import.scm \
 		chicken.ports.import.scm \
 		chicken.posix.import.scm \
 		setup-api.import.scm
 chicken-install.c: chicken-install.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.files.import.scm \
 		chicken.ports.import.scm \
 		chicken.posix.import.scm \
@@ -598,12 +607,14 @@ chicken-uninstall.c: chicken-uninstall.scm \
 		setup-api.import.scm
 setup-api.c: setup-api.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.files.import.scm \
 		chicken.ports.import.scm \
 		chicken.posix.import.scm \
 		chicken.utils.import.scm
 setup-download.c: setup-download.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.files.import.scm \
 		chicken.ports.import.scm \
 		chicken.posix.import.scm \
@@ -619,11 +630,15 @@ posixwin.c: posixwin.scm \
 extras.c: extras.scm \
 		chicken.data-structures.import.scm
 files.c: files.scm \
-		chicken.data-structures.import.scm
+		chicken.data-structures.import.scm \
+		chicken.extras.import.scm
+ports.c: ports.scm \
+		chicken.extras.import.scm
 tcp.c: tcp.scm \
 		chicken.ports.import.scm
 utils.c: utils.scm \
 		chicken.data-structures.import.scm \
+		chicken.extras.import.scm \
 		chicken.files.import.scm \
 		chicken.posix.import.scm
 
@@ -642,7 +657,7 @@ expand.c: $(SRCDIR)expand.scm $(SRCDIR)synrules.scm $(SRCDIR)common-declarations
 modules.c: $(SRCDIR)modules.scm $(SRCDIR)common-declarations.scm $(SRCDIR)mini-srfi-1.scm
 	$(bootstrap-lib)
 extras.c: $(SRCDIR)extras.scm $(SRCDIR)common-declarations.scm
-	$(bootstrap-lib)
+	$(bootstrap-lib) -emit-import-library chicken.extras
 posixunix.c: $(SRCDIR)posixunix.scm $(SRCDIR)posix-common.scm $(SRCDIR)common-declarations.scm
 	$(bootstrap-lib) -emit-import-library chicken.posix
 posixwin.c: $(SRCDIR)posixwin.scm $(SRCDIR)posix-common.scm $(SRCDIR)common-declarations.scm
diff --git a/scrutinizer.scm b/scrutinizer.scm
index b0c3d28d..490b41ea 100644
--- a/scrutinizer.scm
+++ b/scrutinizer.scm
@@ -33,9 +33,10 @@
     (scrutinize load-type-database emit-type-file
      validate-type check-and-validate-type install-specializations)
 
-(import chicken scheme extras
+(import chicken scheme
 	chicken.compiler.support
 	chicken.data-structures
+	chicken.extras
 	chicken.files
 	chicken.ports)
 
diff --git a/setup-api.scm b/setup-api.scm
index cb2c3570..cd10c283 100644
--- a/setup-api.scm
+++ b/setup-api.scm
@@ -66,8 +66,9 @@
      setup-error-handling)
   
   (import scheme chicken foreign
-	  irregex extras
+	  irregex
 	  chicken.data-structures
+	  chicken.extras
 	  chicken.files
 	  chicken.ports
 	  chicken.posix
diff --git a/setup-download.scm b/setup-download.scm
index 33c89bda..de8ffb28 100644
--- a/setup-download.scm
+++ b/setup-download.scm
@@ -37,9 +37,10 @@
 			temporary-directory)
 
   (import scheme chicken foreign)
-  (import extras irregex
+  (import irregex
 	  setup-api
 	  chicken.data-structures
+	  chicken.extras
 	  chicken.files
 	  chicken.posix
 	  chicken.tcp
diff --git a/support.scm b/support.scm
index 54a3ca4a..d61ff1dd 100644
--- a/support.scm
+++ b/support.scm
@@ -75,8 +75,9 @@
      ;; in a lot of other places.
      number-type unsafe)
 
-(import chicken scheme foreign extras
+(import chicken scheme foreign
 	chicken.data-structures
+	chicken.extras
 	chicken.files
 	chicken.ports)
 
diff --git a/tests/loopy-test.scm b/tests/loopy-test.scm
index 43978f68..003d8103 100644
--- a/tests/loopy-test.scm
+++ b/tests/loopy-test.scm
@@ -1,3 +1,5 @@
+(use (only extras printf))
+
 (load-relative "loopy-loop.scm")
 (load-relative "matchable.scm")
 
diff --git a/tests/port-tests.scm b/tests/port-tests.scm
index af1c215e..1c548e14 100644
--- a/tests/port-tests.scm
+++ b/tests/port-tests.scm
@@ -1,4 +1,4 @@
-(require-extension data-structures files ports posix srfi-4 tcp utils)
+(require-extension data-structures extras files ports posix srfi-4 tcp utils)
 
 (include "test.scm")
 (test-begin)
diff --git a/tests/pp-test.scm b/tests/pp-test.scm
index 1c65a57c..b7f8f593 100644
--- a/tests/pp-test.scm
+++ b/tests/pp-test.scm
@@ -1,6 +1,7 @@
 ;;;; pp-test.scm
 
-(use (only ports with-output-to-string))
+(use (only extras pp)
+     (only ports with-output-to-string))
 
 (define (pp->string thing)
   (with-output-to-string (cut pp thing)))
diff --git a/tests/reader-tests.scm b/tests/reader-tests.scm
index 6fbaddf4..a79684d3 100644
--- a/tests/reader-tests.scm
+++ b/tests/reader-tests.scm
@@ -1,7 +1,8 @@
 ;;;; reader-tests.scm
 
 
-(use (only ports with-input-from-string with-output-to-string)
+(use (only extras read-line)
+     (only ports with-input-from-string with-output-to-string)
      (only utils read-all))
 
 
diff --git a/tests/runtests.sh b/tests/runtests.sh
index b8f712d9..a1f2af05 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -40,7 +40,7 @@ for x in setup-api.so setup-api.import.so setup-download.so \
       srfi-4.import.so chicken.data-structures.import.so \
       chicken.ports.import.so chicken.utils.import.so chicken.files.import.so \
       chicken.posix.import.so \
-      extras.import.so \
+      chicken.extras.import.so \
       irregex.import.so chicken.tcp.import.so \
       foreign.import.so \
       csi.import.so irregex.import.so types.db; do
diff --git a/tests/scrutiny-tests.scm b/tests/scrutiny-tests.scm
index 1d12b4c4..4e4c1f6d 100644
--- a/tests/scrutiny-tests.scm
+++ b/tests/scrutiny-tests.scm
@@ -18,7 +18,7 @@
 (let ((bar +))
   (bar 3 'a))				; expected number, got symbol
 
-(pp)					; expected 1 argument, got 0
+(string?)				; expected 1 argument, got 0
 
 (print (cpu-time))			; expected 1 result, got 2
 (print (values))			; expected 1 result, got 0
diff --git a/tests/scrutiny.expected b/tests/scrutiny.expected
index ff2c0453..a73b8010 100644
--- a/tests/scrutiny.expected
+++ b/tests/scrutiny.expected
@@ -22,7 +22,7 @@ Warning: at toplevel:
   (scrutiny-tests.scm:19) in procedure call to `bar', expected argument #2 of type `number', but was given an argument of type `symbol'
 
 Warning: at toplevel:
-  (scrutiny-tests.scm:21) in procedure call to `pp', expected 1 argument, but was given 0 arguments
+  (scrutiny-tests.scm:21) in procedure call to `string?', expected 1 argument, but was given 0 arguments
 
 Warning: at toplevel:
   expected in argument #1 of procedure call `(print (cpu-time))' a single result, but were given 2 results
diff --git a/tests/srfi-45-tests.scm b/tests/srfi-45-tests.scm
index 1950fd39..9ca20623 100644
--- a/tests/srfi-45-tests.scm
+++ b/tests/srfi-45-tests.scm
@@ -1,7 +1,8 @@
 ;;; Tests adapted from SRFI 45 (for "lazy" -> "delay-force").
 ;;; That SRFI Copyright (C) André van Tonder (2003).
 
-(use (only ports with-output-to-string))
+(use (only extras printf)
+     (only ports with-output-to-string))
 
 (define *errors* 0)
 
diff --git a/tests/syntax-tests.scm b/tests/syntax-tests.scm
index 8839427f..b651b5f5 100644
--- a/tests/syntax-tests.scm
+++ b/tests/syntax-tests.scm
@@ -1,6 +1,6 @@
 ;;;; syntax-tests.scm - various macro tests
 
-
+(use-for-syntax extras)
 (use extras)
 
 
diff --git a/tests/test-irregex.scm b/tests/test-irregex.scm
index 70786392..5496ed75 100644
--- a/tests/test-irregex.scm
+++ b/tests/test-irregex.scm
@@ -1,7 +1,7 @@
 ;;;: test-irregex.scm
 
 
-(use data-structures irregex ports)
+(use data-structures extras irregex ports)
 
 (include "test.scm")
 
diff --git a/types.db b/types.db
index 3c6b7b6c..f951c502 100644
--- a/types.db
+++ b/types.db
@@ -1494,27 +1494,26 @@
 
 ;; extras
 
-(format (procedure format (#!rest) *))
-(fprintf (#(procedure #:enforce) fprintf (output-port string #!rest) undefined))
-(pp (#(procedure #:enforce) pp (* #!optional output-port) undefined))
-(pretty-print (#(procedure #:enforce) pretty-print (* #!optional output-port) undefined))
-(pretty-print-width (#(procedure #:clean) pretty-print-width (#!optional fixnum) *))
-(printf (#(procedure #:enforce) printf (string #!rest) undefined))
-(random (#(procedure #:clean #:enforce) random (fixnum) fixnum))
-(randomize (#(procedure #:clean #:enforce) randomize (#!optional fixnum) undefined))
-(read-buffered (#(procedure #:enforce) read-buffered (#!optional input-port) string))
-(read-byte (#(procedure #:enforce) read-byte (#!optional input-port) *))
-(read-file (#(procedure #:enforce) read-file (#!optional (or input-port string) (procedure (input-port) *) fixnum) list))
-(read-line (#(procedure #:enforce) read-line (#!optional input-port (or false fixnum)) (or eof string)))
-(read-lines (#(procedure #:enforce) read-lines (#!optional (or input-port string) fixnum) (list-of string)))
-(read-string (#(procedure #:enforce) read-string (#!optional (or fixnum false) input-port) string))
-(read-string! (#(procedure #:enforce) read-string! ((or fixnum false) string #!optional input-port fixnum) fixnum))
-
-(read-token (#(procedure #:enforce) read-token ((procedure (char) *) #!optional input-port) string))
-(sprintf (#(procedure #:enforce #:foldable) sprintf (string #!rest) string))
-(write-byte (#(procedure #:enforce) write-byte (fixnum #!optional output-port) undefined))
-(write-line (#(procedure #:enforce) write-line (string #!optional output-port) undefined))
-(write-string (#(procedure #:enforce) write-string (string #!optional * output-port) undefined))
+(chicken.extras#format (procedure chicken.extras#format (#!rest) *))
+(chicken.extras#fprintf (#(procedure #:enforce) chicken.extras#fprintf (output-port string #!rest) undefined))
+(chicken.extras#pp (#(procedure #:enforce) chicken.extras#pp (* #!optional output-port) undefined))
+(chicken.extras#pretty-print (#(procedure #:enforce) chicken.extras#pretty-print (* #!optional output-port) undefined))
+(chicken.extras#pretty-print-width (#(procedure #:clean) chicken.extras#pretty-print-width (#!optional fixnum) *))
+(chicken.extras#printf (#(procedure #:enforce) chicken.extras#printf (string #!rest) undefined))
+(chicken.extras#random (#(procedure #:clean #:enforce) chicken.extras#random (fixnum) fixnum))
+(chicken.extras#randomize (#(procedure #:clean #:enforce) chicken.extras#randomize (#!optional fixnum) undefined))
+(chicken.extras#read-buffered (#(procedure #:enforce) chicken.extras#read-buffered (#!optional input-port) string))
+(chicken.extras#read-byte (#(procedure #:enforce) chicken.extras#read-byte (#!optional input-port) *))
+(chicken.extras#read-file (#(procedure #:enforce) chicken.extras#read-file (#!optional (or input-port string) (procedure (input-port) *) fixnum) list))
+(chicken.extras#read-line (#(procedure #:enforce) chicken.extras#read-line (#!optional input-port (or false fixnum)) (or eof string)))
+(chicken.extras#read-lines (#(procedure #:enforce) chicken.extras#read-lines (#!optional (or input-port string) fixnum) (list-of string)))
+(chicken.extras#read-string (#(procedure #:enforce) chicken.extras#read-string (#!optional (or fixnum false) input-port) string))
+(chicken.extras#read-string! (#(procedure #:enforce) chicken.extras#read-string! ((or fixnum false) string #!optional input-port fixnum) fixnum))
+(chicken.extras#read-token (#(procedure #:enforce) chicken.extras#read-token ((procedure (char) *) #!optional input-port) string))
+(chicken.extras#sprintf (#(procedure #:enforce #:foldable) chicken.extras#sprintf (string #!rest) string))
+(chicken.extras#write-byte (#(procedure #:enforce) chicken.extras#write-byte (fixnum #!optional output-port) undefined))
+(chicken.extras#write-line (#(procedure #:enforce) chicken.extras#write-line (string #!optional output-port) undefined))
+(chicken.extras#write-string (#(procedure #:enforce) chicken.extras#write-string (string #!optional * output-port) undefined))
 
 
 ;; files
diff --git a/utils.scm b/utils.scm
index a68a72a2..3a821bec 100644
--- a/utils.scm
+++ b/utils.scm
@@ -41,8 +41,9 @@
    qs)
 
 (import scheme chicken)
-(import extras foreign irregex)
+(import foreign irregex)
 (import chicken.data-structures
+	chicken.extras
 	chicken.files
 	chicken.posix)
 
Trap