1 import sys
, string
, utility
2 from process_line
import extract_data
4 def process_offset(original_line
, tokens
, offsets
):
12 tokens
= tokens
[0 : i
] + tokens
[i
+ 1 : ]
13 offset_target
= tokens
[i
]
15 address
= offsets
[offset_target
]
17 print 'Error: Unable to process offset in "%s"' % original_line
19 tokens
[i
] = '0%sh' % address
22 return uses_offset
, string
.join(tokens
)
24 def extract_offsets(lines
):
25 keywords
= ['proc', 'db', 'dw', 'dd']
30 section
, address
, line
= extract_data(line
)
31 line
= utility
.shrink(line
)
32 tokens
= line
.split(' ')
33 if len(tokens
) >= 2 and tokens
[1] in keywords
:
35 offsets
[name
] = address
36 print 'Parsed %d offsets' % len(offsets
)