2 #------------------------------------------------------------------------------
3 # $File: palm,v 1.13 2014/03/30 21:40:08 christos Exp $
4 # palm: file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks
6 # Brian Lalor <blalor@hcirisc.cs.binghamton.edu>
8 # These are weak, byte 59 is not guaranteed to be 0 and there are
9 # 8 character identifiers at byte 60, one I found for appl is BIGb.
10 # What are the possibilities and where is this documented?
12 # The common header format for PalmOS .pdb/.prc files is
18 # DWord modificationDate;
19 # DWord lastBackupDate;
20 # DWord modificationNumber;
26 # RecordListType recordList;
29 # Datestamps are unsigned seconds since the MacOS epoch (Jan 1, 1904),
30 # or Unix/POSIX time + 2082844800.
33 # date is supposed to be big-endian seconds since 1 Jan 1904, but many
34 # files contain the timestamp in little-endian or a completely
35 # nonsensical value...
36 #>36 bedate-2082844800 >0 \b, created %s
37 # compression: 1=uncomp, 2=orig, 0x4448=HuffDic
38 >(78.L) beshort =1 \b, uncompressed
41 >>(78.L+4) belong x \b, %d bytes uncompressed
44 #60 string appl PalmOS application
48 #60 string HACK HackMaster hack
52 60 string SDocSilX iSiloX E-book
55 # Mobipocket (www.mobipocket.com), donated by Carl Witty
56 # expanded by Ralf Brown
57 60 string BOOKMOBI Mobipocket E-book
58 # MobiPocket stores a full title, pointed at by the belong at offset
59 # 0x54 in its header at (78.L), with length given by the belong at
61 # there's no guarantee that the title string is null-terminated, but
62 # we currently can't specify a variable-length string where the length
63 # field is not at the start of the string; in practice, the data
64 # following the string always seems to start with a zero byte
66 >>&(&0x50.L-4) string >\0 "%s"
68 >>(78.L+0x68) belong >0 \b, version %d
69 >>(78.L+0x1C) belong !0 \b, codepage %d
70 >>(78.L+0x0C) beshort >0 \b, encrypted (type %d)
73 60 string TEXtREAd AportisDoc/PalmDOC E-book
77 # Variety of PalmOS document types
78 # Michael-John Turner <mj@debian.org>
79 # Thanks to Hasan Umit Ezerce <humit@tr-net.net.tr> for his DocType
80 60 string BVokBDIC BDicty PalmOS document
82 60 string DB99DBOS DB PalmOS document
84 60 string vIMGView FireViewer/ImageViewer PalmOS document
86 60 string PmDBPmDB HanDBase PalmOS document
88 60 string InfoINDB InfoView PalmOS document
90 60 string ToGoToGo iSilo PalmOS document
92 60 string JfDbJBas JFile PalmOS document
94 60 string JfDbJFil JFile Pro PalmOS document
96 60 string DATALSdb List PalmOS document
98 60 string Mdb1Mdb1 MobileDB PalmOS document
100 60 string PNRdPPrs PeanutPress PalmOS document
102 60 string DataPlkr Plucker PalmOS document
104 60 string DataSprd QuickSheet PalmOS document
106 60 string SM01SMem SuperMemo PalmOS document
108 60 string TEXtTlDc TealDoc PalmOS document
110 60 string InfoTlIf TealInfo PalmOS document
112 60 string DataTlMl TealMeal PalmOS document
114 60 string DataTlPt TealPaint PalmOS document
116 60 string dataTDBP ThinkDB PalmOS document
118 60 string TdatTide Tides PalmOS document
120 60 string ToRaTRPW TomeRaider PalmOS document
123 # A GutenPalm zTXT etext for use on Palm Pilots (http://gutenpalm.sf.net)
124 # For version 1.xx zTXTs, outputs version and numbers of bookmarks and
126 # For other versions, just outputs version.
128 60 string zTXT A GutenPalm zTXT e-book
131 >>(0x4E.L+1) byte x (v0.%02d)
133 >>(0x4E.L+1) byte x (v1.%02d)
134 >>>(0x4E.L+10) beshort >0
135 >>>>(0x4E.L+10) beshort <2 - 1 bookmark
136 >>>>(0x4E.L+10) beshort >1 - %d bookmarks
137 >>>(0x4E.L+14) beshort >0
138 >>>>(0x4E.L+14) beshort <2 - 1 annotation
139 >>>>(0x4E.L+14) beshort >1 - %d annotations
140 >(0x4E.L) byte >1 (v%d.
141 >>(0x4E.L+1) byte x %02d)
143 # Palm OS .prc file types
145 # flags, only bit 0 or bit 6
146 # http://en.wikipedia.org/wiki/PRC_%28Palm_OS%29
147 # http://web.mit.edu/tytso/www/pilot/prc-format.html
148 >0x20 beshort&0xffbe 0
149 >>0 string >\0 Palm OS dynamic library data "%s"
150 60 string ptch Palm OS operating system patch data
153 # Mobipocket (www.mobipocket.com), donated by Carl Witty
154 60 string BOOKMOBI Mobipocket E-book