Beispiel #1
0
def convert_file(filename):
    converter = Converter()
    items = converter.do_file(filename)
    header = next(items)
    #We exhaust the iterator because the converter data is only there afterwards.
    lines = list(items)
    return lines, converter.unknown_tokens, converter.bytes_read, header
Beispiel #2
0
def output_file(filename):
    converter = Converter()
    items = converter.do_file(filename)
    header = next(items)
    try:
        [print(line) for line in items]
    finally:
        print("Code Bytes read", converter.bytes_read, "of", header['length'])
        if converter.unknown_tokens:
            print("Found %d unknown tokens" % converter.unknown_tokens)
    if converter.unknown_tokens == 0 and converter.bytes_read == header[
            'length']:
        print("All tokens translated")