source: doc/theses/mike_brooks_MMath/programs/lst-features-intro.run.cfa@ e0350e0

Last change on this file since e0350e0 was b195498, checked in by Peter A. Buhr <pabuhr@…>, 5 months ago

proofreading intro and background chapters, capitalize section titles, update backtick calls to regular calls

  • Property mode set to 100644
File size: 491 bytes
Line 
1#include <collections/list.hfa>
2
3
4int main() {
5
6
7
8
9
10
11
12struct req;
13P9_EMBEDDED_FWD_INFUNC(req, dlink(req))
14
15
16
17
18
19
20struct req {
21 int pri, rqr;
22 inline dlink(req); // containment inheritance, fields hoisted into structure
23};
24
25dlist(req) reqs;
26
27req r1 = {1, 42}, r2 = {2, 42};
28
29insert_first(reqs, r2);
30insert_first(reqs, r1);
31
32
33
34
35
36
37
38
39
40P9_EMBEDDED_INFUNC(req, dlink(req))
41
42
43
44
45
46
47
48
49
50
51
52 while( req & cur = iter( reqs ); advance( cur ) )
53 printf("{%d %d} ", cur.pri, cur.rqr);
54printf("\n");
55
56
57
58
59
60
61
62}
Note: See TracBrowser for help on using the repository browser.