[chirp_devel] [PATCH] bitwise: allow #seek in hex (only dec was supported). #715

Tom Hayward
Tue Mar 19 10:07:35 PDT 2013


# HG changeset patch
# User Tom Hayward <tom at tomh.us>
# Date 1363712827 25200
# Node ID f6e4c52e754b5fec9c79f63b08bac635f2f83251
# Parent  f5b8a743705c62b509a496ff811feb069b5b4926
bitwise: allow #seek in hex (only dec was supported). #715

diff -r f5b8a743705c -r f6e4c52e754b chirp/bitwise.py
--- a/chirp/bitwise.py	Sun Mar 03 13:48:01 2013 -0800
+++ b/chirp/bitwise.py	Tue Mar 19 10:07:07 2013 -0700
@@ -745,20 +745,19 @@
 
     def parse_directive(self, directive):
         name = directive[0][0]
+        offset_str = directive[0][1][0][1]
+        if offset_str.startswith("0x"):
+            offset = int(offset_str[2:], 16)
+        else:
+            offset = int(offset_str)
+
         if name == "seekto":
-            offset = directive[0][1][0][1]
-            if offset.startswith("0x"):
-                offset = int(offset[2:], 16)
-            else:
-                offset = int(offset)
             #print "NOTICE: Setting offset to %i (0x%X)" % (offset, offset)
             self._offset = offset
         elif name == "seek":
-            offset = int(directive[0][1][0][1])
             self._offset += offset
         elif name == "printoffset":
-            string = directive[0][1][0][1]
-            print "%s: %i (0x%08X)" % (string[1:-1], self._offset, self._offset)
+            print "%s: %i (0x%08X)" % (offset_str[1:-1], self._offset, self._offset)
 
     def parse_block(self, lang):
         for t, d in lang:



More information about the chirp_devel mailing list