The implementation of a primitive component consists of a list of implementation variants. A variant is simply an alternative implementation. If a component has more than one variant defined in its primitive implementation, the specific variant to be used during system construction can be selected using the Variant property when the component is instantiated. A variant definition consists of a name, a pointer to a file in the operating system containing the source document that implements it, and (optionally) properties that further specify the variant. Below is an example of a primitive component implementation in UniCon. Assume that it is from the UniCon definition of a stack component. The source document referenced in the variant is a file containing C source code that implements a stack abstract data type:
IMPLEMENTATION IS VARIANT stack IN "stack.c" IMPLTYPE (Source) END stack END IMPLEMENTATIONNOTE: It is important to note that the UniCon compiler does not check that the source document is consistent with the component definition. For example, if there exists a player of type RoutineDef named "push" in the interface of the component, the UniCon compiler does not open up the file "stack.c" to check that there is a function definition named push defined in the source code. Consistency between the source document implementing a component and the component's interface is the responsibility of the system designer.
<primitive_implementation> :==
IMPLEMENTATION IS
<property_list>
<variant_list>
END IMPLEMENTATION
<variant> :==
VARIANT <identifier> IN "<filespec>"
<property_list>
END <identifier>
<filespec> :==
a Unix filename, optionally prepended with a path
(e.g., /usr/gz/src/stack.c)
Author:
Last Modified: May 12, 1996