help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: print hash table to disk and reread in hash table


From: Ted Zlatanov
Subject: Re: print hash table to disk and reread in hash table
Date: Fri, 29 Aug 2008 09:06:02 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

On Thu, 28 Aug 2008 21:10:56 +0300 Eli Zaretskii <eliz@gnu.org> wrote: 

>> From: Ted Zlatanov <tzz@lifelogs.com>
>> Date: Thu, 28 Aug 2008 09:03:53 -0500
>> 
>> If there's no library for serialization, it should definitely be
>> written.

EZ> You mean, like bindat.el?

That looks useful for binary data.  I don't see from the code how to use
it to save and load a hashtable.  The spec format supports these types:

;; TYPE    ::= ( eval EXPR )            -- interpret result as TYPE
;;          |  u8   | byte              -- length 1
;;          |  u16  | word | short      -- length 2, network byte order
;;          |  u24                      -- 3-byte value
;;          |  u32  | dword | long      -- length 4, network byte order
;;          |  u16r | u24r | u32r       -- little endian byte order.
;;          |  str LEN                  -- LEN byte string
;;          |  strz LEN                 -- LEN byte (zero-terminated) string
;;          |  vec LEN [TYPE]           -- vector of LEN items of TYPE 
(default: u8)
;;          |  ip                       -- 4 byte vector
;;          |  bits LEN                 -- List with bits set in LEN bytes.

Is there some magic with `eval'?  I didn't get it.

In addition, this library doesn't manage file I/O.  I'd expect the
library do do content coding and error handling internally.  This is,
actually, the most tedious part.  Transforming a hashtable to a list and
back is easy (even I can write it :)

Ted


reply via email to

[Prev in Thread] Current Thread [Next in Thread]