Function CallerAttribute(Depth)

CallerAttribute

The function CallerAttribute returns the attribute of a node that is on the current execution stack.

CallerAttribute(
               Depth      ! (optional) scalar element parameter
               )

Arguments

Depth

An numeric optional expression with default 1. The value should be in the range \(\{ 1 \ldots\) CallerNumberOfLocations \(\}\). The value 1, refers to the caller of the currently running procedure.

Return Value

This function returns an element in AllAttributeNames.

Example

The function CallerAttribute is usually part of utility code, as follows:

1Procedure pr_fragmentCallerAttribute {
2    Body: {
3        _ep_callerAttribute := CallerAttribute(1);
4        display _ep_callerAttribute ;
5    }
6    ElementParameter _ep_callerAttribute {
7        Range: AllAttributeNames;
8    }
9}

Which can then be used as follows:

Procedure pr_testCallerAttribute {
    Body: {
        pr_fragmentCallerAttribute();
    }
}

A call to pr_testCallerAttribute produces in the listing file:

_ep_callerAttribute := 'body' ;

For a more extended illustration of how the function CallerAttribute can be part of utility code, please check the example at CallerNumberOfLocations.

References