[Vala] problems with GMarkupParser bindings
- From: pHilipp Zabel <philipp zabel gmail com>
- To: vala-list <vala-list gnome org>
- Subject: [Vala] problems with GMarkupParser bindings
- Date: Mon, 19 Oct 2009 15:20:12 +0200
Hi,
I'm trying to use the Simple XML Subset Parser, starting from the
example at http://live.gnome.org/Vala/MarkupSample.
The GLib.MarkupParser struct is defined as follows:
unowned GLib.MarkupParser parser = {
(context, element_name, attribute_names, attribute_values) => {
stdout.printf("start |%s|\n",element_name);
for (int i = 0; i < attribute_names.length ; i++) {
stdout.printf("Attr name: %s, value:
%s\n",attribute_names[i],attribute_values[i]);
}
} ,
// [...]
};
I declared it as unowned to avoid the destroy function problem
reported a few times (bugs #595925, #597797, #598178).
That first lambda function is start_element, of type
MarkupParserStartElementFunc:
public delegate void MarkupParserStartElementFunc
(MarkupParseContext context, string element_name, [CCode (array_length
= false, array_null_terminated = true)] string[] attribute_names,
[CCode (array_length = false, array_null_terminated = true)] string[]
attribute_values) throws MarkupError;
But Vala happily ignores the array_length and array_null_terminated
properties and produces this code:
static void _lambda0_ (GMarkupParseContext* context, const
char* element_name, char** attribute_names, int
attribute_names_length1, char** attribute_values, int
attribute_values_length1, GError** error);
I'd expect it to result in the following C code instead:
static void _lambda0_ (GMarkupParseContext* context, const
char* element_name, char** attribute_names, char** attribute_values,
GError** error);
But even this is wrong, as the actual struct GMarkupParser definition
contains an additional user_data pointer:
/* Called for open tags <foo bar="baz"> */
void (*start_element) (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
const gchar **attribute_values,
gpointer user_data,
GError **error);
Can Vala be convinced to honor the CCode for MarkupParserElementFunc?
And how can I set it up to add the user_data pointer?
regards
Philipp
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]