[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen
From: |
Eli Zaretskii |
Subject: |
bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen |
Date: |
Wed, 13 Mar 2024 13:53:12 +0200 |
> Date: Tue, 12 Mar 2024 16:18:58 +0100
> From: Eric Marsden <eric.marsden@risk-engineering.org>
>
> -- file bd.el
> (require 'bindat)
> (bindat-pack (bindat-type sint 32 t) 42)
> --
> emacs -Q --batch -l bd.el -->
>
> Error: void-variable (bitlen)
> mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode
> -0x160fbb9816517825>))
> debug-early-backtrace()
> debug-early(error (void-variable bitlen))
> (/ bitlen 8)
> (+ bindat-idx (/ bitlen 8))
> (setq bindat-idx (+ bindat-idx (/ bitlen 8)))
> (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))
> (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq
> bindat-idx (+ bindat-idx (/ bitlen 8)))))
> (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v
> field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8))))))
> (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v)))
> (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))))))(42)
> bindat--length-group(42 #s(bindat--type :le (lambda (v) (let ((v v))
> (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq
> bindat-idx (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if
> t (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>=
> n max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (<
> v 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen
> v) (bindat--pack-uint bitlen v))))))))
> bindat-length(#s(bindat--type :le (lambda (v) (let ((v v)) (let
> ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx
> (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t
> (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n
> max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v
> 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v)
> (bindat--pack-uint bitlen v))))))) 42)
> bindat-pack(#s(bindat--type :le (lambda (v) (let ((v v)) (let
> ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx
> (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t
> (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n
> max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v
> 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v)
> (bindat--pack-uint bitlen v))))))) 42)
> load-with-code-conversion("/tmp/bd.el" "/tmp/bd.el" nil t)
> command-line-1(("-l" "/tmp/bd.el"))
> command-line()
> normal-top-level()
> Symbol’s value as variable is void: bitlen
>
> This bug is difficult to understand. Run from an IELM buffer, this code
> works as expected. The macroexpansion of the bindat-type declaration
> includes a binding for bitlen.
Thanks, I added Stefan to this discussion.