|
Post by greco558 on Feb 1, 2016 1:59:08 GMT 1
Hi All, Thought I would post a simple file byte editor I wrote for fun in bacon. I think I have most of the bugs worked out. Start from command line ./editbyte -x filename this will dump file in 256 byte chunks in hex and ascii move around screen much like vim with h,j,k,l keys or arrow keys. You can also run ./editbyte -t filename to dump whole text file to screen like cat command in linux. When editing byte enter single character such as a, b, c, or 1, 2, 3 etc... or Hex byte 0A, 0a, 41, ff or FF etc..... Made some changes to program see update notes at top of file. BR John Attachments:editbyte.bac (15.38 KB)
|
|
|
Post by Pjot on Feb 1, 2016 20:10:08 GMT 1
Thanks John! This program really is very nice. The code is a lot better than my simple attempt, which I actually sometimes use to analyze files for my job. Your use of console methods (color, cursor movement, duplicate cursor, keyboard event handling) work out very well. And your code is very clean too. Impressive. And I really appreciate this program for its practical use. So thanks again! Regards, Peter
|
|
|
Post by greco558 on Feb 2, 2016 17:36:30 GMT 1
Peter, Thank you for the kind words I am glad you like it. I found a minor bug with 256 byte jumps when using g<key>. I did not account for files that are not divisible by 256. I added command line option -m option to mark all newline carriage returns in dump. Forgot to change program name in Help menu. Also attaching program keycode that i use alot. I attached updated editbyte.bac BR John Attachments:keycode.bac (745 B)
editbyte.bac (16.11 KB)
|
|
|
Post by greco558 on Feb 25, 2016 21:56:23 GMT 1
Hi All, Just made some minor changes to code mostly visual changes to look more like the program editasm I wrote in NASM Assembly. BR John Attachments:editbyte.bac (16.63 KB)
|
|
|
Post by Pjot on Feb 26, 2016 19:12:04 GMT 1
Thanks John,
All works as advertised on my 64bit Linux.
Regards Peter
|
|
|
Post by vovchik on Feb 27, 2016 19:10:52 GMT 1
Dear John, And it works like a charm on my 32-bit Mint. Well done, and thanks. With kind regards, vovchik
|
|
|
Post by greco558 on Mar 15, 2016 19:40:27 GMT 1
Hi All, Made a few changes, added (m) key to highlite all bytes matching Hex or Ascii byte entered and (c) key to clear all highlites. KeyHandler() Function was getting cluttered so I move Phantom Cursor code to PhantomCursor() Function. BR John Attachments:editbyte.bac (18.49 KB)
|
|
|
Post by basica on Mar 17, 2016 18:51:41 GMT 1
John,
I finally got around to downloading your byte editor and I must say a quick trial produced a nice clean interface which is really much handier than the usual window mouse ones.
Well done and thanks,
basica
|
|
|
Post by greco558 on Jul 5, 2016 15:49:45 GMT 1
Hi All, I recently had to use the byte editor I wrote to edit a long ASCII string in a file and found it inconvenient to replace each ASCII byte one at a time. So I added the option to change a complete string using the uppercase (R), lowercase (r) will still let you edit one byte at a time as ASCII or HEX. Just navigate to the byte you want to start editing from, hit <shift> r, you can now edit a complete string of ASCII characters just start typing, if you make a mistake while typing you can use backspace key to undo the changes. When you are done editing the string hit the ENTER key to end ASCII string editing session and as always, changes are not permanent until you press (w) to write to file. BR, John Attachments:editbyte.bac (20.33 KB)
|
|
|
Post by Pjot on Jul 7, 2016 19:10:40 GMT 1
Thanks John,
A very nice improvement indeed!
Best regards Peter
|
|
|
Post by rikky on Jul 8, 2016 6:14:53 GMT 1
Very nice indeed.
I noticed that you have to resize your window to 90x30 or full screen, so I made this little wrapper and added it to ' /root/.config/rox.sourceforge.net/SendTo' in my Puppylinux, so that you can open a file with biteeditor with a right click, without resizing.
I suppose that in other platforms there is a place like this as well.
#!/bin/bash
geometry="95x30+120+120" xterm -geometry $geometry -e editbyte -x $@ getkey the getkey statement is just a compiled BaCon getkey off course.
|
|
|
Post by greco558 on Jul 8, 2016 19:58:19 GMT 1
Thanks Peter & Rikky, Peter, BaCon is truly one of the best programming languages that I have tried, I really enjoying using it. It is very easy to inline C or Assembly code with what seems like no effort at all. I found a little problem in editbyte with cursor movement when using the arrow or h,j,k,l keys for moving the phantom cursor around. If you hold one of the movement keys down instead of pressing it one time for each phantom cursor movement up, down, left, right, it can end up displaying extra characters off to the sides. For now I just made the (c)key do double duty, not only will it clear marked bytes but you can press it to cleanup display if you end up with a messy display because of key repeat. For me programs never seem to be done they just end up on going projects, weather its bug fixes, adding features or just cleaning up the code. BR, John Attachments:editbyte.bac (20.35 KB)
|
|
|
Post by vovchik on Jul 8, 2016 20:24:52 GMT 1
Dear greco558, What you say reminds me a little of Stravinsky. I am probably making a few errors in the quotes, but he is known to have said, "Talented people borrow. Geniuses steal". And, "Compositions are nevery really finished. They are abandoned". And your work is great. Thanks. WIth kind regards, vovchik
|
|
|
Post by greco558 on Jul 12, 2016 20:53:38 GMT 1
Thank you vovchik. I found a bug while doing some editing on an ASCII String at the end of a sector. I fixed it by having it wrap back to first byte in sector displayed, which then introduced another bug when backspacing to undo changes, both are fixed now. Best to all John Attachments:editbyte.bac (20.57 KB)
|
|
|
Post by Pjot on Jul 13, 2016 21:11:05 GMT 1
Hi John,
Once again, thanks. This program is very handy, and I am actually using it to investigate UCS-2 coding in text files.
Also I like the color layout a lot!
Regards Peter
|
|