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/xf86dri/xf86dri.go | 78 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 3 deletions(-) (limited to 'nexgb/xf86dri') diff --git a/nexgb/xf86dri/xf86dri.go b/nexgb/xf86dri/xf86dri.go index 1d7dd72..f0224a5 100644 --- a/nexgb/xf86dri/xf86dri.go +++ b/nexgb/xf86dri/xf86dri.go @@ -2,7 +2,7 @@ package xf86dri /* - This file was generated by xf86dri.xml on May 11 2012 1:58:36am EDT. + This file was generated by xf86dri.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,8 +40,6 @@ func init() { xgb.NewExtErrorFuncs["XFree86-DRI"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Bool' - // Skipping definition for base type 'Float' // Skipping definition for base type 'Card8' @@ -64,6 +62,8 @@ func init() { // Skipping definition for base type 'Double' +// Skipping definition for base type 'Bool' + type DrmClipRect struct { X1 int16 Y1 int16 @@ -140,6 +140,9 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn) QueryVersionCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c), cookie) return QueryVersionCookie{cookie} @@ -148,6 +151,9 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c), cookie) return QueryVersionCookie{cookie} @@ -227,6 +233,9 @@ type QueryDirectRenderingCapableCookie struct { // QueryDirectRenderingCapable sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryDirectRenderingCapableCookie.Reply() func QueryDirectRenderingCapable(c *xgb.Conn, Screen uint32) QueryDirectRenderingCapableCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'QueryDirectRenderingCapable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryDirectRenderingCapableRequest(c, Screen), cookie) return QueryDirectRenderingCapableCookie{cookie} @@ -235,6 +244,9 @@ func QueryDirectRenderingCapable(c *xgb.Conn, Screen uint32) QueryDirectRenderin // QueryDirectRenderingCapableUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryDirectRenderingCapableUnchecked(c *xgb.Conn, Screen uint32) QueryDirectRenderingCapableCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'QueryDirectRenderingCapable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryDirectRenderingCapableRequest(c, Screen), cookie) return QueryDirectRenderingCapableCookie{cookie} @@ -313,6 +325,9 @@ type OpenConnectionCookie struct { // OpenConnection sends a checked request. // If an error occurs, it will be returned with the reply by calling OpenConnectionCookie.Reply() func OpenConnection(c *xgb.Conn, Screen uint32) OpenConnectionCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'OpenConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(openConnectionRequest(c, Screen), cookie) return OpenConnectionCookie{cookie} @@ -321,6 +336,9 @@ func OpenConnection(c *xgb.Conn, Screen uint32) OpenConnectionCookie { // OpenConnectionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func OpenConnectionUnchecked(c *xgb.Conn, Screen uint32) OpenConnectionCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'OpenConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(openConnectionRequest(c, Screen), cookie) return OpenConnectionCookie{cookie} @@ -414,6 +432,9 @@ type CloseConnectionCookie struct { // CloseConnection sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CloseConnection(c *xgb.Conn, Screen uint32) CloseConnectionCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'CloseConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(closeConnectionRequest(c, Screen), cookie) return CloseConnectionCookie{cookie} @@ -422,6 +443,9 @@ func CloseConnection(c *xgb.Conn, Screen uint32) CloseConnectionCookie { // CloseConnectionChecked sends a checked request. // If an error occurs, it can be retrieved using CloseConnectionCookie.Check() func CloseConnectionChecked(c *xgb.Conn, Screen uint32) CloseConnectionCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'CloseConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(closeConnectionRequest(c, Screen), cookie) return CloseConnectionCookie{cookie} @@ -463,6 +487,9 @@ type GetClientDriverNameCookie struct { // GetClientDriverName sends a checked request. // If an error occurs, it will be returned with the reply by calling GetClientDriverNameCookie.Reply() func GetClientDriverName(c *xgb.Conn, Screen uint32) GetClientDriverNameCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'GetClientDriverName' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getClientDriverNameRequest(c, Screen), cookie) return GetClientDriverNameCookie{cookie} @@ -471,6 +498,9 @@ func GetClientDriverName(c *xgb.Conn, Screen uint32) GetClientDriverNameCookie { // GetClientDriverNameUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetClientDriverNameUnchecked(c *xgb.Conn, Screen uint32) GetClientDriverNameCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'GetClientDriverName' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getClientDriverNameRequest(c, Screen), cookie) return GetClientDriverNameCookie{cookie} @@ -568,6 +598,9 @@ type CreateContextCookie struct { // CreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateContextCookie.Reply() func CreateContext(c *xgb.Conn, Screen uint32, Visual uint32, Context uint32) CreateContextCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(createContextRequest(c, Screen, Visual, Context), cookie) return CreateContextCookie{cookie} @@ -576,6 +609,9 @@ func CreateContext(c *xgb.Conn, Screen uint32, Visual uint32, Context uint32) Cr // CreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContextUnchecked(c *xgb.Conn, Screen uint32, Visual uint32, Context uint32) CreateContextCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(createContextRequest(c, Screen, Visual, Context), cookie) return CreateContextCookie{cookie} @@ -656,6 +692,9 @@ type DestroyContextCookie struct { // DestroyContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyContext(c *xgb.Conn, Screen uint32, Context uint32) DestroyContextCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(destroyContextRequest(c, Screen, Context), cookie) return DestroyContextCookie{cookie} @@ -664,6 +703,9 @@ func DestroyContext(c *xgb.Conn, Screen uint32, Context uint32) DestroyContextCo // DestroyContextChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyContextCookie.Check() func DestroyContextChecked(c *xgb.Conn, Screen uint32, Context uint32) DestroyContextCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(destroyContextRequest(c, Screen, Context), cookie) return DestroyContextCookie{cookie} @@ -708,6 +750,9 @@ type CreateDrawableCookie struct { // CreateDrawable sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateDrawableCookie.Reply() func CreateDrawable(c *xgb.Conn, Screen uint32, Drawable uint32) CreateDrawableCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'CreateDrawable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(createDrawableRequest(c, Screen, Drawable), cookie) return CreateDrawableCookie{cookie} @@ -716,6 +761,9 @@ func CreateDrawable(c *xgb.Conn, Screen uint32, Drawable uint32) CreateDrawableC // CreateDrawableUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateDrawableUnchecked(c *xgb.Conn, Screen uint32, Drawable uint32) CreateDrawableCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'CreateDrawable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(createDrawableRequest(c, Screen, Drawable), cookie) return CreateDrawableCookie{cookie} @@ -793,6 +841,9 @@ type DestroyDrawableCookie struct { // DestroyDrawable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyDrawable(c *xgb.Conn, Screen uint32, Drawable uint32) DestroyDrawableCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'DestroyDrawable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(destroyDrawableRequest(c, Screen, Drawable), cookie) return DestroyDrawableCookie{cookie} @@ -801,6 +852,9 @@ func DestroyDrawable(c *xgb.Conn, Screen uint32, Drawable uint32) DestroyDrawabl // DestroyDrawableChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyDrawableCookie.Check() func DestroyDrawableChecked(c *xgb.Conn, Screen uint32, Drawable uint32) DestroyDrawableCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'DestroyDrawable' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(destroyDrawableRequest(c, Screen, Drawable), cookie) return DestroyDrawableCookie{cookie} @@ -845,6 +899,9 @@ type GetDrawableInfoCookie struct { // GetDrawableInfo sends a checked request. // If an error occurs, it will be returned with the reply by calling GetDrawableInfoCookie.Reply() func GetDrawableInfo(c *xgb.Conn, Screen uint32, Drawable uint32) GetDrawableInfoCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'GetDrawableInfo' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getDrawableInfoRequest(c, Screen, Drawable), cookie) return GetDrawableInfoCookie{cookie} @@ -853,6 +910,9 @@ func GetDrawableInfo(c *xgb.Conn, Screen uint32, Drawable uint32) GetDrawableInf // GetDrawableInfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDrawableInfoUnchecked(c *xgb.Conn, Screen uint32, Drawable uint32) GetDrawableInfoCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'GetDrawableInfo' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getDrawableInfoRequest(c, Screen, Drawable), cookie) return GetDrawableInfoCookie{cookie} @@ -974,6 +1034,9 @@ type GetDeviceInfoCookie struct { // GetDeviceInfo sends a checked request. // If an error occurs, it will be returned with the reply by calling GetDeviceInfoCookie.Reply() func GetDeviceInfo(c *xgb.Conn, Screen uint32) GetDeviceInfoCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'GetDeviceInfo' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getDeviceInfoRequest(c, Screen), cookie) return GetDeviceInfoCookie{cookie} @@ -982,6 +1045,9 @@ func GetDeviceInfo(c *xgb.Conn, Screen uint32) GetDeviceInfoCookie { // GetDeviceInfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetDeviceInfoUnchecked(c *xgb.Conn, Screen uint32) GetDeviceInfoCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'GetDeviceInfo' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getDeviceInfoRequest(c, Screen), cookie) return GetDeviceInfoCookie{cookie} @@ -1084,6 +1150,9 @@ type AuthConnectionCookie struct { // AuthConnection sends a checked request. // If an error occurs, it will be returned with the reply by calling AuthConnectionCookie.Reply() func AuthConnection(c *xgb.Conn, Screen uint32, Magic uint32) AuthConnectionCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'AuthConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(authConnectionRequest(c, Screen, Magic), cookie) return AuthConnectionCookie{cookie} @@ -1092,6 +1161,9 @@ func AuthConnection(c *xgb.Conn, Screen uint32, Magic uint32) AuthConnectionCook // AuthConnectionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AuthConnectionUnchecked(c *xgb.Conn, Screen uint32, Magic uint32) AuthConnectionCookie { + if _, ok := c.Extensions["XFREE86-DRI"]; !ok { + panic("Cannot issue request 'AuthConnection' using the uninitialized extension 'XFree86-DRI'. xf86dri.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(authConnectionRequest(c, Screen, Magic), cookie) return AuthConnectionCookie{cookie} -- cgit v1.2.3