summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2008-04-29 12:06:17 +0000
committerFrederic Peters <fpeters@entrouvert.com>2008-04-29 12:06:17 +0000
commitb02255125abeb60d01b8a506b50924afc7e9f808 (patch)
treefcee78a4a1918b95ce589d57b37c74acb7ce1175
parent3cf3d56d7f7aa54a1dabfa0decc40cd9f0adfa09 (diff)
downloadlasso-b02255125abeb60d01b8a506b50924afc7e9f808.tar.gz
lasso-b02255125abeb60d01b8a506b50924afc7e9f808.tar.xz
lasso-b02255125abeb60d01b8a506b50924afc7e9f808.zip
[project @ fpeters@0d.be-20071122125027-vw48yk2h353ijif8]
Don't bind lasso_*_destroy methods since they are just wrappers around g_object_unref which will be called properly from the bindings object destructor support. Also added support for a skip attribute to <func> in overrides (not used at the moment). Original author: Frederic Peters <fpeters@0d.be> Date: 2007-11-22 13:50:27.802000+01:00
-rw-r--r--bindings/bindings.py33
1 files changed, 21 insertions, 12 deletions
diff --git a/bindings/bindings.py b/bindings/bindings.py
index ae218de0..e8efb886 100644
--- a/bindings/bindings.py
+++ b/bindings/bindings.py
@@ -132,6 +132,7 @@ class Function:
args = None
docstring = None
return_owner = True
+ skip = False
def __repr__(self):
return '%s %s %r' % (self.return_type, self.name, self.args)
@@ -155,6 +156,8 @@ class Function:
self.rename = func.attrib.get('rename')
if func.attrib.get('return_owner'):
self.return_owner = (func.attrib.get('return_owner') != 'false')
+ if func.attrib.get('skip') == 'true':
+ self.skip = True
def normalise_var(type, name):
@@ -262,24 +265,30 @@ def parse_header(header_file):
m = re.match(r'LASSO_EXPORT\s+((?:const |)[\w]+\*?)\s+(\*?\w+)\s*\((.*?)\)', line)
if m and not m.group(2).endswith('_get_type'):
f = Function()
- binding.functions.append(f)
return_type, function_name, args = m.groups()
if function_name[0] == '*':
return_type += '*'
function_name = function_name[1:]
if return_type != 'void':
f.return_type = return_type
- f.name = function_name
- f.args = []
- for arg in [x.strip() for x in args.split(',')]:
- if arg == 'void' or arg == '':
- continue
- m = re.match(r'((const\s+)?\w+\*?)\s+(\*?\w+)', arg)
- if m:
- f.args.append(list(normalise_var(m.group(1), m.group(3))) + [{}])
- else:
- print 'failed to process:', arg, 'in line:', line
- f.apply_overrides()
+ if function_name.endswith('_destroy'):
+ # skip the _destroy functions, they are just wrapper over
+ # g_object_unref
+ pass
+ else:
+ f.name = function_name
+ f.args = []
+ for arg in [x.strip() for x in args.split(',')]:
+ if arg == 'void' or arg == '':
+ continue
+ m = re.match(r'((const\s+)?\w+\*?)\s+(\*?\w+)', arg)
+ if m:
+ f.args.append(list(normalise_var(m.group(1), m.group(3))) + [{}])
+ else:
+ print 'failed to process:', arg, 'in line:', line
+ f.apply_overrides()
+ if not f.skip:
+ binding.functions.append(f)
i += 1