Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: rickg22 on August 04, 2005, 11:24:31 pm

Title: Unicode conversion (attention all devs)
Post by: rickg22 on August 04, 2005, 11:24:31 pm
Attention all developers:

After RC1 was released, there have been lots of complains asking for the installation of Code::Blocks in Linux. And we all agree that we need to get Code::Blocks to compile with unicode support.

Therefore, in absence of the project administrator, i've taken the decision to halt current development and get Code::Blocks branch VERSION_1_0 to work with unicode.

The solution is easy: All operations with wxStrings (not char*'s) should have _("string") for strings to be displayed to the user, and _T("string") for strings used internally.

UPDATE: Please refer to http://www.wxwidgets.org/manuals/2.4.2/wx458.htm#unicode for more info. We need to watch out for char's (change to wxChar), too!

I've made a dir listing - the sdk and src subdirectories have about 100 .cpp files that we need to modify. 200 if we include the plugins.

The currently available co-developers with (at least partial) CVS access are:
byo, Ceniza, cyberkoa, mispunt, and me.

Since I don't have administrator access, I can't know which directories you guys have access to. So guys, those with write access to the SDK please modify the SDK. Those with access to plugins, modify their plugins accordingly.

I'M SETTING A DEADLINE OF 10 DAYS. (This means the conversion work should be completed before August 15)

After those 10 days, we will continue development as normally. Maybe later we'll do another conversion cycle and finish this off.

Those WITHOUT CVS access, please mail their patched files (zipped, please) to me (NOT thru sourceforge, that'd make an awful mess!)

So, before we start working, I need anyone willing to help to say which files he is to modify (non-cvs access people will work on the SDK).

I'll divide the conversion in the following groups of files:

group 0 - all files in the src/src subdirectory.
group 1 - from audodetectcompilers to cbeditorprintout
group 2 - cbproject to cbworkspace
group 3 - compileoptionsbase to compiletarget base
group 4 - configmanager to customvars
group 5 - devcpploader to editarraystringdlg
group 6 - editorbase to editormanager
group 7 - editpathdlg to findreplacebase
group 8 - globals to licenses
group 9 - macrosmanager to menuitemsmanager
group 10 - messagelog to messagemanager
group 11 - mscvc* - zieQ, you handle this one Edit: Oh, already did it, but you better check it.
group 12 - multiselectdlg to personalitymanager
group 13 - pipedprocess to printing_types
group 14 - project*
group 15 - replacedlg to simpletextlog
group 16 - templatemanager to xtra_res
plugins    - the plugins conform a group each (i.e. astyle, compiler, etc).

Before modifying any of the files (download them via CVS, either anonymous or standard), please post which group you're modifying.

So, let's get to work guys, we have one week!
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: David Perfors on August 04, 2005, 11:40:22 pm
I will try to do something to group 0 when I am awake again.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 05, 2005, 12:45:19 am
OK i will do groups 1 ...5 (autodetectcompilers ... editarraystringdlg)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 01:19:58 am
Thanks! Don't forget to:

a) Compile to make sure everything works
b) mail me (or commit) the changes when you're done with each group.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 02:23:38 am
As main developer of wxSmith I'll take care of it ;). It won't be released before final C::B 1.0 but I think it's time to unicode wxSmith also.

I can additionally do groups 6-8 - will send them to rickg22 when done.

Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: Ceniza on August 05, 2005, 03:07:37 am
What do I do?! What do I do?!

Oh, nevermind, I'll convert the help_plugin :)

I should take care of the AStyle plugin too but I think I don't have write access there.

Anyway, I'll inform you this weekend.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 03:09:38 am
Ceniza: You don't need write access, mail the changes to me :)

Anyway, I'll start with 9 and 10, followed by 12 and 13.

Update: Done.  :shock: wow, that was fast. Took me 2 hours and 10 minutes. Now I'm compiling and testing.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 03:42:27 am
Any doubts please post in this thread.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 04:07:31 am
IMPORTANT!!!

XRCID and XRCCTRL macros must _NOT_ be converted! They're pre-converted already!

Quote
WRONG:   XRCCTRL(*this, _T("lblLabel"), wxStaticText)->SetLabel(label);

Quote
RIGHT:   XRCCTRL(*this, "lblLabel", wxStaticText)->SetLabel(label);

Also, be careful. Some of the strings already converted in C::B, use _( when they should be _T(.

Example:

Quote
WRONG: wxXmlResource::Get()->LoadDialog(this, parent, _("dlgGenericMultiSelect"));
dlgGenericMultiSelect is a reference to a resource. Therefore it must use _T instead.
Quote
RIGHT: wxXmlResource::Get()->LoadDialog(this, parent, _T("dlgGenericMultiSelect"));

And don't forget to test for single characters, too!

Quote
'c'

and
Quote
char

Hints: Use the search dialog  :roll: should be obvious by now. Search for "  and '  (single-file) and char (whole word, search in open files).

After replacing the strings in the file, make sure you search again and double-check <- THIS IS VERY IMPORTANT.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: me22 on August 05, 2005, 06:20:04 am
Note: TinyXML needs to NOT be put in Unicode mode.  Use the wxString facilities for getting a wxString to a UTF-8 encoded char*.  Perhaps we can have some typedefs and parallel defines somewhere to make this easier?  perhaps wxString_from_tinyString function and tinyString_from_wxString inlines and a tiny_() and tiny_T() macro?

Something like the following in a global include, perhaps?
#define tinyxml_T(m) m
#define wxString_from_tinyXMLstring( s ) ( wxString( (s), wxConvUTF8 ) )
#define tinyXMLstring_from_wxString( s ) ( (s).mb_str(wxConvUTF8) )

[edit] Ok, I should have read closer before posting, the above was true as of 1.0-beta6, but perhaps less neccesary now? :|  I'll try and help out this weekend.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 07:10:16 am
Files which include tinyxml.h (or have "tixml" in them) and need to be modified VERY CAREFULLY:

editorlexerloader.* (group 6)
ibaseloader.* (group7)
projectlayoutloader.*  (i'm handling this one, and all group14 files)
projecttemplateloader.*
projectloader.*
msv7loader.* ( careful, zieQ!)
workspaceloader.* (group 16)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 05, 2005, 08:10:13 am
... get Code::Blocks branch VERSION_1_0 to work with unicode

You should TAG the current VERSION_1_0 branch in cvs before committing any unicode updates.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 05, 2005, 11:22:41 am
And don't forget to test for single characters, too!

have you changed all
Code
char
to
Code
wxChar
???

or how did you proceed with the char's ?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: David Perfors on August 05, 2005, 11:49:03 am
Update, I can't do anything (sorry) I am going away this afternoon, and I don't have my official development pc here at home. So I need to compile wxWidgets first which take a lot of time, and then I have to get the cvs version of C::B. Sorry, but I can't do anything.
Next week I have my own computer again, but I don't have internet connection. I will try to do download the cvs version of codeblock and take it with me to that pc, but I doubt if I could find the time to do something...
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 03:47:40 pm
Nah, it's ok.

Oh yes, I searched the source code ant it appears there are no "char" types defined in the project, all are wxChar's (that's a good thing :) ).

Anyway, how are you guys doing in your progress?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 03:48:40 pm
You should TAG the current VERSION_1_0 branch in cvs before committing any unicode updates.

I did :-) thanks for the suggestion.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 05, 2005, 04:03:48 pm
Oh yes, I searched the source code ant it appears there are no "char" types defined in the project, all are wxChar's (that's a good thing :) ).

sorry rick, but i think you need a better search tool ! i've found 980 occurrences of "char"
not all of them are "hits" but a lot of them are !

my search results are attached

[attachment deleted by admin]
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 04:12:38 pm
Oops :oops: my mistake. I had only searched the groups i was fixing ^^;

You're right. ALL char references MUST be converted to wxChar's, UNLESS they're sent as parameters to non-unicode-supporting functions (like tinyxml or something).

Update: It appears cbeditor.cpp uses byte buffers for reading and saving files. ARGH! It's the one that relies HEAVILY on wxStyledTtextControl! I say we leave cbEditor FOR THE END.

I see a problem with ASBeautifier. It seems to need a full conversion :-S
Someone contact the guys and tell 'em about it.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 06:41:58 pm
One question - if wxStrring is used as a param inside printf-like function should it be converted using c_str() or mb_str() ?

Example:
           
Code
tmpkey.Printf(_T("%s/editor/keywords/%d"), key.c_str(), i);

Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: elvstone on August 05, 2005, 06:46:27 pm
Hi Code::Blocks developers!

I'm using a Unicode build of wx 2.6.x on top of FreeBSD on my machine, and I'm looking forward to trying to get C::B running on it. When do you think I can expect the Unicode fixes discussed in this topic to hit CVS? I'm eager to check out and start testing C::B and maybe help out if there's lot of Unicode fixes left to be made. I've developed Unicode enabled wx applications before, and know about the issues involved. Just finished a non-programming project at work, and as a result I have some free summer time that I'd be glad to spend on getting a promising IDE running on my favourite OS. Any of the groups described by Rick still not assigned to anyone?

Best regards,
Aron Stansvik

Edit: Oh right. You don't happen to have an IRC channel somewhere?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: David Perfors on August 05, 2005, 06:55:23 pm
Hi Code::Blocks developers!

I'm using a Unicode build of wx 2.6.x on top of FreeBSD on my machine, and I'm looking forward to trying to get C::B running on it. When do you think I can expect the Unicode fixes discussed in this topic to hit CVS? I'm eager to check out and start testing C::B and maybe help out if there's lot of Unicode fixes left to be made. I've developed Unicode enabled wx applications before, and know about the issues involved. Just finished a non-programming project at work, and as a result I have some free summer time that I'd be glad to spend on getting a promising IDE running on my favourite OS. Any of the groups described by Rick still not assigned to anyone?

Best regards,
Aron Stansvik

Edit: Oh right. You don't happen to have an IRC channel somewhere?
You are welcome to help of course, I think that Rick is updating the cvs constanly, so you can test it whenever you want ;) and submit patches by e-mail to Rick.

No we don't have an IRC channel
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: elvstone on August 05, 2005, 07:06:44 pm
Okay.

Because I was browsing the CVS at SourceForge and saw no Unicode-related commits yet, even though (judging by previous posts in this thread) some work has already been done. I'll keep monitoring the CVS until these changes are commited, don't want to risk duplicating work already done in the developers' local copies.

Thanks,
Aron
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 05, 2005, 07:42:13 pm
i've made a rough table (needs to be edited and extended) of the files in \src\sdk

if someone wants to help, please look in this table, and find *your* files to edit
please post which files you are processing. You can copy/edit this table, add your
comments and repost them here.

after editing/compiling/testing send the edited files by email to rickg22

Code
This table was removed. Updated version a few posts below.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 07:58:29 pm
I've been missed - I'm working on 6,7 and 8 :)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: Ceniza on August 05, 2005, 08:28:15 pm
Hmmm, if it's VERSION_1_0 I shouldn't touch the help plugin there, but now you scared me about the ASBeautifier. It uses C++ strings so what would you suggest? Convert from Unicode wxString to string or try to replace string to wstring?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: elvstone on August 05, 2005, 08:49:01 pm
Ok. I've started working on group 16. I'm on a FreeBSD machine with only a Unicode build of wxWidgets 2.6.0 installed. This means I can only test the code to the point where I see that there are no Unicode-related errors like ambigous overloads/convertions in the files I'm working on, when compiling with the headers from my Unicode enabled wx installation, since compiling the entire application for testing on my machine would require all the Unicode issues to be fixed already. I hope that this is okay and that you guys can test the application logic on your machines after my changes.

Aron
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 09:13:50 pm
Thanks :)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 09:18:08 pm
My current status :

Code
Table removed by Rick. See updated table a few posts below

only testing left ;)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 09:31:31 pm
I'm working on group 14. Who wants group 15?

Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: darklordsatan on August 05, 2005, 09:59:44 pm
I'm working on group 14. Who wants group 15?
If you dont need it to be done like in 3 hours from now (Id probably be done for tomorrow), then Im in.
If you agree, then, what should I download? The sources pointed in the download section or the cvs snapshot?

Cheers
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 05, 2005, 10:02:10 pm
One question - if wxStrring is used as a param inside printf-like function should it be converted using c_str() or mb_str() ?

Example:
Code
tmpkey.Printf(_T("%s/editor/keywords/%d"), key.c_str(), i);

hi byo - how did you proceed with this ?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: takeshimiya on August 05, 2005, 10:09:18 pm
Do not use wxChar when is not a text character, because a wxChar in unicode is an int of 16 bits (not 8 bits):

Example for text:
wxChar im_a_character = _T('f');

Example for not text (not character):
char im_a_byte = 254;
but perhaps better would be to use:
byte im_a_byte = 254;
so it's clear that it's a byte and not a character.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 05, 2005, 10:32:03 pm
what to do here ?
Code
            // indent code accordingly
            wxString code = it->second;
            code.Replace("\n", '\n' + lineIndent);

from the docs:
Quote
wxString::Replace
size_t Replace(const char* szOld, const char* szNew, bool replaceAll = true)

Replace first (or all) occurrences of substring with another one.

replaceAll: global replace (default), or only the first occurrence.

Returns the number of replacements made.


wxString::Replace()  seems to be not fit for unicode ? or what ?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 10:56:39 pm
Stan: Take the sources from the CVS snapshot. There were 2 or 3 bugs fixed after RC1-1.

Tiwag: If the input is a const char*, use "normal strings". If the input is a wxChar or wxString, use the _T("macros").

So in this case, just use normal strings.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: darklordsatan on August 05, 2005, 11:03:47 pm
Stan: Take the sources from the CVS snapshot. There were 2 or 3 bugs fixed after RC1-1.

So, the branch is VERSION_1 not HEAD, right?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 11:05:15 pm
Uh oh... I just noticed from the docs.

wxString& operator <<(const wxString& str)
wxString& operator <<(const char* psz)
wxString& operator <<(char ch)

Apparently the << 's can be used with either normal strings or wxstrings, but not with wxChar's. UGH i have to change one or two sources back... :-/
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 11:08:34 pm
what to do here ?
Code
            // indent code accordingly
            wxString code = it->second;
            code.Replace("\n", '\n' + lineIndent);

from the docs:
Quote
wxString::Replace
size_t Replace(const char* szOld, const char* szNew, bool replaceAll = true)

Replace first (or all) occurrences of substring with another one.

replaceAll: global replace (default), or only the first occurrence.

Returns the number of replacements made.


wxString::Replace()  seems to be not fit for unicode ? or what ?


wxWidgets documentation about wxString class seems to be outdated - in header files there's such declaration:

Code
  size_t Replace(const wxChar *szOld,
                 const wxChar *szNew,
                 bool bReplaceAll = true);

I would change the code to:

Code
            // indent code accordingly
            wxString code = it->second;
            code.Replace(_T("\n"), _T('\n') + lineIndent);
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 11:12:32 pm
Uh oh... I just noticed from the docs.

wxString& operator <<(const wxString& str)
wxString& operator <<(const char* psz)
wxString& operator <<(char ch)

Apparently the << 's can be used with either normal strings or wxstrings, but not with wxChar's. UGH i have to change one or two sources back... :-/

Same as in my previous post - documentation outdated. In header files for both wx 2.4 and 2.6 is:

Code
      // string += C string
  wxString& operator<<(const wxChar *psz)
    { append(psz); return *this; }
      // string += char
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: Urxae on August 05, 2005, 11:15:44 pm
Uh oh... I just noticed from the docs.

wxString& operator <<(const wxString& str)
wxString& operator <<(const char* psz)
wxString& operator <<(char ch)

Apparently the << 's can be used with either normal strings or wxstrings, but not with wxChar's. UGH i have to change one or two sources back... :-/

I wouldn't if I were you, cause that would be wrong :P. The docs are generated by automated tools that among other things resolve typedefs such as wxChar to whatever they're typedeffed to. I've noticed on several occasions that they seem to be generated in non-unicode mode. If you actually look in <wx/string.h> (2.6.1) you'll see this:
Code
      // string += C string
  wxString& operator<<(const wxChar *psz)
    { append(psz); return *this; }
      // string += char
  wxString& operator<<(wxChar ch) { append(1, ch); return *this; }

Damn. Beaten. Twice even :shock:.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 05, 2005, 11:18:36 pm
what to do here ?
Code
            // indent code accordingly
            wxString code = it->second;
            code.Replace("\n", '\n' + lineIndent);

from the docs:
Quote
wxString::Replace
size_t Replace(const char* szOld, const char* szNew, bool replaceAll = true)

Replace first (or all) occurrences of substring with another one.

replaceAll: global replace (default), or only the first occurrence.

Returns the number of replacements made.


wxString::Replace()  seems to be not fit for unicode ? or what ?


wxWidgets documentation about wxString class seems to be outdated - in header files there's such declaration:

Code
  size_t Replace(const wxChar *szOld,
                 const wxChar *szNew,
                 bool bReplaceAll = true);

I would change the code to:

Code
            // indent code accordingly
            wxString code = it->second;
            code.Replace(_T("\n"), _T('\n') + lineIndent);


thats what i've already done  ... thanks byo ... i really got unsure for a moment ...  :shock:

cbeditor.cpp was really a brainteaser ... puuh

btw
  i really don't like the fact, that we can't rely on the wx.chm docs
  that's a lot of additional work to study the header's all the time
  somewhat boring ...  but what can we do else ?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 11:26:00 pm
There's one thing important when working with concatenated strings:

_() is macro which calls one of wxWidget's internal function so concatenating should look like this:

Code
_("string 1" "string2" ... )

_T() macro simply adds 'L' before string given as a param (in Unicode of course, in normal mode it do nothing with the string) so concatenation should be:

Code
_T("string1") _T("string2") ...

BTW. Answer to my previous post about Printf-like functions is - use c_str() (in examples in wxwidgets.org there are used different arguments for unicode and non-unicode versions where formating string was both "%s")

Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 11:29:57 pm
btw
  i really don't like the fact, that we can't rely on the wx.chm docs
  that's a lot of additional work to study the header's all the time
  somewhat boring ...  but what can we do else ?

I try to compile changed sources in both Unicode and NonUnicode versions of wxWidgets (and after that in wx2.4 and wx2.6 to make sure it will work everywhere). Unfortunately all project can't be compiled in Unicode but separate files can :)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: Ceniza on August 05, 2005, 11:32:51 pm
Ok, I got the AStyle plugin to compile with wxWidgets UNICODE, but not to link ('cause it needs libcodeblocks.a which I didn't compile, and I think the reasons are obvious).

Anyway, it wasn't that bad. There was only an evil line and this was my workaround:

Code
#ifdef wxUSE_UNICODE
        formattedText << wxString(formatter.nextLine().c_str(), wxConvLocal);
#else
        formattedText << formatter.nextLine().c_str();
#endif

I couldn't find any other way to get it work. If you've got a working trick which looks better let me know, otherwise that could work in the meanwhile if someone else need it.

rickg22: I'll send it to your e-mail when a decision be made, ok?

[edit]
Hmmm, I should add that formatter.nextLine() returns std::string :)
[/edit]
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 11:34:39 pm
I will take group 15 (previous groups done, sent to rickg22)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 05, 2005, 11:36:51 pm

thats what i've already done  ... thanks byo ... i really got unsure for a moment ...  :shock:


Yeah! :shock: whew... glad i've done nothing wrong.

ANYWAY GUYS... yes, i checked the includes. Apparently we have nothing to worry about doing "too much conversion" regarding wxString functions and operators. And if you have doubts, go to the header files!
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 05, 2005, 11:46:23 pm

Code
#ifdef wxUSE_UNICODE
        formattedText << wxString(formatter.nextLine().c_str(), wxConvLocal);
#else
        formattedText << formatter.nextLine().c_str();
#endif


Hmm, wont the first form work both in unicode and non-unicode version ? In files I've changed it works. It's in headers wxstring.h:

when in Unicode:
Code
#if wxUSE_UNICODE
    // from multibyte string
  wxString(const char *psz, wxMBConv& conv, size_t nLength = npos);

when not:

Code
  wxString(const wxChar *psz, wxMBConv& WXUNUSED(conv), size_t nLength = npos)
      : wxStringBase(psz, nLength == npos ? wxStrlen(psz) : nLength) { }
(here wxChar is equal to char)

so when in non-unicode version the secondargument wil be ignored.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: Ceniza on August 05, 2005, 11:54:04 pm
So keeping it the evil way would work for both...

Well, I'll leave it that way (with the #ifdef) so the ASCII build won't need to create a wxString object unnecessarily.

I would also like to inform you the help plugin is ready for UNICODE too, but only in HEAD.

I just tried to commit the changes to the AStyle plugin and CVS rejected, so I'll e-mail them.

I'm gonna commit the help plugin changes to HEAD though.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 06, 2005, 12:22:51 am
~ code is tested Logically.

:? What is that supposed to mean? Anyway, I'm thinking it would be better if all the SDK changes were mailed to me personally.

Anyway guys, send me personal message (NOT mail!) for the changes in status. I'll modify the above table since i'm a webadmin, too ;-)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 06, 2005, 12:25:40 am
My current progress :

Edited by rick - changes posted above

Will handle the rest tomorrow :)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 06, 2005, 01:11:32 am
~ code is tested Logically.
:? What is that supposed to mean?
...

it means - after your edited source code module is compiling without errors or warnings,
look what is this just edited module doing and test this functionality explicitly
in the newly built codeblocks.

ie
it is the last step before sending the modified files to YOU RICK !!

we could rename this symbol to "sent to rick"  :D
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 06, 2005, 03:22:01 am
You could change it for "tested live"
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 06, 2005, 07:56:21 am
Um... man i think tiwag's got the most difficult part!

(i detected one or two possible flaws)
But I have a doubt. Tiwag, have you tried importing MSVC projects and Dev-Cpp projects with the modified files?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 06, 2005, 10:24:02 am
Um... man i think tiwag's got the most difficult part!

(i detected one or two possible flaws)
But I have a doubt. Tiwag, have you tried importing MSVC projects and Dev-Cpp projects with the modified files?

no that i missed till now - will do it in a few hours

just now my wife is worried about my spare-time schedule  :shock: - i have to help her a few things now  :D
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: David Perfors on August 06, 2005, 10:49:21 am
just now my wife is worried about my spare-time schedule  :shock: - i have to help her a few things now  :D
Yes always listen to your wife :lol: (ehm. well I think, I don't have a wife, not even a girl friend.  :( yet :lol:)
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 06, 2005, 11:17:54 am
just now my wife is worried about my spare-time schedule  :shock: - i have to help her a few things now  :D
Yes always listen to your wife :lol: (ehm. well I think, I don't have a wife, not even a girl friend.  :( yet :lol:)

He he, maybe not always, husband can be right too (at least from time to time ;) ).
I haven't listen to my girlfriend much recently and now I see the results - the worst thing in the world is to have lot of spare time and nobody to share it with  :(.

BTW, progress:

Code
////////////////////////////////////////
/// byo
group 15
o    replacedlg.cpp
o    replacedlg.h
o    sanitycheck.h
o    sdk_events.cpp
o    sdk_events.h
o    searchresultslog.cpp
o    searchresultslog.h
o    selecttargetdlg.cpp
o    selecttargetdlg.h
o    settings.h
o    simplelistlog.cpp
o    simplelistlog.h
o    simpletextlog.cpp
o    simpletextlog.h
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 06, 2005, 12:14:46 pm
I try to compile changed sources in both Unicode and NonUnicode versions of wxWidgets (and after that in wx2.4 and wx2.6 to make sure it will work everywhere). Unfortunately all project can't be compiled in Unicode but separate files can :)

Hi byo

what unicode library have you built ? which OS are you using ?

currently i work only in Windows,
i thought about to build a "wxMSW-2.4.2-monolithic-unicode-DLL-debug" library
for testing the CodeBlocks VERSION_1_0_UNICODE .

i would like to discuss with you how to setup the best debug-environment for our new "baby"

in the future i would like to test also in Linux,
just now i have set up an Ubunto Hoary in a VM-ware box
it runs but i'm far away from compiling and testing something...
so testing in Linuxs means "mid-term future" for me
maybe starting in October 05 ... we'll see
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 06, 2005, 03:05:29 pm
what unicode library have you built ? which OS are you using ?

currently i work only in Windows,
i thought about to build a "wxMSW-2.4.2-monolithic-unicode-DLL-debug" library
for testing the CodeBlocks VERSION_1_0_UNICODE .

i would like to discuss with you how to setup the best debug-environment for our new "baby"

in the future i would like to test also in Linux,
just now i have set up an Ubunto Hoary in a VM-ware box
it runs but i'm far away from compiling and testing something...
so testing in Linuxs means "mid-term future" for me
maybe starting in October 05 ... we'll see


I also work on Windows, testing on wx 2.6.1 (monolithic,dll)

I tried to run on Gentoo linux (with wx 2.6.1) but can't get it working (it crashes immediately - it was even discussed somewhere on the forum). Hmm, no, I've run it on 2.4 but it doesn't store configuration or something like that (it crashes when closing stardet but before saving configuration I suppose). But it wasn't sattisfying for me since my wxSmith plugin works only under 2.6.

Hmm, there's also one thing need mentioning - when building wxWidgets in debug mode (when assertions are enabled) it shows some assertions at the beginning (something about unknown parameters - when parsing command line) and some after but I don't remember them currently.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: byo on August 06, 2005, 04:11:21 pm
Code from group 15 sent to rickg22 - You can update my info ;)
Title: NEW MACRO DEFINED!
Post by: rickg22 on August 06, 2005, 10:05:23 pm
New macro defined!

I defined a new macro in "settings.h":

_U(). Use it to convert non-literal char* strings to wxString. Use it for reading attributes from TiXmlNode's.

Code
#ifdef wxUSE_UNICODE
  #define _U(x) wxString((x),wxConvUTF8)
  #define _UU(x,y) wxString((x),y)
#else
  #define _U(x) (x)
  #define _UU(x,y) (x)
#endif
i.e.:

Code
const char* incompatible = "This is an incompatible string";
wxString compatible = _U(incompatible);

// wxString conftype = conf->Attribute("ConfigurationType"); // before
wxString conftype = _U(conf->Attribute("ConfigurationType")); // after :)

I just hope I'm not reinventing the wheel here :P
Title: Re: NEW MACRO DEFINED!
Post by: byo on August 06, 2005, 11:37:48 pm
Code
#ifdef wxUSE_UNICODE
  #define _U(x) wxString((x),wxConvUTF8)
  #define _UU(x,y) wxString((x),y)
#else
  #define _U(x) (x)
  #define _UU(x,y) (x)
#endif

I guess that we should use wxConvUTF8 by default. I've seen that Ceniza uses wxConvLocal. Which one is better ? (Perhaps we will find out when localized versions of C::B will be released ;) ).

Hmm, I shouldn't worry about it. If it will be inside settings.h, jut few seconds and it will be changed  :lol:
Title: OK GUYS, SDK FINISHED!!
Post by: rickg22 on August 07, 2005, 12:22:13 am
We've finished converting the SDK and SRC to Unicode!
And I converted the "small" plugins to unicode, too!

Now it's time for the big ones: Compiler, Debugger, CodeCompletion.

(See http://forums.codeblocks.org/index.php?topic=687.msg4442#msg4442 for more details).
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: takeshimiya on August 07, 2005, 02:04:22 pm
Just a note about the outdated wxString wxWidgets documentation, at the beggining it warns:
"Also please note that in this manual char is sometimes used instead of wxChar because it hasn't been fully updated yet. Please substitute as necessary and refer to the sources in case of a doubt."

The latest wxWidgets documentation updated from CVS is always here (tip: bookmark it  :wink:):
http://www.lpthe.jussieu.fr/~zeitlin/wxWindows/docs/

Another fact is that sometimes the documentation is outdated because ISN'T autogenerated by Doxygen or any autodocumentation system, it's written in LATEX.
But there was some discussion at the wx-mailing-list about porting it to Doxygen. So this is the reason of why the documentation is always outdated in some things.

Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: takeshimiya on August 07, 2005, 02:08:40 pm
A question about CVS (I know little to nothing of CVS):

All of this changes will be in a new VERSION_1 CVS branch, but, when all the _T() conversion thing is finished,
it will be easily merged in the latest CVS-HEAD branch? Or all of this work will have to be rewritten??
I'm hoping that CVS-merge is smart :D
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 07, 2005, 02:49:38 pm
it will be easily merged in the latest CVS-HEAD branch? Or all of this work will have to be rewritten??
I'm hoping that CVS-merge is smart :D

CVS is smart - at least when the same lines of code haven't already been changed in HEAD too - then it asks for user intervention to solve the conflict.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 07, 2005, 04:32:34 pm
CVS is smart - at least when the same lines of code haven't already been changed in HEAD too - then it asks for user intervention to solve the conflict.

Yeah, like making you edit manually all the lines in question :lol:

My proposed solution is this:

 Branch: HEAD
--------------------------------------------------------- HEAD
           |
           |
           | Branch: VERSION_1_0
           | ------ SNAPSHOT ------------------- UNICODE


I had added a SNAPSHOT_DDDDDD tag (and CVS better had not messed with it! :shock: ) for all the changes beforethe UNICODE conversion. All those files have a specific version.

The CVS HEAD branch hasn't seen much changes recently, anyway - so they probably have exactly the same version number than those branhced (with one or two exceptions maybe).

If they have the same version, copy the respective file from the latest VERSION_1_0 to HEAD.
Ta-da! :D

Or does CVS do this already? :?
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 07, 2005, 04:56:48 pm
CVS is smart - at least when the same lines of code haven't already been changed in HEAD too - then it asks for user intervention to solve the conflict.

Yeah, like making you edit manually all the lines in question :lol:

My proposed solution is this:

 Branch: HEAD
--------------------------------------------------------- HEAD
           |
           |
           | Branch: VERSION_1_0
           | ------ SNAPSHOT ------------------- UNICODE


I had added a SNAPSHOT_DDDDDD tag (and CVS better had not messed with it! :shock: ) for all the changes beforethe UNICODE conversion. All those files have a specific version.

The CVS HEAD branch hasn't seen much changes recently, anyway - so they probably have exactly the same version number than those branhced (with one or two exceptions maybe).

If they have the same version, copy the respective file from the latest VERSION_1_0 to HEAD.
Ta-da! :D

Or does CVS do this already? :?

with cvs you can do it smarter, but in any case its not that important for now.
just now i am compiling and linking with wx-dll-unicode libs
i'll report ...
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 07, 2005, 05:24:39 pm
ok guys  8)
built successfully with wx MSW 2.4.2 unicode

the most important
missing till now are:

is somebody working on them ?  :shock:
if finished plz drop me a email with them
thanks
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: takeshimiya on August 07, 2005, 06:00:22 pm
I guess there isn't anyone assigned to the codecompletion, but I guess it's too late for me (need to sleep):

http://forums.codeblocks.org/index.php?topic=687.msg4442#msg4442

PS: Today can be the day that Code::Blocks will see the (Unicode) light! :D
Title: Just say "I could compile code::blocks in Unicode!"
Post by: tiwag on August 07, 2005, 09:27:34 pm
... Today can be the day that Code::Blocks will see the (Unicode) light! :D
you are a visionary !

a !(small) messenger log between rick_g22 and me
Quote
Rick says:
i send you the zip
tiwag says:
its OK, thanks
  Sie haben "H:\Dokumente und Einstellungen\Tiwag\Eigene Dateien\MSN_Messenger\Inbox\compilergcc_unicode.zip"
  von Rick erfolgreich erhalten.
tiwag says:
now i'll try to compile
- just a few moments ...
tiwag says:
Project   : CodeBlocks VERSION_1_0 unicode, wx242
Compiler  : GNU GCC Compiler (called directly)
Directory : D:\cpp\_projects\Codeblocks\_VERSION_1_0_UNICODE_COMPILED\src\
--------------------------------------------------------------------------------
Switching to target: plugin_CompilerGCC
mingw32-g++.exe   -Wall -g -ggdb -pipe -mthreads -fno-pcc-struct-
...-o devel\share\CodeBlocks\plugins\compilergcc.dll  -Wl,--enable-auto-image-base -Wl,--add-stdcall-alias   -lcodeblocks -lstc -lwxxrc -lwxmsw242u

Process terminated with status 0 (0 minutes, 51 seconds)
0 errors, 1 warnings
 
well done my friend !!   
Rick says:
 
Rick says:
oh no!
Rick says:
There's 1 warning!
Rick says:
 
Rick says:
(lol )
Rick says:
 
tiwag says:
nobody is perfect, not even YOU
Rick says:
hmmmm
Rick says:
"In soviet Russia, the system compiles YOU!"
Rick says:
nevermind
tiwag says:
 
tiwag sendet:
 

 
  Die Übertragung von "first_text_from_CBu.txt" wurde ausgeführt.
 
Rick says:
d with CodeB
Rick says:
was it supposed to end in "CodeB" ?
Rick says:

hello rickg !

this text i've just now edited with CodeB
tiwag says:
congratulations - you found the first bug !
Rick says:
 
tiwag says:
hey
tiwag says:
thats a big step for mankind !!
Rick says:
oh well
Rick says:
anyway
Rick says:
i think i know *WHO* is at fault with this 
tiwag says:
not even a crash when fired the first time !
Rick says:
cbeditor saves with non-unicode strings, right?
tiwag says:
thats really a good message iwould say, the rest will be also doable, i'm sure (not peanuts, but doable)
Rick says:
anyway
tiwag says:
NONONONONONO !!
Rick says:
try to load the file you've just saved
Rick says:
uh?
tiwag says:
it saved in UNICODE, the file i've sent you is in UNICODE and was saved by CBu (== CodeBlocksunicode)
Rick says:
oh - in UNICODE
Rick says:
I opened it in notepad
tiwag says:
look with a hexeditor - i did that, because i trust NOBODY
Rick says:
wait a minute
Rick says:
there should be an option to save files as UTF-8 or something, right?
Rick says:
anyway
Rick says:
if you also open it with codeblocks, does it display well?
tiwag says:
YES YES YES YES
tiwag says:
i cant believe it ! its OKOKOK
Rick says:
....h.e.l.l.o. .
r.i.c.k.g. .!...
......t.h.i.s. .
t.e.x.t. .i.'.v.
e. .j.u.s.t. .n.
o.w. .e.d.i.t.e.
d. .w.i.t.h. .C.
o.d.e.B.........
Rick says:
does the line end in "CodeB" ?
tiwag says:
that is bug no 0000000001
Rick says:
wait
Rick says:
  i got it!
tiwag says:
what
Rick says:
If the file is unicode when opened, save as unicode
Rick says:
otherwise, save as normal
tiwag says:
ok agree
tiwag says:
  but this are features !!! let them for CVS HEAD,
  our job is to build a pure UNICODE version now
Rick says:
OH
Rick says:
ok i still have to modify the codecompletion
tiwag says:
i go to announce the message in the forums -
what's your opinion ?
tiwag says:
on
"CodeBlocks_VERSION_1_0_UNICODE has seen the light! "
Rick says:
no
Rick says:
not until we have codecompletion codecompleted 
tiwag says:
codecompletion will not work anyway - believe me
Rick says:
yeah but...
Rick says:
it's better not having to have another stage of modifications
tiwag says:
i dont understand you - i only wanted to post in the forum, that we have compiled and run CBu without crash the first time !
thats all
Rick says:
ok ok...
Rick says:
Just say "I could compile code::blocks in Unicode!"

"I could compile code::blocks in Unicode!"

what i've done now !

thanks to ALL who helped the last days !!!!!!!!!!
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: takeshimiya on August 07, 2005, 09:56:49 pm
Almost CONGRATS!  :o
(almost until codecompletion is finished)

About the File Unicode thing, C::B must save (by default) the files in ASCII mode (with options to save in UTF-8, UTF-16LE/BE as notepad haves).
Because most if not all compilers doesn't support unicode, only old plain ASCII.

And when saving text to a file in Unicode don't forget to put the BOM (Byte Order Mark) so all text editors know that is a file encoded in Unicode.
http://www.websina.com/bugzero/kb/unicode-bom.html
Of course when reading a file also take care of the BOM.

That's it =D
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 07, 2005, 11:12:33 pm
Almost CONGRATS!  :o
(almost until codecompletion is finished)

Remove that "almost", I just committed codecompletion to CVS :-)

IT'S FINISHED, YAY! :D

Edit: Emm... oops, I forgot to do the todo plugin (ironically) :oops:

Edit: Thanks to elvstone for converting the todo plugin. WE'RE FINISHED!!!!
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 07, 2005, 11:18:48 pm

About the File Unicode thing, C::B must save (by default) the files in ASCII mode (with options to save in UTF-8, UTF-16LE/BE as notepad haves).
Because most if not all compilers doesn't support unicode, only old plain ASCII.

And when saving text to a file in Unicode don't forget to put the BOM (Byte Order Mark) so all text editors know that is a file encoded in Unicode.
http://www.websina.com/bugzero/kb/unicode-bom.html
Of course when reading a file also take care of the BOM.


Please enlighten us about it! I don't know how to do that :-(

Also, some plugins also read the files, I don't think they're ready to handle the difference between ANSI and Unicode yet. But at least STAGE 1 has been completed. We'll keep developing and fixing bugs.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: takeshimiya on August 07, 2005, 11:58:11 pm
It's official, time to Celebrate!!
Congratulations all for all the hard work, I'm sure that now your dreams contains some _() and _T() between sheeps :lol:

Here are more info:
http://www.microsoft.com/globaldev/getwr/steps/wrg_unicode.mspx

I never tried using wx, but I think that to know the BOM it's something like:

Code
When reading any text file:
wxString file; // a file loaded entirely in a string

#ifdef UNICODE
    if(file[0] == 0xEF && file[1] == 0xBB && file[2] == 0xBF)
        // it's in UTF-8, wxMBConvert-it

    else if(file[0] == 0xFE && file[1] == 0xFF)
        // it's in UTF-16BE, wxMBConvert-it

    else if(file[0] == 0xFF && file[1] == 0xFE)
        // it's in UTF-16LE, wxMBConvert-it

    else
        // it's in ASCII, wxMBConvert-it
#else
    if(file[0] == 0xEFBB)
        // it's in UTF-8, wxMBConvert-it

    else if(file[0] == 0xFEFF)
        // it's in UTF-16BE, wxMBConvert-it

    else if(file[0] == 0xFFFE)
        // it's in UTF-16LE, wxMBConvert-it

    else
        // it's in ASCII, do nothing
#endif

I don't know if this works, or if it's the best way, there was some discussion in the wx-mailing list to put this functionality in the wxMBConv classes or wxTexFile classes, etc
There was some patchs for this, I don't know what is the current state of this.
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: takeshimiya on August 08, 2005, 12:05:11 am
But well, I hope that C::B compiles in wx2.6+UNICODE+LINUX without lots of segfaults :)

So now a lot of test in linux is requiered, test in different distros with their owns versions of wxGTK2 Unicode (specially Ubuntu, Debian, Mandriva, and Fedora, they seem to be the more widespreaded right now). Any type of testing in linux is appreciated!

Please post in http://forums.codeblocks.org/index.php?topic=317 the results
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: rickg22 on August 08, 2005, 12:43:38 am
OK then! :)

Time to move on. Let's squash some bugs! :P
Title: Re: UNICODE: ATTENTION ALL DEVS
Post by: tiwag on August 08, 2005, 06:28:35 am
...Any type of testing in linux is appreciated!

you can do a lot of that what you're suggesting !!  :)
Title: Re: Unicode conversion (attention all devs)
Post by: takeshimiya on August 08, 2005, 06:39:48 am
Of course! Only if any linux distro would work on this motherboard (on this chipset)...

As I said:
My motherboard's chipset doesn't work in any distro.
So my only solutions are VMWare (too slow for me) or coLinux (I tried several times but failed to got it working ok).

Recommendation: Don't buy a motherboard with an ATI chipset if you want to run linux =|
New hardware/less known hardware doesn't go well with linux kernel.
 :|
Title: Re: Unicode conversion (attention all devs)
Post by: tiwag on August 08, 2005, 06:50:07 am
Of course! Only if any linux distro would work on this motherboard (on this chipset)...
...

ahh yeah .. i've read it after my posting in the other thread

btw i use Ubuntu Linux in VMware on an old AMD XP 1800
and it runs quick and fine too
but i've not managed to compile CB till now
but i'll do in future...
Title: Re: Unicode conversion (attention all devs)
Post by: byo on August 08, 2005, 01:51:30 pm
Hi, I've just compiled C::B VERSION_1_0 under Gentoo Linux (wx 2.6.1, UNICODE)  :D and currently noticed what follows (sources fetched directly from CVS):

files : sdk/projectloader.h, plugins/compilergcc/makefilegenerator.h and plugins/pluginwizard/pluginwizarddlg.h use standard "" strings instead of _T() in function definitions (defaultvalues for arguments).

Do You have same problem ? I thought I have outdated version of files  :? But I've checkouted to empty directory (using sourcefore's developer account) so it should be up to date.

Can't check anything else in this version of wx because of bug in GetClientSize()  :x

Now I'll try to do the same under wx 2.4 - let's see how it works  :)
Title: Re: Unicode conversion (attention all devs)
Post by: rickg22 on August 08, 2005, 07:57:36 pm
byo: You're welcome to send patches! :)
Title: Re: Unicode conversion (attention all devs)
Post by: darklordsatan on August 08, 2005, 08:34:28 pm
Quote from: takeshimiya
My motherboard's chipset doesn't work in any distro.
So my only solutions are VMWare (too slow for me) or coLinux (I tried several times but failed to got it working ok).
Why not trying some low-height distros in VMWare. I actually have a crappier system than yours, with only 256 Mb RAM, and Ive succesfully ran SuSe 8.0 and Redhat 9.0 inside it with no hassle.
The low-heights would be slax (http://slax.linux-live.org/download.php), puppy, DSL, etc...
Here for more (http://www.distrowatch.com). Although yes, I know you already know that website.
Title: Re: Unicode conversion (attention all devs)
Post by: takeshimiya on August 08, 2005, 09:45:54 pm
Yep, I have those distros, but I will be using GTK2/wx apps anyway which paints slow in a normal situation (for my tastes), and very slow when using VMWare.
I think my best solution is to use coLinux, I'll keep trying to get it working, but I've tried several times, failing all the times.
Currently I use x11vnc/tightvnc to use linux in another pc, but that isn't the best solution
Title: Re: Unicode conversion (attention all devs)
Post by: byo on August 09, 2005, 12:40:21 am
byo: You're welcome to send patches! :)

As a newbie in cvs  :oops: I must ask:
cvs diff
does this produce usable patches ?

If so, current log from my linux-compilable version is:
Code
? patch
? src/.deps
? src/.objs
Index: src/sdk/projectloader.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/sdk/projectloader.h,v
retrieving revision 1.5.2.2
diff -r1.5.2.2 projectloader.h
41c41
<         bool DoOptionSection(wxString& buffer, const wxArrayString& array, int nrOfTabs, const wxString& optionName = "option");
---
>         bool DoOptionSection(wxString& buffer, const wxArrayString& array, int nrOfTabs, const wxString& optionName = _T("option"));
45c45
<         void SaveOptions(wxString& buffer, const wxArrayString& array, const wxString& sectionName, int nrOfTabs, const wxString& optionName = "option", const wxString& extra = "");
---
>         void SaveOptions(wxString& buffer, const wxArrayString& array, const wxString& sectionName, int nrOfTabs, const wxString& optionName = _T("option"), const wxString& extra = _T(""));

I tried to do something with this GetClientSize() bug but it crashes in other places too - just like using uninitialized object :? Maybe I'll take a closer look...  :)
Title: Re: Unicode conversion (attention all devs)
Post by: rickg22 on August 09, 2005, 12:47:35 am
i think that for const wxString& you have to use wxEmptyString instead... but i'm not sure.
Title: Re: Unicode conversion (attention all devs)
Post by: byo on August 09, 2005, 12:53:52 am
i think that for const wxString& you have to use wxEmptyString instead...

But if there's reference to const object there's no need to pass param with exackly same type - in such case, temporary object can be created what is done when passing _T("") as wxString.
Hmm, or I didn't understand You ;)
Title: Re: Unicode conversion (attention all devs)
Post by: rickg22 on August 09, 2005, 12:55:22 am
Ah well. Nevermind, keep hunting those uninitialized variables!

(Should we recompile with -Wall and -pedantic or someting?)
Title: Re: Unicode conversion (attention all devs)
Post by: byo on August 09, 2005, 01:04:42 am
Ah well. Nevermind, keep hunting those uninitialized variables!

(Should we recompile with -Wall and -pedantic or someting?)

-Wall is already included  :)

And I forgot to include plugins in my patch  :oops:

Full log:
Code
? patch
? src/.deps
? src/.objs
Index: src/plugins/compilergcc/makefilegenerator.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/compilergcc/makefilegenerator.h,v
retrieving revision 1.12.2.3
diff -r1.12.2.3 makefilegenerator.h
39,41c39,41
<         void DoAppendIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = "-I", bool useGlobalOptions = false);
<         void DoAppendResourceIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = "-I", bool useGlobalOptions = false);
<         void DoAppendLibDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = "-L", bool useGlobalOptions = false);
---
>         void DoAppendIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = _T("-I"), bool useGlobalOptions = false);
>         void DoAppendResourceIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = _T("-I"), bool useGlobalOptions = false);
>         void DoAppendLibDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = _T("-L"), bool useGlobalOptions = false);
Index: src/plugins/pluginwizard/pluginwizarddlg.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/pluginwizard/pluginwizarddlg.h,v
retrieving revision 1.3
diff -r1.3 pluginwizarddlg.h
22c22
< void DoAddHeaderOption(wxString& buffer, bool has, const wxString& retVal = " -1");
---
> void DoAddHeaderOption(wxString& buffer, bool has, const wxString& retVal = _T(" -1"));
Index: src/sdk/projectloader.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/sdk/projectloader.h,v
retrieving revision 1.5.2.2
diff -r1.5.2.2 projectloader.h
41c41
<         bool DoOptionSection(wxString& buffer, const wxArrayString& array, int nrOfTabs, const wxString& optionName = "option");
---
>         bool DoOptionSection(wxString& buffer, const wxArrayString& array, int nrOfTabs, const wxString& optionName = _T("option"));
45c45
<         void SaveOptions(wxString& buffer, const wxArrayString& array, const wxString& sectionName, int nrOfTabs, const wxString& optionName = "option", const wxString& extra = "");
---
>         void SaveOptions(wxString& buffer, const wxArrayString& array, const wxString& sectionName, int nrOfTabs, const wxString& optionName = _T("option"), const wxString& extra = _T(""));

Hmm, quite strange is fact that without these changes all will be compilable under Win but won't under Linux... Hmm, I don't understand this ;) (But I think I don't have to ;) )
Title: Re: Unicode conversion (attention all devs)
Post by: tiwag on August 09, 2005, 01:14:27 am
As a newbie in cvs  :oops: I must ask:
cvs diff
does this produce usable patches ?

use
Code
cvs diff -u
for your patches in unified format
Title: Re: Unicode conversion (attention all devs)
Post by: byo on August 09, 2005, 01:22:52 am
use
Code
cvs diff -u
for your patches in unified format

Thx for info  :D
Title: Re: Unicode conversion (attention all devs)
Post by: cyberkoa on August 09, 2005, 08:25:49 am
I have just landed , let me have some time to compile unicode-version of wxwidgets and redownload CVS.

I will come back soon to help
Title: Re: Unicode conversion (attention all devs)
Post by: takeshimiya on August 10, 2005, 06:25:00 am
I tried to compile VERSION_1_0 CVS in UNICODE, wx2.6 CVS, win32, MinGW, but I get lots of undefined references


Switching to target: sdk
Linking dynamic library: devel\codeblocks.dll
Creating library file: devel\libcodeblocks.a
.objs\2.6\sdk\autodetectcompilers.o(.text+0x10d): In function `ZN19AutoDetectCompilersC2EP8wxWindow':
D:/Develop/src/codeblocks-VERSION_1_0/codeblocks/src/sdk/autodetectcompilers.cpp:19: undefined reference to `_imp___ZN13wxXmlResource8GetXRCIDEPKc'
.objs\2.6\sdk\autodetectcompilers.o(.text+0x663):D:/Develop/src/codeblocks-VERSION_1_0/codeblocks/src/sdk/autodetectcompilers.cpp:49: undefined reference to `_imp___ZN13wxXmlResource8GetXRCIDEPKc'
.objs\2.6\sdk\autodetectcompilers.o(.text+0x7eb): In function `ZN19AutoDetectCompilersC1EP8wxWindow':
D:/Develop/src/codeblocks-VERSION_1_0/codeblocks/src/sdk/autodetectcompilers.cpp:19: undefined reference to `_imp___ZN13wxXmlResource8GetXRCIDEPKc'
.objs\2.6\sdk\autodetectcompilers.o(.text+0xd41):D:/Develop/src/codeblocks-VERSION_1_0/codeblocks/src/sdk/autodetectcompilers.cpp:49: undefined reference to `_imp___ZN13wxXmlResource8GetXRCIDEPKc'
...
Process terminated with status 1 (0 minutes, 22 seconds)
52 errors, 0 warnings


These errors are expected, or anyone compiled all ok with these settings?
VERSION_1_0 is wx2.6 compatible??
Title: Re: Unicode conversion (attention all devs)
Post by: rickg22 on August 10, 2005, 07:46:30 am
Takeshi Miya:
You need to compile the XRC and STC libraries, too. I'm sure you got something wrong in your compilation. Anyway, unicode is _NOT_ ready for primetime yet. Only try to compile C::B in unicode if you're willing to assist in the conversion. (like handling of files, etc).
Title: Re: Unicode conversion (attention all devs)
Post by: takeshimiya on August 10, 2005, 07:27:16 pm
Yes, I want to compile VERSION_1_0 to hunt those bugs (normally I would be using HEAD).

But I compiled STC and XRC=1 as options, must be something else.
Title: Re: Unicode conversion (attention all devs)
Post by: rickg22 on August 10, 2005, 07:33:31 pm
Did you compile them with wxUSE_UNICODE, too?
Title: Re: Unicode conversion (attention all devs)
Post by: takeshimiya on August 10, 2005, 07:40:37 pm
No, what I have done is:

Code
cd <WXWIN>\build\msw
mingw32-make -f makefile.gcc clean
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 VENDOR=cb

cd ..\..\contrib\build\stc
mingw32-make -f makefile.gcc clean
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 VENDOR=cb

I could be wrong, but from what I understand, UNICODE=1 already defines wxUSE_UNICODE 1.

And then, in the C::B project in the "Compiler defines" I've added __UNICODE__ and wxUSE_UNICODE 1 (along with HAVE_W32API_H, __WXMSW__ and WXUSINGDLL). I'm not sure if I'ts necessary or not.
Title: Re: Unicode conversion (attention all devs)
Post by: me22 on August 13, 2005, 09:14:59 pm
Yay!  Success on Linux! ( after a few changes )
I did a `cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/codeblocks co -r VERSION_1_0 codeblocks`, then `make -f Makefile.unix` then, after fixing everything, `./update`.  It even runs, although it doesn't open files.

Summary of changes:
- added #include <cctype> to a few files that needed it
- fixed some default parameters in headers
- changed the link libs to the unicode ones.

Here's my diff:
Code
Index: src/Makefile.unix
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/Makefile.unix,v
retrieving revision 1.21.2.1
diff -u -r1.21.2.1 Makefile.unix
--- src/Makefile.unix 25 Jul 2005 19:05:21 -0000 1.21.2.1
+++ src/Makefile.unix 13 Aug 2005 19:13:38 -0000
@@ -7,8 +7,10 @@
 # Compiler used:    GNU GCC Compiler
 
 ### Variables used in this Makefile
-LIB_WXXRC=wx_gtk2_xrc-2.4
-LIB_WXSTC=wx_gtk2_stc-2.4
+#LIB_WXXRC=wx_gtk2_xrc-2.4
+#LIB_WXSTC=wx_gtk2_stc-2.4
+LIB_WXXRC=wx_gtk2u_xrc-2.4
+LIB_WXSTC=wx_gtk2u_stc-2.4
 tinyXML_CC=gcc
 tinyXML_CPP=g++
 tinyXML_LD=g++
Index: src/plugins/codecompletion/nativeparser.cpp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/codecompletion/nativeparser.cpp,v
retrieving revision 1.20.2.6
diff -u -r1.20.2.6 nativeparser.cpp
--- src/plugins/codecompletion/nativeparser.cpp 7 Aug 2005 20:55:56 -0000 1.20.2.6
+++ src/plugins/codecompletion/nativeparser.cpp 13 Aug 2005 19:13:38 -0000
@@ -38,6 +38,8 @@
 #include "parser/parser.h"
 #include <compilerfactory.h>
 
+#include <cctype>
+
 BEGIN_EVENT_TABLE(NativeParser, wxEvtHandler)
  EVT_MENU(THREAD_START, NativeParser::OnThreadStart)
  EVT_MENU(THREAD_END, NativeParser::OnThreadEnd)
Index: src/plugins/codecompletion/parser/parserthread.cpp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/codecompletion/parser/parserthread.cpp,v
retrieving revision 1.16.2.2
diff -u -r1.16.2.2 parserthread.cpp
--- src/plugins/codecompletion/parser/parserthread.cpp 7 Aug 2005 20:55:56 -0000 1.16.2.2
+++ src/plugins/codecompletion/parser/parserthread.cpp 13 Aug 2005 19:13:39 -0000
@@ -29,6 +29,8 @@
 #include <wx/msgdlg.h>
 #include <globals.h>
 
+#include <cctype>
+
 int THREAD_START = wxNewId();
 int THREAD_END = wxNewId();
 int NEW_TOKEN = wxNewId();
Index: src/plugins/codecompletion/parser/tokenizer.cpp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/codecompletion/parser/tokenizer.cpp,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 tokenizer.cpp
--- src/plugins/codecompletion/parser/tokenizer.cpp 7 Aug 2005 20:55:56 -0000 1.3.2.1
+++ src/plugins/codecompletion/parser/tokenizer.cpp 13 Aug 2005 19:13:39 -0000
@@ -28,6 +28,8 @@
 #include <wx/file.h>
 #include <wx/msgdlg.h>
 
+#include <cctype>
+
 Tokenizer::Tokenizer(const wxString& filename)
  : m_Filename(filename),
  m_BufferLen(0),
Index: src/plugins/compilergcc/makefilegenerator.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/compilergcc/makefilegenerator.h,v
retrieving revision 1.12.2.3
diff -u -r1.12.2.3 makefilegenerator.h
--- src/plugins/compilergcc/makefilegenerator.h 22 Jul 2005 08:51:58 -0000 1.12.2.3
+++ src/plugins/compilergcc/makefilegenerator.h 13 Aug 2005 19:13:39 -0000
@@ -36,9 +36,9 @@
         void DoAppendCompilerOptions(wxString& cmd, ProjectBuildTarget* target = 0L, bool useGlobalOptions = false);
         void DoAppendLinkerOptions(wxString& cmd, ProjectBuildTarget* target = 0L, bool useGlobalOptions = false);
         void DoAppendLinkerLibs(wxString& cmd, ProjectBuildTarget* target = 0L, bool useGlobalOptions = false);
-        void DoAppendIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = "-I", bool useGlobalOptions = false);
-        void DoAppendResourceIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = "-I", bool useGlobalOptions = false);
-        void DoAppendLibDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = "-L", bool useGlobalOptions = false);
+        void DoAppendIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = _T("-I"), bool useGlobalOptions = false);
+        void DoAppendResourceIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = _T("-I"), bool useGlobalOptions = false);
+        void DoAppendLibDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = _T("-L"), bool useGlobalOptions = false);
         void DoAddVarsSet(wxString& buffer, CustomVars& vars);
         void DoAddMakefileVars(wxString& buffer);
 #ifdef __WXMSW__
Index: src/plugins/pluginwizard/pluginwizarddlg.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/pluginwizard/pluginwizarddlg.h,v
retrieving revision 1.3
diff -u -r1.3 pluginwizarddlg.h
--- src/plugins/pluginwizard/pluginwizarddlg.h 14 Mar 2005 09:47:04 -0000 1.3
+++ src/plugins/pluginwizard/pluginwizarddlg.h 13 Aug 2005 19:13:39 -0000
@@ -19,7 +19,7 @@
  void OnOKClick(wxCommandEvent& event);
  void OnNameChange(wxCommandEvent& event);
  void DoGuardBlock();
- void DoAddHeaderOption(wxString& buffer, bool has, const wxString& retVal = " -1");
+ void DoAddHeaderOption(wxString& buffer, bool has, const wxString& retVal = _T(" -1"));
  void DoAddHeaderTool(wxString& buffer);
  void DoAddHeaderCompiler(wxString& buffer);
  void DoAddHeaderDebugger(wxString& buffer);
Index: src/sdk/projectloader.h
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/sdk/projectloader.h,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 projectloader.h
--- src/sdk/projectloader.h 6 Aug 2005 22:13:05 -0000 1.5.2.2
+++ src/sdk/projectloader.h 13 Aug 2005 19:13:39 -0000
@@ -38,11 +38,11 @@
         void DoUnitOptions(TiXmlElement* parentNode, ProjectFile* file);
         
         void BeginOptionSection(wxString& buffer, const wxString& sectionName, int nrOfTabs);
-        bool DoOptionSection(wxString& buffer, const wxArrayString& array, int nrOfTabs, const wxString& optionName = "option");
+        bool DoOptionSection(wxString& buffer, const wxArrayString& array, int nrOfTabs, const wxString& optionName = _("option"));
         void EndOptionSection(wxString& buffer, const wxString& sectionName, int nrOfTabs);
 
         // shortcut that calls BeginOptionSection(), DoOptionSection() and EndOptionSection()
-        void SaveOptions(wxString& buffer, const wxArrayString& array, const wxString& sectionName, int nrOfTabs, const wxString& optionName = "option", const wxString& extra = "");
+        void SaveOptions(wxString& buffer, const wxArrayString& array, const wxString& sectionName, int nrOfTabs, const wxString& optionName = _("option"), const wxString& extra = wxEmptyString);
  private:
         void SaveCompilerOptions(wxString& buffer, CompileOptionsBase* object, int nrOfTabs);
         void SaveResourceCompilerOptions(wxString& buffer, CompileOptionsBase* object, int nrOfTabs);
Title: Re: Unicode conversion (attention all devs)
Post by: cyberkoa on August 13, 2005, 11:23:06 pm
I tried to compile VERSION_1_0 CVS in UNICODE, wx2.6 CVS, win32, MinGW, but I get lots of undefined references


Switching to target: sdk
Linking dynamic library: devel\codeblocks.dll
Creating library file: devel\libcodeblocks.a
.objs\2.6\sdk\autodetectcompilers.o(.text+0x10d): In function `ZN19AutoDetectCompilersC2EP8wxWindow':
D:/Develop/src/codeblocks-VERSION_1_0/codeblocks/src/sdk/autodetectcompilers.cpp:19: undefined reference to `_imp___ZN13wxXmlResource8GetXRCIDEPKc'
.objs\2.6\sdk\autodetectcompilers.o(.text+0x663):D:/Develop/src/codeblocks-VERSION_1_0/codeblocks/src/sdk/autodetectcompilers.cpp:49: undefined reference to `_imp___ZN13wxXmlResource8GetXRCIDEPKc'
.objs\2.6\sdk\autodetectcompilers.o(.text+0x7eb): In function `ZN19AutoDetectCompilersC1EP8wxWindow':
D:/Develop/src/codeblocks-VERSION_1_0/codeblocks/src/sdk/autodetectcompilers.cpp:19: undefined reference to `_imp___ZN13wxXmlResource8GetXRCIDEPKc'
.objs\2.6\sdk\autodetectcompilers.o(.text+0xd41):D:/Develop/src/codeblocks-VERSION_1_0/codeblocks/src/sdk/autodetectcompilers.cpp:49: undefined reference to `_imp___ZN13wxXmlResource8GetXRCIDEPKc'
...
Process terminated with status 1 (0 minutes, 22 seconds)
52 errors, 0 warnings


These errors are expected, or anyone compiled all ok with these settings?
VERSION_1_0 is wx2.6 compatible??

takeshimiya, I get exactly the error message you got .

Later , I have tried the following,
1. Rebuild , result fail

2. I suddenly remember that the unicode compilation of wxwidgets actually genarated a setup.h with UNICODE=0 !!!! It was my experience last time.

Therefore , I go to the unicode version of wxwidgets , and get the corresponding setup.h (default is under gcc_dllu\mswu\ if I am not mistaken)

I do a clean , dist clean , and recompile .

The link error message gone !!!! and left only 3 warning message ..




Title: Re: Unicode conversion (attention all devs)
Post by: me22 on August 15, 2005, 07:25:24 am
Now Saving/Loading Files Works Too!
Seems the problem was a simple case of a void* buffer being treaded as a wxChar* buffer instead of a char* buffer.

Here's the diff:
Code
Index: src/sdk/cbeditor.cpp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/sdk/cbeditor.cpp,v
retrieving revision 1.37.2.7
diff -u -r1.37.2.7 cbeditor.cpp
--- src/sdk/cbeditor.cpp 10 Aug 2005 16:56:47 -0000 1.37.2.7
+++ src/sdk/cbeditor.cpp 15 Aug 2005 05:21:13 -0000
@@ -41,6 +41,8 @@
 #include "cbplugin.h"
 #include "cbeditorprintout.h"
 
+#include <cstring> // std::strlen
+
 /* This struct holds private data for the cbEditor class.
  * It's a paradigm to avoid rebuilding the entire project (as cbEditor is a basic dependency)
  * for just adding a private var or method.
@@ -600,13 +602,12 @@
     if (!file.IsOpened())
         return false;
 
-    wxChar* buff = st.GetWriteBuf(file.Length());
+    void* buff = st.GetWriteBuf(file.Length());
     file.Read(buff, file.Length());
     file.Close();
-    st.UngetWriteBuf();
-
-    m_pControl->InsertText(0, st);
+    m_pControl->InsertText(0, _U( (char const *)buff ));
     m_pControl->EmptyUndoBuffer();
+    st.UngetWriteBuf();
 
     // mark the file read-only, if applicable
     bool read_only = !wxFile::Access(m_Filename.c_str(), wxFile::write);
@@ -647,8 +648,9 @@
     }
     
     wxFile file(m_Filename, wxFile::write);
-    if (file.Write(m_pControl->GetText().c_str(), m_pControl->GetTextLength()) == 0 &&
-        m_pControl->GetTextLength() != 0)
+    wxWX2MBbuf utf_text = m_pControl->GetText().mb_str(wxConvUTF8);
+    size_t utf_text_length = std::strlen( utf_text );
+    if (file.Write( utf_text, utf_text_length ) == 0 && utf_text_length != 0)
     {
         return false; // failed; file is read-only?
     }

[edit] Note that this only does files -- workspaces don't seem to save/load ( dunno which ) properly, and I haven't tried projects.
Title: Re: Unicode conversion (attention all devs)
Post by: rickg22 on August 15, 2005, 09:27:44 am
if you're using void, why not just use *char ? And comment the line, saying "this is a byte-buffer, don't replace with wxChar" or something.
Title: Re: Unicode conversion (attention all devs)
Post by: me22 on August 15, 2005, 05:29:43 pm
The point of the void* was to emphasize that it's not a wxChar*.

I could just use unsigned char *, but then it would show up if someone searched in all files for char .
Title: Re: Unicode conversion (attention all devs)
Post by: zieQ on August 23, 2005, 09:46:32 am
Help, unicode men have modified the parsing of MSVC  :lol:

For example this line:
Code
if (line.StartsWith(_T("Project_Dep_Name"))) {

Does _T means that we do nothing to the string (i.e. keep a char* representation, no unicode conversion)? I'm quite lost with _X() macros, can someone sum up them?
Title: Re: Unicode conversion (attention all devs)
Post by: mandrav on August 23, 2005, 10:09:47 am
Help, unicode men have modified the parsing of MSVC  :lol:

For example this line:
Code
if (line.StartsWith(_T("Project_Dep_Name"))) {

Does _T means that we do nothing to the string (i.e. keep a char* representation, no unicode conversion)? I'm quite lost with _X() macros, can someone sum up them?

wxT(), _T(): unicode string, not-translatable (IIRC just puts L before the quote, i.e. L"text")
_(): unicode string, translatable (use it for english messages and stuff)

There are also some conversion macros in sdk/settings.h:
_U(), _UU(), _C(), _CC()
for the conversion between char* and unicode.

Yiannis.
Title: Re: Unicode conversion (attention all devs)
Post by: takeshimiya on August 23, 2005, 10:13:37 am
About char*, that's why I suggested to use byte* as typedef.

It will make clear that you are using a byte buffer instead of a character string.

char typedefed as byte or wxByte would be good.
Title: Re: Unicode conversion (attention all devs)
Post by: tiwag on August 23, 2005, 10:27:09 am
from sdk/settings.h
Code
#if wxUSE_UNICODE
    #define _UU(x,y) wxString((x),(y))
    #define _CC(x,y) (x).mb_str((y))
#else
    #define _UU(x,y) (x)
    #define _CC(x,y) (x)
#endif

#define _U(x) _UU((x),wxConvUTF8)
#define _C(x) _CC((x),wxConvUTF8)


from wxWidgets-Help
Code
--------------------------------------------------------------------------------

wxT
wxChar wxT(char ch)

const wxChar * wxT(const char *s)

wxT() is a macro which can be used with character and string literals (in other words, 'x' or "foo") to automatically convert them to Unicode in Unicode build configuration. Please see the Unicode overview for more information.

This macro is simply returns the value passed to it without changes in ASCII build. In fact, its definition is:

#ifdef UNICODE
#define wxT(x) L ## x
#else // !Unicode
#define wxT(x) x
#endif

--------------------------------------------------------------------------------

_
const wxChar * _(const char *s)

This macro expands into a call to wxGetTranslation function, so it marks the message for the extraction by xgettext just as wxTRANSLATE does, but also returns the translation of the string for the current locale during execution.

Don't confuse this macro with _T()!



--------------------------------------------------------------------------------

wxPLURAL
const wxChar * wxPLURAL(const char *sing, const char *plur, size_tn)

This macro is identical to _() but for the plural variant of wxGetTranslation.



--------------------------------------------------------------------------------

_T
wxChar _T(char ch)

const wxChar * _T(const wxChar ch)

This macro is exactly the same as wxT and is defined in wxWidgets simply because it may be more intuitive for Windows programmers as the standard Win32 headers also define it (as well as yet another name for the same macro which is _TEXT()).

Don't confuse this macro with _()!

--------------------------------------------------------------------------------


summary     (please someone might correct if i'm wrong or add missing points)

Code
_()
- text's which might be translated to other user-languages
Code
_T()
wxT()
- fixed text's - like XRC resources object names

Code
_U()
- conversion from char* to wxString

Code
_C()
- multibyte C string  see wxhelp (wxMBConv classes overview)


HTH
Title: Re: Unicode conversion (attention all devs)
Post by: tiwag on August 23, 2005, 10:29:07 am
..char typedefed as byte or wxByte would be good.

i always used  "byte"  as typedef'ed  "unsigned char"
Title: Re: Unicode conversion (attention all devs)
Post by: zieQ on August 23, 2005, 11:20:13 am
In the case I cited before, i guess there is an error then, _T is used instead of _U! In unicode build, I don't think there is any conversion to perform to the string, or maybe I still do not understand the whole thing? The parsing consists of reading string in the project files (non-unicode files I think) and compare those string to something expected. Am I wrong?
Title: Re: Unicode conversion (attention all devs)
Post by: rickg22 on August 23, 2005, 05:49:58 pm
_T or wxT only adds an L before the string (ONLY if you're in a unicode build).

Example:

_T("hello there" becomes "hello there" in ansi.
_T("hello there") becomes L"hello there" in unicode.

but if you deal with functions that return strings, you must use our _U macro:

_U(hello_there()) becomes lotsastuffyoudontwanttoknow(hello_there()) in unicode.

The lesson is: if you're using wxString, you MUST use conversion macros.
Title: Re: Unicode conversion (attention all devs)
Post by: jmccay on September 05, 2005, 10:23:48 pm
I've tried to extract the gist of all thess posts to a page on the wiki.  I must note that I haven't really used these macros yet so the content is probably grouped badly.  Also, I don't know that much about editing wiki pages.  With that said, the ugly first attempt is under the wiki main page->articles->Under "Development" section chose "Unicode Standards".
 
   It's not pretty, but it's a starting point for future revision.  It is an attempt to remove the need to go through all of the current 8 pages of the Unicode stuff.  It does need work, and maybe somebody whose gone the pain of the conversion (& knows wiki better) can make it look better.
Joe M.
Title: Re: Unicode conversion (attention all devs)
Post by: gfgfd on September 11, 2005, 12:16:50 pm
finally got codebooks to compile.. :D  with few changes tho..
i'm using gentoo, wx 2.6.1 unicode & cvs c::b

Code
Index: src/plugins/codecompletion/ccoptionsdlg.cpp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/codecompletion/ccoptionsdlg.cpp,v
retrieving revision 1.7
diff -u -r1.7 ccoptionsdlg.cpp
--- src/plugins/codecompletion/ccoptionsdlg.cpp 8 Sep 2005 12:54:46 -0000 1.7
+++ src/plugins/codecompletion/ccoptionsdlg.cpp 11 Sep 2005 09:49:49 -0000
@@ -91,7 +91,7 @@
  XRCCTRL(*this, "chkLocals", wxCheckBox)->SetValue(m_Parser.Options().followLocalIncludes);
  XRCCTRL(*this, "chkGlobals", wxCheckBox)->SetValue(m_Parser.Options().followGlobalIncludes);
  XRCCTRL(*this, "chkPreprocessor", wxCheckBox)->SetValue(m_Parser.Options().wantPreprocessor);
- XRCCTRL(*this, "chkNoCC", wxCheckBox)->SetValue(ConfigManager::Get()->Read("/code_completion/use_code_completion", 1L) == 0);
+ XRCCTRL(*this, "chkNoCC", wxCheckBox)->SetValue(ConfigManager::Get()->Read(_T("/code_completion/use_code_completion"), 1L) == 0);
  XRCCTRL(*this, "chkSimpleMode", wxCheckBox)->SetValue(!m_Parser.Options().useSmartSense);
  XRCCTRL(*this, "chkCaseSensitive", wxCheckBox)->SetValue(m_Parser.Options().caseSensitive);
  XRCCTRL(*this, "chkInheritance", wxCheckBox)->SetValue(m_Parser.ClassBrowserOptions().showInheritance);
@@ -162,7 +162,7 @@
  m_Parser.Options().followGlobalIncludes = XRCCTRL(*this, "chkGlobals", wxCheckBox)->GetValue();
  m_Parser.Options().wantPreprocessor = XRCCTRL(*this, "chkPreprocessor", wxCheckBox)->GetValue();
  m_Parser.Options().caseSensitive = XRCCTRL(*this, "chkCaseSensitive", wxCheckBox)->GetValue();
- ConfigManager::Get()->Write("/code_completion/use_code_completion", !XRCCTRL(*this, "chkNoCC", wxCheckBox)->GetValue());
+ ConfigManager::Get()->Write(_T("/code_completion/use_code_completion"), !XRCCTRL(*this, "chkNoCC", wxCheckBox)->GetValue());
  m_Parser.Options().useSmartSense = !XRCCTRL(*this, "chkSimpleMode", wxCheckBox)->GetValue();
  m_Parser.ClassBrowserOptions().showInheritance = XRCCTRL(*this, "chkInheritance", wxCheckBox)->GetValue();
  m_Parser.ClassBrowserOptions().viewFlat = XRCCTRL(*this, "cmbCBView", wxComboBox)->GetSelection() == 0;
Index: src/plugins/compilergcc/compilerMINGW.cpp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/plugins/compilergcc/compilerMINGW.cpp,v
retrieving revision 1.32
diff -u -r1.32 compilerMINGW.cpp
--- src/plugins/compilergcc/compilerMINGW.cpp 7 Sep 2005 09:55:50 -0000 1.32
+++ src/plugins/compilergcc/compilerMINGW.cpp 11 Sep 2005 09:49:49 -0000
@@ -80,11 +80,12 @@
  _T("-O -O1 -O2 -O3 -Os"),
  _("You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."));
 #ifdef __WXMSW__
-    #define GPROF_LINK "-pg -lgmon"
+    #define GPROF_LINK _T("-pg -lgmon")
 #else
-    #define GPROF_LINK "-pg"
+    #define GPROF_LINK _T("-pg")
+           
 #endif
- m_Options.AddOption(_("Profile code when executed"), _T("-pg"), _("Profiling"), _T(GPROF_LINK));
+ m_Options.AddOption(_("Profile code when executed"), _T("-pg"), _("Profiling"), GPROF_LINK);
 
     wxString category = _("Warnings");
 
Index: src/src/main.cpp
===================================================================
RCS file: /cvsroot/codeblocks/codeblocks/src/src/main.cpp,v
retrieving revision 1.94
diff -u -r1.94 main.cpp
--- src/src/main.cpp 8 Sep 2005 07:55:20 -0000 1.94
+++ src/src/main.cpp 11 Sep 2005 09:49:50 -0000
@@ -442,7 +442,7 @@
     pDockWindow1 = new wxDockWindow( this, 0, _("Management"), wxPoint( 64, 64 ), wxSize( leftW, clientsize.GetHeight() ) );
     pDockWindow1->SetClient( m_pNotebook );
 
-    pDockWindow2 = new wxDockWindow( this, 0, _("Messages"), wxPoint( 96, 96 ), wxSize( clientsize.GetWidth(), bottomH ), "d1" );
+    pDockWindow2 = new wxDockWindow( this, 0, _("Messages"), wxPoint( 96, 96 ), wxSize( clientsize.GetWidth(), bottomH ), _("d1") );
     pDockWindow2->SetClient( Manager::Get()->GetMessageManager() );
 
     // setup dockmanager
Title: Re: Unicode conversion (attention all devs)
Post by: mandrav on September 11, 2005, 03:54:42 pm
Thanks for the patch :)
Was the build process easy/correct?
Did you encounter any other problems, besides those unicode issues?
I 'm asking because the autotools build system is fairly new and I 'm still gathering feedback.
Title: Re: Unicode conversion (attention all devs)
Post by: gfgfd on September 11, 2005, 06:29:01 pm
no problems.. builds and runs just fine :)