diff options
author | Lockywolf <lockywolf@gmail.com> | 2019-08-06 00:43:05 +0800 |
---|---|---|
committer | Lockywolf <lockywolf@gmail.com> | 2019-08-06 00:43:05 +0800 |
commit | 1881db7de8c1a0b2d2544dca8b755c6792c916c9 (patch) | |
tree | 96d97a74b33bae5c4e350545e5f0fd5e22fe4218 /scheme | |
parent | fbdfbee56a03a1a0396d61fdc8f0b0af87273fc9 (diff) | |
download | geiser-guile-1881db7de8c1a0b2d2544dca8b755c6792c916c9.tar.gz geiser-guile-1881db7de8c1a0b2d2544dca8b755c6792c916c9.tar.bz2 |
Add scheme subroutine to find files implementing modules to chibi.
Add a helper function make-location to chibi interface.
Diffstat (limited to 'scheme')
-rw-r--r-- | scheme/chibi/geiser/geiser.scm | 27 | ||||
-rw-r--r-- | scheme/chibi/geiser/geiser.sld | 3 |
2 files changed, 30 insertions, 0 deletions
diff --git a/scheme/chibi/geiser/geiser.scm b/scheme/chibi/geiser/geiser.scm index 96399c3..6ba3edd 100644 --- a/scheme/chibi/geiser/geiser.scm +++ b/scheme/chibi/geiser/geiser.scm @@ -1,3 +1,4 @@ +; -*- geiser-scheme-implementation:chibi; -*- (define (all-environment-exports environment prefix) (if environment (append (filter (lambda (identifier) @@ -92,3 +93,29 @@ (define (geiser:newline) #f) +;(define (geiser:symbol-location) + ; '("geiser-chibi-error" "Not implemented")) + +;;> A chibi implementation of the standard geiser's location-making +;;> subrouting. \var{file} is a string representing file name with path, +;;> \var{line} is the line number starting from 0 (scheme way). + +(define (make-location file line) + (list (cons "file" (if (string? file) file '())) + (cons "line" (if (number? line) (+ 1 line) '())))) + +;;> A function to find the file where the symbol +;;> \var{symbol-representing-module} is defined. + +(define (geiser:module-location symbol-representing-module) + (make-location + (find-module-file + (module-name->file + (module-name + (find-module symbol-representing-module) + ) + ) + ) + 0 + ) +) diff --git a/scheme/chibi/geiser/geiser.sld b/scheme/chibi/geiser/geiser.sld index a60b7de..30c0986 100644 --- a/scheme/chibi/geiser/geiser.sld +++ b/scheme/chibi/geiser/geiser.sld @@ -1,9 +1,12 @@ +; -*- geiser-scheme-implementation:chibi; -*- (define-library (geiser) (export geiser:completions geiser:eval geiser:autodoc geiser:module-completions geiser:no-values +; geiser:symbol-location + geiser:module-location geiser:newline) (import (scheme small) (chibi modules) (chibi) (meta) (chibi ast) (chibi string) (srfi 1) (srfi 95) (chibi show)) (include "geiser.scm")) |