aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/protocol.go
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2013-08-11 20:42:36 -0400
committerPřemysl Janouch <p@janouch.name>2018-09-08 16:49:17 +0200
commit4b20ffaf4f4cc756832a6d064d5dfe182f16b0e9 (patch)
tree9a82c9bbd56ffdf5892070ba477692ae168ebd8e /nexgb/xgbgen/protocol.go
parent5d96993ee16d821b9448f4532328cb7caad223c9 (diff)
downloadhaven-4b20ffaf4f4cc756832a6d064d5dfe182f16b0e9.tar.gz
haven-4b20ffaf4f4cc756832a6d064d5dfe182f16b0e9.tar.xz
haven-4b20ffaf4f4cc756832a6d064d5dfe182f16b0e9.zip
Updated to work with new xproto XML files.
Namely, the "doc" element is ignored. Also, I've sorted everything before output so that diff isn't completely useless.
Diffstat (limited to 'nexgb/xgbgen/protocol.go')
-rw-r--r--nexgb/xgbgen/protocol.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/nexgb/xgbgen/protocol.go b/nexgb/xgbgen/protocol.go
index d56663d..433f4e2 100644
--- a/nexgb/xgbgen/protocol.go
+++ b/nexgb/xgbgen/protocol.go
@@ -22,6 +22,12 @@ type Protocol struct {
Requests []*Request
}
+type Protocols []*Protocol
+
+func (ps Protocols) Len() int { return len(ps) }
+func (ps Protocols) Swap(i, j int) { ps[i], ps[j] = ps[j], ps[i] }
+func (ps Protocols) Less(i, j int) bool { return ps[i].ExtName < ps[j].ExtName }
+
// Initialize traverses all structures, looks for 'Translation' type,
// and looks up the real type in the namespace. It also sets the source
// name for all relevant fields/structures.