Showing posts with label console. Show all posts
Showing posts with label console. Show all posts

Friday, February 19, 2016

Red console view GUI

This is a simpler example to paste into a Red console to test the GUI basics of using the view dialect.

view [
    below
    tgl: text "Some test text"
    text 400x30 bold italic blue font-size 16 "Text with properties"
    button "Click Me" [tgl/text: "Text Changed!"]
    field 400 "SELECT this text then Type something into this entry field"
    area 400x200
]

A Red script might declare that it needs the view module in its header.

The above script was tested with the Feb 19 2016 build of Red.





Tuesday, December 14, 2010

rlwrap for the Curl shell

It is really essential to get a wrapper around some REPL's - the Curl shell is an example.

I run
rlwrap /opt/curl/surge/8/bin/curl --shell
which gives sane keystrokes and a command history.  If you are a client web developer coming over to the server-side, it is as essential a tool as egrep.

Friday, June 29, 2007

a Rebol tip

If you are new to the Rebol language on Windows you may have noticed that there are 2 files named rebol.exe
One is in \core and one is in \view
If you have followed the wiki-book you may be in the habit of running \core\rebol.exe in which case you may hit two oddities: first, that console does not know how to respond to
desktop
and, second, that it cannot respond to
editor ""
or the more interesting
editor system/view

The answer is to launch Rebol only using the home directory view.exe
From there you can go back and forth to console and then return to ViewTop using the command
desktop

While you are at it, try
source build-tag
or
source to-email
or
type? {this and that}
or
reduce [ 2 + 3 + 5 7 ]
or
compose ["this" (21 + 21) "that"]
or
parse {this that these those} " "
and enjoy!

PS. Here are 3 links to console info:
core
shell
quick-start

Friday, June 1, 2007

redirecting Rebol stdin/stdout under Windows

Rebol has a console interpreter which I wished to wrap in a smarter Win32 console shell that would screen my typical typo's, maintain a history across sessions and a few other useful features to exploit the Rebol parser.

My console wrappers at the moment are both Smalltalk console applications written in Dolphin Smalltalk: ConsoleShell and ConsolePipe. ConsoleShell understands commands for several language configurations and writes to a named pipe opened and echoed by ConsolePipe1; ConsolePipe2 takes STDOUT and pipes it to a chosen NamedPipe to feedback to an IDE running the ConsoleShell.

The problem that I faced was to pipe out from rebol.exe as it is not enough just to use the -w option to prevent a window from opening.

The answer lay in a Rebol script not unlike what you might use to loop a Perl interpreter. In my test case, the following pipeline works under Windows XP:
ConsoleShell | ConsolePipe1 | rebol.exe -w -c --do "forever [attempt [print do ask %~]]" 2>&1 | ConsolePipe2

The input is to my shell and the output appears in a destination window fed by a named pipe.
Unless you ran taskmgr you would not know that rebol.exe was running.

The two key bits are the -c flag and the print block. You also have to ignore the obvious and set the prompt ( in my case '->' ) with the '%' as indicated and you must wrap the script in dbl-quotes.

Now my ConsoleShell pipes into Rebol and Rebol outputs into my chosen Windows NamedPipe. This should work with any 2 wrappers - you might want to try with Tcl and expect. The Rebolution continues ...