diff --git a/gen_wrap.py b/gen_wrap.py index f6fa9c9c..5a6740fb 100644 --- a/gen_wrap.py +++ b/gen_wrap.py @@ -117,7 +117,7 @@ def __init__(self, name, class Method: def __init__(self, cls, name, c_name, return_semantics, return_base_type, return_ptr, - args, is_exported, is_constructor): + args, is_exported, is_constructor, is_internal): self.cls = cls self.name = name assert name @@ -128,6 +128,7 @@ def __init__(self, cls, name, c_name, self.args = args self.mutator_veto = False self.is_exported = is_exported + self.is_internal = is_internal self.is_constructor = is_constructor if not self.is_static: @@ -490,7 +491,7 @@ def get_preprocessed_header(self, fname): # {{{ read_header - def read_header(self, fname): + def read_header(self, fname, is_internal=False): lines = self.get_preprocessed_header(fname).split("\n") # heed continuations, split at semicolons @@ -562,13 +563,13 @@ def read_header(self, fname): line = lines[i].strip() if not STRUCT_DECL_RE.search(decl): - self.parse_decl(decl) + self.parse_decl(decl, is_internal) # }}} # {{{ parse_decl - def parse_decl(self, decl): + def parse_decl(self, decl, is_internal): decl_match = DECL_RE.match(decl) if decl_match is None: print(f"WARNING: func decl regexp not matched: {decl}") @@ -702,7 +703,8 @@ def parse_decl(self, decl): cls_meth_list.append(Method( class_name, name, c_name, return_semantics, return_base_type, return_ptr, - args, is_exported=is_exported, is_constructor=is_constructor)) + args, is_exported=is_exported, is_constructor=is_constructor, + is_internal=is_internal)) self.seen_c_names.add(c_name) @@ -1394,10 +1396,18 @@ def write_exposer(outf, meth, arg_names, doc_str): # doc_str = "(static method)\n" + doc_str if not meth.is_exported: - doc_str = doc_str + ( - "\n\n.. warning::\n\n " - "This function is not part of the officially public isl API. " - "Use at your own risk.") + if meth.is_internal: + doc_str = doc_str + ( + "\n\n.. warning::\n\n " + "This function is so internal, it is not even exposed in isl's " + "public headers. We declared it on our own, in hopes that " + "isl didn't change the functions prototype. " + "Really, if you have any sense at all, don't use this.") + else: + doc_str = doc_str + ( + "\n\n.. warning::\n\n " + "This function is not part of the officially public isl API. " + "Use at your own risk.") doc_str_arg = ', "{}"'.format(doc_str.replace("\n", "\\n")) @@ -1460,7 +1470,8 @@ def write_wrappers(expf, wrapf, methods): } -def gen_wrapper(include_dirs, include_barvinok=False, isl_version=None): +def gen_wrapper(include_dirs, include_barvinok=False, isl_version=None, + include_internal=False): fdata = FunctionData(["."] + include_dirs) fdata.read_header("isl/ctx.h") fdata.read_header("isl/id.h") @@ -1490,6 +1501,12 @@ def gen_wrapper(include_dirs, include_barvinok=False, isl_version=None): fdata.read_header("isl/ast_type.h") fdata.read_header("isl/ilp.h") + if include_internal: + # We're reaching deep into isl here, to functions that we're not + # supposed to touch. + fdata.include_dirs.append("isl") + fdata.read_header("isl_equalities.h", is_internal=True) + if include_barvinok: fdata.read_header("barvinok/isl.h") diff --git a/preproc-headers/4f8ba195debdf5174d2d60d5f94e1026eccd39580677961dd42e5c7fe8adb57f b/preproc-headers/4f8ba195debdf5174d2d60d5f94e1026eccd39580677961dd42e5c7fe8adb57f new file mode 100644 index 00000000..20077949 --- /dev/null +++ b/preproc-headers/4f8ba195debdf5174d2d60d5f94e1026eccd39580677961dd42e5c7fe8adb57f @@ -0,0 +1,19 @@ +#line 13 +#include +#include + + + + + +__isl_give isl_mat *isl_mat_final_variable_compression(__isl_take isl_mat *B, + int first, __isl_give isl_mat **T2); +__isl_give isl_mat *isl_mat_variable_compression(__isl_take isl_mat *B, + __isl_give isl_mat **T2); +__isl_give isl_mat *isl_mat_parameter_compression(__isl_take isl_mat *B, + __isl_take isl_vec *d); +__isl_give isl_mat *isl_mat_parameter_compression_ext(__isl_take isl_mat *B, + __isl_take isl_mat *A); +__isl_give isl_basic_set *isl_basic_set_remove_equalities( + __isl_take isl_basic_set *bset, __isl_give isl_mat **T, + __isl_give isl_mat **T2); diff --git a/setup.py b/setup.py index ea96a1b9..3a47bfa6 100644 --- a/setup.py +++ b/setup.py @@ -48,6 +48,8 @@ def get_config_schema(): Switch("USE_BARVINOK", False, "Include wrapper for Barvinok"), Switch("USE_IMATH_SIO", True, "When using imath, use small-integer " "optimization"), + Switch("INCLUDE_INTERNAL", True, "Expose infuriatingly useful " + "but sadly very internal functionality of isl"), IncludeDir("GMP", []), LibraryDir("GMP", []), @@ -264,7 +266,11 @@ def main(): exec(compile(version_py, init_filename, "exec"), conf) from gen_wrap import gen_wrapper - gen_wrapper(wrapper_dirs, include_barvinok=conf["USE_BARVINOK"]) + gen_wrapper(wrapper_dirs, include_barvinok=conf["USE_BARVINOK"], + include_internal=conf["INCLUDE_INTERNAL"]) + + if conf["INCLUDE_INTERNAL"]: + EXTRA_DEFINES["ISLPY_INCLUDE_ISL_INTERNAL_HEADERS"] = 1 with open("README.rst") as readme_f: readme = readme_f.read() diff --git a/src/wrapper/wrap_isl.hpp b/src/wrapper/wrap_isl.hpp index 5ab02c4b..ae8da369 100644 --- a/src/wrapper/wrap_isl.hpp +++ b/src/wrapper/wrap_isl.hpp @@ -27,6 +27,13 @@ #include #endif +#ifdef ISLPY_INCLUDE_ISL_INTERNAL_HEADERS +// Your scientists were so preoccupied with whether or not they could, they +// didn't stop to think if they should. +// -- Dr. Ian Malcolm +#include "../../isl/isl_equalities.h" +#endif + #include #include #include