For example, in the alphabet root typeset (see alphabet-main(2)), a string is represented by the letter ``s'', held at the Limbo level as a ref Value.S.
Each alphabet module has a type signature which describes its return type and the number and type of any flags or arguments that it allows. Inside an alphabet typeset, this signature is represented as a simple string where the first character (always present) indicates the return type of the module. Subsequent characters up until the first minus (``-'') sign (or the end of the string) indicate the module's required argument types. If the last character is an asterisk (*), it allows an unlimited repetition of the preceding argument type.
These may be followed by any number of options, each indicated with a minus character, followed by the option character and then the type characters of any arguments it requires.
For instance, the following Alphabet declaration:
/mount [-abc] [-x /string] /wfd /string -> /statuscan be represented by the signature ``rws-a-b-xs-c''.
An external alphabet typeset is conventionally represented by two header files defining the interface to the typeset, and two modules giving its implementation. Suppose we are to create a new typeset, say /foo . We would create the following files:
The proxy module, footypes.b, must define at least one function, proxy, which returns a channel through which all operations on the typeset take place. The Proxy module (see alphabet-proxy(2)) provides a generic implementation of such a translator; if footypes.b uses this, it needs only define the mapping between values in its parent typeset and its own values.
If the run succeeds, it should return the resulting value. If the module returns a value that was passed in, and it contains a reference-count, the count should be incremented before returning, If the module succeeds, it is responsible for the disposal of any arguments and option arguments that it has been given. Appropriate disposal depends on the type of the argument, but v.free(0) is always sufficient to dispose of value v.
If the run fails, it should return nil; its arguments will automatically be freed in this case.
While processing the run request, the module should send error and debugging diagnostics to the errorc channel (it should take care never to send an empty string). If it spawns any new processes, it can use the Report, r, (see alphabet-reports(2)) to create new diagnostic channels for these processes. When such an diagnostic channel is no longer in use, the module should send an empty string on it. It should take care that Report.start is called before run returns.
|ALPHABET-INTRO(2 )||Rev: Thu Feb 15 14:43:27 GMT 2007|