all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Read binary and pack/unpack functions ?
@ 2006-11-21 22:46 Xavier Maillard
  2006-11-21 23:55 ` Kevin Rodgers
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Xavier Maillard @ 2006-11-21 22:46 UTC (permalink / raw)


Hi,

Iam trying to write a mode to read/write the Palm MemoDB file
based on the described format.

The MemoDB is well documented and thus, it is not that difficult
to build a parser against it.

Where iactually fail is at reading binary data from the file and
packing binary data into a more "neutral" format based on sexp.

Do you know any pack/unpack-like functions for GNU Emacs ?

Regards
-- 
Xavier

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Read binary and pack/unpack functions ?
  2006-11-21 22:46 Read binary and pack/unpack functions ? Xavier Maillard
@ 2006-11-21 23:55 ` Kevin Rodgers
       [not found] ` <mailman.965.1164153409.2155.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2006-11-21 23:55 UTC (permalink / raw)


Xavier Maillard wrote:
> Iam trying to write a mode to read/write the Palm MemoDB file
> based on the described format.
> 
> The MemoDB is well documented and thus, it is not that difficult
> to build a parser against it.
> 
> Where iactually fail is at reading binary data from the file and
> packing binary data into a more "neutral" format based on sexp.
> 
> Do you know any pack/unpack-like functions for GNU Emacs ?

Are you familiar with Emacs coding systems?

-- 
Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Read binary and pack/unpack functions ?
       [not found] ` <mailman.965.1164153409.2155.help-gnu-emacs@gnu.org>
@ 2006-11-22  5:33   ` maillaxa
  0 siblings, 0 replies; 5+ messages in thread
From: maillaxa @ 2006-11-22  5:33 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 1254 bytes --]


Kevin Rodgers a écrit :

> Xavier Maillard wrote:
> > Where iactually fail is at reading binary data from the file and
> > packing binary data into a more "neutral" format based on sexp.
> >
> > Do you know any pack/unpack-like functions for GNU Emacs ?
>
> Are you familiar with Emacs coding systems?

Yes I do and the problem is not with reading binary data but with
"mapping" bytes into something that reflect the binary file format
(header, data, ...).

In perl you have two valuable functions called pack and unpack that
takes a string and expands it out into a list of values. This is what I
am looking for in emacs lisp.

So is there anything similar ?

Regards,

Xavier

P.S: here is what I am ending up for reading (temporary and subject to
change. It basically load a file and try to read the first 72 bytes
from there (corresponding to the file header)

  (defun load-memodb (file-name)
   (save-excursion
     (set-buffer (create-file-buffer file-name))
     (erase-buffer)
     (if (fboundp 'set-buffer-multibyte)
	 (set-buffer-multibyte t))

     (let ((coding-system-for-read 'binary))
       (insert-file-contents file-name))
     (goto-char (point-min))
     (setq header (memo-read-bytes 72))))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Read binary and pack/unpack functions ?
  2006-11-21 22:46 Read binary and pack/unpack functions ? Xavier Maillard
  2006-11-21 23:55 ` Kevin Rodgers
       [not found] ` <mailman.965.1164153409.2155.help-gnu-emacs@gnu.org>
@ 2006-11-22  6:50 ` Magnus Henoch
       [not found] ` <mailman.974.1164178530.2155.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 5+ messages in thread
From: Magnus Henoch @ 2006-11-22  6:50 UTC (permalink / raw)


Xavier Maillard <zedek@gnu.org> writes:

> Do you know any pack/unpack-like functions for GNU Emacs ?

See bindat.el.

Magnus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Read binary and pack/unpack functions ?
       [not found] ` <mailman.974.1164178530.2155.help-gnu-emacs@gnu.org>
@ 2006-11-22 13:20   ` Johan Bockgård
  0 siblings, 0 replies; 5+ messages in thread
From: Johan Bockgård @ 2006-11-22 13:20 UTC (permalink / raw)


Magnus Henoch <mange@freemail.hu> writes:

> Xavier Maillard <zedek@gnu.org> writes:
>
>> Do you know any pack/unpack-like functions for GNU Emacs ?
>
> See bindat.el.

And the corresponding section in the manual, (info "(elisp)Byte Packing")

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-11-22 13:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-21 22:46 Read binary and pack/unpack functions ? Xavier Maillard
2006-11-21 23:55 ` Kevin Rodgers
     [not found] ` <mailman.965.1164153409.2155.help-gnu-emacs@gnu.org>
2006-11-22  5:33   ` maillaxa
2006-11-22  6:50 ` Magnus Henoch
     [not found] ` <mailman.974.1164178530.2155.help-gnu-emacs@gnu.org>
2006-11-22 13:20   ` Johan Bockgård

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.