Am Sonntag, den 06.12.2009, 17:18 +0100 schrieb Jürg Billeter:
> On Sat, 2009-12-05 at 21:10 +0100, Michael 'Mickey' Lauer wrote:
> > How can we fix the MarkupParser binding?
> > 
> > Apart from the anonymous callbacks, which needs fixing upstream, it
> > still doesn't quite work, as the delegates complain about their missing
> > target. How can we fix that?
> 
> The MarkupParser binding should be usable, IIRC, although possibly not
> in the most convenient way and it's easy to get it wrong in a way that
> valac can't detect. If you have an issue that goes beyond convenience
> and error detection, please paste a test case and I'll take a look.

Ok, for a start the attached example which fails with

mic...@andromeda:/tmp$ valac parse.vala 
/tmp/parse.vala.c: In function ‘foo_construct’:
/tmp/parse.vala.c:108: warning: assignment from incompatible pointer
type
/tmp/parse.vala.c:108: error: ‘GMarkupParser’ has no member named
‘start_element_target’
/tmp/parse.vala.c:109: error: ‘GMarkupParser’ has no member named
‘end_element_target’
/tmp/parse.vala.c:110: error: ‘GMarkupParser’ has no member named
‘text_target’
/tmp/parse.vala.c:111: error: ‘GMarkupParser’ has no member named
‘passthrough_target’
/tmp/parse.vala.c:112: error: ‘GMarkupParser’ has no member named
‘error_target’
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)

Making the functions in question static doesn't improve it.

Thanks,

:M:



-- 
:M:
using GLib;

class Foo
{
    MarkupParser parser;

    public Foo()
    {
        parser.start_element = startElement;
        parser.end_element = endElement;
        parser.text = textFunc;
        parser.passthrough = passthroughFunc;
        parser.error = errorFunc;
    }

    public void startElement(MarkupParseContext context, string element_name, string[] attribute_names, string[] attribute_values) throws MarkupError
    {
        debug( @"start element $element_name" );
    }

    public void endElement(MarkupParseContext context, string element_name) throws MarkupError
    {
        debug( @"end element $element_name" );
    }

    public void textFunc(MarkupParseContext context, string text, size_t text_len) throws MarkupError
    {
        debug( @"text '$text'" );
    }

    public void passthroughFunc(MarkupParseContext context, string passthrough_text, size_t text_len) throws MarkupError
    {
        debug( @"passthrough" );
    }

    public void errorFunc (MarkupParseContext context, Error error)
    {
        debug( @"error: $(error.message)" );
    }
}


void main()
{

}
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to