Skip to content

Commit 0a92c03

Browse files
committed
Moving tests to test
1 parent f987056 commit 0a92c03

5 files changed

Lines changed: 1579 additions & 0 deletions

File tree

test/gen/eventdef

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
EVENT KeyButtonPointer BYTE:u.u.type BYTE:u.u.detail CARD16:u.u.sequenceNumber CARD32:u.keyButtonPointer.time CARD32:u.keyButtonPointer.root CARD32:u.keyButtonPointer.event CARD32:u.keyButtonPointer.child INT16:u.keyButtonPointer.rootX INT16:u.keyButtonPointer.rootY INT16:u.keyButtonPointer.eventX INT16:u.keyButtonPointer.eventY CARD16:u.keyButtonPointer.state BOOL:u.keyButtonPointer.sameScreen
2+
EVENT EnterLeave BYTE:u.u.type BYTE:u.u.detail CARD16:u.u.sequenceNumber CARD32:u.enterLeave.time CARD32:u.enterLeave.root CARD32:u.enterLeave.event CARD32:u.enterLeave.child INT16:u.enterLeave.rootX INT16:u.enterLeave.rootY INT16:u.enterLeave.eventX INT16:u.enterLeave.eventY CARD16:u.enterLeave.state BYTE:u.enterLeave.mode BYTE:u.enterLeave.flags
3+
EVENT Focus BYTE:u.u.type BYTE:u.u.detail CARD16:u.u.sequenceNumber CARD32:u.focus.window BYTE:u.focus.mode
4+
EVENT Expose BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.expose.window CARD16:u.expose.x CARD16:u.expose.y CARD16:u.expose.width CARD16:u.expose.height CARD16:u.expose.count
5+
EVENT GraphicsExpose BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.graphicsExposure.drawable CARD16:u.graphicsExposure.x CARD16:u.graphicsExposure.y CARD16:u.graphicsExposure.width CARD16:u.graphicsExposure.height CARD16:u.graphicsExposure.minorEvent CARD16:u.graphicsExposure.count BYTE:u.graphicsExposure.majorEvent
6+
EVENT NoExpose BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.noExposure.drawable CARD16:u.noExposure.minorEvent BYTE:u.noExposure.majorEvent
7+
EVENT VisibilityNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.visibility.window CARD8:u.visibility.state
8+
EVENT CreateNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.createNotify.parent CARD32:u.createNotify.window INT16:u.createNotify.x INT16:u.createNotify.y CARD16:u.createNotify.width CARD16:u.createNotify.height CARD16:u.createNotify.borderWidth BOOL:u.createNotify.override
9+
EVENT DestroyNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.destroyNotify.event CARD32:u.destroyNotify.window
10+
EVENT UnmapNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.unmapNotify.event CARD32:u.unmapNotify.window BOOL:u.unmapNotify.fromConfigure
11+
EVENT MapNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.mapNotify.event CARD32:u.mapNotify.window BOOL:u.mapNotify.override
12+
EVENT MapRequest BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.mapRequest.parent CARD32:u.mapRequest.window
13+
EVENT ReparentNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.reparent.event CARD32:u.reparent.window CARD32:u.reparent.parent INT16:u.reparent.x INT16:u.reparent.y BOOL:u.reparent.override
14+
EVENT ConfigureNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.configureNotify.event CARD32:u.configureNotify.window CARD32:u.configureNotify.aboveSibling INT16:u.configureNotify.x INT16:u.configureNotify.y CARD16:u.configureNotify.width CARD16:u.configureNotify.height CARD16:u.configureNotify.borderWidth BOOL:u.configureNotify.override
15+
EVENT ConfigureRequest BYTE:u.u.type BYTE:u.u.detail CARD16:u.u.sequenceNumber CARD32:u.configureRequest.parent CARD32:u.configureRequest.window CARD32:u.configureRequest.sibling INT16:u.configureRequest.x INT16:u.configureRequest.y CARD16:u.configureRequest.width CARD16:u.configureRequest.height CARD16:u.configureRequest.borderWidth CARD16:u.configureRequest.valueMask
16+
EVENT GravityNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.gravity.event CARD32:u.gravity.window INT16:u.gravity.x INT16:u.gravity.y
17+
EVENT ResizeRequest BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.resizeRequest.window CARD16:u.resizeRequest.width CARD16:u.resizeRequest.height
18+
EVENT Circulate BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.circulate.event CARD32:u.circulate.window CARD32:u.circulate.parent BYTE:u.circulate.place
19+
EVENT PropertyNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.property.window CARD32:u.property.atom CARD32:u.property.time BYTE:u.property.state
20+
EVENT SelectionClear BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.selectionClear.time CARD32:u.selectionClear.window CARD32:u.selectionClear.atom
21+
EVENT SelectionRequest BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.selectionRequest.time CARD32:u.selectionRequest.owner CARD32:u.selectionRequest.requestor CARD32:u.selectionRequest.selection CARD32:u.selectionRequest.target CARD32:u.selectionRequest.property
22+
EVENT SelectionNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.selectionNotify.time CARD32:u.selectionNotify.requestor CARD32:u.selectionNotify.selection CARD32:u.selectionNotify.target CARD32:u.selectionNotify.property
23+
EVENT ColormapNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD32:u.colormap.window CARD32:u.colormap.colormap BOOL:u.colormap.new BYTE:u.colormap.state
24+
EVENT MappingNotify BYTE:u.u.type BYTE:pad CARD16:u.u.sequenceNumber CARD8:u.mappingNotify.request CARD8:u.mappingNotify.firstKeyCode CARD8:u.mappingNotify.count
25+
EVENT ClientMessage BYTE:u.u.type BYTE:u.u.detail CARD16:u.u.sequenceNumber CARD32:u.clientMessage.window CARD32:u.clientMessage.u.l.type

test/gen/genprotocol.awk

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Feed cc -E /usr/include/X11/Xproto.h into this
2+
3+
BEGIN {
4+
in_struct = 0;
5+
6+
types[BOOL] = types[BYTE] = 1;
7+
types[INT8] = types[CARD8] = 1;
8+
types[INT16] = types[CARD16] = 1;
9+
types[INT32] = types[CARD32] = 1;
10+
}
11+
12+
in_struct == 1 && $1 == "}" && $2 ~ /x.*;/ {
13+
name = substr($2, 2, length($2) - 2);
14+
15+
memlist = "";
16+
for (i = 0; i < memcount; i++)
17+
memlist = memlist " " members[i];
18+
19+
# print name ", " memlist
20+
21+
if (name ~ /Req$/)
22+
requests[substr(name, 1, length(name) - 3)] = memlist;
23+
else if (name ~ /Reply$/)
24+
replies[substr(name, 1, length(name) - 5)] = memlist;
25+
else
26+
structs[name] = memlist;
27+
28+
delete members;
29+
in_struct = 0;
30+
}
31+
32+
in_struct == 2 && $1 == "}" && $2 == "xEvent;" {
33+
in_struct = 0;
34+
}
35+
36+
in_struct == 1 && $1 != "}" {
37+
fcount = split($0, f, "[ \t,;]+");
38+
39+
if (fcount > 0) {
40+
if (f[1] == "")
41+
i = 2;
42+
else
43+
i = 1;
44+
45+
if (next_type == "") {
46+
type = f[i];
47+
i++;
48+
} else {
49+
type = next_type;
50+
}
51+
52+
if ($0 ~ /;[ \t]*$/) {
53+
next_type = "";
54+
} else {
55+
next_type = type;
56+
}
57+
58+
for (; i < fcount; i++) {
59+
members[memcount] = type ":" f[i];
60+
memcount++;
61+
}
62+
}
63+
}
64+
65+
/^typedef struct.*\{/ {
66+
if (in_struct)
67+
{
68+
print "typedef struct while in_struct!";
69+
exit 1;
70+
}
71+
72+
next_type = "";
73+
in_struct = 1;
74+
memcount = 0;
75+
76+
# hack to skip _xEvent
77+
if ($3 == "_xEvent")
78+
in_struct = 2;
79+
}
80+
81+
/^typedef x.* x.*;/ {
82+
if (in_struct)
83+
{
84+
print "typedef xFoo xBar; while in_struct!";
85+
exit 1;
86+
}
87+
88+
src = substr($2, 2);
89+
dest = substr($3, 2, length($3) - 2);
90+
91+
if (src ~ /Req$/)
92+
memlist = requests[substr(src, 1, length(src) - 3)];
93+
else if (src ~ /Reply$/)
94+
memlist = replies[substr(src, 1, length(src) - 5)];
95+
else
96+
memlist = structs[src];
97+
98+
if (dest ~ /Req$/)
99+
requests[substr(dest, 1, length(dest) - 3)] = memlist;
100+
else if (dest ~ /Reply$/)
101+
replies[substr(dest, 1, length(dest) - 5)] = memlist;
102+
else
103+
structs[dest] = memlist;
104+
}
105+
106+
END {
107+
for (x in requests)
108+
print "REQUEST " x " " requests[x];
109+
for (x in replies)
110+
print "REPLY " x " " replies[x];
111+
for (x in structs)
112+
print "STRUCT " x " " structs[x];
113+
}
114+

0 commit comments

Comments
 (0)