guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 01/01: Add --r6rs and --r7rs options to "guild compile"


From: Andy Wingo
Subject: [Guile-commits] 01/01: Add --r6rs and --r7rs options to "guild compile"
Date: Mon, 2 Dec 2019 11:35:41 -0500 (EST)

wingo pushed a commit to branch master
in repository guile.

commit 0f61d8d797f085df3e566147c22d1581b4d00a49
Author: Andy Wingo <address@hidden>
Date:   Mon Dec 2 17:29:32 2019 +0100

    Add --r6rs and --r7rs options to "guild compile"
    
    * module/scripts/compile.scm (%options, compile): Add --r6rs and --r7rs
      options.
    * doc/ref/api-evaluation.texi (Compilation): Add docs.
---
 doc/ref/api-evaluation.texi |  6 ++++++
 module/scripts/compile.scm  | 25 ++++++++++++++++++++-----
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index bcebacf..c88af29 100644
--- a/doc/ref/api-evaluation.texi
+++ b/doc/ref/api-evaluation.texi
@@ -686,6 +686,12 @@ more important than the speed of the compiled code.  Pass
 of @code{-O} options can be passed to the compiler, with later ones
 taking precedence.
 
+@item --r6rs
+@itemx --r7rs
+Compile in an environment whose default bindings, reader options, and
+load paths are adapted for specific Scheme standards.  @xref{R6RS
+Support}, and @xref{R7RS Support}.
+
 @item -f @var{lang}
 @itemx --from=@var{lang}
 Use @var{lang} as the source language of @var{file}.  If this option is 
omitted,
diff --git a/module/scripts/compile.scm b/module/scripts/compile.scm
index d86f2f2..045817e 100644
--- a/module/scripts/compile.scm
+++ b/module/scripts/compile.scm
@@ -68,6 +68,12 @@
                  (if (assoc-ref result 'output-file)
                      (fail "`-o' option cannot be specified more than once")
                      (alist-cons 'output-file arg result))))
+        (option '("r6rs") #f #f
+               (lambda (opt name arg result)
+                 (alist-cons 'install-r6rs? #t result)))
+        (option '("r7rs") #f #f
+               (lambda (opt name arg result)
+                 (alist-cons 'install-r7rs? #t result)))
         (option '(#\x) #t #f
                 (lambda (opt name arg result)
                   (set! %load-extensions (cons arg %load-extensions))
@@ -192,9 +198,8 @@ There is NO WARRANTY, to the extent permitted by law.~%"))
         (input-files     (assoc-ref options 'input-files))
         (output-file     (assoc-ref options 'output-file))
         (load-path       (assoc-ref options 'load-path)))
-    (if (or help? (null? input-files))
-        (begin
-          (format #t "Usage: compile [OPTION] FILE...
+    (when (or help? (null? input-files))
+      (format #t "Usage: compile [OPTION] FILE...
 Compile each Guile source file FILE into a Guile object.
 
   -h, --help           print this help message
@@ -208,6 +213,11 @@ Compile each Guile source file FILE into a Guile object.
   -O, --optimize=OPT   specify optimization passes to run; use `-Ohelp'
                        for a list of available optimizations
 
+  --r6rs, --r7rs       compile in an environment whose default bindings,
+                       reader options, and load paths are adapted for
+                       specific Scheme standards; see \"R6RS Support\"
+                       and \"R7RS Support\" in the manual, for full details
+
   -f, --from=LANG      specify a source language other than `scheme'
   -t, --to=LANG        specify a target language other than `bytecode'
   -T, --target=TRIPLET produce bytecode for host TRIPLET
@@ -215,8 +225,13 @@ Compile each Guile source file FILE into a Guile object.
 Note that auto-compilation will be turned off.
 
 Report bugs to <~A>.~%"
-                  %guile-bug-report-address)
-          (exit 0)))
+              %guile-bug-report-address)
+      (exit 0))
+
+    (when (assoc-ref options 'install-r6rs?)
+      (install-r6rs!))
+    (when (assoc-ref options 'install-r7rs?)
+      (install-r7rs!))
 
     ;; Load FROM and TO before we have changed the load path.  That way, when
     ;; cross-compiling Guile itself, we can be sure we're loading our own



reply via email to

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