mirror of
https://github.com/Z3Prover/z3
synced 2025-04-22 16:45:31 +00:00
Add high level bindings for js (#6048)
* [Draft] Added unfinished code for high level bindings for js * * Rewrote structure of js api files * Added more high level apis * Minor fixes * Fixed wasm github action * Fix JS test * Removed ContextOptions type * * Added Ints to JS Api * Added tests to JS Api * Added run-time checks for contexts * Removed default contexts * Merged Context and createContext so that the api behaves the sames as in other constructors * Added a test for Solver * Added Reals * Added classes for IntVals and RealVals * Added abillity to specify logic for solver * Try to make CI tests not fail * Changed APIs after a round of review * Fix test * Added BitVectors * Made sort into getter * Added initial JS docs * Added more coercible types * Removed done TODOs
This commit is contained in:
parent
3d00d1d56b
commit
7fdcbbaee9
37 changed files with 15973 additions and 643 deletions
|
@ -14,11 +14,13 @@ import subprocess
|
|||
|
||||
ML_ENABLED=False
|
||||
MLD_ENABLED=False
|
||||
JS_ENABLED=False
|
||||
BUILD_DIR='../build'
|
||||
DOXYGEN_EXE='doxygen'
|
||||
TEMP_DIR=os.path.join(os.getcwd(), 'tmp')
|
||||
OUTPUT_DIRECTORY=os.path.join(os.getcwd(), 'api')
|
||||
Z3PY_PACKAGE_PATH='../src/api/python/z3'
|
||||
JS_API_PATH='../src/api/js'
|
||||
Z3PY_ENABLED=True
|
||||
DOTNET_ENABLED=True
|
||||
JAVA_ENABLED=True
|
||||
|
@ -28,8 +30,8 @@ SCRIPT_DIR=os.path.abspath(os.path.dirname(__file__))
|
|||
|
||||
def parse_options():
|
||||
global ML_ENABLED, MLD_ENABLED, BUILD_DIR, DOXYGEN_EXE, TEMP_DIR, OUTPUT_DIRECTORY
|
||||
global Z3PY_PACKAGE_PATH, Z3PY_ENABLED, DOTNET_ENABLED, JAVA_ENABLED
|
||||
global DOTNET_API_SEARCH_PATHS, JAVA_API_SEARCH_PATHS
|
||||
global Z3PY_PACKAGE_PATH, Z3PY_ENABLED, DOTNET_ENABLED, JAVA_ENABLED, JS_ENABLED
|
||||
global DOTNET_API_SEARCH_PATHS, JAVA_API_SEARCH_PATHS, JS_API_PATH
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('-b',
|
||||
'--build',
|
||||
|
@ -46,6 +48,11 @@ def parse_options():
|
|||
default=False,
|
||||
help='Include ML/OCaml API documentation'
|
||||
)
|
||||
parser.add_argument('--js',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Include JS/TS API documentation'
|
||||
)
|
||||
parser.add_argument('--doxygen-executable',
|
||||
dest='doxygen_executable',
|
||||
default=DOXYGEN_EXE,
|
||||
|
@ -104,6 +111,7 @@ def parse_options():
|
|||
pargs = parser.parse_args()
|
||||
ML_ENABLED = pargs.ml
|
||||
MLD_ENABLED = pargs.mld
|
||||
JS_ENABLED = pargs.js
|
||||
BUILD_DIR = pargs.build
|
||||
DOXYGEN_EXE = pargs.doxygen_executable
|
||||
TEMP_DIR = pargs.temp_dir
|
||||
|
@ -224,6 +232,10 @@ try:
|
|||
print("Java documentation disabled")
|
||||
doxygen_config_substitutions['JAVA_API_FILES'] = ''
|
||||
doxygen_config_substitutions['JAVA_API_SEARCH_PATHS'] = ''
|
||||
if JS_ENABLED:
|
||||
print('Javascript documentation enabled')
|
||||
else:
|
||||
print('Javascript documentation disabled')
|
||||
|
||||
doxygen_config_file = temp_path('z3api.cfg')
|
||||
configure_file(
|
||||
|
@ -241,7 +253,7 @@ try:
|
|||
'{prefix}<a class="el" href="z3__api_8h.html">C API</a> '
|
||||
).format(
|
||||
prefix=bullet_point_prefix)
|
||||
|
||||
|
||||
if Z3PY_ENABLED:
|
||||
print("Python documentation enabled")
|
||||
website_dox_substitutions['PYTHON_API'] = (
|
||||
|
@ -274,6 +286,13 @@ try:
|
|||
prefix=bullet_point_prefix)
|
||||
else:
|
||||
website_dox_substitutions['OCAML_API'] = ''
|
||||
if JS_ENABLED:
|
||||
website_dox_substitutions['JS_API'] = (
|
||||
'{prefix}<a class="el" href="js/index.html">Javascript/Typescript API</a>'
|
||||
).format(
|
||||
prefix=bullet_point_prefix)
|
||||
else:
|
||||
website_dox_substitutions['JS_API'] = ''
|
||||
configure_file(
|
||||
doc_path('website.dox.in'),
|
||||
temp_path('website.dox'),
|
||||
|
@ -339,6 +358,18 @@ try:
|
|||
exit(1)
|
||||
print("Generated ML/OCaml documentation.")
|
||||
|
||||
if JS_ENABLED:
|
||||
try:
|
||||
subprocess.check_output(['npm', 'run', '--prefix=%s' % JS_API_PATH, 'check-engine'])
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("ERROR: node version check failed.")
|
||||
print(e.output)
|
||||
exit(1)
|
||||
if subprocess.call(['npm', 'run', '--prefix=%s' % JS_API_PATH, 'docs']) != 0:
|
||||
print("ERROR: npm run docs failed.")
|
||||
exit(1)
|
||||
print("Generated Javascript documentation.")
|
||||
|
||||
print("Documentation was successfully generated at subdirectory '{}'.".format(OUTPUT_DIRECTORY))
|
||||
except Exception:
|
||||
exctype, value = sys.exc_info()[:2]
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/**
|
||||
\mainpage An Efficient Theorem Prover
|
||||
|
||||
|
||||
Z3 is a high-performance theorem prover being developed at <a class="el"
|
||||
href="http://research.microsoft.com">Microsoft Research</a>.
|
||||
|
||||
href="http://research.microsoft.com">Microsoft Research</a>.
|
||||
|
||||
<b>The Z3 website is at <a class="el" href="http://github.com/z3prover">http://github.com/z3prover</a>.</b>
|
||||
|
||||
This website hosts the automatically generated documentation for the Z3 APIs.
|
||||
|
||||
- \ref @C_API@
|
||||
- \ref @CPP_API@ @DOTNET_API@ @JAVA_API@ @PYTHON_API@ @OCAML_API@
|
||||
- \ref @CPP_API@ @DOTNET_API@ @JAVA_API@ @PYTHON_API@ @OCAML_API@ @JS_API@
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue