Fixes by Thomas Heller:

- make the selftests work again (they were apparently not used since
  very early in bgen's development), with some minor cleanup by me
- make emacs python mode happier
This commit is contained in:
Jack Jansen 2001-08-27 14:30:55 +00:00
parent 06bd3234cb
commit 9403591014
5 changed files with 13 additions and 12 deletions

View File

@ -259,12 +259,12 @@ class MethodGenerator(FunctionGenerator):
def _test():
void = None
eggs = Generator(void, "eggs",
Variable(stringptr, 'cmd'),
Variable(int, 'x'),
Variable(double, 'y', InOutMode),
Variable(int, 'status', ErrorMode),
)
eggs = FunctionGenerator(void, "eggs",
(stringptr, 'cmd', InMode),
(int, 'x', InMode),
(double, 'y', InOutMode),
(int, 'status', ErrorMode),
)
eggs.setprefix("spam")
print "/* START */"
eggs.generate()

View File

@ -28,9 +28,10 @@ class GeneratorGroup:
def _test():
from bgenGenerator import Generator
void = None
from bgenGenerator import FunctionGenerator
group = GeneratorGroup("spam")
eggs = Generator(void, "eggs")
eggs = FunctionGenerator(void, "eggs")
group.add(eggs)
print "/* START */"
group.generate()

View File

@ -78,9 +78,9 @@ class Module(GeneratorGroup):
def _test():
from bgenGenerator import Generator
from bgenGenerator import FunctionGenerator
m = Module("spam", "", "#include <stdio.h>")
g = Generator(None, "bacon")
g = FunctionGenerator(None, "bacon")
m.add(g)
m.generate()

View File

@ -189,7 +189,7 @@ class ObjectDefinition(GeneratorGroup):
Output("""if (PyDict_SetItemString(d, "%sType", (PyObject *)&%s) != 0)""",
self.name, self.typename);
IndentLevel()
Output("""Py_FatalError("can't initialize %sType");""",
Output("""Py_FatalError("can\'t initialize %sType");""",
self.name)
DedentLevel()

View File

@ -43,7 +43,7 @@ SetOutputFile() # Initialize _File
_Level = 0 # Indentation level
def GetLevel():
""""Return the current indentation level."""
"""Return the current indentation level."""
return _Level
def SetLevel(level):