by September 10, 2000 0 comments

Although the market has its share of Personal DigitalAssistants (PDAs) from different vendors, it’s the Palm computing platformthat has emerged as the leader in this arena, beating stalwarts like WindowsCE-based Handheld PC and Apple’s Newton. The Palm is much, much more than adigital diary. You can do a lot of things with your Palm: manage contacts, planyour day, manage projects, access the Web and e-mail, read e-books, play games,track your finances, and more.

In this series of articles, however, I’ll delve deeper totake a look into what goes on within a Palm program and how to write a fewsimple programs that work on a Palm’s operating system, called the PalmOS (inthis article, Palm and PalmOS are often used interchangeably).

In this article, we’ll take a look at Palm file formats–thePRC and PDB–and the way they store and execute information and instructions ona Palm.

One of the first things that impressed me when I bought myPalm was the size of its programs–both installed and available on the Web.These are extremely small and light, compared to the monstrosities we see onWindows and Linux. This is logical, as handhelds have limited memory. Forcomparison sake, my Palm has just 2 MB of memory as compared to my home computerwith 128 MB. Most Palm programs are thus in the range of 2 kB to 100 kB.

When installing a new Palm program, you need to install filesthat end with PRC or PDB. However, these file extensions exist only on thedesktop computer, and not on the Palm. There’s also a new file extension, PQA,which denotes Web- Clips, a new feature with the Palm VII series. However, I won’tcover this file format here. This is because I’ve never developed a WebClipmyself, and I don’t have access to Palm VII. So, testing this out will bedifficult.

PRC files are what are known as “resourcedatabases”–actual programs that run on the Palm. PRCs are similar to EXEson your PC. PDB files are called “record databases” and storeinformation only. These are comparable to, say, Access MDB or FoxPro DBF fileson your desktop. Both these formats are very similar to each other, with few butvery important differences. Let’s take a detailed look at these.

PRC: The resource database

You might wonder why the equivalent of an executable is beingcalled a database. This is because to preserve memory without increasingprocessing overhead (remember that Palm CPUs have a fraction of the power ofdesktop CPUs), the processing instructions are stored along with some otherrequired information in a predefined format. Due to this, the processor doesn’tneed to read the entire program to know what to execute when. All it needs to dois take a look at the appropriate “record” and execute instructions itfinds there.

Different records in the PRC contain different kinds ofinformation. For instance, a header record contains application-specificinformation, which includes:

  • The name of the application

  • The version

  • Application-specific attribute flags, like whether the application and associated data are to be backed up in the next HotSync

  • The date of creation, modification, and last backup

  • The type of PRC: This is usually set to the string “appl” for application

  • The CreatorID

  • A resource list

The last two elements require further explanation. On thePalm, installed programs are not differentiated by the names that you see on thescreen. These are there only for descriptive purposes. Just as Windows doesn’trecognize the name Internet Explorer, but uses IEXPLORE.EXE instead, on thePalm, programs are differentiated by their creatorID. Every Palm program createdis required to have a unique creatorID. For developers, this can be achieved bygoing to the Palm Developer’s Zone at and applying for afour-character creatorID that they wish to use. For example, if you create aprogram and want to use a creatorID called “vu01”, you need to firstsearch for it at the Devzone. If it isn’t in use already, you can register itby simply giving the name of the program you wish to use it for and your e-mailaddress. This step is very important for the development of any Palm program.This is because if you try to install two programs with the same creatorID on aPalm, at the very least, the program installed last will overwrite the earlierprogram and its data. At the worst, you might have to reset your Palm and do afull restore.

The other element–the resource list–is a variable-lengthlist of “resource records”. Let me explain this a bit further. EveryPalm program is made up of resources like text fields, list boxes, scrollbars,labels, forms, pop-ups, buttons, alert boxes, etc. A Windows programmer willrefer to these resources as components. The resource list specifies whichresources are being used in the application, along with additional attributeslike the individual resource’s position, associated text, and value and nameof the resource in the application. This will become clearer later in thisseries, when we take a look at how to create an application with multipleresources. The actual resources are present as individual records immediatelyafter the complete header.

If you’re wondering where in the world program instructionsare stored, well, instructions are nothing but another resource.

PDB: The record database

The PDB structure is very similar to that of the PRC. Thedifference lies in the fact that the header contains a slightly different set ofinformation. Although it contains everything that the PRC contains, it replacesthe resource list with a record list and resources with actual data records.

The PDB file also contains two new elements, called theAppInfo block and the SortInfo block. These are pretty advanced topics that we’lltalk about in a later article. For now, let’s say that the AppInfo blockstores application-specific information, like the category list you see on manyprograms. The SortInfo block lets you store database-specific information, likethe field to sort data on, the relation between databases, etc.

Programming for Palm applications is done using the PalmOSSDK, currently in version 3.5. The SDK, however, is only the API (ApplicationProgramming Interface) and requires you to program in C. There are two popularways of creating a Palm application–using Palm’s recommended IDE calledCodeWarrior for the Palm, which is good for commercial developers as it’spretty expensive, or using the free GNU C++.

That said, here’s what you can look for in the comingmonths–a step-by-step setup of the GCC environment for Palm programming onWindows (with some pointers for Linux), setting up the development environmentcorrectly, setting up POSE (the Palm OS Emulator), writing your first Palmapplication (the ubiquitous "Hello, World" example), and a much moredetailed application after that. Stay tuned next month for our journey into thedepths of the world of Palm programming.

Vinod Unny
is a technology consultant at iSquare Technologies

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.