[VARARGS FIELDS] - support blanking of fields which are varargs callbacks.
authorAlan Knowles <alan@akbkhome.com>
Sat, 3 Apr 2010 06:41:14 +0000 (14:41 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sat, 3 Apr 2010 06:41:14 +0000 (14:41 +0800)
support for various wierd libraries that do this.

girepository/girparser.c

index c45ac78..4b4d1be 100644 (file)
@@ -3264,6 +3264,46 @@ post_filter_varargs_functions (GList *list, GList ** varargs_callbacks_out)
                }
            }
        }
+
+       if (node->type == G_IR_NODE_FIELD)
+          {
+           /*
+               this is a field, if the member is a blacklisted callback, 
+               then we need to flag it as to be generated as a void*
+            */
+           GIrNodeField *fnode = (GIrNodeField *)node;
+           GIrNodeType * tnode;
+           GList *match;
+
+           if (!fnode->type)
+              continue;
+           
+           tnode = (GIrNodeType *)fnode->type;
+            /* field is not an interface. */
+           if (!tnode->is_interface)
+             continue;
+             
+           match = node_find_in_list(
+                       varargs_callbacks, tnode->interface);
+
+            if (!match)
+             continue;
+
+           /*
+               we now have a field which is pointing to an blacklisted callback.
+              so need modify the type so it points to void* and
+               is not read/or writable.
+            */
+           fnode->readable = FALSE;
+           fnode->writable = FALSE;
+           
+           tnode->tag          = GI_TYPE_TAG_VOID;
+           tnode->is_interface = FALSE;
+           tnode->is_pointer   = TRUE;
+           tnode->is_basic     = TRUE;
+         }
+
+        
     }
 
   *varargs_callbacks_out = varargs_callbacks;