Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: dump-binary

From: atruter:labyrinth:au at: 1-May-2004 9:28

Hi Jaime,
> Please critique my code so that I can improve it.
First, let me echo other folks comments ... well done, I hope this ends up (in some shape or form) as part of the main REBOL code much like 'dump-face, 'dump-obj and 'dump-pane. Now, for some general observations (all opinion, so ignore as you see fit! ;) ). 1. I'd name the function 'dump-bin (to be consistant with 'dump-obj and the use of *-dir function names) 2. I'd add function help, something like: dump-bin: func [ "Print ASCII info for entire binary. (for debugging)" bin [binary!] /local v t c r pad pl len chars tmp ][ ... 3. As above, I'd use bin instead of 'buffer and b, and explicity require a binary! (This simplifies the code by letting you remove "either binary! type? b: get buffer" and the matching error block). 4. Ditch the 'print [buffer "=="]' due to above change These small changes make the function more generic, enabling you to do the following: dump-bin my-binary dump-bin to-binary "abc" dump-bin read/binary %my-binary.exe Regards, Ashley