Click or drag to resize

AStackInfo Function

X#
-- todo --
Creates an array and populates it with information about the current state of the call stack.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION AStackInfo(
	ArrayName
) AS USUAL CLIPPER
Request Example View Source

Parameters

ArrayName (Optional)
Type: Usual
Specifies the name of the array to store information about the call stack.

Return Value

Type: Usual
Numeric
Remarks
The following table describes the information returned by the AStackInfo( ) function:
1Call Stack Level
2Current program filename
3Module or Object name
4Module or Object Source filename
5Line number in the object source file
6Source line contents

AStackInfo( ) populates an array with information about the entire calling stack. It combines functionality of SYS(16) and Program( ) functions while adding new support for line numbers at each call stack level. The value returned is the number of program levels or rows of the returned array.
AStackInfo( ) only populates the 6th array element if source line contents are available, otherwise it will be left empty.
AStackInfo( ) provides, in the 2nd and 4th elements respectively, the name of the current file and, if the file is bound in an APP or other separate file, a full path name to the binding program.
The 4th element contains the original source file information. For objects, this is same information returned by SYS(16), even when bound inside of applications.
AStackInfo() might not be able to retrieve information about program (.prg) files. In this case, X# displays the 2nd element similar to the SYS(16) function. For more information, see SYS(16) - Executing Program File Name.
Examples
X#
 1AStackInfo(myarray)
 2Display MEMO LIKE myarray
 3myArray
 4(1,1)   1                                    // Stack level = 1
 5(1,2)   c:\vfp\myAppl.app                        // Current program
 6(1,3) frmRerport.PrintReport.Click         // Object
 7(1,4) c:\vfp\myclasses\buttons.vct         // Object source file name
 8(1,5) 42                              // Line number in the source
 9(1,6) THISForM.DoReport()                  // in the source
10(2,1)   2                                    // Stack level = 2
11(2,2) c:\vfp\myAppl.app
12(2,3) frmRerport.DoReport
13(2,4) c:\vfp\forms\frmRerport.sct         // Module source file name
14(2,5) 31
15(2,6) DO RunListReport                     // in the source
16(3,1)   3                                    // Stack level = 3
17(3,2) c:\vfp\myAppl.app
18(3,3)
19(3,4) c:\vfp\programs\runlisterport.prg   // Module source file name
20(3,5) 12
21(3,6) REPORT ForM myreport1.frx            // in the source
22(4,1)   4                                    // Stack level = 4
23(4,2) c:\vfp\reports\myreport1.frt
24(4,3) myreport1.DataEnvironment.BeforeOpenTables
25(4,4) c:\vfp\reports\myreport1.frt          // Module source file name
26(4,5) 31
27(4,6) DO ForM getcusts                     // in the source
28(5,1)   5                                    // Stack level = 5
29(5,2) c:\vfp\myAppl.app
30(5,3) getcusts.init
31(5,4) c:\vfp\forms\getcusts.sct            // Module source file name
32(5,5) 2
33(5,6) AStackInfo(myarray)                  // in the source
See Also