parent
86efac510a
commit
18f905021f
|
@ -519,13 +519,16 @@ class Binary32Buffer(FileBuffer):
|
||||||
btype = 'bin32file'
|
btype = 'bin32file'
|
||||||
wordsize = 4
|
wordsize = 4
|
||||||
numwords = 4
|
numwords = 4
|
||||||
|
data = None
|
||||||
def __init__(self, path, nl='\n', name=None):
|
def __init__(self, path, nl='\n', name=None):
|
||||||
'''fb = FileBuffer(path)'''
|
'''fb = FileBuffer(path)'''
|
||||||
FileBuffer.__init__(self, path, nl, name)
|
FileBuffer.__init__(self, path, nl, name)
|
||||||
def read_filter(self, data):
|
def read_filter(self, data):
|
||||||
|
self.rawdata = []
|
||||||
lines = []
|
lines = []
|
||||||
i = 0
|
i = 0
|
||||||
while i < len(data):
|
while i < len(data):
|
||||||
|
self.rawdata.append(data[i:i + self.numwords * self.wordsize])
|
||||||
j = 0
|
j = 0
|
||||||
words = []
|
words = []
|
||||||
while j < self.numwords * self.wordsize and i + j < len(data):
|
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'),
|
'zero': ('magenta', 'default'),
|
||||||
'byte': ('white', '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):
|
def __init__(self, w):
|
||||||
mode.Fundamental.__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)
|
self.add_binding('overwrite-char-%s' % c.lower(), c)
|
||||||
else:
|
else:
|
||||||
self.del_binding(c)
|
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):
|
def get_lmargin(self, y, x=0, ended=False, cont=False):
|
||||||
lm = self.lmargin
|
lm = self.lmargin
|
||||||
if ended:
|
if ended:
|
||||||
s = ' -------- '
|
s = ' -------- '
|
||||||
elif x == 0:
|
elif x == 0:
|
||||||
s = '0x%08x ' % y
|
s = '0x%08x ' % (y * 16)
|
||||||
return (s, color.build('default', 'default', 'bold'))
|
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):
|
class GotoWord(Method):
|
||||||
'''Jump to the specified line number'''
|
'''Jump to the specified line number'''
|
||||||
|
|
Loading…
Reference in New Issue