/[public]/psiconv/trunk/formats/psion/Basic_Structures.psi
ViewVC logotype

Diff of /psiconv/trunk/formats/psion/Basic_Structures.psi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 194 Revision 195
17mUs  17mUE
2d"Times New RomanN1 2d"Times New RomanN1
3< *Koptekst 2L 3< *Koptekst 2L
4< *Koptekst 3L *OpsomtekenOSwissh3r h3r efdefLd.AI&[Basic Structures]Basic Structures[Strings] [String]StringsA string is encoded as a SListB. This means it can be upto 3F characters long. Strings use ASCII Codes..[Offsets] [Offset]OffsetsAt many places, other locations in the file are referenced. These locations are given as Offsets: the number of bytes from the start of the file. Offsets are always encoded in Longs.[Lengths] [Length]LengthsLengths are encoded within longs. The unit is a twip, or 1/5A0 inch (1/1440 decimal). This means 237 (567 decimal) units correspond to 1 cm.[Sizes][Size]SizesFont sizes are expressed within longs. The unit is a 1/14 point (1/20 decimal). As a point equals 1/48 point (1/72 decimal), this is actually the same unit as used for Lengths.[Colors][Color]ColorsColors are encoded within three bytes. Each byte ranges from 00 (black) to FF (white). This is clearly intended to be a RGB encoding, but the Psion 5 only has a greytone display. All three bytes should be equal to express a greytone, and in practice, only values 00 00 00, 55 55 55, AA AA AA and FF FF FF are seen.Signed Integers[SInt][SInts][Signed Integer][Signed Integers]Signed integers are encoded in longs. The most significant bit is used as sign (0 for positive, 1 for negative). So +1 is encoded as 01 00 00 00, and -1 as 01 00 00 80.Floating Point Numbers[Float][Floats][Floating Point Numbers]Floating point numbers are encoded in 8 bytes. The most significant bit is used as sign (0 for positive, 1 for negative). The next B(11 decimal) bits are used as a two-complement exponent, and the remaining 34 (52 decimal) bits are used as the mantissa.The complete number can be found through this C formula (>> means shift right, ** means to the power of, Float is the 8 byte unsigned integer representation): (Float & 0x8000000000000000 ? -1 : 1) * (1 + (Float & 0x000FFFFFFFFFFFFF) / 0x0010000000000000) * (2 ** (((Float & 0x7FF0000000000000) >> 52) - 0x3FF)Some example representations:Number (decimal) Sign bit Exponent Mantissa Complete 1.0 0 3FF 0000000000000 00 00 00 00 00 00 F0 3F 2.0 0 400 0000000000000 00 00 00 00 00 00 00 40 3.0 0 400 8000000000000 00 00 00 00 00 00 08 40 3.5 0 400 C000000000000 00 00 00 00 00 00 0C 40-3.5 1 400 C000000000000 00 00 00 00 00 00 0C C0 0.5 0 3FE 0000000000000 00 00 00 00 00 00 E0 3F 0.0 0 000 0000000000000 00 00 00 00 00 00 00 00 4< *Koptekst 3L *OpsomtekenOSwissh3r h3r efdefLd.A%[Basic Structures]Basic Structures[Strings] [String]StringsA string is encoded as a SListB.. Strings use ASCII Codes..[Offsets] [Offset]OffsetsAt many places, other locations in the file are referenced. These locations are given as Offsets: the number of bytes from the start of the file. Offsets are always encoded in Longs.[Lengths] [Length]LengthsLengths are encoded within longs. The unit is a twip, or 1/5A0 inch (1/1440 decimal). This means 237 (567 decimal) units correspond to 1 cm.[Sizes][Size]SizesFont sizes are expressed within longs. The unit is a 1/14 point (1/20 decimal). As a point equals 1/48 twip (1/72 decimal), this is actually the same unit as used for Lengths.[Colors][Color]ColorsColors are encoded within three bytes. Each byte ranges from 00 (black) to FF (white). This is clearly intended to be a RGB encoding, but the Psion 5 only has a greytone display. All three bytes should be equal to express a greytone, and in practice, only values 00 00 00, 55 55 55, AA AA AA and FF FF FF are seen.Signed Integers[SInt][SInts][Signed Integer][Signed Integers]Signed integers are encoded in longs. The most significant bit is used as sign (0 for positive, 1 for negative). So +1 is encoded as 01 00 00 00, and -1 as 01 00 00 80.Floating Point Numbers[Float][Floats][Floating Point Numbers]Floating point numbers are encoded in 8 bytes. The most significant bit is used as sign (0 for positive, 1 for negative). The next B (11 decimal) bits are used as a two-complement exponent, and the remaining 34 (52 decimal) bits are used as the mantissa.The complete number can be found through this C formula (>> means shift right, ** means to the power of, Float is the 8 byte unsigned integer representation): (Float & 0x8000000000000000 ? -1 : 1) * (1 + (Float & 0x000FFFFFFFFFFFFF) / 0x0010000000000000) * (2 ** (((Float & 0x7FF0000000000000) >> 52) - 0x3FF)Some example representations:Number (decimal) Sign bit Exponent Mantissa Complete 1.0 0 3FF 0000000000000 00 00 00 00 00 00 F0 3F 2.0 0 400 0000000000000 00 00 00 00 00 00 00 40 3.0 0 400 8000000000000 00 00 00 00 00 00 08 40 3.5 0 400 C000000000000 00 00 00 00 00 00 0C 40-3.5 1 400 C000000000000 00 00 00 00 00 00 0C C0 0.5 0 3FE 0000000000000 00 00 00 00 00 00 E0 3F 0.0 0 000 0000000000000 00 00 00 00 00 00 00 00
5 "Times New Roman "Times New Roman " Courier New "Times New Roman " Courier New  "Times New Roman 5 "Times New Roman "Times New Roman " Courier New "Times New Roman " Courier New  "Times New Roman
6m();67  6@();67 
7 @"Arial "Times New Roman "Times New Roman "Times New Roman     "Times New Roman"Times New Roman "Times New Roman"Times New Roman    " Courier New " Courier New"Word.app C"y f 7 @"Arial "Times New Roman "Times New Roman "Times New Roman     "Times New Roman"Times New Roman "Times New Roman"Times New Roman    " Courier New " Courier New"Word.app C"yf 8

Legend:
Removed from v.194  
changed lines
  Added in v.195

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26