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:
parent
06bd3234cb
commit
9403591014
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue