home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_progs
/
prog_c
/
suplib.lzh
/
SUPLIB
/
DOC
/
LISTS.DOC
< prev
next >
Wrap
Text File
|
1991-08-16
|
2KB
|
85 lines
LISTS.DOC
(SUP32.LIB and DRES.LIBRARY)
These are general list handling routines that should have been provided
in EXEC. In addition to basic additions, I provide support for structures
whos Nodes are not at the base of the structure. These are the infamous
'sptr's below. Such routines take a pointer to the structure, add an
offset to it to get to the Node, do the specified operation, then subtract
the offset to return to the 'sptr's actual base. In otherwords, it allows
you to deal with such structures without having to do these hacks in your
source.
GetHead GetHead
GetSucc GetSucc
node = GetHead(list)
node = GetSucc(node) (physically the same routine as GetHead()).
This routine returns the successor of a node in the list. If a list is
specified, the first node in the list is returned. NULL is returned if
the list is empty or one has reached the end of the list.
GetTail GetTail
node = GetTail(list)
This routine returns the last node in the list, or NULL if the list
is empty.
GetPred GetPred
node = GetPred(node)
This routine returns the previous node from the given node, or NULL
if we are at the head of the list.
GetHeadOff GetHeadOff
sptr = GetHeadOff(list, offset)
This routine retrieves the first node in the list and subtracts the
specified offset to get to the base of the structure (where 'offset'
is the offset into the structure where the Node has been placed rather
than placing it as the first object in the structure).
NULL is returned is the list is empty. NOTE! Unlike GetHead(), only
a valid list pointer may be specified here.
GetTailOff GetTailOff
sptr = GetTailOff(list, offset)
This routine works the same as GetHeadOff() but works on the last
node in the list.
GetSuccOff GetSuccOff
sptr = GetSuccOff(sptr, offset)
Given a structure pointer where the Node is offset from the structure
base, add the offset to the pointer, determine the successor if any,
then subtract the offset from the successor to get back to the
structure base for the successor.
NULL is returned if there is no successor.
GetPredOff GetPredOff
sptr = GetPredOff(sptr, offset)
This routine works the same as GetSuccOff() but works on the previous
node rather than the next. NULL is returned if we are at the head
of the list;