Variable Management Functions

Variable Management

FieldBlock Return a code block that sets/gets a value for a given field
FieldWBlock Return a sets/gets code block for field in a given work area
HB_AParams Returns an array containing values of all parameters passed to a function, method or procedure
HB_ArgC Returns the number of command line arguments
HB_ArgCheck Checks existence of an internal switch on the command line
HB_ArgShift Updates HB_Arg* parameter list removing the 1-st one and replacing it by others
HB_ArgString Retrieves the vale of an internal switch set on the command line.
HB_ArgV Retrieves the value of a command line argument
HB_PIsByRef Determine if a parameter is passed by reference.
HB_PValue Retrieves the value of an argument.
HB_ValToStr Converts any scalar type to a string.
MemVarBlock Returns a codeblock that sets/gets a value of memvar variable
PCount Retrieves the number of arguments passed to a function.
Type Retrieves the type of an expression
ValType Retrieves the data type of an expression

__mvScope()

Template

Function

Name

__mvScope()

Category

API

Subcategory

Variable management

Oneliner

If variable exists then returns its scope.

Syntax

      __mvScope( <cVarName> )

Arguments

<cVarName> = a string with a variable name to check

Returns

The symbolic values are defined in hbmemvar.ch

HB_MV_NOT_FOUND      = variable is not declared (not found in symbol table)
HB_MV_UNKNOWN        = if variable doesn't exist (but found in symbol table)
HB_MV_ERROR          = if information cannot be obtained (memory error or argument error)
HB_MV_PUBLIC         = for public variables
HB_MV_PRIVATE_GLOBAL = for private variables declared outside of current function/procedure
HB_MV_PRIVATE_LOCAL  = for private variables declared in current function/procedure

Examples

      PROCEDURE Main()
         PUBLIC mPublic
         PRIVATE mPrivateGlobal

         CallProc()
         ? __mvScope( "mPrivateLocal" )      // HB_MV_UNKNOWN

         RETURN

      PROCEDURE CallProc()
         PRIVATE mPrivateLocal

         ? __mvScope( "mPublic" )            // HB_MV_PUBLIC
         ? __mvScope( "mPrivateGlobal" )     // HB_MV_PRIVATE_GLOBAL
         ? __mvScope( "mPrivateLocal" )      // HB_MV_PRIVATE_LOCAL
         ? __mvScope( "mFindMe" )            // HB_MV_NOT_FOUND

         IF __mvScope( "mPublic" ) > HB_MV_ERROR
            ? "Variable exists"
         ELSE
            ? "Variable not created yet"
         ENDIF

         RETURN

Compliance

Harbour

Files

Library is core

Seealso

include/hbmemvar.ch