Previous: Using calculator
Up: Tutorial
Previous Page: Using calculator
Next Page: About this document ...

Pointers and Indexes

DSPACK handles pointers by converting them into indexes - entry numbers when necessary - for instance for I/O. This feature may be used by the programmer for cases when it is more convenient to use indexes rather than pointers.

One example of this was presented in the example session on page where the user can select whether pointers or indexes are displayed.

This feature can also be used from a program. We can modify the program fill_points (page ) so that we can store indexes of the link-list instead of pointers.

Modifying subroutine fill_points to use indexes


mode_old = ids_pnt_conv(1) ! 1 means 'use pointers'

should be replaced by:

mode_old = ids_pnt_conv(2) ! 2 means 'use indexes'

And inside both loops the lines:

point(i).next = loc(point(i+2))

should be replaced by:

point(i).next = i+2

The resulting program will produce data functionally identical to the original one.

Fri Nov 4 01:54:15 MET 1994