[C++-sig] Pyste bugs again
Niall Douglas
s_sourceforge at nedprod.com
Fri Sep 19 04:09:28 CEST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I hate to be a bore but the patches I submitted here last time have
not been implemented in the latest CVS version.
This means that quite simply pyste DOES NOT WORK on MSVC.
Bug 1: Declaring an unnamed namespace in the pyste output causes
MSVC7.1 to gobble memory until infinity.
My solution: Alter Save() in SingleCodeUnit.py:
if declaration:
pyste_namespace = namespaces.pyste[:-2]
if pyste_namespace:
fout.write('namespace %s {\n\n' %
pyste_namespace)
fout.write(declaration)
if pyste_namespace:
fout.write('\n}// namespace %s\n' %
pyste_namespace)
fout.write(space)
This simply doesn't write out a namespace declaration if it's
unnamed.
Bug 2: Unnamed enums are still being called "$_xx". MSVC does not
like symbols starting with $. Furthermore the export_values()
facility is still not being employed.
My solution: Alter Export() in EnumExporter.py:
def Export(self, codeunit, exported_names):
if not self.info.exclude:
indent = self.INDENT
in_indent = self.INDENT*2
rename = self.info.rename or self.enum.name
full_name = self.enum.FullName()
if rename[0:2] == "$_" or rename == '._0':
global uniqueTypeCount
full_name = 'UniqueInt<%d>' % uniqueTypeCount
uniqueTypeCount+=1
rename = "unnamed"
code = indent + namespaces.python
code += 'enum_< %s >("%s")\n' % (full_name, rename)
for name in self.enum.values:
rename = self.info[name].rename or name
value_fullname = self.enum.ValueFullName(name)
code += in_indent + '.value("%s", %s)\n' % (rename,
value_fullname)
code += in_indent + '.export_values();\n\n'
codeunit.Write('module', code)
exported_names[self.enum.FullName()] = 1
Cheers,
Niall
-----BEGIN PGP SIGNATURE-----
Version: idw's PGP-Frontend 4.9.6.1 / 9-2003 + PGP 8.0.2
iQA/AwUBP2plW8EcvDLFGKbPEQKhxwCeMhcUiZhmxh/1y1+k+0RX9YTnBrEAn0ep
pYXNrv6LWpAcH4zV6LaZvqhl
=3YE9
-----END PGP SIGNATURE-----
More information about the Cplusplus-sig
mailing list