News for hackers. Stuff that matters.
Re:GNU poke 1.0 by SloopJon on Friday February 26, 2021 @01:38PM (#26278146)
One thing I haven't had much success with when trying editors like this is dealing with variable data, like Pascal-style strings or varints. Another one is a length field that is either one byte, or a NUL byte followed by two bytes, or three NUL bytes followed by four bytes.

I'll have to give this one a try. It would be nice to be able to sift through binary data like bytecode or some non-standard serialization format without writing a one-off utility for it.

Re:GNU poke 1.0 by digikata on Friday February 26, 2021 @03:13PM (#26279331)
I recently tried Kaitai for something like this. It worked for some nontrivial cases, but I felt like I kept getting bitten by syntax limitations. All the way through, I kept wondering if writing a one off utility might be faster. But it was possible to express variable structures, sizes and counts. I was using the syntax and the cmd line visualizer, but might have been more productive with their html/gui tooling.

http://kaitai.io/

Re:GNU poke 1.0 by kenny11 on Friday February 26, 2021 @02:27PM (#26278773)
I spent a long time looking for something similar to sift through binary files and found this:

https://www.sweetscape.com/010editor/

It lets you write "templates" in a weird hybrid syntax that looks a lot like a C header file but also allows control statements that can decode complicated data structures in a few lines of script. It looks to have very similar capabilities to GNU Poke, but with a GUI.

Re:GNU poke 1.0 by chris_wot on Friday February 26, 2021 @04:36PM (#26280096)
The poke creator seems to have a very dim view of 010.
Re:GNU poke 1.0 by rurban on Saturday February 27, 2021 @12:00PM (#26286140)
Exactly. Much worse syntax choices. Would not want to spend my time with it, when I have much more with 101.

But it least the VM is much faster than 101

Re:GNU poke 1.0 by kodachi on Friday February 26, 2021 @09:32PM (#26282117)
https://ide.kaitai.io/ has a yaml syntax, and its online editor has tons of examples.
Re:GNU poke 1.0 by badsectoracula on Saturday February 27, 2021 @12:30AM (#26282904)
I skimmed through the manual and from what i can tell this seems to be more of a language (with a REPL) with support for handling data streams (they call them I/O Spaces for some reason) than an editor. There does seem to be support for declaring types of variable length and it is one of the first examples:

    type Packet =
      struct
      {
        byte magic;
        uint<16> length;
        byte[length] data;
      }
It also seems to have optional fields using conditions, using the optional extended header in MP3 id3v2 tag as an example:

    struct ID3V2_Tag =
      struct
      {
        ID3V2_Hdr hdr;
        IDV2_Ext_Hdr ext_hdr if hdr.extended_hdr_present;
      }
(this is an alternative to another way it provides by using unions which work similar to C unions but each alternative also has conditions for when it is valid).

So at least from the above i think it should be possible to declare types that work with variable length and prefixes like that.