BASIC Extensions > A-Shell Extensions > DIMX
DIMX and Structures

Added September 2011

Begining with A-Shell 5.1.1234 of September 2011, DIMX supports structures directly. For example:

DEFSTRUCT ST_MOVIE

    MAP2 TITLE$,S,30

    MAP2 GROSS,F,6

ENDSTRUCT

...

DIMX FILMS(COUNT),ST_MOVIE   

 

This is effectively the same as:

DIMX FILMS(COUNT),X,36

Except that you may also access the individual members using a new form of the traditional array syntax:

FILMS(X).TITLE$     ! instead of FILMS.TITLE$(X)

FILMS(X).GROSS      ! instead of FILMS.GROSS(X)

 

Note that if one of the structure members is itself an array (for example, if we make GROSS into a 2 element array for domestic and foreign gross), the syntax to reference an element of GROSS() array within the FILMS() array would be:

FILMS(X).GROSS(Y)

The prior workaround (allocating a single instance of the structure, plus an array of unformatted variables equal in size to the structure, and then copying the structure into or out of each unformatted element as needed) is still a viable approach, but the new technique is probably more natural. Maybe even more elegant.

Compatibility Warning: this is both a compiler (edit 490) and a runtime enhancement; you will need A-Shell 5.1.1235 or later to use this feature.