unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Marsden <eric.marsden@risk-engineering.org>
To: 69749@debbugs.gnu.org
Subject: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen
Date: Tue, 12 Mar 2024 16:18:58 +0100	[thread overview]
Message-ID: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> (raw)

-- 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.


GNU Emacs 29.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, 
cairo version 1.18.0) of 2024-03-09, modified by Debian








             reply	other threads:[~2024-03-12 15:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 15:18 Eric Marsden [this message]
2024-03-13 11:53 ` bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen Eli Zaretskii
2024-03-13 12:54   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]     ` <4a7ccaf7-02dc-4cca-b6e7-520ffb45dcac@risk-engineering.org>
2024-03-15 16:51       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-16 11:16         ` Eli Zaretskii
     [not found]           ` <000d8acf-bad4-432a-a775-0c03225674fe@risk-engineering.org>
2024-03-17 19:13             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org \
    --to=eric.marsden@risk-engineering.org \
    --cc=69749@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).