Rebol Programming/?

= USAGE: = ? 'word

= DESCRIPTION: = Prints information about words and values.

? is a function value. = ARGUMENTS =
 * word -- (Type: any-type)

= SOURCE CODE = ?: func [ "Prints information about words and values." 'word [any-type!] /local value args item type-name refmode types attrs rtype ][   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: http://www.rebol.com/docs.html ^-^-}        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 ]    value: either path? :word [first reduce reduce [word]] [get :word] 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] args: next args ] [       print "^-(undocumented)" ]    print [tab uppercase mold word "is" type-name :value "value."] 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 = to-set-word '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 ]