aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThien-Thi Nguyen2006-05-23 08:04:25 +0000
committerThien-Thi Nguyen2006-05-23 08:04:25 +0000
commitb12d1537e7b0dcc07bdfc7ca3a63f4e3b14595dd (patch)
tree8b737fb8c71dc503584e5354c57222159b05e0d2
parentf569c26e7918554700a02146bd92a1ee8384ee4a (diff)
downloademacs-b12d1537e7b0dcc07bdfc7ca3a63f4e3b14595dd.tar.gz
emacs-b12d1537e7b0dcc07bdfc7ca3a63f4e3b14595dd.zip
Refill; nfc.
-rw-r--r--lisp/emacs-lisp/bindat.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el
index 455b049dc8a..c6989883a10 100644
--- a/lisp/emacs-lisp/bindat.el
+++ b/lisp/emacs-lisp/bindat.el
@@ -171,8 +171,8 @@
171;; | INTEGER_CONSTANT 171;; | INTEGER_CONSTANT
172;; | DEREF 172;; | DEREF
173 173
174;; DEREF ::= ( [NAME | INTEGER]... ) -- Field NAME or Array index relative to 174;; DEREF ::= ( [NAME | INTEGER]... ) -- Field NAME or Array index relative
175;; current structure spec. 175;; to current structure spec.
176;; -- see bindat-get-field 176;; -- see bindat-get-field
177 177
178;; A `union' specification 178;; A `union' specification
@@ -415,7 +415,9 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..."
415 ((eq type 'repeat) 415 ((eq type 'repeat)
416 (let ((index 0)) 416 (let ((index 0))
417 (while (< index len) 417 (while (< index len)
418 (bindat--length-group (nth index (bindat-get-field struct field)) (nthcdr tail item)) 418 (bindat--length-group
419 (nth index (bindat-get-field struct field))
420 (nthcdr tail item))
419 (setq index (1+ index))))) 421 (setq index (1+ index)))))
420 ((eq type 'union) 422 ((eq type 'union)
421 (let ((tag len) (cases (nthcdr tail item)) case cc) 423 (let ((tag len) (cases (nthcdr tail item)) case cc)
@@ -436,7 +438,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..."
436 (setq pos (+ pos len)))))))) 438 (setq pos (+ pos len))))))))
437 439
438(defun bindat-length (spec struct) 440(defun bindat-length (spec struct)
439 "Calculate raw-data length for STRUCT according to bindat specification SPEC." 441 "Calculate raw-data length for STRUCT according to bindat SPEC."
440 (let ((pos 0)) 442 (let ((pos 0))
441 (bindat--length-group struct spec) 443 (bindat--length-group struct spec)
442 pos)) 444 pos))
@@ -557,7 +559,9 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..."
557 ((eq type 'repeat) 559 ((eq type 'repeat)
558 (let ((index 0)) 560 (let ((index 0))
559 (while (< index len) 561 (while (< index len)
560 (bindat--pack-group (nth index (bindat-get-field struct field)) (nthcdr tail item)) 562 (bindat--pack-group
563 (nth index (bindat-get-field struct field))
564 (nthcdr tail item))
561 (setq index (1+ index))))) 565 (setq index (1+ index)))))
562 ((eq type 'union) 566 ((eq type 'union)
563 (let ((tag len) (cases (nthcdr tail item)) case cc) 567 (let ((tag len) (cases (nthcdr tail item)) case cc)
@@ -583,7 +587,8 @@ Note: The result is a multibyte string; use `string-make-unibyte' on it
583to make it unibyte if necessary." 587to make it unibyte if necessary."
584 (let ((no-return raw-data)) 588 (let ((no-return raw-data))
585 (unless pos (setq pos 0)) 589 (unless pos (setq pos 0))
586 (unless raw-data (setq raw-data (make-vector (+ pos (bindat-length spec struct)) 0))) 590 (unless raw-data
591 (setq raw-data (make-vector (+ pos (bindat-length spec struct)) 0)))
587 (bindat--pack-group struct spec) 592 (bindat--pack-group struct spec)
588 (if no-return nil (concat raw-data)))) 593 (if no-return nil (concat raw-data))))
589 594