13.2. SYSTEM

About
Functions order

13.2.1. About SYSTEM

13.2.2. SYSTEM functions order

13.2.2.4. Function DIRECTORY()

 DIRECTORY(<cDirSpec>, [<cAttributes>]) --> aDirectory

13.2.2.6. Function ERRORBLOCK()

 ERRORBLOCK([<bErrorHandler>]) --> bCurrentErrorHandler

13.2.2.6.3. Description

ERRORBLOCK() is an error function that defines an error handler to execute whenever a runtime error occurs. Specify the error handler as a code block with the following form,

{ |<oError>| <expression list>,... }

where <oError> is an error object containing information about the error. Within the code block, messages can be sent to the error object to obtain information about the error. Returning true (.T.) from the error handling block retries the failed operation and false (.F.) resumes processing.

The error handling code block can be specified either as a list of expressions or as a call to a user-defined function. A call to a user- defined function is more useful since you can use xClipper control statements instead of expressions. This is particularly the case if there is a BEGIN SEQUENCE pending and you want to BREAK to the nearest RECOVER statement.

As this implies, error handling blocks can be used in combination with BEGIN SEQUENCE...END control structures. Within an error handling block, you handle device, low-level, and common errors that have a general recovery mechanism. If the operation needs specific error handling, define a BEGIN SEQUENCE then BREAK to the RECOVER statement, returning the error object for local processing. See the example below.

If no <bErrorHandler> has been specified using ERRORBLOCK() and a runtime error occurs, the default error handling block is evaluated. This error handler displays a descriptive message to the screen, sets the ERRORLEVEL() to 1, then QUITs the program.

Since ERRORBLOCK() returns the current error handling block, it is possible to specify an error handling block for an operation saving the current error handling block, then restore it after the operation has completed. Also, error handlers specified as code blocks, can be passed to procedures and user-defined functions, and RETURNed as values.

For more information on the structure and operations of error objects, refer to the Error class entry in this chapter and the "Error Handling Strategies" chapter in the Programming and Utilities Guide.

13.2.2.7. Function ERRORLEVEL()

 ERRORLEVEL([<nNewReturnCode>]) --> nCurrentReturnCode

13.2.2.9. Function GETENV()

 GETENV(<cEnvironmentVariable>) --> cString

13.2.2.13. Function NETERR()

 NETERR([<lNewError>]) --> lError

13.2.2.16. Function PCOUNT()

 PCOUNT() --> nLastArgumentPos

13.2.2.17. Function PROCLINE()

 PROCLINE([<nActivation>]) --> nSourceLine

13.2.2.18. Function PROCNAME()

 PROCNAME([<nActivation>]) --> cProcedureName

13.2.2.19. Function QOUT()

 QOUT([<exp list>]) --> NIL
 QQOUT([<exp list>]) --> NIL

13.2.2.20. Function SET()

 SET(<nSpecifier>, [<expNewSetting>], [<lOpenMode>]) --> CurrentSetting

13.2.2.20.3. Description

SET() is a system function that lets you inspect or change the values of the xClipper system settings. For information on the meaning and legal values for a particular setting, refer to the associated command or function.

Use a manifest constant to specify the setting to be inspected or changed. These constants are defined in a header file called Set.ch. This header file should be included at the top of any source file which uses SET().

Set.ch also defines a constant called _SET_COUNT. This constant is equal to the number of settings that can be changed or inspected with SET(), allowing the construction of a generic function that preserves all settings (see example below).

Note: The numeric values of the manifest constants in Set.ch are version-dependent and should never be used directly; the manifest constants should always be used.

If <nSpecifier> or <expNewSetting> is invalid, the call to SET() is ignored.

 Set Values Defined in Set.ch
 ------------------------------------------------------------------------
 Constant            Value Type     Associated Command or Function
 ------------------------------------------------------------------------
 _SET_EXACT          Logical        SET EXACT
 _SET_FIXED          Logical        SET FIXED
 _SET_DECIMALS       Numeric        SET DECIMALS
 _SET_DATEFORMAT     Character      SET DATE
 _SET_EPOCH          Numeric        SET EPOCH
 _SET_PATH           Character      SET PATH
 _SET_DEFAULT        Character      SET DEFAULT
 _SET_EXCLUSIVE      Logical        SET EXCLUSIVE
 _SET_SOFTSEEK       Logical        SET SOFTSEEK
 _SET_UNIQUE         Logical        SET UNIQUE
 _SET_DELETED        Logical        SET DELETED
 _SET_CANCEL         Logical        SETCANCEL()
 _SET_DEBUG          Numeric        ALTD()
 _SET_COLOR          Character      SETCOLOR()
 _SET_CURSOR         Numeric        SETCURSOR()
 _SET_CONSOLE        Logical        SET CONSOLE
 _SET_ALTERNATE      Logical        SET ALTERNATE
 _SET_ALTFILE        Character      SET ALTERNATE TO
 _SET_DEVICE         Character      SET DEVICE
 _SET_PRINTER        Logical        SET PRINTER
 _SET_PRINTFILE      Character      SET PRINTER TO
 _SET_MARGIN         Numeric        SET MARGIN
 _SET_BELL           Logical        SET BELL
 _SET_CONFIRM        Logical        SET CONFIRM
 _SET_ESCAPE         Logical        SET ESCAPE
 _SET_INSERT         Logical        READINSERT()
 _SET_EXIT           Logical        READEXIT()
 _SET_INTENSITY      Logical        SET INTENSITY
 _SET_SCOREBOARD     Logical        SET SCOREBOARD
 _SET_DELIMITERS     Logical        SET DELIMITERS
 _SET_DELIMCHARS     Character      SET DELIMITERS TO
 _SET_WRAP           Logical        SET WRAP
 _SET_MESSAGE        Numeric        SET MESSAGE
 _SET_MCENTER        Logical        SET MESSAGE
 ------------------------------------------------------------------------
 

Note: _SET_EXTRAFILE and _SET_SCROLLBREAK have no corresponding commands. _SET_EXTRAFILE lets you specify an additional alternate file, and _SET_SCROLLBREAK lets you toggle the interpretation of Ctrl+S.