def draw(self, terminal, width): table = Table() line_len = 16 if width < 100: line_len = 8 address = self._data_chunk.address() for line in grouper(line_len, self._data_chunk.buffer()): hex_string = [] ascii_string = [] for octuple in grouper(8, line): for quadruple in grouper(4, octuple): hex_string += [(' %02X' % ord(i)) for i in quadruple if i is not None] filtered = ''.join([x.translate(self._ascii_filter) for x in quadruple if x is not None]) ascii_string += filtered.replace('%', '%%') hex_string += [' '] ascii_string += [' '] row = Row() row.add_cell(Cell('0x%016X:' % address)) row.add_cell(Cell(''.join(hex_string))) row.add_cell(Cell(''.join(ascii_string))) table.add_row(row) address += line_len table.draw(terminal, width)
def execute(self, terminal, *_): table = Table() for name, snippet in snippet_repository.snippets(): row = Row() row.add_cell(Cell('%s%s' % ('%(face-identifier)s', name))) row.add_cell(Cell('%s%s' % ('%(face-comment)s', snippet.description()))) table.add_row(row) section = Section('snippets') section.add_component(table) section.draw(terminal, terminal.width())
def draw(self, terminal, width): table = Table() for address, instruction in self._instruction_listing.instructions(): row = Row() const_face = '%(face-normal)s' if address == self._program_counter: const_face = '%(face-underlined)s' row.add_cell(Cell('%s0x%016lX:' % (const_face, address))) if instruction.symbol() is not None: identifier = ['%(face-identifier)s', instruction.symbol(), ':'] row.add_cell(Cell(''.join(identifier))) else: row.add_cell(Cell()) hex_string = [('%02X' % ord(i)) for i in instruction.opcode() if i is not None] row.add_cell(Cell('%s%s' % (const_face, ' '.join(hex_string)))) row.add_cell(Cell('%s%s' % ('%(face-statement)s', instruction.mnemonic()))) if instruction.operands() is not None: operands = self._fmt_operands(instruction.operands()) row.add_cell(Cell(operands)) else: row.add_cell(Cell()) table.add_row(row) table.draw(terminal, width)
def draw(self, terminal, width): table = Table() for address, instruction in self._instruction_listing.instructions(): row = Row() const_face = '%(face-normal)s' if address == self._program_counter: const_face = '%(face-underlined)s' row.add_cell(Cell('%s0x%016lX:' % (const_face, address))) if instruction.symbol() is not None: identifier = ['%(face-identifier)s', instruction.symbol(), ':'] row.add_cell(Cell(''.join(identifier))) else: row.add_cell(Cell()) hex_string = [('%02X' % ord(i)) for i in instruction.opcode() if i is not None] row.add_cell(Cell('%s%s' % (const_face, ' '.join(hex_string)))) row.add_cell( Cell('%s%s' % ('%(face-statement)s', instruction.mnemonic()))) if instruction.operands() is not None: operands = self._fmt_operands(instruction.operands()) row.add_cell(Cell(operands)) else: row.add_cell(Cell()) table.add_row(row) table.draw(terminal, width)