6.3  Building With a Data File

The array generted from a Data file ranges from 0 to the size of the array minus one. You access it like any array variable except that it cannot be modified.


Data file names else with a ".data" suffix. The corresponding array is the same as the file name without the suffix. The data is included in your program or library by listing it in the Class file along with a type designation. A file containing real numbers cannot be declared as an integer type.


When building a data file, a Class is created that is used to access the array from a method. The name of the data class is also shares the array name. The implicit class contains a global array declaration with a zero based index. It also declares a Micro value set to the size of the array. The name of the Micro is array name with ".Size" appended.

The data file can optionally contain a CRC checksum in a comment at the end of the file. The checksum is encoded in a comment after all data values.

The checksum for numeric data files does not include comments, blank lines, or spaces. This way you can reformat comments and white space without changing the checksum. The checksum is computed using the text representation of the numbers. Consequently the checksum changes if numbers themselves are reformatted even if it does not change the binary value.

When you initially compile a data file with no checksum, the checksum is written as a note in the log file. You can then copy the value into the data file itself. If the checksum does not match it is treated as a compilation error.


You may also declare a class with the same name as the data class. The global array will automatically be declared in your new class. Do not explicitly declare it, as this will result in duplicate declarations. You can then add additional declarations in the data class.

String Data File

Gilda Language Reference