| Q D E V _ H L P _ D E L T A S C A N ( )
| | | | | SOURCE: qdev_macros.txt 1.16 (12/09/2014) English
AMIGA - PUBLIC
----------------------------------------------------------------------------
NAME
QDEV_HLP_DELTASCAN() - Allows to traverse Amiga, doubly
linked l. in a fast way (cached).
SYNOPSIS
QDEV_HLP_DELTASCAN(lh, na, code);
QDEV_HLP_DELTASCAN(struct List *, <nodearray>, <code>);
FUNCTION
This m. works in a similar way as QDEV_HLP_DELTAITER().
INPUTS
list - Address of the list(struct List, struct MinList).
na - Node array of 4 entries (struct Node *n[4]).
code - Code that will be executed per loop.
RETURNS
No output.
BASES
None.
NOTES
In theory it is safe to call 'Remove()' at any point as
nodes are cached but this way macro is slower than the
QDEV_HLP_DELTAITER()!
This macro was designed mainly to quickly compare the
node addresses. Use helper macros QDEV_HLP_DS#? to match
and break.
All OS lists can be traversed with this macro, but some
sort of arbitration must be provided. This is typically
to be Forbid()/Permit() pair.
SEE ALSO
QDEV_HLP_ISLISTEMPTY(), QDEV_HLP_ITERATE(),
QDEV_HLP_DELTAITER()
EXAMPLE
#include <proto/exec.h>
#include <qdev.h>
LONG isonlist_ds(struct List *lh, void *node)
{
REGISTER struct Node *QDEV_HLP_DSVARDECL(n);
REGISTER LONG res = 0;
/*
* Enter forbidden state in case of OS list.
*/
QDEV_HLP_NOSWITCH
(
QDEV_HLP_DELTASCAN
(
lh, n,
if ((res = (LONG)QDEV_HLP_DSMATCH(
QDEV_HLP_DSNODEH(n), QDEV_HLP_DSNODET(n), node)))
{
QDEV_HLP_DSBREAK(n);
}
);
);
return res;
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |