looks like a clever way of solving a few issues that we have in our
current version of our libraries. I assume that the category for
java.lang.String is added to NSString, right?
Please make sure that our own demos work with your changes (in
particular Xokoban).
Arno
On 12/13/09 5:57 PM, Gergely Kis wrote:
> Hi,
>
> Currently in XMLVM trunk, the java_lang_String is defined as a typedef
> for NSMutableString + a category. This has the side effect, that @"Const
> string" is not recognized as java_lang_String, also you need to repack
> any NString object you get from Cocoa methods before you can pass it to
> cross compiled code.
>
> This is certainly suboptimal.
>
> In our branch, I changed the definiton of java_lang_String to be a
> typedef of NSString. Of course, the problem is that we need a mutable
> string in order to call the different java string constructors.
>
> So I used the following trick:
> 1. Added a separate alloc method for java_lang_String
> + (id) __alloc_java_lang_String
> {
> return [NSMutableString alloc];
> }
>
> 2. Changed the XSL to use this method instead of the regular alloc, when
> it needs to instantiate a java_lang_String object.
>
> 3. In the Java constructors, like
> __init_java_lang_String_byte_ARRAYTYPE, I call the setString like this:
> [(NSMutableString*)self setString: s];
>
> I plan to also submit this back for inclusion. What do you think? Are
> there any hidden issues that I did not consider?
>
> Best Regards,
> Gergely
>
> --
> Kis Gergely
> MattaKis Consulting
> Email: ger...@ma... <mailto:ger...@ma...>
> Web: http://www.mattakis.com
> Phone: +36 70 408 1723
>
>
>
> ------------------------------------------------------------------------------
> Return on Information:
> Google Enterprise Search pays you back
> Get the facts.
> http://p.sf.net/sfu/google-dev2dev
>
>
>
> _______________________________________________
> xmlvm-users mailing list
> xml...@li...
> https://lists.sourceforge.net/lists/listinfo/xmlvm-users
|