CODEBLOCK

Name

CODEBLOCK -- 

Function

<vData>             CLIP(<sFuncName>, [<Param1>, ..., <ParamN>)
TRUE || FALSE       COMPILEFILE(<sFileName>, <sFlags>, <@sError>)
<CodeBlock>         COMPILESTRING(<sString>, <@sError>)
bCurrentErrorHandlerERRORBLOCK([<bErrorHandler>])
LastBlockValue      EVAL(<bBlock>, [<BlockArg list>])
bFieldBlock         FIELDBLOCK(<cFieldName>)
bFieldWBlock        FIELDWBLOCK(<cFieldName>, <nWorkArea>)
<CodeBlock>         LOAD(<sFileName>)
<CodeBlock>         LOADBLOCK(<sFileName>)
bMemvarBlock        MEMVARBLOCK(<cMemvarName>)
<nTaskID>           START(<vTask>, [<vPar1>,,, <vParN>])

Description

Function CLIP()

 CLIP(<sFuncName>, [<Param1>, ..., <ParamN>) 	--> <vData>

CLIP() evaluates function with name <sFuncName> and returns result this function.

Function EVAL()

 EVAL(<bBlock>, [<BlockArg list>]) --> LastBlockValue

EVAL() is a code block function. It is the most basic code block evaluation facility in the xClipper system. A code block is a special data value that refers to a piece of compiled program code. For more information on code blocks, refer to the "Basic Concepts" chapter in the Programming and Utilities Guide.

To execute or evaluate a code block, call EVAL() with the block value and any parameters. The parameters are supplied to the block when it is executed. Code blocks may be a series of expressions separated by commas. When a code block is evaluated, the returned value is the value of the last expression in the block.

The xClipper compiler usually compiles a code block at compile time. There are, however, occasions at runtime when you may need to compile a code block from a character string. You can do this by using the macro operator (&).

EVAL() is often used to create iteration functions. These are functions that apply a block to each member of a data structure. AEVAL(), ASORT(), ASCAN(), and DBEVAL() are iteration functions (e.g., AEVAL() applies a block to each element within an array).

Function FIELDBLOCK()

 FIELDBLOCK(<cFieldName>) --> bFieldBlock

FIELDBLOCK() is a database function that builds a code block. When executed with an argument, the code block created by this function assigns the value of the argument to <cFieldName>. When executed without an argument, the code block retrieves the value of <cFieldName>.

Note that the specified field variable may not exist when the code block is created, but must exist before the code block is executed.

Function FIELDWBLOCK()

 FIELDWBLOCK(<cFieldName>, <nWorkArea>) --> bFieldWBlock

FIELDWBLOCK() is a database function that builds a code block. When evaluated with the EVAL() function, the code block first selects the designated <nWorkArea>. If an argument was passed, the code block then assigns the value of the argument to <cFieldName>. If no argument was passed, the code block retrieves the value of <cFieldName>. The original work area is then reselected before the code block returns control.

Note that the specified field variable may not exist when the code block is created but must exist before the code block is executed.

Function MEMVARBLOCK()

 MEMVARBLOCK(<cMemvarName>) --> bMemvarBlock

The code block created by MEMVARBLOCK() has two operations depending on whether an argument is passed to the code block when it is evaluated. If evaluated with an argument, it assigns the value of the argument to <cMemvarName>. If evaluated without an argument, the code block retrieves the value of <cMemvarName>.