REBOL [ Author: "Brett Handley" Title: "Little Evaluator" Date: 14-Dec-2001 Purpose: "A GUI for evaluating Rebol expressions." ] ; ; Supporting Code ; do load-thru http://www.codeconscious.com/rebsite/rebol-library/standard-guis.r ; The evaluator script.. ctx-little-evaluator: context [ evaluator-script: [ cmd: none out: none capture: none output-capturer: context [ prin: func [value] [append capture reform value] print: func [value] [prin value prin newline] probe: func [value] [print mold :value :value] ] do-script: does [ either empty? cmd-text: trim copy cmd/text [ capture: copy {} ] [ capture: copy {} either error? result: try [reduce [do bind load/all cmd-text in output-capturer 'self]] [ capture: join capture ["**ERROR" newline mold disarm result] ] [ if not unset? last result [ append capture join "== " mold last result ] ] ] out/pane: scroll-face/fixed layout/offset/origin [text as-is capture] 0x0 0x0 (subtract out/size out/edge/size) out/color out/pane/pane/1/pane/color: silver out/pane/pane/1/color: silver show out unfocus focus cmd ] main-face: center-face layout [ backdrop effect [gradient 1x1 220.220.255 0.0.172] space 0x0 origin 0x0 across button 100x20 "Do Expression:" right [do-script] cmd: area 550x120 return out: box silver 650x350 edge [size: 3x3 color: gray] ] either empty? system/view/screen-face/pane [view main-face] [view/new main-face] ] set 'show-evaluator has [eval] [ eval: context evaluator-script ] ]