summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2005-01-28 19:00:54 +0000
committerIan Romanick <idr@us.ibm.com>2005-01-28 19:00:54 +0000
commit16c3c7401846bbc7c300e6a9b433584ec5b68699 (patch)
treeb34e784e5b84cf802a50fae6d1544aae4bd28b14 /src
parent8d27148bbd13fbc8192f9c5aeeb9b39b92f1045d (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/glx/x11/indirect.h7
-rw-r--r--src/glx/x11/indirect_size.h9
-rw-r--r--src/mesa/glapi/Makefile2
-rw-r--r--src/mesa/glapi/glX_proto_send.py11
-rw-r--r--src/mesa/glapi/glX_proto_size.py15
-rw-r--r--src/mesa/glapi/gl_XML.py8
-rw-r--r--src/mesa/glapi/gl_offsets.py11
-rw-r--r--src/mesa/glapi/gl_table.py6
-rw-r--r--src/mesa/glapi/glapioffsets.h6
-rw-r--r--src/mesa/glapi/glapitable.h6
10 files changed, 34 insertions, 47 deletions
diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h
index f5ffe1c483..cb14dbc75e 100644
--- a/src/glx/x11/indirect.h
+++ b/src/glx/x11/indirect.h
@@ -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_ ) */
diff --git a/src/glx/x11/indirect_size.h b/src/glx/x11/indirect_size.h
index 833e95b241..2001c56c4e 100644
--- a/src/glx/x11/indirect_size.h
+++ b/src/glx/x11/indirect_size.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_ ) */
diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile
index ba89550eda..9fad47e00a 100644
--- a/src/mesa/glapi/Makefile
+++ b/src/mesa/glapi/Makefile
@@ -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
diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py
index 7216b69972..146d662079 100644
--- a/src/mesa/glapi/glX_proto_send.py
+++ b/src/mesa/glapi/glX_proto_send.py
@@ -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
diff --git a/src/mesa/glapi/glX_proto_size.py b/src/mesa/glapi/glX_proto_size.py
index ecab65d3f0..cf0885a5a6 100644
--- a/src/mesa/glapi/glX_proto_size.py
+++ b/src/mesa/glapi/glX_proto_size.py
@@ -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()
diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py
index 16499df094..21f6dc0e62 100644
--- a/src/mesa/glapi/gl_XML.py
+++ b/src/mesa/glapi/gl_XML.py
@@ -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):
diff --git a/src/mesa/glapi/gl_offsets.py b/src/mesa/glapi/gl_offsets.py
index 3ff27e7d2a..f5bd7f40ed 100644
--- a/src/mesa/glapi/gl_offsets.py
+++ b/src/mesa/glapi/gl_offsets.py
@@ -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]
diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py
index d59d3de42a..49a8af7da4 100644
--- a/src/mesa/glapi/gl_table.py
+++ b/src/mesa/glapi/gl_table.py
@@ -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
diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h
index c4431a79a5..4bb255ee5c 100644
--- a/src/mesa/glapi/glapioffsets.h
+++ b/src/mesa/glapi/glapioffsets.h
@@ -26,8 +26,8 @@
* SOFTWARE.
*/
-#ifndef _GLAPI_OFFSETS_H_
-#define _GLAPI_OFFSETS_H_
+#if !defined( _GLAPI_OFFSETS_H_ )
+# define _GLAPI_OFFSETS_H_
#define _gloffset_NewList 0
#define _gloffset_EndList 1
@@ -829,4 +829,4 @@
#define _gloffset_StencilOpSeparate 797
#define _gloffset_StencilMaskSeparate 798
-#endif
+#endif /* !defined( _GLAPI_OFFSETS_H_ ) */
diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h
index 48692540d5..be6ca81acb 100644
--- a/src/mesa/glapi/glapitable.h
+++ b/src/mesa/glapi/glapitable.h
@@ -26,8 +26,8 @@
* SOFTWARE.
*/
-#ifndef _GLAPI_TABLE_H_
-#define _GLAPI_TABLE_H_
+#if !defined( _GLAPI_TABLE_H_ )
+# define _GLAPI_TABLE_H_
#ifndef GLAPIENTRYP
#define GLAPIENTRYP
@@ -836,4 +836,4 @@ struct _glapi_table
void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 798 */
};
-#endif
+#endif /* !defined( _GLAPI_TABLE_H_ ) */