[ Table Of Contents | Keyword Index ]

micca-Embedded(n) 1.3.2 micca "Micca Embedded Macros"

Name

micca-Embedded - Commands for Code Generation

Table Of Contents

Synopsis

Description

This manpage describes the micca embedded macro commands. To aid in translating domain actions from action language into "C", a set of commands may be embedded into the "C" source code. During code generation, the embedded commands are expanded and replaced by the functionally equivalent "C" code. Note that embedded commands may not be nested.

The supplied embedded commands are intended to perform model level actions and remove the need to remember and understand the detailed "C" function interface to the run time. For the following action language (from a state activity):

Filling To Wash State Activity
------------------------------
# Fill the tub with wash water.
select one wc related by self->R4[WC]
select one ct related by self->R1[CT]
signal Fill(wc.WashWaterTemp) to ct

The translation using the embedded commands would appear as:

state FillingToWash {} {
    // Fill the tub with wash water.
    <%my findOneRelated wc R4%>
    <%my findOneRelated ct ~R1%>
    <%instance wc assign {WashWaterTemp washtemp}%>
    <%instance ct signal Fill temp washtemp%>
}

Commands

Commands are divided into sections depending upon to which model level entity they refer. Commands are categorized as:

Class Operations

For every class in a domain, a macro command is created that has the same name as the class. That class command takes as its first argument a subcommand. The various subcommands for classes are given in this section.

<%class create instref ?attr1 value1 attr2 value2 ...?

The create subcommand generates code to synchronously create a new instance of class. A reference to the instance is placed in the variable called, instref. If instref has not been previously declared, it is declared automatically. The attributes of the newly created instance are set to the values given by the attrN / valueN pairs. All attributes of the instance must either be supplied a value as part of the invocation of the create subcommand or have default values declared for them as part of the class definition. Any value given as an argument overrides any default value that might have been defined for an attribute. If class has an associated state model, then the newly created instance is placed in the default initial state that was defined for the state model. No state activity is executed since the instance creation is done synchronously.

<%Color create c Red 20 Green 30 Blue 100%>
<%class createasync event {?param1 value1 param2 value2 ...?} ?attr1 value1 attr2 value2 ...?

The createasync subcommand generates code to asynchronously create a new instance of class by signaling event as a creation event. Any parameters of the creation event are given by the ?paramN valueN? pairs. If the event has no parameters, an empty list ({}) must be used as argument. The attributes of the newly created instance are set to the values given by the ?attrN valueN? pairs. All attributes of the instance must either be supplied a value as part of the invocation of the createasync subcommand or have default values declared for them as part of the class definition. Any value given as an argument overrides any default value that might have been defined for an attribute. This command is only defined for classes that have a state model for which creation events have been specified. The instance is created and placed in its pseudo-initial state awaiting delivery of event, whereupon it will transition and execute a state activity.

<%Order createasync New_order {quantity 20} Customer {"Fred"} Account 2700%>
<%class createin instref state ?attr1 value1 attr2 value2 ...?

The createin subcommand generates code to synchronously create a new instance of class and place it the state state. A reference to the instance is placed in the variable called, instref. If instref has not been previously declared, it is declared automatically. The attributes of the newly created instance are set to the values given by the attrN / valueN pairs. All attributes of the instance must either be supplied a value as part of the invocation of the create subcommand or have default values declared for them as part of the class definition. Any value given as an argument overrides any default value that might have been defined for an attribute. Class must have a state model and the newly created instance has its initial state set to state. No state activity is executed since the instance creation is done synchronously.

<%WashingMachine createin wm Stopped %>
<%class findByName instname instref%>

The findByName subcommand for a class generates code to place an instance reference in the variable named, instref, that refers to the class instance named, instname. When instances are defined in the initial instance population, they are given names and this command allows for computing directly an instance reference to one of the named instances of the initial instance population.

<%Schedule findByName singleton sref%>
<%class findWhere instref clause%>

The findWhere subcommand for a class generates code to search the instances of class. A reference to the first allocated instance of class for which clause evaluates to true is assigned to the instref variable. If the instref variable does not exist before invoking findWhere, then it is declared automatically. If there are multiple instances where clause evaluates to true, then the one returned is arbitrary. If clause never evaluates to true then instref will have the value of NULL.

<%Color findWhere nored {nored->Red == 0}%>
if (nored != NULL) {
    <%instance nored update Red 10%>
}
<%class foreachInstance instref%> body <%end%>

The foreachInstance subcommand generates statements to iterate over the instances of class assigning a reference to each instance to the variable named, instref. If the instref variable does not exist before invoking foreachInstance, then it is declared automatically and with a scope local to the command. The code statements contained in the body are then executed. The body is terminated by a <%end%> macro command.

<%Color foreachInstance c%>
    <%instance c attr Red%> += 30 ;
<%end%>
<%class foreachWhere instref clause%> body <%end%>

The foreachWhere subcommand generates statements to iterate over the instances of class. A reference to each instance for which clause evaluates to true, is assigned to the variable named, instref, and body is executed. If the instref variable does not exist before invoking foreachWhere, then it is declared automatically and with a scope local to the command. The body is terminated by a <%end%> macro command.

<%Color foreachWhere c {c->Red < 30}%>
    printf("low red color: %d\n", <%instance c attr Red%>) ;
    <%instance c update Red 30%>
<%end%>
<%class idtoref instid instref%>

The idtoref subcommand for a class generates code to convert the instid integer identifier of a class instance to a reference to the instance stored in a variable named instref. Outside of a domain, class instances are identified by small integer numbers and when passed into the domain, this command converts them to actual instance references that can be used in further processing.

<%class instset setvarname%>

The instset subcommand for a class generates code to declare setvarname to be a variable whose type is suitable to hold a set of instances of class. The variable is initialized appropriately so that the set is empty.

<%Color instset highContrastColors%>
<%class operation opname ?name1 value1 ...?%>

The operation subcommand for a class generates code to invoke the class-based operation named opname passing the arguments given by the nameN valueN pairs. Operation argument passing is by name (rather than by order), so the order of the name / value pairs is arbitrary and the generated code will invoke the underlying "C" function properly.

<%Color addToBlue blueIncr 20%> ;
<%class refvar refvarname%>

The refvar subcommand for a class generates code to declare refvarname to be a variable whose type is suitable to hold an instance reference to instances of class. This command is not frequently used as most command will automatically declare the necessary "C" variables. However, it can be useful to declare an instance reference variable to make sure it remains within a desired block scope.

<%Color instref mycolor%>
<%class selectWhere instref clause instset%>

The selectWhere subcommand for a class generates code to conditionally add instances of class to an instance set. For each instance of class, a reference to the instance is assigned to the instref variable and clause is evaluated. If the instref variable does not exist before invoking selectWhere, then it is declared automatically. If clause evaluates to true, then the instance is added to the set being accumulated in the instset variable. The instset variable is declared automatically if necessary.

<%Color selectWhere lowred {lowred->Red < 30} lrset%>
if (<%instset lrset empty%>) {
    printf("no low red colors\n") ;
}

Relationship Operations

Each relationship defined by a domain will have a command by the same name created. Those relationship commands have subcommands that depend upon the type of the relationship. These fall into four categories:

The following section show the subcommands available for each category.

Association Operations

All association relationship have a single command, reference, defined for them. The interpretation of reference is slightly different for simple associations than for class based associations. Associations may also have an assigner defined on them and, if so, additional commands are available for the assigner operations.

Simple Association Operations

<%association reference sourceref targetref%>

The reference subcommand when applied to simple associations updates the referenced instance for the association. The sourceref argument is the name of a "C" variable that holds a reference to an instance of the class playing the role of the referring class in the association. The targetref argument is the name of a "C" variable that holds a reference to an instance of the class playing the role of the referenced class in the association. The reference subcommand removes any existing referenced instance in the association and replaces it with the targetref instance.

For a simple association, R3, defined as:

association R3 Member 0..*--1 Group

In R3, Member is the referring class and Group is the referenced class. Then if groupref contains an instance reference to a Group and memberref contains an instance reference to a Member, then:

R3 reference memberref groupref

changes the instance of memberref so that it refers to groupref.

Class Based Association Operations

<%association reference assocref partref ?direction?%>

The reference subcommand when applied to class based associations updates the referenced instance of one of the participants in the association. The assocref argument is the name of a "C" variable that holds a reference to an instance from the class that is the associator class in the association. The partref argument is the name of a "C" variable that holds a reference to an instance from the class that is one of the participant in the association. The reference subcommand removes any existing references to the participant in the association and replaces it with the partref instance. For a reflexive class based association, the direction argument must be supplied as either forward or backward. This indicates that the reference operation should be applied to the instance in either the forward or backward direction of the association traversal. Since the name of the participant classes in a reflexive association are the same, the direction argument is used to disambiguate the which side partref refers to.

For a class based association, R4, defined as:

association R4 -associator Membership Member 0..*--1..* Group

In R4, Membership is the associator class. Then if mshipref contains a reference to a Membership instance and memberref contains a reference to a Member instance, then:

R4 reference mshipref memberref

changes the instance of mshipref so that it refers to memberref.

Single Assigner Association Operations

Associations that are also single assigners have an additional command defined for them in order to signal events to the assigner.

<%association signal event ?name1 value1 name2 value2 ...?%>

For associations that have a single assigner, the signal command signals event to the assigner. If any of the nameN / valueN arguments are present, they are passed as the parameters to event. All parameters required by the event must be supplied and the parameter names must match those of the signature of the event. Event parameters are passed by name, so the ordering of the nameN valueN pairs is not significant.

Multiple Assigner Association Operations

For associations that are multiple assigners, two additional commands are defined. Note that there is no signal command for a multiple assigner. Once an instance of the assigner is found using the findByIdInstance command, it is signaled like any other instance, i.e. using <%instance instref signal event%>.

<%association create instref idinst%>
<%association findByIdInstance idinst instref%>

Generalization Operations

For generalization relationships, two commands are defined.

<%generalization classify superref subref%> body <%end%>
<%subclass classname%> body <%end%>
<%default%> body <%end%>

The classify subcommand navigates the generalization relationship to the currently related subclass instance. The superref argument is the name of a variable holding a reference to a superclass instance of generalization. The subref argument is the name of variable into which a reference to the currently related subclass instance of superref is placed. The type of subref will be declared automatically as the type of the currently related subclass instance. The body of the classify command must consist of invocations of <%subclass classname%> or <%default%> commands. The subclass of the instance currently related to superref is matched against the classnames given in the subclass commands of the body. Upon finding a match, subref is declared to be of the corresponding classname type, set to refer to the related subclass and then the body of the corresponding subclass command is executed. The scope of subref is local to the matching body statements. If the currently related instance does not match any of the classnames given in subclass commands, then the body of the default command is executed. In the default case, subref is not defined. If there is no match and no default command is given, then nothing is executed. Note it is not necessary to give a default command body if all of the subclasses of generalization are specified in subclass commands. A warning is issued if some subclasses of generalization are missing from subclass commands and no default command is given. Note that it is not necessary to place a "C" break statement as part of the body of a subclass or default command.

<%R17 classify lampref sublampref%>
    <%subclass TableLamp%>
        <%instance update sublampref Color red%>
    <%end%>
    <%subclass FloorLamp%>
        <%instance update sublampref Height 7%>
    <%end%>
    <%subclass DeskLamp%>
        <%instance update sublampref Wattage 100%>
    <%end%>
<%end%>
<%generalization reclassify subref newsubclass newsubref ?attr1 value1 ...?%>

The reclassify subcommand changes the type of the subclass instance in the subref variable to be an instance of newsubclass. A reference to the new subclass instance is place in a variable named newsubref. The newsubref instance refers to the same superclass instance as subref did. After the reclassification has happened, the instance referred to by subref no long exists (it was deleted as part of the reclassification) and its instance reference variable may not be used. The newsubref variable is created automatically if needed. The newly created instance of newsubclass has its attributes initialized by the attrN / valueN pairs. All attributes of the new subclass instance must either be supplied a value as part of the invocation of the reclassify subcommand or have default values declared for them as part of the class definition. Any value given as an argument overrides any default value that might have been defined for an attribute.

/*
 * Create a Lamp instance and one of its corresponding subclass instances.
 */
<%Lamp create lampref%>
<%TableLamp create tableref Color blue R17 lampref%>
/*
 * Reclassify the table lamp instance into a desk lamp instance.
 */
<%R17 reclassify tableref DeskLamp deskref Wattage 70%>
/*
 * "deskref" now refers to "lampref" across R17 and
 * "tableref" no longer exists.
 */

Instance Operations

The instance command performs operations on instances. The first argument to the instance command is always the name of a "C" variable that contains a reference to the instance. The second argument is the name of a subcommand operation to be performed on the instance.

<%instance instref assign ?assignspec1 assignspec2 ...?%>

The assign subcommand assigns attribute values of the instance referenced by the value of the instref variable into ordinary "C" variables. Each assignspecN argument consists of one or two elements. If the assignspecN argument consist of one element, then it must be the name of an attribute and a "C" variable by the same name is declared and the corresponding attribute from instref is assigned to it. If the assignspecN argument consists of two elements, then the first element must be the name of an attribute and the second element will be used as the name of a "C" variable into which the corresponding attribute value is assigned. If no assignspecN arguments are given, then all the attributes of instref are assigned to variables whose names are the same as the attribute name.

<%instance c assign Red Blue {Green mygreen}%>
if (Blue > mygreen) {
    printf("this one is more blue than green\n") ;
}
<%instance instref attr name%>

The attr subcommand generate "C" code suitable for using as an lvalue or an rvalue to access the name attribute of the instance refered to by the instref variable. If name is not an attribute of the class of instref, then an error is reported.

<%instance c attr Total%> = <%instance c attr Red%> + <%instance c attr Blue%> ;
<%instance instref canceldelayed event ?sourceinst?%>

The canceldelayed subcommand arranges for event to not be delivered to the instance referenced by instref. The sourcinst argument is a "C" variable name holding a reference to the instance that originally signaled event. If sourceinst is not supplied, then the signaling instance is taken as self if invoked within as state activity and NULL otherwise. After being canceled, event will not be dispatched. It is not an error to cancel an event that does not exist or has already been dispatched. Only events which were signaled as delayed events or periodic events may be canceled.

<%instance c canceldelayed Start%>
<%instance instref delayremaining event ?sourceinst?%>

The delayremaining subcommand generates an rvalue expression of type MRT_DelayTime that evaluates to the number of milliseconds before event will be signaled. The sourcinst argument is a "C" variable name holding a reference to the instance that originally signaled event. If sourceinst is not supplied, then the signaling instance is taken as self if invoked within as state activity and NULL otherwise. A return value of zero implies that event has already been dispatched or does not exist.

MRT_DelayTime newtime = <%instance c delayremaining Start%> + 100 ;
<%instance c canceldelayed Start%>
<%instance c delaysignal newtime Start%>
<%instance instref delaysignal time event ?name1 value1 name2 value2 ...?%>

The delaysignal subcommand arranges for event to be signaled to the instance referenced by the instref variable no sooner than time milliseconds in the future. If time is given as zero, then the event is signalled immediately. If any of the nameN valueN arguments are present, they are passed as the parameters to event. All parameters required by the event must be supplied and the parameter names must match those of the signature of the event. Event parameters are passed by name, so the ordering of the nameN valueN pairs is not significant.

<%instance c delaysignal 100 Start%>
<%instance instref delete%>

The delete subcommand deletes the instance referenced by the value of the instref variable.

<%instance startref findOneRelated> instref rel1 ?rel2 ...?%>

The findOneRelated subcommand obtains a single instance by navigating the relationship chain which starts at startref and is given by the relN arguments. The form of the relN arguments is the same as for the foreachRelated subcommand. A reference to the related instance is assigned into the instref variable. If no related instance is found, i.e. the relationship chain is conditional, then instref will have the value of NULL. If the navigation of the relationship chain would yield more than one instance, then an error is reported. This subcommand is a convenience function when it is known that at most one instance can result from navigating the relationships chain.

<%instance ct findOneRelated wm R1%>
<%instance startref findRelatedWhere instref boolexpr rel1 ?rel2 ...?%>

The findRelatedWhere subcommand obtains a single instance by navigating the relationship chain which starts at startref and is given by the relN arguments. The form of the relN arguments is the same as for the foreachRelated subcommand. A reference to each related instance is assigned into the instref variable and boolexpr is evaluated. If boolexpr evaluates to non-zero, then the iteration stops and instref contains a reference to the matching instance. If no match is found or there are no related instances, instref is set to NULL. If there are multiple matching instances in the related set of instances, the one found is arbitrary.

<%instance ct findRelatedWhere mtr {mrt->MotorID == MTR_Pump} ~R2%>
<%instance startref foreachRelated instref rel1 ?rel2 ...?%> body <%end%>

The foreachRelated subcommand iterates across the set of instances obtained by navigating the relationships chain which begins at startref and is given by the relN arguments. A reference to each instance found is assigned to the instref variable and body is executed. The body is terminated by a <%end%> macro command. The scope of the instref variable is confined to the statements in body unless it was previously declared. The relN arguments specify the relationship navigation and are of the form:

  • Rdd traversing relationship Rdd in the forward direction.

  • ~Rdd traversing relationship Rdd in the reverse direction.

  • {Rdd class} traversing relationship Rdd in the forward direction and stopping at class.

  • {~Rdd class} traversing relationship Rdd in the reverse direction and stopping at class.

where ~Rdd follows our usual naming conventions for relationships, the letter "R" followed by decimal digits (e.g. R27) ;

<%instance color foreachRelated pigm R23 ~R47 {R13 Pigment}%>
    printf("found pigment, %s\n", <%instance pigm attr Name%>) ;
<%end%>
<%instance startref foreachRelatedWhere instref boolexpr rel1 ?rel2 ...?%> body <%end%>

The foreachRelatedWhere subcommand conditionally iterates across the set of instances obtained by navigating the relationships chain which begins at startref and is given by the relN arguments. A reference to each instance found is assigned to the instref variable and boolexpr is evaluated. If boolexpr evaluates to true (or non-zero), then body is executed. The body is terminated by a <%end%> macro command. The scope of the instref variable is confined to the statements in body unless it was previously declared. The relN arguments specify the relationship navigation and are of the same form as for the foreachRelated subcommand.

<%instance color foreachRelatedWhere pigm {pigm->Amount > 20} R23 ~R47 {R13 Pigment}%>
    printf("found pigment, %s\n", <%instance pigm attr Name%>) ;
<%end%>
<%instance instref instid%>

The instid subcommand generates a "C" rvalue expression of unsigned type that computes a small integer identifier for the instance reference held in the instref variable. The identifer values are sequential and range from 0 to the number of instances of the class of instref minus one. These numeric id's are useful for identifying instances outside of their domain and may be passed to the class idtoref command to recover the value of the instance reference.

unsigned cid = <%instance color instid%> ;
<%Color mapcolor Color cid%> ;
<%instance instref operation opname ?param1 value1 param2 value2 ...?%>

The operation subcommand generates a "C" rvalue expression that invokes the instance based operation, opname, passing the paramN values as arguments. Parameter arguments must appear as parameter name / value pairs and the parameter names must match that of the signature of opname. All parameters must be supplied values and the parameter name / value pairs may in any order. The value of the instref references will become the value of self when the operation is invoked.

<%instance color operation incrRed incrAmount 20%> ;
<%instance instref periodicsignal initial reload event%>

The periodicsignal subcommand arranges for event to be signaled to the instance referenced by the instref variable no sooner than initial milliseconds in the future and to be signaled repeatedly after reload milliseconds elapses. Repeated signalling occurs until the periodic signal is canceled. If initial is given as zero, then the event is first signalled immediately. If reload is given as zero, then the event is signalled only once when the initial time elapses. The initial allows the periodic signalling to be synchronized to some other occurrance and subsequent events delivered at reload regular intervals. If there is no need to synchronize the periodic signals, then initial and reload may be given the same value. Note that periodic events may not carry parameters. Periodic signals may be queried for remaining time and canceled using the same commands as for delayed signals, i.e. delayremaining and canceldelayed.

<%instance c periodicsignal 50 100 Start%>
<%instance startref selectRelated instsetvar rel1 ?rel2 ...?%>

The selectRelated subcommand operates the same way as the foreachRelated subcommand, except the instances found during the relationship chain navigation are added to the instance set held in the instsetvar variable.

<%instance color selectRelated pigmset R23 ~R47 {R13 Pigment}%>
<%instance startref selectRelatedWhere instsetvar instref boolexpr rel1 ?rel2 ...?%>

The selectRelatedWhere subcommand operates the same way as the foreachRelatedWhere subcommand, except the instances found during the relationship chain navigation are added to the instance set held in the instsetvar variable.

<%instance color selectRelatedWhere pigmset pigm {pigm->Amount > 20} R23 ~R47 {R13 Pigment}%>
<%instance instref signal event ?name1 value1 name2 value2 ...?%>

The signal subcommand signals event to the instance referenced by the instref variable. If any of the nameN / valueN arguments are present, they are passed as the parameters to event. All parameters required by the event must be supplied and the parameter names must match those of the signature of the event. Event parameters are passed by name, so the ordering of the nameN valueN pairs is not significant.

<%instance c signal Start%>
<%instance instref update ?attr1 value1 ...?%>

The update subcommand updates the values of the attributes of the instance referenced by the value of the instref variable. Attributes and corresponding values are given in pairs. The valueN arguments may be any "C" rvalue expression.

<%instance c update Red 20 Blue 30 Green 40%>
<%instance d update Red {20 * 3}%>

Instance Set Operations

The instset command performs operations on instance sets. Instance sets are sets of instance references where all the instances are of the same class. Instance sets are created by the class instset and selectWhere commands and the instance selectRelated and selectRelatedWhere commands. The first argument to the instset command is always the name of a "C" variable that contains an instance set. The second argument is the name of a subcommand operation to be performed on the instance set.

<%instset instsetvar add instref%>

The add subcommand adds the instance reference contained in the variable named, instref, to the instance reference set contained in the variable named, instsetvar. The instref instance must be of the same class as the other instance references in instsetvar. Adding a duplicate member to the set is silently ignored and the set property of instsetvar is maintained.

<%instset instsetvar cardinality%>

The cardinality subcommand generates a "C" unsigned rvalue expression which evaluates to the number of members of the instance reference set contained it the variable named, instsetvar.

<%Color selectWhere color {color->Blue < 30 && color->Red > 100} brcolors%>
printf("%u blue / red colors present\n", <%instset brcolors cardinality%>) ;
<%instset instsetvar contains instref%>

The contains subcommand generates a "C" boolean rvalue expression which evaluates to true if the instance reference contained in the variable named, instref, is a member of the instance reference set contained in the variable named, instsetvar, and false otherwise. The instance referenced by instref must be of the same class as the references in instsetvar.

<%instset instsetvar empty%>

The empty subcommand generates a "C" boolean rvalue expression which evaluates to true if if the instance reference set contained in the variable named, instsetvar, has no members and false otherwise.

<%Color selectWhere color {color->Blue < 30} lowblues%>
if (<%instset lowblues empty%>) {
    <%Color create lb Red 10 Blue 30 Green 50%>
}
<%instset instsetvar equal compareset%>

The equal subcommand generates a "C" boolean rvalue expression which evaluates to true if if the instance reference set contained in the variable named, instsetvar, is equal to the one contained in the variable named, compareset and false otherwise. For two instance reference sets to be equal the sets must be sets of the same class as well as contain the same instances of that class.

<%instset instsetvar foreachInstance instref%> body <%end%>

The foreachInstance subcommand iterates over the members of the instance reference set contained in the variable named instsetvar. Each instance reference in the set is assigned to the variable named, instref and body is executed. The <%end%> command terminates the body statements. The order of the iteration over the set is unspecified and should be considered arbitrary.

<%Color selectWhere color {color->Red > 30} highreds%>
<%instset highreds foreachInstance highred%>
    <%instance highred assign {Red redValue}%>
    <%instance highred update Red {redValue - 20}%>
<%end%>
<%instset resultset intersect set1 set2 ?set3 ...?%>

The intersect subcommand computes the set intersection of the instance references contained in the setN variables and stores the result in the variable named, resultset. The resultset variable is declared if it does not already exist. All of the setN instance sets must refer to instances of the same class. The order of the appearance of the setN arguments does not affect the result.

<%instset resultset minus set1 set2%>

The minus subcommand computes the set difference between the instance reference set held in the set1 variable and the instance reference set held in the set2 variable. The order of the arguments is significant as set1 is treated as the minuend and set2 is treated as the subtrahend (i.e. minus computes set1 - set2).

<%instset instsetvar notempty%>

The notempty subcommand generates a "C" boolean rvalue expression which evaluates to true if if the instance reference set contained in the variable named, instsetvar, has at least one member and false otherwise.

<%instset instsetvar notequal compareset%>

The notequal subcommand generates a "C" boolean rvalue expression which evaluates to true if if the instance reference set contained in the variable named, instsetvar, is not equal to the one contained in the variable named, compareset and false otherwise.

<%instset instsetvar remove instref%>

The remove subcommand removes the instance reference contained in the variable named, instref, from the instance reference set contained in the variable named, instsetvar. The instref instance must be of the same class as the other instance references in instsetvar. Removing an instance reference that is not a member of the instsetvar set is silently ignored.

<%instset instsetvar selectOneInstance instref%>

The selectOneInstance subcommand selects one arbitrary instance from the instsetvar instance set. A reference to the selected instance is assigned to instref. If instsetvar is empty, then instvar is set to NULL. If instavarset contains more than one instance, the instance reference assigned to instref is chosen arbitrarily from the set.

<%instset resultset union set1 set2 ?set3 ...?%>

The union subcommand computes the set union of the instance references contained in the setN variables and stores the result in the variable named, resultset. The resultset variable is declared if it does not already exist. All of the setN instance sets must refer to instances of the same class. The order of the appearance of the setN arguments does not affect the result.

<%Color selectWhere lowred {lowred->Red < 30} lrset%>
<%Color selectWhere highgreen {highgreen > 60} hgset%>
<%instset lhset union lrset hgset%>

External Entity Operations

For each external entity defined by the eentity command in the domain configuration, a macro command is defined by the same name. For each external entity operation defined on an external entity, a subcommand is defined that is used to invoke the operation.

<%eentity operation ?param1 value1 ...?%>

The eentity operation subcommands generate a "C" rvalue expression that invokes the external operation named, operation that has been defined for the eentity external entity. The paramN are pased as arguments to the operation. The type of the generated expresssion is the same as the declared return type of operation. Arguments must be given as param / value pairs. All arguments to operation must be given but the order of the parameter name / value pairs is arbitrary.

unsigned colorId = <%instance color instid%> ;
unsigned shades = <%ColorEE getColorShades color colorId%> ;

See Also

DSL, micca

Keywords

executable, model