Refactor the code to emit multiple-inclusion protection to
FilterGLAPISpecBase. Since the size_h mode of glX_proto_size.py will be used to generate multiple header files, add an option to specify the define that is used for multiple-inclusion protection. The changes to the header files in this commit are just a side-effect of the changes to the Python scripts.
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#if !defined( _INDIRECT_H_ )
|
||||
# define _INDIRECT_H_
|
||||
|
||||
/**
|
||||
* \file
|
||||
@@ -35,10 +37,6 @@
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#if !defined( _INDIRECT_H_ )
|
||||
# define _INDIRECT_H_
|
||||
|
||||
|
||||
# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
|
||||
# define HIDDEN __attribute__((visibility("hidden")))
|
||||
# else
|
||||
@@ -522,4 +520,5 @@ extern HIDDEN void __indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, G
|
||||
extern HIDDEN void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount);
|
||||
extern HIDDEN void __indirect_glActiveStencilFaceEXT(GLenum face);
|
||||
# undef HIDDEN
|
||||
|
||||
#endif /* !defined( _INDIRECT_H_ ) */
|
||||
|
@@ -25,6 +25,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#if !defined( _INDIRECT_SIZE_H_ )
|
||||
# define _INDIRECT_SIZE_H_
|
||||
|
||||
/**
|
||||
* \file
|
||||
@@ -34,10 +36,6 @@
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#if !defined( _GLXSIZE_H_ )
|
||||
# define _GLXSIZE_H_
|
||||
|
||||
|
||||
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define PURE __attribute__((pure))
|
||||
# else
|
||||
@@ -86,4 +84,5 @@ extern INTERNAL PURE FASTCALL GLint __glPointParameterivNV_size(GLenum);
|
||||
# undef INTERNAL
|
||||
# undef PURE
|
||||
# undef FASTCALL
|
||||
#endif /* !defined( _GLXSIZE_H_ ) */
|
||||
|
||||
#endif /* !defined( _INDIRECT_SIZE_H_ ) */
|
||||
|
@@ -57,7 +57,7 @@ glapitable.h: $(COMMON) gl_table.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) glX_proto_send.py -m init_c > ../../glx/x11/indirect_init.c
|
||||
|
||||
../../glx/x11/indirect_size.h: $(COMMON_GLX) glX_proto_size.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) glX_proto_size.py -m size_h --only-set > ../../glx/x11/indirect_size.h
|
||||
$(PYTHON2) $(PYTHON_FLAGS) glX_proto_size.py -m size_h --only-set -h _INDIRECT_SIZE_H_ > ../../glx/x11/indirect_size.h
|
||||
|
||||
../../glx/x11/indirect_size.c: $(COMMON_GLX) glX_proto_size.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) glX_proto_size.py -m size_c --only-set > ../../glx/x11/indirect_size.c
|
||||
|
@@ -758,28 +758,23 @@ class PrintGlxProtoInit_h(glX_XML.GlxProto):
|
||||
self.license = license.bsd_license_template % ( \
|
||||
"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
|
||||
|
||||
self.header_tag = "_INDIRECT_H_"
|
||||
|
||||
def printRealHeader(self):
|
||||
print """
|
||||
/**
|
||||
print """/**
|
||||
* \\file
|
||||
* Prototypes for indirect rendering functions.
|
||||
*
|
||||
* \\author Kevin E. Martin <kevin@precisioninsight.com>
|
||||
* \\author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#if !defined( _INDIRECT_H_ )
|
||||
# define _INDIRECT_H_
|
||||
|
||||
"""
|
||||
glX_XML.printVisibility( "HIDDEN", "hidden" )
|
||||
|
||||
|
||||
def printRealFooter(self):
|
||||
print "# undef HIDDEN"
|
||||
print "#endif /* !defined( _INDIRECT_H_ ) */"
|
||||
|
||||
|
||||
def printFunction(self, f):
|
||||
if f.fn_offset < 0 or f.ignore: return
|
||||
|
@@ -166,18 +166,13 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
|
||||
|
||||
class PrintGlxSizeStubs_h(PrintGlxSizeStubs_common):
|
||||
def printRealHeader(self):
|
||||
print """
|
||||
/**
|
||||
print """/**
|
||||
* \\file
|
||||
* Prototypes for functions used to determine the number of data elements in
|
||||
* various GLX protocol messages.
|
||||
*
|
||||
* \\author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#if !defined( _GLXSIZE_H_ )
|
||||
# define _GLXSIZE_H_
|
||||
|
||||
"""
|
||||
glX_XML.printPure();
|
||||
print ''
|
||||
@@ -191,7 +186,6 @@ class PrintGlxSizeStubs_h(PrintGlxSizeStubs_common):
|
||||
print "# undef INTERNAL"
|
||||
print "# undef PURE"
|
||||
print "# undef FASTCALL"
|
||||
print "#endif /* !defined( _GLXSIZE_H_ ) */"
|
||||
|
||||
|
||||
def printFunction(self, f):
|
||||
@@ -215,11 +209,12 @@ if __name__ == '__main__':
|
||||
file_name = "gl_API.xml"
|
||||
|
||||
try:
|
||||
(args, trail) = getopt.getopt(sys.argv[1:], "f:m:", ["only-get", "only-set", "get-alias-set"])
|
||||
(args, trail) = getopt.getopt(sys.argv[1:], "f:m:h:", ["only-get", "only-set", "get-alias-set", "header-tag"])
|
||||
except Exception,e:
|
||||
show_usage()
|
||||
|
||||
mode = None
|
||||
header_tag = None
|
||||
which_functions = PrintGlxSizeStubs_common.do_get | PrintGlxSizeStubs_common.do_set
|
||||
|
||||
for (arg,val) in args:
|
||||
@@ -233,11 +228,15 @@ if __name__ == '__main__':
|
||||
which_functions = PrintGlxSizeStubs_common.do_set
|
||||
elif arg == "--get-alias-set":
|
||||
which_functions |= PrintGlxSizeStubs_common.do_get_alias_set
|
||||
elif (arg == '-h') or (arg == "--header-tag"):
|
||||
header_tag = val
|
||||
|
||||
if mode == "size_c":
|
||||
dh = PrintGlxSizeStubs_c( which_functions )
|
||||
elif mode == "size_h":
|
||||
dh = PrintGlxSizeStubs_h( which_functions )
|
||||
if header_tag:
|
||||
dh.header_tag = header_tag
|
||||
else:
|
||||
show_usage()
|
||||
|
||||
|
@@ -494,6 +494,7 @@ class FilterGLAPISpecBase(saxutils.XMLFilterBase):
|
||||
self.types = {}
|
||||
self.xref = {}
|
||||
self.factory = glItemFactory()
|
||||
self.header_tag = None
|
||||
|
||||
|
||||
def find_type(self,type_name):
|
||||
@@ -529,6 +530,10 @@ class FilterGLAPISpecBase(saxutils.XMLFilterBase):
|
||||
print ' * ' + self.license.replace('\n', '\n * ')
|
||||
print ' */'
|
||||
print ''
|
||||
if self.header_tag:
|
||||
print '#if !defined( %s )' % (self.header_tag)
|
||||
print '# define %s' % (self.header_tag)
|
||||
print ''
|
||||
self.printRealHeader();
|
||||
return
|
||||
|
||||
@@ -538,6 +543,9 @@ class FilterGLAPISpecBase(saxutils.XMLFilterBase):
|
||||
|
||||
self.printFunctions()
|
||||
self.printRealFooter()
|
||||
if self.header_tag:
|
||||
print ''
|
||||
print '#endif /* !defined( %s ) */' % (self.header_tag)
|
||||
|
||||
|
||||
def get_category_define(self):
|
||||
|
@@ -38,6 +38,7 @@ class PrintGlOffsets(gl_XML.FilterGLAPISpecBase):
|
||||
|
||||
def __init__(self):
|
||||
gl_XML.FilterGLAPISpecBase.__init__(self)
|
||||
self.header_tag = '_GLAPI_OFFSETS_H_'
|
||||
self.license = license.bsd_license_template % ( \
|
||||
"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
|
||||
@@ -46,16 +47,6 @@ class PrintGlOffsets(gl_XML.FilterGLAPISpecBase):
|
||||
if f.fn_offset < 0: return
|
||||
print '#define _gloffset_%s %d' % (f.name, f.fn_offset)
|
||||
|
||||
def printRealHeader(self):
|
||||
print '#ifndef _GLAPI_OFFSETS_H_'
|
||||
print '#define _GLAPI_OFFSETS_H_'
|
||||
print ''
|
||||
return
|
||||
|
||||
def printRealFooter(self):
|
||||
print ''
|
||||
print '#endif'
|
||||
return
|
||||
|
||||
def show_usage():
|
||||
print "Usage: %s [-f input_file_name]" % sys.argv[0]
|
||||
|
@@ -38,6 +38,7 @@ class PrintGlTable(gl_XML.FilterGLAPISpecBase):
|
||||
|
||||
def __init__(self):
|
||||
gl_XML.FilterGLAPISpecBase.__init__(self)
|
||||
self.header_tag = '_GLAPI_TABLE_H_'
|
||||
self.license = license.bsd_license_template % ( \
|
||||
"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
|
||||
@@ -51,9 +52,6 @@ class PrintGlTable(gl_XML.FilterGLAPISpecBase):
|
||||
(f.fn_return_type, f.name, arg_string, f.fn_offset)
|
||||
|
||||
def printRealHeader(self):
|
||||
print '#ifndef _GLAPI_TABLE_H_'
|
||||
print '#define _GLAPI_TABLE_H_'
|
||||
print ''
|
||||
print '#ifndef GLAPIENTRYP'
|
||||
print '#define GLAPIENTRYP'
|
||||
print '#endif'
|
||||
@@ -64,8 +62,6 @@ class PrintGlTable(gl_XML.FilterGLAPISpecBase):
|
||||
|
||||
def printRealFooter(self):
|
||||
print '};'
|
||||
print ''
|
||||
print '#endif'
|
||||
return
|
||||
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _GLAPI_OFFSETS_H_
|
||||
#if !defined( _GLAPI_OFFSETS_H_ )
|
||||
# define _GLAPI_OFFSETS_H_
|
||||
|
||||
#define _gloffset_NewList 0
|
||||
@@ -829,4 +829,4 @@
|
||||
#define _gloffset_StencilOpSeparate 797
|
||||
#define _gloffset_StencilMaskSeparate 798
|
||||
|
||||
#endif
|
||||
#endif /* !defined( _GLAPI_OFFSETS_H_ ) */
|
||||
|
@@ -26,7 +26,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _GLAPI_TABLE_H_
|
||||
#if !defined( _GLAPI_TABLE_H_ )
|
||||
# define _GLAPI_TABLE_H_
|
||||
|
||||
#ifndef GLAPIENTRYP
|
||||
@@ -836,4 +836,4 @@ struct _glapi_table
|
||||
void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 798 */
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* !defined( _GLAPI_TABLE_H_ ) */
|
||||
|
Reference in New Issue
Block a user