Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : WCHAR type mismatch ?
New Topic New Poll Post Reply
Poster Message
jamie
Level: Smiter
Rank Points: 365
Registered: 04-15-2005
IP: Logged
icon WCHAR type mismatch ? (0)  
On FreeBSD, this fails (and many subsequent similar errors) :
DROD30/DROD/CharacterDialogWidget.cpp: In member function `void CCharacterDialogWidget::SetCommandParametersFromWidgets()':
/usr/users/drod/trunk/DROD30/DROD/CharacterDialogWidget.cpp:3777: error: cannot convert `const __gnu_cxx::character<WCHAR_t, int, mbstate_t>' to `__ct_rune_t' for argument `1' to `int __isctype(__ct_rune_t, long unsigned int)'

line 3777:
if (!this->pCommand->w && (!iswdigit(pOperandText[0]) || WCSlen(pOperandText) > 1))
                                        this->pCommand->label = pOperandText;


It's failing on the "iswdigit" which seems rather correct to me, seeing as the definition is:

const WCHAR *pOperandText;
int iswdigit(wint_t wc);

I basically reduced the whole thing to this:

#include <stdio.h>
#include <wctype.h>
#include <ext/pod_char_traits.h>

main()
{

using namespace std;
using namespace __gnu_cxx;

typedef unsigned short          WCHAR_t;
typedef character<WCHAR_t, int> WCHAR; //wc, 16-bit UNICODE character


  WCHAR *smeg;

  if (!iswdigit(smeg[0])) printf ("boo\n");
}


, which gives the same error, and a similar one on a linux machine I tried it on:

freebsd:
test.cc:17: error: cannot convert `__gnu_cxx::character<main::WCHAR_t, int, mbstate_t>' to `__ct_rune_t' for argument `1' to `int __isctype(__ct_rune_t, long unsigned int)'

linux:
test.cc:17: error: cannot convert ‘__gnu_cxx::character<short unsigned int, int, __mbstate_t>’ to ‘wint_t’ for argument ‘1’ to ‘int iswdigit(wint_t)’


Again, this looks expected to me, so what am I missing ? How come the source compiles on Linux in this state ?

Cheers,
J.

____________________________
#f3i2g# Disclaimer: I'm Welsh, left-handed, and stupid. #f3i2g#
07-18-2007 at 06:09 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5064
Registered: 02-04-2003
IP: Logged
icon Re: WCHAR type mismatch ? (+1)  
Maybe the w-character needs to be wrapped with a W_t() or a We(). ...I can never remember offhand which is which -- the mnemonics escape me.

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.
07-18-2007 at 07:32 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
coppro
Level: Smitemaster
Rank Points: 1308
Registered: 11-24-2005
IP: Logged
icon Re: WCHAR type mismatch ? (+1)  
Question #1: Why does DROD not just use the L modifier to the string constants, instead replacing them with arrays?
Question #2: You need a corrected version of pod_char_traits.h which is at http://cvs.savannah.gnu.org/viewvc/*checkout*/gcc/gcc/libstdc%2B%2B-v3/include/ext/pod_char_traits.h?revision=1.4&content-type=text%2Fplain. Put that in ext.
07-18-2007 at 07:51 PM
View Profile Show all user's posts Quote Reply
ErikH2000
Level: Legendary Smitemaster
Avatar
Rank Points: 2794
Registered: 02-04-2003
IP: Logged
icon Re: WCHAR type mismatch ? (+1)  
coppro wrote:
Question #1: Why does DROD not just use the L modifier to the string constants, instead replacing them with arrays?
It isn't portable. L"" on one O/S means 4-byte wide chars, and on another O/S it means 2-byte wide chars. DROD uses 2-byte wide chars in the data formats which must be binary-compatible from one O/S to the next. This requirement tends to trickle up into other parts of the application that don't necessarily need 2-byte wide chars, but it is still convenient to keep them as 2-byte so that conversion between 2 and 4-byte isn't needed when dealing with persistent storage.

-Erik

____________________________
The Godkiller - Chapter 1 available now on Steam. It's a DROD-like puzzle adventure game.
dev journals | twitch stream | youtube archive (NSFW)
07-18-2007 at 08:18 PM
View Profile Send Email to User Show all user's posts This architect's holds Quote Reply
jamie
Level: Smiter
Rank Points: 365
Registered: 04-15-2005
IP: Logged
icon Re: WCHAR type mismatch ? (0)  
Thanks for the replies. It's the 'wisdigit' bit that it's failing on, also, I downloade the pod file, and it's the same as the one I already have (other than a few spurious space-characters!)

cheers,
Jamie

____________________________
#f3i2g# Disclaimer: I'm Welsh, left-handed, and stupid. #f3i2g#
07-18-2007 at 09:19 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : WCHAR type mismatch ?
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.