Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter ThreeData Types and Operators (continued)

3.7 Contiguous Data

3.7.1 Binary Data

For most operations, intimate knowledge of how data is stored by the language is not required. However, there are certain times when it is necessary to ‘get into the weeds’ either to interface with some external data or program. In such cases, it is essential to understand how data is organized in memory.

All information, no matter how large or small, will be represented as binary information within computer memory or on some media. Legato variable data are stored in several modes that either allow for grouping or does not allow for grouping. For example, if six separate int values were created:

int a, b, c, d, e, f;

These would not be collocated in memory. So, if one was to reference the actual memory address of a (also known as using a pointer), b would not directly follow a. This is because each variable’s control information contains just enough memory to hold a typical variable (64-bits).

Instead, consider the following:

int a[6];

In this case, an area of memory is allocated for a. Therefore, the data for array index 1 will directly follow the 0th element. This is said to be contiguous memory.

3.7.2 Contiguous Memory

All variables that are allocated in arrays with the exception of string types will be contained in contiguous memory. An individual string will have its characters collocated but for an array of strings, each string will be in a different location and may not even be in order in memory. The string array contains a series of string control blocks that, in turn, contain the location, allocated size, and used size.

The size of each unit depends on the data type. For example, char and byte arrays will contain one byte for each element while an array of int types will be 32-bits or four bytes for each element.

Memory organization for lists is as expected. The 0th element is first followed by each element to the nth element. Tables are organized by rows and cells for each column. Therefore, for a 10 x 10 table, a[0][0] references the 0th element and a [1][0] references the 10th element. The organization is conducive to adding and deleting rows easily. Cubes are organized by z planes, y rows, and x columns.

3.7.3 Scattered Data

As mentioned above, string arrays are not contiguous. A single string or string element is treated as an expandable character array.