An option to introduce an `Interface of Implemented Machine' is available under the Tool Bar Introduce.
The general form of an interface description is given in a BNF-like
syntax as follows:
the syntax exp1 | exp2 indicates exp1 or exp2
(choice),
<< exp >> indicates zero or more occurrences of exp
(repetition) and
[| exp |] indicates optionality.
interface_description ::= INTERFACE interface_name | interface_name(params) [| IMPORTS imp_construct << , imp_construct >> |] OPERATIONS operation_list END interface_name ::= Identifier imp_construct ::= Identifier ( param << , param >> ) param ::= Identifier | Bnumber operation_list ::= Identifier << , Identifier >>The interface name must be that of a MACHINE for which an appropriate analysed implementation exists (see below). The OPERATIONS clause identifies those operations which the user wants to appear in the interface (i.e. be `in-scope' for testing) and should be valid operations of the referenced specification; an error will be reported otherwise.
If the MACHINE is parameterised, the parameters must be set in the INTERFACE; an error will be reported otherwise.
Since the interface is the top level of a development, all machines which are SEEN but not IMPORTED at a lower level need to be imported at this interface level. If such a machine is parameterised, actual parameters must, of course, be supplied at import, and so the optional IMPORTS clause provides the point at which such parameters may be set.
The introduction of an `Interface of Implemented Machine' option described above automatically provides the correct description - in template form - of the interface, including the introduction of the IMPORTS clause where necessary. This is the recommended method of introducing an interface into a development; the only task for the user is to provide (where necessary) actual parameters, and the interface is the built completely automatically.
Two types of interface may be built, dictated by the setting of the Interface Option.
The Interface generator produces two specification/implementation pairs: for example if the INTERFACE name if `fifi', the following constructs are generated:
After each of these constructs have been generated, the appropriate jobs are placed on the job queue (enumeration, analysis, translation and linking), and, if the process is successful, it will result in executable code, accessed through the Translators Environment by calling the `Run' tool with the generated interface implementation. Errors are dealt with in the usual way:
This option is much faster than the non-Motif version (since no intermediate Abstract Machines are generated, and there is consequently no need for enumeration, analysis, and translation).
A Motif development environment must be installed on the user's system for this option to function, and the X Link Libraries setting of the Options should reflect the version of X installed.
The resulting Motif interface pops up a window presenting a push-button menu of operation names:
and prompts for input as a form (i.e. operations with more than one input variable appear as a single form to fill in), with enumerations appearing as cascading menus:
Output is displayed in the Display Area: