Function: bindat-pack
bindat-pack is a byte-compiled function defined in bindat.el.gz.
Signature
(bindat-pack SPEC STRUCT &optional RAW IDX)
Documentation
Return binary data packed according to SPEC for structured data STRUCT.
Optional third arg RAW is a pre-allocated unibyte string or vector to pack into. Optional fourth arg IDX is the starting offset into RAW.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/bindat.el.gz
(defun bindat-pack (spec struct &optional raw idx)
"Return binary data packed according to SPEC for structured data STRUCT.
Optional third arg RAW is a pre-allocated unibyte string or vector to
pack into.
Optional fourth arg IDX is the starting offset into RAW."
(when (multibyte-string-p raw)
(error "Pre-allocated string is multibyte"))
(let* ((bindat-idx (or idx 0))
(bindat-raw
(or raw
(make-string (+ bindat-idx (bindat-length spec struct)) 0))))
(bindat--pack-group struct spec)
(if raw nil bindat-raw)))