gir-1.2.rnc 28.5 KB
Newer Older
1
default namespace core = "http://www.gtk.org/introspection/core/1.0"
2 3 4 5 6 7
namespace c = "http://www.gtk.org/introspection/c/1.0"
namespace glib = "http://www.gtk.org/introspection/glib/1.0"

grammar {
  start = Repository

8
  ## Root node of a GIR repository. It contains  namespaces, which can in turn be implemented in several libraries
9 10
  Repository =
    element repository {
11
      ## version number of the repository
12
      attribute version { xsd:string }?,
13
      ## prefixes to filter out from C identifiers for data structures and types. For example, GtkWindow will be Window. If c:symbol-prefixes is not used, then this element is used for both
14
      attribute c:identifier-prefixes { xsd:string }?,
15
      ## prefixes to filter out from C functions. For example, gtk_window_new will lose gtk_
16 17
      attribute c:symbol-prefixes { xsd:string }?,

18
      # Other elements a repository can contain
19 20 21 22 23 24
      (Include*
       & CInclude*
       & Package*
       & Namespace*)
    }

25
  ## Namespace which maps metadata entries to C functionality. This a similar concept to namespace in C++, but for GObject-based C libraries
26 27
  Namespace =
    element namespace {
28
      ## name of the namespace. For example, 'Gtk'
29
      attribute name { xsd:string }?,
30
      ## version number of the namespace
31
      attribute version { xsd:string }?,
32
      ## prefixes to filter out from C identifiers for data structures and types. For example, GtkWindow will be Window. If c:symbol-prefixes is not used, then this element is used for both
33
      attribute c:identifier-prefixes { xsd:string }?,
34
      ## prefixes to filter out from C functions. For example, gtk_window_new will lose gtk_
35
      attribute c:symbol-prefixes { xsd:string }?,
36
      ## Deprecated: the same as c:identifier-prefixes. Only used for backward compatibility 
37
      attribute c:prefix { xsd:string }?,
38
      ## Path to the shared library implementing the namespace. It can be a comma-separated list, with relative path only
39 40
      attribute shared-library { xsd:string }?,

41
      # Other elements a namespace can contain
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
      (Alias*
       & Class*
       & Interface*
       & Record*
       & Enum*
       & Function*
       & Union*
       & BitField*
       & Callback*
       & Constant*
       & Annotation*
       & Boxed*)
    }

  Annotation =
57
    ## element defining an annotation from the source code, usually a user-defined annotation associated to a parameter or a return value
58
    element attribute {
59
      ## name of the attribute
60
      attribute name { xsd:string },
61
      ## value of the attribute
62 63 64 65
      attribute value { xsd:string }
    }

  CInclude =
66
    ## Dependant C header file which should be included in C programs
67
    element c:include {
68
      ## File name of the C header file. The path can be relative.
69 70 71
      attribute name { xsd:string },

      empty
72 73 74
    }

  Include =
75
    ## Dependant namespace to include with the current namespace. For example, Gtk will need the namespace GLib
76
    element include {
77
      ## name of the dependant namespace to include
78
      attribute name { xsd:string },
79
      ## version of the dependant namespace to use
80 81
      attribute version { xsd:string }?,

82 83 84 85
      empty
    }

  Package =
86
    ## Deprecated: package name containing the library
87
    element package {
88
      ## name of the package
89 90
      attribute name { xsd:string },

91 92 93 94
      empty
    }

  Alias =
95
    ## Type's name substitution, representing a typedef in C
96
    element alias {
97
      # Attributes of an Alias (see definition below)
98
      Info.attrs,
99
      ## the new name or typedef'd name
100
      attribute name { xsd:string },
101
      ## the corresponding C type's name
102 103
      attribute c:type { xsd:string },

104
      # Other elements an alias can contain
105 106 107
      (Info.elements
       & Type)
    }
108

109
  Interface =
110
    ## Abstract interface to other classes
111
    element interface {
112
      # Attributes of an Interface (see definition below)
113
      Info.attrs,
114
      ## name of the interface
115
      attribute name { xsd:string },
116
      ## Type name compatible with the GObject type system
117
      attribute glib:type-name { xsd:string },
118
      ## Function to get the GObject compatible type of the interface 
119
      attribute glib:get-type { xsd:string },
120
      ## prefix to filter out from C functions. For example, gtk_window_new will lose gtk_
121
      attribute c:symbol-prefix { xsd:string }?,
122
      ## Corresponding C type
123
      attribute c:type { xsd:string }?,
124
      ## GObject compatible C structure defining the Interface
125 126
      attribute glib:type-struct { xsd:string }?,

127
      # Other elements an interface can contain
128 129 130 131 132 133 134 135 136 137 138 139
      (Info.elements
       & Prerequisite*
       & Implements*
       & Function*
       & Constructor?
       & Method*
       & VirtualMethod*
       & Field*
       & Property*
       & Signal*
       & Callback*
       & Constant*)
140 141 142
    }

  Class =
143
    ## GObject inherited class definition
144
    element class {
145
      Info.attrs,
146 147
      
      ## Name of the class
148
      attribute name { xsd:string },
149
      ## GObject compatible type name of the class
150
      attribute glib:type-name { xsd:string },
151
      ## Function to get the GObject compatible type of the class
152
      attribute glib:get-type { xsd:string },
153
      ## Name of the parent class if any
154
      attribute parent { xsd:string }?,
155
      ## GObject compatible C structure defining the class
156
      attribute glib:type-struct { xsd:string }?,
157
      ## GObject compatible function to reference or increase the reference count of the class
158
      attribute glib:ref-func { xsd:string }?,
159
      ## GObject compatible function to unreference or decrease the reference count of the class
160
      attribute glib:unref-func { xsd:string }?,
161
      ## GObject compatible function to set a value of a property of the class
162
      attribute glib:set-value-func { xsd:string }?,
163
      ## GObject compatible function to get a value of a property of the class
164
      attribute glib:get-value-func { xsd:string }?,
165
      ## C type of the class
166
      attribute c:type { xsd:string }?,
167
      ## prefix to filter out from C functions. For example, gtk_window_new will lose gtk_
168
      attribute c:symbol-prefix { xsd:string }?,
169
      ## Binary attribute to declare the class abstract or not
170
      attribute abstract { "0" | "1" }?,
171
      ## Binary attribute to declare the class fundamental or not (top-level class which do not derives from any other type)
172 173
      attribute glib:fundamental { "0" | "1" }?,

174
      # Other elements a class can contain
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
      (Info.elements
       & Implements*
       & Constructor*
       & Method*
       & Function*
       & VirtualMethod*
       & Field*
       & Property*
       & Signal*
       & Union*
       & Constant*
       & Record*
       & Callback*)
    }

  Boxed =
191
    ## Boxed type (wrapper to opaque C structures registered by the type system)
192 193
    element glib:boxed {
      Info.attrs,
194
      ## GObject compatible type name of the boxed type
195
      attribute glib:name { xsd:string },
196
      ## prefix to filter out from C functions. For example, gtk_window_new will lose gtk_
197
      attribute c:symbol-prefix { xsd:string }?,
198
      ## GObject compatible type name of the boxed type
199
      attribute glib:type-name { xsd:string }?,
200
      ## Function to get the GObject compatible type of the boxed type
201 202
      attribute glib:get-type { xsd:string }?,

203
      # Other elements a Boxed type can contain
204 205
      (Info.elements
       & Function*)
206 207 208
    }

  Record =
209
    ## Record definition, equivalent to a C struct, that is a simple structure, not a class
210
    element record {
211
      Info.attrs,
212
      ## name of the record
213
      attribute name { xsd:string },
214
      ## Corresponding C type of the record
215
      attribute c:type { xsd:string }?,
216 217
      ## Binary attribute to tell if the record is disguised, i.e. whether the c:type is a typedef that doesn't look like a pointer, but is one internally
	  ## Its second meaning is "private" and is set when any typedef struct is parsed which doesn't also include a full struct with fields (https://gitlab.gnome.org/GNOME/gobject-introspection/issues/101)
218
      attribute disguised { "0" | "1" }?,
219
      ## GObject compatible C type of the record
220
      attribute glib:type-name { xsd:string }?,
221
      ## Function to get the GObject compatible type of the record
222
      attribute glib:get-type { xsd:string }?,
223
      ## prefix to filter out from C functions. For example, gtk_window_new will lose gtk_
224
      attribute c:symbol-prefix { xsd:string }?,
225
      ## Binary attribute to tell if the record is foreign, that is it is not available in a g-i supported library
226
      attribute foreign { "0" | "1" }?,
227
      ## Name of the GObject compatible gtype this record represents. If empty, this record will be hidden from generated public APIs.
228 229
      attribute glib:is-gtype-struct-for { xsd:string }?,

230 231
      # Other elements a record can contain
        # mandatory 
232 233 234 235 236 237 238 239
      (Info.elements
       & Field*
       & Function*
       & Union*
       & Method*
       & Constructor*
       & Property*)
    }
240

241
  # Some base information for most elements like version, deprecation, stability, if they are introspectable or not, etc...
242
  Info.attrs = (
243
    ## Binary attribute which is "0" (false) if the element is not introspectable. It doesn't exist in the bindings, due in general to missing information in the annotations in the original C code
244
    attribute introspectable { "0" | "1" }?,
245
    ## Binary attribute which is "1" (true) if the element has been deprecated
246
    attribute deprecated { xsd:string }?,
247
    ## Version number from which this element is deprecated
248
    attribute deprecated-version { xsd:string }?,
249
    ## version number of an element
250
    attribute version { xsd:string }?,
251
    ## give the statibility status of the element. Can take the values "Stable", "Unstable" or "Private"
252 253 254
    attribute stability { xsd:string }?
  )

255
  # Documentation of elements
256
  DocElements = (
257
    ## Version of the documentation
258
    element doc-version {
259
      ## Preserve the original formatting of the documentation from the source code
260
      attribute xml:space { "preserve" }?,
261
      ## Preserve the original formatting of the documentation from the source code. Recommended to use this instead of xml:space
262
      attribute xml:whitespace { "preserve" }?,
263
      ## the text of the version of the documentation
264 265
      text
    }?
266
    ## give the stability of the documentation
267
    & element doc-stability {
268
      ## Preserve the original formatting of the documentation from the source code
269
      attribute xml:space { "preserve" }?,
270
      ## Preserve the original formatting of the documentation from the source code. Recommended to use this instead of xml:space
271
      attribute xml:whitespace { "preserve" }?,
272
      ## a text value about the stability of the documentation. Usually a simple description like stable or unstable
273 274
      text
    }?
275
    ## documentation of an element
276
    & element doc {
277
      ## Preserve the original formatting of the documentation from the source code
278
      attribute xml:space { "preserve" }?,
279
      ## Keep the whitespace as they were in the source code
280
      attribute xml:whitespace { "preserve" }?,
281
      ## The file containing this documentation
282
      attribute filename { xsd:string },
283
      ## The first line of the documentation in the source code
284
      attribute line { xsd:string },
285
      ## The first column of the documentation in the source code
286
      attribute column { xsd:string },
287
      ## the text of the documentation
288 289
      text
    }?
290
    ## Deprecated documentation of an element. Kept for historical reasons in general
291
    & element doc-deprecated {
292
      ## Preserve the original formatting of the documentation from the source code
293
      attribute xml:space { "preserve" }?,
294
      ## Keep the whitespace as they were in the source code
295
      attribute xml:whitespace { "preserve" }?,
296
      ## the text of the deprecated documentation
297 298
      text
    }?
299
    ## Position of the documentation in the original source code
300
    & element source-position {
301
      ## File name of the source of the documentation
302
      attribute filename { xsd:string },
303
      ## The first line of the documentation in the source code
304
      attribute line { xsd:string },
305
      ## The first column of the documentation in the source code
306 307
      attribute column { xsd:string },
    }?
308 309
  )

310
  # Information about elements can be a documentation of annotations
311 312 313 314 315 316
  Info.elements = (
    DocElements
    & Annotation*
  )

  Constant =
317
    ## A constant entity, similar to const variable in C
318 319
    element constant {
        Info.attrs,
320
        ## name of the constant
321
        attribute name { xsd:string },
322
        ## value of the constant
323
        attribute value { xsd:string },
324
        ## corresponding C type of the constant in C
325
        attribute c:type { xsd:string }?,
326
        ## corresponding C identifier in the source code
327 328
        attribute c:identifier { xsd:string }?,

329
        # Other elements a record can contain
330 331
        (Info.elements
         & AnyType?)
332 333 334
    }

  Property =
335
    ## Property, that is a variable or members with getter and setter functions
336
    element property {
337
      Info.attrs,
338
      ## name of the property
339
      attribute name { xsd:string },
340
      ## Binary attribute, true if the property is writeable, that is it has a setter function
341
      attribute writable { "0" | "1" }?,
342
      ## Binary attribute, true if the property is readable, that is it has a getter function
343
      attribute readable { "0" | "1" }?,
344
      ## Binary attribute, true if the property will be set upon construction
345
      attribute construct { "0" | "1" }?,
346
      ## Binary attribute, true if the property can only be set upon construction
347
      attribute construct-only { "0" | "1" }?,
348
      # Define the transfer of ownership of the property element
349 350
      TransferOwnership?,

351
      # Other elements a property can contain
352 353
      (Info.elements
       & AnyType)
354 355 356
    }

  Signal =
357
    ## A signal as defined in the GObject system (https://developer.gnome.org/gobject/stable/signal.html)
358
    element glib:signal {
359
      Info.attrs,
360
      ## name of the signal
361
      attribute name { xsd:string },
362
      ## Binary attribute, true if the signal has a detailed parameter (https://developer.gnome.org/gobject/stable/signal.html#signal-detail# and https://developer.gnome.org/gobject/unstable/gobject-Signals.html#GSignalFlags)
363
      attribute detailed { "0" | "1" }?,
364
      ## When to run the signal during the 5 steps of signal emission (https://developer.gnome.org/gobject/stable/signal.html#signal-emission and https://developer.gnome.org/gobject/unstable/gobject-Signals.html#GSignalFlags)
365
      attribute when { "first" | "last" | "cleanup" }?,
366
      ## Binary attribute, true if the signal can be freely emitted on alive objects from user code (https://developer.gnome.org/gobject/unstable/gobject-Signals.html#GSignalFlags)
367
      attribute action { "0" | "1" }?,
368
      ## Binary attribute, true if no emission hooks are supported for this signal (https://developer.gnome.org/gobject/unstable/gobject-Signals.html#GSignalFlags) 
369
      attribute no-hooks { "0" | "1" }?,
370
      ## Binary attribute, true if signals emitted for an object while currently being in emission for this very object will not be emitted recursively, but instead cause the first emission to be restarted (https://developer.gnome.org/gobject/unstable/gobject-Signals.html#GSignalFlags)
371 372
      attribute no-recurse { "0" | "1" }?,

373
      # Other elements a property can contain
374 375 376
      (Info.elements
       & Callable.params?
       & Callable.return?)
377 378 379
    }

  Field =
380
    ## A field of struct of union structure, that is a C bit field, that is a fixed length in bits variable
381
    element field {
382
      Info.attrs,
383
      ## name of the field
384
      attribute name { xsd:string },
385
      ## Binary attribute, true if the field is writeable
386
      attribute writable { "0" | "1" }?,
387
      ## Binary attribute, true if the field is readable
388
      attribute readable { "0" | "1" }?,
389
      ## Binary attribute, true if the field is private to the structure or has public ("0") visibility
390
      attribute private { "0" | "1" }?,
391
      ## number of bits of the field
392 393
      attribute bits { xsd:integer }?,

394
      # Other elements a property can contain
395 396
      (Info.elements
       & (Callback | AnyType))
397 398 399
    }

  Callback =
400
    ## A callback closure, that is a function called when a signal is emitted (as an answer to that signal)
401
    element callback {
402
      Info.attrs,
403
      ## name of the callback
404
      attribute name { xsd:string },
405
      ## the C type returned by the callback closure (i.e. function)
406
      attribute c:type { xsd:string }?,
407
      ## Binary attribute, true if the callback can throw an error
408
      attribute throws { "0" | "1" }?,
409

410
      # Other elements a property can contain
411 412 413 414
      (Info.elements
       & Callable.params?
       & Callable.return?)
    }
415 416

  Implements  =
417
    ## Give the name of the interface it implements. This element is generally used within a class element
418
    element implements {
419
      ## name of the interface implemented by a class
420 421 422 423
      attribute name { xsd:string }
    }

  Prerequisite  =
424
    ## Interface which is pre-required to implement another interface. This node is generally using within an interface element
425
    element prerequisite {
426
      ## name of the required interface
427 428 429
      attribute name { xsd:string }
    }

430
  # A generic grammar element to represent either a simple Type or an Array of the same Type
431
  AnyType = (Type | ArrayType)
432 433

  Type =
434
    # A simple type of data (as opposed to an array)
435
    element type {
436
      ## name of the type
437
      attribute name { xsd:string }?,
438
      ## the C representation of the type
439
      attribute c:type { xsd:string }?,
440 441
      ## Binary attribute which is "0" (false) if the element is not introspectable. It doesn't exist in the bindings, due in general to missing information in the annotations in the original C code
      attribute introspectable { "0" | "1" }?,
442 443

      (DocElements & AnyType*)
444 445 446
    }

  ArrayType =
447
    ## An array type of data where each element is of the same type
448
    element array {
449
      ## name of the array type
450
      attribute name { xsd:string }?,
451
      ## Binary attribute, true if the last element of the array is zero. For example, in an array of pointers, the last pointer would be NULL
452
      attribute zero-terminated { "0" | "1" }?,
453
      ## size of an array of predetermined fixed size. For example a C array declared as char arr[5].
454
      attribute fixed-size { xsd:integer }?,
455 456
      ## Binary attribute which is "0" (false) if the element is not introspectable. It doesn't exist in the bindings, due in general to missing information in the annotations in the original C code
      attribute introspectable { "0" | "1" }?,
457
	  ## 0-based index of parameter element that specifies the length of the array
458
      attribute length { xsd:integer }?,
459
      ## the C representation of the array type
460 461
      attribute c:type { xsd:string }?,

462
      # Type of the values contained in the array
463
      AnyType
464 465 466
    }

  TransferOwnership =
467
    ## attributes used by many elements for the transfer of ownership, with for example, a returned value. "none" if the recipient does not own the value, "container" if the recipient owns the container but not the value (for arrays or lists for example) , "full" the recipient owns the entire value. For details, see https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations#Memory_and_lifecycle_management
468
    attribute transfer-ownership { "none" | "container" | "full" }
469 470

  Constructor =
471
    ## A constructor of a class
472
    element constructor {
473 474 475 476 477
      Callable.attrs,

      (Info.elements
       & Callable.params?
       & Callable.return?)
478 479
    }

480
  ## Attributes of a Callable (functions, callbacks, closures, etc...)
481 482
  Callable.attrs = (
    Info.attrs,
483
    ## name of the Callable
484
    attribute name { xsd:string },
485
    # C identifier in the source code of the Callable
486
    attribute c:identifier { xsd:string }?,
487
    ## Callable it is shadowed by. For example, in C++, only one version of an overloaded callable will appear
488
    attribute shadowed-by { xsd:string }?,
489
    ## Callable it shadows. For example, in C++, only one version of an overloaded callable will appear
490
    attribute shadows { xsd:string }?,
491
    ## Binary attribute, true if the callable can throw an error
492
    attribute throws { "0" | "1" }?,
493
    ## if for backward compatibility reason the callable has a name in the source code but should be known by another one, this attribute contains the new name    
494 495 496 497
    attribute moved-to { xsd:string }?
  )

  VarArgs =
498
    ## an element, usually found in a parameter element for variadic parameter in a function or callable
499 500 501
    element varargs {
      empty
    }
502

503
  # Refer to https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations#Support_for_GObject_closures 
504
  Callable.params =
505
    ## parameters element of a callable, that is in general parameters of a function or similar
506
    element parameters {
507
      ## parameter element of a list of parameters
508
      element parameter {
509
        ## name of the parameter
510
        attribute name { xsd:string }?,
511
        ## Binary attribute, true if the parameter can have a null value
512
        attribute nullable { "0" | "1" }?,
513
        ## Deprecated. Replaced by nullable and optional
514
        attribute allow-none { "0" | "1" }?,
515
      ## Binary attribute which is "0" (false) if the element is not introspectable. It doesn't exist in the bindings, due in general to missing information in the annotations in the original C code
516
        attribute introspectable { "0" | "1" }?,
517
        ## the parameter is a user_data for callbacks. The value points to a different parameter that is the actual callback
518
        attribute closure { xsd:integer }?,
519
        ## the parameter is a destroy_data for callbacks. The value points to a different parameter that is the actual callback
520
        attribute destroy { xsd:integer }?,
521
        ## the parameter is a callback, the value indicates the lifetime of the call. For language bindings which want to know when the resources required to do the call can be freed. "notified" valid until a GDestroyNotify argument is called, "async" only valid for the duration of the first callback invocationi (can only be called once), "call" only valid for the duration of the call, can be called multiple times during the call. 
522
        attribute scope { "notified" | "async" | "call" }?,
523
        ## direction of the parameter. "in" goes into the callable, "out" for output parameters from the callable (reference in C++, var in Pascal, etc...), "inout" for both (like a pre-allocated structure which will be filled-in by the callable)
524
        attribute direction { "out" | "in" | "inout" }?,
525
        ## Binary attribute, true if the caller should allocate the parameter before calling the callable
526
        attribute caller-allocates { "0" | "1" }?,
527
        ## Binary attribute, true if the parameter is optional
528
        attribute optional { "0" | "1" }?,
529
        ##  Binary attribute, true if the parameter can be omitted from the introspected output
530 531 532 533 534
        attribute skip { "0" | "1" }?,
        TransferOwnership?,

        (DocElements
         & (AnyType | VarArgs))
535 536
      }*

537
      ## instance-parameter is a parameter of a C function which is an instance of an existing object. So the callable is surely a method of a class, and this parameter points to the instance of the object. In C++, this would be equivalent to the pointer this which is not passed to the method, in Python it's equivalent to self.
538
      & element instance-parameter {
539
        ## name of the instance-parameter
540
        attribute name { xsd:string },
541
        ## Binary attribute, true if the parameter can have a null value
542
        attribute nullable { "0" | "1" }?,
543
        ## Deprecated. Replaced by nullable and optional
544
        attribute allow-none { "0" | "1" }?,
545
        ## direction of the parameter. "in" goes into the callable, "out" for output parameters from the callable (reference in C++, var in Pascal, etc...), "inout" for both (like a pre-allocated structure which will be filled-in by the callable)
546
        attribute direction { "out" | "in" | "inout" }?,
547
        ## Binary attribute, true if the caller should allocate the parameter before calling the callable
548 549 550 551 552
        attribute caller-allocates { "0" | "1" }?,
        TransferOwnership?,

        (DocElements
         & Type)
553 554 555 556
      }?
    }

  Callable.return =
557
    ## return value of a callable
558
    element return-value {
559 560
      ## Binary attribute which is "0" (false) if the element is not introspectable. It doesn't exist in the bindings, due in general to missing information in the annotations in the original C code
      attribute introspectable { "0" | "1" }?,
561
      ## Binary attribute, true if the parameter can have a null value
562
      attribute nullable { "0" | "1" }?,
563
      ## the parameter is a user_data for callbacks. The value points to a different parameter that is the actual callback
564
      attribute closure { xsd:integer }?,
565
      ## the parameter is a callback, the value indicates the lifetime of the call. For language bindings which want to know when the resources required to do the call can be freed. "notified" valid until a GDestroyNotify argument is called, "async" only valid for the duration of the first callback invocationi (can only be called once), "call" only valid for the duration of the call, can be called multiple times during the call. 
566
      attribute scope { "notified" | "async" | "call" }?,
567
      ## the parameter is a destroy_data for callbacks. The value points to a different parameter that is the actual callback
568
      attribute destroy { xsd:integer }?,
569
      ##  Binary attribute, true if the parameter can be omitted from the introspected output
570
      attribute skip { "0" | "1" }?,
571
      ## Deprecated. Replaced by nullable and optional
572 573 574 575 576
      attribute allow-none { "0" | "1" }?,
      TransferOwnership?,

      (DocElements
       & AnyType)
577 578 579
    }

  Function =
580
    ## element defining a standalone function (as usual in most programming languages)
581
    element function {
582 583 584 585 586
      Callable.attrs,

      (Callable.params?
       & Callable.return?
       & DocElements)
587 588 589
    }

  Method =
590
    ## element defining a method from a class
591
    element method {
592 593 594 595 596 597 598 599
      Callable.attrs,

      (Info.elements
       & Callable.params?
       & Callable.return?)
    }

  VirtualMethod =
600
    ## element defining a virtual method from a class, concept similar to C++
601 602
    element virtual-method {
      Callable.attrs,
603
      ## name of the callable called when invoking this virtual method
604 605 606 607 608 609 610 611
      attribute invoker { xsd:string }?,

      (Info.elements
       & Callable.params?
       & Callable.return?)
    }

  Union =
612
    ## element defining a type of data being a union of type, similar to union in C/C++ but extended with fields and methods
613 614
    element union {
      Info.attrs,
615
      ## name of the union
616
      attribute name { xsd:string }?,
617
      ## C type defining the union
618
      attribute c:type { xsd:string }?,
619
      ## prefix to filter out from C functions. For example, gtk_window_new will lose gtk_
620
      attribute c:symbol-prefix { xsd:string }?,
621
      ## GObject compatible type name
622
      attribute glib:type-name { xsd:string }?,
623
      ## function to retrieve the GObject compatible type of the element
624
      attribute glib:get-type { xsd:string }?,
625 626 627 628 629 630 631 632 633 634

      (Info.elements
       & Field*
       & Constructor*
       & Method*
       & Function*
       & Record*)
    }

  BitField =
635
    ## element defining a bit field (as in C)
636 637
    element bitfield {
      Info.attrs,
638
      ## name of the bit field
639
      attribute name { xsd:string },
640
      ## corresponding C type of the bit field type
641
      attribute c:type { xsd:string },
642
      ## GObject compatible type name
643
      attribute glib:type-name { xsd:string }?,
644
      ## function to retrieve the GObject compatible type of the element
645 646 647 648 649
      attribute glib:get-type { xsd:string }?,

      (Info.elements
       & Member*
       & Function*)
650 651 652
    }

  Enum =
653
    ## element defining a enumeration type similar to enum in C/C++
654
    element enumeration {
655
      Info.attrs,
656
      ## name of the enumeration
657
      attribute name { xsd:string },
658
      ## corresponding C type of the enumeration type
659
      attribute c:type { xsd:string },
660
      ## GObject compatible type name
661
      attribute glib:type-name { xsd:string }?,
662
      ## function to retrieve the GObject compatible type of the element
663
      attribute glib:get-type { xsd:string }?,
664
      ## Error domain of this enumeration in a stringified form
665
      attribute glib:error-domain { xsd:string }?,
666

667 668 669
      (Info.elements
       & Member*
       & Function*)
670 671
    }

672
  Member =
673
    ## element defining a member of a bit field or an enumeration
674
    element member {
675
      Info.attrs,
676
      ## name of the member
677
      attribute name { xsd:string },
678
      ## value of the member
679
      attribute value { xsd:string },
680
      ## corresponding C type of the member
681
      attribute c:identifier { xsd:string },
682
      ## short nickname of the member
683
      attribute glib:nick { xsd:string }?,
684

685
      Info.elements
686 687
    }
}