diff options
author | Andrew Gallant <jamslam@gmail.com> | 2013-08-11 20:42:36 -0400 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-09-08 16:49:17 +0200 |
commit | 4b20ffaf4f4cc756832a6d064d5dfe182f16b0e9 (patch) | |
tree | 9a82c9bbd56ffdf5892070ba477692ae168ebd8e /nexgb/xgbgen/type.go | |
parent | 5d96993ee16d821b9448f4532328cb7caad223c9 (diff) | |
download | haven-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/type.go')
-rw-r--r-- | nexgb/xgbgen/type.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/nexgb/xgbgen/type.go b/nexgb/xgbgen/type.go index 521f67e..ded5be2 100644 --- a/nexgb/xgbgen/type.go +++ b/nexgb/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. |