summaryrefslogtreecommitdiff
path: root/xgbgen/context.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/context.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/context.go')
-rw-r--r--xgbgen/context.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/xgbgen/context.go b/xgbgen/context.go
index c40313f..697413e 100644
--- a/xgbgen/context.go
+++ b/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)
}