Parameters - Petewg/harbour-core GitHub Wiki

πŸ”™ Functions-by-category


  • 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 parameter zero (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 of main(int argc, char *argv[]) in a C-program.
  • 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 the nParam 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.


πŸ”™ Functions-by-category

⚠️ **GitHub.com Fallback** ⚠️