diff options
author | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-11 23:58:52 -0400 |
---|---|---|
committer | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-11 23:58:52 -0400 |
commit | 29942bf078c92fea681e42ca5029592526f00718 (patch) | |
tree | cee802ebe16e0b118c9be0f6265e26d31e8a5845 /nexgb/dpms/dpms.go | |
parent | fb3128ed2a83a0f644661cedebbe5bfda3f4951e (diff) | |
download | haven-29942bf078c92fea681e42ca5029592526f00718.tar.gz haven-29942bf078c92fea681e42ca5029592526f00718.tar.xz haven-29942bf078c92fea681e42ca5029592526f00718.zip |
panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people.
Diffstat (limited to 'nexgb/dpms/dpms.go')
-rw-r--r-- | nexgb/dpms/dpms.go | 66 |
1 files changed, 57 insertions, 9 deletions
diff --git a/nexgb/dpms/dpms.go b/nexgb/dpms/dpms.go index 8ffb2ee..d1142ce 100644 --- a/nexgb/dpms/dpms.go +++ b/nexgb/dpms/dpms.go @@ -2,7 +2,7 @@ package dpms /* - This file was generated by dpms.xml on May 11 2012 1:58:35am EDT. + This file was generated by dpms.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,14 +40,6 @@ func init() { xgb.NewExtErrorFuncs["DPMS"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Int8' - -// Skipping definition for base type 'Card16' - -// Skipping definition for base type 'Char' - -// Skipping definition for base type 'Card32' - // Skipping definition for base type 'Double' // Skipping definition for base type 'Bool' @@ -64,6 +56,14 @@ func init() { // Skipping definition for base type 'Byte' +// Skipping definition for base type 'Int8' + +// Skipping definition for base type 'Card16' + +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + const ( DPMSModeOn = 0 DPMSModeStandby = 1 @@ -79,6 +79,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["DPMS"]; !ok { + panic("Cannot issue request 'GetVersion' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return GetVersionCookie{cookie} @@ -87,6 +90,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["DPMS"]; !ok { + panic("Cannot issue request 'GetVersion' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie) return GetVersionCookie{cookie} @@ -168,6 +174,9 @@ type CapableCookie struct { // Capable sends a checked request. // If an error occurs, it will be returned with the reply by calling CapableCookie.Reply() func Capable(c *xgb.Conn) CapableCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'Capable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(capableRequest(c), cookie) return CapableCookie{cookie} @@ -176,6 +185,9 @@ func Capable(c *xgb.Conn) CapableCookie { // CapableUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CapableUnchecked(c *xgb.Conn) CapableCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'Capable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(capableRequest(c), cookie) return CapableCookie{cookie} @@ -254,6 +266,9 @@ type GetTimeoutsCookie struct { // GetTimeouts sends a checked request. // If an error occurs, it will be returned with the reply by calling GetTimeoutsCookie.Reply() func GetTimeouts(c *xgb.Conn) GetTimeoutsCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'GetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getTimeoutsRequest(c), cookie) return GetTimeoutsCookie{cookie} @@ -262,6 +277,9 @@ func GetTimeouts(c *xgb.Conn) GetTimeoutsCookie { // GetTimeoutsUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetTimeoutsUnchecked(c *xgb.Conn) GetTimeoutsCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'GetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getTimeoutsRequest(c), cookie) return GetTimeoutsCookie{cookie} @@ -344,6 +362,9 @@ type SetTimeoutsCookie struct { // SetTimeouts sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SetTimeouts(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) SetTimeoutsCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'SetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(setTimeoutsRequest(c, StandbyTimeout, SuspendTimeout, OffTimeout), cookie) return SetTimeoutsCookie{cookie} @@ -352,6 +373,9 @@ func SetTimeouts(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffT // SetTimeoutsChecked sends a checked request. // If an error occurs, it can be retrieved using SetTimeoutsCookie.Check() func SetTimeoutsChecked(c *xgb.Conn, StandbyTimeout uint16, SuspendTimeout uint16, OffTimeout uint16) SetTimeoutsCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'SetTimeouts' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(setTimeoutsRequest(c, StandbyTimeout, SuspendTimeout, OffTimeout), cookie) return SetTimeoutsCookie{cookie} @@ -399,6 +423,9 @@ type EnableCookie struct { // Enable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Enable(c *xgb.Conn) EnableCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'Enable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(enableRequest(c), cookie) return EnableCookie{cookie} @@ -407,6 +434,9 @@ func Enable(c *xgb.Conn) EnableCookie { // EnableChecked sends a checked request. // If an error occurs, it can be retrieved using EnableCookie.Check() func EnableChecked(c *xgb.Conn) EnableCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'Enable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(enableRequest(c), cookie) return EnableCookie{cookie} @@ -445,6 +475,9 @@ type DisableCookie struct { // Disable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func Disable(c *xgb.Conn) DisableCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'Disable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(disableRequest(c), cookie) return DisableCookie{cookie} @@ -453,6 +486,9 @@ func Disable(c *xgb.Conn) DisableCookie { // DisableChecked sends a checked request. // If an error occurs, it can be retrieved using DisableCookie.Check() func DisableChecked(c *xgb.Conn) DisableCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'Disable' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(disableRequest(c), cookie) return DisableCookie{cookie} @@ -491,6 +527,9 @@ type ForceLevelCookie struct { // ForceLevel sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ForceLevel(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'ForceLevel' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(forceLevelRequest(c, PowerLevel), cookie) return ForceLevelCookie{cookie} @@ -499,6 +538,9 @@ func ForceLevel(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie { // ForceLevelChecked sends a checked request. // If an error occurs, it can be retrieved using ForceLevelCookie.Check() func ForceLevelChecked(c *xgb.Conn, PowerLevel uint16) ForceLevelCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'ForceLevel' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(forceLevelRequest(c, PowerLevel), cookie) return ForceLevelCookie{cookie} @@ -540,6 +582,9 @@ type InfoCookie struct { // Info sends a checked request. // If an error occurs, it will be returned with the reply by calling InfoCookie.Reply() func Info(c *xgb.Conn) InfoCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'Info' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(infoRequest(c), cookie) return InfoCookie{cookie} @@ -548,6 +593,9 @@ func Info(c *xgb.Conn) InfoCookie { // InfoUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func InfoUnchecked(c *xgb.Conn) InfoCookie { + if _, ok := c.Extensions["DPMS"]; !ok { + panic("Cannot issue request 'Info' using the uninitialized extension 'DPMS'. dpms.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(infoRequest(c), cookie) return InfoCookie{cookie} |