haven/nexgb/auto_bigreq.go

141 lines
3.1 KiB
Go

package xgb
/*
This file was generated by bigreq.xml on May 8 2012 11:03:23pm EDT.
This file is automatically generated. Edit at your peril!
*/
// BigreqInit must be called before using the BIG-REQUESTS extension.
func (c *Conn) BigreqInit() error {
reply, err := c.QueryExtension(12, "BIG-REQUESTS").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return errorf("No extension named BIG-REQUESTS could be found on on the server.")
}
c.extLock.Lock()
c.extensions["BIG-REQUESTS"] = reply.MajorOpcode
for evNum, fun := range newExtEventFuncs["BIG-REQUESTS"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
for errNum, fun := range newExtErrorFuncs["BIG-REQUESTS"] {
newErrorFuncs[int(reply.FirstError)+errNum] = fun
}
c.extLock.Unlock()
return nil
}
func init() {
newExtEventFuncs["BIG-REQUESTS"] = make(map[int]newEventFun)
newExtErrorFuncs["BIG-REQUESTS"] = make(map[int]newErrorFun)
}
// Skipping definition for base type 'Bool'
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Id'
// 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'
// Skipping definition for base type 'Char'
// Skipping definition for base type 'Card32'
// Skipping definition for base type 'Double'
// Request BigreqEnable
// size: 4
type BigreqEnableCookie struct {
*cookie
}
func (c *Conn) BigreqEnable() BigreqEnableCookie {
cookie := c.newCookie(true, true)
c.newRequest(c.bigreqEnableRequest(), cookie)
return BigreqEnableCookie{cookie}
}
func (c *Conn) BigreqEnableUnchecked() BigreqEnableCookie {
cookie := c.newCookie(false, true)
c.newRequest(c.bigreqEnableRequest(), cookie)
return BigreqEnableCookie{cookie}
}
// Request reply for BigreqEnable
// size: 12
type BigreqEnableReply struct {
Sequence uint16
Length uint32
// padding: 1 bytes
MaximumRequestLength uint32
}
// Waits and reads reply data from request BigreqEnable
func (cook BigreqEnableCookie) Reply() (*BigreqEnableReply, error) {
buf, err := cook.reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return bigreqEnableReply(buf), nil
}
// Read reply into structure from buffer for BigreqEnable
func bigreqEnableReply(buf []byte) *BigreqEnableReply {
v := new(BigreqEnableReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = Get16(buf[b:])
b += 2
v.Length = Get32(buf[b:]) // 4-byte units
b += 4
v.MaximumRequestLength = Get32(buf[b:])
b += 4
return v
}
func (cook BigreqEnableCookie) Check() error {
return cook.check()
}
// Write request to wire for BigreqEnable
func (c *Conn) bigreqEnableRequest() []byte {
size := 4
b := 0
buf := make([]byte, size)
buf[b] = c.extensions["BIG-REQUESTS"]
b += 1
buf[b] = 0 // request opcode
b += 1
Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
return buf
}