Template
Function
Name
__mvDbgInfo()
Category
API
Subcategory
Internal
Oneliner
This function returns the information about the variables for debugger
Syntax
__mvDbgInfo( <nScope> [, <nPosition> [, @<cVarName>] ] )
Arguments
<nScope> = the scope of variables for which an information is asked Supported values (defined in hbmemvar.ch) HB_MV_PUBLIC HB_MV_PRIVATE (or any other value) <nPosition> = the position of asked variable on the list of variables with specified scope – it should start from position 1 <cVarName> = the value is filled with a variable name if passed by reference and <nPosition> is specified
Returns
The return value depends on the number of arguments passed
Description
This function retrieves the information about memvar variables. It returns either the number of variables with given scope (when the first argument is passed only) or a value of variable identified by its position in the variables’ list (when second argument is passed). It also returns the name of a variable if optional third argument is passed by reference.
If requested variable doesn’t exist (requested position is greater then the number of defined variables) then NIL value is returned and variable name is set to “?”
The dynamic symbols table is used to find a PUBLIC variable then the PUBLIC variables are always sorted alphabetically. The PRIVATE variables are sorted in the creation order.
Note:
Due to dynamic nature of memvar variables there is no guarantee that successive calls to retrieve the value of <Nth> PUBLIC variable will return the value of the same variable.
Examples
#include "hbmemvar.ch"
PROCEDURE Main()
LOCAL nCount, i, xValue, cName
nCount := __mvDbgInfo( HB_MV_PUBLIC )
FOR i := 1 TO nCount
xValue := __mvDbgInfo( HB_MV_PUBLIC, i, @cName )
? i, cName, xValue
NEXT
//
? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )
PUBLIC cPublic := "cPublic in MAIN"
? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )
PRIVATE cPrivate := "cPrivate in MAIN"
? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )
CountMemvars()
? "Back in Main"
? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )
RETURN
PROCEDURE CountMemvars()
LOCAL i, nCnt, xVal, cName
PUBLIC ccPublic := "ccPublic"
PRIVATE ccPrivate := "ccPrivate"
? "In CountMemvars"
? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )
PRIVATE cPublic := "cPublic"
? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )
nCnt := __mvDbgInfo( HB_MV_PRIVATE ) + 1
FOR i := 1 TO nCnt
xVal := __mvDbgInfo( HB_MV_PRIVATE, i, @cName )
? i, "=", cName, xVal
NEXT
nCnt := __mvDbgInfo( HB_MV_PUBLIC ) + 1
FOR i := 1 TO nCnt
xVal := __mvDbgInfo( HB_MV_PUBLIC, i, @cName )
? i, "=", cName, xVal
NEXT
RETURN
Compliance
This function should be called from the debugger only.
Files
Library is core