diff options
author | Alexey Yerin <yyp@disroot.org> | 2023-10-04 20:59:45 +0300 |
---|---|---|
committer | Alexey Yerin <yyp@disroot.org> | 2023-10-04 20:59:45 +0300 |
commit | 07cff557463d13bbd1baa970f609c8dbb13e16a8 (patch) | |
tree | 5ed04987ffde8fd18f7e58886cdb3e7e57465609 /gir | |
parent | a3f09a04518ce9ed7cb93719149f75c36ad02856 (diff) |
Update for opaque and other Hare changes
Diffstat (limited to 'gir')
-rw-r--r-- | gir/parse.ha | 82 | ||||
-rw-r--r-- | gir/types.ha | 2 |
2 files changed, 42 insertions, 42 deletions
diff --git a/gir/parse.ha b/gir/parse.ha index a484dc6..91c55d4 100644 --- a/gir/parse.ha +++ b/gir/parse.ha @@ -32,7 +32,7 @@ export fn parse(in: io::file) (repository | error) = { return repo; }; -fn parse_repository(parser: *xml::parser, repo: *void) (void | error) = { +fn parse_repository(parser: *xml::parser, repo: *opaque) (void | error) = { const repo = repo: *repository; return parse_element(parser, "repository", ("xmlns", null), @@ -48,7 +48,7 @@ fn parse_repository(parser: *xml::parser, repo: *void) (void | error) = { ); }; -fn parse_include(parser: *xml::parser, includes: *void) (void | error) = { +fn parse_include(parser: *xml::parser, includes: *opaque) (void | error) = { const includes = includes: *[]include; let new = include { ... }; parse_element(parser, "include", @@ -58,7 +58,7 @@ fn parse_include(parser: *xml::parser, includes: *void) (void | error) = { append(includes, new); }; -fn parse_namespace(parser: *xml::parser, namespaces: *void) (void | error) = { +fn parse_namespace(parser: *xml::parser, namespaces: *opaque) (void | error) = { const namespaces = namespaces: *[]namespace; let new = namespace { ... }; parse_element(parser, "namespace", @@ -88,7 +88,7 @@ fn parse_namespace(parser: *xml::parser, namespaces: *void) (void | error) = { append(namespaces, new); }; -fn parse_alias(parser: *xml::parser, aliases: *void) (void | error) = { +fn parse_alias(parser: *xml::parser, aliases: *opaque) (void | error) = { const aliases = aliases: *[]alias; let new = alias { ... }; parse_element(parser, "alias", @@ -100,7 +100,7 @@ fn parse_alias(parser: *xml::parser, aliases: *void) (void | error) = { append(aliases, new); }; -fn parse_class(parser: *xml::parser, classes: *void) (void | error) = { +fn parse_class(parser: *xml::parser, classes: *opaque) (void | error) = { const classes = classes: *[]class; let new = class { ... }; parse_element(parser, "class", @@ -135,7 +135,7 @@ fn parse_class(parser: *xml::parser, classes: *void) (void | error) = { )?; append(classes, new); }; -fn parse_implements(parser: *xml::parser, implements: *void) (void | error) = { +fn parse_implements(parser: *xml::parser, implements: *opaque) (void | error) = { const implements = implements: *[]str; let name = ""; parse_element(parser, "implements", @@ -143,7 +143,7 @@ fn parse_implements(parser: *xml::parser, implements: *void) (void | error) = { )?; append(implements, name); }; -fn parse_interface(parser: *xml::parser, interfaces: *void) (void | error) = { +fn parse_interface(parser: *xml::parser, interfaces: *opaque) (void | error) = { const interfaces = interfaces: *[]interface; let new = interface { ... }; parse_element(parser, "interface", @@ -169,7 +169,7 @@ fn parse_interface(parser: *xml::parser, interfaces: *void) (void | error) = { )?; append(interfaces, new); }; -fn parse_prerequisite(parser: *xml::parser, prerequisites: *void) (void | error) = { +fn parse_prerequisite(parser: *xml::parser, prerequisites: *opaque) (void | error) = { const prerequisites = prerequisites: *[]str; let name = ""; parse_element(parser, "prerequisite", @@ -178,7 +178,7 @@ fn parse_prerequisite(parser: *xml::parser, prerequisites: *void) (void | error) append(prerequisites, name); }; -fn parse_record(parser: *xml::parser, records: *void) (void | error) = { +fn parse_record(parser: *xml::parser, records: *opaque) (void | error) = { const records = records: *[]record; let new = record { ... }; parse_element(parser, "record", @@ -186,7 +186,7 @@ fn parse_record(parser: *xml::parser, records: *void) (void | error) = { ("name", &new.name), ("c:type", &new.c_type), ("disguised", &new.disguised), - ("opaque", &new.opaque), + ("opaque", &new.opaque_), ("pointer", &new.pointer), ("glib:type-name", &new.glib_type_name), ("glib:get-type", &new.glib_get_type), @@ -205,7 +205,7 @@ fn parse_record(parser: *xml::parser, records: *void) (void | error) = { append(records, new); }; -fn parse_record_entry(parser: *xml::parser, entries: *void) (void | error) = { +fn parse_record_entry(parser: *xml::parser, entries: *opaque) (void | error) = { const entries = entries: *[]entry; let records: []record = []; defer free(records); @@ -213,7 +213,7 @@ fn parse_record_entry(parser: *xml::parser, entries: *void) (void | error) = { append(entries, records[0]); }; -fn parse_constructor(parser: *xml::parser, constructors: *void) (void | error) = { +fn parse_constructor(parser: *xml::parser, constructors: *opaque) (void | error) = { const constructors = constructors: *[]constructor; let new = constructor { return_value = void, ... }; parse_element(parser, "constructor", @@ -223,7 +223,7 @@ fn parse_constructor(parser: *xml::parser, constructors: *void) (void | error) = )?; append(constructors, new); }; -fn parse_method(parser: *xml::parser, methods: *void) (void | error) = { +fn parse_method(parser: *xml::parser, methods: *opaque) (void | error) = { const methods = methods: *[]method; let new = method { return_value = void, ... }; parse_element(parser, "method", @@ -236,7 +236,7 @@ fn parse_method(parser: *xml::parser, methods: *void) (void | error) = { )?; append(methods, new); }; -fn parse_virtual_method(parser: *xml::parser, vmethods: *void) (void | error) = { +fn parse_virtual_method(parser: *xml::parser, vmethods: *opaque) (void | error) = { const vmethods = vmethods: *[]virtual_method; let new = virtual_method { return_value = void, ... }; parse_element(parser, "virtual-method", @@ -248,7 +248,7 @@ fn parse_virtual_method(parser: *xml::parser, vmethods: *void) (void | error) = )?; append(vmethods, new); }; -fn parse_field(parser: *xml::parser, entries: *void) (void | error) = { +fn parse_field(parser: *xml::parser, entries: *opaque) (void | error) = { const entries = entries: *[]entry; let new = field { type_ = simple_type { ... }, ... }; let type_: any_type = simple_type { ... }; @@ -271,7 +271,7 @@ fn parse_field(parser: *xml::parser, entries: *void) (void | error) = { }; append(entries, new); }; -fn parse_property(parser: *xml::parser, properties: *void) (void | error) = { +fn parse_property(parser: *xml::parser, properties: *opaque) (void | error) = { const properties = properties: *[]property; let new = property { type_ = simple_type { ... }, ... }; parse_element(parser, "property", @@ -291,7 +291,7 @@ fn parse_property(parser: *xml::parser, properties: *void) (void | error) = { append(properties, new); }; -fn parse_enumeration(parser: *xml::parser, enums: *void) (void | error) = { +fn parse_enumeration(parser: *xml::parser, enums: *opaque) (void | error) = { const enums = enums: *[]enumeration; let new = enumeration { ... }; parse_element(parser, "enumeration", @@ -308,7 +308,7 @@ fn parse_enumeration(parser: *xml::parser, enums: *void) (void | error) = { append(enums, new); }; -fn parse_function(parser: *xml::parser, functions: *void) (void | error) = { +fn parse_function(parser: *xml::parser, functions: *opaque) (void | error) = { const functions = functions: *[]function; let new = function { return_value = void, ... }; parse_element(parser, "function", @@ -319,7 +319,7 @@ fn parse_function(parser: *xml::parser, functions: *void) (void | error) = { append(functions, new); }; -fn parse_union(parser: *xml::parser, unions: *void) (void | error) = { +fn parse_union(parser: *xml::parser, unions: *opaque) (void | error) = { const unions = unions: *[]union_; let new = union_ { ... }; parse_element(parser, "union", @@ -341,7 +341,7 @@ fn parse_union(parser: *xml::parser, unions: *void) (void | error) = { append(unions, new); }; -fn parse_union_entry(parser: *xml::parser, entries: *void) (void | error) = { +fn parse_union_entry(parser: *xml::parser, entries: *opaque) (void | error) = { const entries = entries: *[]entry; let unions: []union_ = []; defer free(unions); @@ -349,7 +349,7 @@ fn parse_union_entry(parser: *xml::parser, entries: *void) (void | error) = { append(entries, unions[0]); }; -fn parse_bitfield(parser: *xml::parser, bitfields: *void) (void | error) = { +fn parse_bitfield(parser: *xml::parser, bitfields: *opaque) (void | error) = { const bitfields = bitfields: *[]bitfield; let new = bitfield { ... }; parse_element(parser, "bitfield", @@ -365,13 +365,13 @@ fn parse_bitfield(parser: *xml::parser, bitfields: *void) (void | error) = { append(bitfields, new); }; -fn parse_callback(parser: *xml::parser, callbacks: *void) (void | error) = { +fn parse_callback(parser: *xml::parser, callbacks: *opaque) (void | error) = { const callbacks = callbacks: *[]callback; let new = callback { return_value = void, ... }; parse_one_callback(parser, &new)?; append(callbacks, new); }; -fn parse_one_callback(parser: *xml::parser, cb: *void) (void | error) = { +fn parse_one_callback(parser: *xml::parser, cb: *opaque) (void | error) = { const cb = cb: *callback; return parse_element(parser, "callback", parse_info(cb), @@ -384,7 +384,7 @@ fn parse_one_callback(parser: *xml::parser, cb: *void) (void | error) = { ); }; -fn parse_constant(parser: *xml::parser, constants: *void) (void | error) = { +fn parse_constant(parser: *xml::parser, constants: *opaque) (void | error) = { const constants = constants: *[]constant; let new = constant { type_ = void, ... }; let type_: any_type = simple_type { ... }; @@ -404,7 +404,7 @@ fn parse_constant(parser: *xml::parser, constants: *void) (void | error) = { append(constants, new); }; -fn parse_signal(parser: *xml::parser, signals: *void) (void | error) = { +fn parse_signal(parser: *xml::parser, signals: *opaque) (void | error) = { const signals = signals: *[]signal; let new = signal { return_value = void, ... }; parse_element(parser, "glib:signal", @@ -424,7 +424,7 @@ fn parse_signal(parser: *xml::parser, signals: *void) (void | error) = { }; // enum + bitfield -fn parse_member(parser: *xml::parser, members: *void) (void | error) = { +fn parse_member(parser: *xml::parser, members: *opaque) (void | error) = { const members = members: *[]member; let new = member { ... }; parse_element(parser, "member", @@ -458,13 +458,13 @@ fn parse_callable(callable: *callable) [17]scan = [ ("throws", &callable.throws), ("moved-to", null), ]; -fn parse_parameters(parser: *xml::parser, parameters: *void) (void | error) = { +fn parse_parameters(parser: *xml::parser, parameters: *opaque) (void | error) = { return parse_element(parser, "parameters", ("parameter", &parse_parameter, parameters), ("varargs", &parse_varargs, parameters), ); }; -fn parse_method_parameters(parser: *xml::parser, parameters: *void) (void | error) = { +fn parse_method_parameters(parser: *xml::parser, parameters: *opaque) (void | error) = { const parameters = parameters: *(*instance_parameter, *[]callable_param); return parse_element(parser, "parameters", ("instance-parameter", &parse_instance_parameter, parameters.0), @@ -472,7 +472,7 @@ fn parse_method_parameters(parser: *xml::parser, parameters: *void) (void | erro ("varargs", &parse_varargs, parameters.1), ); }; -fn parse_instance_parameter(parser: *xml::parser, param: *void) (void | error) = { +fn parse_instance_parameter(parser: *xml::parser, param: *opaque) (void | error) = { const param = param: *instance_parameter; return parse_element(parser, "instance-parameter", parse_info(param), @@ -486,7 +486,7 @@ fn parse_instance_parameter(parser: *xml::parser, param: *void) (void | error) = ("type", &parse_simple_type, ¶m.type_), ); }; -fn parse_parameter(parser: *xml::parser, parameters: *void) (void | error) = { +fn parse_parameter(parser: *xml::parser, parameters: *opaque) (void | error) = { const parameters = parameters: *[]callable_param; let new = callable_param { parameter = simple_type { ... }, ... }; let type_: any_type = simple_type { ... }; @@ -515,11 +515,11 @@ fn parse_parameter(parser: *xml::parser, parameters: *void) (void | error) = { }; append(parameters, new); }; -fn parse_varargs(parser: *xml::parser, has_varargs: *void) (void | error) = { +fn parse_varargs(parser: *xml::parser, has_varargs: *opaque) (void | error) = { *(has_varargs: *bool) = true; return parse_element(parser, "varargs"); }; -fn parse_return_value(parser: *xml::parser, return_value: *void) (void | error) = { +fn parse_return_value(parser: *xml::parser, return_value: *opaque) (void | error) = { const return_value = return_value: *(callable_return | void); let new = callable_return { type_ = simple_type { ... }, ... }; parse_element(parser, "return-value", @@ -550,7 +550,7 @@ fn parse_info(doc: *documentation) [11]scan = [ ("source-position", null, null), ("attribute", null, null), ]; -fn parse_doc(parser: *xml::parser, text: *void) (void | error) = { +fn parse_doc(parser: *xml::parser, text: *opaque) (void | error) = { const text = text: *str; return parse_element(parser, "doc", ("xml:space", null), @@ -563,7 +563,7 @@ fn parse_doc(parser: *xml::parser, text: *void) (void | error) = { }; // types -fn parse_simple_type(parser: *xml::parser, out: *void) (void | error) = { +fn parse_simple_type(parser: *xml::parser, out: *opaque) (void | error) = { const out = out: *simple_type; return parse_element(parser, "type", parse_info(out), @@ -575,7 +575,7 @@ fn parse_simple_type(parser: *xml::parser, out: *void) (void | error) = { ); }; -fn parse_array_type(parser: *xml::parser, out: *void) (void | error) = { +fn parse_array_type(parser: *xml::parser, out: *opaque) (void | error) = { const out = out: *array_type; let inner: any_type = simple_type { ... }; parse_element(parser, "array", @@ -595,24 +595,24 @@ fn parse_any_type(out: *any_type) [2]scan = [ ("type", &parse_simple_type_union, out), ("array", &parse_array_type_union, out), ]; -fn parse_simple_type_union(parser: *xml::parser, out: *void) (void | error) = { +fn parse_simple_type_union(parser: *xml::parser, out: *opaque) (void | error) = { const out = out: *any_type; let simple = simple_type { ... }; parse_simple_type(parser, &simple)?; *out = simple; }; -fn parse_array_type_union(parser: *xml::parser, out: *void) (void | error) = { +fn parse_array_type_union(parser: *xml::parser, out: *opaque) (void | error) = { const out = out: *any_type; let array = array_type { inner = null: *any_type, ... }; parse_array_type(parser, &array)?; *out = array; }; -type parse_func = nullable *fn(parser: *xml::parser, data: *void) (void | error); +type parse_func = nullable *fn(parser: *xml::parser, data: *opaque) (void | error); type scan_element = ( str, parse_func, - nullable *void, + nullable *opaque, ); type scan_attribute = ( str, @@ -662,8 +662,8 @@ fn parse_element( const (name, func, data) = elements[i]; if (start == name) { match (func) { - case let func: *fn(*xml::parser, *void) (void | error) => - func(parser, data: *void)?; + case let func: *fn(*xml::parser, *opaque) (void | error) => + func(parser, data: *opaque)?; case null => ignore(parser, name)?; }; diff --git a/gir/types.ha b/gir/types.ha index 6616d69..f0f8355 100644 --- a/gir/types.ha +++ b/gir/types.ha @@ -108,7 +108,7 @@ export type record = struct { name: str, c_type: str, disguised: bool, - opaque: bool, + opaque_: bool, pointer: bool, glib_type_name: str, glib_get_type: str, |