Function: bindat--pack-item
bindat--pack-item is a byte-compiled function defined in bindat.el.gz.
Signature
(bindat--pack-item V TYPE LEN &optional VECTYPE)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/bindat.el.gz
(defun bindat--pack-item (v type len &optional vectype)
(if (eq type 'ip)
(setq type 'vec len 4))
(pcase type
((guard (null v)) (setq bindat-idx (+ bindat-idx len)))
((or 'u8 'byte) (bindat--pack-u8 v))
((or 'u16 'word 'short) (bindat--pack-u16 v))
('u24 (bindat--pack-u24 v))
((or 'u32 'dword 'long) (bindat--pack-u32 v))
('u16r (bindat--pack-u16r v))
('u24r (bindat--pack-u24r v))
('u32r (bindat--pack-u32r v))
('bits (bindat--pack-bits len v))
('str (bindat--pack-str len v))
('strz (bindat--pack-strz len v))
('vec
(let ((l (length v)) (vlen 1))
(if (consp vectype)
(setq vlen (nth 1 vectype)
vectype (nth 2 vectype))
(setq type (or vectype 'u8)
vectype nil))
(if (> l len) (setq l len))
(dotimes (i l)
(bindat--pack-item (aref v i) type vlen vectype))))
(_
(setq bindat-idx (+ bindat-idx len)))))