~ chicken-core (chicken-5) 2f519885f0c24bac3460452e95137cbb0c5327b8


commit 2f519885f0c24bac3460452e95137cbb0c5327b8
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Sun Sep 10 17:22:19 2017 +0200
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Wed Sep 13 17:53:51 2017 +1200

    Move delete-file and rename-file from library.scm to file.scm
    
    Nothing really depends on it, so we can move them without problems.
    
    Fix up csc.scm's dependencies while we're at it (it also gets a new
    dependency on file.import.scm)
    
    Signed-off-by: Evan Hanson <evhan@foldling.org>

diff --git a/chicken.import.scm b/chicken.import.scm
index ad4b677f..06212515 100644
--- a/chicken.import.scm
+++ b/chicken.import.scm
@@ -54,7 +54,6 @@
    cplxnum?
    current-error-port
    (current-exception-handler . chicken.condition#current-exception-handler)
-   delete-file
    directory-exists?
    (dynamic-load-libraries . chicken.load#dynamic-load-libraries)
    enable-warnings
@@ -155,7 +154,6 @@
    quotient&remainder
    ratnum?
    (register-feature! . chicken.platform#register-feature!)
-   rename-file
    (repository-path . chicken.platform#repository-path)
    (require . chicken.load#require)
    return-to-host
diff --git a/csc.scm b/csc.scm
index 23241fac..15882f27 100644
--- a/csc.scm
+++ b/csc.scm
@@ -29,12 +29,13 @@
 
 (import scheme
         chicken
-        chicken.posix
+	chicken.file
 	chicken.foreign
 	chicken.format
         chicken.io
-        chicken.process
 	chicken.pathname
+        chicken.posix
+        chicken.process
 	chicken.string)
 
 (include "egg-environment.scm")
diff --git a/file.scm b/file.scm
index f9f42949..0f8f2ea3 100644
--- a/file.scm
+++ b/file.scm
@@ -104,12 +104,30 @@ EOF
 	(apply ##sys#signal-hook type loc (string-append msg " - " (strerror rn)) args) ) ) ) )
 
 
+(define (delete-file filename)
+  (##sys#check-string filename 'delete-file)
+  (unless (eq? 0 (##core#inline "C_delete_file" (##sys#make-c-string filename 'delete-file)))
+    (##sys#update-errno)
+    (##sys#signal-hook
+     #:file-error 'delete-file
+     (##sys#string-append "cannot delete file - " strerror) filename))
+  filename)
+
 ;;; Like `delete-file', but does nothing if the file doesn't exist:
 
 (define delete-file*
   (lambda (file)
     (and (file-exists? file) (delete-file file))))
 
+(define (rename-file old new)
+  (##sys#check-string old 'rename-file)
+  (##sys#check-string new 'rename-file)
+  (unless (eq? 0 (##core#inline "C_rename_file" (##sys#make-c-string old 'rename-file) (##sys#make-c-string new)))
+    (##sys#update-errno)
+    (##sys#signal-hook
+     #:file-error 'rename-file
+     (##sys#string-append "cannot rename file - " strerror) old new))
+  new)
 
 ;;; Directory management:
 
diff --git a/library.scm b/library.scm
index d190fd03..d75635a9 100644
--- a/library.scm
+++ b/library.scm
@@ -2897,26 +2897,6 @@ EOF
       (##sys#values (##sys#slot port 4) (##sys#slot port 5))
       (##sys#error 'port-position "cannot compute position of port" port) ) )
 
-(define (delete-file filename)
-  (##sys#check-string filename 'delete-file)
-  (unless (eq? 0 (##core#inline "C_delete_file" (##sys#make-c-string filename 'delete-file)))
-    (##sys#update-errno)
-    (##sys#signal-hook
-     #:file-error 'delete-file
-     (##sys#string-append "cannot delete file - " strerror) filename) )
-  filename)
-
-(define (rename-file old new)
-  (##sys#check-string old 'rename-file)
-  (##sys#check-string new 'rename-file)
-  (unless (eq? 0 (##core#inline "C_rename_file" (##sys#make-c-string old 'rename-file) (##sys#make-c-string new)))
-    (##sys#update-errno)
-    (##sys#signal-hook
-     #:file-error 'rename-file
-     (##sys#string-append "cannot rename file - " strerror) old new) )
-  new)
-
-
 ;;; Decorate procedure with arbitrary data
 ;
 ; warning: may modify proc, if it already has a suitable decoration!
diff --git a/rules.make b/rules.make
index 2308663e..1bfccfc3 100644
--- a/rules.make
+++ b/rules.make
@@ -640,10 +640,14 @@ modules.c: modules.scm \
 		chicken.platform.import.scm \
 		chicken.syntax.import.scm
 csc.c: csc.scm \
-		chicken.string.import.scm \
+		chicken.file.import.scm \
+		chicken.foreign.import.scm \
 		chicken.format.import.scm \
+		chicken.io.import.scm \
 		chicken.pathname.import.scm \
-		chicken.posix.import.scm
+		chicken.posix.import.scm \
+		chicken.process.import.scm \
+		chicken.string.import.scm
 csi.c: csi.scm \
 		chicken.condition.import.scm \
 		chicken.data-structures.import.scm \
Trap