General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
Introduction of specification modulesInstantiation and Use of Modules
To use a specification module, e.g. the
$/Name/AlgScope.gnrc :instin a .specs file. All component specification files of the
module are thus included in the set of specifications. A derivation
x.specs:allspecscan be used to inspect all the instantiated files.
The module instance obtained by the instantiation command above
provides
The above instantiation command is sufficient if only one instantiation of
the
$/Name/AlgScope.gnrc +instance=CtrlVar :instIn this case another instance of the AlgScope module is generated
having the instance name CtrlVar . It may coexist with the
unnamed instance created above. The names of its files and
of specified entities (symbols, attributes, etc.) are
prefixed by the instance identifier, e.g.
CtrlVarIdUseEnv .
Some modules have a second generic parameter
$/Name/AlgScope.gnrc +instance=CtrlVar +referto=Ctrl :instit provides computations for the attribute CtrlVarIdUseEnv.CtrlKey ,
among other computations.
Other modules use the
If any of the two generic parameters
If a module is instantiated as described its facilities can be used
in certain components of the user's specification:
Symbol computations as those provided by the
SYMBOL UseIdent INHERITS IdUseEnv END;
Note: The symbols provided by modules are
Further
Modules may also provide C functions (directly or via specifications
for other tools), e.g. functions of the environment module in case of the
The same instantiation mechanism may be applied to include user defined modules:
/user/Lib/ModName.gnrc:instinstantiates the module ModName of a user library.
Such a module must contain of at least two files , e.g.
#!/bin/sh moddir=`expr $0 : '\(.*\)/.*' \| '.'` $1 -e "s/|NAME|/$2/g s/|KEY|/$3/g" "$moddir"/ModName.fw > "$2"ModName.fwThe last two lines use sed to substitute the instance
parameter for any occurrence of |NAME| in the file ModName.fw
and the referto parameter for any occurrence of |KEY| .
|