| 1 | package Z3::FFI; | ||
| 2 | |||
| 3 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | our $VERSION = '0.003'; | ||
| 7 | |||
| 8 | 5 | ▶ | use Data::Dumper; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 5 | ▶ | use FFI::Platypus; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 5 | ▶ | use FFI::CheckLib qw//; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 5 | ▶ | use FFI::Platypus::API qw/arguments_get_string/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 5 | ▶ | use File::ShareDir qw/dist_dir/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 5 | ▶ | use Path::Tiny; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | my $search_path = path(dist_dir('Alien-Z3'))->child('dynamic'); | ||
| 16 | my $ffi_lib = FFI::CheckLib::find_lib_or_die(lib => 'z3', libpath => $search_path); | ||
| 17 | my $ffi = FFI::Platypus->new(); | ||
| 18 | $ffi->lib($ffi_lib); | ||
| 19 | |||
| 20 | 5 | ▶ | use constant { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | # Z3_bool | ||
| 22 | 5 | Z3_TRUE => 1, | |
| 23 | Z3_FALSE => 0, | ||
| 24 | # Z3_lbool | ||
| 25 | Z3_L_FALSE => -1, | ||
| 26 | Z3_L_UNDEF => 0, | ||
| 27 | Z3_L_TRUE => 1, | ||
| 28 | # Z3_symbol_kind | ||
| 29 | Z3_INT_SYMBOL => 0, | ||
| 30 | Z3_STRING_SYMBOL => 1, | ||
| 31 | # Z3_paramter_kind | ||
| 32 | Z3_PARAMETER_INT => 0, | ||
| 33 | Z3_PARAMETER_DOUBLE => 1, | ||
| 34 | Z3_PARAMETER_RATIONAL => 2, | ||
| 35 | Z3_PARAMETER_SYMBOL => 3, | ||
| 36 | Z3_PARAMETER_SORT => 4, | ||
| 37 | Z3_PARAMETER_AST => 5, | ||
| 38 | Z3_PARAMETER_FUNC_DECL => 6, | ||
| 39 | # Z3_sort_kind | ||
| 40 | Z3_UNINTERRUPTED_SORT => 0, | ||
| 41 | Z3_BOOL_SORT => 1, | ||
| 42 | Z3_INT_SORT => 2, | ||
| 43 | Z3_REAL_SORT => 3, | ||
| 44 | Z3_BV_SORT => 4, | ||
| 45 | Z3_ARRAY_SORT => 5, | ||
| 46 | Z3_DATATYPE_SORT => 6, | ||
| 47 | Z3_RELATION_SORT => 7, | ||
| 48 | Z3_FINITE_DOMAIN_SORT => 8, | ||
| 49 | Z3_FLOATING_POINT_SORT => 9, | ||
| 50 | Z3_ROUNDING_MODE_SORT => 10, | ||
| 51 | Z3_SEQ_SORT => 11, | ||
| 52 | Z3_RE_SORT => 12, | ||
| 53 | Z3_UNKNOWN_SORT => 1000, | ||
| 54 | # Z3_ast_kind | ||
| 55 | Z3_NUMERAL_AST => 0, | ||
| 56 | Z3_APP_AST => 1, | ||
| 57 | Z3_VAR_AST => 2, | ||
| 58 | Z3_QUANTIFIER_AST => 3, | ||
| 59 | Z3_SORT_AST => 4, | ||
| 60 | Z3_FUNC_DECL_AST => 5, | ||
| 61 | Z3_UNKNOWN_AST => 1000, | ||
| 62 | # Z3_param_kind | ||
| 63 | Z3_PK_UINT => 0, | ||
| 64 | Z3_PK_BOOL => 1, | ||
| 65 | Z3_PK_DOUBLE => 2, | ||
| 66 | Z3_PK_SYMBOL => 3, | ||
| 67 | Z3_PK_STRING => 4, | ||
| 68 | Z3_PK_OTHER => 5, | ||
| 69 | Z3_PK_INVALID => 6, | ||
| 70 | # Z3_ast_print_mode | ||
| 71 | Z3_PRINT_SMTLIB_FULL => 0, | ||
| 72 | Z3_PRINT_LOW_LEVEL => 1, | ||
| 73 | Z3_PRINT_SMTLIB2_COMPLIANT => 2, | ||
| 74 | # Z3_error_code | ||
| 75 | Z3_OK => 0, | ||
| 76 | Z3_SORT_ERROR => 1, | ||
| 77 | Z3_IOB => 2, | ||
| 78 | Z3_INVALID_ARG => 3, | ||
| 79 | Z3_PARSER_ERROR => 4, | ||
| 80 | Z3_NO_PARSER => 5, | ||
| 81 | Z3_INVALID_PATTERN => 6, | ||
| 82 | Z3_MEMOUT_FAIL => 7, | ||
| 83 | Z3_FILE_ACCESS_ERROR => 8, | ||
| 84 | Z3_INTERNAL_FATAL => 9, | ||
| 85 | Z3_INVALID_USAGE => 10, | ||
| 86 | Z3_DEC_REF_ERROR => 11, | ||
| 87 | Z3_EXCEPTION => 12, | ||
| 88 | # Z3_goal_prec | ||
| 89 | Z3_GOAL_PRECISE => 0, | ||
| 90 | Z3_GOAL_UNDER => 1, | ||
| 91 | Z3_GOAL_OVER => 2, | ||
| 92 | Z3_GOAL_UNDER_OVER => 3, | ||
| 93 | # Z3_decl_kind | ||
| 94 | Z3_OP_TRUE => 256, Z3_OP_FALSE => 257, Z3_OP_EQ => 258, Z3_OP_DISTINCT => 259, | ||
| 95 | Z3_OP_ITE => 260, Z3_OP_AND => 261, Z3_OP_OR => 262, Z3_OP_IFF => 263, | ||
| 96 | Z3_OP_XOR => 264, Z3_OP_NOT => 265, Z3_OP_IMPLIES => 266, Z3_OP_OEQ => 267, | ||
| 97 | Z3_OP_ANUM => 512, Z3_OP_AGNUM => 513, Z3_OP_LE => 514, Z3_OP_GE => 515, | ||
| 98 | Z3_OP_LT => 516, Z3_OP_GT => 517, Z3_OP_ADD => 518, Z3_OP_SUB => 519, | ||
| 99 | Z3_OP_UMINUS => 520, Z3_OP_MUL => 521, Z3_OP_DIV => 522, Z3_OP_IDIV => 523, | ||
| 100 | Z3_OP_REM => 524, Z3_OP_MOD => 525, Z3_OP_TO_REAL => 526, Z3_OP_TO_INT => 527, | ||
| 101 | Z3_OP_IS_INT => 528, Z3_OP_POWER => 529, Z3_OP_STORE => 768, Z3_OP_SELECT => 769, | ||
| 102 | Z3_OP_CONST_ARRAY => 770, Z3_OP_ARRAY_MAP => 771, Z3_OP_ARRAY_DEFAULT => 772, Z3_OP_SET_UNION => 773, | ||
| 103 | Z3_OP_SET_INTERSECT => 774, Z3_OP_SET_DIFFERENCE => 775, Z3_OP_SET_COMPLEMENT => 776, Z3_OP_SET_SUBSET => 777, | ||
| 104 | Z3_OP_AS_ARRAY => 778, Z3_OP_ARRAY_EXT => 779, Z3_OP_BNUM => 1024, Z3_OP_BIT1 => 1025, | ||
| 105 | Z3_OP_BIT0 => 1026, Z3_OP_BNEG => 1027, Z3_OP_BADD => 1028, Z3_OP_BSUB => 1029, | ||
| 106 | Z3_OP_BMUL => 1030, Z3_OP_BSDIV => 1031, Z3_OP_BUDIV => 1032, Z3_OP_BSREM => 1033, | ||
| 107 | Z3_OP_BUREM => 1034, Z3_OP_BSMOD => 1035, Z3_OP_BSDIV0 => 1036, Z3_OP_BUDIV0 => 1037, | ||
| 108 | Z3_OP_BSREM0 => 1038, Z3_OP_BUREM0 => 1039, Z3_OP_BSMOD0 => 1040, Z3_OP_ULEQ => 1041, | ||
| 109 | Z3_OP_SLEQ => 1042, Z3_OP_UGEQ => 1043, Z3_OP_SGEQ => 1044, Z3_OP_ULT => 1045, | ||
| 110 | Z3_OP_SLT => 1046, Z3_OP_UGT => 1047, Z3_OP_SGT => 1048, Z3_OP_BAND => 1049, | ||
| 111 | Z3_OP_BOR => 1050, Z3_OP_BNOT => 1051, Z3_OP_BXOR => 1052, Z3_OP_BNAND => 1053, | ||
| 112 | Z3_OP_BNOR => 1054, Z3_OP_BXNOR => 1055, Z3_OP_CONCAT => 1056, Z3_OP_SIGN_EXT => 1057, | ||
| 113 | Z3_OP_ZERO_EXT => 1058, Z3_OP_EXTRACT => 1059, Z3_OP_REPEAT => 1060, Z3_OP_BREDOR => 1061, | ||
| 114 | Z3_OP_BREDAND => 1062, Z3_OP_BCOMP => 1063, Z3_OP_BSHL => 1064, Z3_OP_BLSHR => 1065, | ||
| 115 | Z3_OP_BASHR => 1066, Z3_OP_ROTATE_LEFT => 1067, Z3_OP_ROTATE_RIGHT => 1068, Z3_OP_EXT_ROTATE_LEFT => 1069, | ||
| 116 | Z3_OP_EXT_ROTATE_RIGHT => 1070, Z3_OP_BIT2BOOL => 1071, Z3_OP_INT2BV => 1072, Z3_OP_BV2INT => 1073, | ||
| 117 | Z3_OP_CARRY => 1074, Z3_OP_XOR3 => 1075, Z3_OP_BSMUL_NO_OVFL => 1076, Z3_OP_BUMUL_NO_OVFL => 1077, | ||
| 118 | Z3_OP_BSMUL_NO_UDFL => 1078, Z3_OP_BSDIV_I => 1079, Z3_OP_BUDIV_I => 1080, Z3_OP_BSREM_I => 1081, | ||
| 119 | Z3_OP_BUREM_I => 1082, Z3_OP_BSMOD_I => 1083, Z3_OP_PR_UNDEF => 1280, Z3_OP_PR_TRUE => 1281, | ||
| 120 | Z3_OP_PR_ASSERTED => 1282, Z3_OP_PR_GOAL => 1283, Z3_OP_PR_MODUS_PONENS => 1284, Z3_OP_PR_REFLEXIVITY => 1285, | ||
| 121 | Z3_OP_PR_SYMMETRY => 1286, Z3_OP_PR_TRANSITIVITY => 1287, Z3_OP_PR_TRANSITIVITY_STAR => 1288, Z3_OP_PR_MONOTONICITY => 1289, | ||
| 122 | Z3_OP_PR_QUANT_INTRO => 1290, Z3_OP_PR_BIND => 1291, Z3_OP_PR_DISTRIBUTIVITY => 1292, Z3_OP_PR_AND_ELIM => 1293, | ||
| 123 | Z3_OP_PR_NOT_OR_ELIM => 1294, Z3_OP_PR_REWRITE => 1295, Z3_OP_PR_REWRITE_STAR => 1296, Z3_OP_PR_PULL_QUANT => 1297, | ||
| 124 | Z3_OP_PR_PUSH_QUANT => 1298, Z3_OP_PR_ELIM_UNUSED_VARS => 1299, Z3_OP_PR_DER => 1300, Z3_OP_PR_QUANT_INST => 1301, | ||
| 125 | Z3_OP_PR_HYPOTHESIS => 1302, Z3_OP_PR_LEMMA => 1303, Z3_OP_PR_UNIT_RESOLUTION => 1304, Z3_OP_PR_IFF_TRUE => 1305, | ||
| 126 | Z3_OP_PR_IFF_FALSE => 1306, Z3_OP_PR_COMMUTATIVITY => 1307, Z3_OP_PR_DEF_AXIOM => 1308, Z3_OP_PR_DEF_INTRO => 1309, | ||
| 127 | Z3_OP_PR_APPLY_DEF => 1310, Z3_OP_PR_IFF_OEQ => 1311, Z3_OP_PR_NNF_POS => 1312, Z3_OP_PR_NNF_NEG => 1313, | ||
| 128 | Z3_OP_PR_SKOLEMIZE => 1314, Z3_OP_PR_MODUS_PONENS_OEQ => 1315, Z3_OP_PR_TH_LEMMA => 1316, Z3_OP_PR_HYPER_RESOLVE => 1317, | ||
| 129 | Z3_OP_RA_STORE => 1536, Z3_OP_RA_EMPTY => 1537, Z3_OP_RA_IS_EMPTY => 1538, Z3_OP_RA_JOIN => 1539, | ||
| 130 | Z3_OP_RA_UNION => 1540, Z3_OP_RA_WIDEN => 1541, Z3_OP_RA_PROJECT => 1542, Z3_OP_RA_FILTER => 1543, | ||
| 131 | Z3_OP_RA_NEGATION_FILTER => 1544, Z3_OP_RA_RENAME => 1545, Z3_OP_RA_COMPLEMENT => 1546, Z3_OP_RA_SELECT => 1547, | ||
| 132 | Z3_OP_RA_CLONE => 1548, Z3_OP_FD_CONSTANT => 1549, Z3_OP_FD_LT => 1550, Z3_OP_SEQ_UNIT => 1551, | ||
| 133 | Z3_OP_SEQ_EMPTY => 1552, Z3_OP_SEQ_CONCAT => 1553, Z3_OP_SEQ_PREFIX => 1554, Z3_OP_SEQ_SUFFIX => 1555, | ||
| 134 | Z3_OP_SEQ_CONTAINS => 1556, Z3_OP_SEQ_EXTRACT => 1557, Z3_OP_SEQ_REPLACE => 1558, Z3_OP_SEQ_AT => 1559, | ||
| 135 | Z3_OP_SEQ_LENGTH => 1560, Z3_OP_SEQ_INDEX => 1561, Z3_OP_SEQ_TO_RE => 1562, Z3_OP_SEQ_IN_RE => 1563, | ||
| 136 | Z3_OP_STR_TO_INT => 1564, Z3_OP_INT_TO_STR => 1565, Z3_OP_RE_PLUS => 1566, Z3_OP_RE_STAR => 1567, | ||
| 137 | Z3_OP_RE_OPTION => 1568, Z3_OP_RE_CONCAT => 1569, Z3_OP_RE_UNION => 1570, Z3_OP_RE_RANGE => 1571, | ||
| 138 | Z3_OP_RE_LOOP => 1572, Z3_OP_RE_INTERSECT => 1573, Z3_OP_RE_EMPTY_SET => 1574, Z3_OP_RE_FULL_SET => 1575, | ||
| 139 | Z3_OP_RE_COMPLEMENT => 1576, Z3_OP_LABEL => 1792, Z3_OP_LABEL_LIT => 1793, Z3_OP_DT_CONSTRUCTOR => 2048, | ||
| 140 | Z3_OP_DT_RECOGNISER => 2049, Z3_OP_DT_IS => 2050, Z3_OP_DT_ACCESSOR => 2051, Z3_OP_DT_UPDATE_FIELD => 2052, | ||
| 141 | Z3_OP_PB_AT_MOST => 2304, Z3_OP_PB_AT_LEAST => 2305, Z3_OP_PB_LE => 2306, Z3_OP_PB_GE => 2307, | ||
| 142 | Z3_OP_PB_EQ => 2308, Z3_OP_FPA_RM_NEAREST_TIES_TO_EVEN => 2309, Z3_OP_FPA_RM_NEAREST_TIES_TO_AWAY => 2310, Z3_OP_FPA_RM_TOWARD_POSITIVE => 2311, | ||
| 143 | Z3_OP_FPA_RM_TOWARD_NEGATIVE => 2312, Z3_OP_FPA_RM_TOWARD_ZERO => 2313, Z3_OP_FPA_NUM => 2314, Z3_OP_FPA_PLUS_INF => 2315, | ||
| 144 | Z3_OP_FPA_MINUS_INF => 2316, Z3_OP_FPA_NAN => 2317, Z3_OP_FPA_PLUS_ZERO => 2318, Z3_OP_FPA_MINUS_ZERO => 2319, | ||
| 145 | Z3_OP_FPA_ADD => 2320, Z3_OP_FPA_SUB => 2321, Z3_OP_FPA_NEG => 2322, Z3_OP_FPA_MUL => 2323, | ||
| 146 | Z3_OP_FPA_DIV => 2324, Z3_OP_FPA_REM => 2325, Z3_OP_FPA_ABS => 2326, Z3_OP_FPA_MIN => 2327, | ||
| 147 | Z3_OP_FPA_MAX => 2328, Z3_OP_FPA_FMA => 2329, Z3_OP_FPA_SQRT => 2330, Z3_OP_FPA_ROUND_TO_INTEGRAL => 2331, | ||
| 148 | Z3_OP_FPA_EQ => 2332, Z3_OP_FPA_LT => 2333, Z3_OP_FPA_GT => 2334, Z3_OP_FPA_LE => 2335, | ||
| 149 | Z3_OP_FPA_GE => 2336, Z3_OP_FPA_IS_NAN => 2337, Z3_OP_FPA_IS_INF => 2338, Z3_OP_FPA_IS_ZERO => 2339, | ||
| 150 | Z3_OP_FPA_IS_NORMAL => 2340, Z3_OP_FPA_IS_SUBNORMAL => 2341, Z3_OP_FPA_IS_NEGATIVE => 2342, Z3_OP_FPA_IS_POSITIVE => 2343, | ||
| 151 | Z3_OP_FPA_FP => 2344, Z3_OP_FPA_TO_FP => 2345, Z3_OP_FPA_TO_FP_UNSIGNED => 2346, Z3_OP_FPA_TO_UBV => 2347, | ||
| 152 | Z3_OP_FPA_TO_SBV => 2348, Z3_OP_FPA_TO_REAL => 2349, Z3_OP_FPA_TO_IEEE_BV => 2350, Z3_OP_FPA_BVWRAP => 2351, | ||
| 153 | Z3_OP_FPA_BV2RM => 2352, Z3_OP_INTERNAL => 2353, Z3_OP_UNINTERPRETED => 2354 | ||
| 154 | 5 | }; | |
| 155 | |||
| 156 | my $opaque_types = [map {"Z3_$_"} qw/config context symbol ast sort func_decl app pattern constructor constructor_list params param_descrs model func_interp func_entry fixedpoint optimize ast_vector ast_map goal tactic probe apply_result solver stats rcf_num/]; | ||
| 157 | |||
| 158 | my $functions = [ | ||
| 159 | [mk_fixedpoint => ["Z3_context"] => "Z3_fixedpoint"], | ||
| 160 | [fixedpoint_inc_ref => ["Z3_context", "Z3_fixedpoint"] => "void"], | ||
| 161 | [fixedpoint_dec_ref => ["Z3_context", "Z3_fixedpoint"] => "void"], | ||
| 162 | [fixedpoint_add_rule => ["Z3_context", "Z3_fixedpoint", "Z3_ast", "Z3_symbol"] => "void"], | ||
| 163 | [fixedpoint_add_fact => ["Z3_context", "Z3_fixedpoint", "Z3_func_decl", "uint", "uint[]"] => "void"], | ||
| 164 | [fixedpoint_assert => ["Z3_context", "Z3_fixedpoint", "Z3_ast"] => "void"], | ||
| 165 | [fixedpoint_query => ["Z3_context", "Z3_fixedpoint", "Z3_ast"] => "Z3_lbool"], | ||
| 166 | [fixedpoint_query_relations => ["Z3_context", "Z3_fixedpoint", "uint", "Z3_func_decl_arr"] => "Z3_lbool"], | ||
| 167 | [fixedpoint_get_answer => ["Z3_context", "Z3_fixedpoint"] => "Z3_ast"], | ||
| 168 | [fixedpoint_get_reason_unknown => ["Z3_context", "Z3_fixedpoint"] => "Z3_string"], | ||
| 169 | [fixedpoint_update_rule => ["Z3_context", "Z3_fixedpoint", "Z3_ast", "Z3_symbol"] => "void"], | ||
| 170 | [fixedpoint_get_num_levels => ["Z3_context", "Z3_fixedpoint", "Z3_func_decl"] => "uint"], | ||
| 171 | [fixedpoint_get_cover_delta => ["Z3_context", "Z3_fixedpoint", "int", "Z3_func_decl"] => "Z3_ast"], | ||
| 172 | [fixedpoint_add_cover => ["Z3_context", "Z3_fixedpoint", "int", "Z3_func_decl", "Z3_ast"] => "void"], | ||
| 173 | [fixedpoint_get_statistics => ["Z3_context", "Z3_fixedpoint"] => "Z3_stats"], | ||
| 174 | [fixedpoint_register_relation => ["Z3_context", "Z3_fixedpoint", "Z3_func_decl"] => "void"], | ||
| 175 | [fixedpoint_set_predicate_representation => ["Z3_context", "Z3_fixedpoint", "Z3_func_decl", "uint", "Z3_symbol_arr"] => "void"], | ||
| 176 | [fixedpoint_get_rules => ["Z3_context", "Z3_fixedpoint"] => "Z3_ast_vector"], | ||
| 177 | [fixedpoint_get_assertions => ["Z3_context", "Z3_fixedpoint"] => "Z3_ast_vector"], | ||
| 178 | [fixedpoint_set_params => ["Z3_context", "Z3_fixedpoint", "Z3_params"] => "void"], | ||
| 179 | [fixedpoint_get_help => ["Z3_context", "Z3_fixedpoint"] => "Z3_string"], | ||
| 180 | [fixedpoint_get_param_descrs => ["Z3_context", "Z3_fixedpoint"] => "Z3_param_descrs"], | ||
| 181 | [fixedpoint_to_string => ["Z3_context", "Z3_fixedpoint", "uint", "Z3_ast_arr"] => "Z3_string"], | ||
| 182 | [fixedpoint_from_string => ["Z3_context", "Z3_fixedpoint", "Z3_string"] => "Z3_ast_vector"], | ||
| 183 | [fixedpoint_from_file => ["Z3_context", "Z3_fixedpoint", "Z3_string"] => "Z3_ast_vector"], | ||
| 184 | [fixedpoint_push => ["Z3_context", "Z3_fixedpoint"] => "void"], | ||
| 185 | [fixedpoint_pop => ["Z3_context", "Z3_fixedpoint"] => "void"], | ||
| 186 | [fixedpoint_init => ["Z3_context", "Z3_fixedpoint", "void*"] => "void"], | ||
| 187 | #[fixedpoint_set_reduce_assign_callback => ["Z3_context", "Z3_fixedpoint", "Z3_fixedpoint_reduce_assign_callback_fptr"] => "void"], # TODO figure out these functions? | ||
| 188 | #[fixedpoint_set_reduce_app_callback => ["Z3_context", "Z3_fixedpoint", "Z3_fixedpoint_reduce_app_callback_fptr"] => "void"], | ||
| 189 | #[fixedpoint_add_callback => ["Z3_context", "Z3_fixedpoint", "void *state", "Z3_fixedpoint_new_lemma_eh", "Z3_fixedpoint_predecessor_eh", "Z3_fixedpoint_unfold_eh"] => "void"], | ||
| 190 | [fixedpoint_add_constraint => ["Z3_context", "Z3_fixedpoint", "Z3_ast", "uint"] => "void"], | ||
| 191 | [fixedpoint_query_from_lvl => ["Z3_context", "Z3_fixedpoint", "Z3_ast", "uint"] => "Z3_lbool"], | ||
| 192 | [fixedpoint_get_ground_sat_answer => ["Z3_context", "Z3_fixedpoint"] => "Z3_ast"], | ||
| 193 | [fixedpoint_get_rules_along_trace => ["Z3_context", "Z3_fixedpoint"] => "Z3_ast_vector"], | ||
| 194 | [fixedpoint_get_rule_names_along_trace => ["Z3_context", "Z3_fixedpoint"] => "Z3_symbol"], | ||
| 195 | [fixedpoint_add_invariant => ["Z3_context", "Z3_fixedpoint", "Z3_func_decl", "Z3_ast"] => "void"], | ||
| 196 | [fixedpoint_get_reachable => ["Z3_context", "Z3_fixedpoint", "Z3_func_decl"] => "Z3_ast"], | ||
| 197 | [qe_model_project => ["Z3_context", "Z3_model", "uint", "Z3_app_arr", "Z3_ast"] => "Z3_ast"], | ||
| 198 | [qe_model_project_skolem => ["Z3_context", "Z3_model", "uint", "Z3_app_arr", "Z3_ast", "Z3_ast_map"] => "Z3_ast"], | ||
| 199 | [model_extrapolate => ["Z3_context", "Z3_model", "Z3_ast"] => "Z3_ast"], | ||
| 200 | [qe_lite => ["Z3_context", "Z3_ast_vector", "Z3_ast"] => "Z3_ast"], | ||
| 201 | [polynomial_subresultants => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast_vector"], | ||
| 202 | [global_param_set => ["Z3_string", "Z3_string"] => "void"], | ||
| 203 | [global_param_reset_all => [] => "void"], | ||
| 204 | [global_param_get => ["Z3_string", "Z3_string_ptr"] => "Z3_bool"], | ||
| 205 | [mk_config => [] => "Z3_config"], | ||
| 206 | [del_config => ["Z3_config"] => "void"], | ||
| 207 | [set_param_value => ["Z3_config", "Z3_string", "Z3_string"] => "void"], | ||
| 208 | [mk_context => ["Z3_config"] => "Z3_context"], | ||
| 209 | [mk_context_rc => ["Z3_config"] => "Z3_context"], | ||
| 210 | [del_context => ["Z3_context"] => "void"], | ||
| 211 | [inc_ref => ["Z3_context", "Z3_ast"] => "void"], | ||
| 212 | [dec_ref => ["Z3_context", "Z3_ast"] => "void"], | ||
| 213 | [update_param_value => ["Z3_context", "Z3_string", "Z3_string"] => "void"], | ||
| 214 | [interrupt => ["Z3_context"] => "void"], | ||
| 215 | [mk_params => ["Z3_context"] => "Z3_params"], | ||
| 216 | [params_inc_ref => ["Z3_context", "Z3_params"] => "void"], | ||
| 217 | [params_dec_ref => ["Z3_context", "Z3_params"] => "void"], | ||
| 218 | [params_set_bool => ["Z3_context", "Z3_params", "Z3_symbol", "bool"] => "void"], | ||
| 219 | [params_set_uint => ["Z3_context", "Z3_params", "Z3_symbol", "uint"] => "void"], | ||
| 220 | [params_set_double => ["Z3_context", "Z3_params", "Z3_symbol", "double"] => "void"], | ||
| 221 | [params_set_symbol => ["Z3_context", "Z3_params", "Z3_symbol", "Z3_symbol"] => "void"], | ||
| 222 | [params_to_string => ["Z3_context", "Z3_params"] => "Z3_string"], | ||
| 223 | [params_validate => ["Z3_context", "Z3_params", "Z3_param_descrs"] => "void"], | ||
| 224 | [param_descrs_inc_ref => ["Z3_context", "Z3_param_descrs"] => "void"], | ||
| 225 | [param_descrs_dec_ref => ["Z3_context", "Z3_param_descrs"] => "void"], | ||
| 226 | [param_descrs_get_kind => ["Z3_context", "Z3_param_descrs", "Z3_symbol"] => "Z3_param_kind"], | ||
| 227 | [param_descrs_size => ["Z3_context", "Z3_param_descrs"] => "uint"], | ||
| 228 | [param_descrs_get_name => ["Z3_context", "Z3_param_descrs", "uint"] => "Z3_symbol"], | ||
| 229 | [param_descrs_get_documentation => ["Z3_context", "Z3_param_descrs", "Z3_symbol"] => "Z3_string"], | ||
| 230 | [param_descrs_to_string => ["Z3_context", "Z3_param_descrs"] => "Z3_string"], | ||
| 231 | [mk_int_symbol => ["Z3_context", "int"] => "Z3_symbol"], | ||
| 232 | [mk_string_symbol => ["Z3_context", "Z3_string"] => "Z3_symbol"], | ||
| 233 | [mk_uninterpreted_sort => ["Z3_context", "Z3_symbol"] => "Z3_sort"], | ||
| 234 | [mk_bool_sort => ["Z3_context"] => "Z3_sort"], | ||
| 235 | [mk_int_sort => ["Z3_context"] => "Z3_sort"], | ||
| 236 | [mk_real_sort => ["Z3_context"] => "Z3_sort"], | ||
| 237 | [mk_bv_sort => ["Z3_context", "uint"] => "Z3_sort"], | ||
| 238 | [mk_finite_domain_sort => ["Z3_context", "Z3_symbol", "uint64_t"] => "Z3_sort"], | ||
| 239 | [mk_array_sort => ["Z3_context", "Z3_sort", "Z3_sort"] => "Z3_sort"], | ||
| 240 | [mk_array_sort_n => ["Z3_context", "uint", "Z3_sort_ptr", "Z3_sort"] => "Z3_sort", sub { | ||
| 241 | my ($xsub, $ctx, $n, $domain, $range) = @_; | ||
| 242 | die "\$domain needs to be passed as a scalar reference to mk_array_sort_n" unless ref($domain) eq 'SCALAR'; | ||
| 243 | |||
| 244 | my $ret = $xsub->($ctx, $n, $domain, $range); | ||
| 245 | my $pointer = $$domain; | ||
| 246 | # rebless the inner object into the right type for later | ||
| 247 | $$domain = bless \$pointer, "Z3::FFI::Types::Z3_sort"; | ||
| 248 | |||
| 249 | return $ret; | ||
| 250 | }], | ||
| 251 | [mk_tuple_sort => ["Z3_context", "Z3_symbol", "uint", "Z3_symbol_arr", "Z3_sort_arr", "Z3_func_decl_ptr", "Z3_func_decl_arr"] => "Z3_sort", sub { | ||
| 252 | my ($xsub, $ctx, $mk_tuple_name, $num_fields, $field_names, $field_sorts, $mk_tuple_decl, $proj_decl) = @_; | ||
| 253 | my $ct_names = scalar @$field_names; | ||
| 254 | my $ct_sorts = scalar @$field_sorts; | ||
| 255 | die "Number of field names ($ct_names) doesn't match \$num_fields ($num_fields)" unless $ct_names == $num_fields; | ||
| 256 | die "Number of field sorts ($ct_sorts) doesn't match \$num_fields ($num_fields)" unless $ct_sorts == $num_fields; | ||
| 257 | die "\$mk_tuple_decl needs to be passed as a scalar reference to mk_tuple_sort" unless ref($mk_tuple_decl) eq 'SCALAR'; | ||
| 258 | # set the array here to be long enough | ||
| 259 | @{$proj_decl} = (undef() x $num_fields); | ||
| 260 | |||
| 261 | my $ret = $xsub->($ctx, $mk_tuple_name, $num_fields, $field_names, $field_sorts, $mk_tuple_decl, $proj_decl); | ||
| 262 | my $pointer = $$mk_tuple_decl; | ||
| 263 | # rebless the inner object into the right type for later | ||
| 264 | $$mk_tuple_decl = bless \$pointer, "Z3::FFI::Types::Z3_func_decl"; | ||
| 265 | |||
| 266 | return $ret; | ||
| 267 | }], | ||
| 268 | [mk_enumeration_sort => ["Z3_context", "Z3_symbol", "uint", "Z3_symbol_arr", "Z3_func_decl_arr", "Z3_func_decl_arr"] => "Z3_sort"], | ||
| 269 | [mk_list_sort => ["Z3_context", "Z3_symbol", "Z3_sort", "Z3_func_decl_ptr", "Z3_func_decl_ptr", "Z3_func_decl_ptr", "Z3_func_decl_ptr", "Z3_func_decl_ptr", "Z3_func_decl_ptr"] => "Z3_sort", sub { | ||
| 270 | my ($xsub, $ctx, $name, $elem_sort, $nil_decl, $is_nil_decl, $cons_decl, $is_cons_decl, $head_decl, $tail_decl) = @_; | ||
| 271 | die "\$nil_decl needs to be passed as a scalar reference to mk_list_sort" unless ref($nil_decl) eq 'SCALAR'; | ||
| 272 | die "\$is_nil_decl needs to be passed as a scalar reference to mk_list_sort" unless ref($is_nil_decl) eq 'SCALAR'; | ||
| 273 | die "\$cons_decl needs to be passed as a scalar reference to mk_list_sort" unless ref($cons_decl) eq 'SCALAR'; | ||
| 274 | die "\$is_cons_decl needs to be passed as a scalar reference to mk_list_sort" unless ref($is_cons_decl) eq 'SCALAR'; | ||
| 275 | die "\$head_decl needs to be passed as a scalar reference to mk_list_sort" unless ref($head_decl) eq 'SCALAR'; | ||
| 276 | die "\$tail_decl needs to be passed as a scalar reference to mk_list_sort" unless ref($tail_decl) eq 'SCALAR'; | ||
| 277 | |||
| 278 | my $ret = $xsub->($ctx, $name, $elem_sort, $nil_decl, $is_nil_decl, $cons_decl, $is_cons_decl, $head_decl, $tail_decl); | ||
| 279 | my $pointer = $$nil_decl; | ||
| 280 | $$nil_decl = bless \$pointer, "Z3::FFI::Types::Z3_func_decl"; | ||
| 281 | my $pointer2 = $$is_nil_decl; | ||
| 282 | $$is_nil_decl = bless \$pointer2, "Z3::FFI::Types::Z3_func_decl"; | ||
| 283 | my $pointer3 = $$cons_decl; | ||
| 284 | $$cons_decl = bless \$pointer3, "Z3::FFI::Types::Z3_func_decl"; | ||
| 285 | my $pointer4 = $$is_cons_decl; | ||
| 286 | $$is_cons_decl = bless \$pointer4, "Z3::FFI::Types::Z3_func_decl"; | ||
| 287 | my $pointer5 = $$head_decl; | ||
| 288 | $$head_decl = bless \$pointer, "Z3::FFI::Types::Z3_func_decl"; | ||
| 289 | my $pointer6 = $$tail_decl; | ||
| 290 | $$tail_decl = bless \$pointer6, "Z3::FFI::Types::Z3_func_decl"; | ||
| 291 | |||
| 292 | return $ret; | ||
| 293 | }], | ||
| 294 | [mk_constructor => ["Z3_context", "Z3_symbol", "Z3_symbol", "uint", "Z3_symbol_arr", "Z3_sort_arr", "uint[]"] => "Z3_constructor", sub { | ||
| 295 | my ($xsub, $ctx, $name, $recognizer, $num_fields, $field_names, $sorts, $sort_refs) = @_; | ||
| 296 | my $ct_field_names = scalar @$field_names; | ||
| 297 | die "Number of field_names ($ct_field_names) doesn't match \$num_fields ($num_fields)" unless $ct_field_names == $num_fields; | ||
| 298 | |||
| 299 | $xsub->($ctx, $name, $recognizer, $num_fields, $field_names, $sorts, $sort_refs); | ||
| 300 | }], | ||
| 301 | [del_constructor => ["Z3_context", "Z3_constructor"] => "void"], | ||
| 302 | [mk_datatype => ["Z3_context", "Z3_symbol", "uint", "Z3_constructor_arr"] => "Z3_sort"], | ||
| 303 | [mk_constructor_list => ["Z3_context", "uint", "Z3_constructor_arr"] => "Z3_constructor_list"], | ||
| 304 | [del_constructor_list => ["Z3_context", "Z3_constructor_list"] => "void"], | ||
| 305 | [mk_datatypes => ["Z3_context", "uint", "Z3_symbol_arr", "Z3_sort_arr", "Z3_constructor_list_arr"] => "void"], | ||
| 306 | [query_constructor => ["Z3_context", "Z3_constructor", "uint", "Z3_func_decl_ptr", "Z3_func_decl_ptr", "Z3_func_decl_arr"] => "void", sub { | ||
| 307 | my ($xsub, $ctx, $constructor, $num_fields, $func_constructor, $func_tester, $accessors) = @_; | ||
| 308 | my $ct_accessors = scalar @$accessors; | ||
| 309 | die "Number of accessors ($ct_accessors) doesn't match \$num_fields ($num_fields)" unless $ct_accessors == $num_fields; | ||
| 310 | die "\$func_constructor needs to be passed as a scalar reference to query_constructor" unless ref($func_constructor) eq 'SCALAR'; | ||
| 311 | die "\$func_tester needs to be passed as a scalar reference to query_constructor" unless ref($func_constructor) eq 'SCALAR'; | ||
| 312 | |||
| 313 | my $ret = $xsub->($ctx, $constructor, $num_fields, $func_constructor, $func_tester, $accessors); | ||
| 314 | my $pointer = $$func_tester; | ||
| 315 | my $pointer2 = $$func_constructor; | ||
| 316 | # rebless the inner object into the right type for later | ||
| 317 | $$func_tester = bless \$pointer, "Z3::FFI::Types::Z3_func_decl"; | ||
| 318 | $$func_constructor = bless \$pointer2, "Z3::FFI::Types::Z3_func_decl"; | ||
| 319 | |||
| 320 | return $ret; | ||
| 321 | }], | ||
| 322 | [mk_func_decl => ["Z3_context", "Z3_symbol", "uint", "Z3_sort_arr", "Z3_sort"] => "Z3_func_decl"], | ||
| 323 | [mk_app => ["Z3_context", "Z3_func_decl", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 324 | [mk_const => ["Z3_context", "Z3_symbol", "Z3_sort"] => "Z3_ast"], | ||
| 325 | [mk_fresh_func_decl => ["Z3_context", "Z3_string", "uint", "Z3_sort_arr", "Z3_sort"] => "Z3_func_decl"], | ||
| 326 | [mk_fresh_const => ["Z3_context", "Z3_string", "Z3_sort"] => "Z3_ast"], | ||
| 327 | [mk_rec_func_decl => ["Z3_context", "Z3_symbol", "uint", "Z3_sort_arr", "Z3_sort"] => "Z3_func_decl"], | ||
| 328 | [add_rec_def => ["Z3_context", "Z3_func_decl", "uint", "Z3_ast_arr", "Z3_ast"] => "void"], | ||
| 329 | [mk_true => ["Z3_context"] => "Z3_ast"], | ||
| 330 | [mk_false => ["Z3_context"] => "Z3_ast"], | ||
| 331 | [mk_eq => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 332 | [mk_distinct => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 333 | [mk_not => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 334 | [mk_ite => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 335 | [mk_iff => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 336 | [mk_implies => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 337 | [mk_xor => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 338 | [mk_and => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 339 | [mk_or => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 340 | [mk_add => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 341 | [mk_mul => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 342 | [mk_sub => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 343 | [mk_unary_minus => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 344 | [mk_div => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 345 | [mk_mod => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 346 | [mk_rem => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 347 | [mk_power => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 348 | [mk_lt => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 349 | [mk_le => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 350 | [mk_gt => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 351 | [mk_ge => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 352 | [mk_int2real => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 353 | [mk_real2int => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 354 | [mk_is_int => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 355 | [mk_bvnot => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 356 | [mk_bvredand => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 357 | [mk_bvredor => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 358 | [mk_bvand => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 359 | [mk_bvor => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 360 | [mk_bvxor => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 361 | [mk_bvnand => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 362 | [mk_bvnor => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 363 | [mk_bvxnor => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 364 | [mk_bvneg => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 365 | [mk_bvadd => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 366 | [mk_bvsub => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 367 | [mk_bvmul => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 368 | [mk_bvudiv => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 369 | [mk_bvsdiv => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 370 | [mk_bvurem => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 371 | [mk_bvsrem => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 372 | [mk_bvsmod => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 373 | [mk_bvult => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 374 | [mk_bvslt => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 375 | [mk_bvule => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 376 | [mk_bvsle => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 377 | [mk_bvuge => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 378 | [mk_bvsge => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 379 | [mk_bvugt => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 380 | [mk_bvsgt => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 381 | [mk_concat => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 382 | [mk_extract => ["Z3_context", "uint", "uint", "Z3_ast"] => "Z3_ast"], | ||
| 383 | [mk_sign_ext => ["Z3_context", "uint", "Z3_ast"] => "Z3_ast"], | ||
| 384 | [mk_zero_ext => ["Z3_context", "uint", "Z3_ast"] => "Z3_ast"], | ||
| 385 | [mk_repeat => ["Z3_context", "uint", "Z3_ast"] => "Z3_ast"], | ||
| 386 | [mk_bvshl => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 387 | [mk_bvlshr => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 388 | [mk_bvashr => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 389 | [mk_rotate_left => ["Z3_context", "uint", "Z3_ast"] => "Z3_ast"], | ||
| 390 | [mk_rotate_right => ["Z3_context", "uint", "Z3_ast"] => "Z3_ast"], | ||
| 391 | [mk_ext_rotate_left => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 392 | [mk_ext_rotate_right => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 393 | [mk_int2bv => ["Z3_context", "uint", "Z3_ast"] => "Z3_ast"], | ||
| 394 | [mk_bv2int => ["Z3_context", "Z3_ast", "bool"] => "Z3_ast"], | ||
| 395 | [mk_bvadd_no_overflow => ["Z3_context", "Z3_ast", "Z3_ast", "bool"] => "Z3_ast"], | ||
| 396 | [mk_bvadd_no_underflow => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 397 | [mk_bvsub_no_overflow => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 398 | [mk_bvsub_no_underflow => ["Z3_context", "Z3_ast", "Z3_ast", "bool"] => "Z3_ast"], | ||
| 399 | [mk_bvsdiv_no_overflow => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 400 | [mk_bvneg_no_overflow => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 401 | [mk_bvmul_no_overflow => ["Z3_context", "Z3_ast", "Z3_ast", "bool"] => "Z3_ast"], | ||
| 402 | [mk_bvmul_no_underflow => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 403 | [mk_select => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 404 | [mk_select_n => ["Z3_context", "Z3_ast", "uint", "Z3_ast_arr"] => "Z3_ast", sub { | ||
| 405 | my ($xsub, $ctx, $ast, $ct, $indexes) = @_; | ||
| 406 | # subtract one, $indexes is going to be NULL terminated, which doesn't matter for this call | ||
| 407 | # so the count will be off by one from what we got passed | ||
| 408 | die "\$ct($ct) and \$indexes(".(@$indexes-1).") don't match" unless $ct == @$indexes-1; | ||
| 409 | |||
| 410 | $xsub->($ctx, $ast, $ct, $indexes); | ||
| 411 | }], | ||
| 412 | [mk_store => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 413 | [mk_store_n => ["Z3_context", "Z3_ast", "uint", "Z3_ast_arr", "Z3_ast"] => "Z3_ast", sub { | ||
| 414 | my ($xsub, $ctx, $ast, $ct, $indexes, $val) = @_; | ||
| 415 | # subtract one, $indexes is going to be NULL terminated, which doesn't matter for this call | ||
| 416 | # so the count will be off by one from what we got passed | ||
| 417 | die "\$ct($ct) and \$indexes(".(@$indexes-1).") don't match" unless $ct == @$indexes-1; | ||
| 418 | |||
| 419 | $xsub->($ctx, $ast, $ct, $indexes, $val); | ||
| 420 | }], | ||
| 421 | [mk_const_array => ["Z3_context", "Z3_sort", "Z3_ast"] => "Z3_ast"], | ||
| 422 | [mk_map => ["Z3_context", "Z3_func_decl", "uint", "Z3_ast_arr"] => "Z3_ast", sub { | ||
| 423 | my ($xsub, $ctx, $ast, $ct, $args) = @_; | ||
| 424 | # subtract one, $indexes is going to be NULL terminated, which doesn't matter for this call | ||
| 425 | # so the count will be off by one from what we got passed | ||
| 426 | die "\$ct($ct) and \$args(".(@$args-1).") don't match" unless $ct == @$args-1; | ||
| 427 | |||
| 428 | $xsub->($ctx, $ast, $ct, $args); | ||
| 429 | }], | ||
| 430 | [mk_array_default => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 431 | [mk_as_array => ["Z3_context", "Z3_func_decl"] => "Z3_ast"], | ||
| 432 | [mk_set_sort => ["Z3_context", "Z3_sort"] => "Z3_sort"], | ||
| 433 | [mk_empty_set => ["Z3_context", "Z3_sort"] => "Z3_ast"], | ||
| 434 | [mk_full_set => ["Z3_context", "Z3_sort"] => "Z3_ast"], | ||
| 435 | [mk_set_add => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 436 | [mk_set_del => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 437 | [mk_set_union => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 438 | [mk_set_intersect => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 439 | [mk_set_difference => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 440 | [mk_set_complement => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 441 | [mk_set_member => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 442 | [mk_set_subset => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 443 | [mk_array_ext => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 444 | [mk_numeral => ["Z3_context", "Z3_string", "Z3_sort"] => "Z3_ast"], | ||
| 445 | [mk_real => ["Z3_context", "int", "int"] => "Z3_ast"], | ||
| 446 | [mk_int => ["Z3_context", "int", "Z3_sort"] => "Z3_ast"], | ||
| 447 | # [mk_uint_int => ["Z3_context", "uint", "Z3_sort"] => "Z3_ast"], # TODO not found in library | ||
| 448 | [mk_int64 => ["Z3_context", "int64_t", "Z3_sort"] => "Z3_ast"], | ||
| 449 | # [mk_uint_int64 => ["Z3_context", "uint64_t", "Z3_sort"] => "Z3_ast"], # TODO not found in library | ||
| 450 | [mk_bv_numeral => ["Z3_context", "uint", "bool*"] => "Z3_ast"], | ||
| 451 | [mk_seq_sort => ["Z3_context", "Z3_sort"] => "Z3_sort"], | ||
| 452 | [is_seq_sort => ["Z3_context", "Z3_sort"] => "bool"], | ||
| 453 | [mk_re_sort => ["Z3_context", "Z3_sort"] => "Z3_sort"], | ||
| 454 | [is_re_sort => ["Z3_context", "Z3_sort"] => "bool"], | ||
| 455 | [mk_string_sort => ["Z3_context"] => "Z3_sort"], | ||
| 456 | [is_string_sort => ["Z3_context", "Z3_sort"] => "bool"], | ||
| 457 | [mk_string => ["Z3_context", "Z3_string"] => "Z3_ast"], | ||
| 458 | [is_string => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 459 | [get_string => ["Z3_context", "Z3_ast"] => "Z3_string"], | ||
| 460 | [mk_seq_empty => ["Z3_context", "Z3_sort"] => "Z3_ast"], | ||
| 461 | [mk_seq_unit => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 462 | [mk_seq_concat => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 463 | [mk_seq_prefix => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 464 | [mk_seq_suffix => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 465 | [mk_seq_contains => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 466 | [mk_seq_extract => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 467 | [mk_seq_replace => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 468 | [mk_seq_at => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 469 | [mk_seq_length => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 470 | [mk_seq_index => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 471 | [mk_str_to_int => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 472 | [mk_int_to_str => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 473 | [mk_seq_to_re => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 474 | [mk_seq_in_re => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 475 | [mk_re_plus => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 476 | [mk_re_star => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 477 | [mk_re_option => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 478 | [mk_re_union => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 479 | [mk_re_concat => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 480 | [mk_re_range => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 481 | [mk_re_loop => ["Z3_context", "Z3_ast", "uint", "uint"] => "Z3_ast"], | ||
| 482 | [mk_re_intersect => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 483 | [mk_re_complement => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 484 | [mk_re_empty => ["Z3_context", "Z3_sort"] => "Z3_ast"], | ||
| 485 | [mk_re_full => ["Z3_context", "Z3_sort"] => "Z3_ast"], | ||
| 486 | [mk_pattern => ["Z3_context", "uint", "Z3_ast_arr"] => "Z3_pattern"], | ||
| 487 | [mk_bound => ["Z3_context", "uint", "Z3_sort"] => "Z3_ast"], | ||
| 488 | [mk_forall => ["Z3_context", "uint", "uint", "Z3_pattern_arr", "uint", "Z3_sort_arr", "Z3_symbol_arr", "Z3_ast"] => "Z3_ast"], | ||
| 489 | [mk_exists => ["Z3_context", "uint", "uint", "Z3_pattern_arr", "uint", "Z3_sort_arr", "Z3_symbol_arr", "Z3_ast"] => "Z3_ast"], | ||
| 490 | [mk_quantifier => ["Z3_context", "bool", "uint", "uint", "Z3_pattern_arr", "uint", "Z3_sort_arr", "Z3_symbol_arr", "Z3_ast"] => "Z3_ast"], | ||
| 491 | [mk_quantifier_ex => ["Z3_context", "bool", "uint", "Z3_symbol", "Z3_symbol", "uint", "Z3_pattern_arr", "uint", "Z3_ast_arr", "uint", "Z3_sort_arr", "Z3_symbol_arr", "Z3_ast"] => "Z3_ast"], | ||
| 492 | [mk_forall_const => ["Z3_context", "uint", "uint", "Z3_app_arr", "uint", "Z3_pattern_arr", "Z3_ast"] => "Z3_ast"], | ||
| 493 | [mk_exists_const => ["Z3_context", "uint", "uint", "Z3_app_arr", "uint", "Z3_pattern_arr", "Z3_ast"] => "Z3_ast"], | ||
| 494 | [mk_quantifier_const => ["Z3_context", "bool", "uint", "uint", "Z3_app_arr", "uint", "Z3_pattern_arr", "Z3_ast"] => "Z3_ast"], | ||
| 495 | [mk_quantifier_const_ex => ["Z3_context", "bool", "uint", "Z3_symbol", "Z3_symbol", "uint", "Z3_app_arr", "uint", "Z3_pattern_arr", "uint", "Z3_ast_arr", "Z3_ast"] => "Z3_ast"], | ||
| 496 | [mk_lambda => ["Z3_context", "uint", "Z3_sort_arr", "Z3_symbol_arr", "Z3_ast"] => "Z3_ast"], | ||
| 497 | [mk_lambda_const => ["Z3_context", "uint", "Z3_app_arr", "Z3_ast"] => "Z3_ast"], | ||
| 498 | [get_symbol_kind => ["Z3_context", "Z3_symbol"] => "Z3_symbol_kind"], | ||
| 499 | [get_symbol_int => ["Z3_context", "Z3_symbol"] => "int"], | ||
| 500 | [get_symbol_string => ["Z3_context", "Z3_symbol"] => "Z3_string"], | ||
| 501 | [get_sort_name => ["Z3_context", "Z3_sort"] => "Z3_symbol"], | ||
| 502 | [get_sort_id => ["Z3_context", "Z3_sort"] => "uint"], | ||
| 503 | [sort_to_ast => ["Z3_context", "Z3_sort"] => "Z3_ast"], | ||
| 504 | [is_eq_sort => ["Z3_context", "Z3_sort", "Z3_sort"] => "bool"], | ||
| 505 | [get_sort_kind => ["Z3_context", "Z3_sort"] => "Z3_sort_kind"], | ||
| 506 | [get_bv_sort_size => ["Z3_context", "Z3_sort"] => "uint"], | ||
| 507 | [get_finite_domain_sort_size => ["Z3_context", "Z3_sort", "uint64_t*"] => "Z3_bool"], | ||
| 508 | [get_array_sort_domain => ["Z3_context", "Z3_sort"] => "Z3_sort"], | ||
| 509 | [get_array_sort_range => ["Z3_context", "Z3_sort"] => "Z3_sort"], | ||
| 510 | [get_tuple_sort_mk_decl => ["Z3_context", "Z3_sort"] => "Z3_func_decl"], | ||
| 511 | [get_tuple_sort_num_fields => ["Z3_context", "Z3_sort"] => "uint"], | ||
| 512 | [get_tuple_sort_field_decl => ["Z3_context", "Z3_sort", "uint"] => "Z3_func_decl"], | ||
| 513 | [get_datatype_sort_num_constructors => ["Z3_context", "Z3_sort"] => "uint"], | ||
| 514 | [get_datatype_sort_constructor => ["Z3_context", "Z3_sort", "uint"] => "Z3_func_decl"], | ||
| 515 | [get_datatype_sort_recognizer => ["Z3_context", "Z3_sort", "uint"] => "Z3_func_decl"], | ||
| 516 | [get_datatype_sort_constructor_accessor => ["Z3_context", "Z3_sort", "uint", "uint"] => "Z3_func_decl"], | ||
| 517 | [datatype_update_field => ["Z3_context", "Z3_func_decl", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 518 | [get_relation_arity => ["Z3_context", "Z3_sort"] => "uint"], | ||
| 519 | [get_relation_column => ["Z3_context", "Z3_sort", "uint"] => "Z3_sort"], | ||
| 520 | [mk_atmost => ["Z3_context", "uint", "Z3_ast_arr", "uint"] => "Z3_ast"], | ||
| 521 | [mk_atleast => ["Z3_context", "uint", "Z3_ast_arr", "uint"] => "Z3_ast"], | ||
| 522 | [mk_pble => ["Z3_context", "uint", "Z3_ast_arr", "int[]", "int"] => "Z3_ast"], | ||
| 523 | [mk_pbge => ["Z3_context", "uint", "Z3_ast_arr", "int[]", "int"] => "Z3_ast"], | ||
| 524 | [mk_pbeq => ["Z3_context", "uint", "Z3_ast_arr", "int[]", "int"] => "Z3_ast"], | ||
| 525 | [func_decl_to_ast => ["Z3_context", "Z3_func_decl"] => "Z3_ast"], | ||
| 526 | [is_eq_func_decl => ["Z3_context", "Z3_func_decl", "Z3_func_decl"] => "bool"], | ||
| 527 | [get_func_decl_id => ["Z3_context", "Z3_func_decl"] => "uint"], | ||
| 528 | [get_decl_name => ["Z3_context", "Z3_func_decl"] => "Z3_symbol"], | ||
| 529 | [get_decl_kind => ["Z3_context", "Z3_func_decl"] => "Z3_decl_kind"], | ||
| 530 | [get_domain_size => ["Z3_context", "Z3_func_decl"] => "uint"], | ||
| 531 | [get_arity => ["Z3_context", "Z3_func_decl"] => "uint"], | ||
| 532 | [get_domain => ["Z3_context", "Z3_func_decl", "uint"] => "Z3_sort"], | ||
| 533 | [get_range => ["Z3_context", "Z3_func_decl"] => "Z3_sort"], | ||
| 534 | [get_decl_num_parameters => ["Z3_context", "Z3_func_decl"] => "uint"], | ||
| 535 | [get_decl_parameter_kind => ["Z3_context", "Z3_func_decl", "uint"] => "Z3_parameter_kind"], | ||
| 536 | [get_decl_int_parameter => ["Z3_context", "Z3_func_decl", "uint"] => "int"], | ||
| 537 | [get_decl_double_parameter => ["Z3_context", "Z3_func_decl", "uint"] => "double"], | ||
| 538 | [get_decl_symbol_parameter => ["Z3_context", "Z3_func_decl", "uint"] => "Z3_symbol"], | ||
| 539 | [get_decl_sort_parameter => ["Z3_context", "Z3_func_decl", "uint"] => "Z3_sort"], | ||
| 540 | [get_decl_ast_parameter => ["Z3_context", "Z3_func_decl", "uint"] => "Z3_ast"], | ||
| 541 | [get_decl_func_decl_parameter => ["Z3_context", "Z3_func_decl", "uint"] => "Z3_func_decl"], | ||
| 542 | [get_decl_rational_parameter => ["Z3_context", "Z3_func_decl", "uint"] => "Z3_string"], | ||
| 543 | [app_to_ast => ["Z3_context", "Z3_app"] => "Z3_ast"], | ||
| 544 | [get_app_decl => ["Z3_context", "Z3_app"] => "Z3_func_decl"], | ||
| 545 | [get_app_num_args => ["Z3_context", "Z3_app"] => "uint"], | ||
| 546 | [get_app_arg => ["Z3_context", "Z3_app", "uint"] => "Z3_ast"], | ||
| 547 | [is_eq_ast => ["Z3_context", "Z3_ast", "Z3_ast"] => "bool"], | ||
| 548 | [get_ast_id => ["Z3_context", "Z3_ast"] => "uint"], | ||
| 549 | [get_ast_hash => ["Z3_context", "Z3_ast"] => "uint"], | ||
| 550 | [get_sort => ["Z3_context", "Z3_ast"] => "Z3_sort"], | ||
| 551 | [is_well_sorted => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 552 | [get_bool_value => ["Z3_context", "Z3_ast"] => "Z3_lbool"], | ||
| 553 | [get_ast_kind => ["Z3_context", "Z3_ast"] => "Z3_ast_kind"], | ||
| 554 | [is_app => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 555 | [is_numeral_ast => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 556 | [is_algebraic_number => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 557 | [to_app => ["Z3_context", "Z3_ast"] => "Z3_app"], | ||
| 558 | [to_func_decl => ["Z3_context", "Z3_ast"] => "Z3_func_decl"], | ||
| 559 | [get_numeral_string => ["Z3_context", "Z3_ast"] => "Z3_string"], | ||
| 560 | [get_numeral_decimal_string => ["Z3_context", "Z3_ast", "uint"] => "Z3_string"], | ||
| 561 | [get_numeral_double => ["Z3_context", "Z3_ast"] => "double"], | ||
| 562 | [get_numerator => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 563 | [get_denominator => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 564 | [get_numeral_small => ["Z3_context", "Z3_ast", "int64_t*", "int64_t*"] => "bool"], | ||
| 565 | [get_numeral_int => ["Z3_context", "Z3_ast", "int*"] => "bool"], | ||
| 566 | [get_numeral_uint => ["Z3_context", "Z3_ast", "uint*"] => "bool"], | ||
| 567 | [get_numeral_uint64 => ["Z3_context", "Z3_ast", "uint64_t*"] => "bool"], | ||
| 568 | [get_numeral_int64 => ["Z3_context", "Z3_ast", "int64_t*"] => "bool"], | ||
| 569 | [get_numeral_rational_int64 => ["Z3_context", "Z3_ast", "int64_t*", "int64_t*"] => "bool"], | ||
| 570 | [get_algebraic_number_lower => ["Z3_context", "Z3_ast", "uint"] => "Z3_ast"], | ||
| 571 | [get_algebraic_number_upper => ["Z3_context", "Z3_ast", "uint"] => "Z3_ast"], | ||
| 572 | [pattern_to_ast => ["Z3_context", "Z3_pattern"] => "Z3_ast"], | ||
| 573 | [get_pattern_num_terms => ["Z3_context", "Z3_pattern"] => "uint"], | ||
| 574 | [get_pattern => ["Z3_context", "Z3_pattern", "uint"] => "Z3_ast"], | ||
| 575 | [get_index_value => ["Z3_context", "Z3_ast"] => "uint"], | ||
| 576 | [is_quantifier_forall => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 577 | [is_quantifier_exists => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 578 | [is_lambda => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 579 | [get_quantifier_weight => ["Z3_context", "Z3_ast"] => "uint"], | ||
| 580 | [get_quantifier_num_patterns => ["Z3_context", "Z3_ast"] => "uint"], | ||
| 581 | [get_quantifier_pattern_ast => ["Z3_context", "Z3_ast", "uint"] => "Z3_pattern"], | ||
| 582 | [get_quantifier_num_no_patterns => ["Z3_context", "Z3_ast"] => "uint"], | ||
| 583 | [get_quantifier_no_pattern_ast => ["Z3_context", "Z3_ast", "uint"] => "Z3_ast"], | ||
| 584 | [get_quantifier_num_bound => ["Z3_context", "Z3_ast"] => "uint"], | ||
| 585 | [get_quantifier_bound_name => ["Z3_context", "Z3_ast", "uint"] => "Z3_symbol"], | ||
| 586 | [get_quantifier_bound_sort => ["Z3_context", "Z3_ast", "uint"] => "Z3_sort"], | ||
| 587 | [get_quantifier_body => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 588 | [simplify => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 589 | [simplify_ex => ["Z3_context", "Z3_ast", "Z3_params"] => "Z3_ast"], | ||
| 590 | [simplify_get_help => ["Z3_context"] => "Z3_string"], | ||
| 591 | [simplify_get_param_descrs => ["Z3_context"] => "Z3_param_descrs"], | ||
| 592 | [update_term => ["Z3_context", "Z3_ast", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 593 | [substitute => ["Z3_context", "Z3_ast", "uint", "Z3_ast_arr", "Z3_ast_arr"] => "Z3_ast"], | ||
| 594 | [substitute_vars => ["Z3_context", "Z3_ast", "uint", "Z3_ast_arr"] => "Z3_ast"], | ||
| 595 | [translate => ["Z3_context", "Z3_ast", "Z3_context"] => "Z3_ast"], | ||
| 596 | [mk_model => ["Z3_context"] => "Z3_model"], | ||
| 597 | [model_inc_ref => ["Z3_context", "Z3_model"] => "void"], | ||
| 598 | [model_dec_ref => ["Z3_context", "Z3_model"] => "void"], | ||
| 599 | [model_eval => ["Z3_context", "Z3_model", "Z3_ast", "bool", "Z3_ast_ptr"] => "Z3_bool", sub { | ||
| 600 | my ($xsub, $ctx, $model, $ast, $completion, $val) = @_; | ||
| 601 | die "\$val needs to be passed as a scalar reference to model_eval" unless ref($val) eq 'SCALAR'; | ||
| 602 | |||
| 603 | my $ret = $xsub->($ctx, $model, $ast, $completion, $val); | ||
| 604 | my $pointer = $$val; | ||
| 605 | # rebless the inner object into the right type for later | ||
| 606 | $$val = bless \$pointer, "Z3::FFI::Types::Z3_ast"; | ||
| 607 | |||
| 608 | return $ret; | ||
| 609 | }], | ||
| 610 | [model_get_const_interp => ["Z3_context", "Z3_model", "Z3_func_decl"] => "Z3_ast"], | ||
| 611 | [model_has_interp => ["Z3_context", "Z3_model", "Z3_func_decl"] => "bool"], | ||
| 612 | [model_get_func_interp => ["Z3_context", "Z3_model", "Z3_func_decl"] => "Z3_func_interp"], | ||
| 613 | [model_get_num_consts => ["Z3_context", "Z3_model"] => "uint"], | ||
| 614 | [model_get_const_decl => ["Z3_context", "Z3_model", "uint"] => "Z3_func_decl"], | ||
| 615 | [model_get_num_funcs => ["Z3_context", "Z3_model"] => "uint"], | ||
| 616 | [model_get_func_decl => ["Z3_context", "Z3_model", "uint"] => "Z3_func_decl"], | ||
| 617 | [model_get_num_sorts => ["Z3_context", "Z3_model"] => "uint"], | ||
| 618 | [model_get_sort => ["Z3_context", "Z3_model", "uint"] => "Z3_sort"], | ||
| 619 | [model_get_sort_universe => ["Z3_context", "Z3_model", "Z3_sort"] => "Z3_ast_vector"], | ||
| 620 | [model_translate => ["Z3_context", "Z3_model", "Z3_context"] => "Z3_model"], | ||
| 621 | [is_as_array => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 622 | [get_as_array_func_decl => ["Z3_context", "Z3_ast"] => "Z3_func_decl"], | ||
| 623 | [add_func_interp => ["Z3_context", "Z3_model", "Z3_func_decl", "Z3_ast"] => "Z3_func_interp"], | ||
| 624 | [add_const_interp => ["Z3_context", "Z3_model", "Z3_func_decl", "Z3_ast"] => "void"], | ||
| 625 | [func_interp_inc_ref => ["Z3_context", "Z3_func_interp"] => "void"], | ||
| 626 | [func_interp_dec_ref => ["Z3_context", "Z3_func_interp"] => "void"], | ||
| 627 | [func_interp_get_num_entries => ["Z3_context", "Z3_func_interp"] => "uint"], | ||
| 628 | [func_interp_get_entry => ["Z3_context", "Z3_func_interp", "uint"] => "Z3_func_entry"], | ||
| 629 | [func_interp_get_else => ["Z3_context", "Z3_func_interp"] => "Z3_ast"], | ||
| 630 | [func_interp_set_else => ["Z3_context", "Z3_func_interp", "Z3_ast"] => "void"], | ||
| 631 | [func_interp_get_arity => ["Z3_context", "Z3_func_interp"] => "uint"], | ||
| 632 | [func_interp_add_entry => ["Z3_context", "Z3_func_interp", "Z3_ast_vector", "Z3_ast"] => "void"], | ||
| 633 | [func_entry_inc_ref => ["Z3_context", "Z3_func_entry"] => "void"], | ||
| 634 | [func_entry_dec_ref => ["Z3_context", "Z3_func_entry"] => "void"], | ||
| 635 | [func_entry_get_value => ["Z3_context", "Z3_func_entry"] => "Z3_ast"], | ||
| 636 | [func_entry_get_num_args => ["Z3_context", "Z3_func_entry"] => "uint"], | ||
| 637 | [func_entry_get_arg => ["Z3_context", "Z3_func_entry", "uint"] => "Z3_ast"], | ||
| 638 | [open_log => ["Z3_string"] => "bool"], | ||
| 639 | [append_log => ["Z3_string"] => "void"], | ||
| 640 | [close_log => [] => "void"], | ||
| 641 | [toggle_warning_messages => ["bool"] => "void"], | ||
| 642 | [set_ast_print_mode => ["Z3_context", "Z3_ast_print_mode"] => "void"], | ||
| 643 | [ast_to_string => ["Z3_context", "Z3_ast"] => "Z3_string"], | ||
| 644 | [pattern_to_string => ["Z3_context", "Z3_pattern"] => "Z3_string"], | ||
| 645 | [sort_to_string => ["Z3_context", "Z3_sort"] => "Z3_string"], | ||
| 646 | [func_decl_to_string => ["Z3_context", "Z3_func_decl"] => "Z3_string"], | ||
| 647 | [model_to_string => ["Z3_context", "Z3_model"] => "Z3_string"], | ||
| 648 | [benchmark_to_smtlib_string => ["Z3_context", "Z3_string", "Z3_string", "Z3_string", "Z3_string", "uint", "Z3_ast_arr", "Z3_ast"] => "Z3_string"], | ||
| 649 | [parse_smtlib2_string => ["Z3_context", "Z3_string", "uint", "Z3_symbol_arr", "Z3_sort_arr", "uint", "Z3_symbol_arr", "Z3_func_decl_arr"] => "Z3_ast_vector"], | ||
| 650 | [parse_smtlib2_file => ["Z3_context", "Z3_string", "uint", "Z3_symbol_arr", "Z3_sort_arr", "uint", "Z3_symbol_arr", "Z3_func_decl_arr"] => "Z3_ast_vector"], | ||
| 651 | [eval_smtlib2_string => ["Z3_context", "Z3_string"] => "Z3_string"], | ||
| 652 | [get_error_code => ["Z3_context"] => "Z3_error_code"], | ||
| 653 | [set_error_handler => ["Z3_context", "Z3_error_handler"] => "void", sub { | ||
| 654 | my ($xsub, $ctx, $sub) = @_; | ||
| 655 | die "\$sub needs to be a coderef when passed to set_error_handler" unless ref($sub) eq 'CODE'; | ||
| 656 | |||
| 657 | # extra level, but so we can wrap the arguments properly | ||
| 658 | my $closure = $ffi->closure(sub { | ||
| 659 | my ($ctx_ptr, $err_ptr) = @_; | ||
| 660 | my $ctx = bless \$ctx_ptr, 'Z3::FFI::Types::Z3_context'; | ||
| 661 | my $err = bless \$err_ptr, 'Z3::FFI::Types::Z3_error_code'; | ||
| 662 | $sub->($ctx, $err); | ||
| 663 | }); | ||
| 664 | $xsub->($ctx, $closure); | ||
| 665 | }], | ||
| 666 | [set_error => ["Z3_context", "Z3_error_code"] => "void"], | ||
| 667 | [get_error_msg => ["Z3_context", "Z3_error_code"] => "Z3_string"], | ||
| 668 | [get_version => ["uint *", "uint *", "uint *", "uint *"] => "void"], | ||
| 669 | [get_full_version => [] => "Z3_string"], | ||
| 670 | [enable_trace => ["Z3_string"] => "void"], | ||
| 671 | [disable_trace => ["Z3_string"] => "void"], | ||
| 672 | [reset_memory => [] => "void"], | ||
| 673 | [finalize_memory => [] => "void"], | ||
| 674 | [mk_goal => ["Z3_context", "bool", "bool", "bool"] => "Z3_goal"], | ||
| 675 | [goal_inc_ref => ["Z3_context", "Z3_goal"] => "void"], | ||
| 676 | [goal_dec_ref => ["Z3_context", "Z3_goal"] => "void"], | ||
| 677 | [goal_precision => ["Z3_context", "Z3_goal"] => "Z3_goal_prec"], | ||
| 678 | [goal_assert => ["Z3_context", "Z3_goal", "Z3_ast"] => "void"], | ||
| 679 | [goal_inconsistent => ["Z3_context", "Z3_goal"] => "bool"], | ||
| 680 | [goal_depth => ["Z3_context", "Z3_goal"] => "uint"], | ||
| 681 | [goal_reset => ["Z3_context", "Z3_goal"] => "void"], | ||
| 682 | [goal_size => ["Z3_context", "Z3_goal"] => "uint"], | ||
| 683 | [goal_formula => ["Z3_context", "Z3_goal", "uint"] => "Z3_ast"], | ||
| 684 | [goal_num_exprs => ["Z3_context", "Z3_goal"] => "uint"], | ||
| 685 | [goal_is_decided_sat => ["Z3_context", "Z3_goal"] => "bool"], | ||
| 686 | [goal_is_decided_unsat => ["Z3_context", "Z3_goal"] => "bool"], | ||
| 687 | [goal_translate => ["Z3_context", "Z3_goal", "Z3_context"] => "Z3_goal"], | ||
| 688 | [goal_convert_model => ["Z3_context", "Z3_goal", "Z3_model"] => "Z3_model"], | ||
| 689 | [goal_to_string => ["Z3_context", "Z3_goal"] => "Z3_string"], | ||
| 690 | [goal_to_dimacs_string => ["Z3_context", "Z3_goal"] => "Z3_string"], | ||
| 691 | [mk_tactic => ["Z3_context", "Z3_string"] => "Z3_tactic"], | ||
| 692 | [tactic_inc_ref => ["Z3_context", "Z3_tactic"] => "void"], | ||
| 693 | [tactic_dec_ref => ["Z3_context", "Z3_tactic"] => "void"], | ||
| 694 | [mk_probe => ["Z3_context", "Z3_string"] => "Z3_probe"], | ||
| 695 | [probe_inc_ref => ["Z3_context", "Z3_probe"] => "void"], | ||
| 696 | [probe_dec_ref => ["Z3_context", "Z3_probe"] => "void"], | ||
| 697 | [tactic_and_then => ["Z3_context", "Z3_tactic", "Z3_tactic"] => "Z3_tactic"], | ||
| 698 | [tactic_or_else => ["Z3_context", "Z3_tactic", "Z3_tactic"] => "Z3_tactic"], | ||
| 699 | [tactic_par_or => ["Z3_context", "uint", "Z3_tactic_arr"] => "Z3_tactic"], | ||
| 700 | [tactic_par_and_then => ["Z3_context", "Z3_tactic", "Z3_tactic"] => "Z3_tactic"], | ||
| 701 | [tactic_try_for => ["Z3_context", "Z3_tactic", "uint"] => "Z3_tactic"], | ||
| 702 | [tactic_when => ["Z3_context", "Z3_probe", "Z3_tactic"] => "Z3_tactic"], | ||
| 703 | [tactic_cond => ["Z3_context", "Z3_probe", "Z3_tactic", "Z3_tactic"] => "Z3_tactic"], | ||
| 704 | [tactic_repeat => ["Z3_context", "Z3_tactic", "uint"] => "Z3_tactic"], | ||
| 705 | [tactic_skip => ["Z3_context"] => "Z3_tactic"], | ||
| 706 | [tactic_fail => ["Z3_context"] => "Z3_tactic"], | ||
| 707 | [tactic_fail_if => ["Z3_context", "Z3_probe"] => "Z3_tactic"], | ||
| 708 | [tactic_fail_if_not_decided => ["Z3_context"] => "Z3_tactic"], | ||
| 709 | [tactic_using_params => ["Z3_context", "Z3_tactic", "Z3_params"] => "Z3_tactic"], | ||
| 710 | [probe_const => ["Z3_context", "double"] => "Z3_probe"], | ||
| 711 | [probe_lt => ["Z3_context", "Z3_probe", "Z3_probe"] => "Z3_probe"], | ||
| 712 | [probe_gt => ["Z3_context", "Z3_probe", "Z3_probe"] => "Z3_probe"], | ||
| 713 | [probe_le => ["Z3_context", "Z3_probe", "Z3_probe"] => "Z3_probe"], | ||
| 714 | [probe_ge => ["Z3_context", "Z3_probe", "Z3_probe"] => "Z3_probe"], | ||
| 715 | [probe_eq => ["Z3_context", "Z3_probe", "Z3_probe"] => "Z3_probe"], | ||
| 716 | [probe_and => ["Z3_context", "Z3_probe", "Z3_probe"] => "Z3_probe"], | ||
| 717 | [probe_or => ["Z3_context", "Z3_probe", "Z3_probe"] => "Z3_probe"], | ||
| 718 | [probe_not => ["Z3_context", "Z3_probe"] => "Z3_probe"], | ||
| 719 | [get_num_tactics => ["Z3_context"] => "uint"], | ||
| 720 | [get_tactic_name => ["Z3_context", "uint"] => "Z3_string"], | ||
| 721 | [get_num_probes => ["Z3_context"] => "uint"], | ||
| 722 | [get_probe_name => ["Z3_context", "uint"] => "Z3_string"], | ||
| 723 | [tactic_get_help => ["Z3_context", "Z3_tactic"] => "Z3_string"], | ||
| 724 | [tactic_get_param_descrs => ["Z3_context", "Z3_tactic"] => "Z3_param_descrs"], | ||
| 725 | [tactic_get_descr => ["Z3_context", "Z3_string"] => "Z3_string"], | ||
| 726 | [probe_get_descr => ["Z3_context", "Z3_string"] => "Z3_string"], | ||
| 727 | [probe_apply => ["Z3_context", "Z3_probe", "Z3_goal"] => "double"], | ||
| 728 | [tactic_apply => ["Z3_context", "Z3_tactic", "Z3_goal"] => "Z3_apply_result"], | ||
| 729 | [tactic_apply_ex => ["Z3_context", "Z3_tactic", "Z3_goal", "Z3_params"] => "Z3_apply_result"], | ||
| 730 | [apply_result_inc_ref => ["Z3_context", "Z3_apply_result"] => "void"], | ||
| 731 | [apply_result_dec_ref => ["Z3_context", "Z3_apply_result"] => "void"], | ||
| 732 | [apply_result_to_string => ["Z3_context", "Z3_apply_result"] => "Z3_string"], | ||
| 733 | [apply_result_get_num_subgoals => ["Z3_context", "Z3_apply_result"] => "uint"], | ||
| 734 | [apply_result_get_subgoal => ["Z3_context", "Z3_apply_result", "uint"] => "Z3_goal"], | ||
| 735 | [mk_solver => ["Z3_context"] => "Z3_solver"], | ||
| 736 | [mk_simple_solver => ["Z3_context"] => "Z3_solver"], | ||
| 737 | [mk_solver_for_logic => ["Z3_context", "Z3_symbol"] => "Z3_solver"], | ||
| 738 | [mk_solver_from_tactic => ["Z3_context", "Z3_tactic"] => "Z3_solver"], | ||
| 739 | [solver_translate => ["Z3_context", "Z3_solver", "Z3_context"] => "Z3_solver"], | ||
| 740 | [solver_import_model_converter => ["Z3_context", "Z3_solver", "Z3_solver"] => "void"], | ||
| 741 | [solver_get_help => ["Z3_context", "Z3_solver"] => "Z3_string"], | ||
| 742 | [solver_get_param_descrs => ["Z3_context", "Z3_solver"] => "Z3_param_descrs"], | ||
| 743 | [solver_set_params => ["Z3_context", "Z3_solver", "Z3_params"] => "void"], | ||
| 744 | [solver_inc_ref => ["Z3_context", "Z3_solver"] => "void"], | ||
| 745 | [solver_dec_ref => ["Z3_context", "Z3_solver"] => "void"], | ||
| 746 | [solver_push => ["Z3_context", "Z3_solver"] => "void"], | ||
| 747 | [solver_pop => ["Z3_context", "Z3_solver", "uint"] => "void"], | ||
| 748 | [solver_reset => ["Z3_context", "Z3_solver"] => "void"], | ||
| 749 | [solver_get_num_scopes => ["Z3_context", "Z3_solver"] => "uint"], | ||
| 750 | [solver_assert => ["Z3_context", "Z3_solver", "Z3_ast"] => "void"], | ||
| 751 | [solver_assert_and_track => ["Z3_context", "Z3_solver", "Z3_ast", "Z3_ast"] => "void"], | ||
| 752 | [solver_from_file => ["Z3_context", "Z3_solver", "Z3_string"] => "void"], | ||
| 753 | [solver_from_string => ["Z3_context", "Z3_solver", "Z3_string"] => "void"], | ||
| 754 | [solver_get_assertions => ["Z3_context", "Z3_solver"] => "Z3_ast_vector"], | ||
| 755 | [solver_get_units => ["Z3_context", "Z3_solver"] => "Z3_ast_vector"], | ||
| 756 | [solver_get_non_units => ["Z3_context", "Z3_solver"] => "Z3_ast_vector"], | ||
| 757 | [solver_check => ["Z3_context", "Z3_solver"] => "Z3_lbool"], | ||
| 758 | [solver_check_assumptions => ["Z3_context", "Z3_solver", "uint", "Z3_ast_arr"] => "Z3_lbool"], | ||
| 759 | [get_implied_equalities => ["Z3_context", "Z3_solver", "uint", "Z3_ast_arr", "uint[]"] => "Z3_lbool"], | ||
| 760 | [solver_get_consequences => ["Z3_context", "Z3_solver", "Z3_ast_vector", "Z3_ast_vector", "Z3_ast_vector"] => "Z3_lbool"], | ||
| 761 | [solver_cube => ["Z3_context", "Z3_solver", "Z3_ast_vector", "uint"] => "Z3_ast_vector"], | ||
| 762 | [solver_get_model => ["Z3_context", "Z3_solver"] => "Z3_model"], | ||
| 763 | [solver_get_proof => ["Z3_context", "Z3_solver"] => "Z3_ast"], | ||
| 764 | [solver_get_unsat_core => ["Z3_context", "Z3_solver"] => "Z3_ast_vector"], | ||
| 765 | [solver_get_reason_unknown => ["Z3_context", "Z3_solver"] => "Z3_string"], | ||
| 766 | [solver_get_statistics => ["Z3_context", "Z3_solver"] => "Z3_stats"], | ||
| 767 | [solver_to_string => ["Z3_context", "Z3_solver"] => "Z3_string"], | ||
| 768 | [stats_to_string => ["Z3_context", "Z3_stats"] => "Z3_string"], | ||
| 769 | [stats_inc_ref => ["Z3_context", "Z3_stats"] => "void"], | ||
| 770 | [stats_dec_ref => ["Z3_context", "Z3_stats"] => "void"], | ||
| 771 | [stats_size => ["Z3_context", "Z3_stats"] => "uint"], | ||
| 772 | [stats_get_key => ["Z3_context", "Z3_stats", "uint"] => "Z3_string"], | ||
| 773 | [stats_is_uint => ["Z3_context", "Z3_stats", "uint"] => "bool"], | ||
| 774 | [stats_is_double => ["Z3_context", "Z3_stats", "uint"] => "bool"], | ||
| 775 | [stats_get_uint_value => ["Z3_context", "Z3_stats", "uint"] => "uint"], | ||
| 776 | [stats_get_double_value => ["Z3_context", "Z3_stats", "uint"] => "double"], | ||
| 777 | [get_estimated_alloc_size => [] => "uint64_t"], | ||
| 778 | [mk_fpa_rounding_mode_sort => ["Z3_context"] => "Z3_sort"], | ||
| 779 | [mk_fpa_round_nearest_ties_to_even => ["Z3_context"] => "Z3_ast"], | ||
| 780 | [mk_fpa_rne => ["Z3_context"] => "Z3_ast"], | ||
| 781 | [mk_fpa_round_nearest_ties_to_away => ["Z3_context"] => "Z3_ast"], | ||
| 782 | [mk_fpa_rna => ["Z3_context"] => "Z3_ast"], | ||
| 783 | [mk_fpa_round_toward_positive => ["Z3_context"] => "Z3_ast"], | ||
| 784 | [mk_fpa_rtp => ["Z3_context"] => "Z3_ast"], | ||
| 785 | [mk_fpa_round_toward_negative => ["Z3_context"] => "Z3_ast"], | ||
| 786 | [mk_fpa_rtn => ["Z3_context"] => "Z3_ast"], | ||
| 787 | [mk_fpa_round_toward_zero => ["Z3_context"] => "Z3_ast"], | ||
| 788 | [mk_fpa_rtz => ["Z3_context"] => "Z3_ast"], | ||
| 789 | [mk_fpa_sort => ["Z3_context", "uint", "uint"] => "Z3_sort"], | ||
| 790 | [mk_fpa_sort_half => ["Z3_context"] => "Z3_sort"], | ||
| 791 | [mk_fpa_sort_16 => ["Z3_context"] => "Z3_sort"], | ||
| 792 | [mk_fpa_sort_single => ["Z3_context"] => "Z3_sort"], | ||
| 793 | [mk_fpa_sort_32 => ["Z3_context"] => "Z3_sort"], | ||
| 794 | [mk_fpa_sort_double => ["Z3_context"] => "Z3_sort"], | ||
| 795 | [mk_fpa_sort_64 => ["Z3_context"] => "Z3_sort"], | ||
| 796 | [mk_fpa_sort_quadruple => ["Z3_context"] => "Z3_sort"], | ||
| 797 | [mk_fpa_sort_128 => ["Z3_context"] => "Z3_sort"], | ||
| 798 | [mk_fpa_nan => ["Z3_context", "Z3_sort"] => "Z3_ast"], | ||
| 799 | [mk_fpa_inf => ["Z3_context", "Z3_sort", "bool"] => "Z3_ast"], | ||
| 800 | [mk_fpa_zero => ["Z3_context", "Z3_sort", "bool"] => "Z3_ast"], | ||
| 801 | [mk_fpa_fp => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 802 | [mk_fpa_numeral_float => ["Z3_context", "float", "Z3_sort"] => "Z3_ast"], | ||
| 803 | [mk_fpa_numeral_double => ["Z3_context", "double", "Z3_sort"] => "Z3_ast"], | ||
| 804 | [mk_fpa_numeral_int => ["Z3_context", "int", "Z3_sort"] => "Z3_ast"], | ||
| 805 | [mk_fpa_numeral_int_uint => ["Z3_context", "bool", "int", "uint", "Z3_sort"] => "Z3_ast"], | ||
| 806 | [mk_fpa_numeral_int64_uint64 => ["Z3_context", "bool", "int64_t", "uint64_t", "Z3_sort"] => "Z3_ast"], | ||
| 807 | [mk_fpa_abs => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 808 | [mk_fpa_neg => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 809 | [mk_fpa_add => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 810 | [mk_fpa_sub => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 811 | [mk_fpa_mul => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 812 | [mk_fpa_div => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 813 | [mk_fpa_fma => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 814 | [mk_fpa_sqrt => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 815 | [mk_fpa_rem => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 816 | [mk_fpa_round_to_integral => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 817 | [mk_fpa_min => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 818 | [mk_fpa_max => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 819 | [mk_fpa_leq => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 820 | [mk_fpa_lt => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 821 | [mk_fpa_geq => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 822 | [mk_fpa_gt => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 823 | [mk_fpa_eq => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 824 | [mk_fpa_is_normal => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 825 | [mk_fpa_is_subnormal => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 826 | [mk_fpa_is_zero => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 827 | [mk_fpa_is_infinite => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 828 | [mk_fpa_is_nan => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 829 | [mk_fpa_is_negative => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 830 | [mk_fpa_is_positive => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 831 | [mk_fpa_to_fp_bv => ["Z3_context", "Z3_ast", "Z3_sort"] => "Z3_ast"], | ||
| 832 | [mk_fpa_to_fp_float => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_sort"] => "Z3_ast"], | ||
| 833 | [mk_fpa_to_fp_real => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_sort"] => "Z3_ast"], | ||
| 834 | [mk_fpa_to_fp_signed => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_sort"] => "Z3_ast"], | ||
| 835 | # [mk_fpa_to_fp_uint => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_sort"] => "Z3_ast"], # TODO not found in library | ||
| 836 | [mk_fpa_to_ubv => ["Z3_context", "Z3_ast", "Z3_ast", "uint"] => "Z3_ast"], | ||
| 837 | [mk_fpa_to_sbv => ["Z3_context", "Z3_ast", "Z3_ast", "uint"] => "Z3_ast"], | ||
| 838 | [mk_fpa_to_real => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 839 | [fpa_get_ebits => ["Z3_context", "Z3_sort"] => "uint"], | ||
| 840 | [fpa_get_sbits => ["Z3_context", "Z3_sort"] => "uint"], | ||
| 841 | [fpa_is_numeral_nan => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 842 | [fpa_is_numeral_inf => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 843 | [fpa_is_numeral_zero => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 844 | [fpa_is_numeral_normal => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 845 | [fpa_is_numeral_subnormal => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 846 | [fpa_is_numeral_positive => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 847 | [fpa_is_numeral_negative => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 848 | [fpa_get_numeral_sign_bv => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 849 | [fpa_get_numeral_significand_bv => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 850 | [fpa_get_numeral_sign => ["Z3_context", "Z3_ast", "int *"] => "bool"], | ||
| 851 | [fpa_get_numeral_significand_string => ["Z3_context", "Z3_ast"] => "Z3_string"], | ||
| 852 | [fpa_get_numeral_significand_uint64 => ["Z3_context", "Z3_ast", "uint64_t *"] => "bool"], | ||
| 853 | [fpa_get_numeral_exponent_string => ["Z3_context", "Z3_ast", "bool"] => "Z3_string"], | ||
| 854 | [fpa_get_numeral_exponent_int64 => ["Z3_context", "Z3_ast", "int64_t *", "bool"] => "bool"], | ||
| 855 | [fpa_get_numeral_exponent_bv => ["Z3_context", "Z3_ast", "bool"] => "Z3_ast"], | ||
| 856 | [mk_fpa_to_ieee_bv => ["Z3_context", "Z3_ast"] => "Z3_ast"], | ||
| 857 | [mk_fpa_to_fp_int_real => ["Z3_context", "Z3_ast", "Z3_ast", "Z3_ast", "Z3_sort"] => "Z3_ast"], | ||
| 858 | [algebraic_is_value => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 859 | [algebraic_is_pos => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 860 | [algebraic_is_neg => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 861 | [algebraic_is_zero => ["Z3_context", "Z3_ast"] => "bool"], | ||
| 862 | [algebraic_sign => ["Z3_context", "Z3_ast"] => "int"], | ||
| 863 | [algebraic_add => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 864 | [algebraic_sub => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 865 | [algebraic_mul => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 866 | [algebraic_div => ["Z3_context", "Z3_ast", "Z3_ast"] => "Z3_ast"], | ||
| 867 | [algebraic_root => ["Z3_context", "Z3_ast", "uint"] => "Z3_ast"], | ||
| 868 | [algebraic_power => ["Z3_context", "Z3_ast", "uint"] => "Z3_ast"], | ||
| 869 | [algebraic_lt => ["Z3_context", "Z3_ast", "Z3_ast"] => "bool"], | ||
| 870 | [algebraic_gt => ["Z3_context", "Z3_ast", "Z3_ast"] => "bool"], | ||
| 871 | [algebraic_le => ["Z3_context", "Z3_ast", "Z3_ast"] => "bool"], | ||
| 872 | [algebraic_ge => ["Z3_context", "Z3_ast", "Z3_ast"] => "bool"], | ||
| 873 | [algebraic_eq => ["Z3_context", "Z3_ast", "Z3_ast"] => "bool"], | ||
| 874 | [algebraic_neq => ["Z3_context", "Z3_ast", "Z3_ast"] => "bool"], | ||
| 875 | [algebraic_roots => ["Z3_context", "Z3_ast", "uint", "Z3_ast_arr"] => "Z3_ast_vector"], | ||
| 876 | [algebraic_eval => ["Z3_context", "Z3_ast", "uint", "Z3_ast_arr"] => "int"], | ||
| 877 | [mk_ast_vector => ["Z3_context"] => "Z3_ast_vector"], | ||
| 878 | [ast_vector_inc_ref => ["Z3_context", "Z3_ast_vector"] => "void"], | ||
| 879 | [ast_vector_dec_ref => ["Z3_context", "Z3_ast_vector"] => "void"], | ||
| 880 | [ast_vector_size => ["Z3_context", "Z3_ast_vector"] => "uint"], | ||
| 881 | [ast_vector_get => ["Z3_context", "Z3_ast_vector", "uint"] => "Z3_ast"], | ||
| 882 | [ast_vector_set => ["Z3_context", "Z3_ast_vector", "uint", "Z3_ast"] => "void"], | ||
| 883 | [ast_vector_resize => ["Z3_context", "Z3_ast_vector", "uint"] => "void"], | ||
| 884 | [ast_vector_push => ["Z3_context", "Z3_ast_vector", "Z3_ast"] => "void"], | ||
| 885 | [ast_vector_translate => ["Z3_context", "Z3_ast_vector", "Z3_context"] => "Z3_ast_vector"], | ||
| 886 | [ast_vector_to_string => ["Z3_context", "Z3_ast_vector"] => "Z3_string"], | ||
| 887 | [mk_ast_map => ["Z3_context"] => "Z3_ast_map"], | ||
| 888 | [ast_map_inc_ref => ["Z3_context", "Z3_ast_map"] => "void"], | ||
| 889 | [ast_map_dec_ref => ["Z3_context", "Z3_ast_map"] => "void"], | ||
| 890 | [ast_map_contains => ["Z3_context", "Z3_ast_map", "Z3_ast"] => "bool"], | ||
| 891 | [ast_map_find => ["Z3_context", "Z3_ast_map", "Z3_ast"] => "Z3_ast"], | ||
| 892 | [ast_map_insert => ["Z3_context", "Z3_ast_map", "Z3_ast", "Z3_ast"] => "void"], | ||
| 893 | [ast_map_erase => ["Z3_context", "Z3_ast_map", "Z3_ast"] => "void"], | ||
| 894 | [ast_map_reset => ["Z3_context", "Z3_ast_map"] => "void"], | ||
| 895 | [ast_map_size => ["Z3_context", "Z3_ast_map"] => "uint"], | ||
| 896 | [ast_map_keys => ["Z3_context", "Z3_ast_map"] => "Z3_ast_vector"], | ||
| 897 | [ast_map_to_string => ["Z3_context", "Z3_ast_map"] => "Z3_string"], | ||
| 898 | [mk_optimize => ["Z3_context"] => "Z3_optimize"], | ||
| 899 | [optimize_inc_ref => ["Z3_context", "Z3_optimize"] => "void"], | ||
| 900 | [optimize_dec_ref => ["Z3_context", "Z3_optimize"] => "void"], | ||
| 901 | [optimize_assert => ["Z3_context", "Z3_optimize", "Z3_ast"] => "void"], | ||
| 902 | [optimize_assert_soft => ["Z3_context", "Z3_optimize", "Z3_ast", "Z3_string", "Z3_symbol"] => "uint"], | ||
| 903 | [optimize_maximize => ["Z3_context", "Z3_optimize", "Z3_ast"] => "uint"], | ||
| 904 | [optimize_minimize => ["Z3_context", "Z3_optimize", "Z3_ast"] => "uint"], | ||
| 905 | [optimize_push => ["Z3_context", "Z3_optimize"] => "void"], | ||
| 906 | [optimize_pop => ["Z3_context", "Z3_optimize"] => "void"], | ||
| 907 | [optimize_check => ["Z3_context", "Z3_optimize", "uint", "Z3_ast_arr"] => "Z3_lbool"], | ||
| 908 | [optimize_get_reason_unknown => ["Z3_context", "Z3_optimize"] => "Z3_string"], | ||
| 909 | [optimize_get_model => ["Z3_context", "Z3_optimize"] => "Z3_model"], | ||
| 910 | [optimize_get_unsat_core => ["Z3_context", "Z3_optimize"] => "Z3_ast_vector"], | ||
| 911 | [optimize_set_params => ["Z3_context", "Z3_optimize", "Z3_params"] => "void"], | ||
| 912 | [optimize_get_param_descrs => ["Z3_context", "Z3_optimize"] => "Z3_param_descrs"], | ||
| 913 | [optimize_get_lower => ["Z3_context", "Z3_optimize", "uint"] => "Z3_ast"], | ||
| 914 | [optimize_get_upper => ["Z3_context", "Z3_optimize", "uint"] => "Z3_ast"], | ||
| 915 | [optimize_get_lower_as_vector => ["Z3_context", "Z3_optimize", "uint"] => "Z3_ast_vector"], | ||
| 916 | [optimize_get_upper_as_vector => ["Z3_context", "Z3_optimize", "uint"] => "Z3_ast_vector"], | ||
| 917 | [optimize_to_string => ["Z3_context", "Z3_optimize"] => "Z3_string"], | ||
| 918 | [optimize_from_string => ["Z3_context", "Z3_optimize", "Z3_string"] => "void"], | ||
| 919 | [optimize_from_file => ["Z3_context", "Z3_optimize", "Z3_string"] => "void"], | ||
| 920 | [optimize_get_help => ["Z3_context", "Z3_optimize"] => "Z3_string"], | ||
| 921 | [optimize_get_statistics => ["Z3_context", "Z3_optimize"] => "Z3_stats"], | ||
| 922 | [optimize_get_assertions => ["Z3_context", "Z3_optimize"] => "Z3_ast_vector"], | ||
| 923 | [optimize_get_objectives => ["Z3_context", "Z3_optimize"] => "Z3_ast_vector"], | ||
| 924 | [rcf_del => ["Z3_context", "Z3_rcf_num"] => "void"], | ||
| 925 | [rcf_mk_rational => ["Z3_context", "Z3_string"] => "Z3_rcf_num"], | ||
| 926 | [rcf_mk_small_int => ["Z3_context", "int"] => "Z3_rcf_num"], | ||
| 927 | [rcf_mk_pi => ["Z3_context"] => "Z3_rcf_num"], | ||
| 928 | [rcf_mk_e => ["Z3_context"] => "Z3_rcf_num"], | ||
| 929 | [rcf_mk_infinitesimal => ["Z3_context"] => "Z3_rcf_num"], | ||
| 930 | [rcf_mk_roots => ["Z3_context", "uint", "Z3_rcf_num_arr", "Z3_rcf_num_arr"] => "uint"], | ||
| 931 | [rcf_add => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "Z3_rcf_num"], | ||
| 932 | [rcf_sub => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "Z3_rcf_num"], | ||
| 933 | [rcf_mul => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "Z3_rcf_num"], | ||
| 934 | [rcf_div => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "Z3_rcf_num"], | ||
| 935 | [rcf_neg => ["Z3_context", "Z3_rcf_num"] => "Z3_rcf_num"], | ||
| 936 | [rcf_inv => ["Z3_context", "Z3_rcf_num"] => "Z3_rcf_num"], | ||
| 937 | [rcf_power => ["Z3_context", "Z3_rcf_num", "uint"] => "Z3_rcf_num"], | ||
| 938 | [rcf_lt => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "bool"], | ||
| 939 | [rcf_gt => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "bool"], | ||
| 940 | [rcf_le => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "bool"], | ||
| 941 | [rcf_ge => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "bool"], | ||
| 942 | [rcf_eq => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "bool"], | ||
| 943 | [rcf_neq => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num"] => "bool"], | ||
| 944 | [rcf_num_to_string => ["Z3_context", "Z3_rcf_num", "bool", "bool"] => "Z3_string"], | ||
| 945 | [rcf_num_to_decimal_string => ["Z3_context", "Z3_rcf_num", "uint"] => "Z3_string"], | ||
| 946 | [rcf_get_numerator_denominator => ["Z3_context", "Z3_rcf_num", "Z3_rcf_num_ptr", "Z3_rcf_num_ptr"] => "void", sub { | ||
| 947 | my ($xsub, $ctx, $in, $num, $denom) = @_; | ||
| 948 | die "\$num needs to be passed as a scalar reference to rcf_get_numerator_denominator" unless ref($num) eq 'SCALAR'; | ||
| 949 | die "\$denom needs to be passed as a scalar reference to rcf_get_numerator_denominator" unless ref($denom) eq 'SCALAR'; | ||
| 950 | |||
| 951 | my $ret = $xsub->($ctx, $in, $num, $denom); | ||
| 952 | my $pointer = $$num; | ||
| 953 | my $pointer2 = $$denom; | ||
| 954 | # rebless the inner object into the right type for later | ||
| 955 | $$num = bless \$pointer, "Z3::FFI::Types::Z3_rcf_num"; | ||
| 956 | $$denom = bless \$pointer2, "Z3::FFI::Types::Z3_rcf_num"; | ||
| 957 | |||
| 958 | return $ret; | ||
| 959 | }], | ||
| 960 | ]; | ||
| 961 | |||
| 962 | my $real_types = { | ||
| 963 | Z3_bool => 'bool', | ||
| 964 | Z3_lbool => 'int', | ||
| 965 | Z3_parameter_kind => 'int', | ||
| 966 | Z3_symbol_kind => 'int', | ||
| 967 | Z3_sort_kind => 'int', | ||
| 968 | Z3_ast_kind => 'int', | ||
| 969 | Z3_decl_kind => 'int', | ||
| 970 | Z3_param_kind => 'int', | ||
| 971 | Z3_ast_print_mode => 'int', | ||
| 972 | Z3_error_code => 'int', | ||
| 973 | Z3_goal_prec => 'int', | ||
| 974 | Z3_string => 'string', | ||
| 975 | Z3_string_ptr => 'string *', | ||
| 976 | Z3_error_handler => '(opaque, opaque)->void', | ||
| 977 | }; | ||
| 978 | |||
| 979 | for my $type (@$opaque_types) { | ||
| 980 | # print "Makeint type $type\n"; | ||
| 981 | $ffi->custom_type($type => { | ||
| 982 | native_type => 'opaque', | ||
| 983 | native_to_perl => sub { | ||
| 984 | my $class = "Z3::FFI::Types::$type"; | ||
| 985 | # print $class, "\n"; | ||
| 986 | bless \$_[0], $class; | ||
| 987 | }, | ||
| 988 | perl_to_native => sub { | ||
| 989 | my $val = shift; | ||
| 990 | die "Wrong type passed, ".ref($val)." expected Z3::FFI::Types::$type" unless ref($val) eq "Z3::FFI::Types::$type"; | ||
| 991 | |||
| 992 | return $$val | ||
| 993 | }}); | ||
| 994 | |||
| 995 | $ffi->load_custom_type("Z3::FFI::ArrayType" => $type."_arr", $type); | ||
| 996 | |||
| 997 | $ffi->type("opaque*" => $type."_ptr"); | ||
| 998 | } | ||
| 999 | |||
| 1000 | |||
| 1001 | for my $type_name (keys %$real_types) { | ||
| 1002 | my $real_type = $real_types->{$type_name}; | ||
| 1003 | $ffi->type($real_type => $type_name); | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | for my $function (@$functions) { | ||
| 1007 | my $name = shift @$function; | ||
| 1008 | $ffi->attach(["Z3_$name" => $name], @$function); | ||
| 1009 | } | ||
| 1010 | |||
| 1011 | 1; | ||
| 1012 | |||
| 1013 | __END__ | ||