From: Mark Wooding Date: Mon, 21 May 2018 16:41:57 +0000 (+0100) Subject: utils/split-pieces: Introduce unsigned quick fields. X-Git-Tag: 2.4.2~7 X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/commitdiff_plain/b9ff3b5f9d0e994b15e827a8004fdf5cefd508fa utils/split-pieces: Introduce unsigned quick fields. There aren't any in Catacomb at the moment -- and I don't plan to add any -- but other code uses them so it's useful to be able to work with them. --- diff --git a/utils/split-pieces b/utils/split-pieces index a5b62945..0bffd500 100755 --- a/utils/split-pieces +++ b/utils/split-pieces @@ -69,13 +69,19 @@ class SignedQfConvert (BaseQfConvert): SIGNEDP = True def fmt(me, n): return str(n) +class UnsignedQfConvert (BaseQfConvert): + SIGNEDP = False + def fmt(me, n): return '0x%x' % n + R_split = RX.compile(r',\s*|\s+') def spliteval(arg): return map(eval, R_split.split(arg.strip())) convmap = { 'scaf': ScafConvert, 'unscaf': ScafConvert, 'qf': SignedQfConvert, - 'unqf': SignedQfConvert } + 'unqf': SignedQfConvert, + 'uqf': UnsignedQfConvert, + 'unuqf': UnsignedQfConvert } op = getarg() cvt = convmap[op].parse() if op.startswith('un'): prepare, conv, format = spliteval, cvt.unhack, str