[gobject-introspection] Update RelaxNG schema to validate all common girs



commit 7baef5d317ceda2d8af153b6e48e962a08d04a5e
Author: Christoph Reiter <creiter src gnome org>
Date:   Thu May 12 12:29:28 2016 +0200

    Update RelaxNG schema to validate all common girs
    
    This updates the schema to validate all GIRs currently
    available in Debian unstable except a few obviously broken ones.
    
    For testing the following tools were used:
      $ trang gir-1.2.rnc gir-1.2.rng
      $ xmllint --noout --relaxng gir-1.2.rng Gtk-3.0.gir
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766313

 docs/gir-1.2.rnc |  510 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 379 insertions(+), 131 deletions(-)
---
diff --git a/docs/gir-1.2.rnc b/docs/gir-1.2.rnc
index 7ff6f00..f75893b 100644
--- a/docs/gir-1.2.rnc
+++ b/docs/gir-1.2.rnc
@@ -1,4 +1,4 @@
-namespace core = "http://www.gtk.org/introspection/core/1.0";
+default namespace core = "http://www.gtk.org/introspection/core/1.0";
 namespace c = "http://www.gtk.org/introspection/c/1.0";
 namespace glib = "http://www.gtk.org/introspection/glib/1.0";
 
@@ -7,225 +7,473 @@ grammar {
 
   Repository =
     element repository {
-      Include*
-      & Package*
-      & Alias*
-      & Class*
-      & Record*
-      & Enum*
-      & Function*
+      attribute version { xsd:string }?,
+      attribute c:identifier-prefixes { xsd:string }?,
+      attribute c:symbol-prefixes { xsd:string }?,
+
+      (Include*
+       & CInclude*
+       & Package*
+       & Namespace*)
+    }
+
+  Namespace =
+    element namespace {
+      attribute name { xsd:string }?,
+      attribute version { xsd:string }?,
+      attribute c:identifier-prefixes { xsd:string }?,
+      attribute c:symbol-prefixes { xsd:string }?,
+      attribute c:prefix { xsd:string }?,
+      attribute shared-library { xsd:string }?,
+
+      (Alias*
+       & Class*
+       & Interface*
+       & Record*
+       & Enum*
+       & Function*
+       & Union*
+       & BitField*
+       & Callback*
+       & Constant*
+       & Annotation*
+       & Boxed*)
+    }
+
+  Annotation =
+    element annotation {
+      attribute key { xsd:string },
+      attribute value { xsd:string }
+    }
+
+  CInclude =
+    element c:include {
+      attribute name { xsd:string },
+
+      empty
     }
 
   Include =
-    element \include {
-      attribute name { xsd:string }
-      attribute version { xsd:string }
+    element include {
+      attribute name { xsd:string },
+      attribute version { xsd:string }?,
+
       empty
     }
 
   Package =
     element package {
-      attribute name { xsd:string }
+      attribute name { xsd:string },
+
       empty
     }
 
   Alias =
     element alias {
-      attribute name { xsd:string }
-      attribute c:type { xsd:string }
-      attribute introspectable { string "0" }?
+      Info.attrs,
+      attribute name { xsd:string },
+      attribute c:type { xsd:string },
+
+      (Info.elements
+       & Type)
+    }
 
-      Doc?
-      & Type
+  Interface =
+    element interface {
+      Info.attrs,
+      attribute name { xsd:string },
+      attribute glib:type-name { xsd:string },
+      attribute glib:get-type { xsd:string },
+
+      attribute c:symbol-prefix { xsd:string }?,
+      attribute c:type { xsd:string }?,
+      attribute glib:type-struct { xsd:string }?,
+
+      (Info.elements
+       & Prerequisite*
+       & Implements*
+       & Function*
+       & Constructor?
+       & Method*
+       & VirtualMethod*
+       & Field*
+       & Property*
+       & Signal*
+       & Callback*
+       & Constant*)
     }
 
   Class =
     element class {
-      attribute name { xsd:string }
-      attribute c:symbol-prefix { xsd:string }
-      attribute c:type { xsd:string }
-      attribute parent { xsd:string }
-      attribute glib:type-name { xsd:string }
-      attribute glib:get-type { xsd:string }
-      attribute glib:type-struct { xsd:string }
-      attribute introspectable { string "0" }?
-
-      Doc?
-      & DocDeprecated?
-      & Implements*
-      & Constructor?
-      & Method*
-      & Field*
-      & Property*
-      & Signal*
+      Info.attrs,
+      attribute name { xsd:string },
+      attribute glib:type-name { xsd:string },
+      attribute glib:get-type { xsd:string },
+
+      attribute parent { xsd:string }?,
+      attribute glib:type-struct { xsd:string }?,
+      attribute glib:ref-func { xsd:string }?,
+      attribute glib:unref-func { xsd:string }?,
+      attribute glib:set-value-func { xsd:string }?,
+      attribute glib:get-value-func { xsd:string }?,
+      attribute c:type { xsd:string }?,
+      attribute c:symbol-prefix { xsd:string }?,
+      attribute abstract { "0" | "1" }?,
+      attribute glib:fundamental { "0" | "1" }?,
+
+      (Info.elements
+       & Implements*
+       & Constructor*
+       & Method*
+       & Function*
+       & VirtualMethod*
+       & Field*
+       & Property*
+       & Signal*
+       & Union*
+       & Constant*
+       & Record*
+       & Callback*)
+    }
+
+  Boxed =
+    element glib:boxed {
+      Info.attrs,
+      attribute glib:name { xsd:string },
+
+      attribute c:symbol-prefix { xsd:string }?,
+      attribute glib:type-name { xsd:string }?,
+      attribute glib:get-type { xsd:string }?,
+
+      (Info.elements
+       & Function*)
     }
 
   Record =
     element record {
-      attribute name { xsd:string }
-      attribute version { xsd:string }?
-      attribute c:type { xsd:string }
-      attribute disguised { xsd:string }?
-      attribute glib:is-gtype-struct-for { xsd:string }?
-      attribute introspectable { string "0" }?
+      Info.attrs,
+      attribute name { xsd:string },
+
+      attribute c:type { xsd:string }?,
+      attribute disguised { "0" | "1" }?,
+      attribute glib:type-name { xsd:string }?,
+      attribute glib:get-type { xsd:string }?,
+      attribute c:symbol-prefix { xsd:string }?,
+      attribute foreign { "0" | "1" }?,
+      attribute glib:is-gtype-struct-for { xsd:string }?,
+
+      (Info.elements
+       & Field*
+       & Function*
+       & Union*
+       & Method*
+       & Constructor*
+       & Property*)
+    }
 
-      Field*
+  Info.attrs = (
+    attribute introspectable { "0" | "1" }?,
+    attribute deprecated { xsd:string }?,
+    attribute deprecated-version { xsd:string }?,
+    attribute version { xsd:string }?,
+    attribute stability { xsd:string }?
+  )
+
+  DocElements = (
+    element doc-version {
+      attribute xml:space { "preserve" }?,
+      attribute xml:whitespace { "preserve" }?,
+
+      text
+    }?
+    & element doc-stability {
+      attribute xml:space { "preserve" }?,
+      attribute xml:whitespace { "preserve" }?,
+
+      text
+    }?
+    & element doc {
+      attribute xml:space { "preserve" }?,
+      attribute xml:whitespace { "preserve" }?,
+
+      text
+    }?
+    & element doc-deprecated {
+      attribute xml:space { "preserve" }?,
+      attribute xml:whitespace { "preserve" }?,
+
+      text
+    }?
+  )
+
+  Info.elements = (
+    DocElements
+    & Annotation*
+  )
+
+  Constant =
+    element constant {
+        Info.attrs,
+        attribute name { xsd:string },
+        attribute value { xsd:string },
+        attribute c:type { xsd:string }?,
+        attribute c:identifier { xsd:string }?,
+
+        (Info.elements
+         & AnyType?)
     }
 
   Property =
     element property {
-      attribute name { xsd:string }
-      attribute version { xsd:string }?
-      attribute writable { string "0" | string "1" }?
-      attribute readable { string "0" | string "1" }?
+      Info.attrs,
+      attribute name { xsd:string },
 
-      Doc?
-      & DocDeprecated?
-      & Type
+      attribute writable { "0" | "1" }?,
+      attribute readable { "0" | "1" }?,
+      attribute construct { "0" | "1" }?,
+      attribute construct-only { "0" | "1" }?,
+      TransferOwnership?,
+
+      (Info.elements
+       & AnyType)
     }
 
   Signal =
     element glib:signal {
-      attribute name { xsd:string }
-      attribute version { xsd:string }?
-      attribute when { string "first" | string "last" }
-      attribute no-recurse { xsd:string }?
-
-      Doc?
-      & DocDeprecated
-      & Callable.params?
-      & Callable.return?
+      Info.attrs,
+      attribute name { xsd:string },
+
+      attribute detailed { "0" | "1" }?,
+      attribute when { "first" | "last" | "cleanup" }?,
+      attribute action { "0" | "1" }?,
+      attribute no-hooks { "0" | "1" }?,
+      attribute no-recurse { "0" | "1" }?,
+
+      (Info.elements
+       & Callable.params?
+       & Callable.return?)
     }
 
   Field =
     element field {
-      attribute name { xsd:string }
-      attribute introspectable { xsd:string }?
+      Info.attrs,
+      attribute name { xsd:string },
 
-      Type
-      | Callback
+      attribute writable { "0" | "1" }?,
+      attribute readable { "0" | "1" }?,
+      attribute private { "0" | "1" }?,
+      attribute bits { xsd:integer }?,
+
+      (Info.elements
+       & (Callback | AnyType))
     }
 
   Callback =
     element callback {
-      attribute name { xsd:string }
-      attribute introspectable { xsd:string }
+      Info.attrs,
+      attribute name { xsd:string },
 
-      Callable.params?
-      & Callable.return?
+      attribute c:type { xsd:string }?,
+      attribute throws { "0" | "1" }?,
 
-  Doc =
-    element doc { text }
-
-  DocDeprecated =
-    element doc-deprecated { text }
+      (Info.elements
+       & Callable.params?
+       & Callable.return?)
+    }
 
   Implements  =
-    element implements { attribute name { xsd:string } }
+    element implements {
+      attribute name { xsd:string }
+    }
+
+  Prerequisite  =
+    element prerequisite {
+      attribute name { xsd:string }
+    }
+
+  AnyType = (Type | ArrayType)
 
   Type =
     element type {
-      attribute name { xsd:string }
-      attribute c:type { xsd:string }
-      attribute introspectable { xsd:string }?
-      empty
+      attribute name { xsd:string }?,
+      attribute c:type { xsd:string }?,
+      attribute introspectable { xsd:string }?,
+
+      (DocElements & AnyType*)
     }
 
   ArrayType =
     element array {
-      attribute c:type { xsd:string }
-      attribute zero-terminated { string "0" | string "1" }?
-      attribute fixed-size { xsd:string }?
-      attribute introspectable { xsd:string }?
-      Type
+      attribute name { xsd:string }?,
+      attribute zero-terminated { "0" | "1" }?,
+      attribute fixed-size { xsd:integer }?,
+      attribute introspectable { xsd:string }?,
+      attribute length { xsd:integer }?,
+      attribute c:type { xsd:string }?,
+
+      AnyType
     }
 
   TransferOwnership =
-    attribute transfer-ownership { string "none" | string "container" | string "full" }
+    attribute transfer-ownership { "none" | "container" | "full" }
 
   Constructor =
     element constructor {
-      Callable.attrs
-      & Callable.params?
-      & Callable.return?
-      & Doc?
-      & DocDeprecated?
+      Callable.attrs,
+
+      (Info.elements
+       & Callable.params?
+       & Callable.return?)
     }
 
-  Callable.attrs &= attribute name { xsd:string }
-  Callable.attrs &= attribute version { xsd:string }?
-  Callable.attrs &= attribute c:identifier { xsd:string }
-  Callable.attrs &= attribute deprecated { xsd:string }?
-  Callable.attrs &= attribute deprecation-version { xsd:string }?
-  Callable.attrs &= attribute introspectable { xsd:string }?
+  Callable.attrs = (
+    Info.attrs,
+    attribute name { xsd:string },
+
+    attribute c:identifier { xsd:string }?,
+    attribute shadowed-by { xsd:string }?,
+    attribute shadows { xsd:string }?,
+    attribute throws { "0" | "1" }?,
+    attribute moved-to { xsd:string }?
+  )
+
+  VarArgs =
+    element varargs {
+      empty
+    }
 
   Callable.params =
     element parameters {
       element parameter {
-        attribute name { xsd:string }
-        attribute nullable { xsd:string }?
-        attribute allow-none { xsd:string }?
-        attribute introspectable { xsd:string }
-        TransferOwnership?
-
-        Doc?
-        & DocDeprecated?
-        & (Type | ArrayType)
+        attribute name { xsd:string }?,
+        attribute nullable { "0" | "1" }?,
+        attribute allow-none { "0" | "1" }?,
+        attribute introspectable { "0" | "1" }?,
+        attribute closure { xsd:integer }?,
+        attribute destroy { xsd:integer }?,
+        attribute scope { "notified" | "async" | "call" }?,
+        attribute direction { "out" | "in" | "inout" }?,
+        attribute caller-allocates { "0" | "1" }?,
+        attribute optional { "0" | "1" }?,
+        attribute skip { "0" | "1" }?,
+        TransferOwnership?,
+
+        (DocElements
+         & (AnyType | VarArgs))
       }*
 
       & element instance-parameter {
-        attribute name { xsd:string }
-        TransferOwnership?
+        attribute name { xsd:string },
+
+        attribute nullable { "0" | "1" }?,
+        attribute allow-none { "0" | "1" }?,
+        attribute direction { "out" | "in" | "inout" }?,
+        attribute caller-allocates { "0" | "1" }?,
+        TransferOwnership?,
+
+        (DocElements
+         & Type)
       }?
     }
 
   Callable.return =
     element return-value {
-      attribute introspectable { xsd:string }
-      TransferOwnership?
-      & Doc?
-      & (Type | ArrayType)
+      attribute introspectable { xsd:string }?,
+      attribute nullable { "0" | "1" }?,
+      attribute closure { xsd:integer }?,
+      attribute scope { "notified" | "async" | "call" }?,
+      attribute destroy { xsd:integer }?,
+      attribute skip { "0" | "1" }?,
+      attribute allow-none { "0" | "1" }?,
+      TransferOwnership?,
+
+      (DocElements
+       & AnyType)
     }
 
   Function =
     element function {
-      Callable.attrs
-      & Callable.params?
-      & Callable.return?
-      & Doc?
-      & DocDeprecated?
+      Callable.attrs,
+
+      (Callable.params?
+       & Callable.return?
+       & DocElements)
     }
 
   Method =
     element method {
-      Callable.attrs
-      & Callable.params
-      & Callable.return?
-      & Doc?
-      & DocDeprecated?
+      Callable.attrs,
+
+      (Info.elements
+       & Callable.params?
+       & Callable.return?)
+    }
+
+  VirtualMethod =
+    element virtual-method {
+      Callable.attrs,
+      attribute invoker { xsd:string }?,
+
+      (Info.elements
+       & Callable.params?
+       & Callable.return?)
+    }
+
+  Union =
+    element union {
+      Info.attrs,
+      attribute name { xsd:string }?,
+      attribute c:type { xsd:string }?,
+      attribute c:symbol-prefix { xsd:string }?,
+      attribute glib:get-type { xsd:string }?,
+      attribute glib:type-name { xsd:string }?,
+
+      (Info.elements
+       & Field*
+       & Constructor*
+       & Method*
+       & Function*
+       & Record*)
+    }
+
+  BitField =
+    element bitfield {
+      Info.attrs,
+      attribute name { xsd:string },
+      attribute c:type { xsd:string },
+
+      attribute glib:type-name { xsd:string }?,
+      attribute glib:get-type { xsd:string }?,
+
+      (Info.elements
+       & Member*
+       & Function*)
     }
 
   Enum =
     element enumeration {
-      attribute name { xsd:string }
-      attribute glib:type-name { xsd:string }?
-      attribute glib:get-type { xsd:string }?
-      attribute c:type { xsd:string }
+      Info.attrs,
+      attribute name { xsd:string },
+      attribute c:type { xsd:string },
 
-      Doc?
-      & DocDeprecated?
+      attribute glib:type-name { xsd:string }?,
+      attribute glib:get-type { xsd:string }?,
+      attribute glib:error-domain { xsd:string }?,
 
-      EnumMember+
+      (Info.elements
+       & Member*
+       & Function*)
     }
 
-  EnumMember =
+  Member =
     element member {
-      attribute name { xsd:string }
-      attribute value { xsd:string }
-      attribute c:identifier { xsd:string }
-      attribute glib:nick { xsd:string }?
+      Info.attrs,
+      attribute name { xsd:string },
+      attribute value { xsd:string },
+      attribute c:identifier { xsd:string },
+
+      attribute glib:nick { xsd:string }?,
 
-      Doc?
-      & DocDeprecated?
+      Info.elements
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]