unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Add -C command-line option to adjust %load-compiled-path
@ 2013-03-29 16:35 Mark H Weaver
  2013-03-30 23:38 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Mark H Weaver @ 2013-03-29 16:35 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 90 bytes --]

I'd like to include something like this in 2.0.8.
Comments and suggestions?

      Mark



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Add -C command-line option to adjust %load-compiled-path --]
[-- Type: text/x-diff, Size: 3480 bytes --]

From a36b1c48079803cf09753fc446825fcc2c64e6a8 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Fri, 29 Mar 2013 12:28:49 -0400
Subject: [PATCH] Add -C command-line option to adjust %load-compiled-path.

* module/ice-9/command-line.scm (compile-shell-switches):
  Implement -C option.
  (*usage*): Add -C option.

* doc/ref/guile-invoke.texi (Command-line Options): Add docs.
---
 doc/ref/guile-invoke.texi     |    3 +++
 module/ice-9/command-line.scm |   16 +++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/ref/guile-invoke.texi b/doc/ref/guile-invoke.texi
index 397bc47..866bf1d 100644
--- a/doc/ref/guile-invoke.texi
+++ b/doc/ref/guile-invoke.texi
@@ -71,6 +71,9 @@ before any directories in the @env{GUILE_LOAD_PATH} environment
 variable.  Paths added here are @emph{not} in effect during execution of
 the user's @file{.guile} file.
 
+@item -C @var{directory}
+Like @option{-L}, but adjusts the load path for @emph{compiled} files.
+
 @item -x @var{extension}
 Add @var{extension} to the front of Guile's load extension list
 (@pxref{Load Paths, @code{%load-extensions}}).  The specified extensions
diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm
index 2aa50ec..0211b85 100644
--- a/module/ice-9/command-line.scm
+++ b/module/ice-9/command-line.scm
@@ -117,6 +117,7 @@ remaining arguments as the value of (command-line).
 If FILE begins with `-' the -s switch is mandatory.
 
   -L DIRECTORY   add DIRECTORY to the front of the module load path
+  -C DIRECTORY   like -L, but for compiled files
   -x EXTENSION   add EXTENSION to the front of the load extensions
   -l FILE        load source code from FILE
   -e FUNCTION    after reading script, apply FUNCTION to
@@ -194,6 +195,7 @@ If FILE begins with `-' the -s switch is mandatory.
         (script-cell #f)
         (entry-point #f)
         (user-load-path '())
+        (user-load-compiled-path '())
         (user-extensions '())
         (interactive? #t)
         (inhibit-user-init? #f)
@@ -264,6 +266,14 @@ If FILE begins with `-' the -s switch is mandatory.
             (parse (cdr args)
                    out))
 
+           ((string=? arg "-C")         ; add to %load-compiled-path
+            (if (null? args)
+                (error "missing argument to `-C' switch"))
+            (set! user-load-compiled-path
+                  (cons (car args) user-load-compiled-path))
+            (parse (cdr args)
+                   out))
+
            ((string=? arg "-x")         ; add to %load-extensions
             (if (null? args)
                 (error "missing argument to `-x' switch"))
@@ -430,11 +440,15 @@ If FILE begins with `-' the -s switch is mandatory.
                    `(set! %load-extensions (cons ,ext %load-extensions)))
                  user-extensions)
 
-          ;; Add the user-specified load path here, so it won't be in
+          ;; Add the user-specified load paths here, so they won't be in
           ;; effect during the loading of the user's customization file.
           ,@(map (lambda (path)
                    `(set! %load-path (cons ,path %load-path)))
                  user-load-path)
+          ,@(map (lambda (path)
+                   `(set! %load-compiled-path
+                          (cons ,path %load-compiled-path)))
+                 user-load-compiled-path)
 
           ;; Put accumulated actions in their correct order.
           ,@(reverse! out)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add -C command-line option to adjust %load-compiled-path
  2013-03-29 16:35 [PATCH] Add -C command-line option to adjust %load-compiled-path Mark H Weaver
@ 2013-03-30 23:38 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2013-03-30 23:38 UTC (permalink / raw)
  To: guile-devel

Mark H Weaver <mhw@netris.org> skribis:

> From a36b1c48079803cf09753fc446825fcc2c64e6a8 Mon Sep 17 00:00:00 2001
> From: Mark H Weaver <mhw@netris.org>
> Date: Fri, 29 Mar 2013 12:28:49 -0400
> Subject: [PATCH] Add -C command-line option to adjust %load-compiled-path.
>
> * module/ice-9/command-line.scm (compile-shell-switches):
>   Implement -C option.
>   (*usage*): Add -C option.
>
> * doc/ref/guile-invoke.texi (Command-line Options): Add docs.

Looks good to me!

Ludo’.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-30 23:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-29 16:35 [PATCH] Add -C command-line option to adjust %load-compiled-path Mark H Weaver
2013-03-30 23:38 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).