File: mk_pat_db.py

package info (click to toggle)
z3 4.13.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,364 kB
  • sloc: cpp: 501,803; python: 16,788; cs: 10,567; java: 9,687; ml: 3,282; ansic: 2,531; sh: 162; javascript: 37; makefile: 32
file content (29 lines) | stat: -rwxr-xr-x 810 bytes parent folder | download | duplicates (2)
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
# -- /usr/bin/env python
"""
Reads a pattern database and generates the corresponding
header file.
"""
import mk_genfile_common
import argparse
import logging
import os
import sys

def main(args):
    logging.basicConfig(level=logging.INFO)
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("db_file", help="pattern database file")
    parser.add_argument("output_file", help="output header file path")
    pargs = parser.parse_args(args)

    if not os.path.exists(pargs.db_file):
        logging.error('"{}" does not exist'.format(pargs.db_file))
        return 1

    mk_genfile_common.mk_pat_db_internal(pargs.db_file, pargs.output_file)
    logging.info('Generated "{}"'.format(pargs.output_file))
    return 0

if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))