All objects in Realsoft 3D are linked to a hierarchical structure. Once you get access to the root object, you can access any other object in the application.
For example, buttons and sub windows are children of their parent windows and are therefore linked into the parent's 'child list'.
A new list can be created as follows:
R3LIST list; R3NewList(&list);
Then any structure extended from R3NODE can be linked to the list using R3AddHead(), R3AddTail() or R3Insert() functions. For example:
R3NODE *n = ...; R3AddTail(&list, n);
Root class (inc/oops/r3roo.h) defines necessary methods for linking objects to/from lists. For example:
R3LIST mylist; R3NewList(&mylist); myobj = R3New(R3CLID_MYOBJ, ...); R3DoA(myobj, R3RM_ADDTAIL, &mylist); ... R3DoA(myobj, R3RM_REMOVE, &mylist);
Lists can be enumerated as follows:
R3NODE *n; for(n = list->head; n->next; n = n->next) { ... }
To scan a list backwards:
R3NODE *n; for(n = list->tail_pred; n->prev; n = n->prev) { ... }