wesnoth-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-dev] Re: towupper


From: Wesnoth
Subject: [Wesnoth-dev] Re: towupper
Date: Thu, 28 Apr 2005 10:23:16 +0100

I have added some code to the main Cocoa file to check the runtime OS version. This is then stored in a variable which can be checked from within the string_utils. Unfortunately this check can not be performed within string_utils due to the problems of mixing Cocoa and C++.

Thanks a lot to Phiippe for that code as it enables the game to run on 10.2.8.

This means that we can check for 10.2.8 and only run the alternate code on that.

Personally I am finding this messy, but the only alternative is to drop 10.2.8 which I think it would be best to avoid for now.

As for checking for towupper, that is not a solution for the binary package which is how most Mac users are going to encounter Wesnoth. There is no compile culture in the Mac community. Those with the desire to do so are definitely the exception rather than the rule. Thus we have to check the host OS at runtime rather than at compile time. This is what it is currently doing. The new version, including my code is:

--- At the start of the file

#ifdef __APPLE__
extern int EarlierThan10_3;
#endif


--- At the critical point:

#ifdef __APPLE__
// FIXME: Should we support towupper on recent OSX platforms?


// MJP Addition
std::string res;
fprintf(stderr, "EarlierThan10_3:%d\n",EarlierThan10_3);
if (EarlierThan10_3 == 1)
{
/* On a 10.2 - 10.2.x system */
wchar_t uchar = *itor;
if(uchar >= 0 && uchar < 0x100)
uchar = toupper(uchar);
res = utils::wchar_to_string(uchar);
} else {
/* 10.3 or later system */
res = utils::wchar_to_string(towupper(*itor));
}
#else

If someone could add this to cvs I'd be grateful :)

--- End



On 26 Apr 2005, at 19:56, address@hidden wrote:

How about doing a configure check for towupper()? This would mean
changing the workaround to depend on something like #ifndef
HAVE_TOWUPPER instead of #ifdef __APPLE__ as currently.


Yes this should be done but the XCode build doesn't use autotools and
configure so we need to check for an old OS X version somehow at
compiletime.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]