Function CallerLine(Depth)

CallerLine

The function CallerLine returns the line of a node that is on the current execution stack.

CallerLine(
     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 a line number.

Example

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

1Procedure pr_fragmentCallerLine {
2    Body: {
3        _p_callerLine := CallerLine(1);
4        display _p_callerLine ;
5    }
6    Parameter _p_callerLine;
7}

Which can then be used as follows:

Procedure pr_testCallerLine {
    Body: {
        ! Hello

        pr_fragmentCallerLine();
    }
}

A call to pr_testCallerLine produces in the listing file:

_p_callerLine := 3 ;

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

References