[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-chez ab13b7f 03/37: Chez: add rudimentary autodoc s
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-chez ab13b7f 03/37: Chez: add rudimentary autodoc support |
Date: |
Sun, 1 Aug 2021 18:25:55 -0400 (EDT) |
branch: elpa/geiser-chez
commit ab13b7ff828f1f510f66f1b5d712e03a42b85ac0
Author: Peter <craven@gmx.net>
Commit: Jose Antonio Ortega Ruiz <jao@gnu.org>
Chez: add rudimentary autodoc support
---
scheme/chez/geiser/geiser.ss | 49 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 48 insertions(+), 1 deletion(-)
diff --git a/scheme/chez/geiser/geiser.ss b/scheme/chez/geiser/geiser.ss
index 3dbed7f..2fa648c 100644
--- a/scheme/chez/geiser/geiser.ss
+++ b/scheme/chez/geiser/geiser.ss
@@ -52,8 +52,55 @@
(substring? prefix el))
(map write-to-string (library-list))))
+ (define (procedure-parameter-list p)
+ ;; same as (inspect object), then hitting c
+ (let ((s (((inspect/object p) 'code) 'source)))
+ (if s
+ (let ((form (s 'value)))
+ (if (and (list? form)
+ (> (length form) 2)
+ (eq? (car form) 'lambda))
+ (cadr form)
+ #f))
+ #f)))
+
+ (define (operator-arglist operator)
+ (let ((binding (eval operator)))
+ (if binding
+ (let ((arglist (procedure-parameter-list binding)))
+ (let loop ((arglist arglist)
+ (optionals? #f)
+ (required '())
+ (optional '()))
+ (cond ((null? arglist)
+ `(,operator ("args" (("required" ,@(reverse required))
+ ("optional" ,@(reverse optional))
+ ("key")
+ ;; ("module" ,module)
+ ))))
+ ((symbol? arglist)
+ (loop '()
+ #t
+ required
+ (cons "..." (cons arglist optional))))
+ (else
+ (loop
+ (cdr arglist)
+ optionals?
+ (if optionals? required (cons (car arglist) required))
+ (if optionals? (cons (car arglist) optional)
optional))))))
+ '())))
+
(define (geiser:autodoc ids . rest)
- '())
+ (cond ((null? ids) '())
+ ((not (list? ids))
+ (geiser:autodoc (list ids)))
+ ((not (symbol? (car ids)))
+ (geiser:autodoc (cdr ids)))
+ (else
+ (map (lambda (id)
+ (operator-arglist id))
+ ids))))
(define (geiser:no-values)
#f)
- [nongnu] branch elpa/geiser-chez created (now 03da1c1), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 2a7a3f6 01/37: Add preliminary support for Chez Scheme, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 1f1ee00 02/37: Clean-up elisp code, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 1bb0a87 06/37: Handle exceptions of ChezScheme and multi-value as well, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 993b630 07/37: Alway pretty-print for results, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez ab13b7f 03/37: Chez: add rudimentary autodoc support,
Philip Kaludercic <=
- [nongnu] elpa/geiser-chez e4c15a7 04/37: fix call the chez scheme executable., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 6a83bee 08/37: rewritten geiser:eval to fix the following bug:, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 2fb484b 05/37: Use (car (process-lines ...)) instead of (shell-command ...), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez a5a6176 11/37: fix compile and load for chez, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 2d682c0 13/37: fix for geiser-chez-parameters, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 7bc8f62 14/37: Capture stdout in ChezScheme's eval:geiser, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 352515c 16/37: Begin the summary lines of all elisp libraries with three semicolons, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez a0f6fc3 15/37: Add rudimentary Chez support for macro expansion, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 146d4a7 18/37: Fix indentation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-chez 9d66c63 24/37: chez: pretty printing macroexpand results., Philip Kaludercic, 2021/08/01