Last change
on this file since 1bb0170 was
5546f50b,
checked in by Peter A. Buhr <pabuhr@…>, 8 months ago
|
more switch to tabs
|
-
Property mode set to
100644
|
File size:
427 bytes
|
Rev | Line | |
---|
[77d46c7] | 1 | #include <collections/list.hfa> |
---|
[5717495] | 2 | |
---|
| 3 | |
---|
| 4 | int main() { |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | struct req; |
---|
| 13 | P9_EMBEDDED_FWD_INFUNC(req, dlink(req)) |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | struct req { |
---|
[5546f50b] | 21 | int pri, rqr; |
---|
| 22 | inline dlink(req); |
---|
[5717495] | 23 | }; |
---|
| 24 | |
---|
| 25 | dlist(req) reqs; |
---|
| 26 | |
---|
| 27 | req |
---|
[5546f50b] | 28 | r1 = {1, 42}, |
---|
| 29 | r2 = {2, 42}; |
---|
[5717495] | 30 | |
---|
| 31 | insert_first(reqs, r2); |
---|
| 32 | insert_first(reqs, r1); |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | P9_EMBEDDED_INFUNC(req, dlink(req)) |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | while( req & cur = reqs`elems; cur`moveNext ) |
---|
[5546f50b] | 53 | printf("{%d %d} ", cur.pri, cur.rqr); |
---|
[5717495] | 54 | printf("\n"); |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.