Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FlexFile Reference Guide - <b>a_declare()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 A_DECLARE()
 Declare a FlexFile array
-------------------------------------------------------------------------------

 Syntax

    A_DECLARE(   <cType>,
                 <nElement>,
                 [<nElements>...] )    ->     aArray

 Arguments

    <cType> is a code for the type of the FlexFile strongly typed
    array. (See the table below for a list of types and their codes.)

    <nElements> is the number of elements in each consecutive
    dimension.  An array can be declared with up to six dimensions.

 Returns

    A_DECLARE() returns a fully dimensioned FlexFile array of <cType>.

 Description

    A_DECLARE() creates a FlexFile type array.  The various data types
    that FlexFile implements are listed below.

    When Clipper returns a value from a function, it makes a copy of
    the value for the calling function before releasing the value
    created by the called function.  So, if you declare a FlexFile
    character array of 60,000 elements, A_DECLARE() will allocate
    memory for an array of 60,000 character elements (a little over
    60,000 bytes) and then Clipper will copy that variable requiring
    two 60,000 byte blocks to execute the function.

    Although this is not a problem with smaller arrays, it becomes
    significant with larger ones.  FlexFile addresses this problem by
    offering an optional syntax for this function.  Just add a new
    parameter and insert it after the type.  This parameter must be a
    previously declared character string of any length and it must be
    passed-by-reference. The optional syntax is as follows:

    A_DECLARE( <cType>,
              @<aLargeArr>,
               <nElement>,
              [<nElements>...] )


    The return value when this syntax is used is undefined.  Instead,
    FlexFile will modify the <aLargeArr> variable.  Because there is
    no return value, Clipper will not duplicate the <aLargeArr>
    variable.

    Table: Data types
    +----------------------------------------------------------------------+
    | Array Type       Type  Elem/Arr  Byte/Elem Data Range                |
    |----------------------------------------------------------------------|
    | Binary (logical)  B    520K      1 bit     .T. or .F.                |
    | Character         C    65K       1 byte    Extended ASCII set        |
    | Tiny Integer      T    65K       1 byte    -128 to 127               |
    | Unsigned Tiny     UT   65K       1 byte    0 to 255                  |
    | Integer           I    32K       2 bytes   -32,768 to 32,767         |
    | Unsigned Integer  UI   32K       2 bytes   0 to 65,535               |
    | Long Integer      L    16K       4 bytes   -2147483648 to 2147483647 |
    | Unsigned Long     UL   16K       4 bytes   0 to 4,294,967,295        |
    | Floating Point    F    16K       4 bytes   7 digit precision         |
    | String            S    16K       4 bytes   n/a                       |
    | Double            D    8K        8 bytes   15 digit precision        |
    +----------------------------------------------------------------------+

 Examples

    // Declare a two dimensional (B)inary array
    LOCAL rows, cols

    rows = 10000
    cols = 20
    aBinary = A_DECLARE( "B", rows, cols )

    // Optional syntax. Note: A_DECLARE() has no return value.
    LOCAL aLargeArr := ''

    A_DECLARE( "UL", aLargeArr, 10000, 2 )

See Also: A_FILL() A_TYPE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson