Declare clause

In versions 0.1.1 to 0.1.53 of CPN Tools it is necessary to use the declare clause to generate some of the color set functions. The declare clause can be appended to declarations for enumerated color sets, product color sets, record color sets, and union color sets.

Many of the versions between 0.1.1 and 0.1.53 are available only as internal releases. The declare clause does NOT need to be used in versions 0.1.54 and above, unless:

If you have declared product or record color sets with 10 or more components, then you will have to use the declare clause to generate the color set functions that are mentioned below. Note: it may not be possible to create record or product color sets with more than ca. 18 components, for more information see bug #731.

Declaration Syntax

colset name = … declare id1, id2, …, idn ;

where for i=1..n, idi is one of the following: input, all, ran, size, ord, col, of, or mult. For more details about these functions, read more about Color set functions.

Affected Color Sets

The declare clause must be used to declare the following functions:

Note: the set_idi functions for product and record color sets are not available in versions before 0.1.54.

Declaration Example

colset P = product SmallInt * Bool declare mult, all;

This declaration ensures that the functions P.mult and P.all are available.

colset R = record i:INT * s:STRING declare set;

This declaration ensures that the functions R.set_i and R.set_s are available.

colset Packet = union DATA: Data + ACK declare of,size;

This declaration ensures that the functions Packet.of_DATA, Packet.of_ACK, and Packet.size are available.