aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/glx/reg.py
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-11-08 16:53:17 +0100
committermarha <marha@users.sourceforge.net>2013-11-08 16:53:17 +0100
commit3ef320ddf5d23b4e69cc7d44a17f902e245f6426 (patch)
tree93613bf53ec448c47fade975f70c4ec6b0051cb6 /xorg-server/hw/xwin/glx/reg.py
parentf707ea3ce065f0ce40f586c40283fab42059b485 (diff)
downloadvcxsrv-3ef320ddf5d23b4e69cc7d44a17f902e245f6426.tar.gz
vcxsrv-3ef320ddf5d23b4e69cc7d44a17f902e245f6426.tar.bz2
vcxsrv-3ef320ddf5d23b4e69cc7d44a17f902e245f6426.zip
Solved compilation and run-time problems after latest merge
Diffstat (limited to 'xorg-server/hw/xwin/glx/reg.py')
-rw-r--r--xorg-server/hw/xwin/glx/reg.py114
1 files changed, 60 insertions, 54 deletions
diff --git a/xorg-server/hw/xwin/glx/reg.py b/xorg-server/hw/xwin/glx/reg.py
index 37b9a8cb1..de28323d5 100644
--- a/xorg-server/hw/xwin/glx/reg.py
+++ b/xorg-server/hw/xwin/glx/reg.py
@@ -24,6 +24,12 @@
import io,os,re,string,sys
from lxml import etree
+def write( *args, **kwargs ):
+ file = kwargs.pop('file',sys.stdout)
+ end = kwargs.pop( 'end','\n')
+ file.write( ' '.join([str(arg) for arg in args]) )
+ file.write( end )
+
# noneStr - returns string argument, or "" if argument is None.
# Used in converting lxml Elements into text.
# str - string to convert
@@ -365,16 +371,16 @@ class OutputGenerator:
"""Log a message at the given level. Can be ignored or log to a file"""
if (level == 'error'):
strfile = io.StringIO()
- print('ERROR:', *args, file=strfile)
+ write('ERROR:', *args, file=strfile)
if (self.errFile != None):
- print(strfile.getvalue(), file=self.errFile)
+ write(strfile.getvalue(), file=self.errFile)
raise UserWarning(strfile.getvalue())
elif (level == 'warn'):
if (self.warnFile != None):
- print('WARNING:', *args, file=self.warnFile)
+ write('WARNING:', *args, file=self.warnFile)
elif (level == 'diag'):
if (self.diagFile != None):
- print('DIAG:', *args, file=self.diagFile)
+ write('DIAG:', *args, file=self.diagFile)
else:
raise UserWarning(
'*** FATAL ERROR in Generator.logMsg: unknown level:' + level)
@@ -504,7 +510,7 @@ class COutputGenerator(OutputGenerator):
return [ pdecl + paramdecl, tdecl + paramdecl ]
#
def newline(self):
- print('', file=self.outFile)
+ write('', file=self.outFile)
#
def beginFile(self, genOpts):
OutputGenerator.beginFile(self, genOpts)
@@ -513,42 +519,42 @@ class COutputGenerator(OutputGenerator):
# Multiple inclusion protection & C++ wrappers.
if (genOpts.protectFile and self.genOpts.filename):
headerSym = '__' + re.sub('\.h', '_h_', os.path.basename(self.genOpts.filename))
- print('#ifndef', headerSym, file=self.outFile)
- print('#define', headerSym, '1', file=self.outFile)
+ write('#ifndef', headerSym, file=self.outFile)
+ write('#define', headerSym, '1', file=self.outFile)
self.newline()
- print('#ifdef __cplusplus', file=self.outFile)
- print('extern "C" {', file=self.outFile)
- print('#endif', file=self.outFile)
+ write('#ifdef __cplusplus', file=self.outFile)
+ write('extern "C" {', file=self.outFile)
+ write('#endif', file=self.outFile)
self.newline()
#
# User-supplied prefix text, if any (list of strings)
if (genOpts.prefixText):
for s in genOpts.prefixText:
- print(s, file=self.outFile)
+ write(s, file=self.outFile)
#
# Some boilerplate describing what was generated - this
# will probably be removed later since the extensions
# pattern may be very long.
- print('/* Generated C header for:', file=self.outFile)
- print(' * API:', genOpts.apiname, file=self.outFile)
+ write('/* Generated C header for:', file=self.outFile)
+ write(' * API:', genOpts.apiname, file=self.outFile)
if (genOpts.profile):
- print(' * Profile:', genOpts.profile, file=self.outFile)
- print(' * Versions considered:', genOpts.versions, file=self.outFile)
- print(' * Versions emitted:', genOpts.emitversions, file=self.outFile)
- print(' * Default extensions included:', genOpts.defaultExtensions, file=self.outFile)
- print(' * Additional extensions included:', genOpts.addExtensions, file=self.outFile)
- print(' * Extensions removed:', genOpts.removeExtensions, file=self.outFile)
- print(' */', file=self.outFile)
+ write(' * Profile:', genOpts.profile, file=self.outFile)
+ write(' * Versions considered:', genOpts.versions, file=self.outFile)
+ write(' * Versions emitted:', genOpts.emitversions, file=self.outFile)
+ write(' * Default extensions included:', genOpts.defaultExtensions, file=self.outFile)
+ write(' * Additional extensions included:', genOpts.addExtensions, file=self.outFile)
+ write(' * Extensions removed:', genOpts.removeExtensions, file=self.outFile)
+ write(' */', file=self.outFile)
def endFile(self):
# C-specific
# Finish C++ wrapper and multiple inclusion protection
self.newline()
- print('#ifdef __cplusplus', file=self.outFile)
- print('}', file=self.outFile)
- print('#endif', file=self.outFile)
+ write('#ifdef __cplusplus', file=self.outFile)
+ write('}', file=self.outFile)
+ write('#endif', file=self.outFile)
if (self.genOpts.protectFile and self.genOpts.filename):
self.newline()
- print('#endif', file=self.outFile)
+ write('#endif', file=self.outFile)
# Finish processing in superclass
OutputGenerator.endFile(self)
def beginFeature(self, interface, emit):
@@ -568,29 +574,29 @@ class COutputGenerator(OutputGenerator):
if (self.emit):
self.newline()
if (self.genOpts.protectFeature):
- print('#ifndef', self.featureName, file=self.outFile)
- print('#define', self.featureName, '1', file=self.outFile)
+ write('#ifndef', self.featureName, file=self.outFile)
+ write('#define', self.featureName, '1', file=self.outFile)
if (self.typeBody != ''):
- print(self.typeBody, end='', file=self.outFile)
+ write(self.typeBody, end='', file=self.outFile)
#
# Don't add additional protection for derived type declarations,
# which may be needed by other features later on.
if (self.featureExtraProtect != None):
- print('#ifdef', self.featureExtraProtect, file=self.outFile)
+ write('#ifdef', self.featureExtraProtect, file=self.outFile)
if (self.enumBody != ''):
- print(self.enumBody, end='', file=self.outFile)
+ write(self.enumBody, end='', file=self.outFile)
if (self.genOpts.genFuncPointers and self.cmdPointerBody != ''):
- print(self.cmdPointerBody, end='', file=self.outFile)
+ write(self.cmdPointerBody, end='', file=self.outFile)
if (self.cmdBody != ''):
if (self.genOpts.protectProto):
- print('#ifdef', self.genOpts.protectProtoStr, file=self.outFile)
- print(self.cmdBody, end='', file=self.outFile)
+ write('#ifdef', self.genOpts.protectProtoStr, file=self.outFile)
+ write(self.cmdBody, end='', file=self.outFile)
if (self.genOpts.protectProto):
- print('#endif', file=self.outFile)
+ write('#endif', file=self.outFile)
if (self.featureExtraProtect != None):
- print('#endif /*', self.featureExtraProtect, '*/', file=self.outFile)
+ write('#endif /*', self.featureExtraProtect, '*/', file=self.outFile)
if (self.genOpts.protectFeature):
- print('#endif /*', self.featureName, '*/', file=self.outFile)
+ write('#endif /*', self.featureName, '*/', file=self.outFile)
# Finish processing in superclass
OutputGenerator.endFeature(self)
#
@@ -793,37 +799,37 @@ class Registry:
self.addElementInfo(feature, ei, 'extension', self.extdict)
def dumpReg(self, maxlen = 40, filehandle = sys.stdout):
"""Dump all the dictionaries constructed from the Registry object"""
- print('***************************************', file=filehandle)
- print(' ** Dumping Registry contents **', file=filehandle)
- print('***************************************', file=filehandle)
- print('// Types', file=filehandle)
+ write('***************************************', file=filehandle)
+ write(' ** Dumping Registry contents **', file=filehandle)
+ write('***************************************', file=filehandle)
+ write('// Types', file=filehandle)
for name in self.typedict:
tobj = self.typedict[name]
- print(' Type', name, '->', etree.tostring(tobj.elem)[0:maxlen], file=filehandle)
- print('// Groups', file=filehandle)
+ write(' Type', name, '->', etree.tostring(tobj.elem)[0:maxlen], file=filehandle)
+ write('// Groups', file=filehandle)
for name in self.groupdict:
gobj = self.groupdict[name]
- print(' Group', name, '->', etree.tostring(gobj.elem)[0:maxlen], file=filehandle)
- print('// Enums', file=filehandle)
+ write(' Group', name, '->', etree.tostring(gobj.elem)[0:maxlen], file=filehandle)
+ write('// Enums', file=filehandle)
for name in self.enumdict:
eobj = self.enumdict[name]
- print(' Enum', name, '->', etree.tostring(eobj.elem)[0:maxlen], file=filehandle)
- print('// Commands', file=filehandle)
+ write(' Enum', name, '->', etree.tostring(eobj.elem)[0:maxlen], file=filehandle)
+ write('// Commands', file=filehandle)
for name in self.cmddict:
cobj = self.cmddict[name]
- print(' Command', name, '->', etree.tostring(cobj.elem)[0:maxlen], file=filehandle)
- print('// APIs', file=filehandle)
+ write(' Command', name, '->', etree.tostring(cobj.elem)[0:maxlen], file=filehandle)
+ write('// APIs', file=filehandle)
for key in self.apidict:
- print(' API Version ', key, '->',
+ write(' API Version ', key, '->',
etree.tostring(self.apidict[key].elem)[0:maxlen], file=filehandle)
- print('// Extensions', file=filehandle)
+ write('// Extensions', file=filehandle)
for key in self.extdict:
- print(' Extension', key, '->',
+ write(' Extension', key, '->',
etree.tostring(self.extdict[key].elem)[0:maxlen], file=filehandle)
- # print('***************************************', file=filehandle)
- # print(' ** Dumping XML ElementTree **', file=filehandle)
- # print('***************************************', file=filehandle)
- # print(etree.tostring(self.tree.getroot(),pretty_print=True), file=filehandle)
+ # write('***************************************', file=filehandle)
+ # write(' ** Dumping XML ElementTree **', file=filehandle)
+ # write('***************************************', file=filehandle)
+ # write(etree.tostring(self.tree.getroot(),pretty_print=True), file=filehandle)
#
# typename - name of type
# required - boolean (to tag features as required or not)