# An Overgrown Feature

Once upon a time (early previous year), I had a silly idea. Why can't my text editor read binary files?

I've since decided to stop developing the text editor, but a little now and then I went through my git history and found the correct commit where the binary viewer was still functional.

The idea was pretty simple, it took input in the form of
 1 2 3 4 5 6 7 struct Data { U32 magic; U32 size; I32 payload[64]; // Assuming size is 64 }; @0x00 Data 

and would output the data in the file, starting from 0x00, in a formatted way. As this was integrated in my text editor I would get (almost) instant preview when I made a change to the struct. So when I saw the I32 payload[64] actually had a size of 128, I could easily change it... but it got tedious.

Wouldn't it be nicer if I could write
 1 2 3 4 5 6 7 struct Data { U32 magic; U32 size; I32 payload[size]; }; @0x00 Data 

That's how BEdit started, an overgrown feature that proved more useful than the application I was developing. It has gone from nothing more than parsing a C-like type definition to running its own virtual machine.

It's not very often you deal with binary files, but even in its currently limited state I find it really nice to have when you just want to quickly double-check if that one flag is set.

I hope you enjoy it as well!
Simon Anciaux,
It seems interesting.

At some point I wanted to do a somewhat similar tool to help reading binary files in which I didn't knew the format (sort of reverse engineering). I could see the usefulness if the tool comes with an editor to create the layout file, because if I need to write them, I might as well write them directly in C since I'm more comfortable and less likely to make an error.

Probably an incorporated diff tool would be nice.

I try adding an intentional errors in bmp.bet file (commenting u(4) Size; assert(Size==40);) and the application crashed. (Sorry I'm an ***)

Keep it up !
Jens,
Interesting you would mention a diff tool, I've had similar ideas. I've never written a diff tool myself so could be interesting to try out.

Currently the error handling is very... version 0.0.1 :D Expect it to improve sooner rather than later.