INTRO(2): introduction to clive packages
SYNOPSYS
import (
"clive/cmd"
...
)
; Go install clive/...
DESCRIPTION
Clive commands are written in the Go programming language.
External packages are not to be imported directly from their source
repositories. Instead, they should be installed under the
clive/x/...
path and then imported from there
(to survive to incompatible upgrades made by their authors).
The compiler requires modifications as made to the Lsub fork of the standard Go compiler.
In particular, there is a close
operation for
channels that accepts an error indication and can be used both by the
sender and the receiver. A new cerror
operation retrieves the error causing the close of a channel. The send
operation can be used as a value to see if the send could proceed or
the channel was closed. For example:
[:]:
c := make(chan []byte, 0)
for i := 0; i < 10; i++ {
ok := c <- []byte(fmt.Sprintf("<%d>", i))
if !ok {
dbg.Fatal(cerror(c))
}
}
close(c, "oops")
The runtime provides support for application contexts, which is also missing in the standard (non-lsub) Go.
Most system I/O happens through channels packaged in
nchan.Conn
structures. These bridge external
pipes and connections to channels.
Most application I/O happens through
interface{}
channels, usually by calling
clive/cmd
functions. See
intro(1) for a
description of the environment variables used when compilying, and for
conventions regarding I/O.
The Go(1) command can be
used to adjust them and run the standard go
command to compile and operate on system source.
But for a few pages (including this one), the manual pages in this
section are generated using godoc
from the
system source.
EXAMPLES
To learn how to use theclive/ch
package:
[:]:
; doc clive/ch
or
[:]:
; doc 2 clive/ch
To compile the entire system:
[:]:
; cd /zx/sys/src/clive
; Go install ./...
The eco(1) command source is a good example for a simple Clive command.
SOURCE
/zx/sys/src/clive
/zx/bin/rc
BUGS
Yes. It's a research system. Nevertheless, we are using it as our computing environment for most daily work.