TOC PREV NEXT INDEX

Modify statement

Synopsis

[mode]
object_name
[additional_types_and_atts]
[delete_atts]
[properties]
[array_declarator]
[subobjects]
[value_expression]_ ;

Description

The modify statement modifies an object's definition. Only those clauses you specify are modified. Other clauses are unchanged.

A modify statement does not begin with a type clause. This is what distinguishes it from a create statement. If you specify a type before the object's name, AVS/Express deletes the existing definition of the object and creates a new one.

Arguements

The clauses are similar to the create statement. The descriptions below highlight the differences.

mode

The object's reference mode. It is ^ (by-value), & (by-reference), or * (by-pointer).
For example, you change object x's reference mode to value:

^
x;

object_name

The name of the object to be modified. You can specify the current object, one of its immediate subobjects, or, using a pathname, any lower-level subobject.
For example, you create an object called c1, then change subobject x, one of the inherited subobjects:

group coordinates {
int x, y;
};
coordinates c1 {
x
= 3;
};

Assume you are in the VCP and want to modify subobject x. One way is to first navigate to x:

c1 {
x
= 3;

Another way is to specify a pathname:

c1.x
= 3;

To modify an object's name, use the V command $set_obj_name. For example, you change object x's name to int1:

$set_obj_name x int1

additional_types_and_atts

Additional types to be assigned to the object. additional_types_and_atts begins with a plus sign, followed by one or more plus-sign separated types and/or attributes.
For example, you add the req and notify attributes to x:


x+req+notify
;

You cannot remove a previously assigned type. If this is what you want to do, you must recreate the object.

delete_atts

You can remove a previously assigned attribute, by preceding it with a minus sign:


x-notify
;

You cannot remove a previously assigned object type.

You can mix delete_atts with additional_types_and_atts. For example:

OM(SingleWindowApp) -> int x;
OM(SingleWindowApp) -> int+notify x;
OM(SingleWindowApp) -> x-notify+write;
OM(SingleWindowApp) -> $print x
int+write x;

properties

Additional properties and/or modifications to existing properties.
For example, you set x's NEx property to 100:

x<NEx = 100>
;

array_declarator

A new array declaration for the object. If the object is currently a single entity, it changes into an array of the specified dimensions. If the object is already an array, its dimensions change to those specified. You cannot change an array into a single entity, except to specify an array of size 1.

For example:


x[10]
; // Change x to a 10 array.
x[mdims][3]
; // Change x to an mdims by 3 array.

subobject_block

Additional subobjects and/or modifications or deletions to existing subobjects.
For example, you modify c1 by modifying subobject x and adding subobject z:

my_coordinates {
x = 100;
int z;
}
;

Caution: Deleting an inherited subobject breaks an object's template hierarchy.

value_expression

A new value expression.
For example, you connect object in to object invert.out:


in => invert.out
;

Below, you break the connection by specifying a null value expression:

in = >;


TOC PREV NEXT INDEX