PalmGen

A GNU C Code Generation Tool for the Palm Pilot.

Copyright 2000
Joe Oguri

oguri_joe@bigfoot.com

http://www.geocities.com/projpunch

Version 2.0

Updated 10/11/00

 

Well, not as fully tested as I would have liked, but I wanted to get the program out when I promised. I already missed on several promise dates, so I'm releasing it in it's current state. It works, but it's not that pretty.

What is PalmGen?

PalmGen is a Java program that will take a Palm Resource file (PilRc format) and generate GNUC source code that will set up form handlers for all of the forms that are defined in the resource file, object handlers for the objects in each form, and menu handlers for each menu. The idea is to use a GUI resource editor (like Arbor Builder, or Falch.net's IDE resource compiler) to create all of your forms and objects in those forms, then use this tool to create the GNUC code for a working prototype, or skeletal framework.

Feature Summary:

  • Code Generation from a PilRC Resource File
  • Fast Prototyping
  • Hardware button can scroll through Forms
  • Makefile generation
  • PalmTools version 0.5.0, and 2.0 (Does anyone still use 0.5.0???)
  • Source file options.. all in one C file, in 4 files, or a file for each form.
  • Specify Alert for each form event (when anything gets tapped).

Version 2.0 Update Summary:

  • GUI interface
  • PalmTools 2.0 support
  • Hardware Form Scrolling

Still NOT WORKING:

  • All Menu bar picks, except Exit.

Legal Stuff:

USE THIS PROGRAM AT YOUR OWN RISK!

Not responsible for any damage, loss of money, loss of hair, or loss of data this program may cause. Taken as is, No warrenty. This program can be used and distributed free for any non-commercial use.

DownLoad:

Version 2.0: You can get it at palmgear, or download it from here.

PGHQgetit.jpg (9478 bytes)

NOTE: I've been having bad luck with downloads...Many people have had problems downloading it from this palmgear.. so here are some alternatives. If all else fails, email me oguri_joe@bigfoot.com, and I'll send it back to you.

Version 2.0:

AngelFire: PalmGen20.zip (http://www.angelfire.com/ma/ojoe/PalmGen20.zip),

GeoCities: PalmGen20.zip (http://www.geocities.com/projpunch/PalmGen20.zip)

iDrive: https://www.idrive.com/projectpunch/files/ProjectPunch/, then select PalmGen20.zip checkbox, and click on the yellow Download button. Last time I checked (Oct/10/2000), this was not working.. a notice appeared that they were upgrading the site, and that the guest accounts they have place "Temporary restrictions on guest accounts"... but I have hope that once that is done, idrive will work better than the links above.


Program Description:


PalmGen is a Java program that will take a Palm Resource file (PilRc format) and generate GNUC source code that will set up form handlers for all of the forms that are defined in the resource file, object handlers for the objects in each form, and menu handlers for each menu. The idea is to use a GUI resource editor (like Arbor Builder, or Falch.net's IDE resource compiler) to create all of your forms and objects in those forms, then use this tool to create the GNUC code for a working prototype, or skeletal framework.


Limitations:

  • This documentation stinks.

Instructions:

Installation

You will need Version 2 of the  Java Runtime Environment installed on your system.

  • Unzip the PalmGen20.zip file. It should contain PalmGen.jar, and PalmGen.bat.
  • For the PC, run the PalmGen.bat file. For any other OS, type in the commands that are in the PalmGen.bat file. NOTE: Where ever you run PalmGen, it will look for CodeTemplate.tpl. If it can't find that file, PalmGen will not run.
  • You may want to add this installation directory to your PATH.

Getting Started

  • Before running PalmGen, make sure you have the following files in your working directory:
    • CodeTemplate.tpl
    • Callbacks.h
    • Any header file used by your resource file.
    • Any bitmaps used by your resource file.
  • Go to your working directory (where you want to generate the source files)
  • Run PalmGen.
  • You will see the following screen:

PalmGen.gif (6947 bytes)

  • Select the PRC file with the Browes button.
  • Select options: PrcTools Version, Source Files, ProtoAlert, Hardware Button Scrool Forms.
    • PrcTools Version: Which one are you compiling with?
    • Source Files:
      • OneFile: Puts all code into one file by the name of {resource_file}.c
      • FourFiles: Creates 4 files:
        1. {resource_file}.c: All basic functions
        2. Decls.h: Function Declarations
        3. FormEH.c All Form and Form Object Handlers
        4. MenuMH.c Menu Handlers
      • MultiFile: Same as -4, but instead of FormEH.c, it will create a file for every form defined in the resource file. These files will be named {FormName}.c, and will contain the form handler, and all Form Object handlers for that form.
    • ProtoAlerts: This will set up all of the form object handlers to generate an alert. To make this work, the resource file must define an alert resourse and select it in the next window. It needs to accept one parameter (will be the object name). For example, the resource file could include the following alert:
      	ALERT ID ProtoAlert
      	INFORMATION
      	BEGIN
      	  TITLE "Testing"
      	  MESSAGE "You Selected:\n^1"
      	  BUTTONS "OK"
      	END
    • Hardware Button Scroll Form: Will add code to make the hardware scroll button change the form view. They will scroll through all of the forms defined in the resource file.
  • Press the "Create Code" button. The source files should appear in your working directory.
  • Press the "Done" button.
  • You should be able to go to a command line prompt, and run the make file. If you have the PalmTools installed correctly, and have the path to the compilers and linkers set up, it should build a prc file that you can install in the emulator, or on your palm.
  • Note that the menu bar selections do nothing (version 2.0).

Usage Tips

  • If you are bold, you can control the way the code is generated by editing the CodeTemplate.tpl file. It's not something I would recommend, but it is possible. PalmGen takes snippets of code in CodeTemplate.tpl to create the code that works. It's not TOO complex, but if you know exactly what you want to change, you could probally find the code snippet you want, and change it in this file. If you do, and your code doesn't compile or run, YOU'RE ON YOUR OWN!!! I will try to document the format of the file later on. In short... the file is composed of sections marked by "<Section:sectionName>" markers. These sections contain code sections. They can also contain <Option:optionName> markers for text that may or may not be included. PalmGen uses these code sections to construct the program.

Future Plans

Breif History: First there was Version 1, a DOS version. This was written in C++, and was a big hack. I totally rewrote it in Java (to learn Java, and to give it a GUI for multiple platforms). The source code shows definite signs that I was learning Java as I wrote it, but it works, and should be fairly maintainable. I did learn Java, and helped to get me hired at my current job!

Future plans ??  I dunno. Any suggestions?

Please send any comments, suggestions, or bug reports to: oguri_joe@bigfoot.com