To get this Program simple Hello World program ...
having the following icon on the PalmPilot ...
... just copy the following files in one directory and use make! (GCC for Pilot required!)
Resorce File
C Source Code
Header File
Makefile
Pilot Icon
// hello.rcp: A simple Hello World Program // // Albrecht Schmidt // TecO, www.teco.edu/~albrecht/ // #include "hello.h" FORM ID HelloStart AT (2 2 156 156) USABLE MODAL BEGIN TITLE "Albrecht' Hello World" LABEL "This is a Start!" ID 2000 AT (CENTER 20) FONT 2 BUTTON "Quit" ID OkButton AT (CENTER 140 AUTO AUTO) END ICON "helloic.bmp" VERSION 1 "0.0.1"
/* hello.c: A simple Hello World Program
*
* Albrecht Schmidt
* TecO, www.teco.edu/~albrecht/
*/
#pragma pack(2)
#include "hello.h"
#include <Common.h>
#include <System/SysAll.h>
#include <UI/UIAll.h>
DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags)
{
short err;
EventType e;
FormType *pfrm;
if (!cmd)
{
FrmGotoForm(HelloStart);
while(1)
{
EvtGetEvent(&e, 100);
if (SysHandleEvent(&e))
continue;
if (MenuHandleEvent((void *)0, &e, &err))
continue;
switch (e.eType)
{
case ctlSelectEvent:
// to extent the example put in your events and function call here
if (e.data.ctlSelect.controlID == OkButton)
{
return 0;
}
break;
case frmLoadEvent:
FrmSetActiveForm(FrmInitForm(e.data.frmLoad.formID));
break;
case frmOpenEvent:
pfrm = FrmGetActiveForm();
FrmDrawForm(pfrm);
break;
case appStopEvent:
return 0;
default:
FrmHandleEvent(FrmGetActiveForm(), &e);
}
}
}
return 0;
}
/* hello.h: A simple Hello World Program * * Albrecht Schmidt * TecO, www.teco.edu/~albrecht/ */ #define HelloStart 1000 #define OkButton 9999
# Makefile: A simple Hello World Program # * # * Albrecht Schmidt # * TecO, www.teco.edu/~albrecht/ # */ OBJS = hello.o CC = m68k-palmos-coff-gcc #uncomment this if you want to build a gdb debuggable version DEFINES = -DDEBUG INCLUDES = CSFLAGS = -O2 -S $(DEFINES) $(INCLUDES) CFLAGS = -O2 -g $(DEFINES) $(INCLUDES) PILRC = pilrc TXT2BITM = txt2bitm OBJRES = m68k-palmos-coff-obj-res BUILDPRC = build-prc ICONTEXT = "Hello World" APPID = asHello PRC = hello.prc all: $(PRC) .S.o: $(CC) $(TARGETFLAGS) -c $< .c.s: $(CC) $(CSFLAGS) $< $(PRC): code.stamp bin.stamp $(BUILDPRC) $@ $(ICONTEXT) $(APPID) *.grc *.bin code.stamp: hello $(OBJRES) hello touch code.stamp bin.stamp: hello.rcp $(PILRC) hello.rcp touch bin.stamp hello: $(OBJS) $(CC) $(CFLAGS) $(OBJS) -o $@ clean: rm -rf *.[oa] hello *.bin *.stamp *.grc hello.prc