19 lines
694 B
Text
19 lines
694 B
Text
define structure
|
|
1 Node,
|
|
2 value fixed decimal,
|
|
2 back_pointer handle(Node),
|
|
2 fwd_pointer handle(Node);
|
|
|
|
/* Given that 'Current" points at some node in the linked list : */
|
|
|
|
P = NEW (: Node :); /* Create a node. */
|
|
get (P => value);
|
|
P => fwd_pointer = Current => fwd_pointer;
|
|
/* Points the new node at the next one. */
|
|
Current => fwd_pinter = P;
|
|
/* Points the current node at the new one. */
|
|
P => back_pointer = Current;
|
|
/* Points the new node back at the current one. */
|
|
Q = P => fwd_pointer;
|
|
Q => back_pointer = P;
|
|
/* Points the next node to the new one. */
|