From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org
Subject: Re: bindat docs on length of str, strz, etc types
Date: Thu, 28 Dec 2006 00:06:11 +0100 [thread overview]
Message-ID: <m3y7otq6qk.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <87r6ulq8qs.fsf@zip.com.au> (Kevin Ryde's message of "Thu\, 28 Dec 2006 09\:22\:51 +1100")
Kevin Ryde <user42@zip.com.au> writes:
> In the "Bindat Spec" node of the lisp manual, the `repeat' type has
>
> COUNT may be an integer, or a list of one element that names a
> previous field.
>
> If I'm not mistaken that applies to any of the LEN arguments for str,
> strz, etc too (the "Bindat Examples" have some like that). I wonder
> if the words could be in a more prominent / more general spot.
>
> And also if I'm not mistaken a form `(eval FOO)' is allowed, for
> calculating a length.
You are right. And all (eval FOO) forms can access `last' and
the other items listed only for the last type of eval form.
> It'd be nice to describe that.
Indeed.
>
> I tried it for a jpeg record, where the length field includes itself
> so the data is "length-2" bytes
>
> ((marker u16)
> (length u16)
> (data str (eval (- (assoc-default 'length struct) 2))))
>
> But perhaps there's a cleaner way I missed.
This should work:
((marker u16)
(length u16)
(data str (eval (- last 2))))
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
next prev parent reply other threads:[~2006-12-27 23:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-27 22:22 bindat docs on length of str, strz, etc types Kevin Ryde
2006-12-27 23:06 ` Kim F. Storm [this message]
2006-12-27 23:38 ` Kevin Ryde
2006-12-29 1:23 ` Kim F. Storm
2006-12-29 22:42 ` Kevin Ryde
2006-12-30 0:46 ` Kim F. Storm
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=m3y7otq6qk.fsf@kfs-l.imdomain.dk \
--to=storm@cua.dk \
--cc=emacs-devel@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).