david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[tables] Add for_each_table_entry_continue() and _continue_reverse()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2010-09-04 23:29:00 +01:00
parent a3021ad0e4
commit c04b6ccd75
1 changed files with 58 additions and 0 deletions

View File

@ -359,6 +359,35 @@ FILE_LICENCE ( GPL2_OR_LATER );
pointer < table_end ( table ) ; \
pointer++ )
/**
* Iterate through all remaining entries within a linker table
*
* @v pointer Entry pointer, preset to most recent entry
* @v table Linker table
*
* Example usage:
*
* @code
*
* #define FROBNICATORS __table ( struct frobnicator, "frobnicators" )
* #define __frobnicator __table_entry ( FROBNICATORS, 01 )
*
* struct frob my_frobnicator __frobnicator;
* struct frobnicator *frob;
*
* frob = &my_frobnicator;
* for_each_table_entry_continue ( frob, FROBNICATORS ) {
* ...
* }
*
* @endcode
*
*/
#define for_each_table_entry_continue( pointer, table ) \
for ( pointer++ ; \
pointer < table_end ( table ) ; \
pointer++ )
/**
* Iterate through all entries within a linker table in reverse order
*
@ -385,6 +414,35 @@ FILE_LICENCE ( GPL2_OR_LATER );
pointer >= table_start ( table ) ; \
pointer-- )
/**
* Iterate through all remaining entries within a linker table in reverse order
*
* @v pointer Entry pointer, preset to most recent entry
* @v table Linker table
*
* Example usage:
*
* @code
*
* #define FROBNICATORS __table ( struct frobnicator, "frobnicators" )
* #define __frobnicator __table_entry ( FROBNICATORS, 01 )
*
* struct frob my_frobnicator __frobnicator;
* struct frobnicator *frob;
*
* frob = &my_frobnicator;
* for_each_table_entry_continue_reverse ( frob, FROBNICATORS ) {
* ...
* }
*
* @endcode
*
*/
#define for_each_table_entry_continue_reverse( pointer, table ) \
for ( pointer-- ; \
pointer >= table_start ( table ) ; \
pointer-- )
/******************************************************************************
*
* Intel's C compiler chokes on several of the constructs used in this