palm 5.2 KB

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