[Top][All Lists]

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

[Guile-commits] 50/58: compile: Add '-x' flag.

From: Andy Wingo
Subject: [Guile-commits] 50/58: compile: Add '-x' flag.
Date: Tue, 7 Aug 2018 06:58:38 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit 44cdabd9e3b8bc7baca4e6b7506b950dd7cbadd4
Author: Ludovic Court├Ęs <address@hidden>
Date:   Thu Jul 19 17:54:30 2018 +0200

    compile: Add '-x' flag.
    * module/scripts/compile.scm (%options, compile): Add '-x'.
    * doc/ref/api-evaluation.texi (Compilation): Document it.
 doc/ref/api-evaluation.texi | 6 ++++++
 module/scripts/compile.scm  | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index 98593ce..60f7fec 100644
--- a/doc/ref/api-evaluation.texi
+++ b/doc/ref/api-evaluation.texi
@@ -658,6 +658,12 @@ Write output bytecode to @var{ofile}.  By convention, 
bytecode file
 names end in @code{.go}.  When @option{-o} is omitted, the output file
 name is as for @code{compile-file} (see below).
address@hidden -x @var{extension}
+Recognize @var{extension} as a valid source file name extension.
+For example, to compile R6RS code, you might want to pass @command{-x
+.sls} so that files ending in @file{.sls} can be found.
 @item -W @var{warning}
 @itemx address@hidden
 @cindex warnings, compiler
diff --git a/module/scripts/compile.scm b/module/scripts/compile.scm
index 5aa58d3..924456e 100644
--- a/module/scripts/compile.scm
+++ b/module/scripts/compile.scm
@@ -68,6 +68,10 @@
                  (if (assoc-ref result 'output-file)
                      (fail "`-o' option cannot be specified more than once")
                      (alist-cons 'output-file arg result))))
+        (option '(#\x) #t #f
+                (lambda (opt name arg result)
+                  (set! %load-extensions (cons arg %load-extensions))
+                  result))
         (option '(#\W "warn") #t #f
                 (lambda (opt name arg result)
@@ -197,6 +201,7 @@ Compile each Guile source file FILE into a Guile object.
   -L, --load-path=DIR  add DIR to the front of the module load path
   -o, --output=OFILE   write output to OFILE
+  -x EXTENSION         add EXTENSION to the set of source file extensions
   -W, --warn=WARNING   emit warnings of type WARNING; use `--warn=help'
                        for a list of available warnings

reply via email to

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