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

Tom Hayward
Fri Mar 22 12:40:22 PDT 2013


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

diff -r ca76c7af25c7 -r 665669066a8d chirp/bitwise.py
--- a/chirp/bitwise.py	Thu Mar 14 16:55:57 2013 -0700
+++ b/chirp/bitwise.py	Fri Mar 22 12:29:44 2013 -0700
@@ -732,20 +732,14 @@
 
     def parse_directive(self, directive):
         name = directive[0][0]
+        value = directive[0][1][0][1]
         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
+            self._offset = int(value, 0)
         elif name == "seek":
-            offset = int(directive[0][1][0][1])
-            self._offset += offset
+            self._offset += int(value, 0)
         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)" % (value[1:-1], self._offset, self._offset)
 
     def parse_block(self, lang):
         for t, d in lang:



More information about the chirp_devel mailing list