#
import os
+import sys
from .ast import (Bitfield, Callback, Enum, Function, Namespace, Member,
Parameter, Return, Struct, Field,
path = os.path.join(d, girname)
if os.path.exists(path):
return path
- raise ValueError("Couldn't find include %r (search path: %r)"\
+ sys.stderr.write("Couldn't find include %r (search path: %r)\n"\
% (girname, searchdirs))
+ sys.exit(1)
def _parse_include(self, filename):
parser = self._cachestore.load(filename)
return False
def _handle_destroy(self, param, destroy_idx, destroy_param):
- if ((self._namespace.name == 'GLib' and
- destroy_param.type.name == 'DestroyNotify') or
- destroy_param.type.name == 'GLib.DestroyNotify'):
+ if (destroy_param.type.name == 'GLib.DestroyNotify' or
+ destroy_param.type.ctype == 'GDestroyNotify'):
param.destroy_name = destroy_param.name
param.destroy_index = destroy_idx
return True
if not self._type_is_callback(param.type):
continue
+ # set a default scope
+ if param.scope is None:
+ param.scope = 'call'
+
# j is the index where we look for closure/destroy to
# group with the callback param
j = i + 1
else:
break
return type_name
+
+ def iter_enums(self):
+ for node in self._namespace.nodes:
+ if isinstance(node, Enum):
+ yield node