chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH 1/8] Add chicken.file module


From: Evan Hanson
Subject: [Chicken-hackers] [PATCH 1/8] Add chicken.file module
Date: Thu, 2 Mar 2017 21:50:37 +1300

This is a placeholder for what will eventually be the (chicken file)
module. For now, it simply reexports values from the preexisting "files"
and "posix" units.
---
 README                |  1 +
 chicken-install.scm   |  1 +
 defaults.make         |  2 +-
 distribution/manifest |  4 +++
 eval.scm              |  4 +--
 file.scm              | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
 modules.scm           |  1 +
 rules.make            | 13 ++++++---
 8 files changed, 94 insertions(+), 7 deletions(-)
 create mode 100644 file.scm

diff --git a/README b/README
index 6330571f..2e6c5802 100644
--- a/README
+++ b/README
@@ -282,6 +282,7 @@
        |   |       |-- chicken.errno.import.so
        |   |       |-- chicken.eval.import.so
        |   |       |-- chicken.expand.import.so
+       |   |       |-- chicken.file.import.so
        |   |       |-- chicken.files.import.so
        |   |       |-- chicken.fixnum.import.so
        |   |       |-- chicken.flonum.import.so
diff --git a/chicken-install.scm b/chicken-install.scm
index c17eb4b0..8cf77d4b 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -51,6 +51,7 @@
       "chicken.errno.import.so"
       "chicken.eval.import.so"
       "chicken.expand.import.so"
+      "chicken.file.import.so"
       "chicken.files.import.so"
       "chicken.fixnum.import.so"
       "chicken.flonum.import.so"
diff --git a/defaults.make b/defaults.make
index 00570b2f..4b16640c 100644
--- a/defaults.make
+++ b/defaults.make
@@ -269,7 +269,7 @@ DYNAMIC_CHICKEN_IMPORT_LIBRARIES = bitwise errno fixnum 
flonum format \
        gc io keyword locative memory posix pretty-print random time
 DYNAMIC_CHICKEN_COMPILER_IMPORT_LIBRARIES = user-pass
 DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES = continuation data-structures \
-       eval expand files internal irregex lolevel pathname ports \
+       eval expand file files internal irregex lolevel pathname ports \
        read-syntax repl tcp utils
 
 # targets
diff --git a/distribution/manifest b/distribution/manifest
index 2348a1c9..2d1459ec 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -24,6 +24,7 @@ data-structures.c
 dbg-stub.c
 debugger-client.c
 ports.c
+file.c
 files.c
 extras.c
 internal.c
@@ -77,6 +78,7 @@ extras.scm
 data-structures.scm
 debugger-client.scm
 ports.scm
+file.scm
 files.scm
 chicken-bug.mdoc
 chicken-bug.scm
@@ -276,6 +278,8 @@ chicken.eval.import.scm
 chicken.eval.import.c
 chicken.expand.import.scm
 chicken.expand.import.c
+chicken.file.import.scm
+chicken.file.import.c
 chicken.files.import.scm
 chicken.files.import.c
 chicken.fixnum.import.scm
diff --git a/eval.scm b/eval.scm
index c6dfb7f9..d2dac22e 100644
--- a/eval.scm
+++ b/eval.scm
@@ -88,8 +88,8 @@
 
 (define-constant core-units
   '(chicken-syntax chicken-ffi-syntax continuation data-structures eval
-    expand extras files internal irregex library lolevel pathname ports
-    posix srfi-4 tcp repl read-syntax utils))
+    expand extras file files internal irregex library lolevel pathname
+    ports posix srfi-4 tcp repl read-syntax utils))
 
 (define-constant cygwin-default-dynamic-load-libraries '("cygchicken-0"))
 (define-constant macosx-load-library-extension ".dylib")
diff --git a/file.scm b/file.scm
new file mode 100644
index 00000000..9d5c0201
--- /dev/null
+++ b/file.scm
@@ -0,0 +1,75 @@
+;;;; file.scm - File operations
+;
+; 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 file)
+  (uses files posix)
+  (fixnum)
+  (disable-interrupts))
+
+(module chicken.file
+  (block-device?
+   change-file-mode
+   change-file-owner
+   character-device?
+   create-directory
+   create-fifo
+   create-symbolic-link
+   create-temporary-directory
+   create-temporary-file
+   delete-directory
+   delete-file
+   delete-file*
+   directory
+   directory-exists?
+   directory?
+   fifo?
+   file-copy
+   file-execute-access?
+   file-exists?
+   file-modification-time
+   file-move
+   file-read-access?
+   file-type
+   file-write-access?
+   find-files
+   glob
+   read-symbolic-link
+   regular-file?
+   rename-file
+   socket?
+   symbolic-link?)
+
+(import chicken chicken.files chicken.posix))
diff --git a/modules.scm b/modules.scm
index 2b47abe3..94a60697 100644
--- a/modules.scm
+++ b/modules.scm
@@ -949,6 +949,7 @@
 (##sys#register-module-alias 'errno 'chicken.errno)
 (##sys#register-module-alias 'eval 'chicken.eval)
 (##sys#register-module-alias 'expand 'chicken.expand)
+(##sys#register-module-alias 'file 'chicken.file)
 (##sys#register-module-alias 'files 'chicken.files)
 (##sys#register-module-alias 'fixnum 'chicken.fixnum)
 (##sys#register-module-alias 'flonum 'chicken.flonum)
diff --git a/rules.make b/rules.make
index 6a49d88c..0c1357e7 100644
--- a/rules.make
+++ b/rules.make
@@ -36,10 +36,10 @@ VPATH=$(SRCDIR)
 SETUP_API_OBJECTS_1 = setup-api setup-download
 
 LIBCHICKEN_SCHEME_OBJECTS_1 = \
-       library eval read-syntax repl data-structures pathname ports files \
-       extras lolevel utils tcp srfi-4 continuation $(POSIXFILE) internal \
-       irregex scheduler debugger-client profiler stub expand modules \
-       chicken-syntax chicken-ffi-syntax build-version
+       library eval read-syntax repl data-structures pathname ports file \
+       files extras lolevel utils 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
 LIBCHICKEN_SHARED_OBJECTS = $(LIBCHICKEN_OBJECTS_1:=$(O))
 LIBCHICKEN_STATIC_OBJECTS = $(LIBCHICKEN_OBJECTS_1:=-static$(O))
@@ -744,6 +744,9 @@ eval.c: eval.scm \
                chicken.keyword.import.scm
 repl.c: repl.scm \
                chicken.eval.import.scm
+file.c: file.scm \
+               chicken.files.import.scm \
+               chicken.posix.import.scm
 files.c: files.scm \
                chicken.data-structures.import.scm \
                chicken.io.import.scm \
@@ -823,6 +826,8 @@ pathname.c: $(SRCDIR)pathname.scm 
$(SRCDIR)common-declarations.scm
        $(bootstrap-lib) -emit-import-library chicken.pathname
 ports.c: $(SRCDIR)ports.scm $(SRCDIR)common-declarations.scm
        $(bootstrap-lib) -emit-import-library chicken.ports
+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
 lolevel.c: $(SRCDIR)lolevel.scm $(SRCDIR)common-declarations.scm
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]