commit 951de57d5d7f7f0820399cb1faec3b2f1310ee08
Author: Colin Walters <walters@verbum.org>
Date:   Wed Oct 15 17:57:07 2008 -0400

    Support Shadows:

diff --git a/girepository/girparser.c b/girepository/girparser.c
index 8e47ec9..52d767a 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -534,6 +534,7 @@ start_function (GMarkupParseContext *context,
 		GError             **error)
 {
   const gchar *name;
+  const gchar *shadows;
   const gchar *symbol;
   const gchar *deprecated;
   GIrNodeFunction *function;
@@ -566,7 +567,8 @@ start_function (GMarkupParseContext *context,
   name = find_attribute ("name", attribute_names, attribute_values);
   symbol = find_attribute ("c:identifier", attribute_names, attribute_values);
   deprecated = find_attribute ("deprecated", attribute_names, attribute_values);
-      
+  shadows = find_attribute ("shadows", attribute_names, attribute_values);
+
   if (name == NULL)
     {
       MISSING_ATTRIBUTE (context, error, element_name, "name");
@@ -579,8 +581,11 @@ start_function (GMarkupParseContext *context,
     }
 
   function = (GIrNodeFunction *) g_ir_node_new (G_IR_NODE_FUNCTION);
-      
-  ((GIrNode *)function)->name = g_strdup (name);
+
+  if (shadows != NULL)
+    ((GIrNode *)function)->name = g_strdup (shadows);
+  else
+    ((GIrNode *)function)->name = g_strdup (name);
   function->symbol = g_strdup (symbol);
   function->parameters = NULL;
   if (deprecated)
diff --git a/giscanner/ast.py b/giscanner/ast.py
index 8ee6f7a..055918f 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -157,11 +157,13 @@ class Namespace(Node):
 
 class Function(Node):
 
-    def __init__(self, name, retval, parameters, symbol):
+    def __init__(self, name, retval, parameters, symbol,
+                 shadows_symbol=None):
         Node.__init__(self, name)
         self.retval = retval
         self.parameters = parameters
         self.symbol = symbol
+        self.shadows_symbol = shadows_symbol
 
     def __repr__(self):
         return '%s(%r, %r, %r)' % (self.__class__.__name__,
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index 1ccbbef..766d797 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -105,6 +105,8 @@ class GIRWriter(XMLWriter):
         attrs = [('name', func.name),
                  ('c:identifier', func.symbol)]
         self._append_deprecated(func, attrs)
+        if func.shadows_symbol:
+            attrs.append(('shadows', func.shadows_symbol))
         with self.tagcontext(tag_name, attrs):
             self._write_return_type(func.retval)
             self._write_parameters(func.parameters)
diff --git a/giscanner/scannerlexer.l b/giscanner/scannerlexer.l
index dd02cb4..07ddc31 100644
--- a/giscanner/scannerlexer.l
+++ b/giscanner/scannerlexer.l
@@ -243,6 +243,12 @@ parse_gtkdoc (GISourceScanner *scanner,
       name = parts[0];
       value = NULL;
     }
+  else if (n_parts == 2 && g_ascii_strcasecmp (parts[0], "hadows") == 0)
+    {
+      options = g_slist_prepend (options, g_strdup (parts[1]));
+      name = parts[0];
+      value = NULL;
+    }
   else if (n_parts >= 2)
     {
       name = parts[0];
@@ -289,6 +295,8 @@ parse_gtkdoc (GISourceScanner *scanner,
     rname = "return";
   else if (g_ascii_strncasecmp ("eprecated", name, 9) == 0)
     rname = "deprecated";
+  else if (g_ascii_strncasecmp ("hadows", name, 6) == 0)
+    rname = "shadows";
   else
     rname = name;
 
@@ -341,7 +349,8 @@ parse_comment (GISourceScanner *scanner)
       if ((c1 != '*' && c1 != ' '))
           startofline = FALSE;
 
-      if (startofline && (c1 == ' ') && (c2 == '@' || (c2 == 'r') || (c2 == 'R') || (c2 == 'D')))
+      if (startofline && (c1 == ' ') && (c2 == '@' || (c2 == 'r') || (c2 == 'R') || (c2 == 'D')
+					 || c2 == 'S'))
         {
            c1 = c2;
            c2 = input();
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index c1609aa..0918a33 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -241,6 +241,12 @@ class Transformer(object):
                 # No version, just include str
                 node.deprecated = deprecated_value.strip()
 
+    def _parse_shadows(self, directives):
+        shadow = directives.get('shadows', None)
+        if shadow:
+            return shadow[0].strip()
+        return None
+
     def _pair_array(self, params, array):
         if not array.type.length_param_name:
             return
@@ -281,8 +287,9 @@ class Transformer(object):
         self._pair_annotations(parameters)
         return_ = self._create_return(symbol.base_type.base_type,
                                       directives.get('return', {}))
+        shadow_sym = self._parse_shadows(directives)
         name = self._strip_namespace_func(symbol.ident)
-        func = Function(name, return_, parameters, symbol.ident)
+        func = Function(name, return_, parameters, symbol.ident, shadow_sym)
         self._parse_deprecated(func, directives)
         return func
 
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
index 2bf78d1..d9c735f 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
@@ -100,7 +100,7 @@ post-check:
 
 %.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile
 	$(top_builddir)/tools/g-ir-compiler --includedir=. --includedir=$(top_builddir)/gir $< -o $@
-	$(SCANNER) --typelib-xml $< > $<.tmp && mv $<.tmp $<.txml
+	$(top_builddir)/tools/g-ir-generate --includedir=. $@ > $@.tmp && mv $@.tmp $@.txml
 
 check-local: pre-check
 check-local: $(CHECKGIRS) $(TYPELIBS)
diff --git a/tests/scanner/annotation-1.0-expected.gir b/tests/scanner/annotation-1.0-expected.gir
index fb16ff0..b6c2ae2 100644
--- a/tests/scanner/annotation-1.0-expected.gir
+++ b/tests/scanner/annotation-1.0-expected.gir
@@ -168,6 +168,39 @@
           <type name="GObject.Object" c:type="GObject*"/>
         </return-value>
       </method>
+      <method name="set" c:identifier="annotation_object_set">
+        <return-value>
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter>
+            <varargs>
+            </varargs>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="set_values"
+              c:identifier="annotation_object_set_values"
+              shadows="annotation_object_set">
+        <return-value>
+          <type name="none" c:type="void"/>
+        </return-value>
+        <parameters>
+          <parameter name="columns">
+            <array length="3" c:type="gint*">
+              <type name="int"/>
+            </array>
+          </parameter>
+          <parameter name="values">
+            <array length="3" c:type="GValue*">
+              <type name="GObject.Value"/>
+            </array>
+          </parameter>
+          <parameter name="n_values">
+            <type name="int" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
       <field name="parent_instance">
         <type name="GObject.Object" c:type="GObject"/>
       </field>
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
index ecffd52..0e3f6f5 100644
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -263,4 +263,40 @@ annotation_object_do_not_use (AnnotationObject *object)
   return NULL;
 }
 
+/**
+ * annotation_object_set_columns: 
+ * @object: a #GObject
+ *
+ **/
+void
+annotation_object_set_columns (AnnotationObject *object, ...)
+{
+}
+
+/**
+ * annotation_object_set:
+ * @object: a #GObject
+ *
+ **/
+void
+annotation_object_set (AnnotationObject *object, ...)
+{
+}
+
+/**
+ * annotation_object_set_values:
+ * @object: a #GObject
+ * @columns: (array length=n_values): column numbers
+ * @values: (array length=n_values): values to set
+ * @n_values: Length of arrays
+ *
+ * Shadows: annotation_object_set
+ **/
+void
+annotation_object_set_values (AnnotationObject *object,
+			      gint *columns,
+			      GValue *values, gint n_values)
+{
+}
+
 static char backslash_parsing_tester_2 = '\\';
diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h
index 57c0f85..1d28e7c 100644
--- a/tests/scanner/annotation.h
+++ b/tests/scanner/annotation.h
@@ -52,5 +52,10 @@ void     annotation_object_compute_sum_n(AnnotationObject *object,
 
 GObject* annotation_object_do_not_use   (AnnotationObject *object);
 
+void annotation_object_set (AnnotationObject *object, ...);
+
+void annotation_object_set_values (AnnotationObject *object,
+				   gint *columns,
+				   GValue *values, gint n_values);
 
 #endif /* __ANNOTATION_OBJECT_H__ */
