]> git.tdb.fi Git - gldbg.git/blobdiff - genenum.py
Consolidate genwrap.py and genenum.py into generate.py
[gldbg.git] / genenum.py
diff --git a/genenum.py b/genenum.py
deleted file mode 100755 (executable)
index c41d37a..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/python
-# $Id$
-
-import sys
-
-enums = []
-
-cur_categ = None
-for fn in sys.argv[1:]:
-       prefix = "GL_"
-       if '=' in fn:
-               fn, prefix = fn.split('=', 1)
-       for line in open(fn):
-               line = line.strip()
-               if not line or line[0]=='#':
-                       continue
-               elif line[-1]==':':
-                       parts = line[:-1].split()
-                       if parts[1]=="enum":
-                               cur_categ = parts[0]
-               elif cur_categ:
-                       parts = line.split()
-                       if parts[0]=="use":
-                               enums.append([None, cur_categ, prefix+parts[2]])
-                       elif parts[1]=="=":
-                               try:
-                                       enums.append([int(parts[2], 0), cur_categ, prefix+parts[0]])
-                               except ValueError, e:
-                                       sys.stderr.write("Syntax error in %s: %s\n"%(fn, e))
-
-for e in enums:
-       if e[0] is None:
-               for n in enums:
-                       if n[2]==e[2] and n[0] is not None:
-                               e[0] = n[0]
-               if e[0] is None:
-                       sys.stderr.write("Could not find value for enum reference %s in category %s\n"%(e[2], e[1]))
-
-enums.sort(lambda x, y: cmp(x[0], y[0])*2+cmp(x[1], y[1]))
-
-'''categs = set([e[2] for e in enums])
-for c in categs:
-       print c, reduce(lambda x, y: x^y, [ord(c[i])*(1<<i) for i in range(len(c))])'''
-
-print "EnumInfo enums[] ="
-print "{"
-for e in enums:
-       if e[0] is not None:
-               print "\t{ 0x%X, \"%s\", \"%s\" },"%(e[0], e[1], e[2])
-print "\t{ 0, 0, 0 }"
-print "};"
-print "unsigned enum_count = %d;"%len(enums)