aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mapi/glapi/gen/gl_enums.py
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-11-29 22:05:53 +0000
committermarha <marha@users.sourceforge.net>2010-11-29 22:05:53 +0000
commitfed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7 (patch)
treefa1ba494685a71e28a096990a8707680c7cb378b /mesalib/src/mapi/glapi/gen/gl_enums.py
parentae340911c1ba1f98b418bd8f1a487fa4d79491b0 (diff)
parent6fda93be42ace9eeab0e82ceebb6798961c9105c (diff)
downloadvcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.tar.gz
vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.tar.bz2
vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mapi/glapi/gen/gl_enums.py')
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_enums.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py
index 3a9ea3c86..0caa01030 100644
--- a/mesalib/src/mapi/glapi/gen/gl_enums.py
+++ b/mesalib/src/mapi/glapi/gen/gl_enums.py
@@ -105,7 +105,8 @@ const char *_mesa_lookup_enum_by_nr( int nr )
}
else {
/* this is not re-entrant safe, no big deal here */
- sprintf(token_tmp, "0x%x", nr);
+ _mesa_snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr);
+ token_tmp[sizeof(token_tmp) - 1] = '\\0';
return token_tmp;
}
}
@@ -151,8 +152,10 @@ int _mesa_lookup_enum_by_name( const char *symbol )
return
- def printBody(self, api):
- self.process_enums( api )
+ def printBody(self, api_list):
+ self.enum_table = {}
+ for api in api_list:
+ self.process_enums( api )
keys = self.enum_table.keys()
keys.sort()
@@ -209,16 +212,20 @@ int _mesa_lookup_enum_by_name( const char *symbol )
def process_enums(self, api):
- self.enum_table = {}
-
for obj in api.enumIterateByName():
if obj.value not in self.enum_table:
self.enum_table[ obj.value ] = []
+ enum = self.enum_table[ obj.value ]
name = "GL_" + obj.name
priority = obj.priority()
- self.enum_table[ obj.value ].append( [name, priority] )
+ already_in = False;
+ for n, p in enum:
+ if n == name:
+ already_in = True
+ if not already_in:
+ enum.append( [name, priority] )
def show_usage():
@@ -226,18 +233,16 @@ def show_usage():
sys.exit(1)
if __name__ == '__main__':
- file_name = "gl_API.xml"
-
try:
(args, trail) = getopt.getopt(sys.argv[1:], "f:")
except Exception,e:
show_usage()
+ api_list = []
for (arg,val) in args:
if arg == "-f":
- file_name = val
-
- api = gl_XML.parse_GL_API( file_name )
+ api = gl_XML.parse_GL_API( val )
+ api_list.append(api);
printer = PrintGlEnums()
- printer.Print( api )
+ printer.Print( api_list )