parent
86efac510a
commit
18f905021f
|
@ -519,13 +519,16 @@ class Binary32Buffer(FileBuffer):
|
|||
btype = 'bin32file'
|
||||
wordsize = 4
|
||||
numwords = 4
|
||||
data = None
|
||||
def __init__(self, path, nl='\n', name=None):
|
||||
'''fb = FileBuffer(path)'''
|
||||
FileBuffer.__init__(self, path, nl, name)
|
||||
def read_filter(self, data):
|
||||
self.rawdata = []
|
||||
lines = []
|
||||
i = 0
|
||||
while i < len(data):
|
||||
self.rawdata.append(data[i:i + self.numwords * self.wordsize])
|
||||
j = 0
|
||||
words = []
|
||||
while j < self.numwords * self.wordsize and i + j < len(data):
|
||||
|
|
23
mode/hex.py
23
mode/hex.py
|
@ -17,6 +17,12 @@ class Hex(mode.Fundamental):
|
|||
'zero': ('magenta', 'default'),
|
||||
'byte': ('white', 'default'),
|
||||
}
|
||||
lmargin = 12
|
||||
rmargin = 18
|
||||
_ctrans = ['.'] * 256
|
||||
for c in string.letters + string.digits + string.punctuation + ' ':
|
||||
_ctrans[ord(c)] = c
|
||||
ctrans = ''.join(_ctrans)
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
|
||||
|
@ -30,20 +36,19 @@ class Hex(mode.Fundamental):
|
|||
self.add_binding('overwrite-char-%s' % c.lower(), c)
|
||||
else:
|
||||
self.del_binding(c)
|
||||
|
||||
def enable_line_numbers(self):
|
||||
self.show_line_numbers = True
|
||||
self.lmargin = 12
|
||||
def disable_line_numbers(self):
|
||||
self.show_line_numbers = False
|
||||
self.lmargin = 0
|
||||
def get_lmargin(self, y, x=0, ended=False, cont=False):
|
||||
lm = self.lmargin
|
||||
if ended:
|
||||
s = ' -------- '
|
||||
elif x == 0:
|
||||
s = '0x%08x ' % y
|
||||
return (s, color.build('default', 'default', 'bold'))
|
||||
s = '0x%08x ' % (y * 16)
|
||||
return (s, color.build('cyan', 'default', 'bold'))
|
||||
def get_rmargin(self, y, x=0, ended=False, cont=False):
|
||||
if ended:
|
||||
s = ''
|
||||
else:
|
||||
s = string.translate(self.window.buffer.rawdata[y], self.ctrans)
|
||||
return (s, color.build('green', 'default', 'bold'))
|
||||
|
||||
class GotoWord(Method):
|
||||
'''Jump to the specified line number'''
|
||||
|
|
Loading…
Reference in New Issue