From 20252d7c3013461387370de251f9f84b7ceed1b8 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Sat, 16 Aug 2008 22:26:55 +0000 Subject: [PATCH] Remove resolve_possible_typedefs, it was unused. Allow multiple enum 2008-08-17 Johan Dahlin * girepository/gtypelib.c (validate_enum_blob): * giscanner/glibtransformer.py: * giscanner/transformer.py: Remove resolve_possible_typedefs, it was unused. Allow multiple enum values of the sample value in an enum, since it's actually pretty common. Register enums so they can be resolved too. svn path=/trunk/; revision=389 --- ChangeLog | 10 ++++++++++ girepository/gtypelib.c | 3 +++ giscanner/glibtransformer.py | 4 ++-- giscanner/transformer.py | 8 +++----- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa6da16..88b11db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-08-17 Johan Dahlin + + * girepository/gtypelib.c (validate_enum_blob): + * giscanner/glibtransformer.py: + * giscanner/transformer.py: + Remove resolve_possible_typedefs, it was unused. + Allow multiple enum values of the sample value in an enum, + since it's actually pretty common. + Register enums so they can be resolved too. + 2008-08-16 Johan Dahlin * giscanner/girparser.py: diff --git a/girepository/gtypelib.c b/girepository/gtypelib.c index dd59844..c737120 100644 --- a/girepository/gtypelib.c +++ b/girepository/gtypelib.c @@ -1199,6 +1199,7 @@ validate_enum_blob (GTypelib *typelib, error)) return FALSE; +#if 0 v1 = (ValueBlob *)&typelib->data[offset + sizeof (EnumBlob) + i * sizeof (ValueBlob)]; for (j = 0; j < i; j++) @@ -1208,6 +1209,7 @@ validate_enum_blob (GTypelib *typelib, if (v1->value == v2->value) { + /* FIXME should this be an error ? */ g_set_error (error, G_TYPELIB_ERROR, @@ -1216,6 +1218,7 @@ validate_enum_blob (GTypelib *typelib, return FALSE; } } +#endif } return TRUE; diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py index 317754b..82b1958 100644 --- a/giscanner/glibtransformer.py +++ b/giscanner/glibtransformer.py @@ -182,7 +182,8 @@ class GLibTransformer(object): def _name_is_internal_gtype(self, giname): try: node = self._internal_types[giname] - return isinstance(node, (GLibObject, GLibInterface, GLibBoxed)) + return isinstance(node, (GLibObject, GLibInterface, GLibBoxed, + GLibEnum, GLibFlags)) except KeyError, e: return False @@ -399,7 +400,6 @@ class GLibTransformer(object): def _resolve_param_type(self, ptype): ptype.name = ptype.name.replace('*', '') type_name = ptype.name - type_name = self._transformer.resolve_possible_typedef(type_name) possible_node = self._internal_types.get(type_name) if possible_node: ptype.name = possible_node.name diff --git a/giscanner/transformer.py b/giscanner/transformer.py index 15039b6..72c1daa 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -48,7 +48,6 @@ class Transformer(object): self._ctype_names = {} # Maps from CType -> (namespace, node) self._typedefs_ns = {} self._strip_prefix = '' - self._typedefs = {} def get_type_names(self): return self._type_names @@ -59,9 +58,6 @@ class Transformer(object): def set_strip_prefix(self, strip_prefix): self._strip_prefix = strip_prefix - def resolve_possible_typedef(self, tname): - return self._typedefs.get(tname, tname) - def parse(self): nodes = [] for symbol in self.generator.get_symbols(): @@ -161,7 +157,9 @@ class Transformer(object): enum_name = self.strip_namespace_object(symbol.ident) enum_name = symbol.ident[-len(enum_name):] - return Enum(enum_name, symbol.ident, members) + enum = Enum(enum_name, symbol.ident, members) + self._type_names[symbol.ident] = (None, enum) + return enum def _create_object(self, symbol): return Member(symbol.ident, symbol.base_type.name, -- 2.7.4