Sha256: 4d2438a3064cb4eeb3564c530ccab0b993f1c0717d4fc9b71352d8d4cb2733b1

Contents?: true

Size: 766 Bytes

Versions: 19

Compression:

Stored size: 766 Bytes

Contents

class DumpUtilities
  
  def DumpUtilities.hex_dump(buffer)
   	s=""
		(0..(buffer.length/16)).each {|line_number|
			 lhs=""
			 rhs=""
			 start_byte=line_number*16
			 line=buffer[start_byte..start_byte+15]
			if line.length>0 then
				 line.each_byte {|byte|
					  lhs+= sprintf("%02X ", byte)
					  rhs+= (byte%128).chr.sub(/[\x00-\x1f]/,'.')
			 	}
				lhs+=" "*(16-line.length)*3
				s+=sprintf("%02X\t%s %s\n",start_byte,lhs,rhs)
			end
		}
		s
  end
  
  def DumpUtilities.font_dump(buffer)
  #treat buffer as a set 8 bit wide characters
  s=""
  c=0
  buffer.each_byte do |byte| 
      s<<sprintf(";char %02x\n",c>>3) if c%8==0
      s<<sprintf("%08b\n",byte).tr("1","#").tr("0"," ")
      c+=1
      
  end
  s
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ripxplore-0.17.1 lib/DumpUtilities.rb
ripxplore-0.17.0 lib/DumpUtilities.rb
ripxplore-0.16.1 lib/DumpUtilities.rb
ripxplore-0.15.1 lib/DumpUtilities.rb
ripxplore-0.14.1 lib/DumpUtilities.rb
ripxplore-0.14.0 lib/DumpUtilities.rb
ripxplore-0.13.0 lib/DumpUtilities.rb
ripxplore-0.12.0 lib/DumpUtilities.rb
ripxplore-0.11.0 lib/DumpUtilities.rb
ripxplore-0.4.0 lib/DumpUtilities.rb
ripxplore-0.0.1 lib/DumpUtilities.rb
ripxplore-0.0.2 lib/DumpUtilities.rb
ripxplore-0.5.0 lib/DumpUtilities.rb
ripxplore-0.5.1 lib/DumpUtilities.rb
ripxplore-0.7.0 lib/DumpUtilities.rb
ripxplore-0.5.2 lib/DumpUtilities.rb
ripxplore-0.7.1 lib/DumpUtilities.rb
ripxplore-0.7.2 lib/DumpUtilities.rb
ripxplore-0.8.0 lib/DumpUtilities.rb