Ian's BCX Code Pages

WinCe & PPC Programming


Home

Unicode Programming

WinCe Programming

BMFD Programs

Miscellaneous codes

Languages Code

BCXOLR

Android programming

Links to other BCX sites






DOWNLOAD LATEST: UnicodeLexer v3_3.zip - Source & exe of Unicode translator.

Note 1) There is no help file except this page.
Note 2) PellesC POCC.exe v5.08 is needed with PellesC v6 Include and Libs files is needed for Pocket PC and SmartPhone apps.

Calc.zip  - Kevin Diggens calculator demo - compiled in PellesC 5.08
This example demonstrates how easy it is to compile as Win32 ANSI, Win32 Unicode and for Pocket PC with only a couple of changes.
Changes are noted in the first part of the file along with build settings for PellesC.

Introduction:

Most modern compilers can now compile for unicode but normally you need to rewrite alot of your code to do this.

I just wanted an easier way to convert ANSI 'C' code to a compiler ready unicode format.
Back in 2004 I wrote BCX2Unicode with help from Garvan O'Keefe but last year Wayne Halsdorf wrote the UnicodeLexer and this is now my translator of choice.

How easy is compiling to unicode?
   Translating to Unicode is adding L or _T in front of quoted strings and changing from ANSI functions to unicode functions.
  And recompile using Unicode parameters in pocc command line call, see How I compile my BCX programs with PellesC
   Okay it is a little more complicated than that but not by much.

In BCX, just by adding a couple of lines to my base code I can compile the same code to run as Win32/64 ANSI or Unicode.

BCX:

BCX by Kevin Diggins was designed to intepret Basic code to the 'C' equivalent.
It is easy to use and translates on average each line of Basic into 2-10 lines of 'C' code.

UnicodeLexer:

Wayne Halsdorf used my BCX2Unicode idea and made UnicodeLexer.

UnicodeLexer Introduction:

UnicodeLexer  is basically a search & replace program with added features before the c compiler sees your code:

1) translates Windows API code to Windows Unicode API code
2) translates ANSI strings to Unicode i.e. "help" to _T("help"} or L"help" depending on on the switches used
3) used to either delete or translate code that absolutely will not work with Unicode / WinCE or other compilers.
4) Uses a comma delimited text file to store list of items to change
5) can generate a report of changed items,  see -d option
6) can accept several parameters (see BCX2Unicode  Readme.rtf)
7) Switch to turn off/on translation around ANSI essential code using
    //<---UNICODE AWARE translation off
    //>---UNICODE AWARE translation on
or
    !//$EMIT_ANSI switch
8) Can be used in Command Line mode or it will revert to GUI if no command line parameters are available


UnicodeLexer Command line Parameters:

1st parameter should be yourFilename.c(cpp) - this must be the whole path  and filename, can be .c  or .cpp

NONE: This will invoke a File Dialog box to input the filename and then Parameters input box.

Conversion file parameters:
none:  uses the file  TCHARXLATER.txt as the conversion file

-ppc : use the file TCHARXLATOR_PPC.txt as the conversion file
-g    : use the file  TCHARXLATER_USER.txt as the conversion file
         a different user filename can only be added in GUI mode.
-w  : use the file  TCHARXLATER_WIDE.txt as the conversion file
-u   : use the file  TCHARXLATER.txt as the conversion file (default)

Other parameters:
-t   : disable using '_T' in front of quoted strings defaults to adding L .
-l   : disable using 'L'  in front of quoted strings.
       NOTE: to turn off both adding '_T' and 'L' use -t -l

-d  : generate a LOG file, this file can be large as it will generate 3 lines per line of c code
  
     Not sure then start the UnicodeLexer.exe without Parameters and use the GUI interface

Compile from a C compiler:

Save your work and Run UnicodeLexerV3.exe from either the command line or in GUI mod from Windows explorer
In GUI mode add the filename you want to translate, and any other parameters.
Defaults are translate using the  tchar.h file, use _T to decorate strings.
Click on "Done".
Your file is now converted and use the appropiate compile string in your compiler to output your file.exe

NOTE: Your old file will be saved with the extension ".bak" and the translated file will have the ".c" extension
Look at the different pocc and polink commands I use below:

How I compile my BCX programs with PellesC:

If the file I want to convert is a BCX .bas file then I convert it to 'C' using command line  BC.exe filename.bas

ANSI:
Command line calls to the PellesC compiler:
pocc -W1 -Ot -Gd -Go -Ze -Zx -MT -Tx86-coff -D_WIN32_WINNT=0x0501  filename.c
polink -release -machine:ix86 -subsystem:windows filename.obj kernel32.lib advapi32.lib delayimp.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib

Win32 Unicode:
In my basic file I add:
   $ONEXIT "D:\BCX\Bin\BC_2_Unicode\unicodelexer.exe D:\BCX\WinCe\Calc\Calc.c"  'Change Paths to suit

Command line calls to the PellesC  compiler:
pocc -W1 -Ot -Gd -Go -Ze -Zx -MT -Tx86-coff -D_WIN32_WINNT=0x0501 -DUNICODE -D_UNICODE filename.c
polink -release -machine:ix86 -subsystem:windows filename.obj kernel32.lib advapi32.lib delayimp.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib

WinCE:
In my basic file I add
   $ONEXIT "D:\BCX\Bin\BC_2_Unicode\unicodelexer.exe D:\BCX\WinCe\Calc\Calc.c -ppc"  'Change Paths to suit
   $INCLUDE "WinCesetup.bas"  'adds some include files and CEFunctions.bas
   $INCLUDE "PPConlyFunctions.bas"  'adds some PPC only includes and Menu Functions

Command line calls to the PellesC compiler:
pocc -W1 -Ot -Gd -Go -Ze -Zx -MT -Tarm-coff -D_WINCE -D_WIN32_WCE=0x400 -DARM -D_ARM_ -DUNICODE -D_UNICODE filename.c
polink -release -machine:arm  -subsystem:windowsce,4.0 filename.obj -stack:0x10000,0x1000 -version:1.1  aygshell.lib coredll.lib corelibc.lib commctrl.lib crtce.lib

Needed programs:

BC.exe - Get the latest from http://groups.yahoo.com/group/BCX/
UnicodeLexer v3_3.zip - Source & exe of Unicode translator

Last version of  BCX2unicode.zip - Source & exe of my old Unicode translator (not needed)

Some Notes on whats I've done:

See the BCX2Unicode Readme File in the BCX2Unicode zip file
WinCe dos&donts.rtf - My ramblings on what worked and what didn't and sometimes why:)
WinCE CommPort Notes.rtf - How I got Serial ports to work in WinCE
Use EZ-IDE w_WinCE.rtf - How far I got with using EZ-IDE in WinCE


Examples of some BCX WinCE programs:
Common:
      
CEsupportfiles.zip - Files I use in most programs


PELLESC:

ceListView.zip - compiled in PelesC - Updated 12/22/08
Same as ListVTest.zip but for PellesC
I have a section that can be commented out to use in XP
Uses Listview, Edit box(text), Static (label) and Buttons

 

Calc.zip  - Kevin Diggens calculator example - compiled in PellesC 5.08 - 2/2010
just comment in/out a couple of lines of code and it works for Win32 ansi, Win32Unicode or WinCe.

LanguageTest.zip - simple example to show how I add multiple languages to a BCX program. -3/2010
I made this unicode so I could use all the characters available.
This is for Win32Unicode or WinCe.

English View           Chinese View

UnicodeViewer.zip
Example of showing all unicode characters, has combobox for some language ranges (not all) - 3/2010
You can also use the rdit boxes to input other ranges of numbers.
This is for Win32Unicode or WinCe.


EVC++ 3.0
I think most of these files include the ".exe" file else you'll need to recompile.
At least you have the example code:)
I have since deleted and re-installed all my eVC and eVB stuff, missing some magic parameter to compile these again , hmm.


ceAccessIt.zip      -  Demo of using an Access database - compiled in eVC 3.0 - Updated 7/15/05

Access normal
                        mode

SerialLogger.zip  - Demo of a Serial Port datalogger - compiled in eVC 3.0 -Updated 7/13/05

seriallogger

ListVTest.zip - Demo using a ListView control - compiled in eVC 3.0 -Updated 7/13/05



Bcxedit.Zip  - My First CE program using BCX (see credits) - compiled in eVC 3.0 -Updated 7/13/05

ceMail.zip - This can send and read mail but I haven't finished displaying the mail yet. - compiled in eVC 3.0 - Updated 7/13/05

Login Page    Send This


If you're one of the people the helped me  by providing samples to the BCX, you may see I've used sample lines and sometimes whole functions, normally not without major modification.
Anyway thanks to all those that helped.
Especially: Garvan O'Keefe, Doyle Whisenant (BCXEdit), Mike Henning and Kevin Diggins