AbstractFileBrowser.st
branchjv
changeset 17304 3eea1002b141
parent 17303 85890687ff9c
parent 17252 1182be543bb2
child 17379 028adf14bc05
equal deleted inserted replaced
17303:85890687ff9c 17304:3eea1002b141
  2830 !AbstractFileBrowser class methodsFor:'utilities'!
  2830 !AbstractFileBrowser class methodsFor:'utilities'!
  2831 
  2831 
  2832 contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart
  2832 contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart
  2833     "utility helper: generate a hexDump with addresses"
  2833     "utility helper: generate a hexDump with addresses"
  2834 
  2834 
  2835     |lines nHexLines|
  2835     |lines nHexLines replacementForUnprintable|
       
  2836 
       
  2837     "/ used to be:
       
  2838     "/ replacementForUnprintable := $.
       
  2839     replacementForUnprintable := Character value:16rB7. "/ a centered dot.
  2836 
  2840 
  2837     "generate a virtual collection which evaluates and returns lines on-demand"
  2841     "generate a virtual collection which evaluates and returns lines on-demand"
  2838 
  2842 
  2839     nHexLines := (data size + 15) // 16.
  2843     nHexLines := (data size + 15) // 16.
  2840 
  2844 
  2870                         (byte between:32 and:127) ifTrue:[
  2874                         (byte between:32 and:127) ifTrue:[
  2871                             asciiLineStream nextPut:(Character value:byte)
  2875                             asciiLineStream nextPut:(Character value:byte)
  2872                         ] ifFalse:[
  2876                         ] ifFalse:[
  2873                             (byte between:0 and:31) ifTrue:[
  2877                             (byte between:0 and:31) ifTrue:[
  2874                                 "/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400
  2878                                 "/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400
  2875                                 "/ are perfect here, but usually not available
  2879                                 "/ are perfect here, but usually not available in the font
       
  2880                                 "/ and we have currently no way of knowing if they are...
       
  2881                                 "/ (could let the font draw into abitmap and check if there is something...)
       
  2882                                 "/ therefore, for now, write a dot.·
  2876                                 "/ asciiLineStream nextPut:(Character value:(byte + 16r2400))
  2883                                 "/ asciiLineStream nextPut:(Character value:(byte + 16r2400))
  2877                                 asciiLineStream nextPut:$.
  2884                                 asciiLineStream nextPut:replacementForUnprintable.
  2878                             ] ifFalse:[
  2885                             ] ifFalse:[
  2879                                 asciiLineStream nextPut:$.
  2886                                 asciiLineStream nextPut:replacementForUnprintable.
  2880                             ].
  2887                             ].
  2881                         ].
  2888                         ].
  2882                     ].
  2889                     ].
  2883                 ].
  2890                 ].
  2884                 line := (lineStream contents paddedTo:(addrDigits + 1 + (3*16)+ 8))
  2891                 line := (lineStream contents paddedTo:(addrDigits + 1 + (3*16)+ 8))