ProcName()

PROCNAME()

Gets the name of the current function on the stack

Syntax

      PROCNAME( <nLevel> ) --> <cProcName>

Arguments

<nLevel> is the function level required.

Returns

<cProcName> The name of the function that it is being executed.

Description

This function looks at the top of the stack and gets the current executed function if no arguments are passed. Otherwise it returns the name of the function or procedure at <nLevel>.

Examples

      See Test

Tests

      This test will show the functions and procedures in stack.
      before executing it.
      PROCEDURE Main()
         LOCAL n := 1
         DO WHILE ! Empty( ProcName( n ) )
            ? ProcName( n++ )
         ENDDO
         RETURN

Compliance

Clipper

Files

Library is vm

Seealso

PROCLINE(), PROCFILE()

PCount()

PCOUNT()

Retrieves the number of arguments passed to a function.

Syntax

      PCOUNT() --> <nArgs>

Arguments

None

Returns

<nArgs> A number that indicates the number of arguments passed to a function or procedure.

Description

This function is useful to check if a function or procedure has received the required number of arguments.

Examples

      See Test

Tests

      PROCEDURE Test( xExp )
         IF PCount() == 0
            ? "This function needs a parameter"
         ELS
            ? xExp
         ENDIF
         RETURN

Compliance

Clipper

Files

Library is vm

Seealso

HB_PVALUE()

HB_PValue

HB_PVALUE

Retrieves the value of an argument.

Syntax

      HB_PVALUE( <nArg> ) --> <xExp>

Arguments

A number that indicates the argument to check.

Returns

<xExp> Returns the value stored by an argument.

Description

This function is useful to check the value stored in an argument.

Examples

      See Test

Tests

      PROCEDURE Test( nValue, cString )
         IF PCount() == 2
            ? hb_PValue( 1 ), nValue
            ? hb_PValue( 2 ), cString
         ENDIF
         RETURN

Compliance

Harbour

Files

Library is vm

Seealso

PCount(), HB_AParams()

Do()

DO()

Calls a procedure or a function

Syntax

      DO( <xFuncProc> [, <xArguments...>] ) --> <xRetVal>

Arguments

<xFuncProc> = Either a string with a function/procedure name to be called or a codeblock to evaluate.

<xArguments> = arguments passed to a called function/procedure or to a codeblock.

Returns

<xRetVal> A value that was returned from called function.

Description

This function can be called either by the harbour compiler or by user. The compiler always passes the item of IT_SYMBOL type that stores the name of procedure specified in DO <proc> WITH … statement.

If called procedure/function doesn’t exist then a runtime error is generated.

This function can be used as replacement of macro operator. It is also used internally to implement DO <proc> WITH <args…> In this case <xFuncProc> is of type HB_SYMB.

Examples

      cbCode := {| x | MyFunc( x ) }
      Do( cbCode, 1 )

      cFunction := "MyFunc"
      xRetVal := Do( cFunction, 2 )

      // Old style (slower):
      DO &cFunction WITH 3

Compliance

Clipper

Files

Library is rtl

CLIPINIT()

 

CLIPINIT()

Initialize various Harbour sub-systems

Syntax

      CLIPINIT() --> NIL

Arguments

none.

Returns

CLIPINIT() always return NIL.

Description

CLIPINIT() is one of the pre-defined INIT PROCEDURE and is executed at program startup. It declare an empty MEMVAR PUBLIC array called GetList that is going to be used by the Get system. It activates the default error handler, and (at least for the moment) calls the function that sets the default help key.

Compliance

It is said that CLIPINIT() should not call the function that sets the default help key since CA-Cl*pper does it in some other place.

Platforms

All

Seealso

INIT PROCEDURE

Break()

 

BREAK()

Exits from a BEGIN SEQUENCE block

Syntax

      BREAK( <xExp> )

Arguments

<xExp> is any valid expression. It is always required. If do not want to pass any argument, just use NIL.

Description

This function passes control to the RECOVER statement in a BEGIN SEQUENCE block.

Examples

      Break( NIL )

Compliance

Clipper

Files

Library is vm

Seealso

BEGIN SEQUENCE

__SetHelpK()

Template

Procedure

Name

__SetHelpK()

Category

API

Subcategory

Internal

Oneliner

Set F1 as the default help key

Syntax

      __SetHelpK()

Arguments

None.

Description

Set F1 to execute a function called HELP if such a function is linked into the program.

Compliance

Clipper

Files

Library is core

Seealso

__XHelp(), SET KEY, SetKey()

__Quit()

Template

Procedure

Name

__Quit()

Category

API

Subcategory

Events

Oneliner

Terminates an application.

Syntax

      __Quit()

Arguments

None

Description

This function terminates the current application and returns to the system.

Examples

      PROCEDURE EndApp( lYesNo )
         IF lYesNo
            __Quit()
         ENDIF
         RETURN

Compliance

Clipper