Megatest

modules.scm at [a42ae2762b]
Login

File modules.scm artifact 22d4a2e5e1 part of check-in a42ae2762b


;;======================================================================
;; Copyright 2006-2018, Matthew Welland.
;; 
;; This file is part of Megatest.
;; 
;;     Megatest is free software: you can redistribute it and/or modify
;;     it under the terms of the GNU General Public License as published by
;;     the Free Software Foundation, either version 3 of the License, or
;;     (at your option) any later version.
;; 
;;     Megatest is distributed in the hope that it will be useful,
;;     but WITHOUT ANY WARRANTY; without even the implied warranty of
;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;     GNU General Public License for more details.
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.
;;======================================================================

(define (load-common-modules)
  (use (prefix mtargs    args:))
  (use mtdebug)
  (use (prefix mtconfigf configf:)))
(load-common-modules)

;; configure mtdebug  ;; TODO: move to megatest.scm with other command line arg processing
(if (args:get-arg "-v")     (debug:set-verbose-mode))
(if (args:get-arg "-q")     (debug:set-quiet-mode))
(if (args:get-arg "-color")
    (case (string->symbol (args:get-arg "-color"))
      ((y Y yes YES t T)  (debug:force-color))
      ((n N no NO f F)    (debug:suppress-color))))

;; configure mtconfigf
(define *default-log-port*  (current-error-port))
(let* ((normal-fn debug:print)
       (info-fn   debug:print-info)
       (error-fn  debug:print-error)
       (default-port *default-log-port*))
  (configf:set-debug-printers normal-fn info-fn error-fn default-port))

(configf:add-eval-string "(import (prefix mtargs    args:))
                          (import mtdebug)
                          (import (prefix mtconfigf configf:))")