In my latest, second article
on CabInstl, Mad Programmer's File Dialog Changer and the HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer\fAskDest registry
key, I’ve already spoken a bit about the two free scripting applications, nscript
for the Pocket PC.
Because nscript has excellent support for the Windows Mobile operating system, I’ve decided to compare it to the other solutions of directly compiling code on the Pocket PC: Java
(my tutorials there have even made to the Pocket PC Thoughts frontpage!
) and PocketC
Why did I choose just Java and PocketC, you may ask. The answer is simple. To my knowledge, these are the only two environments/languages that can also be edited and, most importantly, compiled
on the Pocket PC (not taking into account almost useless, non-native solutions like running Borland C++ under PocketDOS). I wish I could be able to edit and compile native
WindowsCE C/C++ applications, or managed code
(Compact Framework; preferably accessed from C#) on the Pocket PC, but, as far as I know, it’s not possible. So, for people that have to write an app that does something serious while they don’t have access to a desktop PC (or, the language/class librtary they use just don’t support the thing they want to do – see or example the WinCE database access, which I’ll speak more in the next paragraph), only PocketC and Java are the viable solutions.
PocketC was a big surprise for me
. Despite the lack of any kind of TCP/IP and multithreading support, it’s an astonishingly well written, compact language and function library. My initial fears (what if it’s so different from C that I end up learning another language/even I/O/string handler library?) disappeared very fast when I learnt more and more about it. I especially liked the almost full access to the WindowsCE system databases it offers – not even the Compact Framework 2.0 is able to do this (it only allows for accessing PIM databases), let alone older, now still current versions! It also has a great set of drawing, file I/O functions etc.
Some remarks on PocketC: please note that its character size must be modified in a rather unusual place: Help/Preference
. Without it, it has way too big characters in QVGA/SE VGA. On VGA devices, size of 6 is the way to go IMHO, especially in Landscape mode. It also puts a 357,041-byte-long help file, pchelp.htp
, in \Windows; you may want to relocate/delete it after installation.
Java is also compiling/working great on Pocket PC’s, especially with the CrEme JVM. Please read the above-linked thread on Java compilation for more information. Also, on MortRunner and nscript, read my second big post in the above thread.
When to use which language/environment?
First, you need to make a distinction based on whether you “only” want to have a “light” scripting language (only slightly better, in this respect, than the control/conditional structures of MS-DOS) that is mostly meant for process control (MortRunner), a strong(er) language with decent C-like syntax and tolerably good system access capabilities (nscript) or a language that is, except for the TCP/IP and multithreading fiasco, is able to do almost anything on your PDA (PocketC). The latter, PocketC, is even able to access all the “problematic” parts of the device that can’t be accessed by a generic, multiplatform language like Java.
This means you shouldn’t (and, actually, can’t really) use PocketC or Java for process control (say, starting external programs, sending mouse clicks to it just like the stylus tap emulation in the Button Mapper app of VITO SystemTools
etc), while, on the other hand, you won’t be able to write an app that processes (reads, extracts some info etc) files in MortRunner. The former is meant for scripting apps, the latter for real programming languages.
There is indeed some kind of overlap between the two categories. While, for example, nscript is more of a scripting app, it even offers file I/O like a “real” programming language and even regex support and socket I/O (the latter two isn’t supported by PocketC). This is why I’ve decided to include both scripting apps together with “real” programming languages in my roundup.
Enough of talk: let the table speak instead of me.
This table contains all the major areas: I/O, networking, string manipulation, system access, native graphics, process control, multithreading, system events, WinCE databases, WinCE registry etc. I’ve even collected and formatted the function names (with Java, mostly the package names) for the different application areas so you’ll know at once what to use.
(Note that, the table being a big HTML table, I couldn’t copy its contents in here. This is why I needed to link it.)
: all the three apps/environments have strengths and weaknesses. nscript and MortRunner are both free; the latter is actively worked on, the latest version, 2.60, released some days ago. I wish it had a C-like syntax though. For simple(r) scripting/programming, they, especially nscript, may be perfectly OK.
PocketC has delivered much more than I expected. This app is really great, except for the lack of multithreading and network support. For multithreading, you may want to stick to Java; for network support, nscript can also be a good choice.
With Java, as I’ve already pointed out in the Java compilation thread above, you have access to almost anything. All this editable, compilable and usable right on your PDA, without the need for any desktop computer. Its only downside is the unability to access the registry / the system databases. In the latter, PocketC really excels, and is much easier to use than the standard Win32 library. (Which, again, can only be written programs to on a desktop PC.)
Please let me know if you have any questions about any of the three above applications or how Java should be compiled/run on the PPC. I will also keep posting scripts/programs using these apps in my later posts.