fork download
  1. #!/usr/bin/env ruby
  2. # -*- coding: utf-8 -*-
  3.  
  4. exit 1 if ARGV.size<2
  5. File.open(ARGV[0]) {|f|
  6.  
  7. data = f.read.unpack("B*")[0]
  8.  
  9. puts "<wxHexEditor_XML_TAG><filename>"
  10. ARGV[1..-1].each {|ss|
  11. pos = 0
  12. sbs = (eval ss).to_s(2)
  13. note_colour = sprintf("#%02X%02X%02X", *(1..3).map{rand(0x7f)+0x80})
  14.  
  15. while m = data.match(sbs, pos) do
  16. puts %Q{ <TAG>
  17. <start_offset>#{m.begin(0)/8}</start_offset>
  18. <end_offset>#{m.end(0)/8}</end_offset>
  19. <tag_text>#{sprintf("0x%08X(%d) : %s [%s]", m.begin(0)/8, m.begin(0)%8, ss, sbs)}</tag_text>
  20. <note_colour>#{note_colour}</note_colour>
  21. </TAG>}
  22. pos = m.begin(0) + 1
  23. end
  24.  
  25. }
  26. puts "</filename></wxHexEditor_XML_TAG>"
  27.  
  28. }
  29.  
Runtime error #stdin #stdout 0.02s 7456KB
stdin
Standard input is empty
stdout
Standard output is empty