19 #define MAX_LEN_WORKLIST 64
20 #define MAX_NUM_WORKLISTS 16
47 #define worklist_iterate(_list, _p) \
49 struct universal _p; \
52 while (_p##_index < worklist_length(_list)) { \
53 worklist_peek_ith(_list, &_p, _p##_index++);
55 #define worklist_iterate_end \
struct universal entries[MAX_LEN_WORKLIST]
void worklist_advance(struct worklist *pwl)
Remove first element from worklist.
bool worklist_peek(const struct worklist *pwl, struct universal *prod)
Fill in the id and is_unit values for the head of the worklist if the worklist is non-empty.
void worklist_copy(struct worklist *dst, const struct worklist *src)
Copy contents from worklist src to worklist dst.
void worklist_init(struct worklist *pwl)
Initialize a worklist to be empty.
bool worklist_peek_ith(const struct worklist *pwl, struct universal *prod, int idx)
Fill in the id and is_unit values for the ith element in the worklist.
bool worklist_is_empty(const struct worklist *pwl)
Returns whether worklist has no elements.
bool worklist_append(struct worklist *pwl, const struct universal *prod)
Adds the id to the next available slot in the worklist.
bool worklist_insert(struct worklist *pwl, const struct universal *prod, int idx)
Inserts the production at the location idx in the worklist, thus moving all subsequent entries down.
void worklist_remove(struct worklist *pwl, int idx)
Remove element from position idx.
bool are_worklists_equal(const struct worklist *wlist1, const struct worklist *wlist2)
Return TRUE iff the two worklists are equal.
int worklist_length(const struct worklist *pwl)
Returns the number of entries in the worklist.