Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reordering (addressing) fields #9

Open
MarkJeronimus opened this issue Nov 8, 2018 · 2 comments
Open

Allow reordering (addressing) fields #9

MarkJeronimus opened this issue Nov 8, 2018 · 2 comments

Comments

@MarkJeronimus
Copy link

MarkJeronimus commented Nov 8, 2018

It would be useful (also for enhancement request #8) to be able to address a string of bits to allow reordering data and overlapping data.

For example:
00 11 22 33 44 55 66
with
A:16h B:16h C:{16@8}h D:{16@24}h
becomes:
A:0011 B:2233 C:1122 D:3344 ...

Continuation option 1. The 'current pointer' is always after the last bit ever read (as if by a max() function). Addressed access only pushes the pointer forward if it exceeds previously read data.

the above becomes:
A:0011 B:2233 C:1122 D:3344 A:5566 ...

Continuation option 2. The 'current pointer' should not be modified by an addressed field. Addressed field access just peeks into the data without modifying anything else.

the above becomes:
A:0011 B:2233 C:1122 D:3344 A:4455...

==Extras:==

<{16@24}h : The 16bit value starting bit 24 is interpreted little endian.
{16@-24}h : The 16bit value starting bit 24 before the current pointer.
{16@+24}h : The 16bit value starting bit 24 after the current pointer.

@zuckschwerdt
Copy link
Member

This would display bits out of order. I guess it could be useful but seems rather advanced. With multiple format lines you can already display selected pieces.
Also I prefer option 2, peeking at bits with a pointer shouldn'T disturb what's been consumed. I don't want any bits to disappear from output.
I guess a simple "set pointer" option shouldn't be hard to add. I.e. just the offset, so maybe:
{@24}<16h : The 16bit value starting bit 24 is interpreted little endian.
{-24}16h : The 16bit value starting bit 24 before the current pointer.
{+24}16h : The 16bit value starting bit 24 after the current pointer.

@MarkJeronimus
Copy link
Author

{} is length in the input so it's illogical to not use it as length in #8, so use [ ] or something to seek.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants