Author Topic: Simple WinXP way to do Non-unicode compile of Code::Blocks  (Read 4554 times)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6956
    • My Best Post
Simple WinXP way to do Non-unicode compile of Code::Blocks
« on: September 26, 2008, 04:25:33 am »
How to use SED to convert cbp files to using non-unicode wxWidgets.

Tools needed include sed.exe from GnuWin32 http://gnuwin32.sourceforge.net/packages.html

Must have an copy of Code::Blocks source code like an SVN copy.

Tim S

ANSI.sed
Code: [Select]
s/<Variable name="WX_SUFFIX" value="u" \/>/<Variable name="WX_SUFFIX" value="" \/>/g
s/<Add option="-DwxUSE_UNICODE" \/>$/<Add option="-DwxUSE_UNICODE=0" \/>$/g
s/<Add option="-DwxUSE_UNICODE=1" \/>$/<Add option="-DwxUSE_UNICODE=0" \/>$/g

This batch file assumes the folder codeblocks is below the folder holding this batch file and the sed script file.

sed-ANSI.bat
Code: [Select]
SET PATH=C:\Program Files\GnuWin32\bin;C:\WINDOWS\system32

setlocal
set TOP=%CD%
set SEDFILE=ANSI.sed

CD codeblocks

REM
set CB=%CD%

cd %CB%\src
sed --separate --file=%TOP%\%SEDFILE% --in-place CodeBlocks.cbp

cd %CB%\src\plugins\contrib\AutoVersioning
sed --separate --file=%TOP%\%SEDFILE% --in-place AutoVersioning.cbp

cd %CB%\src\plugins\contrib\BrowseTracker
sed --separate --file=%TOP%\%SEDFILE% --in-place BrowseTracker.cbp

cd %CB%\src\plugins\contrib\byogames
sed --separate --file=%TOP%\%SEDFILE% --in-place byogames.cbp

cd %CB%\src\plugins\contrib\cb_koders
sed --separate --file=%TOP%\%SEDFILE% --in-place cb_koders.cbp

cd %CB%\src\plugins\contrib\codesnippets
sed --separate --file=%TOP%\%SEDFILE% --in-place codesnippets.cbp

cd %CB%\src\plugins\contrib\codestat
sed --separate --file=%TOP%\%SEDFILE% --in-place codestat.cbp

cd %CB%\src\plugins\contrib\copystrings
sed --separate --file=%TOP%\%SEDFILE% --in-place copystrings.cbp

cd %CB%\src\plugins\contrib\devpak_plugin
sed --separate --file=%TOP%\%SEDFILE% --in-place DevPakPlugin.cbp

cd %CB%\src\plugins\contrib\dragscroll
sed --separate --file=%TOP%\%SEDFILE% --in-place dragscroll.cbp

cd %CB%\src\plugins\contrib\envvars
sed --separate --file=%TOP%\%SEDFILE% --in-place envvars.cbp

cd %CB%\src\plugins\contrib\headerfixup
sed --separate --file=%TOP%\%SEDFILE% --in-place headerfixup.cbp

cd %CB%\src\plugins\contrib\help_plugin
sed --separate --file=%TOP%\%SEDFILE% --in-place help-plugin.cbp

cd %CB%\src\plugins\contrib\keybinder
sed --separate --file=%TOP%\%SEDFILE% --in-place keybinder.cbp

cd %CB%\src\plugins\contrib\lib_finder
sed --separate --file=%TOP%\%SEDFILE% --in-place lib_finder.cbp

cd %CB%\src\plugins\contrib\profiler
sed --separate --file=%TOP%\%SEDFILE% --in-place cbprofiler.cbp

cd %CB%\src\plugins\contrib\regex_testbed
sed --separate --file=%TOP%\%SEDFILE% --in-place RegExTestbed.cbp

cd %CB%\src\plugins\contrib\source_exporter
sed --separate --file=%TOP%\%SEDFILE% --in-place Exporter.cbp

cd %CB%\src\plugins\contrib\symtab
sed --separate --file=%TOP%\%SEDFILE% --in-place symtab.cbp

cd %CB%\src\plugins\contrib\ThreadSearch
sed --separate --file=%TOP%\%SEDFILE% --in-place ThreadSearch.cbp

cd %CB%\src\plugins\contrib\wxSmith
sed --separate --file=%TOP%\%SEDFILE% --in-place wxSmith.cbp

cd %CB%\src\plugins\contrib\wxSmithContribItems
sed --separate --file=%TOP%\%SEDFILE% --in-place wxSmithContribItems.cbp

cd %CB%\src\plugins\contrib\HexEditor
sed --separate --file=%TOP%\%SEDFILE% --in-place HexEditor-win.cbp

cd %CB%\src\tools\cb_share_config
sed --separate --file=%TOP%\%SEDFILE% --in-place cb_share_config.cbp

PAUSE
« Last Edit: September 26, 2008, 04:32:56 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6956
    • My Best Post
Re: Simple WinXP way to do Non-unicode compile of Code::Blocks
« Reply #1 on: September 26, 2008, 04:36:46 am »
Compiling as an ANSI (non-unicode) wxWidget like build results in warning not normally displayed showing up.


Patch for some of the warning

Code: [Select]
Index: src/plugins/contrib/source_exporter/wxPdfDocument/src/pdfkernel.cpp
===================================================================
--- src/plugins/contrib/source_exporter/wxPdfDocument/src/pdfkernel.cpp (revision 5208)
+++ src/plugins/contrib/source_exporter/wxPdfDocument/src/pdfkernel.cpp (working copy)
@@ -758,7 +758,7 @@
 
     NewObj();
     OutAscii(wxString(_T("<<")) + filter + wxString(_T("/Length ")) +
-             wxString::Format(_T("%ld"), CalculateStreamLength(p->TellO())) + wxString(_T(">>")));
+             wxString::Format(_T("%d"), CalculateStreamLength(p->TellO())) + wxString(_T(">>")));
     PutStream(*p);
     Out("endobj");
     if (m_compress)
@@ -927,7 +927,7 @@
         Out("/Decode[0 1 0 1 0 1 0 1 0 1]");
         Out("/BitsPerFlag 8");
         wxMemoryOutputStream* p = grad->GetBuffer();
-        OutAscii(wxString::Format(_T("/Length %ld"), CalculateStreamLength(p->TellO())));
+        OutAscii(wxString::Format(_T("/Length %d"), CalculateStreamLength(p->TellO())));
         Out(">>");
         PutStream(*p);
         Out("endobj");
@@ -1549,7 +1549,7 @@
       p = &(currentTemplate->m_buffer);
     }
 
-    OutAscii(wxString::Format(_T("/Length %ld >>"), CalculateStreamLength(p->TellO())));
+    OutAscii(wxString::Format(_T("/Length %d >>"), CalculateStreamLength(p->TellO())));
     PutStream(*p);
     Out("endobj");
     if (m_compress)
Index: src/plugins/contrib/dragscroll/dragscroll.cpp
===================================================================
--- src/plugins/contrib/dragscroll/dragscroll.cpp (revision 5208)
+++ src/plugins/contrib/dragscroll/dragscroll.cpp (working copy)
@@ -244,7 +244,7 @@
  PluginInfo* pInfo = (PluginInfo*)(Manager::Get()->GetPluginManager()->GetPluginInfo(this));
  pInfo->version = wxT(VERSION);
  // Allow other plugins to find our Event ID
- m_DragScrollFirstId = wxString::Format( _T("%ld"), wxEVT_DRAGSCROLL_EVENT);
+ m_DragScrollFirstId = wxString::Format( _T("%d"), wxEVT_DRAGSCROLL_EVENT);
  pInfo->authorWebsite = m_DragScrollFirstId;
 
  #if defined(LOGGING)
Index: src/plugins/contrib/symtab/symtabexec.cpp
===================================================================
--- src/plugins/contrib/symtab/symtabexec.cpp (revision 5208)
+++ src/plugins/contrib/symtab/symtabexec.cpp (working copy)
@@ -539,7 +539,7 @@
 
         if (item!=-1)
         {
-          s_item.Printf(_T("%6d"), item);
+          s_item.Printf(_T("%6ld"), item);
           m_ListCtrl->SetItem(item, 0, s_item);
 
           // Symbols can have colons in it, too        -> like Class::Method()
Index: src/plugins/contrib/codesnippets/Search/ThreadSearchView.cpp
===================================================================
--- src/plugins/contrib/codesnippets/Search/ThreadSearchView.cpp (revision 5208)
+++ src/plugins/contrib/codesnippets/Search/ThreadSearchView.cpp (working copy)
@@ -538,7 +538,7 @@
     {
         long snippetID = it->second;
         CodeSnippetsEvent evt(wxEVT_CODESNIPPETS_SELECT, snippetID);
-        wxString strID = wxString::Format(_T("type=\"snippet\" ID=\"%d\""), snippetID);
+        wxString strID = wxString::Format(_T("type=\"snippet\" ID=\"%ld\""), snippetID);
         evt.SetSnippetString( strID );
         evt.PostCodeSnippetsEvent(evt);
     }
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9595
Re: Simple WinXP way to do Non-unicode compile of Code::Blocks
« Reply #2 on: September 26, 2008, 09:04:39 am »
How to use SED to convert cbp files to using non-unicode wxWidgets.
Patch for some of the warning
Mind feeding this into the WiKi?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6956
    • My Best Post
Re: Simple WinXP way to do Non-unicode compile of Code::Blocks
« Reply #3 on: September 26, 2008, 08:57:12 pm »
How to use SED to convert cbp files to using non-unicode wxWidgets.
Patch for some of the warning
Mind feeding this into the WiKi?

Ok, will do an WiKi on it.

http://wiki.codeblocks.org/index.php?title=Building_an_Non-Unicode_Win32_Code::Blocks

I am done; please look it over. I redid the batch file to make it easier for Devs to not accidentally commit the ANSI project files.

Tim S
« Last Edit: September 26, 2008, 10:18:43 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6956
    • My Best Post
Re: Simple WinXP way to do Non-unicode compile of Code::Blocks
« Reply #4 on: September 26, 2008, 10:20:45 pm »
http://wiki.codeblocks.org/index.php?title=Building_an_Non-Unicode_Win32_Code::Blocks

I am done; please look it over. I redid the batch file to make it easier for Devs to not accidentally commit the ANSI project files.

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9595
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ