Product Documentation
Cadence SKILL Development Reference
Product Version IC23.1, June 2023

getCallingFunction

getCallingFunction( 
[ tx_nestingLevel ] 
) 
=> s_functionName  / nil

Description

Returns the name of the calling function or procedure at the specified level in the call stack.

Arguments

tx_nestingLevel

Indicates the nesting level of the procedure of function name to be returned. If not specified, the name of the current function is returned.

Value Returned

s_functionName

The name of the calling function or procedure.

nil

If the specified level exceeds the call stack level, or the function at the specified level is unnamed, nil is returned.

Examples

The following returns the name of the function one level up in the nest of calls. This is the same as getCallingFunction(1)

getCallingFunction()

The following returns the name of the current function.

getCallingFunction(0)

The following returns the name of the function one level up in the nest.

getCallingFunction(1)

The following returns the name of the function n levels up in the nest, or the top level function if n-1 is the top, or nil.

getCallingFunction(n) 

The following example returns the names of the functions in a list.

(defun Child () (list         (getCallingFunction 3)
(getCallingFunction 2)
(getCallingFunction 1)
(getCallingFunction)))
(defun Parent()     (Child))
(defun GrandParent()(Parent))
(defun GreatGrandParent() (GrandParent))
(GreatGrandParent)
=> (GreatGrandParent GrandParent Parent Child)

Related Topics

Debug Functions


Return to top
 ⠀
X