]> xenbits.xensource.com Git - seabios.git/commitdiff
acpi_extract: Make the generated .hex files more human readable
authorKevin O'Connor <kevin@koconnor.net>
Tue, 17 Nov 2015 23:36:17 +0000 (18:36 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 19 Nov 2015 13:48:34 +0000 (08:48 -0500)
Add a comment to the top of the generated file indicating that is is
an automatically generated file.  Compress output so that up to eight
hex values are placed on a single line.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
scripts/acpi_extract.py

index 24ff0d138a2ff47c1cfbeafd5c59afbb988b66c3..3ed863b6a79412a1276bb905d08f92bd677e9e09 100755 (executable)
@@ -346,14 +346,21 @@ def main():
     debug = "at end of file"
 
     # Pretty print output
+    outstrs = ["/* DO NOT EDIT!  This is an autogenerated file."
+               "  See scripts/acpi_extract.py. */"]
     for array in output.keys():
         otype = get_value_type(max(output[array]))
+        outstrs.append("static unsigned %s %s[] = {" % (otype, array))
         odata = []
         for value in output[array]:
-            odata.append("0x%x" % value)
-        sys.stdout.write("static unsigned %s %s[] = {\n" % (otype, array))
-        sys.stdout.write(",\n".join(odata))
-        sys.stdout.write('\n};\n')
+            odata.append("0x%02x" % value)
+            if len(odata) >= 8:
+                outstrs.append("    %s," % (', '.join(odata),))
+                del odata[:]
+        outstrs.append("    %s" % (', '.join(odata),))
+        outstrs.append('};')
+        outstrs.append('')
+    sys.stdout.write('\n'.join(outstrs))
 
 if __name__ == '__main__':
     main()