When will Wine integrate an x86 CPU emulator?

Francois Gouget fgouget at free.fr
Fri Aug 22 05:29:14 CDT 2003


On Fri, 22 Aug 2003, Shachar Shemesh wrote:

> To add to Jim's idea:
>
> What if the entire Wine code runs natively, but in little endian

Here's the code of InflateRect:

void WINAPI InflateRect16( LPRECT16 rect, INT16 x, INT16 y )
{
    rect->left   -= x;
    rect->top 	 -= y;
    rect->right  += x;
    rect->bottom += y;
}

Please rewrite it so that it takes a little endian RECT struct on a both
big endian architectures and little endian architecture. Then, tell me
what you would do about the approximately 70 places in Wine where we
call it. For instance (from dlls/comctl32/toolbar.c):

    myrect.left = lpRect->left;
    myrect.right = lpRect->right;
    myrect.top = lpRect->top + (lpRect->bottom - lpRect->top - 2)/2;
    myrect.bottom = myrect.top + 1;

    InflateRect (&myrect, -2, 0);

Rewrite the above code snippet so that myrect contains integers in the
little endian format expected by InflateRect. Finally, make sure the -2
and 0 parameters arrive in little endian format in InflateRect.

When all the above is done, tell me honestly: is the code still
readable? Is it still maintainable? Would you do the same for the 15000
other API calls now?


> (possibly for winelib too - that would actually help with binary
> compatibility between the Unix and the windows versions of programs)?

Further exercise: how are you going to explain to Winelib users that
they have to do the same modifications in their application code?


This way lies madness.


PS: Please accept my apologies if this was a joke.


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                     Avoid the Gates of Hell - use Linux.




More information about the wine-devel mailing list