[VAR_ARGS_PARSER] Parser Handling of va_list args as properties
authorAlan Knowles <alan@akbkhome.com>
Sat, 3 Apr 2010 10:14:38 +0000 (18:14 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sat, 3 Apr 2010 10:14:38 +0000 (18:14 +0800)
Affects libgsf from what I remember.

giscanner/transformer.py

index bbcabe4..87be006 100644 (file)
@@ -47,6 +47,8 @@ _xdg_data_dirs = [x for x in os.environ.get('XDG_DATA_DIRS', '').split(':') \
 class SkipError(Exception):
     pass
 
+class VaListSkipError(SkipError):
+    pass
 
 class Names(object):
     names = property(lambda self: self._names)
@@ -357,7 +359,17 @@ class Transformer(object):
         source_type = symbol.base_type
         if (source_type.type == CTYPE_POINTER and
             symbol.base_type.base_type.type == CTYPE_FUNCTION):
-            node = self._create_callback(symbol)
+            try:
+                node = self._create_callback(symbol)
+            except VaListSkipError:
+                #this handles va_list members, and converts them
+                #to unwritable, unreadable void*
+                ftype = Type("any", "void*")
+                ftype = self.resolve_param_type(ftype)
+                node = Field(symbol.ident, ftype, ftype.name,
+                         readable=False, writable=False, bits=symbol.const_int)
+
+
         elif source_type.type == CTYPE_STRUCT and source_type.name is None:
             node = self._create_struct(symbol, anonymous=True)
         elif source_type.type == CTYPE_UNION and source_type.name is None:
@@ -464,7 +476,7 @@ class Transformer(object):
     def _create_type(self, source_type, is_param, is_retval):
         ctype = self._create_source_type(source_type)
         if ctype.startswith('va_list'):
-            raise SkipError()
+            raise VaListSkipError()
         # FIXME: FILE* should not be skipped, it should be handled
         #        properly instead
         elif ctype == 'FILE*':