Programming for Palm OS/PilRC
PilRC (the PILot Resource Compiler) takes human-readable definitions of User Interface features (example) and turns them into a machine-readable form suitable for feeding to tools such as build-prc.
installation
[edit | edit source]installing PilRC on Debian
[edit | edit source]sudo apt-get install pilrc
usage
[edit | edit source]PilRC reads a .rcp file and produces one or more .bin files. To find out what can be put into a .rcp file:
mozilla file:///usr/share/doc/pilrc/html/manual.html#language
Then invoke PilRC like this:
pilrc -q YourProject.rcp
..and it will produce files named things like:
NFNT03e8.bin MBAR03e8.bin tFRM03e8.bin
..which are fed to build-prc like this:
build-prc $(PROJECT).prc "$(PROJECT)" $(CREATOR_ID) *.$(PROJECT).grc *.bin
examples
[edit | edit source]fonts
[edit | edit source]In YourProject.h (so that resource IDs can be kept in sync between the source code and YourProject.rcp):
#define TinyFont 1000
..then in YourProject.rcp:
#include "YourProject.h" FONT ID TinyFont FONTID 128 "6pt-sans-font.txt"
128 is fntAppCustomBase and should be in the range 128-255. 6pt-sans-font.txt refers to a file that describes the font. This file looks like this:
ascent 5 descent 1 glyph 32 --- --- --- --- --- --- glyph 33 -#- -#- -#- --- -#- --- glyph -1 ---- ###- #-#- #-#- ###- ----
..although your fonts should define more than only two glyphs.
The following Ruby can be used to create a blank font file suitable for consumption by PilRC:
#!/usr/bin/env ruby # ROWS = 7 COLUMNS = 6 puts 'ascent %i' % (ROWS - 1) puts 'descent 1' (32..127).each do |index| puts 'glyph %i' % index ROWS.times do puts '-' * COLUMNS end end