From 29942bf078c92fea681e42ca5029592526f00718 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 23:58:52 -0400 Subject: panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people. --- nexgb/xcmisc/xcmisc.go | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'nexgb/xcmisc') diff --git a/nexgb/xcmisc/xcmisc.go b/nexgb/xcmisc/xcmisc.go index 7171969..0a4b4ce 100644 --- a/nexgb/xcmisc/xcmisc.go +++ b/nexgb/xcmisc/xcmisc.go @@ -2,7 +2,7 @@ package xcmisc /* - This file was generated by xc_misc.xml on May 11 2012 1:58:36am EDT. + This file was generated by xc_misc.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,18 +40,6 @@ func init() { xgb.NewExtErrorFuncs["XC-MISC"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Float' - -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - -// Skipping definition for base type 'Int32' - -// Skipping definition for base type 'Void' - -// Skipping definition for base type 'Byte' - // Skipping definition for base type 'Int8' // Skipping definition for base type 'Card16' @@ -64,6 +52,18 @@ func init() { // Skipping definition for base type 'Bool' +// Skipping definition for base type 'Float' + +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + // GetVersionCookie is a cookie used only for GetVersion requests. type GetVersionCookie struct { *xgb.Cookie @@ -72,6 +72,9 @@ type GetVersionCookie struct { // GetVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling GetVersionCookie.Reply() func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie { + if _, ok := c.Extensions["XC-MISC"]; !ok { + panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return GetVersionCookie{cookie} @@ -80,6 +83,9 @@ func GetVersion(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint1 // GetVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint16, ClientMinorVersion uint16) GetVersionCookie { + if _, ok := c.Extensions["XC-MISC"]; !ok { + panic("Cannot issue request 'GetVersion' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return GetVersionCookie{cookie} @@ -161,6 +167,9 @@ type GetXIDRangeCookie struct { // GetXIDRange sends a checked request. // If an error occurs, it will be returned with the reply by calling GetXIDRangeCookie.Reply() func GetXIDRange(c *xgb.Conn) GetXIDRangeCookie { + if _, ok := c.Extensions["XC-MISC"]; !ok { + panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getXIDRangeRequest(c), cookie) return GetXIDRangeCookie{cookie} @@ -169,6 +178,9 @@ func GetXIDRange(c *xgb.Conn) GetXIDRangeCookie { // GetXIDRangeUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetXIDRangeUnchecked(c *xgb.Conn) GetXIDRangeCookie { + if _, ok := c.Extensions["XC-MISC"]; !ok { + panic("Cannot issue request 'GetXIDRange' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getXIDRangeRequest(c), cookie) return GetXIDRangeCookie{cookie} @@ -244,6 +256,9 @@ type GetXIDListCookie struct { // GetXIDList sends a checked request. // If an error occurs, it will be returned with the reply by calling GetXIDListCookie.Reply() func GetXIDList(c *xgb.Conn, Count uint32) GetXIDListCookie { + if _, ok := c.Extensions["XC-MISC"]; !ok { + panic("Cannot issue request 'GetXIDList' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getXIDListRequest(c, Count), cookie) return GetXIDListCookie{cookie} @@ -252,6 +267,9 @@ func GetXIDList(c *xgb.Conn, Count uint32) GetXIDListCookie { // GetXIDListUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetXIDListUnchecked(c *xgb.Conn, Count uint32) GetXIDListCookie { + if _, ok := c.Extensions["XC-MISC"]; !ok { + panic("Cannot issue request 'GetXIDList' using the uninitialized extension 'XC-MISC'. xcmisc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getXIDListRequest(c, Count), cookie) return GetXIDListCookie{cookie} -- cgit v1.2.3-70-g09d2