scanner: support stability tag
authorEvan Nemerson <evan@coeus-group.com>
Tue, 10 Jul 2012 20:59:23 +0000 (13:59 -0700)
committerEvan Nemerson <evan@coeus-group.com>
Tue, 10 Jul 2012 21:52:25 +0000 (14:52 -0700)
https://bugzilla.gnome.org/show_bug.cgi?id=679160

giscanner/ast.py
giscanner/girwriter.py
giscanner/maintransformer.py
tests/scanner/Regress-1.0-expected.gir
tests/scanner/regress.c
tests/scanner/regress.h

index 6945d60..7fa75ed 100644 (file)
@@ -480,6 +480,7 @@ properties."""
         self.skip = False
         self.introspectable = True
         self.attributes = [] # (key, value)*
+        self.stability = None
         self.deprecated = None
         self.deprecated_version = None
         self.doc = None
index cb13d21..0f5c700 100644 (file)
@@ -145,6 +145,8 @@ and/or use gtk-doc annotations. ''')
             if node.deprecated_version:
                 attrs.append(('deprecated-version',
                               node.deprecated_version))
+        if node.stability:
+            attrs.append(('stability', node.stability))
 
     def _append_throws(self, func, attrs):
         if func.throws:
index 8723875..77a66d2 100644 (file)
@@ -24,7 +24,8 @@ from . import message
 from .annotationparser import (TAG_VFUNC, TAG_SINCE, TAG_DEPRECATED, TAG_RETURNS,
                                TAG_ATTRIBUTES, TAG_RENAME_TO, TAG_TYPE,
                                TAG_UNREF_FUNC, TAG_REF_FUNC, TAG_SET_VALUE_FUNC,
-                               TAG_GET_VALUE_FUNC, TAG_VALUE, TAG_TRANSFER)
+                               TAG_GET_VALUE_FUNC, TAG_VALUE, TAG_TRANSFER,
+                               TAG_STABILITY)
 from .annotationparser import (OPT_ALLOW_NONE, OPT_ARRAY, OPT_ATTRIBUTE,
                                OPT_ELEMENT_TYPE, OPT_IN, OPT_INOUT,
                                OPT_INOUT_ALT, OPT_OUT, OPT_SCOPE,
@@ -617,6 +618,15 @@ usage is void (*_gtk_reserved1)(void);"""
             if version is not None:
                 node.deprecated_version = version
 
+        stability_tag = block.get_tag(TAG_STABILITY)
+        if stability_tag is not None:
+            stability = stability_tag.value.capitalize()
+            if stability in ["Stable", "Unstable", "Private", "Internal"]:
+                node.stability = stability
+            else:
+                message.warn('unknown value "%s" for Stability tag' % (
+                    stability_tag.value), stability_tag.position)
+
         annos_tag = block.get_tag(TAG_ATTRIBUTES)
         if annos_tag is not None:
             for key, value in annos_tag.options.iteritems():
index 631dd98..e5d8b5a 100644 (file)
@@ -3482,5 +3482,15 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d
         </parameter>
       </parameters>
     </function>
+    <function name="test_versioning"
+              c:identifier="regress_test_versioning"
+              version="1.32.1"
+              deprecated="Use foobar instead"
+              deprecated-version="1.33.3"
+              stability="Unstable">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+    </function>
   </namespace>
 </repository>
index 6ba2bdf..1f58d19 100644 (file)
@@ -3812,3 +3812,15 @@ regress_has_parameter_named_attrs (int        foo,
                                    gpointer   attributes)
 {
 }
+
+/**
+ * regress_test_versioning:
+ *
+ * Since: 1.32.1
+ * Deprecated: 1.33.3: Use foobar instead
+ * Stability: Unstable
+ */
+void
+regress_test_versioning ()
+{
+}
index fd937cd..112d935 100644 (file)
@@ -137,6 +137,9 @@ cairo_surface_t *regress_test_cairo_surface_full_return (void);
 void regress_test_cairo_surface_none_in (cairo_surface_t *surface);
 void regress_test_cairo_surface_full_out (cairo_surface_t **surface);
 
+/* versioning (deprecated, since, stability) */
+void regress_test_versioning ();
+
 GVariant *regress_test_gvariant_i (void);
 GVariant *regress_test_gvariant_s (void);
 GVariant *regress_test_gvariant_asv (void);