summaryrefslogtreecommitdiff
path: root/xgbgen/type.go
diff options
context:
space:
mode:
authorAndrew Gallant <[email protected]>2013-08-11 20:42:36 -0400
committerAndrew Gallant <[email protected]>2013-08-11 20:42:36 -0400
commita95df029067fedc05cb914b883b1752ce1d57974 (patch)
treead873cd533d1b7f34311caa21c770af501989f45 /xgbgen/type.go
parent7725850c7d1f4eb39864f8c8b16c249e385bb2a0 (diff)
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 'xgbgen/type.go')
-rw-r--r--xgbgen/type.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/xgbgen/type.go b/xgbgen/type.go
index 521f67e..ded5be2 100644
--- a/xgbgen/type.go
+++ b/xgbgen/type.go
@@ -14,6 +14,16 @@ type Type interface {
Define(c *Context)
}
+type Types []Type
+
+func (ts Types) Len() int { return len(ts) }
+func (ts Types) Swap(i, j int) { ts[i], ts[j] = ts[j], ts[i] }
+func (ts Types) Less(i, j int) bool {
+ x1, x2 := ts[i].XmlName(), ts[j].XmlName()
+ s1, s2 := ts[i].SrcName(), ts[j].SrcName()
+ return (s1 == s2 && x1 < x2) || s1 < s2
+}
+
// Translation is used *only* when transitioning from XML types to
// our better representation. They are placeholders for the real types (below)
// that will replace them.