diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-07 01:25:14 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-07 01:25:14 +0200 |
commit | 6212ff6e6928d2844ff3b8ff5a40f4e714685262 (patch) | |
tree | 12ab92296db48b623f72a43b16b9ae9ae51b8bbd /geiser | |
parent | 90835ae8e3ad9763e1a8d1135e337c0855ec3daf (diff) | |
download | geiser-guile-6212ff6e6928d2844ff3b8ff5a40f4e714685262.tar.gz geiser-guile-6212ff6e6928d2844ff3b8ff5a40f4e714685262.tar.bz2 |
Guile: real fix for symbol locations (needs Guile's git head).
Diffstat (limited to 'geiser')
-rw-r--r-- | geiser/evaluation.scm | 8 | ||||
-rw-r--r-- | geiser/modules.scm | 23 | ||||
-rw-r--r-- | geiser/xref.scm | 2 |
3 files changed, 22 insertions, 11 deletions
diff --git a/geiser/evaluation.scm b/geiser/evaluation.scm index 179e425..a0007c4 100644 --- a/geiser/evaluation.scm +++ b/geiser/evaluation.scm @@ -15,6 +15,7 @@ ge:macroexpand ge:compile-file ge:load-file) + #:use-module (geiser modules) #:use-module (srfi srfi-1) #:use-module (language tree-il) #:use-module (system base compile) @@ -33,13 +34,6 @@ (else (display (format "ERROR: ~a, args: ~a" (car args) (cdr args))))) `(error (key . ,(car args)))) -(define (find-module module-name) - (and (list? module-name) - (or (nested-ref the-root-module (append '(%app modules) module-name)) - (let ((m (resolve-module module-name))) - (beautify-user-module! m) - m)))) - (define (write-result result output) (write (list (cons 'result result) (cons 'output output))) (newline)) diff --git a/geiser/modules.scm b/geiser/modules.scm index 2934603..39b01b8 100644 --- a/geiser/modules.scm +++ b/geiser/modules.scm @@ -11,7 +11,9 @@ (define-module (geiser modules) #:export (symbol-module - module-filename + module-name? + module-path + find-module all-modules module-exports module-location) @@ -21,6 +23,11 @@ #:use-module (ice-9 session) #:use-module (srfi srfi-1)) +(define (module-name? module-name) + (and (list? module-name) + (> (length module-name) 0) + (every symbol? module-name))) + (define (symbol-module sym . all) (and sym (catch 'module-name @@ -38,9 +45,19 @@ (and (eq? key 'module-name) (car args)))))) (define (module-location name) - (make-location (module-filename name) #f)) + (make-location (module-path name) #f)) + +(define (find-module module-name) + (and (module-name? module-name) + (or (nested-ref (resolve-module '() #f) module-name) + (let ((m (resolve-module module-name))) + (beautify-user-module! m) + m)))) -(define module-filename (@@ (ice-9 session) module-filename)) +(define (module-path module-name) + (and (module-name? module-name) + (or ((@@ (ice-9 session) module-filename) module-name) + (module-filename (resolve-module module-name))))) (define (all-modules) (let ((roots ((@@ (ice-9 session) root-modules)))) diff --git a/geiser/xref.scm b/geiser/xref.scm index 060bec4..18005ee 100644 --- a/geiser/xref.scm +++ b/geiser/xref.scm @@ -55,7 +55,7 @@ (define (program-path p) (let* ((mod (program-module p)) (name (and mod (module-name mod)))) - (and name (module-filename name)))) + (and name (module-path name)))) (define (procedure-xref proc . mod-name) (let ((proc-name (or (procedure-name proc) '<anonymous>)) |