CallStackDepth (System function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "<span style="font-size:120%; color:black"><b><section begin=dpl_desc/>Get Call Stack Depth<section end=dpl_desc/></b></span> CallStackDepth function [...")
 
(Automatically generated page update)
 
(21 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<span style="font-size:120%; color:black"><b><section begin=dpl_desc/>Get Call Stack Depth<section end=dpl_desc/></b></span>
{{Template:System:CallStackDepth subtitle}}
[[Category:System methods|CallStackDepth function]]
The<var>CallStackDepth</var> shared function returns a number indicating the depth of the call stack.
[[Category:System/Subsystem methods]]
<!--DPL?? Category:System methods|CallStackDepth function: Get Call Stack Depth-->
<p>
CallStackDepth is a member of the [[System class]].
</p>


This shared function returns a number indicating the depth of the call stack.
==Syntax==
{{Template:System:CallStackDepth syntax}}
===Syntax terms===
<table class="syntaxTable">
<tr><th>%number</th><td>A numeric variable to receive the current call stack depth (that is, number of nested calls).</td></tr>
<tr><th><var class="nobr">%(System)</var></th><td>The class name in parentheses denotes a [[Notation conventions for methods#Shared methods|shared]] method.</td></tr>
</table>


The CallStackDepth method is available in ''Sirius Mods'' 7.2 and later.
==Usage Notes==
===Syntax===
<ul>
  %depth = %(system):CallStackDepth
<li>At level-0 (immediately inside a <var>Begin/End</var>), <var>CallStackDepth</var> always returns <code>0</code>.  For a method or subroutine called directly from level-0 code, <var>CallStackDepth</var> returns <code>1</code>. For a method called from a method called from level-0, <var>CallStackDepth</var> returns <code>2</code>; and so on.
====Syntax Terms====
<dl>
<dt><i><b>%depth</b></i>
<dd>A numeric variable to receive the current call stack depth
(number of nested calls).
<dt>%(system)
<dd>The class name in parentheses denotes a shared method.


</dl>
<li>The <var>CallStackDepth</var> method is intended to be used for problem diagnosis and, perhaps, for logging and auditing.  Using it to affect method or subroutine behavior by causing a method or subroutine to behave differently depending on the call stack depth is <b><i>extremely</i></b> poor technique, and it cannot be discouraged strongly enough.
===Usage Notes===
 
<li><var>CallStackDepth</var> is available in <var class="product">[[Sirius Mods|Sirius Mods]]</var> Version 7.2 and later.
</ul>
 
==See also==
<ul>
<ul>
<li>At level-0 (immediately inside a Begin/End), CallStackDepth always
<li>The actual caller associated with a particular depth can be determined using the <var>[[CallStackCaller (System function)|CallStackCaller]]</var> function.
returns <tt>0</tt>.
For a method or subroutine called directly from level-0 code, CallStackDepth
returns <tt>1</tt>.
For a method called from a method called from level-0, CallStackDepth
returns <tt>2</tt>; and so on.
<li>The actual caller associated with a caller can be determined using the
[[CallStackCaller (System function)|CallStackCaller]] function.
The [[CallStack (System function)|CallStack]] function can be used to return the same
information as returned by CallStackCaller, but for every call level in the call
stack.


The number of items returned by the CallStack method will always equal the
<li><var>[[CallStack (System function)|CallStack]]</var> can be used to return the same information as returned by <var>CallStackCaller</var>, but for every call level in the call stack.<p>The number of items returned by the <var>CallStack (System function)|CallStack</var> method will always equal the value returned by <var>CallStackDepth</var> at the same point in the code.</p>
value returned by CallStackDepth at the same point in the code.
<li>The CallStackDepth method is intended to be used for problem
diagnosis and, perhaps, for logging and auditing.
Using it to affect method or subroutine behavior by causing a method or subroutine
to behave differently depending on the call stack depth is '''extremely''' poor
technique, and it cannot be discouraged strongly enough.
</ul>
</ul>
{{Template:System:CallStackDepth footer}}

Latest revision as of 00:19, 16 February 2014

Depth of the call stack (System class)

TheCallStackDepth shared function returns a number indicating the depth of the call stack.

Syntax

%number = %(System):CallStackDepth

Syntax terms

%numberA numeric variable to receive the current call stack depth (that is, number of nested calls).
%(System)The class name in parentheses denotes a shared method.

Usage Notes

  • At level-0 (immediately inside a Begin/End), CallStackDepth always returns 0. For a method or subroutine called directly from level-0 code, CallStackDepth returns 1. For a method called from a method called from level-0, CallStackDepth returns 2; and so on.
  • The CallStackDepth method is intended to be used for problem diagnosis and, perhaps, for logging and auditing. Using it to affect method or subroutine behavior by causing a method or subroutine to behave differently depending on the call stack depth is extremely poor technique, and it cannot be discouraged strongly enough.
  • CallStackDepth is available in Sirius Mods Version 7.2 and later.

See also

  • The actual caller associated with a particular depth can be determined using the CallStackCaller function.
  • CallStack can be used to return the same information as returned by CallStackCaller, but for every call level in the call stack.

    The number of items returned by the CallStack (System function)|CallStack method will always equal the value returned by CallStackDepth at the same point in the code.