[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH 1/2] Drop compile-file and remove the utils uni
From: |
Evan Hanson |
Subject: |
[Chicken-hackers] [PATCH 1/2] Drop compile-file and remove the utils unit |
Date: |
Sat, 4 Mar 2017 12:35:05 +1300 |
The `compile-file` and `compile-file-options` procedures have been moved
to an egg, so the utils unit is now empty and can be dropped entirely.
Also fix the types.db entries for `qs` and `system*`, which have been
moved to the chicken.process module.
---
NEWS | 8 +--
README | 1 -
chicken-install.scm | 3 +-
csc.scm | 2 +-
defaults.make | 2 +-
distribution/manifest | 5 --
eval.scm | 2 +-
manual/Extensions | 2 +-
manual/Modules | 1 -
manual/Non-standard macros and special forms | 2 +-
manual/Supported language | 1 -
manual/Unit posix | 4 +-
manual/Unit tcp | 2 +-
manual/Unit utils | 51 ----------------
modules.scm | 1 -
rules.make | 18 +-----
scripts/compile-all | 2 +-
scripts/makedist.scm | 2 +-
scripts/mini-salmonella.scm | 2 +-
scripts/setversion | 2 +-
setup-api.scm | 2 +-
setup-download.scm | 4 +-
setup.defaults | 2 +-
tests/port-tests.scm | 2 +-
tests/runtests.bat | 2 +-
tests/runtests.sh | 5 +-
tests/sgrep.scm | 2 +-
types.db | 12 ++--
utils.scm | 89 ----------------------------
29 files changed, 33 insertions(+), 200 deletions(-)
delete mode 100644 manual/Unit utils
delete mode 100644 utils.scm
diff --git a/NEWS b/NEWS
index 5099942f..7cbe20dc 100644
--- a/NEWS
+++ b/NEWS
@@ -23,10 +23,10 @@
- Core libraries
- Removed support for memory-mapped files (posix), queues
(data-structures), binary-search (data-structures), scan-input-lines
- (utils), group-information (posix) and object-eviction (lolevel).
- These are now available as eggs.
- - Removed the srfi-1, srfi-13, srfi-14, srfi-18 and srfi-69 units.
- These are now available as eggs.
+ (utils), group-information (posix) object-eviction (lolevel), and
+ compile-file (utils). These are now available as eggs.
+ - Removed the srfi-1, srfi-13, srfi-14, srfi-18, srfi-69, and utils
+ units. These are now available as eggs.
- Added the `executable-pathname` procedure for retrieving a path to
the currently-running executable.
- Removed all support for SWIG.
diff --git a/README b/README
index b7c7e480..573384a1 100644
--- a/README
+++ b/README
@@ -309,7 +309,6 @@
| | |-- chicken.tcp.import.so
| | |-- chicken.time.import.so
| | |-- chicken.time.posix.import.so
- | | |-- chicken.utils.import.so
| | |-- modules.db
| | |-- setup-api.import.so
| | |-- setup-api.so
diff --git a/chicken-install.scm b/chicken-install.scm
index f9f81ba4..97bc167b 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -38,7 +38,7 @@
chicken.port
chicken.posix
chicken.pretty-print
- (only chicken.utils qs))
+ (only chicken.process qs))
(include "mini-srfi-1.scm")
@@ -79,7 +79,6 @@
"chicken.tcp.import.so"
"chicken.time.import.so"
"chicken.time.posix.import.so"
- "chicken.utils.import.so"
"setup-api.import.so"
"setup-api.so"
"setup-download.so"
diff --git a/csc.scm b/csc.scm
index 863216d9..9a3a8b65 100644
--- a/csc.scm
+++ b/csc.scm
@@ -31,7 +31,7 @@
chicken.foreign
chicken.format
chicken.pathname
- chicken.utils)
+ chicken.process)
(include "mini-srfi-1.scm")
diff --git a/defaults.make b/defaults.make
index 1a62e280..607d0849 100644
--- a/defaults.make
+++ b/defaults.make
@@ -271,7 +271,7 @@ DYNAMIC_CHICKEN_IMPORT_LIBRARIES = bitwise errno file.posix
fixnum flonum \
DYNAMIC_CHICKEN_COMPILER_IMPORT_LIBRARIES = user-pass
DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES = continuation data-structures \
eval expand file files internal irregex lolevel pathname port \
- read-syntax repl tcp utils
+ read-syntax repl tcp
# targets
diff --git a/distribution/manifest b/distribution/manifest
index fe61831d..1848d1d3 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -48,7 +48,6 @@ support.c
chicken.compiler.support.import.scm
repl.c
tcp.c
-utils.c
user-pass.c
feathers.in
feathers.bat.in
@@ -234,7 +233,6 @@ tests/reverser/tags/1.1/reverser.scm
tests/rev-app.scm
tests/version-tests.scm
tweaks.scm
-utils.scm
Makefile
Makefile.android
Makefile.aix
@@ -333,8 +331,6 @@ chicken.time.import.scm
chicken.time.import.c
chicken.time.posix.import.scm
chicken.time.posix.import.c
-chicken.utils.import.scm
-chicken.utils.import.c
srfi-4.import.scm
srfi-4.import.c
setup-download.scm
@@ -412,7 +408,6 @@ manual-html/Unit irregex.html
manual-html/Unit repl.html
manual-html/Unit srfi-4.html
manual-html/Unit tcp.html
-manual-html/Unit utils.html
manual-html/Using the compiler.html
manual-html/Using the interpreter.html
manual-html/faq.html
diff --git a/eval.scm b/eval.scm
index 1a017fc7..f1f64715 100644
--- a/eval.scm
+++ b/eval.scm
@@ -89,7 +89,7 @@
(define-constant core-units
'(chicken-syntax chicken-ffi-syntax continuation data-structures eval
expand extras file files internal irregex library lolevel pathname
- port posix srfi-4 tcp repl read-syntax utils))
+ port posix srfi-4 tcp repl read-syntax))
(define-constant cygwin-default-dynamic-load-libraries '("cygchicken-0"))
(define-constant macosx-load-library-extension ".dylib")
diff --git a/manual/Extensions b/manual/Extensions
index f007665a..dace753f 100644
--- a/manual/Extensions
+++ b/manual/Extensions
@@ -33,7 +33,7 @@ downloaded, its contents extracted and the contained
''setup'' script
is executed. This setup script is a normal Scheme source file, which
will be interpreted by {{chicken-install}}. The complete language
supported by {{csi}} is available, and the library units
-{{regex utils posix tcp}} are loaded. Additional libraries can be loaded
+{{regex posix tcp}} are loaded. Additional libraries can be loaded
at run-time.
The setup script should perform all necessary steps to build the new
diff --git a/manual/Modules b/manual/Modules
index a021a1af..8279526a 100644
--- a/manual/Modules
+++ b/manual/Modules
@@ -280,7 +280,6 @@ Everything from the {{library}}, {{eval}} and {{expand}}
library units.
[module] regex
[module] srfi-4
[module] tcp
- [module] utils
Modules exporting the bindings from the respective library units.
diff --git a/manual/Non-standard macros and special forms b/manual/Non-standard
macros and special forms
index 78a56f5a..2072ebc2 100644
--- a/manual/Non-standard macros and special forms
+++ b/manual/Non-standard macros and special forms
@@ -543,7 +543,7 @@ Expands by selecting feature clauses. This form is allowed
to appear in non-topl
Predefined feature-identifiers are "situation" specific:
-; compile : {{chicken}}, {{compiling}}, {{library}}, {{eval}}, {{extras}},
{{utils}}, {{regex}}, {{srfi-0}}, {{srfi-2}}, {{srfi-4}}, {{srfi-6}},
{{srfi-8}}, {{srfi-9}}, {{srfi-10}}, {{srfi-11}}, {{srfi-12}}, {{srfi-15}},
{{srfi-16}}, {{srfi-17}}, {{srfi-23}}, {{srfi-26}}, {{srfi-28}}, {{srfi-30}},
{{srfi-31}}, {{srfi-39}}, {{srfi-55}}, {{srfi-61}}, {{srfi-62}}
+; compile : {{chicken}}, {{compiling}}, {{library}}, {{eval}}, {{extras}},
{{regex}}, {{srfi-0}}, {{srfi-2}}, {{srfi-4}}, {{srfi-6}}, {{srfi-8}},
{{srfi-9}}, {{srfi-10}}, {{srfi-11}}, {{srfi-12}}, {{srfi-15}}, {{srfi-16}},
{{srfi-17}}, {{srfi-23}}, {{srfi-26}}, {{srfi-28}}, {{srfi-30}}, {{srfi-31}},
{{srfi-39}}, {{srfi-55}}, {{srfi-61}}, {{srfi-62}}
; load : {{chicken}}, {{extras}}, {{srfi-0}}, {{srfi-2}}, {{srfi-6}},
{{srfi-8}}, {{srfi-9}}, {{srfi-10}}, {{srfi-12}}, {{srfi-17}}, {{srfi-23}},
{{srfi-28}}, {{srfi-30}}, {{srfi-39}}, {{srfi-55}}, {{srfi-61}}, {{srfi-62}}.
{{library}} is implicit.
diff --git a/manual/Supported language b/manual/Supported language
index 3573a4af..1a77c80f 100644
--- a/manual/Supported language
+++ b/manual/Supported language
@@ -24,7 +24,6 @@
* [[Unit irregex]] Regular expressions
* [[Unit srfi-4]] Homogeneous numeric vectors
* [[Unit posix]] Unix-like services
-* [[Unit utils]] Shell scripting and file operations
* [[Unit tcp]] Basic TCP-sockets
* [[Unit lolevel]] Low-level operations
* [[Unit continuation]] Continuations
diff --git a/manual/Unit posix b/manual/Unit posix
index 50586d67..6097ab3b 100644
--- a/manual/Unit posix
+++ b/manual/Unit posix
@@ -7,7 +7,7 @@ This unit provides services as used on many UNIX-like systems.
Note that
the following definitions are not all available on non-UNIX systems like
Windows. See below for Windows specific notes.
-This unit uses the {{regex}}, {{scheduler}}, {{extras}} and {{utils}} units.
+This unit uses the {{irregex}}, {{scheduler}}, and {{extras}} units.
All errors related to failing file-operations will signal a condition
of kind {{(exn i/o file)}}.
@@ -1422,4 +1422,4 @@ Returns:
----
Previous: [[Unit srfi-4]]
-Next: [[Unit utils]]
\ No newline at end of file
+Next: [[Unit tcp]]
diff --git a/manual/Unit tcp b/manual/Unit tcp
index abc8885c..cfb90b4a 100644
--- a/manual/Unit tcp
+++ b/manual/Unit tcp
@@ -215,6 +215,6 @@ and {{server.scm}}:
Hello!
---
-Previous: [[Unit utils]]
+Previous: [[Unit posix]]
Next: [[Unit lolevel]]
diff --git a/manual/Unit utils b/manual/Unit utils
deleted file mode 100644
index c299b79f..00000000
--- a/manual/Unit utils
+++ /dev/null
@@ -1,51 +0,0 @@
-[[tags: manual]]
-[[toc:]]
-
-
-== Unit utils
-
-This unit contains a "grab bag" of procedures without a good home, and which
-don't have to be available by default (as compared to the [[Unit
-extras|extras]] unit).
-
-This unit uses the {{extras}} unit.
-
-
-=== Dynamic compilation
-
-==== compile-file
-
-<procedure>(compile-file FILENAME #!key options output-file load)</procedure>
-
-Compiles the Scheme source file {{FILENAME}} into a dynamically
-loadable library by invoking the {{csc}} compiler driver. If the
-library can be successfully created and {{load}} is not given or
-true, the file is loaded into the current
-Scheme process. {{options}} may be a list of strings which are passed
-as additional command line options to {{csc}}. If {{output-file}} is
-not given, then the compiled file is stored in a temporary location
-and will be deleted when the process exits successfully.
-When compilation and loading succeeds, the name of the compiled file
-is returned, otherwise {{#f}} is returned.
-
-Notes:
-
-* loading the same compiled file multiple times is only supported on Linux
- in the moment and should be considered unreliable. For this reason, a new
temporary
- file is created for every invocation of {{compile-file}}, unless an explicit
- output file name is given.
-
-* this procedure is compatible to the {{scheme-compile-file}} command in
{{emacs}}' {{scheme-mode}}.
-
-==== compile-file-options
-
-<parameter>compile-file-options</parameter>
-
-A parameter that holds a list of default options that should be given
-to {{csc}} after invocation of the {{compile-file}} procedure.
-The initial default options are {{-O2 -d2}}.
-
-
-Previous: [[Unit posix]]
-
-Next: [[Unit tcp]]
diff --git a/modules.scm b/modules.scm
index 0ce8178b..91099db1 100644
--- a/modules.scm
+++ b/modules.scm
@@ -972,7 +972,6 @@
(##sys#register-module-alias 'repl 'chicken.repl)
(##sys#register-module-alias 'tcp 'chicken.tcp)
(##sys#register-module-alias 'time 'chicken.time)
-(##sys#register-module-alias 'utils 'chicken.utils)
(define-inline (se-subset names env) (map (cut assq <> env) names))
diff --git a/rules.make b/rules.make
index 5462cf90..cfdde464 100644
--- a/rules.make
+++ b/rules.make
@@ -37,7 +37,7 @@ SETUP_API_OBJECTS_1 = setup-api setup-download
LIBCHICKEN_SCHEME_OBJECTS_1 = \
library eval read-syntax repl data-structures pathname port file \
- files extras lolevel utils tcp srfi-4 continuation $(POSIXFILE) \
+ files extras lolevel 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
@@ -633,8 +633,7 @@ csc.c: csc.scm \
chicken.eval.import.scm \
chicken.format.import.scm \
chicken.pathname.import.scm \
- chicken.posix.import.scm \
- chicken.utils.import.scm
+ chicken.posix.import.scm
csi.c: csi.scm \
chicken.data-structures.import.scm \
chicken.foreign.import.scm \
@@ -698,8 +697,7 @@ setup-api.c: setup-api.scm \
chicken.irregex.import.scm \
chicken.pathname.import.scm \
chicken.posix.import.scm \
- chicken.pretty-print.import.scm \
- chicken.utils.import.scm
+ chicken.pretty-print.import.scm
setup-download.c: setup-download.scm \
chicken.data-structures.import.scm \
chicken.files.import.scm \
@@ -710,7 +708,6 @@ setup-download.c: setup-download.scm \
chicken.pathname.import.scm \
chicken.posix.import.scm \
chicken.tcp.import.scm \
- chicken.utils.import.scm \
setup-api.import.scm
srfi-4.c: srfi-4.scm \
chicken.bitwise.import.scm \
@@ -768,13 +765,6 @@ tcp.c: tcp.scm \
chicken.foreign.import.scm \
chicken.port.import.scm \
chicken.time.import.scm
-utils.c: utils.scm \
- chicken.data-structures.import.scm \
- chicken.files.import.scm \
- chicken.foreign.import.scm \
- chicken.format.import.scm \
- chicken.pathname.import.scm \
- chicken.process.import.scm
define profile-flags
$(if $(filter $(basename $(1)),$(PROFILE_OBJECTS)),-profile)
@@ -851,8 +841,6 @@ tcp.c: $(SRCDIR)tcp.scm $(SRCDIR)common-declarations.scm
$(bootstrap-lib) -emit-import-library chicken.tcp
srfi-4.c: $(SRCDIR)srfi-4.scm $(SRCDIR)common-declarations.scm
$(bootstrap-lib) -emit-import-library srfi-4
-utils.c: $(SRCDIR)utils.scm $(SRCDIR)common-declarations.scm
- $(bootstrap-lib) -emit-import-library chicken.utils
scheduler.c: $(SRCDIR)scheduler.scm $(SRCDIR)common-declarations.scm
$(bootstrap-lib)
profiler.c: $(SRCDIR)profiler.scm $(SRCDIR)common-declarations.scm
diff --git a/scripts/compile-all b/scripts/compile-all
index 000c1818..47159c84 100755
--- a/scripts/compile-all
+++ b/scripts/compile-all
@@ -12,7 +12,7 @@ library_options="-optimize-level 2 -include-path .
-include-path ./ -inline -ign
compiler="$1"
shift
-for x in library eval data-structures ports files extras lolevel utils tcp
srfi-4 posixunix posixwin irregex scheduler profiler stub expand modules
chicken-syntax chicken-ffi-syntax build-version; do
+for x in library eval data-structures ports files extras lolevel tcp srfi-4
posixunix posixwin irregex scheduler profiler stub expand modules
chicken-syntax chicken-ffi-syntax build-version; do
$compiler $x.scm $library_options -output-file /tmp/xxx.c "$@"
done
diff --git a/scripts/makedist.scm b/scripts/makedist.scm
index c04132bf..3cca17b2 100644
--- a/scripts/makedist.scm
+++ b/scripts/makedist.scm
@@ -1,7 +1,7 @@
;;;; makedist.scm - Make distribution tarballs
-(use data-structures extras files irregex posix setup-api utils)
+(use data-structures extras files irregex posix setup-api (chicken process))
(include "mini-srfi-1.scm")
diff --git a/scripts/mini-salmonella.scm b/scripts/mini-salmonella.scm
index 7761789a..52b558ce 100644
--- a/scripts/mini-salmonella.scm
+++ b/scripts/mini-salmonella.scm
@@ -4,7 +4,7 @@
(module mini-salmonella ()
(import scheme chicken)
-(use posix files extras data-structures setup-api utils)
+(use posix files extras data-structures setup-api (chicken process))
(define (usage code)
(print "usage: mini-salmonella [-h] [-test] [-debug] [-download] [-trunk]
EGGDIR [PREFIX]")
diff --git a/scripts/setversion b/scripts/setversion
index 4656cf85..9da23b91 100755
--- a/scripts/setversion
+++ b/scripts/setversion
@@ -3,7 +3,7 @@
exec csi -s "$0" "$@"
|#
-(use data-structures files format io utils irregex)
+(use data-structures files format io irregex (chicken process))
(define buildversion (with-input-from-file "buildversion" read))
diff --git a/setup-api.scm b/setup-api.scm
index ef1f3c14..55f2aa65 100644
--- a/setup-api.scm
+++ b/setup-api.scm
@@ -73,7 +73,7 @@
chicken.pathname
chicken.posix
chicken.pretty-print
- chicken.utils)
+ chicken.process)
(include "mini-srfi-1.scm")
diff --git a/setup-download.scm b/setup-download.scm
index c4057973..33ac7b49 100644
--- a/setup-download.scm
+++ b/setup-download.scm
@@ -41,8 +41,8 @@
chicken.irregex
chicken.pathname
chicken.posix
- chicken.tcp
- chicken.utils)
+ chicken.process
+ chicken.tcp)
(include "mini-srfi-1.scm")
diff --git a/setup.defaults b/setup.defaults
index c427f783..d7ec1e74 100644
--- a/setup.defaults
+++ b/setup.defaults
@@ -28,7 +28,7 @@
(map
(data-structures
- extras files foreign irregex lolevel ports tcp utils
+ extras files foreign irregex lolevel ports tcp
posix irregex setup-api setup-download srfi-4
->) )
diff --git a/tests/port-tests.scm b/tests/port-tests.scm
index 30785465..ec6a323b 100644
--- a/tests/port-tests.scm
+++ b/tests/port-tests.scm
@@ -1,4 +1,4 @@
-(require-extension data-structures files flonum format io port posix srfi-4
tcp utils)
+(require-extension data-structures files flonum format io port posix srfi-4
tcp)
(include "test.scm")
(test-begin)
diff --git a/tests/runtests.bat b/tests/runtests.bat
index 888c71a6..cdefd97f 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -473,7 +473,7 @@ if errorlevel 1 exit /b 1
echo ======================================== compiler/nursery stress test ...
for %%s in (100000 120000 200000 250000 300000 350000 400000 450000 500000) do
(
echo %%s
- ..\chicken -ignore-repository ..\utils.scm -:s%%s -output-file tmp.c
-include-path %TEST_DIR%/..
+ ..\chicken -ignore-repository ..\port.scm -:s%%s -output-file tmp.c
-include-path %TEST_DIR%/..
if errorlevel 1 exit /b 1
)
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 84bbe7b8..c66cf3c7 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -64,8 +64,7 @@ for x in \
chicken.repl.import.so \
chicken.read-syntax.import.so \
chicken.tcp.import.so \
- chicken.time.import.so \
- chicken.utils.import.so
+ chicken.time.import.so
do
cp ../$x test-repository
done
@@ -421,7 +420,7 @@ $interpret -bnq test-glob.scm
echo "======================================== compiler/nursery stress test
..."
for s in 100000 120000 200000 250000 300000 350000 400000 450000 500000; do
echo " $s"
- ../chicken -ignore-repository ../utils.scm -:s$s -output-file tmp.c
-include-path ${TEST_DIR}/..
+ ../chicken -ignore-repository ../port.scm -:s$s -output-file tmp.c
-include-path ${TEST_DIR}/..
done
echo "======================================== heap literal stress test ..."
diff --git a/tests/sgrep.scm b/tests/sgrep.scm
index 227997b9..79e5ad67 100644
--- a/tests/sgrep.scm
+++ b/tests/sgrep.scm
@@ -1,7 +1,7 @@
;;;; sgrep.scm - grepping benchmark
-(use io irregex port utils)
+(use io irregex port)
(define big-string
diff --git a/types.db b/types.db
index 1525a999..b32a36dd 100644
--- a/types.db
+++ b/types.db
@@ -2094,6 +2094,10 @@
(chicken.posix#with-input-from-pipe (#(procedure #:enforce)
chicken.posix#with-input-from-pipe (string (procedure () . *) #!optional
symbol) . *))
(chicken.posix#with-output-to-pipe (#(procedure #:enforce)
chicken.posix#with-output-to-pipe (string (procedure () . *) #!optional symbol)
. *))
+;; process
+
+(chicken.process#system* (#(procedure #:clean #:enforce)
chicken.process#system* (string #!rest) undefined))
+(chicken.process#qs (#(procedure #:clean #:enforce) chicken.process#qs
(string) string))
;; srfi-4
@@ -2291,11 +2295,3 @@
(chicken.tcp#tcp-port-numbers (#(procedure #:clean #:enforce)
chicken.tcp#tcp-port-numbers (port) fixnum fixnum))
(chicken.tcp#tcp-read-timeout (#(procedure #:clean #:enforce)
chicken.tcp#tcp-read-timeout (#!optional (or false integer)) (or false
integer)))
(chicken.tcp#tcp-write-timeout (#(procedure #:clean #:enforce)
chicken.tcp#tcp-write-timeout (#!optional (or false integer)) (or false
integer)))
-
-
-;; utils
-
-(chicken.utils#system* (#(procedure #:clean #:enforce) chicken.utils#system*
(string #!rest) undefined))
-(chicken.utils#qs (#(procedure #:clean #:enforce) chicken.utils#qs (string)
string))
-(chicken.utils#compile-file (#(procedure #:clean #:enforce)
chicken.utils#compile-file (string #!rest) (or false string)))
-(chicken.utils#compile-file-options (#(procedure #:clean #:enforce)
chicken.utils#compile-file-options (#!optional (list-of string)) (list-of
string)))
diff --git a/utils.scm b/utils.scm
deleted file mode 100644
index ae92e89e..00000000
--- a/utils.scm
+++ /dev/null
@@ -1,89 +0,0 @@
-;;;; utils.scm - Utilities for scripting and file stuff
-;
-; 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 utils)
- (uses data-structures posix files pathname)
- (fixnum)
- (disable-interrupts) )
-
-(module chicken.utils
- (compile-file
- compile-file-options
- system*
- qs)
-
-(import scheme chicken)
-(import chicken.data-structures
- chicken.files
- chicken.foreign
- chicken.format
- chicken.pathname
- chicken.process)
-
-(include "common-declarations.scm")
-
-
-;;; Compile and load file
-
-(define compile-file-options (make-parameter '("-O2" "-d2")))
-
-(define compile-file
- (let ((csc (foreign-value "C_CSC_PROGRAM" c-string))
- (load-file load)
- (path (foreign-value "C_INSTALL_BIN_HOME" c-string)) )
- (lambda (filename #!key options output-file (load #t) verbose)
- (let* ((cscpath (or (file-exists? (make-pathname path csc)) "csc"))
- (tmpfile (and (not output-file) (create-temporary-file "so")))
- (crapshell (eq? (build-platform) 'mingw32))
- (cmd (sprintf "~a~a -s ~a ~a -o ~a~a"
- (if crapshell "\"" "")
- (qs cscpath)
- (string-intersperse
- (or options
- (compile-file-options)))
- (qs filename)
- (qs (or output-file tmpfile))
- (if crapshell "\"" ""))))
- (when verbose (print " " cmd))
- (let ((status (system cmd)))
- (cond ((zero? status)
- (unless output-file
- (on-exit
- (lambda ()
- (handle-exceptions ex #f (delete-file* tmpfile)))))
- (when load
- (let ((f (or output-file tmpfile)))
- (handle-exceptions ex
- (begin
- (delete-file* f)
- (abort ex))
- (load-file f)
- f))))
- (else #f)))))))
-
-)
--
2.11.0
- [Chicken-hackers] [PATCH 7/8] Add chicken.process module, (continued)
- [Chicken-hackers] [PATCH 7/8] Add chicken.process module, Evan Hanson, 2017/03/02
- [Chicken-hackers] [PATCH 3/8] Add posix.scm file that wraps platform-specific posix implementations, Evan Hanson, 2017/03/02
- [Chicken-hackers] [PATCH 6/8] Add chicken.time.posix module, Evan Hanson, 2017/03/02
- [Chicken-hackers] [PATCH 1/8] Add chicken.file module, Evan Hanson, 2017/03/02
- [Chicken-hackers] [PATCH 4/8] Deduplicate the Unix and Windows chicken.errno module definitions, Evan Hanson, 2017/03/02
- Re: [Chicken-hackers] [PATCH 1/8] Add chicken.file module, felix . winkelmann, 2017/03/02
- [Chicken-hackers] [PATCH 0/2] Move "compile-file" to egg and drop utils unit, Evan Hanson, 2017/03/03
- Re: [Chicken-hackers] [PATCH 0/2] Move "compile-file" to egg and drop utils unit, felix . winkelmann, 2017/03/04
- Re: [Chicken-hackers] [PATCH 0/8] Add posix replacement modules, Peter Bex, 2017/03/04
- Re: [Chicken-hackers] [PATCH 0/8] Add posix replacement modules, felix . winkelmann, 2017/03/05