next up previous
Next: 1 Array TypeSpec Up: 3 Operator type specifications Previous: 2 Union TypeSpec

  
2 Meta Operator TypeSpecs

For objects such as structures and unions, the sender knows at prototype specification time how many arguments the structuring operator has. For these objects, the type of each field is given quite easily within the prototype by specifying them through the operator's arguments. However, this approach does not work for objects which are a repetition of a single type specification (an array, for example), or for which the actual number of arguments is not known at prototype specification time or for which the number of arguments may be different for individual instances of the object within the tree (a pointer or ragged array, for example).

These cases are handled using a variant of the Common Basic Meta type: MP_CommonMetaOperator. This Meta operator may only appear in a Prototype tree. They have two defining characteristics which distinguish them from general operators. First, the type of each element in the object is defined through a nested prototype annotation. Second, the Meta operators have no actual arguments within the Prototype tree. Instead, the number of arguments field gives information about the number of arguments to expect in the data packet that follows the prototype. There are two cases to consider:

1.
A meta operator packet with a non-zero number of arguments field. This is the number of elements to read from the data packet.
2.
A meta operator packet with 0 in the number of arguments field. The number of arguments to the operator could not be given at prototype specification time and the actual number must be read from the data packet.

First we consider arrays, then pointers and recursion.



 
next up previous
Next: 1 Array TypeSpec Up: 3 Operator type specifications Previous: 2 Union TypeSpec
| ZCA Home | Reports |