#include "pp.h"
Go to the source code of this file.
Defines | |
#define | FIFO_decl(type, count, label) |
Declare a FIFO. | |
#define | FIFO_extern(type, count, label) |
Make a global FIFO available elsewhere. | |
#define | FIFO_init(type, ilabel) ( ppConcat(ilabel,_add) = ppConcat(ilabel,_pop) = ilabel ) |
Initialize a declared FIFO If it was declared as part of a compound, the indirection to that compound is also reqiured as part of ilabel. | |
#define | FIFO_auto(type, count, ilabel) |
Declare a FIFO as a global or on the stack. | |
#define | FIFO_empty(type, ilabel) ( ppConcat(ilabel,_add) == ppConcat(ilabel,_pop) ) |
Tell us if a FIFO is empty, and therefore that FIFO_pop is invalid. | |
#define | FIFO_next(type, ilabel, val) ((val) == (ilabel) ? ((type*)((char*)ilabel+sizeof(ilabel))-1) : (val)-1) |
Tell us what the next wrapped value will be. | |
#define | FIFO_full(type, ilabel) ( FIFO_next(type, ilabel, ppConcat(ilabel,_add)) == ppConcat(ilabel,_pop) ) |
Tell us if a FIFO is full, and therefore that FIFO_add is invalid. | |
#define | FIFO_back(type, ilabel) ( (ilabel)+ppConcat(ilabel,_add) ) |
Get a pointer to where next add will add a member Useful for where you want to get a pointer to where data would be added so it can be initialized in place before invoking FIFO_add. You should check FIFO_empty before doing this. | |
#define | FIFO_front(type, ilabel) ( (ilabel)+ppConcat(ilabel,_pop) ) |
Get a pointer to who will be next to be popped without popping it You should check FIFO_empty before doing this. | |
#define | FIFO_add(type, ilabel) ( ppConcat(ilabel,_add) = FIFO_next(type, ilabel, ppConcat(ilabel,_add)) ) |
Add a new value to the back of the FIFO queue You should check FIFO_full before doing this, maybe in a debug assertion Returns pointer to the data in FIFO to fill in. | |
#define | FIFO_pop(type, ilabel) ( ppConcat(ilabel,_pop) = FIFO_next(type, ilabel, ppConcat(ilabel,_pop)) ) |
Pop the oldest value off the queue You should check FIFO_empty before doing this Returns pointer to the data in FIFO to access BEFORE adding to the FIFO again. | |
#define | FIFO_foreach(type, ilabel, iterator) |
Iterate (search) over FIFO members. |
Definition in file fifo.h.
#define FIFO_foreach | ( | type, | |||
ilabel, | |||||
iterator | ) |
Value:
if( !FIFO_empty(type, ilabel) ) \ for( iterator = FIFO_front(type, ilabel); iterator != FIFO_back(type, ilabel); iterator = FIFO_next(type, ilabel, iterator) )
type | Type of FIFO | |
type | ilabel instance label (including ->path to FIFO) | |
iterator | Variable of type 'type' that will be set to each member as the following scope body is invoked Returns pointer to the data in FIFO to access BEFORE adding to the FIFO again |