Next: , Previous: , Up: Reference for Common Language Elements   [Contents]


8.7 Scoping

Each time an opening brace is put into the file, a new scope begins. Scopes behave similar as in programming languages, meaning that any color name, style or procedure definition take their effect only within the scope, up to the closing brace. Thus if you redefine a style just after an opening brace, the style returns to its original definition after the closing brace. (See Defining Styles.)

In signalling charts scoping also applies to the numbering (including pre, post, format and append), compress, vspacing, indicator, angle and text.* chart options. Any changes to these take effect only until the next closing brace. Scoping explicitly does not apply to background.* and comment.* options. Those take effect until the next such option or all the way to the bottom of the chart. The option hscale is global, the last value you set will be used, irrespective of scope.

Similar, with block diagrams scoping applies to all chart options, except background.

You can nest scopes arbitrarily deep and can also manually open a new scope, such as below. This practically has no effect in any of the languages other than limiting the effect of an attribute or color/style definition.

...numbering is off here...
{
    #number only in this scope
    numbering=yes;
    ...various elements with numbers...
};
...other elements with no numbers...

For graphs, this opens an unnamed subgraph - but that has no effect on layout. For block diagrams there is actually no effect. For signalling charts the layout will be the same as in case when they are not enclosed in braces (including the handling of compress, vspacing, keep_with_next and keep_together attributes and the use of parallel and overlap keywords). This is true only if you do not change the layout attribute of the block, but use the default, see Parallel Blocks. Thus if you mark an element between the braces with parallel elements after the closing brace can be laid out besides it. Marking the entire block with overlap or parallel will make elements after the block to be laid over or besides the entrie block, respectively. See Parallel Keyword.


Next: Defining Styles, Previous: Common Attributes, Up: Reference for Common Language Elements   [Contents]