Function SymbolInfo() Foundation

Retrieves information about registered symbols.

Syntax
SymbolInfo( [<nDefine>] ) --> aReturn
Parameters
<nDefine>
A #define constant from MEMVAR.CH must be used for <nDefine>. The parameter defaults to SYMBOL_FUNCTION (see below).
Return

The function returns a one- or two-dimensional array filled with information about entities registered in the symbol table at runtime of a program. The returned array depends on the passed #define constant:

MEMVAR_PRIVATE

The function returns a two-dimensional array with three columns:

{ { cSymbol, xValue, lVisible }, ... } 

The first column contains character strings indicating the symbolic names of PRIVATE variables, the second column holds their values and the third column contains a logical value. If this value is .T. (true), the PRIVATE variable is visible when SymbolInfo() is called, otherwise it is hidden by a variable of the same name.

MEMVAR_PUBLIC

The function returns a two-dimensional array with two columns:

{ { cSymbol, xValue }, ... } 

The columns contain the symbolic name and the value of PUBLIC variables.

SYMBOL_CLASSFUNC

The return value is a one-dimensional array holding the symbolic names of CLASS functions as character strings.

SYMBOL_BUILTIN_CLASSFUNC

The return value is a one-dimensional array holding the symbolic names of built-in CLASS functions as character strings.

SYMBOL_FUNCTION

The return value is a one-dimensional array holding the symbolic names of FUNCTIONs and PROCEDUREs as character strings.

SYMBOL_BUILTIN_FUNCTION

The return value is a one-dimensional array holding the symbolic names of built-in FUNCTIONs as character strings.

Description

The function is used to obtain information about entities registered in the symbol table at runtime of a program. This applies to dynamic memory variables, functions, procedures and class functions. The corresponding declarations are MEMVAR, PRIVATE, PUBLIC, FUNCTION, PROCEDURE and CLASS.

Symbols declared as STATIC or LOCAL are resolved at compile time and cannot be retrieved with SymbolInfo(), no matter whether it is a static variable, function, procedure or class. Symbols of FIELD variables are not registered in a program's symbol table and cannot be retrieved either with this function.

SymbolInfo() lists all registered symbols, regardless of whether they are declared in the EXE or in a DLL. If functions are implemented in a dynamically loaded DLL, the symbols of exported functions are listed including a possible function prefix specified as second parameter of the DllLoad() function. The original function name can be obtained with the DllInfo() function.

Examples
Listing PRIVATE variables
// The example demonstrates how to obtain a list of 
// all PRIVATE variables of a program. Note that 
// the PRIVATEs declared in Main() are overloaded 
// in Test(). 

#include "Memvar.ch" 

PROCEDURE Main 

   PRIVATE x := "Hello" 
   PRIVATE y := Date() 
   Test() 

RETURN 

PROCEDURE Test 
   LOCAL aSymbols, i 

   PRIVATE x := "World" 
   PRIVATE y := 12345.67 

   aSymbols := SymbolInfo( MEMVAR_PRIVATE ) 

   FOR i:=1 TO Len( aSymbols ) 
      ? aSymbols[i,1], "=", Var2Char(aSymbols[i,2]) 
      IF aSymbols[i,3] 
         ?? " visible" 
      ELSE 
         ?? " hidden" 
      ENDIF 
   NEXT 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.