Pelles C forum

Pelles C => General discussions => Topic started by: CommonTater on December 05, 2010, 08:59:00 AM

Title: IDE unicode support....
Post by: CommonTater on December 05, 2010, 08:59:00 AM
This is just a question... I'm thinking perhaps I've missed something along the way.

When working with unicode (wchar_t and windows TCHAR) I find it just a tad frustrating to have to constantly ender _TEXT("test line") or L"Test line" for string literals... I don't even want to guess how often I've had compiler errors because I forgot...

Is there a way to wire things up so the IDE --or maybe the compiler itself-- will recognize the #define _UNICODE declaration and not require the added text?



Title: Re: IDE unicode support....
Post by: Stefan Pendl on December 05, 2010, 09:44:12 AM
I think this is more or less common practice, since I have not seen a compiler allowing to omit the L or _TEXT prefixes.

On the other hand, I have not explored many compilers, since I am happy with Pelles C and M$ SDK/WDK compilers.
Title: Re: IDE unicode support....
Post by: CommonTater on December 05, 2010, 11:29:35 PM
Thanks Stephan... I've been pretty much a Pelle fan since I found it. So like you I haven't played with a lot of different compilers since. 

But, lazy old me wants a compiler switch instead of the extra typing... what can I say?
Title: Re: IDE unicode support....
Post by: Stefan Pendl on December 06, 2010, 12:26:21 AM
A preprocessor option or pragma could be one solution.

Another one would be a plug-in to parse and correct the code.

On the other hand, doesn't the UNICODE flag of the project macros take care of this?
Title: Re: IDE unicode support....
Post by: CommonTater on December 06, 2010, 04:57:05 AM
A preprocessor option or pragma could be one solution.

Another one would be a plug-in to parse and correct the code.

On the other hand, doesn't the UNICODE flag of the project macros take care of this?

Unfortunately defining _UNICODE or UNICODE doesn't get me around the extra bit on literals. I thiught it would at first but then I got the ever so popular: "More than 100 errors, please improve yourself" message from the compiler. 

I've played with a couple of macros to no avail. 
The plug in might be an idea... write a section of code, then re-parse it to stuff in the L...

Title: Re: IDE unicode support....
Post by: iancasey on April 07, 2011, 10:46:57 PM
Tater,
decorate your text with '_T("")  and even change functions to unicode.

this may help:

http://www.bcxgurus.com/bcxusers/Ian/unicodelexer.zip
also see :
http://www.bcxgurus.com/bcxusers/Ian/PPCstuff/PellesC %26 BCX2Unicode.html
you won't need the bcx stuff but just calls to POCC and POLINK

works either command line or gui.

You can change the TCHARXLATER.txt file to suit you

I use it all the time for unicode as it works on the c code.

Saves me lots of time

Ian