|
DeepScreen Code Generation for Control Variable Arrays (as of 8.06 MR6)
This release of DeepScreen code generation supports using Control variables as arrays (excluding the Java and miniGL targets). Control is the scripting environment within Altia Design (open the Control Editor from the Control button in Altia Design to add or modify the Control logic associated with an object). At DeepScreen code generation time, if the Generate code for Control option is chosen, Control logic is converted to actual source code. In earlier releases of DeepScreen, Control variables (globals or routine locals) used as arrays generated code that could not compile. This release supports generating code for Control variables used as arrays if the variable is given an array size when it is declared in a GLOBALS statement or the LOCALS section of a ROUTINE statement as in:
GLOBALS my_array[20]
or...
ROUTINE my_routine
PARAMS: my_param LOCALS: local_array[100]
The array size must be a number, not a Control variable name or an animation name. If an array’s elements are used as strings, the array becomes an array of string elements at code generation time and the default length of each string element is 64 characters. This allows for a string of 63 printable characters followed by a nil terminator character in each element of the array. This length is adjustable from the Code Generation Options window by changing the setting for:
Size Settings if no Dynamic Memory:
Maximum number of characters in dynamic strings 100
The setting (100 in this example) is used for the character length of each array element even if the Use Dynamic Memory option is selected. In other words, the character length of array elements is fixed to one size for all arrays whose elements are used as strings. Finally, if one element of an array is used as a string, all elements must be used as strings. Failure to use all elements of a specific array consistently will most likely generate code in altia/control.c that does not compile or if it compiles, it probably will fail on execution.
If array elements will contain strings and these strings are only set through indirection as in:
EXPR my_array[i] = @temp_name
There must be at least one SET or EXPR statement that sets an array element directly to a string as in:
SET my_array[0] = “a string”
Otherwise, the DeepScreen code generator is not able to recognize that my_array[20] (in this example) is for string elements and it assumes the elements will hold numbers instead of strings.
|