aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-07 21:58:33 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-07 21:58:33 -0400
commit13d598e5e7f26bc6177ae3f7d52f4f19729ab2f3 (patch)
tree216dde82bd19b1beb01d9fd0654daa3538e73f92 /nexgb/xgbgen
parentdaad54a5e114dcff9ef62abbbd18ea52929d01e5 (diff)
downloadhaven-13d598e5e7f26bc6177ae3f7d52f4f19729ab2f3.tar.gz
haven-13d598e5e7f26bc6177ae3f7d52f4f19729ab2f3.tar.xz
haven-13d598e5e7f26bc6177ae3f7d52f4f19729ab2f3.zip
more clean up. use log instead of fmt.Print to stderr. bug fix for event blocking (a hack fix for now).
Diffstat (limited to 'nexgb/xgbgen')
-rw-r--r--nexgb/xgbgen/context.go7
-rw-r--r--nexgb/xgbgen/go_error.go14
2 files changed, 18 insertions, 3 deletions
diff --git a/nexgb/xgbgen/context.go b/nexgb/xgbgen/context.go
index f1762d3..a7a1d1d 100644
--- a/nexgb/xgbgen/context.go
+++ b/nexgb/xgbgen/context.go
@@ -86,7 +86,7 @@ func (c *Context) Morph(xmlBytes []byte) {
c.Putln("case err != nil:")
c.Putln("return err")
c.Putln("case !reply.Present:")
- c.Putln("return newError(\"No extension named %s could be found on "+
+ c.Putln("return errorf(\"No extension named %s could be found on "+
"on the server.\")", xname)
c.Putln("}")
c.Putln("")
@@ -95,6 +95,9 @@ func (c *Context) Morph(xmlBytes []byte) {
c.Putln("for evNum, fun := range newExtEventFuncs[\"%s\"] {", xname)
c.Putln("newEventFuncs[int(reply.FirstEvent) + evNum] = fun")
c.Putln("}")
+ c.Putln("for errNum, fun := range newExtErrorFuncs[\"%s\"] {", xname)
+ c.Putln("newErrorFuncs[int(reply.FirstError) + errNum] = fun")
+ c.Putln("}")
c.Putln("c.extLock.Unlock()")
c.Putln("")
c.Putln("return nil")
@@ -102,8 +105,10 @@ func (c *Context) Morph(xmlBytes []byte) {
c.Putln("")
// Make sure newExtEventFuncs["EXT_NAME"] map is initialized.
+ // Same deal for newExtErrorFuncs["EXT_NAME"]
c.Putln("func init() {")
c.Putln("newExtEventFuncs[\"%s\"] = make(map[int]newEventFun)", xname)
+ c.Putln("newExtErrorFuncs[\"%s\"] = make(map[int]newErrorFun)", xname)
c.Putln("}")
c.Putln("")
}
diff --git a/nexgb/xgbgen/go_error.go b/nexgb/xgbgen/go_error.go
index 9e01042..c96866c 100644
--- a/nexgb/xgbgen/go_error.go
+++ b/nexgb/xgbgen/go_error.go
@@ -29,7 +29,12 @@ func (e *Error) Define(c *Context) {
// Let's the XGB event loop read this error.
c.Putln("func init() {")
- c.Putln("newErrorFuncs[%d] = New%s", e.Number, e.ErrType())
+ if c.protocol.isExt() {
+ c.Putln("newExtErrorFuncs[\"%s\"][%d] = New%s",
+ c.protocol.ExtXName, e.Number, e.ErrType())
+ } else {
+ c.Putln("newErrorFuncs[%d] = New%s", e.Number, e.ErrType())
+ }
c.Putln("}")
c.Putln("")
}
@@ -95,7 +100,12 @@ func (e *ErrorCopy) Define(c *Context) {
// Let's the XGB know how to read this error.
c.Putln("func init() {")
- c.Putln("newErrorFuncs[%d] = New%s", e.Number, e.ErrType())
+ if c.protocol.isExt() {
+ c.Putln("newExtErrorFuncs[\"%s\"][%d] = New%s",
+ c.protocol.ExtXName, e.Number, e.ErrType())
+ } else {
+ c.Putln("newErrorFuncs[%d] = New%s", e.Number, e.ErrType())
+ }
c.Putln("}")
c.Putln("")
}