Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

Core 2.5.2 help

 [1/2] from: ingo::2b1::de at: 7-May-2002 23:54

Hi Rebols, nice to have a help on paths, now, but I'm kinda accustomed to do things like
>> help system/stats
SYSTEM/STATS is an integer of value: 4039648 and get:
>> help system/stats
USAGE: SYSTEM/STATS /pools /types /series /frames /recycle DESCRIPTION: System statistics. Default is to return total memory allocated. SYSTEM/STATS is a native value. REFINEMENTS: /pools -- Returns: width units free-units units-per-alloc segments mem-in-use /types -- Returns: Datatype count /series -- Returns: total blocks strings other avail free expansions /frames -- Returns: total used unused free values-total /recycle -- Returns: count series-total series-last frames-total frames-last ballast So here s my help patch updated for 2.5.2. ------- start patch (watch for line wraps) ------ [REBOL [] help: func [ "Prints information about words and values. (*PATCHED* by iho)" 'word [any-type!] /local value args item name refmode types attrs rtype part parts obj ][ if unset? get/any 'word [ print trim/auto {To use HELP, supply a word or value as its argument: ^-help insert ^-help system ^-help system/script To view all words that match a pattern use a string or partial word: ^-help "path" ^-help to- To see words with values of a specific datatype: ^-help native! ^-help datatype! Word completion: ^-The command line can perform word ^-completion. Type a few chars and press TAB ^-to complete the word. If nothing happens, ^-there may be more than one word that ^-matches. Press TAB again to see choices. ^-Local filenames can also be completed. ^-Begin the filename with a %. Other useful functions: ^-about - see general product info ^-usage - view program options ^-license - show terms of user license ^-source func - view source of a function ^-upgrade - updates your copy of REBOL More information: } exit ] if all [word? :word not value? :word] [word: mold :word] if any [string? :word all [word? :word datatype? get :word]] [ types: dump-obj/match system/words :word sort types if not empty? types [ print ["Found these words:" newline types] exit ] print ["No information on" word "(word has no value)"] exit ] type-name: func [value] [ value: mold type? :value clear back tail value join either find "aeiou" first value ["an "] ["a "] value ] if not any [word? :word path? :word] [ print [mold :word "is" type-name :word] exit ] ; start changes iho either path? :word [ ; this chokes on functions in paths ... ;first reduce reduce [word] parts: to-block word either error? try [obj: get first parts ] [ print [word "is not a valid path"] exit ] [ item: 2 repeat part next parts [ if error? try [ obj: get in obj part] [ break ] item: item + 1 ] value: :obj word: to-path copy/part parts (item - 1) ] ] [ value: get :word ] ; end changes iho if not any-function? :value [ prin [uppercase mold word "is" type-name :value "of value: "] print either object? value [print "" dump-obj value] [mold :value] exit ] args: third :value prin "USAGE:^/^-" if not op? :value [prin append uppercase mold word " "] while [not tail? args] [ item: first args if :item = /local [break] if any [all [any-word? :item not set-word? :item] refinement? :item] [ prin append mold :item " " if op? :value [prin append uppercase mold word " " value: none] ] args: next args ] print "" args: head args ;value: get word print "^/DESCRIPTION:" either string? pick args 1 [ print [tab first args newline tab uppercase mold word "is" type-name :value "value."] args: next args ] [ print "^-(undocumented)" ] if block? pick args 1 [ attrs: first args args: next args ] if tail? args [exit] while [not tail? args] [ item: first args args: next args if :item = /local [break] either not refinement? :item [ all [set-word? :item :item = first [return:] block? first args rtype: first args] if none? refmode [ print "^/ARGUMENTS:" refmode: 'args ] ] [ if refmode <> 'refs [ print "^/REFINEMENTS:" refmode: 'refs ] ] either refinement? :item [ prin [tab mold item] if string? pick args 1 [prin [" --" first args] args: next args] print "" ] [ if all [any-word? :item not set-word? :item] [ if refmode = 'refs [prin tab] prin [tab :item "-- "] types: if block? pick args 1 [args: next args first back args] if string? pick args 1 [prin [first args ""] args: next args] if not types [types: 'any] prin rejoin ["(Type: " types ")"] print "" ] ] ] if rtype [print ["^/RETURNS:^/^-" rtype]] if attrs [ print "^/(SPECIAL ATTRIBUTES)" while [not tail? attrs] [ value: first attrs attrs: next attrs if any-word? value [ prin [tab value] if string? pick attrs 1 [ prin [" -- " first attrs] attrs: next attrs ] print "" ] ] ] exit ] ] -------- End Patch ---------

 [2/2] from: anton:lexicon at: 8-May-2002 16:48

Looking at the source, it appears the new in-built help is identical to Nenad Rakocevic's "Extended Help" of 10-Oct-2000. I have been using this for a while so I didn't notice any difference. :) Anton.