From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.help Subject: Re: print hash table to disk and reread in hash table Date: Fri, 29 Aug 2008 09:06:02 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <868wuflxv9.fsf@lifelogs.com> References: <34f9604c-a23b-4ad9-9c84-f45884a6df23@x16g2000prn.googlegroups.com> <86od3dfd86.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1220020943 17064 80.91.229.12 (29 Aug 2008 14:42:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Aug 2008 14:42:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 29 16:43:17 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KZ5Bn-00050N-TG for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Aug 2008 16:43:04 +0200 Original-Received: from localhost ([127.0.0.1]:45889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZ5Ap-0003AS-Fy for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Aug 2008 10:42:03 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!newsfeed.straub-nv.de!news.albasani.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Original-X-Trace: news.albasani.net BFOVjVn0Os+nuPz6skx3Ws7mb73mF8u4JC+L9NwT5teHaudhulR1nYe/xgEDyRnS2GYheQw394dsxOp9UFFGjRpUmnb6rVmo+LVjdSNw13Bbri4PH7w7B4HBKr/TKccn Original-X-Complaints-To: abuse@albasani.net Original-NNTP-Posting-Date: Fri, 29 Aug 2008 14:06:02 +0000 (UTC) X-User-ID: 4Si+zU0ejhZCy47ePoQ/WHhz3/u8EeQnl+wkBb9soUo= X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Cancel-Lock: sha1:CuioezK+0QKG+qPhCc5NgZpjUDw= sha1:9sTKvT2IMY8M5Dg29pVQLEo5uO4= User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) X-NNTP-Posting-Host: CnFwo4fSqDBlQO3H+YBm2XBGQIfS+FL6NjY9M34mrXQ= Original-Xref: news.stanford.edu gnu.emacs.help:161755 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:57093 Archived-At: On Thu, 28 Aug 2008 21:10:56 +0300 Eli Zaretskii wrote: >> From: Ted Zlatanov >> 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