3 # (C) Copyright IBM Corporation 2004
6 # Permission is hereby granted, free of charge, to any person obtaining a
7 # copy of this software and associated documentation files (the "Software"),
8 # to deal in the Software without restriction, including without limitation
9 # on the rights to use, copy, modify, merge, publish, distribute, sub
10 # license, and/or sell copies of the Software, and to permit persons to whom
11 # the Software is furnished to do so, subject to the following conditions:
13 # The above copyright notice and this permission notice (including the next
14 # paragraph) shall be included in all copies or substantial portions of the
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 # IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26 # Ian Romanick <idr@us.ibm.com>
28 from xml
.sax
import saxutils
29 from xml
.sax
import make_parser
30 from xml
.sax
.handler
import feature_namespaces
38 print """# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
39 # define PURE __attribute__((pure))
45 print """# if defined(__i386__) && defined(__GNUC__)
46 # define FASTCALL __attribute__((fastcall))
51 def printVisibility(S
, s
):
52 print """# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
53 # define %s __attribute__((visibility("%s")))
56 # endif""" % (S
, s
, S
)
59 print """# if defined(__GNUC__)
60 # define NOINLINE __attribute__((noinline))
66 class glXItemFactory(gl_XML
.glItemFactory
):
67 """Factory to create GLX protocol oriented objects derived from glItem."""
69 def create(self
, context
, name
, attrs
):
70 if name
== "function":
71 return glXFunction(context
, name
, attrs
)
73 return glXEnum(context
, name
, attrs
)
75 return glXParameter(context
, name
, attrs
)
77 return gl_XML
.glItemFactory
.create(self
, context
, name
, attrs
)
79 class glXEnumFunction
:
80 def __init__(self
, name
):
83 # "enums" is a set of lists. The element in the set is the
84 # value of the enum. The list is the list of names for that
85 # value. For example, [0x8126] = {"POINT_SIZE_MIN",
86 # "POINT_SIZE_MIN_ARB", "POINT_SIZE_MIN_EXT",
87 # "POINT_SIZE_MIN_SGIS"}.
91 # "count" is indexed by count values. Each element of count
92 # is a list of index to "enums" that have that number of
93 # associated data elements. For example, [4] =
94 # {GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_EMISSION,
95 # GL_AMBIENT_AND_DIFFUSE} (the enum names are used here,
96 # but the actual hexadecimal values would be in the array).
101 def append(self
, count
, value
, name
):
102 if self
.enums
.has_key( value
):
103 self
.enums
[value
].append(name
)
105 if not self
.count
.has_key(count
):
106 self
.count
[count
] = []
108 self
.enums
[value
] = []
109 self
.enums
[value
].append(name
)
110 self
.count
[count
].append(value
)
113 def signature( self
):
116 for e
in self
.count
[i
]:
117 sig
+= "%04x,%u," % (e
, i
)
122 def PrintUsingTable(self
):
123 """Emit the body of the __gl*_size function using a pair
124 of look-up tables and a mask. The mask is calculated such
125 that (e & mask) is unique for all the valid values of e for
126 this function. The result of (e & mask) is used as an index
127 into the first look-up table. If it matches e, then the
128 same entry of the second table is returned. Otherwise zero
131 It seems like this should cause better code to be generated.
132 However, on x86 at least, the resulting .o file is about 20%
133 larger then the switch-statment version. I am leaving this
134 code in because the results may be different on other
135 platforms (e.g., PowerPC or x86-64)."""
142 # Determine if there is some mask M, such that M = (2^N) - 1,
143 # that will generate unique values for all of the enums.
146 for i
in [1, 2, 3, 4, 5, 6, 7, 8]:
153 if (a
& mask
) == (b
& mask
):
161 if (mask
!= 0) and (mask
< (2 * count
)):
165 for i
in range(0, mask
):
166 masked_enums
[i
] = "0";
170 for e
in self
.count
[c
]:
172 masked_enums
[i
] = '0x%04x /* %s */' % (e
, self
.enums
[e
][0])
176 print ' static const GLushort a[%u] = {' % (mask
+ 1)
177 for e
in masked_enums
:
178 print ' %s, ' % (masked_enums
[e
])
181 print ' static const GLubyte b[%u] = {' % (mask
+ 1)
182 for c
in masked_count
:
183 print ' %u, ' % (masked_count
[c
])
186 print ' const unsigned idx = (e & 0x%02xU);' % (mask
)
188 print ' return (e == a[idx]) ? (GLint) b[idx] : 0;'
193 def PrintUsingSwitch(self
):
194 """Emit the body of the __gl*_size function using a
197 print ' switch( e ) {'
200 for e
in self
.count
[c
]:
203 # There may be multiple enums with the same
204 # value. This happens has extensions are
205 # promoted from vendor-specific or EXT to
206 # ARB and to the core. Emit the first one as
207 # a case label, and emit the others as
208 # commented-out case labels.
210 for j
in self
.enums
[e
]:
212 print ' case %s:' % (j
)
215 print '/* case %s:*/' % (j
)
217 print ' return %u;' % (c
)
219 print ' default: return 0;'
223 def Print(self
, name
):
224 print 'INTERNAL PURE FASTCALL GLint'
225 print '__gl%s_size( GLenum e )' % (name
)
228 if not self
.PrintUsingTable():
229 self
.PrintUsingSwitch()
236 class glXEnum(gl_XML
.glEnum
):
237 def __init__(self
, context
, name
, attrs
):
238 gl_XML
.glEnum
.__init
__(self
, context
, name
, attrs
)
239 self
.glx_functions
= []
241 def startElement(self
, name
, attrs
):
243 n
= attrs
.get('name', None)
244 if not self
.context
.glx_enum_functions
.has_key( n
):
245 f
= glXEnumFunction( n
)
246 self
.context
.glx_enum_functions
[ f
.name
] = f
248 temp
= attrs
.get('count', None)
252 raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp
, self
.name
, n
))
254 self
.context
.glx_enum_functions
[ n
].append( c
, self
.value
, self
.name
)
256 gl_XML
.glEnum
.startElement(self
, context
, name
, attrs
)
260 class glXParameter(gl_XML
.glParameter
):
261 def __init__(self
, context
, name
, attrs
):
263 gl_XML
.glParameter
.__init
__(self
, context
, name
, attrs
);
266 class glXFunction(gl_XML
.glFunction
):
271 # If this is set to true, it means that GLdouble parameters should be
272 # written to the GLX protocol packet in the order they appear in the
273 # prototype. This is different from the "classic" ordering. In the
274 # classic ordering GLdoubles are written to the protocol packet first,
275 # followed by non-doubles. NV_vertex_program was the first extension
276 # to break with this tradition.
278 glx_doubles_in_order
= 0
285 def __init__(self
, context
, name
, attrs
):
286 self
.vectorequiv
= attrs
.get('vectorequiv', None)
287 self
.count_parameters
= None
290 self
.can_be_large
= 0
291 self
.reply_always_array
= 0
293 gl_XML
.glFunction
.__init
__(self
, context
, name
, attrs
)
296 def startElement(self
, name
, attrs
):
297 """Process elements within a function that are specific to GLX."""
300 self
.glx_rop
= int(attrs
.get('rop', "0"))
301 self
.glx_sop
= int(attrs
.get('sop', "0"))
302 self
.glx_vendorpriv
= int(attrs
.get('vendorpriv', "0"))
304 if attrs
.get('handcode', "false") == "true":
309 if attrs
.get('ignore', "false") == "true":
314 if attrs
.get('large', "false") == "true":
315 self
.can_be_large
= 1
317 self
.can_be_large
= 0
319 if attrs
.get('doubles_in_order', "false") == "true":
320 self
.glx_doubles_in_order
= 1
322 self
.glx_doubles_in_order
= 0
324 if attrs
.get('always_array', "false") == "true":
325 self
.reply_always_array
= 1
327 self
.reply_always_array
= 0
330 gl_XML
.glFunction
.startElement(self
, name
, attrs
)
333 def append(self
, tag_name
, p
):
334 gl_XML
.glFunction
.append(self
, tag_name
, p
)
336 if p
.is_variable_length_array():
338 elif not self
.glx_doubles_in_order
and p
.p_type
.size
== 8:
341 if p
.p_count_parameters
!= None:
342 self
.count_parameters
= p
.p_count_parameters
345 self
.counter
= p
.name
352 def variable_length_parameter(self
):
353 for param
in self
.fn_parameters
:
354 if param
.is_variable_length_array():
360 def command_payload_length(self
):
364 if p
.is_output
: continue
365 temp
= p
.size_string()
370 size_string
= size_string
+ " + __GLX_PAD(%s)" % (temp
)
372 return [size
, size_string
]
374 def command_length(self
):
375 [size
, size_string
] = self
.command_payload_length()
377 if self
.glx_rop
!= 0:
380 size
= ((size
+ 3) & ~
3)
381 return "%u%s" % (size
, size_string
)
384 def opcode_value(self
):
385 if self
.glx_rop
!= 0:
387 elif self
.glx_sop
!= 0:
389 elif self
.glx_vendorpriv
!= 0:
390 return self
.glx_vendorpriv
394 def opcode_rop_basename(self
):
395 if self
.vectorequiv
== None:
398 return self
.vectorequiv
400 def opcode_name(self
):
401 if self
.glx_rop
!= 0:
402 return "X_GLrop_%s" % (self
.opcode_rop_basename())
403 elif self
.glx_sop
!= 0:
404 return "X_GLsop_%s" % (self
.name
)
405 elif self
.glx_vendorpriv
!= 0:
406 return "X_GLvop_%s" % (self
.name
)
410 def opcode_real_name(self
):
411 if self
.glx_vendorpriv
!= 0:
412 if self
.needs_reply():
413 return "X_GLXVendorPrivateWithReply"
415 return "X_GLXVendorPrivate"
417 return self
.opcode_name()
420 def return_string(self
):
421 if self
.fn_return_type
!= 'void':
422 return "return retval;"
427 def needs_reply(self
):
428 return self
.fn_return_type
!= 'void' or self
.output
!= None
431 class GlxProto(gl_XML
.FilterGLAPISpecBase
):
432 name
= "glX_proto_send.py (from Mesa)"
435 gl_XML
.FilterGLAPISpecBase
.__init
__(self
)
436 self
.factory
= glXItemFactory()
437 self
.glx_enum_functions
= {}
440 def endElement(self
, name
):
441 if name
== 'OpenGLAPI':
442 # Once all the parsing is done, we have to go back and
443 # fix-up some cross references between different
446 for k
in self
.functions
:
447 f
= self
.functions
[k
]
448 if f
.vectorequiv
!= None:
449 equiv
= self
.find_function(f
.vectorequiv
)
451 f
.glx_doubles_in_order
= equiv
.glx_doubles_in_order
452 f
.glx_rop
= equiv
.glx_rop
454 raise RuntimeError("Could not find the vector equiv. function %s for %s!" % (f
.name
, f
.vectorequiv
))
456 gl_XML
.FilterGLAPISpecBase
.endElement(self
, name
)
460 class PrintGlxProtoStubs(GlxProto
):
462 GlxProto
.__init
__(self
)
463 self
.last_category
= ""
464 self
.license
= license
.bsd_license_template
% ( "(C) Copyright IBM Corporation 2004", "IBM")
465 self
.generic_sizes
= [3, 4, 6, 8, 12, 16, 24, 32]
468 def printRealHeader(self
):
470 print '#include <GL/gl.h>'
471 print '#include "indirect.h"'
472 print '#include "glxclient.h"'
473 print '#include "size.h"'
474 print '#include <GL/glxproto.h>'
476 print '#define __GLX_PAD(n) (((n) + 3) & ~3)'
481 print '/* If the size and opcode values are known at compile-time, this will, on'
482 print ' * x86 at least, emit them with a single instruction.'
484 print '#define emit_header(dest, op, size) \\'
485 print ' do { union { short s[2]; int i; } temp; \\'
486 print ' temp.s[0] = (size); temp.s[1] = (op); \\'
487 print ' *((int *)(dest)) = temp.i; } while(0)'
489 print """static NOINLINE CARD32
490 read_reply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_array )
492 xGLXSingleReply reply;
494 (void) _XReply(dpy, (xReply *) & reply, 0, False);
496 if ((reply.size >= 1) || reply_is_always_array) {
497 const GLint bytes = (reply_is_always_array)
498 ? (4 * reply.length) : (reply.size * size);
499 const GLint extra = 4 - (bytes & 3);
501 _XRead(dpy, dest, bytes);
503 _XEatData(dpy, extra);
507 (void) memcpy( dest, &(reply.pad3), size);
514 #define X_GLXSingle 0
516 static NOINLINE GLubyte *
517 setup_single_request( __GLXcontext * gc, GLint sop, GLint cmdlen )
520 Display * const dpy = gc->currentDpy;
522 (void) __glXFlushRenderBuffer(gc, gc->pc);
524 GetReqExtra(GLXSingle, cmdlen, req);
525 req->reqType = gc->majorOpcode;
526 req->contextTag = gc->currentContextTag;
528 return (GLubyte *)(req) + sz_xGLXSingleReq;
531 static NOINLINE GLubyte *
532 setup_vendor_request( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen )
534 xGLXVendorPrivateReq * req;
535 Display * const dpy = gc->currentDpy;
537 (void) __glXFlushRenderBuffer(gc, gc->pc);
539 GetReqExtra(GLXVendorPrivate, cmdlen, req);
540 req->reqType = gc->majorOpcode;
542 req->vendorCode = vop;
543 req->contextTag = gc->currentContextTag;
544 return (GLubyte *)(req) + sz_xGLXVendorPrivateReq;
548 for size
in self
.generic_sizes
:
549 self
.print_generic_function(size
)
552 def printFunction(self
, f
):
553 if f
.fn_offset
< 0 or f
.handcode
or f
.ignore
: return
555 if f
.glx_rop
!= 0 or f
.vectorequiv
!= None:
556 self
.printRenderFunction(f
)
557 elif f
.glx_sop
!= 0 or f
.glx_vendorpriv
!= 0:
558 self
.printSingleFunction(f
)
560 print "/* Missing GLX protocol for %s. */" % (f
.name
)
562 def print_generic_function(self
, n
):
563 print """static FASTCALL NOINLINE void
564 generic_%u_byte( GLint rop, const void * ptr )
566 __GLXcontext * const gc = __glXGetCurrentContext();
567 const GLuint cmdlen = %u;
569 emit_header(gc->pc, rop, cmdlen);
570 (void) memcpy((void *)(gc->pc + 4), ptr, %u);
572 if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
577 def common_emit_one_arg(self
, p
, offset
, pc
, indent
, adjust
):
578 if p
.is_output
: return
584 src_ptr
= "&" + p
.name
586 print '%s (void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \
587 % (indent
, pc
, offset
+ adjust
, src_ptr
, p
.size_string() )
589 def common_emit_args(self
, f
, pc
, indent
, adjust
, skip_vla
):
590 # First emit all of the fixed-length 8-byte (i.e., GLdouble)
602 if p
.is_output
or p
.order
!= order
: continue
604 self
.common_emit_one_arg(p
, offset
, pc
, indent
, adjust
)
611 def common_func_print_just_header(self
, f
):
612 print '#define %s %d' % (f
.opcode_name(), f
.opcode_value())
614 print '%s' % (f
.fn_return_type
)
615 print '__indirect_gl%s(%s)' % (f
.name
, f
.get_parameter_string())
619 def common_func_print_header(self
, f
):
620 self
.common_func_print_just_header(f
)
622 print ' __GLXcontext * const gc = __glXGetCurrentContext();'
623 print ' Display * const dpy = gc->currentDpy;'
625 if f
.fn_return_type
!= 'void':
626 print ' %s retval = (%s) 0;' % (f
.fn_return_type
, f
.fn_return_type
)
628 if f
.count_parameters
!= None:
629 print ' const GLuint compsize = __gl%s_size(%s);' % (f
.name
, f
.count_parameters
)
631 print ' const GLuint cmdlen = %s;' % (f
.command_length())
633 if f
.counter
!= None:
634 print ' if (%s < 0) %s' % (f
.counter
, f
.return_string())
637 print ' if (dpy == NULL) return;'
638 print ' if ( ((gc->pc + cmdlen) > gc->bufEnd)'
639 print ' || (cmdlen > gc->maxSmallRenderCommandSize)) {'
640 print ' (void) __glXFlushRenderBuffer(gc, gc->pc);'
648 def printSingleFunction(self
, f
):
649 self
.common_func_print_header(f
)
651 print ' if (dpy != NULL) {'
653 if f
.fn_parameters
!= []:
654 pc_decl
= "GLubyte const * pc ="
658 if f
.glx_vendorpriv
!= 0:
659 print ' %s setup_vendor_request(gc, %s, %s, cmdlen);' % (pc_decl
, f
.opcode_real_name(), f
.opcode_name())
661 print ' %s setup_single_request(gc, %s, cmdlen);' % (pc_decl
, f
.opcode_name())
663 self
.common_emit_args(f
, "pc", " ", 0, 0)
667 output_size
= f
.output
.p_type
.size
668 output_str
= f
.output
.name
673 if f
.fn_return_type
!= 'void':
674 return_str
= " retval = (%s)" % (f
.fn_return_type
)
676 return_str
= " (void)"
678 if f
.reply_always_array
:
683 print " %s read_reply(gc->currentDpy, %s, %s, %s);" % (return_str
, output_size
, output_str
, aa
)
685 print ' UnlockDisplay(gc->currentDpy); SyncHandle();'
687 print ' %s' % f
.return_string()
693 def printRenderFunction(self
, f
):
694 if f
.variable_length_parameter() == None and len(f
.fn_parameters
) == 1:
695 p
= f
.fn_parameters
[0]
697 [cmdlen
, size_string
] = f
.command_payload_length()
698 if cmdlen
in self
.generic_sizes
:
699 self
.common_func_print_just_header(f
)
700 print ' generic_%u_byte( %s, %s );' % (cmdlen
, f
.opcode_real_name(), p
.name
)
705 self
.common_func_print_header(f
)
708 print ' if (cmdlen <= gc->maxSmallRenderCommandSize) {'
713 print '%s emit_header(gc->pc, %s, cmdlen);' % (indent
, f
.opcode_real_name())
715 self
.common_emit_args(f
, "gc->pc", indent
, 4, 0)
716 print '%s gc->pc += cmdlen;' % (indent
)
717 print '%s if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent
)
722 print ' const GLint op = %s;' % (f
.opcode_real_name())
723 print ' const GLuint cmdlenLarge = cmdlen + 4;'
724 print ' (void) memcpy((void *)(gc->pc + 0), (void *)(&op), 4);'
725 print ' (void) memcpy((void *)(gc->pc + 4), (void *)(&cmdlenLarge), 4);'
726 offset
= self
.common_emit_args(f
, "gc->pc", indent
, 8, 1)
728 p
= f
.variable_length_parameter()
729 print ' __glXSendLargeCommand(gc, gc->pc, %u, %s, %s);' % (offset
+ 8, p
.name
, p
.size_string())
737 class PrintGlxProtoInit_c(GlxProto
):
739 GlxProto
.__init
__(self
)
740 self
.last_category
= ""
741 self
.license
= license
.bsd_license_template
% ( \
742 """Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
743 (C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
746 def printRealHeader(self
):
748 * \\file indirect_init.c
749 * Initialize indirect rendering dispatch table.
751 * \\author Kevin E. Martin <kevin@precisioninsight.com>
752 * \\author Brian Paul <brian@precisioninsight.com>
753 * \\author Ian Romanick <idr@us.ibm.com>
756 #include "indirect_init.h"
757 #include "indirect.h"
762 * No-op function used to initialize functions that have no GLX protocol
765 static int NoOp(void)
771 * Create and initialize a new GL dispatch table. The table is initialized
772 * with GLX indirect rendering protocol functions.
774 __GLapi * __glXNewIndirectAPI( void )
779 entries = _glapi_get_dispatch_table_size();
780 glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *));
782 /* first, set all entries to point to no-op functions */
785 void **dispatch = (void **) glAPI;
786 for (i = 0; i < entries; i++) {
787 dispatch[i] = (void *) NoOp;
791 /* now, initialize the entries we understand */"""
793 def printRealFooter(self
):
799 def printFunction(self
, f
):
800 if f
.fn_offset
< 0 or f
.ignore
: return
802 if f
.category
!= self
.last_category
:
803 self
.last_category
= f
.category
805 print ' /* %s */' % (self
.last_category
)
808 print ' glAPI->%s = __indirect_gl%s;' % (f
.name
, f
.name
)
811 class PrintGlxProtoInit_h(GlxProto
):
813 GlxProto
.__init
__(self
)
814 self
.last_category
= ""
815 self
.license
= license
.bsd_license_template
% ( \
816 """Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
817 (C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
820 def printRealHeader(self
):
824 * Prototypes for indirect rendering functions.
826 * \\author Kevin E. Martin <kevin@precisioninsight.com>
827 * \\author Ian Romanick <idr@us.ibm.com>
830 #if !defined( _INDIRECT_H_ )
831 # define _INDIRECT_H_
834 printVisibility( "HIDDEN", "hidden" )
837 def printRealFooter(self
):
838 print "# undef HIDDEN"
839 print "#endif /* !defined( _INDIRECT_H_ ) */"
841 def printFunction(self
, f
):
842 if f
.fn_offset
< 0 or f
.ignore
: return
843 print 'extern HIDDEN %s __indirect_gl%s(%s);' % (f
.fn_return_type
, f
.name
, f
.get_parameter_string())
846 class PrintGlxSizeStubs(GlxProto
):
848 GlxProto
.__init
__(self
)
849 self
.license
= license
.bsd_license_template
% ( "(C) Copyright IBM Corporation 2004", "IBM")
851 self
.glx_enum_sigs
= {}
853 def printRealHeader(self
):
855 print '#include <GL/gl.h>'
856 print '#include "indirect_size.h"'
863 printVisibility( "INTERNAL", "internal" )
866 print '#ifdef HAVE_ALIAS'
867 print '# define ALIAS2(from,to) \\'
868 print ' INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\'
869 print ' __attribute__ ((alias( # to )));'
870 print '# define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size )'
872 print '# define ALIAS(from,to) \\'
873 print ' INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\'
874 print ' { return __gl ## to ## _size( e ); }'
879 def printRealFooter(self
):
880 for a
in self
.aliases
:
883 def printFunction(self
, f
):
884 if self
.glx_enum_functions
.has_key(f
.name
):
885 ef
= self
.glx_enum_functions
[f
.name
]
887 sig
= ef
.signature();
888 if self
.glx_enum_sigs
.has_key(sig
):
889 n
= self
.glx_enum_sigs
[sig
];
890 a
= 'ALIAS( %s, %s )' % (f
.name
, n
)
891 self
.aliases
.append(a
)
894 self
.glx_enum_sigs
[sig
] = f
.name
;
898 class PrintGlxSizeStubs_h(GlxProto
):
900 GlxProto
.__init
__(self
)
901 self
.license
= license
.bsd_license_template
% ( "(C) Copyright IBM Corporation 2004", "IBM")
903 self
.glx_enum_sigs
= {}
905 def printRealHeader(self
):
909 * Prototypes for functions used to determine the number of data elements in
910 * various GLX protocol messages.
912 * \\author Ian Romanick <idr@us.ibm.com>
915 #if !defined( _GLXSIZE_H_ )
923 printVisibility( "INTERNAL", "internal" );
926 def printRealFooter(self
):
928 print "# undef INTERNAL"
930 print "# undef FASTCALL"
931 print "#endif /* !defined( _GLXSIZE_H_ ) */"
934 def printFunction(self
, f
):
935 if self
.glx_enum_functions
.has_key(f
.name
):
936 ef
= self
.glx_enum_functions
[f
.name
]
937 print 'extern INTERNAL PURE FASTCALL GLint __gl%s_size(GLenum);' % (f
.name
)
941 print "Usage: %s [-f input_file_name] [-m output_mode]" % sys
.argv
[0]
945 if __name__
== '__main__':
946 file_name
= "gl_API.xml"
949 (args
, trail
) = getopt
.getopt(sys
.argv
[1:], "f:m:")
954 for (arg
,val
) in args
:
961 dh
= PrintGlxProtoStubs()
962 elif mode
== "init_c":
963 dh
= PrintGlxProtoInit_c()
964 elif mode
== "init_h":
965 dh
= PrintGlxProtoInit_h()
966 elif mode
== "size_c":
967 dh
= PrintGlxSizeStubs()
968 elif mode
== "size_h":
969 dh
= PrintGlxSizeStubs_h()
973 parser
= make_parser()
974 parser
.setFeature(feature_namespaces
, 0)
975 parser
.setContentHandler(dh
)