mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-01 01:40:21 +02:00
(try-load-module): Bracket calls to try-module-linked
and try-module-dynamic-link with `begin-deprecated'. (split-c-module-name, convert-c-registered-modules, registered-modules, register-modules, warn-autoload-deprecation, init-dynamic-module, dynamic-maybe-call, dynamic-maybe-link, find-and-link-dynamic-module, try-using-libtool-name, try-using-sharlib-name, link-dynamic-module, try-module-linked, try-module-dynamic-link): Deprecated. Activate deprecation message.
This commit is contained in:
parent
691f5a4d2d
commit
99a34d6e6a
1 changed files with 135 additions and 137 deletions
|
@ -1610,9 +1610,9 @@
|
||||||
;; (define-special-value '(app modules new-ws) (lambda () (make-scm-module)))
|
;; (define-special-value '(app modules new-ws) (lambda () (make-scm-module)))
|
||||||
|
|
||||||
(define (try-load-module name)
|
(define (try-load-module name)
|
||||||
(or (try-module-linked name)
|
(or (begin-deprecated (try-module-linked name))
|
||||||
(try-module-autoload name)
|
(try-module-autoload name)
|
||||||
(try-module-dynamic-link name)))
|
(begin-deprecated (try-module-dynamic-link name))))
|
||||||
|
|
||||||
(define (purify-module! module)
|
(define (purify-module! module)
|
||||||
"Removes bindings in MODULE which are inherited from the (guile) module."
|
"Removes bindings in MODULE which are inherited from the (guile) module."
|
||||||
|
@ -1803,13 +1803,11 @@
|
||||||
;;; Dynamic linking of modules
|
;;; Dynamic linking of modules
|
||||||
|
|
||||||
;; This method of dynamically linking Guile Extensions is deprecated.
|
;; This method of dynamically linking Guile Extensions is deprecated.
|
||||||
;; Use `dynamic-link' and `dynamic-call' explicitely from Scheme code
|
;; Use `load-extension' explicitely from Scheme code instead.
|
||||||
;; instead.
|
|
||||||
|
|
||||||
;; XXX - We can not offer the removal of this code thru the
|
(begin-deprecated
|
||||||
;; deprecation mechanism since we have no complete replacement yet.
|
|
||||||
|
|
||||||
(define (split-c-module-name str)
|
(define (split-c-module-name str)
|
||||||
(let loop ((rev '())
|
(let loop ((rev '())
|
||||||
(start 0)
|
(start 0)
|
||||||
(pos 0)
|
(pos 0)
|
||||||
|
@ -1825,28 +1823,28 @@
|
||||||
(else
|
(else
|
||||||
(loop rev start (+ pos 1) end)))))
|
(loop rev start (+ pos 1) end)))))
|
||||||
|
|
||||||
(define (convert-c-registered-modules dynobj)
|
(define (convert-c-registered-modules dynobj)
|
||||||
(let ((res (map (lambda (c)
|
(let ((res (map (lambda (c)
|
||||||
(list (split-c-module-name (car c)) (cdr c) dynobj))
|
(list (split-c-module-name (car c)) (cdr c) dynobj))
|
||||||
(c-registered-modules))))
|
(c-registered-modules))))
|
||||||
(c-clear-registered-modules)
|
(c-clear-registered-modules)
|
||||||
res))
|
res))
|
||||||
|
|
||||||
(define registered-modules '())
|
(define registered-modules '())
|
||||||
|
|
||||||
(define (register-modules dynobj)
|
(define (register-modules dynobj)
|
||||||
(set! registered-modules
|
(set! registered-modules
|
||||||
(append! (convert-c-registered-modules dynobj)
|
(append! (convert-c-registered-modules dynobj)
|
||||||
registered-modules)))
|
registered-modules)))
|
||||||
|
|
||||||
(define (warn-autoload-deprecation modname)
|
(define (warn-autoload-deprecation modname)
|
||||||
;; Do nothing here until we can deprecate the code for real.
|
|
||||||
(if #f
|
|
||||||
(issue-deprecation-warning
|
(issue-deprecation-warning
|
||||||
"Autoloading of compiled code modules is deprecated."
|
"Autoloading of compiled code modules is deprecated."
|
||||||
"Write a Scheme file instead that uses `dynamic-link' directly.")))
|
"Write a Scheme file instead that uses `load-extension'.")
|
||||||
|
(issue-deprecation-warning
|
||||||
|
(simple-format #f "(You just autoloaded module ~S.)" modname)))
|
||||||
|
|
||||||
(define (init-dynamic-module modname)
|
(define (init-dynamic-module modname)
|
||||||
;; Register any linked modules which have been registered on the C level
|
;; Register any linked modules which have been registered on the C level
|
||||||
(register-modules #f)
|
(register-modules #f)
|
||||||
(or-map (lambda (modinfo)
|
(or-map (lambda (modinfo)
|
||||||
|
@ -1865,21 +1863,21 @@
|
||||||
#f))
|
#f))
|
||||||
registered-modules))
|
registered-modules))
|
||||||
|
|
||||||
(define (dynamic-maybe-call name dynobj)
|
(define (dynamic-maybe-call name dynobj)
|
||||||
(catch #t ; could use false-if-exception here
|
(catch #t ; could use false-if-exception here
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(dynamic-call name dynobj))
|
(dynamic-call name dynobj))
|
||||||
(lambda args
|
(lambda args
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
(define (dynamic-maybe-link filename)
|
(define (dynamic-maybe-link filename)
|
||||||
(catch #t ; could use false-if-exception here
|
(catch #t ; could use false-if-exception here
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(dynamic-link filename))
|
(dynamic-link filename))
|
||||||
(lambda args
|
(lambda args
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
(define (find-and-link-dynamic-module module-name)
|
(define (find-and-link-dynamic-module module-name)
|
||||||
(define (make-init-name mod-name)
|
(define (make-init-name mod-name)
|
||||||
(string-append "scm_init"
|
(string-append "scm_init"
|
||||||
(list->string (map (lambda (c)
|
(list->string (map (lambda (c)
|
||||||
|
@ -1925,29 +1923,29 @@
|
||||||
(link-dynamic-module sharlib-full init)
|
(link-dynamic-module sharlib-full init)
|
||||||
(check-dirs (cdr dir-list)))))))))
|
(check-dirs (cdr dir-list)))))))))
|
||||||
|
|
||||||
(define (try-using-libtool-name libdir libname)
|
(define (try-using-libtool-name libdir libname)
|
||||||
(let ((libtool-filename (in-vicinity libdir
|
(let ((libtool-filename (in-vicinity libdir
|
||||||
(string-append libname ".la"))))
|
(string-append libname ".la"))))
|
||||||
(and (file-exists? libtool-filename)
|
(and (file-exists? libtool-filename)
|
||||||
libtool-filename)))
|
libtool-filename)))
|
||||||
|
|
||||||
(define (try-using-sharlib-name libdir libname)
|
(define (try-using-sharlib-name libdir libname)
|
||||||
(in-vicinity libdir (string-append libname ".so")))
|
(in-vicinity libdir (string-append libname ".so")))
|
||||||
|
|
||||||
(define (link-dynamic-module filename initname)
|
(define (link-dynamic-module filename initname)
|
||||||
;; Register any linked modules which has been registered on the C level
|
;; Register any linked modules which have been registered on the C level
|
||||||
(register-modules #f)
|
(register-modules #f)
|
||||||
(let ((dynobj (dynamic-link filename)))
|
(let ((dynobj (dynamic-link filename)))
|
||||||
(dynamic-call initname dynobj)
|
(dynamic-call initname dynobj)
|
||||||
(register-modules dynobj)))
|
(register-modules dynobj)))
|
||||||
|
|
||||||
(define (try-module-linked module-name)
|
(define (try-module-linked module-name)
|
||||||
(init-dynamic-module module-name))
|
(init-dynamic-module module-name))
|
||||||
|
|
||||||
(define (try-module-dynamic-link module-name)
|
(define (try-module-dynamic-link module-name)
|
||||||
(and (find-and-link-dynamic-module module-name)
|
(and (find-and-link-dynamic-module module-name)
|
||||||
(init-dynamic-module module-name)))
|
(init-dynamic-module module-name))))
|
||||||
|
;; end of deprecated section
|
||||||
|
|
||||||
|
|
||||||
(define autoloads-done '((guile . guile)))
|
(define autoloads-done '((guile . guile)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue