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/record/record.go | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'nexgb/record') diff --git a/nexgb/record/record.go b/nexgb/record/record.go index 5623e50..a9ae7ea 100644 --- a/nexgb/record/record.go +++ b/nexgb/record/record.go @@ -2,7 +2,7 @@ package record /* - This file was generated by record.xml on May 11 2012 1:58:36am EDT. + This file was generated by record.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -526,6 +526,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, MajorVersion uint16, MinorVersion uint16) QueryVersionCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie) return QueryVersionCookie{cookie} @@ -534,6 +537,9 @@ func QueryVersion(c *xgb.Conn, MajorVersion uint16, MinorVersion uint16) QueryVe // 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, MajorVersion uint16, MinorVersion uint16) QueryVersionCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie) return QueryVersionCookie{cookie} @@ -615,6 +621,9 @@ type CreateContextCookie struct { // CreateContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContext(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) CreateContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createContextRequest(c, Context, ElementHeader, NumClientSpecs, NumRanges, ClientSpecs, Ranges), cookie) return CreateContextCookie{cookie} @@ -623,6 +632,9 @@ func CreateContext(c *xgb.Conn, Context Context, ElementHeader ElementHeader, Nu // CreateContextChecked sends a checked request. // If an error occurs, it can be retrieved using CreateContextCookie.Check() func CreateContextChecked(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) CreateContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createContextRequest(c, Context, ElementHeader, NumClientSpecs, NumRanges, ClientSpecs, Ranges), cookie) return CreateContextCookie{cookie} @@ -683,6 +695,9 @@ type RegisterClientsCookie struct { // RegisterClients sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func RegisterClients(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) RegisterClientsCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'RegisterClients' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(registerClientsRequest(c, Context, ElementHeader, NumClientSpecs, NumRanges, ClientSpecs, Ranges), cookie) return RegisterClientsCookie{cookie} @@ -691,6 +706,9 @@ func RegisterClients(c *xgb.Conn, Context Context, ElementHeader ElementHeader, // RegisterClientsChecked sends a checked request. // If an error occurs, it can be retrieved using RegisterClientsCookie.Check() func RegisterClientsChecked(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) RegisterClientsCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'RegisterClients' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(registerClientsRequest(c, Context, ElementHeader, NumClientSpecs, NumRanges, ClientSpecs, Ranges), cookie) return RegisterClientsCookie{cookie} @@ -751,6 +769,9 @@ type UnregisterClientsCookie struct { // UnregisterClients sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func UnregisterClients(c *xgb.Conn, Context Context, NumClientSpecs uint32, ClientSpecs []ClientSpec) UnregisterClientsCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'UnregisterClients' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(unregisterClientsRequest(c, Context, NumClientSpecs, ClientSpecs), cookie) return UnregisterClientsCookie{cookie} @@ -759,6 +780,9 @@ func UnregisterClients(c *xgb.Conn, Context Context, NumClientSpecs uint32, Clie // UnregisterClientsChecked sends a checked request. // If an error occurs, it can be retrieved using UnregisterClientsCookie.Check() func UnregisterClientsChecked(c *xgb.Conn, Context Context, NumClientSpecs uint32, ClientSpecs []ClientSpec) UnregisterClientsCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'UnregisterClients' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(unregisterClientsRequest(c, Context, NumClientSpecs, ClientSpecs), cookie) return UnregisterClientsCookie{cookie} @@ -809,6 +833,9 @@ type GetContextCookie struct { // GetContext sends a checked request. // If an error occurs, it will be returned with the reply by calling GetContextCookie.Reply() func GetContext(c *xgb.Conn, Context Context) GetContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'GetContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getContextRequest(c, Context), cookie) return GetContextCookie{cookie} @@ -817,6 +844,9 @@ func GetContext(c *xgb.Conn, Context Context) GetContextCookie { // GetContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetContextUnchecked(c *xgb.Conn, Context Context) GetContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'GetContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getContextRequest(c, Context), cookie) return GetContextCookie{cookie} @@ -910,6 +940,9 @@ type EnableContextCookie struct { // EnableContext sends a checked request. // If an error occurs, it will be returned with the reply by calling EnableContextCookie.Reply() func EnableContext(c *xgb.Conn, Context Context) EnableContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'EnableContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(enableContextRequest(c, Context), cookie) return EnableContextCookie{cookie} @@ -918,6 +951,9 @@ func EnableContext(c *xgb.Conn, Context Context) EnableContextCookie { // EnableContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func EnableContextUnchecked(c *xgb.Conn, Context Context) EnableContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'EnableContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(enableContextRequest(c, Context), cookie) return EnableContextCookie{cookie} @@ -1024,6 +1060,9 @@ type DisableContextCookie struct { // DisableContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DisableContext(c *xgb.Conn, Context Context) DisableContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'DisableContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(disableContextRequest(c, Context), cookie) return DisableContextCookie{cookie} @@ -1032,6 +1071,9 @@ func DisableContext(c *xgb.Conn, Context Context) DisableContextCookie { // DisableContextChecked sends a checked request. // If an error occurs, it can be retrieved using DisableContextCookie.Check() func DisableContextChecked(c *xgb.Conn, Context Context) DisableContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'DisableContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(disableContextRequest(c, Context), cookie) return DisableContextCookie{cookie} @@ -1073,6 +1115,9 @@ type FreeContextCookie struct { // FreeContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func FreeContext(c *xgb.Conn, Context Context) FreeContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'FreeContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(freeContextRequest(c, Context), cookie) return FreeContextCookie{cookie} @@ -1081,6 +1126,9 @@ func FreeContext(c *xgb.Conn, Context Context) FreeContextCookie { // FreeContextChecked sends a checked request. // If an error occurs, it can be retrieved using FreeContextCookie.Check() func FreeContextChecked(c *xgb.Conn, Context Context) FreeContextCookie { + if _, ok := c.Extensions["RECORD"]; !ok { + panic("Cannot issue request 'FreeContext' using the uninitialized extension 'RECORD'. record.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(freeContextRequest(c, Context), cookie) return FreeContextCookie{cookie} -- cgit v1.2.3-70-g09d2