~ chicken-core (chicken-5) 7f7ec447321f1c06de46423ebfb4745bd30a2d83
commit 7f7ec447321f1c06de46423ebfb4745bd30a2d83
Author: Evan Hanson <evhan@foldling.org>
AuthorDate: Tue Feb 10 17:55:43 2015 +1300
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Sun Jul 19 21:12:54 2015 +1200
Convert the files unit into a module
diff --git a/README b/README
index e669cb84..cea4a430 100644
--- a/README
+++ b/README
@@ -285,12 +285,12 @@
| | `-- 7
| | |-- chicken.import.so
| | |-- chicken.data-structures.import.so
+ | | |-- chicken.files.import.so
| | |-- chicken.ports.import.so
| | |-- chicken.tcp.import.so
| | |-- chicken.utils.import.so
| | |-- csi.import.so
| | |-- extras.import.so
- | | |-- files.import.so
| | |-- foreign.import.so
| | |-- irregex.import.so
| | |-- lolevel.import.so
diff --git a/batch-driver.scm b/batch-driver.scm
index 16b76795..a44da93a 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 files
+(import chicken scheme extras
chicken.data-structures
+ chicken.files
chicken.compiler.support
chicken.compiler.compiler-syntax
chicken.compiler.core
diff --git a/chicken-install.scm b/chicken-install.scm
index 2dede2fd..b0b480f5 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -29,11 +29,12 @@
(module main ()
- (import scheme chicken posix irregex extras files)
+ (import scheme chicken posix irregex extras)
(import setup-download setup-api)
(import foreign)
(import chicken.data-structures
+ chicken.files
chicken.ports
chicken.utils)
@@ -45,13 +46,13 @@
"setup-download.so" "setup-download.import.so"
"chicken.import.so"
"chicken.data-structures.import.so"
+ "chicken.files.import.so"
"chicken.ports.import.so"
"chicken.tcp.import.so"
"chicken.utils.import.so"
"lolevel.import.so"
"srfi-1.import.so"
"srfi-4.import.so"
- "files.import.so"
"posix.import.so"
"extras.import.so"
"foreign.import.so"
diff --git a/chicken-status.scm b/chicken-status.scm
index 501050dd..7d7a8255 100644
--- a/chicken-status.scm
+++ b/chicken-status.scm
@@ -30,8 +30,9 @@
(module main ()
(import scheme chicken foreign)
- (import posix irregex files setup-api extras)
+ (import posix irregex setup-api extras)
(import chicken.data-structures
+ chicken.files
chicken.ports)
(include "mini-srfi-1.scm")
diff --git a/chicken-uninstall.scm b/chicken-uninstall.scm
index 843e7683..39c8ea71 100644
--- a/chicken-uninstall.scm
+++ b/chicken-uninstall.scm
@@ -33,8 +33,9 @@
(import scheme chicken foreign)
(import setup-api)
- (import posix irregex files)
+ (import posix irregex)
(import chicken.data-structures
+ chicken.files
chicken.ports
chicken.utils)
diff --git a/chicken.scm b/chicken.scm
index 00e243e7..fac1817d 100644
--- a/chicken.scm
+++ b/chicken.scm
@@ -27,7 +27,7 @@
(declare
(uses chicken-syntax chicken-ffi-syntax
- srfi-4 utils files extras data-structures support
+ srfi-4 utils extras data-structures support
compiler optimizer lfa2 compiler-syntax scrutinizer
;; TODO: These three need to be made configurable somehow
batch-driver c-platform c-backend))
diff --git a/csc.scm b/csc.scm
index e921ddfd..916a09bc 100644
--- a/csc.scm
+++ b/csc.scm
@@ -30,6 +30,7 @@
(uses data-structures utils files extras))
(import chicken.data-structures
+ chicken.files
chicken.utils)
(include "mini-srfi-1.scm")
diff --git a/defaults.make b/defaults.make
index 64eb346f..63200c79 100644
--- a/defaults.make
+++ b/defaults.make
@@ -267,10 +267,10 @@ CHICKEN_PROGRAM_OPTIONS += $(if $(PROFILE_OBJECTS),-profile)
# import libraries
-PRIMITIVE_IMPORT_LIBRARIES = chicken lolevel srfi-4 files
+PRIMITIVE_IMPORT_LIBRARIES = chicken lolevel srfi-4
PRIMITIVE_IMPORT_LIBRARIES += posix extras foreign csi irregex
PRIMITIVE_IMPORT_LIBRARIES += setup-api setup-download
-DYNAMIC_IMPORT_LIBRARIES = data-structures ports tcp utils
+DYNAMIC_IMPORT_LIBRARIES = data-structures files ports tcp utils
# targets
diff --git a/distribution/manifest b/distribution/manifest
index 759bc600..f658cae8 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -236,12 +236,12 @@ modules.c
chicken-syntax.scm
chicken-syntax.c
common-declarations.scm
-files.import.scm
-files.import.c
chicken.import.scm
chicken.import.c
chicken.data-structures.import.scm
chicken.data-structures.import.c
+chicken.files.import.scm
+chicken.files.import.c
chicken.ports.import.scm
chicken.ports.import.c
chicken.tcp.import.scm
diff --git a/files.import.scm b/files.import.scm
deleted file mode 100644
index 8bc0ac1f..00000000
--- a/files.import.scm
+++ /dev/null
@@ -1,48 +0,0 @@
-;;;; files.import.scm - import library for "files" 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
- 'files
- '(delete-file*
- file-copy
- file-move
- make-pathname
- directory-null?
- make-absolute-pathname
- create-temporary-directory
- create-temporary-file
- decompose-directory
- decompose-pathname
- absolute-pathname?
- pathname-directory
- pathname-extension
- pathname-file
- pathname-replace-directory
- pathname-replace-extension
- pathname-replace-file
- pathname-strip-directory
- pathname-strip-extension
- normalize-pathname))
diff --git a/files.scm b/files.scm
index 272d5960..ec62d9a8 100644
--- a/files.scm
+++ b/files.scm
@@ -36,9 +36,8 @@
(declare
(unit files)
- (uses irregex data-structures)
+ (uses extras irregex data-structures)
(fixnum)
- (hide chop-pds absolute-pathname-root root-origin root-directory split-directory)
(disable-interrupts)
(foreign-declare #<<EOF
#include <errno.h>
@@ -52,6 +51,17 @@
EOF
))
+(module chicken.files
+ (delete-file* file-copy file-move make-pathname directory-null?
+ make-absolute-pathname create-temporary-directory
+ create-temporary-file decompose-directory decompose-pathname
+ absolute-pathname? pathname-directory pathname-extension
+ pathname-file pathname-replace-directory pathname-replace-extension
+ pathname-replace-file pathname-strip-directory
+ pathname-strip-extension normalize-pathname)
+
+(import scheme chicken foreign)
+(import extras irregex)
(import chicken.data-structures)
(include "common-declarations.scm")
@@ -449,3 +459,5 @@ EOF
(rt (absolute-pathname-root dir))
(org (root-origin rt)) )
(values org (root-directory rt) (strip-origin-prefix org (and (not (null? ls)) ls))) ) )
+
+)
diff --git a/modules.scm b/modules.scm
index c7965d5d..780fb32c 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 'files 'chicken.files)
(##sys#register-module-alias 'ports 'chicken.ports)
(##sys#register-module-alias 'tcp 'chicken.tcp)
(##sys#register-module-alias 'utils 'chicken.utils)
diff --git a/posixunix.scm b/posixunix.scm
index 86e6bcda..1220a01d 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -41,10 +41,10 @@
;;; common code
-(include "posix-common.scm")
-
-(import chicken.ports)
+(import chicken.files
+ chicken.ports)
+(include "posix-common.scm")
(declare
(foreign-declare #<<EOF
diff --git a/posixwin.scm b/posixwin.scm
index 35c1b63a..215a095b 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -661,9 +661,10 @@ EOF
;;; common code
-(include "posix-common.scm")
+(import chicken.files
+ chicken.ports)
-(import chicken.ports)
+(include "posix-common.scm")
;;; Lo-level I/O:
diff --git a/rules.make b/rules.make
index e5ef7c13..cf29d4a2 100644
--- a/rules.make
+++ b/rules.make
@@ -527,7 +527,8 @@ c-platform.c: c-platform.scm mini-srfi-1.scm \
chicken.compiler.optimizer.import.scm \
chicken.compiler.support.import.scm \
chicken.compiler.core.import.scm \
- chicken.data-structures.import.scm
+ chicken.data-structures.import.scm \
+ chicken.files.import.scm
c-backend.c: c-backend.scm mini-srfi-1.scm \
chicken.compiler.c-platform.import.scm \
chicken.compiler.support.import.scm \
@@ -543,6 +544,7 @@ optimizer.c: optimizer.scm mini-srfi-1.scm \
scrutinizer.c: scrutinizer.scm mini-srfi-1.scm \
chicken.compiler.support.import.scm \
chicken.data-structures.import.scm \
+ chicken.files.import.scm \
chicken.ports.import.scm
lfa2.c: lfa2.scm mini-srfi-1.scm \
chicken.compiler.support.import.scm
@@ -554,9 +556,11 @@ 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.files.import.scm \
chicken.ports.import.scm
csc.c: csc.scm \
chicken.data-structures.import.scm \
+ chicken.files.import.scm \
chicken.utils.import.scm
csi.c: csi.scm \
chicken.data-structures.import.scm \
@@ -569,32 +573,39 @@ chicken-profile.c: chicken-profile.scm \
chicken.data-structures.import.scm
chicken-status.c: chicken-status.scm \
chicken.data-structures.import.scm \
+ chicken.files.import.scm \
chicken.ports.import.scm \
setup-api.import.scm
chicken-install.c: chicken-install.scm \
chicken.data-structures.import.scm \
+ chicken.files.import.scm \
chicken.ports.import.scm \
chicken.utils.import.scm \
setup-api.import.scm \
setup-download.import.scm
chicken-uninstall.c: chicken-uninstall.scm \
chicken.data-structures.import.scm \
+ chicken.files.import.scm \
chicken.ports.import.scm \
chicken.utils.import.scm \
setup-api.import.scm
setup-api.c: setup-api.scm \
chicken.data-structures.import.scm \
+ chicken.files.import.scm \
chicken.ports.import.scm \
chicken.utils.import.scm
setup-download.c: setup-download.scm \
chicken.data-structures.import.scm \
+ chicken.files.import.scm \
chicken.ports.import.scm \
chicken.tcp.import.scm \
chicken.utils.import.scm \
setup-api.import.scm
posixunix.c: posixunix.scm \
+ chicken.files.import.scm \
chicken.ports.import.scm
posixwin.c: posixwin.scm \
+ chicken.files.import.scm \
chicken.ports.import.scm
extras.c: extras.scm \
chicken.data-structures.import.scm
@@ -603,7 +614,8 @@ files.c: files.scm \
tcp.c: tcp.scm \
chicken.ports.import.scm
utils.c: utils.scm \
- chicken.data-structures.import.scm
+ chicken.data-structures.import.scm \
+ chicken.files.import.scm
define profile-flags
$(if $(filter $(basename $(1)),$(PROFILE_OBJECTS)),-profile)
@@ -636,7 +648,7 @@ data-structures.c: $(SRCDIR)data-structures.scm $(SRCDIR)common-declarations.scm
ports.c: $(SRCDIR)ports.scm $(SRCDIR)common-declarations.scm
$(bootstrap-lib) -emit-import-library chicken.ports
files.c: $(SRCDIR)files.scm $(SRCDIR)common-declarations.scm
- $(bootstrap-lib)
+ $(bootstrap-lib) -emit-import-library chicken.files
lolevel.c: $(SRCDIR)lolevel.scm $(SRCDIR)common-declarations.scm
$(bootstrap-lib)
tcp.c: $(SRCDIR)tcp.scm $(SRCDIR)common-declarations.scm
diff --git a/scrutinizer.scm b/scrutinizer.scm
index 490cda7a..b0c3d28d 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 files
+(import chicken scheme extras
chicken.compiler.support
chicken.data-structures
+ chicken.files
chicken.ports)
(include "tweaks")
diff --git a/setup-api.scm b/setup-api.scm
index 96817d76..afa2efbc 100644
--- a/setup-api.scm
+++ b/setup-api.scm
@@ -66,8 +66,9 @@
setup-error-handling)
(import scheme chicken foreign
- irregex posix extras files
+ irregex posix extras
chicken.data-structures
+ chicken.files
chicken.ports
chicken.utils)
diff --git a/setup-download.scm b/setup-download.scm
index c3455490..e143cb0d 100644
--- a/setup-download.scm
+++ b/setup-download.scm
@@ -37,9 +37,10 @@
temporary-directory)
(import scheme chicken foreign)
- (import extras irregex posix files
+ (import extras irregex posix
setup-api
chicken.data-structures
+ chicken.files
chicken.tcp
chicken.utils)
diff --git a/support.scm b/support.scm
index 477d95bf..54a3ca4a 100644
--- a/support.scm
+++ b/support.scm
@@ -75,8 +75,9 @@
;; in a lot of other places.
number-type unsafe)
-(import chicken scheme foreign files extras
+(import chicken scheme foreign extras
chicken.data-structures
+ chicken.files
chicken.ports)
(include "tweaks")
diff --git a/tests/port-tests.scm b/tests/port-tests.scm
index 4122df59..588a487a 100644
--- a/tests/port-tests.scm
+++ b/tests/port-tests.scm
@@ -1,4 +1,4 @@
-(require-extension data-structures ports utils srfi-4 extras tcp posix)
+(require-extension data-structures files ports srfi-4 tcp utils)
(include "test.scm")
(test-begin)
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 297bfc35..2986c5ce 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -38,7 +38,7 @@ mkdir -p test-repository
for x in setup-api.so setup-api.import.so setup-download.so \
setup-download.import.so chicken.import.so lolevel.import.so \
srfi-4.import.so chicken.data-structures.import.so \
- chicken.ports.import.so chicken.utils.import.so files.import.so \
+ chicken.ports.import.so chicken.utils.import.so chicken.files.import.so \
posix.import.so \
extras.import.so \
irregex.import.so chicken.tcp.import.so \
diff --git a/types.db b/types.db
index 67de25e0..ffc0342c 100644
--- a/types.db
+++ b/types.db
@@ -1519,26 +1519,26 @@
;; files
-(delete-file* (#(procedure #:clean #:enforce) delete-file* (string) *))
-(file-copy (#(procedure #:clean #:enforce) file-copy (string string #!optional * fixnum) fixnum))
-(file-move (#(procedure #:clean #:enforce) file-move (string string #!optional * fixnum) fixnum))
-(make-pathname (#(procedure #:clean #:enforce) make-pathname ((or string (list-of string) false) #!optional (or string false) (or string false)) string))
-(directory-null? (#(procedure #:clean #:enforce) directory-null? (string) boolean))
-(make-absolute-pathname (#(procedure #:clean #:enforce) make-absolute-pathname (* #!optional string string) string))
-(create-temporary-directory (#(procedure #:clean #:enforce) create-temporary-directory () string))
-(create-temporary-file (#(procedure #:clean #:enforce) create-temporary-file (#!optional string) string))
-(decompose-directory (#(procedure #:clean #:enforce) decompose-directory (string) * * *))
-(decompose-pathname (#(procedure #:clean #:enforce) decompose-pathname (string) * * *))
-(absolute-pathname? (#(procedure #:clean #:enforce) absolute-pathname? (string) boolean))
-(pathname-directory (#(procedure #:clean #:enforce) pathname-directory (string) *))
-(pathname-extension (#(procedure #:clean #:enforce) pathname-extension (string) *))
-(pathname-file (#(procedure #:clean #:enforce) pathname-file (string) *))
-(pathname-replace-directory (#(procedure #:clean #:enforce) pathname-replace-directory (string string) string))
-(pathname-replace-extension (#(procedure #:clean #:enforce) pathname-replace-extension (string string) string))
-(pathname-replace-file (#(procedure #:clean #:enforce) pathname-replace-file (string string) string))
-(pathname-strip-directory (#(procedure #:clean #:enforce) pathname-strip-directory (string) string))
-(pathname-strip-extension (#(procedure #:clean #:enforce) pathname-strip-extension (string) string))
-(normalize-pathname (#(procedure #:clean #:enforce) normalize-pathname (string #!optional symbol) string))
+(chicken.files#delete-file* (#(procedure #:clean #:enforce) chicken.files#delete-file* (string) *))
+(chicken.files#file-copy (#(procedure #:clean #:enforce) chicken.files#file-copy (string string #!optional * fixnum) fixnum))
+(chicken.files#file-move (#(procedure #:clean #:enforce) chicken.files#file-move (string string #!optional * fixnum) fixnum))
+(chicken.files#make-pathname (#(procedure #:clean #:enforce) chicken.files#make-pathname ((or string (list-of string) false) #!optional (or string false) (or string false)) string))
+(chicken.files#directory-null? (#(procedure #:clean #:enforce) chicken.files#directory-null? (string) boolean))
+(chicken.files#make-absolute-pathname (#(procedure #:clean #:enforce) chicken.files#make-absolute-pathname (* #!optional string string) string))
+(chicken.files#create-temporary-directory (#(procedure #:clean #:enforce) chicken.files#create-temporary-directory () string))
+(chicken.files#create-temporary-file (#(procedure #:clean #:enforce) chicken.files#create-temporary-file (#!optional string) string))
+(chicken.files#decompose-directory (#(procedure #:clean #:enforce) chicken.files#decompose-directory (string) * * *))
+(chicken.files#decompose-pathname (#(procedure #:clean #:enforce) chicken.files#decompose-pathname (string) * * *))
+(chicken.files#absolute-pathname? (#(procedure #:clean #:enforce) chicken.files#absolute-pathname? (string) boolean))
+(chicken.files#pathname-directory (#(procedure #:clean #:enforce) chicken.files#pathname-directory (string) *))
+(chicken.files#pathname-extension (#(procedure #:clean #:enforce) chicken.files#pathname-extension (string) *))
+(chicken.files#pathname-file (#(procedure #:clean #:enforce) chicken.files#pathname-file (string) *))
+(chicken.files#pathname-replace-directory (#(procedure #:clean #:enforce) chicken.files#pathname-replace-directory (string string) string))
+(chicken.files#pathname-replace-extension (#(procedure #:clean #:enforce) chicken.files#pathname-replace-extension (string string) string))
+(chicken.files#pathname-replace-file (#(procedure #:clean #:enforce) chicken.files#pathname-replace-file (string string) string))
+(chicken.files#pathname-strip-directory (#(procedure #:clean #:enforce) chicken.files#pathname-strip-directory (string) string))
+(chicken.files#pathname-strip-extension (#(procedure #:clean #:enforce) chicken.files#pathname-strip-extension (string) string))
+(chicken.files#normalize-pathname (#(procedure #:clean #:enforce) chicken.files#normalize-pathname (string #!optional symbol) string))
;; irregex
diff --git a/utils.scm b/utils.scm
index 01821db2..a6095487 100644
--- a/utils.scm
+++ b/utils.scm
@@ -41,8 +41,9 @@
qs)
(import scheme chicken)
-(import extras files foreign irregex posix)
-(import chicken.data-structures)
+(import extras foreign irregex posix)
+(import chicken.data-structures
+ chicken.files)
(include "common-declarations.scm")
Trap