From bb9387013343261d6a6c58e6a73d6204c6469de6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 19 Aug 2003 01:06:24 +0000 Subject: [PATCH] simplify some python code --- src/mesa/glapi/apiparser.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/mesa/glapi/apiparser.py b/src/mesa/glapi/apiparser.py index 0c14ab99899..ffbaffc795f 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: -- 2.30.2