]> git.eshelyaron.com Git - emacs.git/commit
* lisp/emacs-lisp/bindat.el: Minor refactoring
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 5 Mar 2021 18:31:16 +0000 (13:31 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 5 Mar 2021 18:31:16 +0000 (13:31 -0500)
commit03ada27cb81dabb87eff38f2d66fe8fc4a02da46
treeee81ebdcc796bc856f5abf485f7861e484b80927
parentd582356a7f704f8a209a3ef31d6ea970520c6224
* lisp/emacs-lisp/bindat.el: Minor refactoring

(bindat--unpack-str, bindat--unpack-strz, bindat--unpack-bits):
New functions, extracted from `bindat--unpack-item`.
(bindat--unpack-item): Use them.
(bindat--align): New function.
(bindat--unpack-group, bindat--length-group, bindat--pack-group): Use it.
(bindat-get-field): Allow integers to index both lists (as returned by
`repeat`) and vectors (as returned by `vec`).
(bindat--pack-str, bindat--pack-bits): New functions, extracted from
`bindat--pack-item`.
(bindat--pack-item): Use them.

* test/lisp/emacs-lisp/bindat-tests.el (struct-bindat): Place the fields
in the order in which they appear in the structs.
lisp/emacs-lisp/bindat.el
test/lisp/emacs-lisp/bindat-tests.el