1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 22:40:34 +02:00

compile: Add '-x' flag.

* module/scripts/compile.scm (%options, compile): Add '-x'.
* doc/ref/api-evaluation.texi (Compilation): Document it.
This commit is contained in:
Ludovic Courtès 2018-07-19 17:54:30 +02:00
parent d677aca5c5
commit 887e495c6b
2 changed files with 12 additions and 1 deletions

View file

@ -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).
@item -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 --warn=@var{warning}
@cindex warnings, compiler

View file

@ -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