Parameters - Petewg/harbour-core GitHub Wiki
-
GetE(
<cEnvironmentVariable>
) β cValue
see/use hb_GetEnv() -
GetEnv(
<cEnvironmentVariable>
) β cValue
see/use hb_GetEnv() -
hb_GetEnv(
<cEnvironmentVariable>, [<cDefaultValue>]
) β cValue
returns the content of the<cEnvironmentVariable>
environment variable.
If<cEnvironmentVariable>
does not exist,<cDefaultValue>
is returned.
If<cEnvironmentVariable>
does not exist and no<cDefaultValue>
specified an empty string is returned. -
hb_ACmdLine() β aArray
It returns array with all command line parameters. Unlike 'hb_AParams(__dbgProcLevel() - 1)', hb_ACmdLine() returns all parameters also hidden ones, just like 'hb_CmdLine()' function and 'hb_argv()/hb_argc()'. -
hb_AParams(
[<nUpLevel>]
) β aParamList
returns an array with the parameters passed to a function. Specifying<nUpLevel>
lets you obtain the parameter list of the caller functions up in the call tree. NOTE: returns current value of parameters which might have been changed by user code, so they potentially be different than original parameters passed to given function. -
hb_argc() β nArgs
returns the number of command line arguments passed to the application, including the internal arguments;
Note: the number returned doesn't include the hb_argv(0) (i.e. the name of executable). -
hb_argv(
[<nArg>]
) β cArg
returns the<nArg>
-th command line argument passed to the application. Calling it with the parameterzero
(or no parameter at all) it will return the name of the executable, as written in the command line (including full path).- Remark: the above two functions, hb_argc() & hb_argv() resemble (in functionality terms) the
int argc
&char *argv[]
arguments ofmain(int argc, char *argv[])
in a C-program.
- Remark: the above two functions, hb_argc() & hb_argv() resemble (in functionality terms) the
-
hb_argCheck(
<cArg>
) β lSet
Check if an internal switch has been set when the program started. Internal switch is a command line argument prefixed with a double slash//
.e.g.: myprogram.exe //SWITCH1 ? hb_argCheck("SWITCH1") --> .T. ? hb_argCheck("SWITCH2") --> .F.
-
hb_argShift(
[<lShift>]
) β NIL
updates the parameters list (that are retrieved/utilized by 'hb_arg*()' family functions) by removing the 1-st one and replacing it by others. If<lShift>
is.T.
then first non internal parameter is moved to hb_argv(0) (i.e. hb_progname()) and all next are shifted. -
hb_argString(
<cArg>
) β cValue
returns the value assigned to<cArg>
internal switch. If the<cArg>
is not set or has not assigned a value to it, the function returns a NULL string.e.g.: myprogram.exe //SWITCH1somevalue //SWITCH2 ? hb_argString("SWITCH1") --> "somevalue" ? hb_argString("SWITCH2") --> "" (null string, no value assigned to SWITCH2) ? hb_argString("SWITCH3") --> "" (null string, SWITCH3 is not set)
-
hb_ArrayToParams(
<aValue>
) β aValue[ 1 ] [, aValue>[ N ] ]
converts array into list of items which can be used as function parameters, array-values or array-indexes in the same way as...
operator. -
hb_CmdLine() β cString
returns the full command line, i.e.: all command line arguments (parameters). -
hb_Default(
<@xVar>, <xValue>
) β NIL
Sets the value of<xVar>
to<xValue>
if either<xVar>
value is NIL or the types of both values doesn't match.<xVar>
must passed by refernce! -
hb_DefaultValue(
<xValue>, <xDefaultValue>
) β xReturn
returns<xDefaultValue>
if<xValue>
is NIL or different type of<xDefaultValue>
, otherwise returns<xValue>
. It's similar to hb_Default() but not modifying the variable. -
hb_GetEnv(
<cEnvVar>, [<cDefaultValue>]
) β cValue
retruns the value of the<cEnvVar>
environment variable or<cDefaultValue>
or an empty string if<cEnvVar>
does not exist and no<cDefaultValue>
specified. -
hb_setEnv(
<cEnvName>, [<cNewVal>]
) β lOK
sets or deletes (when<cNewVal>
is NIL) process environment variable<cEnvName>
. -
hb_mvRestore(
<cFileName>, [lAdditive], [cMask], [lIncludeMask]
) β xValue
restores saved memory variables (public, privates). Returns: 1st restored value or NIL if no value restored or .F. on error. -
hb_mvSave(
<cFileName>, [cMask] [, lIncludeMask]
) β NIL
saves memory variables (public, privates), visible within the current procedure or user-defined function, to a memory file (.hbv
). Supports variable names lengthier than 10 chars. -
hb_PIsByRef(
<nParam>
) β lIsByRef
returns .T. if thenParam
is passed by reference. -
hb_PValue(
<nParam> [, <uNewValue> ]
) β uValue
returns the value passed in the<nParam>
parameter and optionally assigns a new value to it. It returns the current (not the original passed) parameter value. -
PCount() β nArgs
retrieves the number of arguments passed to a function.