[REBOL] Need help with help
From: tim:johnsons-web at: 1-Dec-2004 17:37
At the console:
>> help *
value1 * value2
Returns the first value multiplied by the second.
* is an op value.
value1 -- (Type: number pair char money time tuple)
value2 -- (Type: number pair char money time tuple)
;; Now let's suppose I want to collect help with globally-defined
;; functions. The following function collects them.
get-global-funcs: func [
"collects a list of globally-defined functions."
/local vals args here total res ][
total: copy 
vals: second system/words
foreach word first system/words [
if any-function? first vals [
args: first first vals
if here: find args /local [args: copy/part args here]
append total reduce [word mold args]
vals: next vals
global-funcs: extract sort/skip total 2 2
;; Next, I want to collect the documentation. I hacked 'help as 'helps
;; to do so by gathering the output as a string. helps * gives me
;; a string with the same content as the console session above.
;; 'get-global-funcs collects function names as a list.
;; So far so good. But if I attempt to iterate thru the list of
;; global functions, I don't get the results I'm looking for
;; the following code:
foreach fnc global-funcs[
?? fnc ;; yields fnc: *
help fnc ;; see yield below
help :fnc ;; see yield below
help 'fnc ;; see yield below
;; gives me
help fnc ==>>
FNC is a word of value: *
;; no good
help :fnc ==>>
Found these words:
* op! Returns the first value multiplied by the second.
** op! Returns the first number raised to the second numb...
LWS* block! length: 2
WS* block! length: 2
;; no good either
help 'fnc ==>>
What do I need to do here?
Goal is to automatically build a series of emacs docstrings to
aid in on-demand documentation.
Tim Johnson <[tim--johnsons-web--com]>