On 8/6/07, Nicolas Cannasse <[EMAIL PROTECTED]> wrote:
> > Hello list,
> >
> > I have a slight problem here, I'm using a simple stringscanner to
> > parse my language, but i cannot parse literal 32bit integer even if i
> > handle them internally like that since the only way from string->Int32
> > is over $int which cuts the value to 31bit. Same goes for float, there
> > is a way to go to float but not from float.
>
> Hello,
>
> Yes, there's no easy way of doing this right now. But you can write a
> string -> int32 converter that will start with 0, then multiply by 10
> and add the number for each digit in your string.
>
> Maybe a float -> int32 function would help here.
> I just modified int32_new on CVS so it can accept a float.
>

Thanks for that, in the meanwhile i am using: http://pastie.caboo.se/86027
As you can see it's not very performant, the first bytes could be
converted by $int, but just as a quick and dirty solution it works
fine.

> > Also, is there any Int64 planned?
>
> Not right now. If you want to contribute one, I'll have a look at
> integrating it into the standard library.

I just don't know C to this level yet, so i'm not sure if it is
possible to implement this in a cross-platform manner or it needs some
special hacks.
AFAIK there is a guy who also works with HaXe who wanted to do an
Int64 once he's got too much time on his hands, so i'll be patient.

> > Ah, and if someone wants to see my (horrible) code, just go to
> > http://manveru.mine.nu/darcs/prog/neko/oxid/
>
> Looks interesting, good luck !

thanks a lot :)

^ manveru

-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to