diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2006-05-24 09:13:31 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2006-05-24 09:13:31 +0000 |
commit | 40a1b46245c1a8786324f5a06d6cb8d4bd9d5b74 (patch) | |
tree | f45020695e190f511f4faf4dd3ed144059f298c0 /lisp/emacs-lisp/bindat.el | |
parent | dbe9f5ba9648890dc34f4836a49fde766b21ce74 (diff) | |
parent | 4ea5193b9cc5c577127ca6c89ecfaad819398d3b (diff) | |
download | emacs-40a1b46245c1a8786324f5a06d6cb8d4bd9d5b74.tar.gz |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-289
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-290
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-291
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-292
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-293
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-567
Diffstat (limited to 'lisp/emacs-lisp/bindat.el')
-rw-r--r-- | lisp/emacs-lisp/bindat.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index 455b049dc8a..823fcf869b6 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -171,8 +171,8 @@ ;; | INTEGER_CONSTANT ;; | DEREF -;; DEREF ::= ( [NAME | INTEGER]... ) -- Field NAME or Array index relative to -;; current structure spec. +;; DEREF ::= ( [NAME | INTEGER]... ) -- Field NAME or Array index relative +;; to current structure spec. ;; -- see bindat-get-field ;; A `union' specification @@ -415,7 +415,9 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." ((eq type 'repeat) (let ((index 0)) (while (< index len) - (bindat--length-group (nth index (bindat-get-field struct field)) (nthcdr tail item)) + (bindat--length-group + (nth index (bindat-get-field struct field)) + (nthcdr tail item)) (setq index (1+ index))))) ((eq type 'union) (let ((tag len) (cases (nthcdr tail item)) case cc) @@ -436,7 +438,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (setq pos (+ pos len)))))))) (defun bindat-length (spec struct) - "Calculate raw-data length for STRUCT according to bindat specification SPEC." + "Calculate raw-data length for STRUCT according to bindat SPEC." (let ((pos 0)) (bindat--length-group struct spec) pos)) @@ -557,7 +559,9 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." ((eq type 'repeat) (let ((index 0)) (while (< index len) - (bindat--pack-group (nth index (bindat-get-field struct field)) (nthcdr tail item)) + (bindat--pack-group + (nth index (bindat-get-field struct field)) + (nthcdr tail item)) (setq index (1+ index))))) ((eq type 'union) (let ((tag len) (cases (nthcdr tail item)) case cc) @@ -577,13 +581,14 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (defun bindat-pack (spec struct &optional raw-data pos) "Return binary data packed according to SPEC for structured data STRUCT. -Optional third arg RAW-DATA is a pre-allocated string or vector to unpack into. +Optional third arg RAW-DATA is a pre-allocated string or vector to pack into. Optional fourth arg POS is the starting offset into RAW-DATA. Note: The result is a multibyte string; use `string-make-unibyte' on it to make it unibyte if necessary." (let ((no-return raw-data)) (unless pos (setq pos 0)) - (unless raw-data (setq raw-data (make-vector (+ pos (bindat-length spec struct)) 0))) + (unless raw-data + (setq raw-data (make-vector (+ pos (bindat-length spec struct)) 0))) (bindat--pack-group struct spec) (if no-return nil (concat raw-data)))) |