General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
Association of properties to definitionsMap Objects to Integers
This module computes a mapping of object keys to non-negative numbers
A number is associated as property named The module can be used to just count the objects that occur in a range, to prepare for generating unique identifier names on output, or to map objects of a range to addresses that are incremented by a certain value. The module is instantiated by $/Prop/ObjCnt.gnrc+instance=NAME +referto=KEY :inst
The role
The default start value is 0. It can be changed by
overriding the computation of
If the
We demonstrate an application of this module by mapping the objects
of out running example to unique numbers, in order to print
unique names as they resulted from the consistent renaming task.
For that purpose the grammar root can be chosen for the range role.
The
SYMBOL Program COMPUTE printf ("the program references %d different objects\n", THIS.TotalObjNo); END; SYMBOL IdentOcc INHERITS ObjCnt COMPUTE printf ("object %s%d referenced in line %d\n", StringTable (THIS.Sym), THIS.ObjNo, LINE); END; |