Introduction:
I started using BCX with the
specific purpose of programming for the
PocketPC. eVB was no longer going to be supported by MS and I had
misgivings
about dotNET, price being one of them.
Being about the worst 'C' programmer in the world and after using VB 3
thru 6
and paying for marginal updates I decided there must be another way.
Fortunately I found BCX!!
Now I'm using PellesC and with minor alterations I can use several of
my regular windows programs in winCe
after I compile for PPC and adjust for screen size.
Some insight into BCX:
BCX by Kevin Diggins was designed
to intepret Basic code to the 'C'
equivalent. Kevin Diggins did a wonderful job of starting this project
and is
still actively involved with it's development. Since the end of 2004,
Mike Henning has stepped in to take Kevins place and has really had a
magnificent amount of input and upgrades.
BCX at present is a mixture of Windows API calls and Ansi C
although efforts are being made to add COM, but I
have
still been unable to implement this in WinCE.
Differences between
Windows 9x, XP and WinCE:
I'm not going to go into alot of
detail right here.
WinCE includes most of the Windows desktop API although they have a
Unicode name. Normally this is a w somewhere in the name.
WinCE is Unicode, although Serial ports use ANSI this must be
translated.
Some Windows API's have no easy translation and need special care and
sometimes a new routine to convert the BCX code.
i.e. Val()
Considerations &
Strategy for
compiling to WinCE:
1) As WinCE devices
generally use a smaller screen size right now 3" Width
* 4" Depth (1/4 VGA) I decided that the program QTab Wizard would
be almost ideal for my needs. I generally use 3 to 6 tabbed pages (or
more)
even in a small programs, and menus were originally shied away from by
eVB programmers, I'm not really sure why anymore. At the time BCX
didn't natively support tabbed pages, and I haven't had the time to
check them out.
2) WinCE is Unicode, BCX generally emits ANSI C code, I decided
that the
universal method as used in TCHAR.h would best suit my needs.
3) As I already had eVC ++ 3.0 on my development computer I decided I
would use this as my compiler. and not 'Pelles C' as I also wanted to
compile for other WinCE devices other that PPC.
Recently I got PellesC to work for PPC and now use it almost
exclusively.
BCX2Unicode:
I built BCX2unicode.exe
with lots of help from Garvan and others on the BCX website to convert
what I needed . I will put a link at the bottom of this page.
BCX2Unicode is basically a search & replace program with added
features.
BCX2Unicode does a few things to the c code before the c compiler sees
your code:
1) translates BCX ANSI strings to Unicode i.e. "help" to _T("help"}
2) translates Windows API code to Windows Unicode API code
3) used to either delete or translate code that absolutely will not
work with WinCE or other compilers.
4) Uses a comma delimited text file to store list of items to change
5) generates a report of changed items
6) can accept several parameters (see BCX2Unicode Readme.rtf)
7) Switch to turn off/on translation - ! //EMIT_ANSI
8) It can sort variable lists and add default values. -NEW Jan '08
NOTE: A recent change in BCX
has rendered the //EMIT_ANSI switch useless.
Now we must use: ! //EMIT_ANSI note the Exclaimation mark
(single line of C Code in BCX)
I am presently updating all the files, so if you do get errors in the
demos with mixed ansi & unicode variables, then this may be the
problem.
Ian
How I compile with EVC:
These are the steps I need to take to make and compile a program for
EVC++
1) Build the BCX Program with the $CPP command near the top of the
program.
2) Add the BCX2Unicode on Exit Command.
$ONEXIT "C:\BCX\XLator\BCX2unicode.EXE
C:\BCX\WinCe\Test\Test.cpp"
remember it's the cpp file we're going to translate.
Change the paths as well.
3) Run BCX on the file, this should automatically run BCX2Unicode as
well. I use Dev Suite Pro, so I hit F10.
4) Open eVC++ and create a new empty project, this needs to be
done to set which type of processor and other options in the WinCe
device.
5) Add your file to the Project (Project -> Add To Project ->
Files)
6) Check the Line above the code window specifies your device and
processor type you're compiling for.
7) Build your Project. Hopefully it will compile and run on your WinCe
Device.
How I compile with
PellesC:
I set up my editor (Context) to accept F9 button for compile to
automagically
compile for PPC and use the PellesC bat file:
i.e command line is D:\BCX\Bin\PellesC.bat PPC UPX Path &
Filename
My pellesC.bat file can be downloaded here: Ian's
PellesC.bat for PPC
1) Add the BCX2Unicode on Exit Command to your bcx .bas file near the
top.
$ONEXIT "D:\BCX\XLator\BCX2unicode.exe
D:\BCX\WinCe\Test\Test.c"
Change the paths to suit your setup.Note we are calling
the .c file not . bas!!
2) Press key F9 to compile or run the command line code above.
3) My compile settings for PellesC in Context:
pocc -Tarm-coff -Zi
-W1 -Gd -Ze -Zx -D_WINCE -D_WIN32_WCE=0x400 -DDEBUG -DARM -D_ARM_
-DUNICODE -D_UNICODE %3.c
polink -release
-machine:arm -subsystem:windowsce,3.0 %3.obj %ResFileName%.res
-stack:0x10000,0x1000 -version:1.1 aygshell.lib coredll.lib
corelibc.lib commctrl.lib %4 %5 %6
News:
NOTE: A recent change in BCX
has rendered the //EMIT_ANSI switch inoperable.
Now we must use: ! //EMIT_ANSI note the Exclaimation mark
(single line of C Code in BCX)
Last update Jan 26, 2008,
I started adding stuff for other compilers, now bcx2Unicode can work on
variable lists in the functions:
i.e. you need to change from functionA to functionB but variable
lists don't match:
Dec. 22, 2008
I found that eVC and eVB were not on my new computer , after an install
of these I'm still missing something, all errors are in the included
".h" files.
So I am converting all of these to compile on PellesC.
In PellesC:
ceListView.zip - compiled
in PelesC - Updated 12/22/08
Links
to my working programs:
These programs worked for me, some are getting a little old, but if
there
are bugs please let me know:
I have since deleted and re-installed all my eVC and eVB stuff, missing
some magic parameter to compile these again , hmm.
Please note these files are my own and are not in any way related to
StarTrak Pigging, except being hosted here.
These are demos of programs I have put together to test BCX with WinCe
Devices.
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.
Needed programs:
Some Notes on whats I've
done:
Examples of some BCX WinCE
programs:
I think most of these files include the ".exe" file
else you'll need to recompile.
At least you have the example code:)
CEsupportfiles.zip -
Files I use in most programs
ceAccessIt.zip
- Demo of using an Access database - compiled in eVC
3.0 - Updated 7/15/05
SerialLogger.zip -
Demo of a Serial Port datalogger - compiled in eVC 3.0 -Updated 7/13/05
ListVTest.zip - Demo using
a ListView control - compiled in eVC 3.0 -Updated 7/13/05
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 - A calculator
demo - compiled in eVC 3.0
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
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
Coming
Soon:
I'm working on a language demo, I have it working in my River survey
program for my PPC.
Links
to other BCX Sites:
|