Hi Frederik,
'out string' will not work - that was the first thing I tried - problem is that
if I would have used 'out string' in 'setup' function, the generated C code
will pass some temporary variable to 'setup' and not the location of the
required location. That is the reason why I've included that long explanation
how it works. Maybe I was not clear enough, so let me explain again:
1) 'setup' functions takes 'location' of 'char*' destionation variable and
stores it along with 'name' in 'SomeParser' structure
2) 'run' then does the parsing and fills all locations described by their names
by previous 'setup' calls
3) now all destionations registered with 'setup' are filled
or I can use some pseudo-C-code to explain better how that parser works:
------------------------------------------
typedef struct {
CoolStringMap map;
} SomeParser;
void some_parser_setup(SomeParser *self, char *name, char **location)
{
cool_map_set(self->map, name, location);
}
void some_parser_run(SomeParser *self)
{
...
for (name, location) in self->map {
char *str = strdup(cool_parser_get_value(name));
*location = str;
}
...
}
------------------------------------------
Another thing - I know that 'char *' is 'string', but why 'string a_str = a;'
does not work?
Jan Spurny
On Tue, 08 Mar 2011 17:26:52 +0100 (CET)
Frederik <[email protected]> wrote:
> 'char *' is 'string'
> 'char **' ist 'out string' in your case.
>
>
> Best regards,
>
> Frederik
> _______________________________________________
> vala-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list