%GetCallChain function


FunctionThe function gets back complete series of callings (CALL actions) that caused its execution.
Declaration
TEXT %GetCallChain()
ParametersNone.
ExampleThe example shows the return value of the function (in the procedure Procx of the script E.C3) when calling remote procedures from the scripts E.C1, E.C2 and E.C3. Execution of the procedures begins in the initialization part of the script E.C1.

;******************* E.C1 *******************
PROCEDURE Proc1x
   CALL [E.C2] Proc2 ON SELF.EVH ; line 3
END Proc1x

PROCEDURE ProcB
   CALL Proc1x ; line 7
END ProcB

BEGIN
   CALL ProcB ; line 11
END

;********************************************


;*********** Server event: E.C2 *************
RPC PROCEDURE Proc2
CALL [E.C3] Proc3 ON SELF.EVH ; line 3
END Proc2

BEGIN
END

;********************************************


;*********** Server event: E.C3 *************
PROCEDURE Procx
TEXT _callChain
_callChain
:= %GetCallChain() ; line 4.
END Procx

RPC PROCEDURE Proc3
CALL Procx ; line 8
END Proc3

BEGIN
END

;********************************************


The value of local variable _callChain of procedure Procx in script E.C3.

Procx: 4
SELF.EVH;E.C3( 24791) 1438;Proc3: 8
SELF.EVH;E.C2( 24792) 1439;Proc2: 3
Proc1x: 3
ProcB: 7
SELF.EVH;E.C1( 1325457) 2207;: 11

Each line in the value of variable _callChain (except for the first one) identifies the line in ESL script with CALL action.

For example a dump:
SELF.EVH;E.C3( 24791) 1438;Proc3: 8

represents line 8 in the script of the object of name E.C3. Line 8 is in the context of procedure Proc3. The script was performed on process SELF.EVH. HOBJ of object E.C3 is 24791 and the unique identifier of the running script is 1438 (this value is generated at each start of the arbitrary script and it is univocal within the process which interprets the scripts).
The mentioned line contains CALL Procx action calling the procedure Procx within the script.
As the script was not changed, the previous line (in the value of variable _callChain) contains only the procedure name and number of rows.

This way allows to find out following information from the value of variable _callChain (described bottom-up):
The action executing starts in script E.C1 (on the process SELF.EVH), there is the procedure call ProcB on the line 11, there is procedure call Proc1x on line 7 and there is RPC procedure call Proc2 on line 3 in the script E.C2 within the same process of SELF.EVH. In the procedure (Proc2) there is RPC procedure call Proc3 on line 3 in the script E.C3 within the same process SELF.EVH.
There is a procedure called Procx on line 8 in the script E.C3 and the call of function GetCallChain was performed on line 4.


Napíšte komentár