Review: Programming: Palmtop Application Library Update

PAL lets programmers create DOS programs for the Palmtop with the look and feel of a built-in Palmtop application. The latest version of PAL provides better memory management, expanded memory support, AppManager support and much more.

By Gilles Kohl

PAL is a collection of C language functions that provide programmers with the tools needed to give DOS programs the look and feel of the HP 100/200LX build-in applications. This includes pull-down menus, dialog boxes, hot-keys and cut-and-paste capabilities.

Over a year has passed since the first version of the Palmtop Application Library or PAL was uploaded to the libraries of the HPHAND forum on CompuServe.

The November 1994 upload was meant for contributors only - it could not yet be used for serious development. There were about 25 source files, and the entire compressed archive was less than 80K in size.

Half a year ago, I wrote about V1.1 of PAL in the July/August '95 issue of The HP Palmtop Paper. This version had an archive size of 350K, extensive documentation (the first release had close to none), and about 80 source files.

PAL 1.6 just became available at the time of this writing -- it comes in a small (480K) and a large (1.4 MB) version, and will be made available on The HP Palmtop Paper's CD InfoBase (see page 18 for announcement) It is also available in the HP Palmtop Developer's Guide and in Library 15 of CompuServe's HP Hand Forum. The number of source files has doubled to over 160.

Many new modules and a lot of new functionality has been added in this version -- too much to list all the functions in detail. But I'll try to give you an overview of the improvements and additions.

Memory management

Replacement routines are provided for the standard memory allocation functions. The new versions are compatible with the standard functions, but can detect an out-of-memory condition, and take appropriate action. This can be used to save important files before closing down the application in the case of a severe out-of-memory condition. But it can also be used to free resources (large fonts or pictures that are not absolutely necessary) and retry an allocation request.

Expanded memory support

While the HP Palmtops do not have genuine EMS, an excellent emulator has been written that can convert C drive storage into expanded memory. This emulator is called EMM200 (ON DISK icon) and was written by Hiroyuki Sekiya. It is included in the PAL distribution by kind permission of the author. The PAL EMS module provides an interface to the EMS 4.0 standard. PAL programs can use these calls to store and retrieve additional data in a much faster way than using files. (The PAL routines will also work on the desktop provided an EMS emulator like EMM386 is present.)

Software Carousel API

Software Carousel by Sunshine Software has been acclaimed as The best task switcher for the HP Palmtops (see review, Vol.4, No.6, Pg. 35). It is the only one that is aware of HP Palmtop-specifics like the blue application keys or the need to switch to the System Manager work area when an alarm comes due. With the API, programmers can now control Software Carousel themselves, instruct it to switch to a given work area, launch or shut down programs, and even send keystrokes to applications running in another area.

Filer communication

PAL now includes routines that can talk to a remote Filer over the serial port. Programs running on the desktop can install themselves on the Palmtop this way, and programs running on the Palmtop can talk to the connectivity pack incarnation of FILER, for example, to actively backup their files or merge with files on the desktop. Currently, the routines work under DOS and Windows 3.x -- their author Harry Konstas is working on making them Windows 95 and Windows NT compatible. Andreas Garzotto already did this for the free operating system 'Linux'.

Applications Manager support

Another step towards easier installation is the Application Manager module. It provides functions to read, write and modify the APPMGR.DAT file -- applications can install themselves into Application Manager automatically, without the user needing to type in a name and DOS Path. Even icon installation and retrieval is supported.

Picklist support

While menus are great to select a single given option, what do you do when there is a need to select several options at once? The answer is picklists. The user can mark several entries in a menu, and all entries that have this 'checkmark' are returned to the program. There's even a FilePickList function that will let the user select among the files in a given directory matching a pattern provided by the programmer.

Modifiable CFG configuration files

The INI-style configuration files that were read-only in earlier versions of PAL can now be modified in memory and written back to file - even respecting comments in the file. Applications can now offer customization dialogs to users, and save the data back to the .CFG file.

Dialog improvements

Dialogs are now even closer to their System Manager counterparts. Edit items support copying and pasting to the System Manager clipboard, the buttons are more aesthetically pleasant (rounded and with a shadow), there is an overstrike and undo feature in edit items, radio button selection can now be moved with the mouse, and more. The long-awaited listbox control is now finally here as well. Programmers interested in the technical details of PAL dialogs should check out the March/April issue of "PDA Developers" where the PAL dialog topic is covered in depth in two articles.

Miscellaneous

A number of additions and improvements don't fit easily into a predetermined category. Functions are now available to read and set the battery type, start and stop charging, read the battery voltage and even detect if the AC adapter is plugged in. An easy device for displaying progress meters is provided. The dreaded 'Abort / Retry / Ignore' error message from DOS can be intercepted by an errorhandler routine. The name and location of the last file edited in Memo can be retrieved, and the MsgBox function now supports sophisticated function key handling and label display.

Future additions

Even as PAL 1.6 is being released, PAL development is continuing. Developing Database routines has a high priority, since they did not quite make it into version 1.6.

The next PAL version will have the long-awaited System Manager compatible file selection box -- now possible with the addition of listboxes to the dialog toolbox. A circle and ellipse drawing function (that does not need floating point) will be added to the graphics routines, along with a flood-fill routine and a utility function that can retrieve user data from SETUP .ENV.