Part of what I was telling you earlier is that you can set XMLCh to be
wchar_t. The parse is designed to work this way, as well as with XMLCh set
to unsigned int. If CW actually is compliant and has wchar_t as a unique
type, then you should set XMLCh to wchar_t on your platform. You'd do it in
the CW per-compiler file.

----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
[EMAIL PROTECTED]



[EMAIL PROTECTED] on 02/07/2000 12:24:23 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  re: Metrowerks Codewarrior for Windows



Yes, I did adjust autosense.hpp.  One thing I had to do is change this:

#if defined(_MSC_VER)
    #define XML_VISUALCPP
#elif

to this

#if defined(_MSC_VER) && !defined( __MWERKS__ )
    #define XML_VISUALCPP
#elif

because Metrowerks defines _MSC_VER.  I guess it's trying to be Microsoft C
compatible.

The wide-char routines appear to almost, but not quite work.

One thing that I know for sure is broken under Metrowerks is this code:

unsigned int Win32LCPTranscoder::calcRequiredSize(const char* const
srcText)
{
    if (!srcText)
        return 0;

    const unsigned int retVal = ::mbstowcs(0, srcText, 0);
    if (retVal == (unsigned int)-1)
        return 0;
    return retVal;
}

In this case, passing a nil destination pointer and 0 buffer length is
supposed to
calculate the required size for the buffer if you actually did transcode
it;
Metrowerks always returns 0.

I was able to go through the code provided by 1.0.1 and work around this,
but I
still had all kinds of trouble.

There's another problem in getting things to compile, in that an XMLCh
won't be
automatically cast to a wchar_t (or XMLCh* to wchar_t*) by the compiler and
you
have to put in casts.

I recall having this same problem on the macintosh with some other code
from
Windows that I was porting for another project; I think a wchar_t is two
bytes
under metrowerks but the compiler just doesn't consider it an integer
value.

Maybe I'm wrong and it's 4 bytes or something and then I'd be all screwed
up.
But if you actually do pass a buffer to the ANSI widechar routines, they
mostly
get transcoded right.

My problem is that I get all kinds of weird crashes.  It's been frustrating
because it
locks up the machine a lot.  I guess Win98 doesn't have protected memory -
maybe I should try to install NT on my laptop for development, I've got a
partition
set aside for it.

Unfortunately it's not really an option to switch compilers at this point.
I could
possibly do it later.  The problem is that I've got a mountain of someone
else's
cross-platform GUI code that compiles and runs just fine on Metrowerks for
Mac,
Windows and BeOS.  I spoke to the author about making it run under Visual
C++
and he thought it would "probably work" but I don't want to be the one to
find all
the weird problems that will result!

Don't tell me about standards, there ain't no [EMAIL PROTECTED]&*( standards!

Mike



Reply via email to