'''
-import sys
+import sys, os
from u_format_parse import *
import u_format_pack
return False
return True
-def write_format_table(formats):
- print('/* This file is autogenerated by u_format_table.py from u_format.csv. Do not edit directly. */')
- print()
+def write_format_table_header(file):
+ print('/* This file is autogenerated by u_format_table.py from u_format.csv. Do not edit directly. */', file=file)
+ print(file=file)
# This will print the copyright message on the top of this file
- print(CopyRight.strip())
- print()
- print('#include "u_format.h"')
+ print(CopyRight.strip(), file=file)
+ print(file=file)
+ print('#include "util/format/u_format.h"', file=file)
+
+def write_format_table(formats):
+ write_format_table_header(sys.stdout)
print('#include "u_format_bptc.h"')
print('#include "u_format_s3tc.h"')
print('#include "u_format_rgtc.h"')
print('#include "u_format_latc.h"')
print('#include "u_format_etc.h"')
print()
+
+ write_format_table_header(sys.stdout2)
u_format_pack.generate(formats)
generate_table_getter("unpack_")
def main():
-
formats = []
+
+ sys.stdout2 = open(os.devnull, "w")
+
for arg in sys.argv[1:]:
+ if arg == '--header':
+ sys.stdout2 = sys.stdout
+ sys.stdout = open(os.devnull, "w")
+ continue
+
formats.extend(parse(arg))
- write_format_table(formats)
+ write_format_table(formats)
if __name__ == '__main__':
main()