xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

ProcName()

Determines the symbolic name of the currently executed function, method or procedure.

Syntax

ProcName( [<nCallStack>] ) --> nProcName

Arguments

<nCallStack>
This is a numeric value >= 0 indicating the call stack position of the currently executed routine whose symbolic name should be returned. The default value is zero, which indicates the currently executed routine.

Return

The function returns a character string holding the name of the routine that is currently being executed. If <nCallStack> is larger than the number of entries in the call stack, or if the symbolic name is not included as debug information in the linked executable file, an empty string is returned ("").

Description

ProcName() is a debug function used to determine the symbolic name of the routine currently being executed. It is mainly used in conjunction with error handling routines that identify the location of runtime errors. See function ErrorBlock() for a discussion of error handling.

Info

See also:ErrorBlock(), ProcFile(), ProcLine()
Category: Debug functions
Source:vm\proc.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example implements a user defined function that collects call stack
// information in an array.

   FUNCTION GetCallStack()
      LOCAL aStack := {}
      LOCAL nStack := 1  // Skip the GetCallStack() function in the result

      DO WHILE .NOT. Empty( ProcName(nStack) )
         AAdd( aStack, { ProcFile(nStack), ProcName(nStack), ProcLine(nStack) }
         nStack ++
      ENDDO

   RETURN aStack

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe