source: doc/theses/mike_brooks_MMath/programs/lst-issues-multi-static.run.c @ b965774

Last change on this file since b965774 was 1379c96e, checked in by Peter A. Buhr <pabuhr@…>, 6 months ago

formatting changes to programs

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[5717495]1#include <sys/queue.h>
2#include <stdio.h>
3
4
5
6int main() {
7
8
9
10
11
12
13
14
15
16
17
18
19
20struct req {
[5546f50b]21        int pri, rqr;
22        LIST_ENTRY(req) by_pri;
23        LIST_ENTRY(req) by_rqr;
[5717495]24};
25
26LIST_HEAD(reql, req);
27
[1379c96e]28struct reql reqs_pri;
[5717495]29struct reql reqs_rqr_42;
30struct reql reqs_rqr_17;
31struct reql reqs_rqr_99;
32
[1379c96e]33LIST_INIT(&reqs_pri);
[5717495]34LIST_INIT(&reqs_rqr_42);
35LIST_INIT(&reqs_rqr_17);
36LIST_INIT(&reqs_rqr_99);
37
38struct req
[5546f50b]39        r42a = {1, 42},
40        r42b = {2, 42},
41        r17a = {2, 17},
42        r17b = {3, 17},
43        r17c = {4, 17},
44        r99a = {3, 99};
[5717495]45
[1379c96e]46LIST_INSERT_HEAD(&reqs_pri, &r17c, by_pri);
47LIST_INSERT_HEAD(&reqs_pri, &r99a, by_pri);
48LIST_INSERT_HEAD(&reqs_pri, &r17b, by_pri);
49LIST_INSERT_HEAD(&reqs_pri, &r42b, by_pri);
50LIST_INSERT_HEAD(&reqs_pri, &r17a, by_pri);
51LIST_INSERT_HEAD(&reqs_pri, &r42a, by_pri);
[5717495]52
53LIST_INSERT_HEAD(&reqs_rqr_42, &r42b, by_rqr);
54LIST_INSERT_HEAD(&reqs_rqr_42, &r42a, by_rqr);
55
56LIST_INSERT_HEAD(&reqs_rqr_17, &r17c, by_rqr);
57LIST_INSERT_HEAD(&reqs_rqr_17, &r17b, by_rqr);
58LIST_INSERT_HEAD(&reqs_rqr_17, &r17a, by_rqr);
59
60LIST_INSERT_HEAD(&reqs_rqr_99, &r99a, by_rqr);
61
62
63
64
65
66
67
68struct req *cur;
[1379c96e]69LIST_FOREACH(cur, &reqs_pri, by_pri)
[5546f50b]70        printf("{%d %d} ", cur->pri, cur->rqr);
[5717495]71printf("| ");
72LIST_FOREACH(cur, &reqs_rqr_42, by_rqr)
[5546f50b]73        printf("{%d %d} ", cur->pri, cur->rqr);
[5717495]74printf("| ");
75LIST_FOREACH(cur, &reqs_rqr_17, by_rqr)
[5546f50b]76        printf("{%d %d} ", cur->pri, cur->rqr);
[5717495]77printf("| ");
78LIST_FOREACH(cur, &reqs_rqr_99, by_rqr)
[5546f50b]79        printf("{%d %d} ", cur->pri, cur->rqr);
[5717495]80printf("\n");
81
[5546f50b]82}
Note: See TracBrowser for help on using the repository browser.