|
| 1 | +from reformat_docs import convert_file |
| 2 | +from os import walk |
| 3 | +from os.path import join |
| 4 | +from sys import exit |
| 5 | +from re import match |
| 6 | + |
| 7 | +""" |
| 8 | +Run this from CBMC's top-level directory. |
| 9 | +""" |
| 10 | + |
| 11 | +def main(): |
| 12 | + IGNORE_LIST = [ |
| 13 | + r'src/big-int/.*', |
| 14 | + r'src/miniz/.*', |
| 15 | + r'src/ansi-c/arm_builtin_headers.h', |
| 16 | + r'src/ansi-c/clang_builtin_headers.h', |
| 17 | + r'src/ansi-c/cw_builtin_headers.h', |
| 18 | + r'src/ansi-c/gcc_builtin_headers_alpha.h', |
| 19 | + r'src/ansi-c/gcc_builtin_headers_arm.h', |
| 20 | + r'src/ansi-c/gcc_builtin_headers_generic.h', |
| 21 | + r'src/ansi-c/gcc_builtin_headers_ia32-2.h', |
| 22 | + r'src/ansi-c/gcc_builtin_headers_ia32.h', |
| 23 | + r'src/ansi-c/gcc_builtin_headers_mips.h', |
| 24 | + r'src/ansi-c/gcc_builtin_headers_power.h', |
| 25 | + r'src/ansi-c/library/cprover.h'] |
| 26 | + |
| 27 | + MATCH_EXPR = r'.*\.(h|cpp)' |
| 28 | + |
| 29 | + for root, dirs, files in walk('src'): |
| 30 | + for file in files: |
| 31 | + path = join(root, file) |
| 32 | + if any(map(lambda x: match(x, path), IGNORE_LIST)): |
| 33 | + print 'ignoring', path |
| 34 | + continue |
| 35 | + if not match(MATCH_EXPR, path): |
| 36 | + continue |
| 37 | + convert_file(path, True) |
| 38 | + |
| 39 | +if __name__ == '__main__': |
| 40 | + exit(main()) |
0 commit comments