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/context.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/context.go')
-rw-r--r-- | nexgb/xgbgen/context.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nexgb/xgbgen/context.go b/nexgb/xgbgen/context.go index c40313f..697413e 100644 --- a/nexgb/xgbgen/context.go +++ b/nexgb/xgbgen/context.go @@ -5,6 +5,7 @@ import ( "encoding/xml" "fmt" "log" + "sort" "time" ) @@ -70,6 +71,8 @@ func (c *Context) Morph(xmlBytes []byte) { if c.protocol.isExt() { c.Putln("\"github.com/BurntSushi/xgb/xproto\"") } + + sort.Sort(Protocols(c.protocol.Imports)) for _, imp := range c.protocol.Imports { // We always import xproto, so skip it if it's explicitly imported if imp.Name == "xproto" { @@ -142,6 +145,8 @@ func (c *Context) Morph(xmlBytes []byte) { } // Now write Go source code + sort.Sort(Types(c.protocol.Types)) + sort.Sort(Requests(c.protocol.Requests)) for _, typ := range c.protocol.Types { typ.Define(c) } |