Explorar el Código

Added option to save original assembly for easy comparison.

Taddeus Kroes hace 14 años
padre
commit
43a4e07d11
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  1. 10 1
      main.py

+ 10 - 1
main.py

@@ -7,11 +7,20 @@ if __name__ == '__main__':
     from sys import argv, exit
 
     if len(argv) < 2:
-        print 'Usage: python %s FILE' % argv[0]
+        print 'Usage: python %s SOURCE_FILE [ OUT_FILE [ SOURCE_OUT_FILE ] ]' \
+                % argv[0]
         exit(1)
 
     # Parse File
     original = parse_file(argv[1])
+
+    if len(argv) > 3:
+        # Save input assembly in new file for easy comparison
+        out = write_statements(original)
+        f = open(argv[3], 'w+')
+        f.write(out)
+        f.close()
+
     optimized = optimize(original, verbose=1)
 
     if len(argv) > 2: