-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor
mk_z3consts_py()
to that is usable externally via a new
function ``mk_z3consts_py_internal()`` which called by a new ``mk_consts_files.py`` script. This will script will allow the const declarations for the different Z3 language bindings to be generated. Right now only support for python is implemented but more can be added in the future.
- Loading branch information
Dan Liew
committed
Mar 4, 2016
1 parent
f6e9464
commit 8bc7d31
Showing
2 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Reads a list of Z3 API header files and | ||
generate the constant declarations need | ||
by one or more Z3 language bindings | ||
""" | ||
import mk_util | ||
import argparse | ||
import logging | ||
import os | ||
import sys | ||
|
||
def check_dir(output_dir): | ||
if not os.path.isdir(output_dir): | ||
logging.error('"{}" is not an existing directory'.format(output_dir)) | ||
return 1 | ||
return 0 | ||
|
||
def main(args): | ||
logging.basicConfig(level=logging.INFO) | ||
parser = argparse.ArgumentParser(description=__doc__) | ||
parser.add_argument("api_files", nargs="+") | ||
parser.add_argument("--z3py-output-dir", dest="z3py_output_dir", default=None) | ||
pargs = parser.parse_args(args) | ||
|
||
for api_file in pargs.api_files: | ||
if not os.path.exists(api_file): | ||
logging.error('"{}" does not exist'.format(api_file)) | ||
return 1 | ||
|
||
count = 0 | ||
|
||
if pargs.z3py_output_dir: | ||
if check_dir(pargs.z3py_output_dir) != 0: | ||
return 1 | ||
mk_util.mk_z3consts_py_internal(pargs.api_files, pargs.z3py_output_dir) | ||
count += 1 | ||
|
||
if count == 0: | ||
logging.info('No files generated. You need to specific an output directory' | ||
' for the relevant langauge bindings') | ||
# TODO: Add support for other bindings | ||
return 0 | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main(sys.argv[1:])) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters