Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Reading other kinds of data files ?

 [1/4] from: slok00::yahoo::com at: 20-Jul-2001 2:54


I understand that Rebol can read and save data files. But what if the data file is created/generated by other 3rd party applications. Eg. Is it possible to write a script in Rebol to read data files from the address book in Palm Desktop. An example of the Address.dat format in Palm Desktop http://www.geocities.com/Heartland/Acres/3216/address_dat.htm Can Rebol read from such files? or generally, do we write a program (C in this case) to read from the data file and pass the data to the Rebol script? YekSoon

 [2/4] from: cyphre:volny:cz at: 20-Jul-2001 12:36


Hi YekSoon, You don't have to write any C code etc. ;) Rebol is very strong tool for parsing so you should write a script which: -load the data file -parse the useful informations from the data structure using specific parsing rules -visualize the parsed results Check the rebol Core .pdf manual chapter Parsing for more information. If you have any questions regarding parsing send the to the list or just contact me directly. Best regards, Cyphre

 [3/4] 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 ] ]

 [4/4] from: ptretter:charter at: 20-Jul-2001 7:23


Cal, Can you provide some details on how you use a *.r file for cgi functions in your webserv.r? Paul Tretter