export type repository = struct { version: str, includes: []include, namespaces: []namespace, }; export fn repository_finish(repo: *repository) void = { free(repo.version); for (let i = 0z; i < len(repo.includes); i += 1) { include_finish(&repo.includes[i]); }; for (let i = 0z; i < len(repo.namespaces); i += 1) { namespace_finish(&repo.namespaces[i]); }; }; export type include = struct { name: str, version: str, }; export fn include_finish(incl: *include) void = { free(incl.name); free(incl.version); }; export type namespace = struct { name: str, version: str, aliases: []alias, classes: []class, interfaces: []interface, records: []record, enums: []enumeration, functions: []function, unions: []union_, bitfields: []bitfield, callbacks: []callback, constants: []constant, }; export fn namespace_finish(ns: *namespace) void = { free(ns.name); free(ns.version); // TODO }; export type alias = struct { documentation, name: str, c_type: str, inner: simple_type, }; export type class = struct { documentation, name: str, glib_type_name: str, glib_get_type: str, parent: str, glib_ref_func: str, glib_unref_func: str, glib_set_value_func: str, glib_get_value_func: str, c_type: str, symbol_prefix: str, abstract: bool, fundamental: bool, final: bool, entries: []entry, implements: []str, constructors: []constructor, methods: []method, functions: []function, virtual_methods: []virtual_method, properties: []property, signals: []signal, constants: []constant, callbacks: []callback, }; export type interface = struct { documentation, name: str, glib_type_name: str, glib_get_type: str, symbol_prefix: str, c_type: str, entries: []entry, prerequisites: []str, implements: []str, functions: []function, constructors: []constructor, methods: []method, virtual_methods: []virtual_method, properties: []property, signals: []signal, callbacks: []callback, constants: []constant, }; export type record = struct { documentation, name: str, c_type: str, disguised: bool, opaque_: bool, pointer: bool, glib_type_name: str, glib_get_type: str, symbol_prefix: str, foreign: bool, copy_function: str, free_function: str, entries: []entry, functions: []function, methods: []method, constructors: []constructor, }; // FIXME: find a better name for this export type entry = (field | union_ | record); export type constructor = struct { callable, params: []callable_param, return_value: (callable_return | void), }; export type method = struct { callable, glib_set_property: str, glib_get_property: str, instance: instance_parameter, params: []callable_param, return_value: (callable_return | void), }; export type virtual_method = struct { callable, invoker: str, instance: instance_parameter, params: []callable_param, return_value: (callable_return | void), }; export type field = struct { documentation, name: str, writable: bool, readable: bool, private: bool, bits: uint, type_: (callback | any_type), }; export type property = struct { documentation, name: str, writable: bool, readable: bool, construct: bool, construct_only: bool, setter: str, getter: str, default_value: str, transfer_ownership: str, type_: any_type, }; export type enumeration = struct { documentation, name: str, c_type: str, glib_type_name: str, glib_get_type: str, glib_error_domain: str, members: []member, functions: []function, }; export type function = struct { callable, params: []callable_param, return_value: (callable_return | void), }; export type union_ = struct { documentation, name: str, c_type: str, symbol_prefix: str, glib_type_name: str, glib_get_type: str, copy_function: str, free_function: str, entries: []entry, constructors: []constructor, methods: []method, functions: []function, }; export type bitfield = struct { documentation, name: str, c_type: str, glib_type_name: str, glib_get_type: str, members: []member, functions: []function, }; export type callback = struct { documentation, name: str, c_type: str, throws: bool, params: []callable_param, return_value: (callable_return | void), }; export type constant = struct { documentation, name: str, value: str, c_type: str, c_identifier: str, type_: (any_type | void), }; export type signal = struct { documentation, name: str, detailed: bool, when: str, action: bool, no_hooks: bool, no_recurse: bool, emitter: str, params: []callable_param, return_value: (callable_return | void), }; export type member = struct { documentation, name: str, value: str, c_identifier: str, glib_nick: str, glib_name: str, }; export type callable = struct { documentation, name: str, c_identifier: str, shadowed_by: str, shadows: str, throws: bool, }; export type callable_param = struct { documentation, name: str, is_nullable: bool, allow_none: bool, introspectable: bool, closure: uint, destroy: uint, scope: str, direction: str, caller_allocates: bool, optional: bool, skip: bool, transfer_ownership: str, parameter: (any_type | varargs), }; export type instance_parameter = struct { documentation, name: str, is_nullable: bool, allow_none: bool, direction: str, caller_allocates: str, transfer_ownership: str, type_: simple_type, }; export type varargs = void; export type callable_return = struct { documentation, introspectable: bool, is_nullable: bool, closure: uint, scope: str, destroy: uint, skip: bool, allow_none: bool, transfer_ownership: str, type_: any_type, }; export type documentation = struct { doc: str, }; export type simple_type = struct { documentation, name: str, c_type: str, introspectable: bool, inner: []any_type, }; export type array_type = struct { documentation, name: str, zero_terminated: bool, fixed_size: uint, introspectable: bool, length: uint, c_type: str, inner: *any_type, }; export type any_type = (simple_type | array_type);