Re: [RFA] Add la_getstr member to language_defn

Thiago Jung Bauermann
2008-11-24T18:51:32Z

El lun, 24-11-2008 a las 09:44 -0700, Tom Tromey escribiÃ³:
> Thiago> * language.h (language_dfn): Add la_getstr member.
> Thiago> (LA_GET_STRING): New macro.
>
> A nit: the macro is called LA_GET_STRING, but the field is la_getstr.
> How about la_get_string for the field instead?

I was just following the la_printstr/LA_PRINT_STRING example.
I agree la_get_string is better. Since there doesn't seem to be a strict
pattern for these names, I'll make the change.

> Thiago> + int (*la_getstr) (struct value *value, gdb_byte **buffer, int *length);
>
> I was thinking about writing this function for Java, sort of as a
> proof of the API. One oddity here is that a String there has a fixed
> encoding, which may or may not be the same as the target charset (and
> in any case, is not convertible using the charset.c code).
>
> One idea for fixing this is to let this new method optionally return
> an encoding. That way a language implementation could fill in this
> info if it is known. The C implementation would simply do nothing
> here.
>
> What do you think?

I'm fine with that. What about adding a const char **encoding argument?
c_getstr could return the value from target_charset.
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center