TRUE || FALSE COMPILEFILE(<sFileName>, <sFlags>, <@sError>) <CodeBlock> COMPILESTRING(<sString>, <@sError>) <cPath> DefPath() aDirectory DIRECTORY(<cDirSpec>, [<cAttributes>]) nOsCode DOSERROR([<nNewOsCode>]) bCurrentErrorHandlerERRORBLOCK([<bErrorHandler>]) nCurrentReturnCode ERRORLEVEL([<nNewReturnCode>]) nErrorCode FERROR() cString GETENV(<cEnvironmentVariable>) <CodeBlock> LOAD(<sFileName>) <CodeBlock> LOADBLOCK(<sFileName>) nKbytes MEMORY(<nExp>) lError NETERR([<lNewError>]) cWorkstationName NETNAME() cOsName OS() nLastArgumentPos PCOUNT() nSourceLine PROCLINE([<nActivation>]) cProcedureName PROCNAME([<nActivation>]) NIL QOUT([<exp list>]) --> NIL QQOUT([<exp list>]) CurrentSetting SET(<nSpecifier>, [<expNewSetting>], [<lOpenMode>]) NIL SLEEP(<nSec>) <nResultCode> SYSCMD(<sCmd>, <sStdin>, @<sResult>, @<sError>) <vOldLimitValue> ULIMIT(<sResName>, <vLimitVal>) cVersion VERSION()
COMPILEFILE(<sFileName>, <sFlags>, <@sError>) --> TRUE || FALSE
COMPILEFILE() compiles file <sFileName> with flags <sFlags> and returns TRUE in success, in other returns FALSE and <sError> contents error description.
COMPILESTRING(<sString>, <@sError>) --> <CodeBlock>
COMPILESTRING() compiles string <sString> to code block and returns it. If error was created, <sError> kept error description.
Sourse string can contents any CLIP construstions and command with the exlusion not static functions declaration. <sString> must begin with parameters descriptions (if it need) without functions/procedures declaration. See examples.
DefPath() --> <cPath>
Returns the path defined in SET DEFAULT command with ending PATH_DELIM or ":" symbol. If SET DEFAULT path isn't defined (empty), nothing is added.
DIRECTORY(<cDirSpec>, [<cAttributes>]) --> aDirectory
DIRECTORY() is an environment function that returns information about files in the current or specified directory. It is similar to ADIR(), but returns a single array instead of adding values to a series of existing arrays passed by reference.
Use DIRECTORY() to perform actions on groups of files. In combination with AEVAL(), you can define a block that can be applied to all files matching the specified <cDirSpec>.
The header file, Directry.ch, in the \include subdirectory contains #defines for the subarray subscripts, so that the references to each file subarray are more readable.
<cDirSpec> | identifies the drive, directory and file specification for the directory search. Wildcards are allowed in the file specification. If <cDirSpec> is omitted, the default value is *.*. |
<cAttributes> | specifies inclusion of files with special attributes in the returned information. <cAttributes> is a string containing one or more of the following characters: DIRECTORY() Attributes ------------------------------------------------------------------------ Attribute Meaning ------------------------------------------------------------------------ H Include hidden files S Include system files D Include directories V Search for the DOS volume label and exclude all other files ------------------------------------------------------------------------Normal files are always included in the search, unless you specify V. |
Returns : | DIRECTORY() returns an array of subarrays, with each subarray containing information about each file matching <cDirSpec>. The subarray has the following structure: DIRECTORY() Subarray Structure ------------------------------------------------------------------------ Position Metasymbol Directry.ch ------------------------------------------------------------------------ 1 cName F_NAME 2 cSize F_SIZE 3 dDate F_DATE 4 cTime F_TIME 5 cAttributes F_ATTR ------------------------------------------------------------------------If no files are found matching <cDirSpec> or if <cDirSpec> is an illegal path or file specification, DIRECTORY() returns an empty ({}) array. |
See also : | AEVAL() |
DOSERROR([<nNewOsCode>]) --> nOsCode
DOSERROR() is an error function that returns the last DOS error code associated with an activation of the runtime error block. When a runtime error occurs, the DOSERROR() function is set to the current DOS error if the operation has an associated DOS error. The function value is retained until another runtime error occurs. If the failed operation has no associated DOS error, the DOSERROR() returns zero. With low- level file functions, FERROR() returns the same value as DOSERROR().
Through use of the optional <nNewOsCode>, you may customize to the reporting activation the returned value for any DOS error.
<nNewOsCode> | , if specified, alters the value returned by DOSERROR(). The value must be a numeric value that reflects a DOS error number. |
Returns : | DOSERROR() returns the DOS error number as an integer numeric value. |
See also : | ERRORBLOCK() FERROR() |
ERRORBLOCK([<bErrorHandler>]) --> bCurrentErrorHandler
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.
<bErrorHandler> | is the code block to execute whenever a runtime error occurs. When evaluated, the <bErrorHandler> is passed an error object as an argument by the system. |
Returns : | ERRORBLOCK() returns the current error handling code block. If no error handling block has been posted since the program was invoked, ERRORBLOCK() returns the default error handling block. |
ERRORLEVEL([<nNewReturnCode>]) --> nCurrentReturnCode
ERRORLEVEL() is a dual purpose environment function. It returns the current xClipper return code and optionally sets a new return code. The return code is a value set by a child process so the parent process can test the termination state of the child process. Typically, the parent process is OS and the child process is an application program. Retrieve a return code with the OS ERRORLEVEL command or INT 21 Function 4Dh.
When a xClipper program terminates, the return code is set to 1 if the process ends with a fatal error. If the process ends normally, the return code is set to zero, or the last ERRORLEVEL() set in the program.
Typically, you would set a return code with ERRORLEVEL() to indicate an error state to the program that invoked the current xClipper program. In most cases this is the application batch file. Here you would test the return code using the OS ERRORLEVEL command. Refer to your OS manual for more information.
<nNewReturnCode> | is the new return code setting. This can be a value between zero and 255. The default value at startup is zero. If not specified, ERRORLEVEL() reports the current setting without assigning a new value. |
Returns : | ERRORLEVEL() returns the current xClipper exit code as a numeric value, if one has been set using ERRORLEVEL() with an argument; otherwise, it returns zero. |
FERROR() --> nErrorCode
FERROR() is a low-level file function that indicates a DOS error after a file function is used. These functions include FCLOSE(), FCREATE(), FERASE(), FOPEN(), FREAD(), FREADSTR(), and FRENAME(). FERROR() retains its value until the next execution of a file function.
Warning! This function allows low-level access to DOS files and devices. It should be used with extreme care and requires a thorough knowledge of the operating system.
GETENV(<cEnvironmentVariable>) --> cString
GETENV() is an environment function that lets you retrieve information from the OS environment into an application program. Typically, this is configuration information, including path names, that gives the location of files (database, index, label, or reports). This function is particularly useful for network environments.
<cEnvironmentVariable> | is the name of the OS environment variable. When specifying this argument, you can use any combination of uppercase and lowercase letters; GETENV() is not case-sensitive. |
Returns : | GETENV() returns the contents of the specified OS environment variable as a character string. If the variable cannot be found, GETENV() returns a null string (""). |
LOAD(<sFileName>) --> <CodeBlock>
LOAD() reades file <sFileName> and returns code block. <sFile> is the byte-code file "filename.po" or dynamic library "filename.so". After loading all not static functions are accessible to use.
LOADBLOCK(<sFileName>) --> <CodeBlock>
LOADBLOCK() loades byte-code file <sFileName> and returns code block. Byte-code file can be created:
clip -p filename.prg
The rules and structure of filename.prg must be corresponded are rules for string from function COMPILESTRING().
MEMORY(<nExp>) --> nKbytes
MEMORY() is an environment function that reports various states of free pool memory. (Free pool is the dynamic region of memory that stores character strings and executes RUN commands.)
<nExp> | is a numeric value that determines the type of value MEMORY() returns as follows: MEMORY() Argument Values ------------------------------------------------------------------------ Value Meaning ------------------------------------------------------------------------ 0 Estimated total space available for character values 1 Largest contiguous block available for character values 2 Area available for RUN commands ------------------------------------------------------------------------ |
Returns : | MEMORY() returns an integer numeric value representing the amount of memory available, in one -kilobyte increments. |
NETERR([<lNewError>]) --> lError
NETERR() is a network function. It is a global flag set by USE, USE...EXCLUSIVE, and APPEND BLANK in a network environment. It is used to test whether any of these commands have failed by returning true (.T.) in the following situations:
NETERR() Causes ------------------------------------------------------------------------ Command Cause ------------------------------------------------------------------------ USE USE EXCLUSIVE by another process USE...EXCLUSIVE USE EXCLUSIVE or USE by another process APPEND BLANK FLOCK() or RLOCK() of LASTREC() + 1 by another user ------------------------------------------------------------------------
NETERR() is generally applied in a program by testing it following a USE or APPEND BLANK command. If it returns false (.F.), you can perform the next operation. If the command is USE, you can open index files. If it is APPEND BLANK, you can assign values to the new record with a REPLACE or @...GET command. Otherwise, you must handle the error by either retrying the USE or APPEND BLANK, or terminating the current operation with a BREAK or RETURN.
<lNewError> | , if specified, sets the value returned by NETERR() to the specified status. <lNewError> can be either true (.T.) or false (.F.). Setting NETERR() to a specified value allows the runtime error handler to control the way certain file errors are handled. For more information, refer to Errorsys.prg. |
Returns : | NETERR() returns true (.T.) if a USE or APPEND BLANK fails. The initial value of NETERR() is false (.F.). If the current process is not running under a network operating system, NETERR() always returns false (.F.). |
See also : | RLOCK() FLOCK() |
NETNAME() --> cWorkstationName
OS() --> cOsName
OS() is an environment function that returns the name of the disk operating system under which the current workstation is operating. The name is returned in the form of the operating system name followed by the version number.
PCOUNT() --> nLastArgumentPos
PCOUNT() reports the position of the last argument in the list of arguments passed when a procedure or user-defined function is invoked. This information is useful when determining whether arguments were left off the end of the argument list. Arguments skipped in the middle of the list are still included in the value returned.
To determine if a parameter did not receive a value, test it for NIL. Skipped parameters are uninitialized and, therefore, return NIL when accessed. Another method is to test parameters with the VALTYPE() function. This can establish whether the argument was passed and enforce the correct type at the same time. If a parameter was not supplied, a default value can be assigned.
For more information on passing parameters, refer to the "Basic Concepts" chapter in the Programming and Utilities Guide.
Returns : | PCOUNT() returns, as an integer numeric value, the position of the last argument passed. If no arguments are passed, PCOUNT() returns zero. |
See also : | VALTYPE() |
PROCLINE([<nActivation>]) --> nSourceLine
PROCLINE() queries the xClipper activation stack to determine the last line executed in a currently executing procedure, user-defined function, or code block. The activation stack is an internal structure that maintains a record of each procedure, function, or code block invocation. A line number is relative to the beginning of the original source file. A line includes a comment, blank line, preprocessor directive, and a continued line. A multistatement line is counted as a single line.
For the current activation, PROCLINE() returns the number of the current line. For a previous activation, PROCLINE() returns the number of the line that invoked the procedure or a user-defined function in which PROCLINE() is invoked.
If the activation being queried is a code block evaluation, PROCLINE() returns the line number of the procedure in which the code block was originally defined.
PROCLINE() is used with PROCNAME() to report debugging information.
<nActivation> | is a numeric value that specifies which activation to query. Zero refers to the current activation, one refers to the previous activation, etc. If not specified, the default value is zero. |
Returns : | PROCLINE() returns the line number of the last line executed in a currently executing procedure, function, or code block as an integer numeric value. If the /L compiler option suppresses line number information, PROCLINE() always returns zero. |
See also : | PROCNAME() |
PROCNAME([<nActivation>]) --> cProcedureName
PROCNAME() queries the xClipper activation stack to determine the name of a currently executing procedure, user-defined function, or code block. The activation stack is an internal structure that maintains a record of each procedure, function, or code block invocation.
For the current activation, PROCNAME() returns the name of the current procedure or user-defined function. For a previous activation, PROCNAME() returns the name of the procedure or user-defined function that invoked the current procedure.
If the activation being queried is a code block evaluation, PROCNAME() returns the name of the procedure or user-defined function that defined the code block, preceded by "b". If the activation being queried is a memvar, PROCNAME() returns the name preceded by "M->".
PROCNAME() is used with PROCLINE() to report debugging information.
<nActivation> | specifies which activation to query. A value of zero refers to the current activation, a value of one refers to the previous activation, etc. If unspecified, the default value is zero. |
Returns : | PROCNAME() returns the name of a currently executing procedure, function, or code block, as a character string. |
See also : | PROCLINE() |
QOUT([<exp list>]) --> NIL QQOUT([<exp list>]) --> NIL
QOUT() and QQOUT() are console functions. These are the functional primitives that create the ? and ?? commands, respectively. Like the ? and ?? commands, they display the results of one or more expressions to the console. QOUT() outputs carriage return and line feed characters before displaying the results of <exp list>. QQOUT() displays the results of <exp list> at the current ROW() and COL() position. When QOUT() and QQOUT() display to the console, ROW() and COL() are updated. If SET PRINTER is ON, PROW() and PCOL() are updated instead. If <exp list> is specified, both QOUT() and QQOUT() display a space between the results of each expression.
You can use QOUT() and QQOUT() for console display within an expression. This is particularly useful for blocks, iteration functions such as AEVAL() and DBEVAL(), and in a list of statements in the output pattern of a user-defined command definition.
<exp list> | is a comma-separated list of expressions (of any data type other than array or block) to display to the console. If no argument is specified and QOUT() is specified, a carriage return/line feed pair is displayed. If QQOUT() is specified without arguments, nothing displays. |
Returns : | QOUT() and QQOUT() always return NIL. |
SET(<nSpecifier>, [<expNewSetting>], [<lOpenMode>]) --> CurrentSetting
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.
<nSpecifier> | is a numeric value that identifies the setting to be inspected or changed. <nSpecifier> should be supplied as a manifest constant (see below). |
<expNewSetting> | is an optional argument that specifies a new value for the <nSpecifier>. The type of <expNewSetting> depends on |
<nSpecifier> | . |
<lOpenMode> | is a logical value that indicates whether or not files opened for the following settings, _SET_ALTFILE, _SET_PRINTFILE, _SET_EXTRAFILE should be truncated or opened in append mode. A value of false (.F.) means the file should be truncated. A value of true (.T.) means the file should be opened in append mode. In either case, if the file does not exist, it is created. If this argument is not specified, the default is append mode. |
Returns : | SET() returns the current value of the specified setting. |
SYSCMD(<sCmd>, <sStdin>, @<sResult>, @<sError>) --> <nResultCode>
SYSCMD() runs system command <sCmd> and sends to this command string <sStdin> to a standart input. All output stream will be write to <sResult>, and all error stream to <sError>.
<sResult> and <sError> can't be constants.
ULIMIT(<sResName>, <vLimitVal>) --> <vOldLimitValue>
ULIMIT() sets new limit value <vLimitVal> to use system resource with name <sResName> and returns old value for this resource.
The list of resource names see in ulimit.ch