summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcodegen/codegen.py9
-rw-r--r--codegen/definitions.py10
2 files changed, 14 insertions, 5 deletions
diff --git a/codegen/codegen.py b/codegen/codegen.py
index bf5dfc5..73324a5 100755
--- a/codegen/codegen.py
+++ b/codegen/codegen.py
@@ -249,10 +249,11 @@ class Wrapper:
def get_initial_class_substdict(self): return {}
def get_initial_constructor_substdict(self, constructor):
- return { 'name': '%s.__init__' % self.objinfo.c_name,
+ return { 'name': '%s.__init__' % self.objinfo.py_name,
'errorreturn': '-1' }
+
def get_initial_method_substdict(self, method):
- substdict = { 'name': '%s.%s' % (self.objinfo.c_name, method.name) }
+ substdict = { 'name': '%s.%s' % (self.objinfo.py_name, method.name) }
if method.unblock_threads:
substdict['begin_allow_threads'] = 'pyg_begin_allow_threads;'
substdict['end_allow_threads'] = 'pyg_end_allow_threads;'
@@ -467,7 +468,7 @@ class Wrapper:
def _get_class_virtual_substdict(self, meth, cname, parent):
substdict = self.get_initial_method_substdict(meth)
- substdict['virtual'] = substdict['name'].split('.')[1]
+ substdict['virtual'] = meth.name
substdict['cname'] = cname
substdict['class_cast_macro'] = parent.typecode.replace(
'_TYPE_', '_', 1) + "_CLASS"
@@ -1133,7 +1134,7 @@ class GInterfaceWrapper(GObjectWrapper):
def _get_class_virtual_substdict(self, meth, cname, parent):
substdict = self.get_initial_method_substdict(meth)
- substdict['virtual'] = substdict['name'].split('.')[1]
+ substdict['virtual'] = meth.name
substdict['cname'] = cname
substdict['typecode'] = self.objinfo.typecode
substdict['vtable'] = self.objinfo.vtable
diff --git a/codegen/definitions.py b/codegen/definitions.py
index 88b6cdb..aca5adb 100644
--- a/codegen/definitions.py
+++ b/codegen/definitions.py
@@ -60,15 +60,23 @@ class Property(object):
self.argname = old.argname
-class Definition:
+class Definition(object):
docstring = "NULL"
+
+ def py_name(self):
+ return '%s.%s' % (self.module, self.name)
+
+ py_name = property(py_name)
+
def __init__(self, *args):
"""Create a new defs object of this type. The arguments are the
components of the definition"""
raise RuntimeError, "this is an abstract class"
+
def merge(self, old):
"""Merge in customisations from older version of definition"""
raise RuntimeError, "this is an abstract class"
+
def write_defs(self, fp=sys.stdout):
"""write out this definition in defs file format"""
raise RuntimeError, "this is an abstract class"