swank-picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/swank-picolisp.git/
Log | Files | Refs

commit bb3545e59d0d175a006f758811796ebdf76df9f3
parent 83414a9227a5ebfe417707bf1068fc4a6bd64e67
Author: Tomas Hlavaty <tom@logand.com>
Date:   Wed, 27 Apr 2011 01:38:34 +0200

autodoc for built-in functions

Diffstat:
Mswank-picolisp.l | 26+++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/swank-picolisp.l b/swank-picolisp.l @@ -94,17 +94,33 @@ ':version 'nil #NIL #,*swank-wire-protocol-version* ) ) +(de *Swank:autodoc-built-in . NIL) + +(de %swank:autodoc-built-in (Nm) + (unless *Swank:autodoc-built-in + (in (list "sh" "-c" "grep '# (' ~/git/picolisp/src64/*.l | grep -v '# (c)'") + (use (@A @B) + (until (eof) + ## /home/tomas/git/picolisp/src64/sym.l:# (fold 'any ['cnt]) -> sym + (when (match '(@A ":" "#" " " "(" @B " " @C) (line)) + ## TODO multiple lines, e.g.'for' + (push '*Swank:autodoc-built-in + (list (pack @B) (pack @C) (pack @A)) ) ) ) ) ) ) + (let? X (cadr (assoc Nm *Swank:autodoc-built-in)) + (pack "(" X) ) ) + +##(%swank:autodoc-built-in "pack") +##(%swank:autodoc-built-in "de") +##(%swank:autodoc-built-in "for") + (de swank:autodoc (RawForm . @) ## TODO highlighting "Arg1 ===> Arg2 <=== Arg3" ## TODO Key PrintRightMargin (let? Nm (intern (caar RawForm)) (let Def (val Nm) (cond - ((or (not Def) (= Nm Def)) (pack Nm " not defined") ) - ((atom Def) (pack Nm " " Def - (case Nm ## TODO automate this? grep '^# (' *.l | grep -v '# (c)' - (de " (sym . any) -> sym") - (pack " ('any ..) -> sym") ) ) ) + ((or (not Def) (= Nm Def)) (pack Nm " not defined")) + ((atom Def) (pack Nm " " Def " " (%swank:autodoc-built-in Nm))) (T (pack Nm " " (sym (car Def)))) ) ) ) ) (de swank:swank-require (Lst))