next up previous
Next: Returning Values From External Up: The Basic Structure of Previous: Access Modes of External

Scoping

In the context of use-relations between asms, XASM distinguishes between the parent-asm and the caller-asm:
The parent-asm of an asm B is the asm where B is declared (either as sub-asm or as external function), while the caller-asm is the asm where the call actually takes place.
In the easiest case, parent and caller are the same, as in the above example: asm error is declared in and called by asm A. In the following example, this is not the case:




\fbox{\TheSbox}


Here, A is the parent-asm and B the caller-asm of asm error. As a consequence, the exported relation ok_flag is taken from the parent-asm, rather than from the caller-asm. That means, that the update of error in B has the consequence that the checkok relation is updated in A. This distinction has been made, in order to completely abstract from the actual realization of exported and accessed functions and sub-asms. In this case, B doesn't need to ``know'' that error is an external function.

The scoping rule for XASM-asms is similar to static scoping in programming languages and can be summarized as follows:

Exported and accessed functions and sub-asms of an asm B are always taken from the asm where B has been declared either as external function or as sub-asm.


next up previous
Next: Returning Values From External Up: The Basic Structure of Previous: Access Modes of External
Philipp Kutter 2002-03-18