Tuesday, February 23, 2016

Clive channels and plumbing

In Clive, we can run
eco http://lsub.org >[out:ink]
to display a web page. Here, eco is Clive's echo, and the redirection at the end is the standard ql(1) syntax to make the standard output channel be the channel named ink. Ql is the Clive's shell.

In the same way,
eco look:ix.go:4 >[out:ink]
opens ix.go in the ix shell and selects line 4; also
eco exec:cmd >[out:ink]
opens a new window in ix with  the cmd output.

I/O in Clive relies on named channels. Instead of 0, 1, and 2 file descriptors in UNIX, Clive has in, out, and err channels. A command may use cmd.In("in") to get the input channel in, or cmd.Out("err") to get the output channel err. The command gets a nil channel if there's no such channel.

This is used by ix(1) to provide an extra output channel named ink. This channel is used by commands to output graphical user interfaces through it. If a command creates a web control, writes it to a buffer, and sends the buffer through this channel, the user interface will show the control and get in touch with the command.

The convention is that through the ink channel we get URLs, or HTML, or strings starting with "look:" or "exec:".

A look package used by ix inspects the look strings read from the ink channel and executes the commands configured by the user. Thus, the ink channel is enough to provide the plumbing facilities provided in Plan 9 by its plumber command.

As another example, with this configuration file, a click with the button-3 at ix(1) opens a window with the manual.
# $home/lib/look: rules for look(2), used by ix(1)
doc \2 \1|rf
open \0
open \0

Tuesday, February 9, 2016

Clive's Ink screenshot

We'll write about Ink in the future. It's the Clive UIMS, written in Go (as all other Clive apps) and using a viewer in HTML5/javascript so the browser is the terminal device.

IX is the Clive shell (a descendant of Acme, Omero, and O/live) and, using Ink,
it can do nice things, eg., click 3 on ",~*.go" and it finds and loads all Go files under ".".
The "command language" is actually a set of external commands, thanks to using named channels as the standard I/O mechanism. A new "ink" standard output channel is along "in", "out", and "err", and let's commands output their user interfaces.
All Ink controls can be replicated in one or more web pages, which is also nice.

This is a screenshot of our development version of IX with a few commands running.