# Fill self.count and self.enums using the dictionary of enums
- # that was passed in.
+ # that was passed in. The generic Get functions (e.g.,
+ # GetBooleanv and friends) are handled specially here. In
+ # the data the generic Get functions are refered to as "Get".
+
+ if func_name in ["GetIntegerv", "GetBooleanv", "GetFloatv", "GetDoublev"]:
+ match_name = "Get"
+ else:
+ match_name = func_name
mode_set = 0
for enum_name in enum_dict:
e = enum_dict[ enum_name ]
-
- if e.functions.has_key( func_name ):
- [count, mode] = e.functions[ func_name ]
+
+ if e.functions.has_key( match_name ):
+ [count, mode] = e.functions[ match_name ]
if mode_set and mode != self.mode:
raise RuntimeError("Not all enums for %s have the same mode." % (func_name))
self.count[i].sort()
for e in self.count[i]:
- self.sig += "%04x,%u," % (e, i)
-
+ self.sig += "%04x,%d," % (e, i)
+
return self.sig
for o in keys:
p = f.parameters_by_name[ foo[o] ]
- printer.common_emit_one_arg(p, "pc", " ", 0)
+ printer.common_emit_one_arg(p, "pc", 0)
fixup.append( p.name )
print '#include <GL/gl.h>'
if self.emit_get:
print '#include "indirect_size_get.h"'
+ print '#include "glxserver.h"'
+ print '#include "indirect_util.h"'
print '#include "indirect_size.h"'
class PrintGlxReqSize_c(PrintGlxReqSize_common):
+ """Create the server-side 'request size' functions.
+
+ Create the server-side functions that are used to determine what the
+ size of a varible length command should be. The server then uses
+ this value to determine if the incoming command packed it malformed.
+ """
+
def __init__(self):
PrintGlxReqSize_common.__init__(self)
self.counter_sigs = {}
def printRealHeader(self):
print ''
print '#include <GL/gl.h>'
- print '#include <byteswap.h>'
print '#include "glxserver.h"'
+ print '#include "glxbyteorder.h"'
print '#include "indirect_size.h"'
print '#include "indirect_reqsize.h"'
-
print ''
print '#define __GLX_PAD(x) (((x) + 3) & ~3)'
print ''
if fixup:
print ' if (swap) {'
for name in fixup:
- print ' %-14s = bswap_32( %s );' % (name, name)
+ print ' %s = bswap_32(%s);' % (name, name)
print ' }'
return
- def common_emit_one_arg(self, p, pc, indent, adjust):
+ def common_emit_one_arg(self, p, pc, adjust):
offset = p.offset
dst = p.string()
src = '(%s *)' % (p.type_string())
- print '%s%-18s = *%11s(%s + %u);' % (indent, dst, src, pc, offset + adjust);
+ print '%-18s = *%11s(%s + %u);' % (dst, src, pc, offset + adjust);
return
self.common_func_print_just_header(f)
f.offset_of( f.parameters[0].name )
- [dim, w, h, d, junk] = f.dimensions()
+ [dim, w, h, d, junk] = f.get_images()[0].get_dimensions()
print ' GLint row_length = * (GLint *)(pc + 4);'
img = f.images[0]
for p in f.parameterIterateGlxSend():
if p.name in [w, h, d, img.img_format, img.img_type, img.img_target]:
- self.common_emit_one_arg( p, "pc", " ", 0 )
+ self.common_emit_one_arg(p, "pc", 0)
fixup.append( p.name )
print ''
self.common_func_print_just_header(f)
for p in params:
- self.common_emit_one_arg(p, "pc", " ", 0 )
+ self.common_emit_one_arg(p, "pc", 0)
print ''
print " -m output_mode Output mode can be one of 'size_c' or 'size_h'."
print " --only-get Only emit 'get'-type functions."
print " --only-set Only emit 'set'-type functions."
- print " --get-alias-set When only 'get'-type functions are emitted, allow them"
- print " to be aliases to 'set'-type funcitons."
print ""
print "By default, both 'get' and 'set'-type functions are emitted."
sys.exit(1)