[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/04: compile: Add '-x' flag.
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] 02/04: compile: Add '-x' flag. |
Date: |
Thu, 19 Jul 2018 12:00:26 -0400 (EDT) |
civodul pushed a commit to branch stable-2.2
in repository guile.
commit 887e495c6bdb43ea5fe5ee94d7d38631b5f8c14e
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 | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index 7a4c8c9..d1e4dbe 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 b4d6b31..ce7cca4 100644
--- a/module/scripts/compile.scm
+++ b/module/scripts/compile.scm
@@ -1,6 +1,6 @@
;;; Compile --- Command-line Guile Scheme compiler -*- coding: iso-8859-1 -*-
-;; Copyright 2005, 2008-2011, 2013, 2014, 2015, 2017 Free Software Foundation,
Inc.
+;; Copyright 2005, 2008-2011, 2013-2015, 2017-2018 Free Software Foundation,
Inc.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public License
@@ -83,6 +83,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)
@@ -213,6 +217,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