[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-guile e975e10 263/284: guile 2.2: program-arities a
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-guile e975e10 263/284: guile 2.2: program-arities and program-module reloaded |
Date: |
Sun, 1 Aug 2021 18:29:57 -0400 (EDT) |
branch: elpa/geiser-guile
commit e975e10772f8c0595dfed21f1ac2ad783deeb9f2
Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
Commit: Jose Antonio Ortega Ruiz <jao@gnu.org>
guile 2.2: program-arities and program-module reloaded
Those two procedures are gone in these 2.2 times, and things like
autodoc and xref were broken as a result. With Andy's help,
apparently good enough approximations of their functionality are now
in place: let's see how they go.
---
geiser/doc.scm | 11 +++++++----
geiser/modules.scm | 29 ++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/geiser/doc.scm b/geiser/doc.scm
index 185b204..9f28f7f 100644
--- a/geiser/doc.scm
+++ b/geiser/doc.scm
@@ -1,6 +1,6 @@
;;; doc.scm -- procedures providing documentation on scheme objects
-;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2010, 2018 Jose Antonio Ortega Ruiz
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
@@ -17,6 +17,7 @@
#:use-module (geiser utils)
#:use-module (geiser modules)
#:use-module (system vm program)
+ #:use-module (system vm debug)
#:use-module (ice-9 session)
#:use-module (ice-9 documentation)
#:use-module (ice-9 regex)
@@ -75,11 +76,13 @@
((macro? obj) default-macro-args)
(else 'variable)))
+(define (program-arities prog)
+ (let ((addrs (program-address-range prog)))
+ (when (pair? addrs) (find-program-arities (car addrs)))))
+
(define (arguments proc)
(define (p-args prog)
- (let ((as (map (lambda (a)
- ((@@ (system vm program) arity->arguments-alist) prog a))
- (or (program-arities prog) '()))))
+ (let ((as (map arity-arguments-alist (or (program-arities prog) '()))))
(and (not (null? as)) as)))
(define (clist f) (lambda (x) (let ((y (f x))) (and y (list y)))))
(cond ((is-a? proc <generic>) (generic-args proc))
diff --git a/geiser/modules.scm b/geiser/modules.scm
index 780d39e..32b0f1f 100644
--- a/geiser/modules.scm
+++ b/geiser/modules.scm
@@ -1,6 +1,6 @@
;;; modules.scm -- module metadata
-;; Copyright (C) 2009, 2010, 2011 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2010, 2011, 2018 Jose Antonio Ortega Ruiz
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
@@ -11,6 +11,7 @@
(define-module (geiser modules)
#:export (symbol-module
+ program-module
module-name?
module-path
find-module
@@ -19,10 +20,36 @@
module-location)
#:use-module (geiser utils)
#:use-module (system vm program)
+ #:use-module (system vm debug)
#:use-module (ice-9 regex)
#:use-module (ice-9 session)
#:use-module (srfi srfi-1))
+;; Return hash table mapping filename to list of modules defined in that
+;; file. H/t andy wingo.
+(define (fill-file->module-mapping! ret)
+ (define (record-module m)
+ (let ((f (module-filename m)))
+ (hash-set! ret f (cons m (hash-ref ret f '())))))
+ (define (visit-module m)
+ (record-module m)
+ (hash-for-each (lambda (k v) (visit-module v))
+ (module-submodules m)))
+ (visit-module (resolve-module '() #f))
+ ret)
+
+(define file->modules (fill-file->module-mapping! (make-hash-table)))
+
+(define (program-file p)
+ (let ((src (program-source p 0)))
+ (and (pair? src) (cadr src))))
+
+(define (program-module p)
+ (let* ((f (program-file p))
+ (mods (or (hash-ref file->modules f)
+ (hash-ref (fill-file->module-mapping! file->modules) f))))
+ (and (pair? mods) (not (null? mods)) (car mods))))
+
(define (module-name? module-name)
(and (list? module-name)
(not (null? module-name))
- [nongnu] elpa/geiser-guile c8dcc24 202/284: Make do with a single connection, (continued)
- [nongnu] elpa/geiser-guile c8dcc24 202/284: Make do with a single connection, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile fef0d8a 209/284: Document browser improvements, and Racket using them, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 190290b 213/284: Guile: fixes for documentation display, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 6d69176 216/284: No more interning in the scheme reader, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile b9a8980 224/284: Guile: what if i do what i meant to do?, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile d6fca59 232/284: guile: lambda* indentation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 15af81d 247/284: Add 'geiser-syntax--simple-keywords', Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 362354d 241/284: Indent Guile's `with-mutex', Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 9fb965f 251/284: Add more highlighting/indentation for Guile, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile be00e7a 261/284: guile: fix manual symbol lookup., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile e975e10 263/284: guile 2.2: program-arities and program-module reloaded,
Philip Kaludercic <=
- [nongnu] elpa/geiser-guile f6f254f 262/284: guile 2.2: program-arities and program-module reloaded, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile f23e075 265/284: Guile: use load paths defined in dir-local variables (fixes #268), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile f7483fd 267/284: Mark the beginning of code part of elisp libraries with Code: heading, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 527fd8f 270/284: Fix typos, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile aab5226 272/284: geiser -> src, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 705083a 273/284: Adding elisp/geiser-guile.el with past history, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 43d9ece 275/284: license and readme files, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 6e8add2 277/284: typo, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 6b31cd5 179/284: Guile: really support R6RS libs, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile a6c2ef3 180/284: Guile: debug leftover deleted, Philip Kaludercic, 2021/08/01