[Win32utils-devel] 1.9.x compatibility for win32-api

Luis Lavena luislavena at gmail.com
Wed Feb 18 14:43:53 EST 2009


On Wed, Feb 18, 2009 at 5:17 PM, Berger, Daniel <Daniel.Berger at qwest.com> wrote:
>
> [...]
>
> I'm a little stuck at the moment, as it appears 1.9.x has separate macros for RARRAY(ptr) vs RARRAY(ptr)->[index]. Anyone happen to know what it is?
>
> Anyway, this is what I've got so far. If anyone can fill in the "???" for me that would be swell.
>
> // Ruby 1.9.x
> #ifndef RSTRING_PTR
> #define RSTRING_PTR(s) (RSTRING(s)->ptr)
> #endif
> #ifndef RSTRING_LEN
> #define RSTRING_LEN(s) (RSTRING(s)->len)
> #endif
>
> #ifndef RARRAY_PTR
> #define RARRAY_PTR(a) (RARRAY(a)->ptr)
> #define RARRAY_?????? (RARRAY(a)->ptr[i])
> #endif
> #ifndef RARRAY_LEN
> #define RARRAY_LEN(a) (RARRAY(a)->len)
> #endif
>

This ticket has a good example:

http://redmine.ruby-lang.org/issues/show/839

RARRAY_PTR(a)[i]

Only RARRAY_PTR(a) needs to get defined, since the index from the
array will work out of the box in both cases.

Did that help?

-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry


More information about the win32utils-devel mailing list