[REBOL] Re: Reading other kinds of data files ?
From: deadzaphod:flyingparty at: 20-Jul-2001 4:23
Well, I've never worked with the address book specifically, but here's a
function to display the raw contents of any palm .PDB file that I used to
use when debugging palm apps (I also have some functions for creating .PDB
files, if you're intrested in those let me know)
- Cal Dixon
print-pdb: func [ filename ] [
pdb: read/binary filename
print [ "Name: " to-string copy/part pdb 32 ]
print mold copy/part pdb 32
pdb: skip pdb 32
print [ "Attributes: " mold copy/part pdb 2 ]
pdb: skip pdb 2
print [ "Version: " to-integer copy/part pdb 2 ]
pdb: skip pdb 2
print [ "Creation Date: " to-integer copy/part pdb 4 ]
pdb: skip pdb 4
print [ "Modification Date: " to-integer copy/part pdb 4 ]
pdb: skip pdb 4
print [ "Backup Date: " to-integer copy/part pdb 4 ]
pdb: skip pdb 4
print [ "Modification Number: " to-integer copy/part pdb 4 ]
pdb: skip pdb 4
print [ "AppInfo ID: " to-integer copy/part pdb 4 ]
pdb: skip pdb 4
print [ "SortInfo ID: " to-integer copy/part pdb 4 ]
pdb: skip pdb 4
print [ "Type: " mold to-string copy/part pdb 4 to-integer copy/part pdb
4
mold copy/part pdb 4]
pdb: skip pdb 4
print [ "Creator: " mold to-string copy/part pdb 4 to-integer copy/part
pdb 4
mold copy/part pdb 4]
pdb: skip pdb 4
print [ "UniqueID Seed: " to-integer copy/part pdb 4 ]
pdb: skip pdb 4
print [ "Next Record List ID: " to-integer copy/part pdb 4 ]
pdb: skip pdb 4
print [ "Number of Records: " n: to-integer copy/part pdb 2 ]
pdb: skip pdb 2
if n = 0 [ pdb: skip pdb 2 ]
for x 1 n 1 [
print [ " Record:" x "of" n ]
print [ " LocalID: " to-integer copy/part pdb 4 ]
pdb: skip pdb 4
print [ " Attributes: " mold copy/part pdb 1 ]
pdb: skip pdb 1
print [ " UniqueID: " mold copy/part pdb 3 to-integer copy/part pdb
3 ]
pdb: skip pdb 3
]
pdb: skip pdb 2
print [ "Current Offset (i.e. LocalID): " -1 + index? pdb ]
print [ "Data: " mold pdb ]
]