mirror of
https://github.com/Z3Prover/z3
synced 2025-07-22 20:32:05 +00:00
Refactor `mk_pat_db()
` so that it is usable externally via a new function
``mk_pat_db_internal()`` which is called by a new ``mk_pat_db.py`` script. This will allow other build systems to generate the ``database.h`` file.
This commit is contained in:
parent
9558dc14fb
commit
ef58179462
2 changed files with 46 additions and 9 deletions
34
scripts/mk_pat_db.py
Executable file
34
scripts/mk_pat_db.py
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Reads a pattern database and generates the corresponding
|
||||
header file.
|
||||
"""
|
||||
import mk_util
|
||||
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
|
||||
|
||||
if (os.path.exists(pargs.output_file) and
|
||||
not os.path.isfile(pargs.output_file)):
|
||||
logging.error('Refusing to overwrite "{}"'.format(
|
||||
pargs.output_file))
|
||||
return 1
|
||||
|
||||
mk_util.mk_pat_db_internal(pargs.db_file, pargs.output_file)
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue