Re: [Vala] [patch] G.Scanner



Hi,

Le mardi 27 octobre 2009 à 18:10 +0100, Julian Andres Klode a écrit :
Am Dienstag, den 27.10.2009, 17:55 +0100 schrieb Xavier Bestel:
Hi,

could someone apply that please ?

Thanks,
    Xav

--- /usr/share/vala/vapi/glib-2.0.vapi.orig 2009-10-20 19:22:51.000000000 +0200
+++ /usr/share/vala/vapi/glib-2.0.vapi      2009-10-21 17:10:01.000000000 +0200
@@ -2125,13 +2125,17 @@
            public TokenValue next_value;
            public uint next_line;
            public uint next_position;
-           public Scanner (ScannerConfig? config_templ);
+           public Scanner (ScannerConfig? config_templ = null);
This seems good to me.

            public void input_file (int input_fd);
            public void sync_file_offset ();
            public void input_text (string text, uint text_len);
            public TokenType peek_next_token ();
            public TokenType get_next_token ();
            public bool eof ();
+           public int cur_line ();
+           public int cur_position ();
+           public TokenType cur_token ();
+           public TokenValue cur_value ();
Don't they do the same as the member line, position, token and value do,
and are thus useless?

They are, but they correctly access the values through methods instead
of direct member access. Direct access is undocumented, so I guess it's
not really part of the API and can change anytime.

            public uint set_scope (uint scope_id);
            public void scope_add_symbol (uint scope_id, string symbol, void* value);
            public void scope_foreach_symbol (uint scope_id, HFunc func);
@@ -2213,6 +2217,7 @@
    }
 
    [SimpleType]
+   [CCode (destroy_function = "")]
    public struct TokenValue {
            [CCode (cname="v_symbol")]
            public void* symbol;
I never experienced any kind of problem with TokenValue, and thus I
can't see why such a patch would be needed. At least everything in
http://git.debian.org/?p=users/jak/apt2.git;a=blob;f=libapt/configuration.vala;h=524b204049cabfa50f94c1a2aa31838483dcaac4;hb=HEAD
works perfectly. It may be related to your cur_value() function not
being weak although it probably should be (as it just returns the
'value' member), but I'm not sure here.

I'm not sure either. I tried the weak thing, it doesn't help.
The trouble is that Vala doesn't support union natively, and there's
absolutely no documentation on how the use the metadata to resolve such
a case (and no one answers when I ask).
In the meantime, it's the only solution I found which works.

Of this patch, the only thing that looks useful to me is the default
value in the constructor. The remaining changes just seem kind of
useless to me.

But it doesn't look clean at all to me.

        Xav






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]