[REBOL] Re: Object "Serialization" (script repost)
From: gjones05:mail:orion at: 22-Feb-2001 18:49
From: Renaud
> REBOL [
> Title: "Nom du script"
> File: %binutils.r
> Date: 22-Feb-2001
> Author: "Renaud GOMBERT"
> Purpose: "Save and retrieve any word/value pair as binary"
> To-do: {
> Make a refinement to do compressions only if needed
> Allow processing of multiple word/value pairs at one time
> }
> Release: 0.0.1
> Category: []
> ]
>
> put-bin: func [ "Save word/value pair as compressed binary"
> 'data [any-type!] "word to process"
> filename [file!] "file to write to"
> /local temp
> ][
> temp: make object! [
> value: get data
> name: data
> ]
> write/binary filename compress to-binary mold temp
> ]
>
> get-bin: func [ "Load word/value pair from a compressed binary"
> filename [file!] "file to get word/value from"
> /local temp
> ][
> temp: do decompress read/binary filename
> set temp/name temp/value
> ]
Thanks, Renaud. The compression seems to start paying dividends at
original file length of mid 100's. You have reminded me that REBOL has
the built-in compression. I guess that at least on Windows, numerous
objects would be best saved in a single, easily parsable file inorder to
avoid the unused sector space. I guess it is time to check-out Gabriele
Santilli's database in this regard, or I could just reinvent the wheel.
Now let's see (2 * pi * r) = .... :)
--Scott