summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-08-19 01:06:24 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-08-19 01:06:24 +0000
commitbb9387013343261d6a6c58e6a73d6204c6469de6 (patch)
treec85d3023bf9ecebfce5878fc88c03c0f17a85c97
parent8a033fa13514e3b78612ba1678182c9ea8290cd4 (diff)
simplify some python code
-rw-r--r--src/mesa/glapi/apiparser.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/mesa/glapi/apiparser.py b/src/mesa/glapi/apiparser.py
index 0c14ab9989..ffbaffc795 100644
--- a/src/mesa/glapi/apiparser.py
+++ b/src/mesa/glapi/apiparser.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# $Id: apiparser.py,v 1.1 2001/11/18 22:42:57 brianp Exp $
+# $Id: apiparser.py,v 1.2 2003/08/19 01:06:24 brianp Exp $
# Mesa 3-D graphics library
# Version: 4.1
@@ -71,6 +71,8 @@ def PrintRecord(name, returnType, argTypeList, argNameList, alias, offset):
#
def ProcessSpecFile(specFile, userFunc):
+ NO_OFFSET = -2
+
# init some vars
prevCategory = ''
funcName = ''
@@ -94,7 +96,7 @@ def ProcessSpecFile(specFile, userFunc):
if funcName != '':
# Verify entry has offset or alias
pnts = 0
- if offset == -2:
+ if offset == NO_OFFSET:
pnts = pnts + 1
if offset >= 0:
pnts = pnts + 1
@@ -115,27 +117,18 @@ def ProcessSpecFile(specFile, userFunc):
funcName = tokens[1]
elif tokens[0] == 'return':
- returnType = tokens[1]
- if len(tokens) > 2:
- returnType = returnType + ' ' + tokens[2]
- if len(tokens) > 3:
- returnType = returnType + ' ' + tokens[3]
+ returnType = string.join(tokens[1:], ' ')
elif tokens[0] == 'param':
argNameList.append(tokens[1])
- type = tokens[2]
- if len(tokens) > 3:
- type = type + ' ' + tokens[3]
- if len(tokens) > 4:
- type = type + ' ' + tokens[4]
- argTypeList.append(type)
+ argTypeList.append(string.join(tokens[2:], ' '))
elif tokens[0] == 'category':
category = tokens[1]
elif tokens[0] == 'offset':
if tokens[1] == '?':
- offset = -2
+ offset = NO_OFFSET
else:
offset = int(tokens[1])
if offset > maxOffset: