diff options
Diffstat (limited to 'nexgb/auto_xprint.go')
-rw-r--r-- | nexgb/auto_xprint.go | 2176 |
1 files changed, 2176 insertions, 0 deletions
diff --git a/nexgb/auto_xprint.go b/nexgb/auto_xprint.go new file mode 100644 index 0000000..6790a86 --- /dev/null +++ b/nexgb/auto_xprint.go @@ -0,0 +1,2176 @@ +package xgb + +/* + This file was generated by xprint.xml on May 6 2012 3:00:45am EDT. + This file is automatically generated. Edit at your peril! +*/ + +// Imports are not necessary for XGB because everything is +// in one package. They are still listed here for reference. +// import "xproto" + +// 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' + +// 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' + +const ( + XprintGetDocFinished = 0 + XprintGetDocSecondConsumer = 1 +) + +const ( + XprintEvMaskNoEventMask = 0 + XprintEvMaskPrintMask = 1 + XprintEvMaskAttributeMask = 2 +) + +const ( + XprintDetailStartJobNotify = 1 + XprintDetailEndJobNotify = 2 + XprintDetailStartDocNotify = 3 + XprintDetailEndDocNotify = 4 + XprintDetailStartPageNotify = 5 + XprintDetailEndPageNotify = 6 +) + +const ( + XprintAttrJobAttr = 1 + XprintAttrDocAttr = 2 + XprintAttrPageAttr = 3 + XprintAttrPrinterAttr = 4 + XprintAttrServerAttr = 5 + XprintAttrMediumAttr = 6 + XprintAttrSpoolerAttr = 7 +) + +// Skipping resource definition of 'Pcontext' + +type XprintString8 byte + +// 'XprintPrinter' struct definition +// Size: (((4 + pad((int(NameLen) * 1))) + 4) + pad((int(DescLen) * 1))) +type XprintPrinter struct { + NameLen uint32 + Name []XprintString8 // size: pad((int(NameLen) * 1)) + DescLen uint32 + Description []XprintString8 // size: pad((int(DescLen) * 1)) +} + +// Struct read XprintPrinter +func ReadXprintPrinter(buf []byte, v *XprintPrinter) int { + b := 0 + + v.NameLen = Get32(buf[b:]) + b += 4 + + v.Name = make([]XprintString8, v.NameLen) + for i := 0; i < int(v.NameLen); i++ { + v.Name[i] = XprintString8(buf[b]) + b += 1 + } + b = pad(b) + + v.DescLen = Get32(buf[b:]) + b += 4 + + v.Description = make([]XprintString8, v.DescLen) + for i := 0; i < int(v.DescLen); i++ { + v.Description[i] = XprintString8(buf[b]) + b += 1 + } + b = pad(b) + + return b +} + +// Struct list read XprintPrinter +func ReadXprintPrinterList(buf []byte, dest []XprintPrinter) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = XprintPrinter{} + b += ReadXprintPrinter(buf[b:], &dest[i]) + } + return pad(b) +} + +// Struct write XprintPrinter +func (v XprintPrinter) Bytes() []byte { + buf := make([]byte, (((4 + pad((int(v.NameLen) * 1))) + 4) + pad((int(v.DescLen) * 1)))) + b := 0 + + Put32(buf[b:], v.NameLen) + b += 4 + + for i := 0; i < int(v.NameLen); i++ { + buf[b] = byte(v.Name[i]) + b += 1 + } + b = pad(b) + + Put32(buf[b:], v.DescLen) + b += 4 + + for i := 0; i < int(v.DescLen); i++ { + buf[b] = byte(v.Description[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Write struct list XprintPrinter +func XprintPrinterListBytes(buf []byte, list []XprintPrinter) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += pad(len(structBytes)) + } + return b +} + +// Struct list size XprintPrinter +func XprintPrinterListSize(list []XprintPrinter) int { + size := 0 + for _, item := range list { + size += (((4 + pad((int(item.NameLen) * 1))) + 4) + pad((int(item.DescLen) * 1))) + } + return size +} + +// Event definition XprintNotify (0) +// Size: 32 + +const XprintNotify = 0 + +type XprintNotifyEvent struct { + Sequence uint16 + Detail byte + Context Id + Cancel bool +} + +// Event read XprintNotify +func NewXprintNotifyEvent(buf []byte) Event { + v := XprintNotifyEvent{} + b := 1 // don't read event number + + v.Detail = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Context = Id(Get32(buf[b:])) + b += 4 + + if buf[b] == 1 { + v.Cancel = true + } else { + v.Cancel = false + } + b += 1 + + return v +} + +// Event write XprintNotify +func (v XprintNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 0 + b += 1 + + buf[b] = v.Detail + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Context)) + b += 4 + + if v.Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +func (v XprintNotifyEvent) ImplementsEvent() {} + +func (v XprintNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XprintNotifyEvent) String() string { + fieldVals := make([]string, 0, 3) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Context: %d", v.Context)) + fieldVals = append(fieldVals, sprintf("Cancel: %t", v.Cancel)) + return "XprintNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[0] = NewXprintNotifyEvent +} + +// Event definition XprintAttributNotify (1) +// Size: 32 + +const XprintAttributNotify = 1 + +type XprintAttributNotifyEvent struct { + Sequence uint16 + Detail byte + Context Id +} + +// Event read XprintAttributNotify +func NewXprintAttributNotifyEvent(buf []byte) Event { + v := XprintAttributNotifyEvent{} + b := 1 // don't read event number + + v.Detail = buf[b] + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Context = Id(Get32(buf[b:])) + b += 4 + + return v +} + +// Event write XprintAttributNotify +func (v XprintAttributNotifyEvent) Bytes() []byte { + buf := make([]byte, 32) + b := 0 + + // write event number + buf[b] = 1 + b += 1 + + buf[b] = v.Detail + b += 1 + + b += 2 // skip sequence number + + Put32(buf[b:], uint32(v.Context)) + b += 4 + + return buf +} + +func (v XprintAttributNotifyEvent) ImplementsEvent() {} + +func (v XprintAttributNotifyEvent) SequenceId() uint16 { + return v.Sequence +} + +func (v XprintAttributNotifyEvent) String() string { + fieldVals := make([]string, 0, 2) + fieldVals = append(fieldVals, sprintf("Sequence: %d", v.Sequence)) + fieldVals = append(fieldVals, sprintf("Detail: %d", v.Detail)) + fieldVals = append(fieldVals, sprintf("Context: %d", v.Context)) + return "XprintAttributNotify {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newEventFuncs[1] = NewXprintAttributNotifyEvent +} + +// Error definition XprintBadContext (0) +// Size: 32 + +const BadXprintBadContext = 0 + +type XprintBadContextError struct { + Sequence uint16 + NiceName string +} + +// Error read XprintBadContext +func NewXprintBadContextError(buf []byte) Error { + v := XprintBadContextError{} + v.NiceName = "XprintBadContext" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XprintBadContextError) ImplementsError() {} + +func (err XprintBadContextError) SequenceId() uint16 { + return err.Sequence +} + +func (err XprintBadContextError) BadId() Id { + return 0 +} + +func (err XprintBadContextError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXprintBadContext {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[0] = NewXprintBadContextError +} + +// Error definition XprintBadSequence (1) +// Size: 32 + +const BadXprintBadSequence = 1 + +type XprintBadSequenceError struct { + Sequence uint16 + NiceName string +} + +// Error read XprintBadSequence +func NewXprintBadSequenceError(buf []byte) Error { + v := XprintBadSequenceError{} + v.NiceName = "XprintBadSequence" + + b := 1 // skip error determinant + b += 1 // don't read error number + + v.Sequence = Get16(buf[b:]) + b += 2 + + return v +} + +func (err XprintBadSequenceError) ImplementsError() {} + +func (err XprintBadSequenceError) SequenceId() uint16 { + return err.Sequence +} + +func (err XprintBadSequenceError) BadId() Id { + return 0 +} + +func (err XprintBadSequenceError) Error() string { + fieldVals := make([]string, 0, 0) + fieldVals = append(fieldVals, "NiceName: "+err.NiceName) + fieldVals = append(fieldVals, sprintf("Sequence: %d", err.Sequence)) + return "BadXprintBadSequence {" + stringsJoin(fieldVals, ", ") + "}" +} + +func init() { + newErrorFuncs[1] = NewXprintBadSequenceError +} + +// Request XprintPrintQueryVersion +// size: 4 +type XprintPrintQueryVersionCookie struct { + *cookie +} + +func (c *Conn) XprintPrintQueryVersion() XprintPrintQueryVersionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintQueryVersionRequest(), cookie) + return XprintPrintQueryVersionCookie{cookie} +} + +func (c *Conn) XprintPrintQueryVersionUnchecked() XprintPrintQueryVersionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintQueryVersionRequest(), cookie) + return XprintPrintQueryVersionCookie{cookie} +} + +// Request reply for XprintPrintQueryVersion +// size: 12 +type XprintPrintQueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + MajorVersion uint16 + MinorVersion uint16 +} + +// Waits and reads reply data from request XprintPrintQueryVersion +func (cook XprintPrintQueryVersionCookie) Reply() (*XprintPrintQueryVersionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintQueryVersionReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintQueryVersion +func xprintPrintQueryVersionReply(buf []byte) *XprintPrintQueryVersionReply { + v := new(XprintPrintQueryVersionReply) + 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.MajorVersion = Get16(buf[b:]) + b += 2 + + v.MinorVersion = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XprintPrintQueryVersionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintQueryVersion +func (c *Conn) xprintPrintQueryVersionRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + 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 +} + +// Request XprintPrintGetPrinterList +// size: pad(((12 + pad((int(PrinterNameLen) * 1))) + pad((int(LocaleLen) * 1)))) +type XprintPrintGetPrinterListCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetPrinterList(PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) XprintPrintGetPrinterListCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetPrinterListRequest(PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return XprintPrintGetPrinterListCookie{cookie} +} + +func (c *Conn) XprintPrintGetPrinterListUnchecked(PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) XprintPrintGetPrinterListCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetPrinterListRequest(PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return XprintPrintGetPrinterListCookie{cookie} +} + +// Request reply for XprintPrintGetPrinterList +// size: (32 + XprintPrinterListSize(Printers)) +type XprintPrintGetPrinterListReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ListCount uint32 + // padding: 20 bytes + Printers []XprintPrinter // size: XprintPrinterListSize(Printers) +} + +// Waits and reads reply data from request XprintPrintGetPrinterList +func (cook XprintPrintGetPrinterListCookie) Reply() (*XprintPrintGetPrinterListReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetPrinterListReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetPrinterList +func xprintPrintGetPrinterListReply(buf []byte) *XprintPrintGetPrinterListReply { + v := new(XprintPrintGetPrinterListReply) + 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.ListCount = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Printers = make([]XprintPrinter, v.ListCount) + b += ReadXprintPrinterList(buf[b:], v.Printers) + + return v +} + +func (cook XprintPrintGetPrinterListCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetPrinterList +func (c *Conn) xprintPrintGetPrinterListRequest(PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) []byte { + size := pad(((12 + pad((int(PrinterNameLen) * 1))) + pad((int(LocaleLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 1 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], PrinterNameLen) + b += 4 + + Put32(buf[b:], LocaleLen) + b += 4 + + for i := 0; i < int(PrinterNameLen); i++ { + buf[b] = byte(PrinterName[i]) + b += 1 + } + b = pad(b) + + for i := 0; i < int(LocaleLen); i++ { + buf[b] = byte(Locale[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintRehashPrinterList +// size: 4 +type XprintPrintRehashPrinterListCookie struct { + *cookie +} + +// Write request to wire for XprintPrintRehashPrinterList +func (c *Conn) XprintPrintRehashPrinterList() XprintPrintRehashPrinterListCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintRehashPrinterListRequest(), cookie) + return XprintPrintRehashPrinterListCookie{cookie} +} + +func (c *Conn) XprintPrintRehashPrinterListChecked() XprintPrintRehashPrinterListCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintRehashPrinterListRequest(), cookie) + return XprintPrintRehashPrinterListCookie{cookie} +} + +func (cook XprintPrintRehashPrinterListCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintRehashPrinterList +func (c *Conn) xprintPrintRehashPrinterListRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 20 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XprintCreateContext +// size: pad(((16 + pad((int(PrinterNameLen) * 1))) + pad((int(LocaleLen) * 1)))) +type XprintCreateContextCookie struct { + *cookie +} + +// Write request to wire for XprintCreateContext +func (c *Conn) XprintCreateContext(ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) XprintCreateContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintCreateContextRequest(ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return XprintCreateContextCookie{cookie} +} + +func (c *Conn) XprintCreateContextChecked(ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) XprintCreateContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintCreateContextRequest(ContextId, PrinterNameLen, LocaleLen, PrinterName, Locale), cookie) + return XprintCreateContextCookie{cookie} +} + +func (cook XprintCreateContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintCreateContext +func (c *Conn) xprintCreateContextRequest(ContextId uint32, PrinterNameLen uint32, LocaleLen uint32, PrinterName []XprintString8, Locale []XprintString8) []byte { + size := pad(((16 + pad((int(PrinterNameLen) * 1))) + pad((int(LocaleLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 2 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], ContextId) + b += 4 + + Put32(buf[b:], PrinterNameLen) + b += 4 + + Put32(buf[b:], LocaleLen) + b += 4 + + for i := 0; i < int(PrinterNameLen); i++ { + buf[b] = byte(PrinterName[i]) + b += 1 + } + b = pad(b) + + for i := 0; i < int(LocaleLen); i++ { + buf[b] = byte(Locale[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintSetContext +// size: 8 +type XprintPrintSetContextCookie struct { + *cookie +} + +// Write request to wire for XprintPrintSetContext +func (c *Conn) XprintPrintSetContext(Context uint32) XprintPrintSetContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintSetContextRequest(Context), cookie) + return XprintPrintSetContextCookie{cookie} +} + +func (c *Conn) XprintPrintSetContextChecked(Context uint32) XprintPrintSetContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintSetContextRequest(Context), cookie) + return XprintPrintSetContextCookie{cookie} +} + +func (cook XprintPrintSetContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintSetContext +func (c *Conn) xprintPrintSetContextRequest(Context uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 3 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Context) + b += 4 + + return buf +} + +// Request XprintPrintGetContext +// size: 4 +type XprintPrintGetContextCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetContext() XprintPrintGetContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetContextRequest(), cookie) + return XprintPrintGetContextCookie{cookie} +} + +func (c *Conn) XprintPrintGetContextUnchecked() XprintPrintGetContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetContextRequest(), cookie) + return XprintPrintGetContextCookie{cookie} +} + +// Request reply for XprintPrintGetContext +// size: 12 +type XprintPrintGetContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Context uint32 +} + +// Waits and reads reply data from request XprintPrintGetContext +func (cook XprintPrintGetContextCookie) Reply() (*XprintPrintGetContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetContextReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetContext +func xprintPrintGetContextReply(buf []byte) *XprintPrintGetContextReply { + v := new(XprintPrintGetContextReply) + 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.Context = Get32(buf[b:]) + b += 4 + + return v +} + +func (cook XprintPrintGetContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetContext +func (c *Conn) xprintPrintGetContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 4 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XprintPrintDestroyContext +// size: 8 +type XprintPrintDestroyContextCookie struct { + *cookie +} + +// Write request to wire for XprintPrintDestroyContext +func (c *Conn) XprintPrintDestroyContext(Context uint32) XprintPrintDestroyContextCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintDestroyContextRequest(Context), cookie) + return XprintPrintDestroyContextCookie{cookie} +} + +func (c *Conn) XprintPrintDestroyContextChecked(Context uint32) XprintPrintDestroyContextCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintDestroyContextRequest(Context), cookie) + return XprintPrintDestroyContextCookie{cookie} +} + +func (cook XprintPrintDestroyContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintDestroyContext +func (c *Conn) xprintPrintDestroyContextRequest(Context uint32) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 5 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], Context) + b += 4 + + return buf +} + +// Request XprintPrintGetScreenOfContext +// size: 4 +type XprintPrintGetScreenOfContextCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetScreenOfContext() XprintPrintGetScreenOfContextCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetScreenOfContextRequest(), cookie) + return XprintPrintGetScreenOfContextCookie{cookie} +} + +func (c *Conn) XprintPrintGetScreenOfContextUnchecked() XprintPrintGetScreenOfContextCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetScreenOfContextRequest(), cookie) + return XprintPrintGetScreenOfContextCookie{cookie} +} + +// Request reply for XprintPrintGetScreenOfContext +// size: 12 +type XprintPrintGetScreenOfContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Root Id +} + +// Waits and reads reply data from request XprintPrintGetScreenOfContext +func (cook XprintPrintGetScreenOfContextCookie) Reply() (*XprintPrintGetScreenOfContextReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetScreenOfContextReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetScreenOfContext +func xprintPrintGetScreenOfContextReply(buf []byte) *XprintPrintGetScreenOfContextReply { + v := new(XprintPrintGetScreenOfContextReply) + 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.Root = Id(Get32(buf[b:])) + b += 4 + + return v +} + +func (cook XprintPrintGetScreenOfContextCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetScreenOfContext +func (c *Conn) xprintPrintGetScreenOfContextRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 6 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XprintPrintStartJob +// size: 8 +type XprintPrintStartJobCookie struct { + *cookie +} + +// Write request to wire for XprintPrintStartJob +func (c *Conn) XprintPrintStartJob(OutputMode byte) XprintPrintStartJobCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintStartJobRequest(OutputMode), cookie) + return XprintPrintStartJobCookie{cookie} +} + +func (c *Conn) XprintPrintStartJobChecked(OutputMode byte) XprintPrintStartJobCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintStartJobRequest(OutputMode), cookie) + return XprintPrintStartJobCookie{cookie} +} + +func (cook XprintPrintStartJobCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintStartJob +func (c *Conn) xprintPrintStartJobRequest(OutputMode byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 7 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = OutputMode + b += 1 + + return buf +} + +// Request XprintPrintEndJob +// size: 8 +type XprintPrintEndJobCookie struct { + *cookie +} + +// Write request to wire for XprintPrintEndJob +func (c *Conn) XprintPrintEndJob(Cancel bool) XprintPrintEndJobCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintEndJobRequest(Cancel), cookie) + return XprintPrintEndJobCookie{cookie} +} + +func (c *Conn) XprintPrintEndJobChecked(Cancel bool) XprintPrintEndJobCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintEndJobRequest(Cancel), cookie) + return XprintPrintEndJobCookie{cookie} +} + +func (cook XprintPrintEndJobCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintEndJob +func (c *Conn) xprintPrintEndJobRequest(Cancel bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 8 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request XprintPrintStartDoc +// size: 8 +type XprintPrintStartDocCookie struct { + *cookie +} + +// Write request to wire for XprintPrintStartDoc +func (c *Conn) XprintPrintStartDoc(DriverMode byte) XprintPrintStartDocCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintStartDocRequest(DriverMode), cookie) + return XprintPrintStartDocCookie{cookie} +} + +func (c *Conn) XprintPrintStartDocChecked(DriverMode byte) XprintPrintStartDocCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintStartDocRequest(DriverMode), cookie) + return XprintPrintStartDocCookie{cookie} +} + +func (cook XprintPrintStartDocCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintStartDoc +func (c *Conn) xprintPrintStartDocRequest(DriverMode byte) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 9 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + buf[b] = DriverMode + b += 1 + + return buf +} + +// Request XprintPrintEndDoc +// size: 8 +type XprintPrintEndDocCookie struct { + *cookie +} + +// Write request to wire for XprintPrintEndDoc +func (c *Conn) XprintPrintEndDoc(Cancel bool) XprintPrintEndDocCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintEndDocRequest(Cancel), cookie) + return XprintPrintEndDocCookie{cookie} +} + +func (c *Conn) XprintPrintEndDocChecked(Cancel bool) XprintPrintEndDocCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintEndDocRequest(Cancel), cookie) + return XprintPrintEndDocCookie{cookie} +} + +func (cook XprintPrintEndDocCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintEndDoc +func (c *Conn) xprintPrintEndDocRequest(Cancel bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 10 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + return buf +} + +// Request XprintPrintPutDocumentData +// size: pad((((16 + pad((int(LenData) * 1))) + pad((len(DocFormat) * 1))) + pad((len(Options) * 1)))) +type XprintPrintPutDocumentDataCookie struct { + *cookie +} + +// Write request to wire for XprintPrintPutDocumentData +func (c *Conn) XprintPrintPutDocumentData(Drawable Id, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []XprintString8, Options []XprintString8) XprintPrintPutDocumentDataCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintPutDocumentDataRequest(Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) + return XprintPrintPutDocumentDataCookie{cookie} +} + +func (c *Conn) XprintPrintPutDocumentDataChecked(Drawable Id, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []XprintString8, Options []XprintString8) XprintPrintPutDocumentDataCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintPutDocumentDataRequest(Drawable, LenData, LenFmt, LenOptions, Data, DocFormat, Options), cookie) + return XprintPrintPutDocumentDataCookie{cookie} +} + +func (cook XprintPrintPutDocumentDataCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintPutDocumentData +func (c *Conn) xprintPrintPutDocumentDataRequest(Drawable Id, LenData uint32, LenFmt uint16, LenOptions uint16, Data []byte, DocFormat []XprintString8, Options []XprintString8) []byte { + size := pad((((16 + pad((int(LenData) * 1))) + pad((len(DocFormat) * 1))) + pad((len(Options) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 11 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Drawable)) + b += 4 + + Put32(buf[b:], LenData) + b += 4 + + Put16(buf[b:], LenFmt) + b += 2 + + Put16(buf[b:], LenOptions) + b += 2 + + copy(buf[b:], Data[:LenData]) + b += pad(int(LenData)) + + for i := 0; i < int(len(DocFormat)); i++ { + buf[b] = byte(DocFormat[i]) + b += 1 + } + b = pad(b) + + for i := 0; i < int(len(Options)); i++ { + buf[b] = byte(Options[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintGetDocumentData +// size: 12 +type XprintPrintGetDocumentDataCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetDocumentData(Context Id, MaxBytes uint32) XprintPrintGetDocumentDataCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetDocumentDataRequest(Context, MaxBytes), cookie) + return XprintPrintGetDocumentDataCookie{cookie} +} + +func (c *Conn) XprintPrintGetDocumentDataUnchecked(Context Id, MaxBytes uint32) XprintPrintGetDocumentDataCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetDocumentDataRequest(Context, MaxBytes), cookie) + return XprintPrintGetDocumentDataCookie{cookie} +} + +// Request reply for XprintPrintGetDocumentData +// size: (32 + pad((int(DataLen) * 1))) +type XprintPrintGetDocumentDataReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + StatusCode uint32 + FinishedFlag uint32 + DataLen uint32 + // padding: 12 bytes + Data []byte // size: pad((int(DataLen) * 1)) +} + +// Waits and reads reply data from request XprintPrintGetDocumentData +func (cook XprintPrintGetDocumentDataCookie) Reply() (*XprintPrintGetDocumentDataReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetDocumentDataReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetDocumentData +func xprintPrintGetDocumentDataReply(buf []byte) *XprintPrintGetDocumentDataReply { + v := new(XprintPrintGetDocumentDataReply) + 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.StatusCode = Get32(buf[b:]) + b += 4 + + v.FinishedFlag = Get32(buf[b:]) + b += 4 + + v.DataLen = Get32(buf[b:]) + b += 4 + + b += 12 // padding + + v.Data = make([]byte, v.DataLen) + copy(v.Data[:v.DataLen], buf[b:]) + b += pad(int(v.DataLen)) + + return v +} + +func (cook XprintPrintGetDocumentDataCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetDocumentData +func (c *Conn) xprintPrintGetDocumentDataRequest(Context Id, MaxBytes uint32) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 12 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], MaxBytes) + b += 4 + + return buf +} + +// Request XprintPrintStartPage +// size: 8 +type XprintPrintStartPageCookie struct { + *cookie +} + +// Write request to wire for XprintPrintStartPage +func (c *Conn) XprintPrintStartPage(Window Id) XprintPrintStartPageCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintStartPageRequest(Window), cookie) + return XprintPrintStartPageCookie{cookie} +} + +func (c *Conn) XprintPrintStartPageChecked(Window Id) XprintPrintStartPageCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintStartPageRequest(Window), cookie) + return XprintPrintStartPageCookie{cookie} +} + +func (cook XprintPrintStartPageCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintStartPage +func (c *Conn) xprintPrintStartPageRequest(Window Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 13 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Window)) + b += 4 + + return buf +} + +// Request XprintPrintEndPage +// size: 8 +type XprintPrintEndPageCookie struct { + *cookie +} + +// Write request to wire for XprintPrintEndPage +func (c *Conn) XprintPrintEndPage(Cancel bool) XprintPrintEndPageCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintEndPageRequest(Cancel), cookie) + return XprintPrintEndPageCookie{cookie} +} + +func (c *Conn) XprintPrintEndPageChecked(Cancel bool) XprintPrintEndPageCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintEndPageRequest(Cancel), cookie) + return XprintPrintEndPageCookie{cookie} +} + +func (cook XprintPrintEndPageCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintEndPage +func (c *Conn) xprintPrintEndPageRequest(Cancel bool) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 14 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + if Cancel { + buf[b] = 1 + } else { + buf[b] = 0 + } + b += 1 + + b += 3 // padding + + return buf +} + +// Request XprintPrintSelectInput +// size: pad((8 + (4 + pad((4 * popCount(int(EventMask))))))) +type XprintPrintSelectInputCookie struct { + *cookie +} + +// Write request to wire for XprintPrintSelectInput +func (c *Conn) XprintPrintSelectInput(Context Id, EventMask uint32, EventList []uint32) XprintPrintSelectInputCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintSelectInputRequest(Context, EventMask, EventList), cookie) + return XprintPrintSelectInputCookie{cookie} +} + +func (c *Conn) XprintPrintSelectInputChecked(Context Id, EventMask uint32, EventList []uint32) XprintPrintSelectInputCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintSelectInputRequest(Context, EventMask, EventList), cookie) + return XprintPrintSelectInputCookie{cookie} +} + +func (cook XprintPrintSelectInputCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintSelectInput +func (c *Conn) xprintPrintSelectInputRequest(Context Id, EventMask uint32, EventList []uint32) []byte { + size := pad((8 + (4 + pad((4 * popCount(int(EventMask))))))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 15 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], EventMask) + b += 4 + for i := 0; i < popCount(int(EventMask)); i++ { + Put32(buf[b:], EventList[i]) + b += 4 + } + b = pad(b) + + return buf +} + +// Request XprintPrintInputSelected +// size: 8 +type XprintPrintInputSelectedCookie struct { + *cookie +} + +func (c *Conn) XprintPrintInputSelected(Context Id) XprintPrintInputSelectedCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintInputSelectedRequest(Context), cookie) + return XprintPrintInputSelectedCookie{cookie} +} + +func (c *Conn) XprintPrintInputSelectedUnchecked(Context Id) XprintPrintInputSelectedCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintInputSelectedRequest(Context), cookie) + return XprintPrintInputSelectedCookie{cookie} +} + +// Request reply for XprintPrintInputSelected +// size: ((8 + (4 + pad((4 * popCount(int(EventMask)))))) + (4 + pad((4 * popCount(int(AllEventsMask)))))) +type XprintPrintInputSelectedReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + EventMask uint32 + EventList []uint32 + AllEventsMask uint32 + AllEventsList []uint32 +} + +// Waits and reads reply data from request XprintPrintInputSelected +func (cook XprintPrintInputSelectedCookie) Reply() (*XprintPrintInputSelectedReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintInputSelectedReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintInputSelected +func xprintPrintInputSelectedReply(buf []byte) *XprintPrintInputSelectedReply { + v := new(XprintPrintInputSelectedReply) + 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.EventMask = Get32(buf[b:]) + b += 4 + + v.EventList = make([]uint32, popCount(int(v.EventMask))) + for i := 0; i < popCount(int(v.EventMask)); i++ { + v.EventList[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + v.AllEventsMask = Get32(buf[b:]) + b += 4 + + v.AllEventsList = make([]uint32, popCount(int(v.AllEventsMask))) + for i := 0; i < popCount(int(v.AllEventsMask)); i++ { + v.AllEventsList[i] = Get32(buf[b:]) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XprintPrintInputSelectedCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintInputSelected +func (c *Conn) xprintPrintInputSelectedRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 16 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request XprintPrintGetAttributes +// size: 12 +type XprintPrintGetAttributesCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetAttributes(Context Id, Pool byte) XprintPrintGetAttributesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetAttributesRequest(Context, Pool), cookie) + return XprintPrintGetAttributesCookie{cookie} +} + +func (c *Conn) XprintPrintGetAttributesUnchecked(Context Id, Pool byte) XprintPrintGetAttributesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetAttributesRequest(Context, Pool), cookie) + return XprintPrintGetAttributesCookie{cookie} +} + +// Request reply for XprintPrintGetAttributes +// size: 33 +type XprintPrintGetAttributesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + StringLen uint32 + // padding: 20 bytes + Attributes XprintString8 +} + +// Waits and reads reply data from request XprintPrintGetAttributes +func (cook XprintPrintGetAttributesCookie) Reply() (*XprintPrintGetAttributesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetAttributesReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetAttributes +func xprintPrintGetAttributesReply(buf []byte) *XprintPrintGetAttributesReply { + v := new(XprintPrintGetAttributesReply) + 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.StringLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Attributes = XprintString8(buf[b]) + b += 1 + + return v +} + +func (cook XprintPrintGetAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetAttributes +func (c *Conn) xprintPrintGetAttributesRequest(Context Id, Pool byte) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 17 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + buf[b] = Pool + b += 1 + + b += 3 // padding + + return buf +} + +// Request XprintPrintGetOneAttributes +// size: pad((16 + pad((int(NameLen) * 1)))) +type XprintPrintGetOneAttributesCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetOneAttributes(Context Id, NameLen uint32, Pool byte, Name []XprintString8) XprintPrintGetOneAttributesCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetOneAttributesRequest(Context, NameLen, Pool, Name), cookie) + return XprintPrintGetOneAttributesCookie{cookie} +} + +func (c *Conn) XprintPrintGetOneAttributesUnchecked(Context Id, NameLen uint32, Pool byte, Name []XprintString8) XprintPrintGetOneAttributesCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetOneAttributesRequest(Context, NameLen, Pool, Name), cookie) + return XprintPrintGetOneAttributesCookie{cookie} +} + +// Request reply for XprintPrintGetOneAttributes +// size: (32 + pad((int(ValueLen) * 1))) +type XprintPrintGetOneAttributesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ValueLen uint32 + // padding: 20 bytes + Value []XprintString8 // size: pad((int(ValueLen) * 1)) +} + +// Waits and reads reply data from request XprintPrintGetOneAttributes +func (cook XprintPrintGetOneAttributesCookie) Reply() (*XprintPrintGetOneAttributesReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetOneAttributesReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetOneAttributes +func xprintPrintGetOneAttributesReply(buf []byte) *XprintPrintGetOneAttributesReply { + v := new(XprintPrintGetOneAttributesReply) + 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.ValueLen = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Value = make([]XprintString8, v.ValueLen) + for i := 0; i < int(v.ValueLen); i++ { + v.Value[i] = XprintString8(buf[b]) + b += 1 + } + b = pad(b) + + return v +} + +func (cook XprintPrintGetOneAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetOneAttributes +func (c *Conn) xprintPrintGetOneAttributesRequest(Context Id, NameLen uint32, Pool byte, Name []XprintString8) []byte { + size := pad((16 + pad((int(NameLen) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 19 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], NameLen) + b += 4 + + buf[b] = Pool + b += 1 + + b += 3 // padding + + for i := 0; i < int(NameLen); i++ { + buf[b] = byte(Name[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintSetAttributes +// size: pad((16 + pad((len(Attributes) * 1)))) +type XprintPrintSetAttributesCookie struct { + *cookie +} + +// Write request to wire for XprintPrintSetAttributes +func (c *Conn) XprintPrintSetAttributes(Context Id, StringLen uint32, Pool byte, Rule byte, Attributes []XprintString8) XprintPrintSetAttributesCookie { + cookie := c.newCookie(false, false) + c.newRequest(c.xprintPrintSetAttributesRequest(Context, StringLen, Pool, Rule, Attributes), cookie) + return XprintPrintSetAttributesCookie{cookie} +} + +func (c *Conn) XprintPrintSetAttributesChecked(Context Id, StringLen uint32, Pool byte, Rule byte, Attributes []XprintString8) XprintPrintSetAttributesCookie { + cookie := c.newCookie(true, false) + c.newRequest(c.xprintPrintSetAttributesRequest(Context, StringLen, Pool, Rule, Attributes), cookie) + return XprintPrintSetAttributesCookie{cookie} +} + +func (cook XprintPrintSetAttributesCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintSetAttributes +func (c *Conn) xprintPrintSetAttributesRequest(Context Id, StringLen uint32, Pool byte, Rule byte, Attributes []XprintString8) []byte { + size := pad((16 + pad((len(Attributes) * 1)))) + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 18 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put32(buf[b:], StringLen) + b += 4 + + buf[b] = Pool + b += 1 + + buf[b] = Rule + b += 1 + + b += 2 // padding + + for i := 0; i < int(len(Attributes)); i++ { + buf[b] = byte(Attributes[i]) + b += 1 + } + b = pad(b) + + return buf +} + +// Request XprintPrintGetPageDimensions +// size: 8 +type XprintPrintGetPageDimensionsCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetPageDimensions(Context Id) XprintPrintGetPageDimensionsCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetPageDimensionsRequest(Context), cookie) + return XprintPrintGetPageDimensionsCookie{cookie} +} + +func (c *Conn) XprintPrintGetPageDimensionsUnchecked(Context Id) XprintPrintGetPageDimensionsCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetPageDimensionsRequest(Context), cookie) + return XprintPrintGetPageDimensionsCookie{cookie} +} + +// Request reply for XprintPrintGetPageDimensions +// size: 20 +type XprintPrintGetPageDimensionsReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Width uint16 + Height uint16 + OffsetX uint16 + OffsetY uint16 + ReproducibleWidth uint16 + ReproducibleHeight uint16 +} + +// Waits and reads reply data from request XprintPrintGetPageDimensions +func (cook XprintPrintGetPageDimensionsCookie) Reply() (*XprintPrintGetPageDimensionsReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetPageDimensionsReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetPageDimensions +func xprintPrintGetPageDimensionsReply(buf []byte) *XprintPrintGetPageDimensionsReply { + v := new(XprintPrintGetPageDimensionsReply) + 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.Width = Get16(buf[b:]) + b += 2 + + v.Height = Get16(buf[b:]) + b += 2 + + v.OffsetX = Get16(buf[b:]) + b += 2 + + v.OffsetY = Get16(buf[b:]) + b += 2 + + v.ReproducibleWidth = Get16(buf[b:]) + b += 2 + + v.ReproducibleHeight = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XprintPrintGetPageDimensionsCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetPageDimensions +func (c *Conn) xprintPrintGetPageDimensionsRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 21 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} + +// Request XprintPrintQueryScreens +// size: 4 +type XprintPrintQueryScreensCookie struct { + *cookie +} + +func (c *Conn) XprintPrintQueryScreens() XprintPrintQueryScreensCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintQueryScreensRequest(), cookie) + return XprintPrintQueryScreensCookie{cookie} +} + +func (c *Conn) XprintPrintQueryScreensUnchecked() XprintPrintQueryScreensCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintQueryScreensRequest(), cookie) + return XprintPrintQueryScreensCookie{cookie} +} + +// Request reply for XprintPrintQueryScreens +// size: (32 + pad((int(ListCount) * 4))) +type XprintPrintQueryScreensReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ListCount uint32 + // padding: 20 bytes + Roots []Id // size: pad((int(ListCount) * 4)) +} + +// Waits and reads reply data from request XprintPrintQueryScreens +func (cook XprintPrintQueryScreensCookie) Reply() (*XprintPrintQueryScreensReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintQueryScreensReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintQueryScreens +func xprintPrintQueryScreensReply(buf []byte) *XprintPrintQueryScreensReply { + v := new(XprintPrintQueryScreensReply) + 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.ListCount = Get32(buf[b:]) + b += 4 + + b += 20 // padding + + v.Roots = make([]Id, v.ListCount) + for i := 0; i < int(v.ListCount); i++ { + v.Roots[i] = Id(Get32(buf[b:])) + b += 4 + } + b = pad(b) + + return v +} + +func (cook XprintPrintQueryScreensCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintQueryScreens +func (c *Conn) xprintPrintQueryScreensRequest() []byte { + size := 4 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 22 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + return buf +} + +// Request XprintPrintSetImageResolution +// size: 12 +type XprintPrintSetImageResolutionCookie struct { + *cookie +} + +func (c *Conn) XprintPrintSetImageResolution(Context Id, ImageResolution uint16) XprintPrintSetImageResolutionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintSetImageResolutionRequest(Context, ImageResolution), cookie) + return XprintPrintSetImageResolutionCookie{cookie} +} + +func (c *Conn) XprintPrintSetImageResolutionUnchecked(Context Id, ImageResolution uint16) XprintPrintSetImageResolutionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintSetImageResolutionRequest(Context, ImageResolution), cookie) + return XprintPrintSetImageResolutionCookie{cookie} +} + +// Request reply for XprintPrintSetImageResolution +// size: 10 +type XprintPrintSetImageResolutionReply struct { + Sequence uint16 + Length uint32 + Status bool + PreviousResolutions uint16 +} + +// Waits and reads reply data from request XprintPrintSetImageResolution +func (cook XprintPrintSetImageResolutionCookie) Reply() (*XprintPrintSetImageResolutionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintSetImageResolutionReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintSetImageResolution +func xprintPrintSetImageResolutionReply(buf []byte) *XprintPrintSetImageResolutionReply { + v := new(XprintPrintSetImageResolutionReply) + b := 1 // skip reply determinant + + if buf[b] == 1 { + v.Status = true + } else { + v.Status = false + } + b += 1 + + v.Sequence = Get16(buf[b:]) + b += 2 + + v.Length = Get32(buf[b:]) // 4-byte units + b += 4 + + v.PreviousResolutions = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XprintPrintSetImageResolutionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintSetImageResolution +func (c *Conn) xprintPrintSetImageResolutionRequest(Context Id, ImageResolution uint16) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 23 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + Put16(buf[b:], ImageResolution) + b += 2 + + return buf +} + +// Request XprintPrintGetImageResolution +// size: 8 +type XprintPrintGetImageResolutionCookie struct { + *cookie +} + +func (c *Conn) XprintPrintGetImageResolution(Context Id) XprintPrintGetImageResolutionCookie { + cookie := c.newCookie(true, true) + c.newRequest(c.xprintPrintGetImageResolutionRequest(Context), cookie) + return XprintPrintGetImageResolutionCookie{cookie} +} + +func (c *Conn) XprintPrintGetImageResolutionUnchecked(Context Id) XprintPrintGetImageResolutionCookie { + cookie := c.newCookie(false, true) + c.newRequest(c.xprintPrintGetImageResolutionRequest(Context), cookie) + return XprintPrintGetImageResolutionCookie{cookie} +} + +// Request reply for XprintPrintGetImageResolution +// size: 10 +type XprintPrintGetImageResolutionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + ImageResolution uint16 +} + +// Waits and reads reply data from request XprintPrintGetImageResolution +func (cook XprintPrintGetImageResolutionCookie) Reply() (*XprintPrintGetImageResolutionReply, error) { + buf, err := cook.reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return xprintPrintGetImageResolutionReply(buf), nil +} + +// Read reply into structure from buffer for XprintPrintGetImageResolution +func xprintPrintGetImageResolutionReply(buf []byte) *XprintPrintGetImageResolutionReply { + v := new(XprintPrintGetImageResolutionReply) + 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.ImageResolution = Get16(buf[b:]) + b += 2 + + return v +} + +func (cook XprintPrintGetImageResolutionCookie) Check() error { + return cook.check() +} + +// Write request to wire for XprintPrintGetImageResolution +func (c *Conn) xprintPrintGetImageResolutionRequest(Context Id) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.extensions["XPEXTENSION"] + b += 1 + + buf[b] = 24 // request opcode + b += 1 + + Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units + b += 2 + + Put32(buf[b:], uint32(Context)) + b += 4 + + return buf +} |