File: do_doc_convert.py

package info (click to toggle)
cbmc 6.6.0-4
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 153,852 kB
  • sloc: cpp: 386,459; ansic: 114,466; java: 28,405; python: 6,003; yacc: 4,552; makefile: 4,041; lex: 2,487; xml: 2,388; sh: 2,050; perl: 557; pascal: 184; javascript: 163; ada: 36
file content (40 lines) | stat: -rw-r--r-- 1,265 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from reformat_docs import convert_file
from os import walk
from os.path import join
from sys import exit
from re import match

"""
Run this from CBMC's top-level directory.
"""

def main():
    IGNORE_LIST = [
            r'src/big-int/.*',
            r'src/miniz/.*',
            r'src/ansi-c/arm_builtin_headers.h',
            r'src/ansi-c/clang_builtin_headers.h',
            r'src/ansi-c/cw_builtin_headers.h',
            r'src/ansi-c/gcc_builtin_headers_alpha.h',
            r'src/ansi-c/gcc_builtin_headers_arm.h',
            r'src/ansi-c/gcc_builtin_headers_generic.h',
            r'src/ansi-c/gcc_builtin_headers_ia32-2.h',
            r'src/ansi-c/gcc_builtin_headers_ia32.h',
            r'src/ansi-c/gcc_builtin_headers_mips.h',
            r'src/ansi-c/gcc_builtin_headers_power.h',
            r'src/ansi-c/library/cprover.h']

    MATCH_EXPR = r'.*\.(h|cpp)'

    for root, dirs, files in walk('src'):
        for file in files:
            path = join(root, file)
            if any(map(lambda x: match(x, path), IGNORE_LIST)):
                print 'ignoring', path
                continue
            if not match(MATCH_EXPR, path):
                continue
            convert_file(path, True)

if __name__ == '__main__':
    exit(main())