-
Notifications
You must be signed in to change notification settings - Fork 227
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
options: add "-o base=2" #703
base: master
Are you sure you want to change the base?
Conversation
Add experimental support for base 2 (bits). For example: $ fq -o base=2 '.frames[0].header' example.mp3 Also, add various comments to make sense of the dump.go code.
I wonder if the header in base 2 should be something like And i apologies for the mess in dump.go, lots of things to keep track of and hard to come up with good names :) and i would like to refactor it into something that "renders" per column somehow, now all is done i one go. That would also prepare for allowing a user to configure columns. |
Based on the failing tests it seems like some kind of stop bit position etc ends up wrong (too far?) for hex |
Seeing the bit offset address could be nice, especially to do slicing
I haven't tested this well. I'll take a look. |
Would it look strange to show binary in 8 bit groups somehow? 🤔
No worries, just so you know why it might show wrong value About # runs only the TestInterp/testdata/hexdump.fqtest test
$ go test -run TestInterp/testdata/hexdump.fqtest ./pkg/interp
# test name is a / separated regexps so you can do
# also -v makes i print nam of tests
$ go test -v -run "TestInterp/testdata/.*\.fqtest" ./pkg/interp
# all tests under TestInterp/testdata/
$ go test -v -run TestInterp/testdata/ ./pkg/interp Also maybe good to know that fq has kind of two types of |
I checked HexFiend. It has an option called "Byte Grouping". Similarly, it also has "line number format" (maybe you have this already?).
yes, that was it. I added a missing conditional. It solved most failing tests, but some remain. Maybe you can help me with those? |
|
Sorry for the delay, work and life happening. They all look very nice, hard to decide :) For variant D+E would it make sense that the line address would be
Guess that would be addrbase now? but it's also used in some other places for addresses also
Yeap will do |
A mix of hex and decimal offset "feels" confusing to me... :-/
It seems I fixed the tests (at least the |
Currently it's mostly that addresses are default hex, other things decimal. But yeah showing number of bits in hex maybe is confusing :) About line address, does it make sense to "offset" for each line if the line address is the field start address? i do like that number base controls that line address is in bits instead of bytes. But i wonder if it should be communicated somehow? Think i will have to play around with this a bit to get a feeling, haven't had much quailty fq-time the last days :)
🥳 |
Add experimental support for base 2 (bits).
For example:
$ fq -o base=2 '.frames[0].header' example.mp3
Also, add various comments to make sense of the dump.go code.