aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-02 22:30:17 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-07-02 22:30:17 +0200
commit4b53493c3b6ee5554fe0a5887f672333b0da7811 (patch)
tree2b9977563545c71d388bcaa238b9f4a6edf60572 /src
parentb65612c264d3f343291719d4ec987814571b1388 (diff)
downloadcuirass-4b53493c3b6ee5554fe0a5887f672333b0da7811.tar
cuirass-4b53493c3b6ee5554fe0a5887f672333b0da7811.tar.gz
cuirass: Move code from main to auxiliary procedures.
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/utils.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cuirass/utils.scm b/src/cuirass/utils.scm
index f1ddbf5..56d3fcd 100644
--- a/src/cuirass/utils.scm
+++ b/src/cuirass/utils.scm
@@ -1,6 +1,7 @@
;;;; utils.scm -- helper procedures
;;;
;;; Copyright © 2012, 2013, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of Cuirass.
@@ -22,6 +23,7 @@
#:use-module (ice-9 match)
#:export (;; Procedures
mkdir-p
+ make-user-module
;; Macros.
λ*
with-directory-excursion))
@@ -64,3 +66,12 @@
(λ () (chdir dir))
(λ () body ...)
(λ () (chdir init)))))
+
+(define* (make-user-module #:optional (modules '()))
+ "Return a new user module with the additional MODULES loaded."
+ ;; Module in which the machine description file is loaded.
+ (let ((module (make-fresh-user-module)))
+ (for-each (lambda (iface)
+ (module-use! module (resolve-interface iface)))
+ modules)
+ module))