3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-06 22:23:22 +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:
Dan Liew 2016-02-27 22:31:19 +00:00
parent 9558dc14fb
commit ef58179462
2 changed files with 46 additions and 9 deletions

View file

@ -2602,16 +2602,19 @@ def exec_pyg_scripts():
# database.smt ==> database.h
def mk_pat_db():
c = get_component(PATTERN_COMPONENT)
fin = open(os.path.join(c.src_dir, 'database.smt2'), 'r')
fout = open(os.path.join(c.src_dir, 'database.h'), 'w')
fout.write('static char const g_pattern_database[] =\n')
for line in fin:
fout.write('"%s\\n"\n' % line.strip('\n'))
fout.write(';\n')
fin.close()
fout.close()
fin = os.path.join(c.src_dir, 'database.smt2')
fout = os.path.join(c.src_dir, 'database.h')
mk_pat_db_internal(fin, fout)
def mk_pat_db_internal(inputFilePath, outputFilePath):
with open(inputFilePath, 'r') as fin:
with open(outputFilePath, 'w') as fout:
fout.write('static char const g_pattern_database[] =\n')
for line in fin:
fout.write('"%s\\n"\n' % line.strip('\n'))
fout.write(';\n')
if VERBOSE:
print("Generated '%s'" % os.path.join(c.src_dir, 'database.h'))
print("Generated '%s'" % outputFilePath)
# Update version numbers
def update_version():