[chirp_devel] [developer] Control address format for full-file dump/diff - #1767
Dan Smith
Tue Jul 15 17:30:16 PDT 2014
> +
> + try:
> + addrfmt = CONF.get("hexdump_addrfmt", "developer")
> + except Exception:
> + addrfmt = "decimal"
> + if addrfmt == None:
> + addrfmt = "decimal"
> + elif (addrfmt != "decimal" and addrfmt != "hex" and addrfmt != "both"):
> + print "Invalid hexdump_addrfmt value %s. Using decimal." % addrfmt
> + addrfmt = "decimal"
>
> for i in range(0, (len(data)/line_sz)):
> - out += "%03i: " % (i * line_sz)
> + if addrfmt == "hex":
> + out += "x%04X: " % (i * line_sz)
> + elif addrfmt == "both":
> + out += "%04i x%04X: " % ((i * line_sz), (i * line_sz))
> + else:
> + out += "%04i: " % (i * line_sz)
Just a thought...
Instead of having them choose from a few different symbolic choices, why
not just let them specify the format themselves? So in the config:
hexdump_addrfmt = %0000x
and in the code:
fmt = CONF.get("hexdump_addrfmt", "developer")
. . .
thing = fmt % addr
I can just see someone coming along and wanting octal or something and
if we just let them specify the format, we can avoid adding new symbols.
What do you think?
--Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 538 bytes
Desc: OpenPGP digital signature
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20140715/1f422802/attachment-0001.bin
More information about the chirp_devel
mailing list