From 5c6a840ab4811a60e168b55ff11500c22f036fec Mon Sep 17 00:00:00 2001 From: Kristian Lein-Mathisen Date: Sun, 9 Apr 2017 10:19:19 +0200 Subject: [PATCH 2/2] Add chicken.syntax module I don't really know how to test this, because these identifiers are exported through `expand`, and they work both with and without a (use chicken.syntax). However, compiling this test-module gives no warnings about missing imported identifiers: (module foo () (import (only chicken.syntax er-macro-transformer ir-macro-transformer expand get-line-number strip-syntax syntax-error))) --- README | 1 + chicken-install.scm | 1 + defaults.make | 2 +- distribution/manifest | 2 ++ eval.scm | 2 +- modules.scm | 1 + rules.make | 7 ++++++- syntax.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 syntax.scm diff --git a/README b/README index b7dbba03..70208350 100644 --- a/README +++ b/README @@ -308,6 +308,7 @@ | | |-- chicken.random.import.so | | |-- chicken.repl.import.so | | |-- chicken.read-syntax.import.so + | | |-- chicken.syntax.import.so | | |-- chicken.tcp.import.so | | |-- chicken.time.import.so | | |-- chicken.time.posix.import.so diff --git a/chicken-install.scm b/chicken-install.scm index 88ea7ba0..5c9dbb29 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -78,6 +78,7 @@ "chicken.random.import.so" "chicken.repl.import.so" "chicken.read-syntax.import.so" + "chicken.syntax.import.so" "chicken.tcp.import.so" "chicken.time.import.so" "chicken.time.posix.import.so" diff --git a/defaults.make b/defaults.make index 763ae146..d583e542 100644 --- a/defaults.make +++ b/defaults.make @@ -267,7 +267,7 @@ PRIMITIVE_IMPORT_LIBRARIES = chicken chicken.csi chicken.foreign DYNAMIC_IMPORT_LIBRARIES = setup-api setup-download srfi-4 DYNAMIC_CHICKEN_IMPORT_LIBRARIES = bitwise errno file.posix fixnum flonum \ format gc io keyword load locative memory posix pretty-print process \ - process.signal process-context random time time.posix + process.signal process-context random syntax time time.posix DYNAMIC_CHICKEN_COMPILER_IMPORT_LIBRARIES = user-pass DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES = continuation data-structures \ eval expand file files internal irregex lolevel pathname port \ diff --git a/distribution/manifest b/distribution/manifest index 6df2a82a..c4e3c108 100644 --- a/distribution/manifest +++ b/distribution/manifest @@ -330,6 +330,8 @@ chicken.read-syntax.import.scm chicken.read-syntax.import.c chicken.repl.import.scm chicken.repl.import.c +chicken.syntax.import.scm +chicken.syntax.import.c chicken.tcp.import.scm chicken.tcp.import.c chicken.time.import.scm diff --git a/eval.scm b/eval.scm index 117e8f0a..a72e3166 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 load files internal irregex library lolevel pathname - port posix srfi-4 tcp repl read-syntax)) + port posix srfi-4 tcp repl read-syntax syntax)) (define-constant cygwin-default-dynamic-load-libraries '("cygchicken-0")) (define-constant macosx-load-library-extension ".dylib") diff --git a/modules.scm b/modules.scm index 8f0e36ce..9d392095 100644 --- a/modules.scm +++ b/modules.scm @@ -971,6 +971,7 @@ (##sys#register-module-alias 'random 'chicken.random) (##sys#register-module-alias 'read-syntax 'chicken.read-syntax) (##sys#register-module-alias 'repl 'chicken.repl) +(##sys#register-module-alias 'syntax 'chicken.syntax) (##sys#register-module-alias 'tcp 'chicken.tcp) (##sys#register-module-alias 'time 'chicken.time) diff --git a/rules.make b/rules.make index e50a110d..0fa493da 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 load lolevel tcp srfi-4 continuation $(POSIXFILE) \ + files extras load lolevel tcp srfi-4 syntax 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 @@ -534,6 +534,7 @@ $(eval $(call declare-emitted-import-lib-dependency,chicken.format,extras)) $(eval $(call declare-emitted-import-lib-dependency,chicken.io,extras)) $(eval $(call declare-emitted-import-lib-dependency,chicken.pretty-print,extras)) $(eval $(call declare-emitted-import-lib-dependency,chicken.random,extras)) +$(eval $(call declare-emitted-import-lib-dependency,chicken.syntax,library)) $(eval $(call declare-emitted-import-lib-dependency,chicken.load,library)) $(eval $(call declare-emitted-import-lib-dependency,chicken.locative,lolevel)) $(eval $(call declare-emitted-import-lib-dependency,chicken.memory,lolevel)) @@ -746,6 +747,8 @@ eval.c: eval.scm \ chicken.keyword.import.scm repl.c: repl.scm \ chicken.eval.import.scm +syntax.c: syntax.scm \ + chicken.expand.import.scm file.c: file.scm \ chicken.files.import.scm \ chicken.posix.import.scm @@ -850,6 +853,8 @@ srfi-4.c: $(SRCDIR)srfi-4.scm $(SRCDIR)common-declarations.scm $(bootstrap-lib) -emit-import-library srfi-4 scheduler.c: $(SRCDIR)scheduler.scm $(SRCDIR)common-declarations.scm $(bootstrap-lib) +syntax.c: $(SRCDIR)syntax.scm $(SRCDIR)common-declarations.scm + $(bootstrap-lib) -emit-import-library chicken.syntax profiler.c: $(SRCDIR)profiler.scm $(SRCDIR)common-declarations.scm $(bootstrap-lib) stub.c: $(SRCDIR)stub.scm $(SRCDIR)common-declarations.scm diff --git a/syntax.scm b/syntax.scm new file mode 100644 index 00000000..42ec33b3 --- /dev/null +++ b/syntax.scm @@ -0,0 +1,50 @@ +;;;; syntax.scm - macro utilities +; +; 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 syntax) + (uses expand) + (fixnum) ;; TODO: do we need (fixnum) here? + (disable-interrupts)) ;; TODO: do we need (disable-interrupts) here? + +(module chicken.syntax + (er-macro-transformer + ir-macro-transformer + expand + get-line-number + strip-syntax + syntax-error) + +(import chicken chicken.expand)) -- 2.12.1