Purpose:Define array variables

 

Format:SETARRAY [/= /F /T:type /R filename [/Z] arrayname] name[a[,b[,c[,d]]]] [...]

 

a,b,c,dArray dimensions

 

/F(orce overwrite)/T(ype)
/R(ead)/Z (resize)        

 

Usage:

 

You can define up to 4-dimensional arrays. For example, to define a 5-row by 10-column array:

 

setarray array1[5,10]

 

The array elements are addressed in base 0, so to reference this array you would use 0-4 for the rows and 0-9 for the columns.

 

You can initialize arrays by appending [value] to the definition. For example, to initialize all of the array elements to 0:

 

setarray myarray[100] [0]

 

Array variables can return a range of values. The syntax is:

 

arrayvar[x..y]

 

TCC will return the values from arrayvar[x] to arrayvar[y] with a space between each value.

 

To set the variable elements, use the SET command.

 

If you don't enter any arguments, SETARRAY will display the currently defined arrays. If you don't enter any dimensions, SETARRAY will display the definition for that array. You can use wildcards in the array name.

 

See also @ARRAYINFO.

 

Options:

 

/=Display the SETARRAY command dialog to help you set the command line options. The /= option can be anywhere on the line; additional options will set the appropriate fields in the command dialog.

 

/FForce overwrite of existing arrays (if any).

 

/RRead a file into a 1-dimensional array. SETARRAY will automatically determine the required size of the array. You can only combine /R with /F.

 

/T:type[:"regexpression"]Set a variable type. If you try to set the variable to an incompatible type, SET will return an error. The supported types are:

 

int (or 1)The variable can only contain 0-9
dec (or 2)The variable can only contain 0-9, the decimal character, and the thousands separator
hex (or 3)The variable can only contain 0-9 and A-F
bool (or 4)The variable can only contain 0 or 1
alpha (or 5)The variable can only contain A-Z and a-z
alnum (or 6)The variable can only contain A-Z, a-z, and 0-9
regex (or 7)The variable must match the specified regular expression

 

/ZResize an existing array. For example:

 

setarray myarray[5,2]

...

setarray /z myarray[8,3]

 

You cannot change the number of dimensions in an array.