More glyph changes ugh

This commit is contained in:
Neale Pickett 2018-07-16 13:10:10 -06:00
parent 37642c0780
commit c0f7e96117
1 changed files with 23 additions and 3 deletions

View File

@ -1,5 +1,6 @@
#! /usr/bin/python3 #! /usr/bin/python3
import binascii
import sys import sys
import struct import struct
@ -60,6 +61,25 @@ cgach = (
'≡±≥≤⌠⌡÷≈°∙·√ⁿ²■¤' '≡±≥≤⌠⌡÷≈°∙·√ⁿ²■¤'
) )
fluffych = (
'·☺☻♥♦♣♠•◘○◙♂♀♪♫☼'
'►◄↕‼¶§▬↨↑↓→←∟↔▲▼'
' !"#$%&\'()*+,-./'
'0123456789:;<=>?'
'@ABCDEFGHIJKLMNO'
'PQRSTUVWXYZ[\]^_'
'`abcdefghijklmno'
'pqrstuvwxyz{|}~⌂'
'ÇüéâäàåçêëèïîìÄÅ'
'ÉæÆôöòûùÿÖÜ¢£¥₧ƒ'
'áíóúñѪº¿⌐¬½¼¡«»'
'░▒▓│┤╡╢╖╕╣║╗╝╜╛┐'
'└┴┬├─┼╞╟╚╔╩╦╠═╬╧'
'╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀'
'αßΓπΣσµτΦΘΩδ∞φε∩'
'≡±≥≤⌠⌡÷≈°∀∃√ⁿ²■¤'
)
def unpack(fmt, buf): def unpack(fmt, buf):
"""Unpack buf based on fmt, return the remainder.""" """Unpack buf based on fmt, return the remainder."""
@ -70,7 +90,7 @@ def unpack(fmt, buf):
class HexDumper: class HexDumper:
def __init__(self, output, charset=stdch): def __init__(self, output, charset=fluffych):
self.offset = 0 self.offset = 0
self.last = None self.last = None
self.elided = False self.elided = False
@ -124,7 +144,7 @@ class HexDumper:
self.output.write('{:08x}\n'.format(self.offset)) self.output.write('{:08x}\n'.format(self.offset))
def hexdump(buf, f=sys.stdout, charset=cgach): def hexdump(buf, f=sys.stdout, charset=fluffych):
"Print a hex dump of buf" "Print a hex dump of buf"
h = HexDumper(output=f, charset=charset) h = HexDumper(output=f, charset=charset)
@ -246,7 +266,7 @@ def bin(i, bits=None):
def unhex(s): def unhex(s):
"""Decode a string as hex, stripping whitespace first""" """Decode a string as hex, stripping whitespace first"""
return [ord(i) for i in s.replace(' ', '').decode('hex')] return binascii.unhexlify(s.replace(' ', ''))
def pp(value, bits=16): def pp(value, bits=16):