Changeset 12447


Ignore:
Timestamp:
02/11/10 12:03:56 (7 years ago)
Author:
mevenson
Message:

REQUIRE now searches for ASDF systems.

If ASDF is loaded via (REQUIRE 'ASDF), all subsequent invocations of
REQUIRE will search for a loadable ASDF system definitions if the
default resolver mechanism fails.

SYS::*MODULE-PROVIDER-FUNCTIONS* now contains a customizable list of
module provider functions. Such a function takes a single argument of
the module that should be resolved and loaded. There is a builtin
resolver #'SYS::MODULE-PROVIDE-SYSTEM that implicitly called before
any functions in this variable.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/asdf-abcl.lisp

    r12429 r12447  
    4545        t
    4646        (call-next-method))))
     47
     48(defun module-provide-asdf (name)
     49  (handler-case
     50      (let* ((*verbose-out* (make-broadcast-stream))
     51             (system (asdf:find-system name nil)))
     52        (when system
     53          (asdf:operate 'asdf:load-op name)
     54          t))
     55    (missing-component (e)
     56      (declare (ignore e))
     57      nil)
     58    (t (e)
     59      (format *error-output* "ASDF could not load ~A because ~A.~%"
     60              name e))))
     61
     62(pushnew #'module-provide-asdf sys::*module-provider-functions*)
    4763 
    4864(provide 'asdf-abcl)
  • trunk/abcl/src/org/armedbear/lisp/require.lisp

    r11391 r12447  
    3737  t)
    3838
     39(defun module-provide-system (module)
     40  (let ((*readtable* (copy-readtable nil)))
     41    (handler-case
     42        (load-system-file (string-downcase (string module)))
     43      (t (e)
     44        (unless (and (typep e 'error)
     45                     (search "Failed to find loadable system file"
     46                             (format nil "~A" e)))
     47          (format *error-output* "Failed to require  ~A because '~A'~%"
     48                  module e))
     49        nil))))
     50   
     51(defvar *module-provider-functions* nil)
     52
    3953(defun require (module-name &optional pathnames)
    4054  (unless (member (string module-name) *modules* :test #'string=)
     
    4559               (load x)))
    4660            (t
    47              (let ((*readtable* (copy-readtable nil)))
    48                (load-system-file (string-downcase (string module-name))))))
     61             (unless (some (lambda (p) (funcall p module-name))
     62                           (append (list #'module-provide-system)
     63                                 sys::*module-provider-functions*))
     64               (error "Don't know how to ~S ~A." 'require module-name))))
    4965      (set-difference *modules* saved-modules))))
     66
Note: See TracChangeset for help on using the changeset viewer.