1m4_dnl -*- C++ -*- 2m4_define(`dnl', `m4_dnl') 3m4_divert(-1) 4This m4 file contains the code for generating ppl_java_<CLASS_NAME>.cc 5 6Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> 7Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com) 8 9This file is part of the Parma Polyhedra Library (PPL). 10 11The PPL is free software; you can redistribute it and/or modify it 12under the terms of the GNU General Public License as published by the 13Free Software Foundation; either version 3 of the License, or (at your 14option) any later version. 15 16The PPL is distributed in the hope that it will be useful, but WITHOUT 17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19for more details. 20 21You should have received a copy of the GNU General Public License 22along with this program; if not, write to the Free Software Foundation, 23Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 24 25For the most up-to-date information see the Parma Polyhedra Library 26site: http://bugseng.com/products/ppl/ . 27 28FIXME: Find a way to avoid having these dummy macros. 29No code is needed for these procedure schemas in the Java interface 30as the tokens argument for widening and extrapolation is optional. 31 32m4_define(`ppl_@CLASS@_@WIDEN@_widening_assign_with_tokens_code', `') 33m4_define(`ppl_@CLASS@_widening_assign_with_tokens_code', `') 34m4_define(`ppl_@CLASS@_@EXTRAPOLATION@_extrapolation_assign_with_tokens_code', `') 35m4_define(`ppl_@CLASS@_@LIMITEDBOUNDED@_@WIDENEXPN@_extrapolation_assign_with_tokens_code', `') 36 37Define here as empty any known schematic method macros for which 38the definition is not yet implemented. 39 40m4_define(`ppl_new_@CLASS@_iterator_from_iterator_code', 41`dnl 42#include "parma_polyhedra_library_@CLASS@_Iterator.h" 43 44JNIEXPORT void JNICALL 45Java_parma_1polyhedra_1library_@1CLASS@_1Iterator_build_1cpp_1object 46(JNIEnv* env, jobject j_this, jobject j_y) try { 47 @CPP_CLASS@::iterator* y_ptr 48 = reinterpret_cast<@CPP_CLASS@::iterator*>(get_ptr(env, j_y)); 49 @CPP_CLASS@::iterator* this_ptr 50 = new @CPP_CLASS@::iterator(*y_ptr); 51 set_ptr(env, j_this, this_ptr); 52} 53CATCH_ALL 54 55') 56 57m4_define(`ppl_@CLASS@_iterator_equals_iterator_code', 58`dnl 59JNIEXPORT jboolean JNICALL 60Java_parma_1polyhedra_1library_@1CLASS@_1Iterator_equals 61(JNIEnv* env, jobject j_this, jobject j_y) { 62 try { 63 @CPP_CLASS@::iterator* this_ptr 64 = reinterpret_cast<@CPP_CLASS@::iterator*>(get_ptr(env, j_this)); 65 @CPP_CLASS@::iterator* y_ptr 66 = reinterpret_cast<@CPP_CLASS@::iterator*>(get_ptr(env, j_y)); 67 return *this_ptr == *y_ptr; 68 } 69 CATCH_ALL; 70 return false; 71} 72 73') 74 75m4_define(`ppl_@CLASS@_@BEGINEND@_iterator_code', 76`dnl 77JNIEXPORT jobject JNICALL 78Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_@BEGINEND@_1iterator 79(JNIEnv* env, jobject j_this) { 80 try { 81 @CPP_CLASS@* this_ptr 82 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 83 jclass j_it_class 84 = env->FindClass("parma_polyhedra_library/@TOPOLOGY@@CLASS@_Iterator"); 85 CHECK_RESULT_ASSERT(env, j_it_class); 86 jmethodID j_it_ctr_id = env->GetMethodID(j_it_class, "<init>", "()V"); 87 CHECK_RESULT_ASSERT(env, j_it_ctr_id); 88 jobject j_it = env->NewObject(j_it_class, j_it_ctr_id); 89 CHECK_RESULT_RETURN(env, j_it, 0); 90 @TOPOLOGY@@CPP_CLASS@::iterator* ppl_it 91 = new @TOPOLOGY@@CPP_CLASS@::iterator(this_ptr->@BEGINEND@()); 92 set_ptr(env, j_it, ppl_it); 93 return j_it; 94 } 95 CATCH_ALL; 96 jobject null = 0; 97 return null; 98} 99 100') 101 102m4_define(`ppl_delete_@CLASS@_iterator_code', 103`dnl 104JNIEXPORT void JNICALL 105Java_parma_1polyhedra_1library_@1CLASS@_1Iterator_free 106(JNIEnv* env, jobject j_this) try { 107 if (!is_java_marked(env, j_this)) { 108 @CPP_CLASS@::iterator* this_ptr 109 = reinterpret_cast<@CPP_CLASS@::iterator*>(get_ptr(env, j_this)); 110 delete this_ptr; 111 void* null_ptr = 0; 112 set_ptr(env, j_this, null_ptr); 113 } 114} 115CATCH_ALL 116 117JNIEXPORT void JNICALL 118Java_parma_1polyhedra_1library_@1CLASS@_1Iterator_finalize 119(JNIEnv* env, jobject j_this) try { 120 if (!is_java_marked(env, j_this)) { 121 @CPP_CLASS@::iterator* this_ptr 122 = reinterpret_cast<@CPP_CLASS@::iterator*>(get_ptr(env, j_this)); 123 delete this_ptr; 124 } 125} 126CATCH_ALL 127 128') 129 130m4_define(`ppl_@CLASS@_@INCDEC@_iterator_code', 131`dnl 132JNIEXPORT void JNICALL 133Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_1Iterator_@A_INCDEC@ 134(JNIEnv* env, jobject j_this) try { 135 @TOPOLOGY@@CPP_CLASS@::iterator* this_ptr 136 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@::iterator*>(get_ptr(env, j_this)); 137 m4_@INCDEC@_cpp_name()(*this_ptr); 138} 139CATCH_ALL 140 141') 142 143m4_define(`m4_increment_cpp_name', `++') 144m4_define(`m4_decrement_cpp_name', `--') 145 146m4_define(`ppl_@CLASS@_get_disjunct_code', 147`dnl 148JNIEXPORT jobject JNICALL 149Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_1Iterator_get_1disjunct 150(JNIEnv* env, jobject j_this) { 151 try { 152 @TOPOLOGY@@CPP_CLASS@::iterator* this_ptr 153 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@::iterator*>(get_ptr(env, j_this)); 154 jclass j_class = env->FindClass("parma_polyhedra_library/@DISJUNCT_TOPOLOGY@@DISJUNCT@"); 155 CHECK_RESULT_ASSERT(env, j_class); 156 jmethodID j_ctr_id = env->GetMethodID(j_class, "<init>", "()V"); 157 CHECK_RESULT_ASSERT(env, j_ctr_id); 158 jobject j_obj = env->NewObject(j_class, j_ctr_id); 159 CHECK_RESULT_RETURN(env, j_obj, 0); 160 set_ptr(env, j_obj, &((*this_ptr)->pointset()), true); 161 return j_obj; 162 } 163 CATCH_ALL; 164 jobject null = 0; 165 return null; 166} 167 168') 169 170m4_define(`ppl_@CLASS@_drop_disjunct_code', 171`dnl 172JNIEXPORT void JNICALL 173Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_drop_1disjunct 174(JNIEnv* env, jobject j_this, jobject j_it) try { 175 @TOPOLOGY@@CPP_CLASS@* this_ptr 176 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_this)); 177 @TOPOLOGY@@CPP_CLASS@::iterator& itr 178 = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@::iterator*>(get_ptr(env, j_it))); 179 itr = this_ptr->drop_disjunct(itr); 180} 181CATCH_ALL 182 183') 184 185m4_define(`ppl_@CLASS@_drop_disjuncts_code', 186`dnl 187JNIEXPORT void JNICALL 188Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_drop_1disjuncts 189(JNIEnv* env, jobject j_this, jobject j_first, jobject j_last) try { 190 @TOPOLOGY@@CPP_CLASS@::iterator* first_ptr 191 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@::iterator*>(get_ptr(env, j_first)); 192 @TOPOLOGY@@CPP_CLASS@::iterator* last_ptr 193 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@::iterator*>(get_ptr(env, j_last)); 194 @TOPOLOGY@@CPP_CLASS@* this_ptr 195 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_this)); 196 this_ptr->drop_disjuncts(*first_ptr, *last_ptr); 197} 198CATCH_ALL 199 200') 201 202m4_define(`ppl_@CLASS@_add_disjunct_code', 203`dnl 204JNIEXPORT void JNICALL 205Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_add_1disjunct 206(JNIEnv* env, jobject j_this, jobject j_d) try { 207 @TOPOLOGY@@CPP_CLASS@* this_ptr 208 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_this)); 209 @DISJUNCT_TOPOLOGY@@A_DISJUNCT@* d_ptr 210 = reinterpret_cast<@DISJUNCT_TOPOLOGY@@A_DISJUNCT@*>(get_ptr(env, j_d)); 211 this_ptr->add_disjunct(*d_ptr); 212} 213CATCH_ALL 214 215') 216 217m4_define(`ppl_new_@TOPOLOGY@@CLASS@_from_space_dimension_code', 218`dnl 219JNIEXPORT void JNICALL 220Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_build_1cpp_1object__JLparma_1polyhedra_1library_Degenerate_1Element_2 221(JNIEnv* env, jobject j_this, jlong j_dim, jobject j_degenerate_element) try { 222 dimension_type ppl_dim = jtype_to_unsigned<dimension_type>(j_dim); 223 jint j_degenerate_element_int 224 = env->CallIntMethod(j_degenerate_element, 225 cached_FMIDs.Degenerate_Element_ordinal_ID); 226 CHECK_EXCEPTION_ASSERT(env); 227 @TOPOLOGY@@CPP_CLASS@* this_ptr; 228 switch (j_degenerate_element_int) { 229 case 0: 230 this_ptr = new @TOPOLOGY@@CPP_CLASS@(ppl_dim, UNIVERSE); 231 break; 232 case 1: 233 this_ptr = new @TOPOLOGY@@CPP_CLASS@(ppl_dim, EMPTY); 234 break; 235 default: 236 PPL_JAVA_UNEXPECTED; 237 break; 238 } 239 set_ptr(env, j_this, this_ptr); 240} 241CATCH_ALL 242 243') 244 245m4_define(`ppl_new_@TOPOLOGY@@CLASS@_from_@FRIEND@_code', 246`dnl 247JNIEXPORT void JNICALL 248Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_build_1cpp_1object__Lparma_1polyhedra_1library_@1FRIEND@_2 249(JNIEnv* env, jobject j_this, jobject j_y) try { 250 @B_FRIEND@* y_ptr 251 = reinterpret_cast<@B_FRIEND@*>(get_ptr(env, j_y)); 252 @TOPOLOGY@@CPP_CLASS@* this_ptr = new @TOPOLOGY@@CPP_CLASS@(*y_ptr); 253 set_ptr(env, j_this, this_ptr); 254} 255CATCH_ALL 256 257') 258 259m4_define(`ppl_new_@TOPOLOGY@@CLASS@_from_@FRIEND@_with_complexity_code', 260`dnl 261JNIEXPORT void JNICALL 262Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_build_1cpp_1object__Lparma_1polyhedra_1library_@1FRIEND@_2Lparma_1polyhedra_1library_Complexity_1Class_2 263(JNIEnv* env, jobject j_this, jobject j_y, jobject j_complexity) try { 264 @B_FRIEND@* y_ptr 265 = reinterpret_cast<@B_FRIEND@*>(get_ptr(env, j_y)); 266 jint j_complexity_int 267 = env->CallIntMethod(j_complexity, 268 cached_FMIDs.Complexity_Class_ordinal_ID); 269 CHECK_EXCEPTION_ASSERT(env); 270 @TOPOLOGY@@CPP_CLASS@* this_ptr; 271 switch (j_complexity_int) { 272 case 0: 273 this_ptr = new @TOPOLOGY@@CPP_CLASS@(*y_ptr, POLYNOMIAL_COMPLEXITY); 274 break; 275 case 1: 276 this_ptr = new @TOPOLOGY@@CPP_CLASS@(*y_ptr, SIMPLEX_COMPLEXITY); 277 break; 278 case 2: 279 this_ptr = new @TOPOLOGY@@CPP_CLASS@(*y_ptr, ANY_COMPLEXITY); 280 break; 281 default: 282 PPL_JAVA_UNEXPECTED; 283 break; 284 } 285 set_ptr(env, j_this, this_ptr); 286} 287CATCH_ALL 288 289') 290 291m4_define(`ppl_new_@TOPOLOGY@@CLASS@_from_@BUILD_REPRESENT@s_code', 292`dnl 293JNIEXPORT void JNICALL 294Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_build_1cpp_1object__Lparma_1polyhedra_1library_@1!BUILD_REPRESENT@_1System_2 295(JNIEnv* env, jobject j_this, jobject j_iterable) try { 296 @!BUILD_REPRESENT@_System cs 297 = build_cxx_@BUILD_REPRESENT@_system(env, j_iterable); 298 @TOPOLOGY@@CPP_CLASS@* this_ptr = new @TOPOLOGY@@CPP_CLASS@(cs@RECYCLE@); 299 set_ptr(env, j_this, this_ptr); 300} 301CATCH_ALL 302 303') 304 305m4_define(`ppl_@CLASS@_@UB_EXACT@_code', 306`dnl 307JNIEXPORT jboolean JNICALL 308Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_@1UB_EXACT@ 309(JNIEnv* env, jobject j_this, jobject j_y) { 310 try { 311 @TOPOLOGY@@CPP_CLASS@* this_ptr 312 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_this)); 313 @TOPOLOGY@@CPP_CLASS@* y_ptr 314 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_y)); 315 return this_ptr->@UB_EXACT@(*y_ptr); 316 } 317 CATCH_ALL; 318 return false; 319} 320 321') 322 323m4_define(`ppl_delete_@CLASS@_code', 324`dnl 325JNIEXPORT void JNICALL 326Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_finalize 327(JNIEnv* env, jobject j_this) try { 328 if (!is_java_marked(env, j_this)) { 329 @TOPOLOGY@@CPP_CLASS@* this_ptr 330 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_this)); 331 delete this_ptr; 332 } 333} 334CATCH_ALL 335 336') 337 338m4_define(`ppl_free_@CLASS@_code', 339`dnl 340JNIEXPORT void JNICALL 341Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_free 342(JNIEnv* env, jobject j_this) try { 343 if (!is_java_marked(env, j_this)) { 344 @TOPOLOGY@@CPP_CLASS@* this_ptr 345 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_this)); 346 delete this_ptr; 347 void* null_ptr = 0; 348 set_ptr(env, j_this, null_ptr); 349 } 350} 351CATCH_ALL 352 353') 354 355m4_define(`ppl_@CLASS@_swap_code', 356`dnl 357JNIEXPORT void JNICALL 358Java_parma_1polyhedra_1library_@1CLASS@_swap 359(JNIEnv* env, jobject j_this, jobject j_y) try { 360 @CPP_CLASS@* this_ptr 361 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 362 @CPP_CLASS@* y_ptr 363 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 364 swap(*this_ptr, *y_ptr); 365} 366CATCH_ALL 367 368') 369 370m4_define(`ppl_@CLASS@_@DIMENSION@_code', 371`dnl 372JNIEXPORT jlong JNICALL 373Java_parma_1polyhedra_1library_@1CLASS@_@1DIMENSION@ 374(JNIEnv* env, jobject j_this) { 375 try { 376 @CPP_CLASS@* this_ptr 377 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 378 return this_ptr->@DIMENSION@(); 379 } 380 CATCH_ALL; 381 return 0; 382} 383 384') 385 386m4_define(`ppl_@CLASS@_get_@CLASS_REPRESENT@s_code', 387`dnl 388JNIEXPORT jobject JNICALL 389Java_parma_1polyhedra_1library_@1CLASS@_@1CLASS_REPRESENT@s 390(JNIEnv* env, jobject j_this) { 391 try { 392 @CPP_CLASS@* this_ptr 393 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 394 return build_java_@CLASS_REPRESENT@_system(env, this_ptr->@CLASS_REPRESENT@s()); 395 } 396 CATCH_ALL; 397 jobject null = 0; 398 return null; 399} 400 401') 402 403m4_define(`ppl_@CLASS@_get_minimized_@CLASS_REPRESENT@s_code', 404`dnl 405JNIEXPORT jobject JNICALL 406Java_parma_1polyhedra_1library_@1CLASS@_minimized_1@1CLASS_REPRESENT@s 407(JNIEnv* env, jobject j_this) { 408 try { 409 @CPP_CLASS@* this_ptr 410 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 411 return build_java_@CLASS_REPRESENT@_system(env, 412 this_ptr->minimized_@CLASS_REPRESENT@s()); 413 } 414 CATCH_ALL; 415 jobject null = 0; 416 return null; 417} 418 419') 420 421m4_define(`ppl_@CLASS@_relation_with_@RELATION_REPRESENT@_code', 422`dnl 423JNIEXPORT jobject JNICALL 424Java_parma_1polyhedra_1library_@1CLASS@_relation_1with__Lparma_1polyhedra_1library_@1!RELATION_REPRESENT@_2 425(JNIEnv* env, jobject j_this, jobject j_c) { 426 try { 427 @CPP_CLASS@* this_ptr 428 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 429 @!RELATION_REPRESENT@ c = build_cxx_@RELATION_REPRESENT@(env, j_c); 430 Poly_@!A_RELATION_REPRESENT@_Relation pcr = this_ptr->relation_with(c); 431 return build_java_poly_@A_RELATION_REPRESENT@_relation(env, pcr); 432 } 433 CATCH_ALL; 434 jobject null = 0; 435 return null; 436} 437 438') 439 440m4_define(`ppl_@CLASS@_@HAS_PROPERTY@_code', 441`dnl 442JNIEXPORT jboolean JNICALL 443Java_parma_1polyhedra_1library_@1CLASS@_@1HAS_PROPERTY@ 444(JNIEnv* env, jobject j_this) { 445 try { 446 @CPP_CLASS@* this_ptr 447 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 448 return this_ptr->@HAS_PROPERTY@(); 449 } 450 CATCH_ALL; 451 return false; 452} 453 454') 455 456m4_define(`ppl_@CLASS@_@SIMPLIFY@_code', 457`dnl 458JNIEXPORT void JNICALL 459Java_parma_1polyhedra_1library_@1CLASS@_@1SIMPLIFY@ 460(JNIEnv* env, jobject j_this) try { 461 @CPP_CLASS@* this_ptr 462 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 463 this_ptr->@SIMPLIFY@(); 464} 465CATCH_ALL 466 467') 468 469m4_define(`ppl_@CLASS@_unconstrain_space_dimension_code', 470`dnl 471JNIEXPORT void JNICALL 472Java_parma_1polyhedra_1library_@1CLASS@_unconstrain_1space_1dimension 473(JNIEnv* env, jobject j_this, jobject j_var) try { 474 @CPP_CLASS@* this_ptr 475 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 476 Variable v = build_cxx_variable(env, j_var); 477 this_ptr->unconstrain(v); 478} 479CATCH_ALL 480 481') 482 483m4_define(`ppl_@CLASS@_unconstrain_space_dimensions_code', 484`dnl 485JNIEXPORT void JNICALL 486Java_parma_1polyhedra_1library_@1CLASS@_unconstrain_1space_1dimensions 487(JNIEnv* env, jobject j_this, jobject j_v_set) try { 488 @CPP_CLASS@* this_ptr 489 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 490 Variables_Set v_set = build_cxx_variables_set(env, j_v_set); 491 this_ptr->unconstrain(v_set); 492} 493CATCH_ALL 494 495') 496 497m4_define(`ppl_@CLASS@_bounds_from_@ABOVEBELOW@_code', 498`dnl 499JNIEXPORT jboolean JNICALL 500Java_parma_1polyhedra_1library_@1CLASS@_bounds_1from_1@1ABOVEBELOW@ 501(JNIEnv* env, jobject j_this, jobject j_le) { 502 try { 503 @CPP_CLASS@* this_ptr 504 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 505 Linear_Expression le = build_cxx_linear_expression(env, j_le); 506 return this_ptr->bounds_from_@ABOVEBELOW@(le); 507 } 508 CATCH_ALL; 509 return false; 510} 511 512') 513 514m4_define(`ppl_@CLASS@_has_@UPPERLOWER@_bound_code', 515`dnl 516JNIEXPORT jboolean JNICALL 517Java_parma_1polyhedra_1library_@1CLASS@_has_1@UPPERLOWER@_1bound 518(JNIEnv* env, jobject j_this, jobject j_var, 519 jobject j_num, jobject j_den, jobject j_ref_boolean) { 520 try { 521 @CPP_CLASS@* this_ptr 522 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 523 Variable var = build_cxx_variable(env, j_var); 524 PPL_DIRTY_TEMP_COEFFICIENT(num); 525 PPL_DIRTY_TEMP_COEFFICIENT(den); 526 num = build_cxx_coeff(env, j_num); 527 den = build_cxx_coeff(env, j_den); 528 bool b_value; 529 if (this_ptr->has_@UPPERLOWER@_bound(var, num, den, b_value)) { 530 set_coefficient(env, j_num, build_java_coeff(env, num)); 531 set_coefficient(env, j_den, build_java_coeff(env, den)); 532 jobject j_boolean = bool_to_j_boolean_class(env, b_value); 533 set_by_reference(env, j_ref_boolean, j_boolean); 534 return true; 535 } 536 return false; 537 } 538 CATCH_ALL; 539 return false; 540} 541 542') 543 544m4_define(`ppl_@CLASS@_@MAXMIN@_code', 545`dnl 546JNIEXPORT jboolean JNICALL 547Java_parma_1polyhedra_1library_@1CLASS@_@1MAXMIN@__Lparma_1polyhedra_1library_Linear_1Expression_2Lparma_1polyhedra_1library_Coefficient_2Lparma_1polyhedra_1library_Coefficient_2Lparma_1polyhedra_1library_By_1Reference_2 548(JNIEnv* env, jobject j_this, jobject j_le, 549 jobject j_num, jobject j_den, jobject j_ref_boolean) { 550 try { 551 @CPP_CLASS@* this_ptr 552 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 553 PPL_DIRTY_TEMP_COEFFICIENT(num); 554 PPL_DIRTY_TEMP_COEFFICIENT(den); 555 num = build_cxx_coeff(env, j_num); 556 den = build_cxx_coeff(env, j_den); 557 Linear_Expression le = build_cxx_linear_expression(env, j_le); 558 bool b_value; 559 if (this_ptr->@MAXMIN@(le, num, den, b_value)) { 560 set_coefficient(env, j_num, build_java_coeff(env, num)); 561 set_coefficient(env, j_den, build_java_coeff(env, den)); 562 jobject j_boolean = bool_to_j_boolean_class(env, b_value); 563 set_by_reference(env, j_ref_boolean, j_boolean); 564 return true; 565 } 566 return false; 567 } 568 CATCH_ALL; 569 return false; 570} 571 572') 573 574m4_define(`ppl_@CLASS@_@MAXMIN@_with_point_code', 575`dnl 576JNIEXPORT jboolean JNICALL 577Java_parma_1polyhedra_1library_@1CLASS@_@1MAXMIN@__Lparma_1polyhedra_1library_Linear_1Expression_2Lparma_1polyhedra_1library_Coefficient_2Lparma_1polyhedra_1library_Coefficient_2Lparma_1polyhedra_1library_By_1Reference_2Lparma_1polyhedra_1library_Generator_2 578(JNIEnv* env, jobject j_this, jobject j_le, 579 jobject j_num, jobject j_den, jobject j_ref_boolean, jobject j_g) { 580 try { 581 @CPP_CLASS@* this_ptr 582 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 583 PPL_DIRTY_TEMP_COEFFICIENT(num); 584 PPL_DIRTY_TEMP_COEFFICIENT(den); 585 num = build_cxx_coeff(env, j_num); 586 den = build_cxx_coeff(env, j_den); 587 Linear_Expression le = build_cxx_linear_expression(env, j_le); 588 bool b_value; 589 Generator g = point(); 590 if (this_ptr->@MAXMIN@(le, num, den, b_value, g)) { 591 set_coefficient(env, j_num, build_java_coeff(env, num)); 592 set_coefficient(env, j_den, build_java_coeff(env, den)); 593 jobject j_boolean = bool_to_j_boolean_class(env, b_value); 594 set_by_reference(env, j_ref_boolean, j_boolean); 595 jobject j_g_result = build_java_generator(env, g); 596 set_generator(env, j_g, j_g_result); 597 return true; 598 } 599 return false; 600 } 601 CATCH_ALL; 602 return false; 603} 604 605') 606 607m4_define(`ppl_@CLASS@_frequency_code', 608`dnl 609JNIEXPORT jboolean JNICALL 610Java_parma_1polyhedra_1library_@1CLASS@_frequency 611(JNIEnv* env, jobject j_this, jobject j_le, 612 jobject j_freqn, jobject j_freqd, jobject j_valn, jobject j_vald) { 613 try { 614 @CPP_CLASS@* this_ptr 615 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 616 PPL_DIRTY_TEMP_COEFFICIENT(freqn); 617 PPL_DIRTY_TEMP_COEFFICIENT(freqd); 618 PPL_DIRTY_TEMP_COEFFICIENT(valn); 619 PPL_DIRTY_TEMP_COEFFICIENT(vald); 620 freqn = build_cxx_coeff(env, j_freqn); 621 freqd = build_cxx_coeff(env, j_freqd); 622 valn = build_cxx_coeff(env, j_valn); 623 vald = build_cxx_coeff(env, j_vald); 624 Linear_Expression le = build_cxx_linear_expression(env, j_le); 625 if (this_ptr->frequency(le, freqn, freqd, valn, vald)) { 626 set_coefficient(env, j_freqn, build_java_coeff(env, freqn)); 627 set_coefficient(env, j_freqd, build_java_coeff(env, freqd)); 628 set_coefficient(env, j_valn, build_java_coeff(env, valn)); 629 set_coefficient(env, j_vald, build_java_coeff(env, vald)); 630 return true; 631 } 632 return false; 633 } 634 CATCH_ALL; 635 return false; 636} 637 638') 639 640m4_define(`ppl_@CLASS@_@COMPARISON@_@CLASS@_code', 641`dnl 642JNIEXPORT jboolean JNICALL 643Java_parma_1polyhedra_1library_@1CLASS@_@1COMPARISON@ 644(JNIEnv* env, jobject j_this, jobject j_y) { 645 try { 646 @CPP_CLASS@* this_ptr 647 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 648 @CPP_CLASS@* y_ptr 649 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 650 return this_ptr->@COMPARISON@(*y_ptr); 651 } 652 CATCH_ALL; 653 return false; 654} 655 656') 657 658m4_define(`ppl_@CLASS@_equals_@CLASS@_code', 659`dnl 660JNIEXPORT jboolean JNICALL 661Java_parma_1polyhedra_1library_@1CLASS@_equals 662(JNIEnv* env, jobject j_this, jobject j_y) { 663 try { 664 @CPP_CLASS@* this_ptr 665 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 666 @CPP_CLASS@* y_ptr 667 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 668 return *this_ptr == *y_ptr; 669 } 670 CATCH_ALL; 671 return false; 672} 673 674') 675 676m4_define(`ppl_@CLASS@_hashcode_code', 677`dnl 678JNIEXPORT jint JNICALL 679Java_parma_1polyhedra_1library_@1CLASS@_hashCode 680(JNIEnv* env, jobject j_this) { 681 try { 682 @CPP_CLASS@* this_ptr 683 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 684 return this_ptr->hash_code(); 685 } 686 CATCH_ALL; 687 return 0; 688} 689 690') 691 692 693m4_define(`ppl_@CLASS@_OK_code', 694`dnl 695JNIEXPORT jboolean JNICALL 696Java_parma_1polyhedra_1library_@1CLASS@_OK 697(JNIEnv* env, jobject j_this) { 698 try { 699 @CPP_CLASS@* this_ptr 700 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 701 return this_ptr->OK(); 702 } 703 CATCH_ALL; 704 return false; 705} 706 707') 708 709m4_define(`ppl_@CLASS@_add_@CLASS_REPRESENT@_code', 710`dnl 711JNIEXPORT void JNICALL 712Java_parma_1polyhedra_1library_@1CLASS@_add_1@1CLASS_REPRESENT@ 713(JNIEnv* env, jobject j_this, jobject j_c) try { 714 @CPP_CLASS@* this_ptr 715 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 716 @!CLASS_REPRESENT@ c = build_cxx_@CLASS_REPRESENT@(env, j_c); 717 this_ptr->add_@CLASS_REPRESENT@(c); 718} 719CATCH_ALL 720 721') 722 723m4_define(`ppl_@CLASS@_refine_with_@REFINE_REPRESENT@_code', 724`dnl 725JNIEXPORT void JNICALL 726Java_parma_1polyhedra_1library_@1CLASS@_refine_1with_1@1REFINE_REPRESENT@ 727(JNIEnv* env, jobject j_this, jobject j_c) try { 728 @CPP_CLASS@* this_ptr 729 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 730 @!REFINE_REPRESENT@ c = build_cxx_@REFINE_REPRESENT@(env, j_c); 731 this_ptr->refine_with_@REFINE_REPRESENT@(c); 732} 733CATCH_ALL 734 735') 736 737m4_define(`ppl_@CLASS@_add_@CLASS_REPRESENT@s_code', 738`dnl 739JNIEXPORT void JNICALL 740Java_parma_1polyhedra_1library_@1CLASS@_add_1@1CLASS_REPRESENT@s 741(JNIEnv* env, jobject j_this, jobject j_cs) try { 742 @CPP_CLASS@* this_ptr 743 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 744 @!CLASS_REPRESENT@_System cs = build_cxx_@CLASS_REPRESENT@_system(env, j_cs); 745 this_ptr->add_@CLASS_REPRESENT@s(cs); 746} 747CATCH_ALL 748 749') 750 751m4_define(`ppl_@CLASS@_refine_with_@REFINE_REPRESENT@s_code', 752`dnl 753JNIEXPORT void JNICALL 754Java_parma_1polyhedra_1library_@1CLASS@_refine_1with_1@1REFINE_REPRESENT@s 755(JNIEnv* env, jobject j_this, jobject j_cs) try { 756 @CPP_CLASS@* this_ptr 757 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 758 @!REFINE_REPRESENT@_System cs 759 = build_cxx_@REFINE_REPRESENT@_system(env, j_cs); 760 this_ptr->refine_with_@REFINE_REPRESENT@s(cs); 761} 762CATCH_ALL 763 764') 765 766m4_define(`ppl_@CLASS@_@BINOP@_code', 767`dnl 768JNIEXPORT void JNICALL 769Java_parma_1polyhedra_1library_@1CLASS@_@1BINOP@ 770(JNIEnv* env, jobject j_this, jobject j_y) try { 771 @CPP_CLASS@* this_ptr 772 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 773 @CPP_CLASS@* y_ptr 774 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 775 this_ptr->@BINOP@(*y_ptr); 776} 777CATCH_ALL 778 779') 780 781m4_define(`ppl_@CLASS@_positive_time_elapse_assign_code', 782`dnl 783JNIEXPORT void JNICALL 784Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_positive_1time_1elapse_1assign 785(JNIEnv* env, jobject j_this, jobject j_y) try { 786 @TOPOLOGY@@CPP_CLASS@* this_ptr 787 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_this)); 788 @TOPOLOGY@@CPP_CLASS@* y_ptr 789 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_y)); 790 this_ptr->positive_time_elapse_assign(*y_ptr); 791} 792CATCH_ALL; 793 794') 795 796m4_define(`ppl_@CLASS@_simplify_using_context_assign_code', 797`dnl 798JNIEXPORT jboolean JNICALL 799Java_parma_1polyhedra_1library_@1CLASS@_simplify_1using_1context_1assign 800(JNIEnv* env, jobject j_this, jobject j_y) { 801 try { 802 @CPP_CLASS@* this_ptr 803 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 804 @CPP_CLASS@* y_ptr 805 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 806 return this_ptr->simplify_using_context_assign(*y_ptr); 807 } 808 CATCH_ALL; 809 return false; 810} 811 812') 813 814m4_define(`ppl_@CLASS@_@AFFIMAGE@_code', 815`dnl 816JNIEXPORT void JNICALL 817Java_parma_1polyhedra_1library_@1CLASS@_@1AFFIMAGE@ 818(JNIEnv* env, jobject j_this, jobject j_v, jobject j_le, jobject j_c) try { 819 @CPP_CLASS@* this_ptr 820 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 821 Variable v = build_cxx_variable(env, j_v); 822 Linear_Expression le = build_cxx_linear_expression(env, j_le); 823 PPL_DIRTY_TEMP_COEFFICIENT(c); 824 c = build_cxx_coeff(env, j_c); 825 this_ptr->@AFFIMAGE@(v, le, c); 826} 827CATCH_ALL 828 829') 830 831m4_define(`ppl_@CLASS@_generalized_@AFFIMAGE@_lhs_rhs_code', 832`dnl 833JNIEXPORT void JNICALL 834Java_parma_1polyhedra_1library_@1CLASS@_generalized_1@1AFFIMAGE@__Lparma_1polyhedra_1library_Linear_1Expression_2Lparma_1polyhedra_1library_Relation_1Symbol_2Lparma_1polyhedra_1library_Linear_1Expression_2 835(JNIEnv* env, jobject j_this, 836 jobject j_lhs, jobject j_relsym, jobject j_rhs) try { 837 @CPP_CLASS@* this_ptr 838 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 839 Linear_Expression lhs = build_cxx_linear_expression(env, j_lhs); 840 Linear_Expression rhs = build_cxx_linear_expression(env, j_rhs); 841 Relation_Symbol relsym = build_cxx_relsym(env, j_relsym); 842 this_ptr->generalized_@AFFIMAGE@(lhs, relsym, rhs); 843} 844CATCH_ALL 845 846') 847 848m4_define(`ppl_@CLASS@_generalized_@AFFIMAGE@_code', 849`dnl 850JNIEXPORT void JNICALL 851Java_parma_1polyhedra_1library_@1CLASS@_generalized_1@1AFFIMAGE@__Lparma_1polyhedra_1library_Variable_2Lparma_1polyhedra_1library_Relation_1Symbol_2Lparma_1polyhedra_1library_Linear_1Expression_2Lparma_1polyhedra_1library_Coefficient_2 852(JNIEnv* env, jobject j_this, 853 jobject j_v, jobject j_relsym, jobject j_le, jobject j_c) try { 854 @CPP_CLASS@* this_ptr 855 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 856 Variable v = build_cxx_variable(env, j_v); 857 Relation_Symbol relsym = build_cxx_relsym(env, j_relsym); 858 Linear_Expression le = build_cxx_linear_expression(env, j_le); 859 PPL_DIRTY_TEMP_COEFFICIENT(c); 860 c = build_cxx_coeff(env, j_c); 861 this_ptr->generalized_@AFFIMAGE@(v, relsym, le, c); 862} 863CATCH_ALL 864 865') 866 867m4_define(`ppl_@CLASS@_generalized_@AFFIMAGE@_lhs_rhs_with_congruence_code', 868`dnl 869JNIEXPORT void JNICALL 870Java_parma_1polyhedra_1library_@1CLASS@_generalized_1@1AFFIMAGE@_1lhs_1rhs_1with_1congruence 871(JNIEnv* env, jobject j_this, 872 jobject j_lhs, jobject j_relsym, jobject j_rhs, jobject j_modulus) try { 873 @CPP_CLASS@* this_ptr 874 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 875 Linear_Expression lhs = build_cxx_linear_expression(env, j_lhs); 876 Linear_Expression rhs = build_cxx_linear_expression(env, j_rhs); 877 Relation_Symbol relsym = build_cxx_relsym(env, j_relsym); 878 PPL_DIRTY_TEMP_COEFFICIENT(modulus); 879 modulus = build_cxx_coeff(env, j_modulus); 880 this_ptr->generalized_@AFFIMAGE@(lhs, relsym, rhs, modulus); 881} 882CATCH_ALL 883 884') 885 886m4_define(`ppl_@CLASS@_generalized_@AFFIMAGE@_with_congruence_code', 887`dnl 888JNIEXPORT void JNICALL 889Java_parma_1polyhedra_1library_@CLASS@_generalized_1@1AFFIMAGE@_1with_1congruence 890(JNIEnv* env, jobject j_this, 891 jobject j_v, jobject j_relsym, jobject j_le, jobject j_c, 892 jobject j_modulus) try { 893 @CPP_CLASS@* this_ptr 894 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 895 Variable v = build_cxx_variable(env, j_v); 896 Relation_Symbol relsym = build_cxx_relsym(env, j_relsym); 897 Linear_Expression le = build_cxx_linear_expression(env, j_le); 898 PPL_DIRTY_TEMP_COEFFICIENT(c); 899 PPL_DIRTY_TEMP_COEFFICIENT(modulus); 900 c = build_cxx_coeff(env, j_c); 901 modulus = build_cxx_coeff(env, j_modulus); 902 this_ptr->generalized_@AFFIMAGE@(v, relsym, le, c, modulus); 903} 904CATCH_ALL 905 906') 907 908m4_define(`ppl_@CLASS@_bounded_@AFFIMAGE@_code', 909`dnl 910JNIEXPORT void JNICALL 911Java_parma_1polyhedra_1library_@1CLASS@_bounded_1@1AFFIMAGE@ 912(JNIEnv* env, jobject j_this, 913 jobject j_v, jobject j_lhs, jobject j_rhs, jobject j_c) try { 914 @CPP_CLASS@* this_ptr 915 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 916 Variable v = build_cxx_variable(env, j_v); 917 Linear_Expression lhs = build_cxx_linear_expression(env, j_lhs); 918 Linear_Expression rhs = build_cxx_linear_expression(env, j_rhs); 919 PPL_DIRTY_TEMP_COEFFICIENT(c); 920 c = build_cxx_coeff(env, j_c); 921 this_ptr->bounded_@AFFIMAGE@(v, lhs, rhs, c); 922} 923CATCH_ALL 924 925') 926 927m4_define(`ppl_@CLASS@_wrap_assign_code', 928`dnl 929JNIEXPORT void JNICALL 930Java_parma_1polyhedra_1library_@1CLASS@_wrap_1assign 931(JNIEnv* env, jobject j_this, jobject j_vars, 932 jobject j_w, jobject j_r, jobject j_o, jobject j_cs, 933 jlong j_cx, jboolean j_wrap_individually) try { 934 @CPP_CLASS@* this_ptr 935 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 936 Variables_Set vars = build_cxx_variables_set(env, j_vars); 937 Bounded_Integer_Type_Width w = build_cxx_bounded_width(env, j_w); 938 Bounded_Integer_Type_Representation r = build_cxx_bounded_rep(env, j_r); 939 Bounded_Integer_Type_Overflow o = build_cxx_bounded_overflow(env, j_o); 940 Constraint_System cs = build_cxx_constraint_system(env, j_cs); 941 unsigned cx = jtype_to_unsigned<unsigned int>(j_cx); 942 this_ptr->wrap_assign(vars, w, r, o, &cs, cx, j_wrap_individually); 943} 944CATCH_ALL 945 946') 947 948m4_define(`ppl_@CLASS@_@WIDEN@_widening_assign_code', 949`dnl 950JNIEXPORT void JNICALL 951Java_parma_1polyhedra_1library_@1CLASS@_@1WIDEN@_1widening_1assign 952(JNIEnv* env, jobject j_this, jobject j_y, jobject j_by_ref_int) try { 953 @CPP_CLASS@* this_ptr 954 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 955 @CPP_CLASS@* y_ptr 956 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 957 if (j_by_ref_int == NULL) 958 this_ptr->@WIDEN@_widening_assign(*y_ptr); 959 else { 960 jobject j_integer = get_by_reference(env, j_by_ref_int); 961 unsigned int tokens = 962 jtype_to_unsigned<unsigned int>(j_integer_to_j_int(env, j_integer)); 963 this_ptr->@WIDEN@_widening_assign(*y_ptr, &tokens); 964 j_integer = j_int_to_j_integer(env, tokens); 965 set_by_reference(env, j_by_ref_int, j_integer); 966 } 967} 968CATCH_ALL 969 970') 971 972m4_define(`ppl_@CLASS@_widening_assign_code', 973`dnl 974JNIEXPORT void JNICALL 975Java_parma_1polyhedra_1library_@1CLASS@_widening_1assign 976(JNIEnv* env, jobject j_this, jobject j_y, jobject j_by_ref_int) try { 977 @CPP_CLASS@* this_ptr 978 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 979 @CPP_CLASS@* y_ptr 980 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 981 if (j_by_ref_int == NULL) 982 this_ptr->widening_assign(*y_ptr); 983 else { 984 jobject j_integer = get_by_reference(env, j_by_ref_int); 985 unsigned int tokens = 986 jtype_to_unsigned<unsigned int>(j_integer_to_j_int(env, j_integer)); 987 this_ptr->widening_assign(*y_ptr, &tokens); 988 j_integer = j_int_to_j_integer(env, tokens); 989 set_by_reference(env, j_by_ref_int, j_integer); 990 } 991} 992CATCH_ALL 993 994') 995 996m4_define(`ppl_@CLASS@_@EXTRAPOLATION@_extrapolation_assign_code', 997`dnl 998JNIEXPORT void JNICALL 999Java_parma_1polyhedra_1library_@1CLASS@_@1EXTRAPOLATION@_1extrapolation_1assign 1000(JNIEnv* env, jobject j_this, jobject j_y, jobject j_by_ref_int) try { 1001 @CPP_CLASS@* this_ptr 1002 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1003 @CPP_CLASS@* y_ptr 1004 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 1005 if (j_by_ref_int == NULL) 1006 this_ptr->@EXTRAPOLATION@_extrapolation_assign(*y_ptr); 1007 else { 1008 jobject j_integer = get_by_reference(env, j_by_ref_int); 1009 unsigned int tokens = 1010 jtype_to_unsigned<unsigned int>(j_integer_to_j_int(env, j_integer)); 1011 this_ptr->@EXTRAPOLATION@_extrapolation_assign(*y_ptr, &tokens); 1012 j_integer = j_int_to_j_integer(env, tokens); 1013 set_by_reference(env, j_by_ref_int, j_integer); 1014 } 1015} 1016CATCH_ALL 1017 1018') 1019 1020m4_define(`ppl_@CLASS@_@EXTRAPOLATION@_narrowing_assign_code', 1021`dnl 1022JNIEXPORT void JNICALL 1023Java_parma_1polyhedra_1library_@1CLASS@_@1EXTRAPOLATION@_1narrowing_1assign 1024(JNIEnv* env, jobject j_this, jobject j_y) try { 1025 @CPP_CLASS@* this_ptr 1026 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1027 @CPP_CLASS@* y_ptr 1028 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 1029 this_ptr->@EXTRAPOLATION@_narrowing_assign(*y_ptr); 1030} 1031CATCH_ALL 1032 1033') 1034 1035m4_define(`ppl_@CLASS@_@LIMITEDBOUNDED@_@WIDENEXPN@_extrapolation_assign_code', 1036`dnl 1037JNIEXPORT void JNICALL 1038Java_parma_1polyhedra_1library_@1CLASS@_@1LIMITEDBOUNDED@_1@1WIDENEXPN@_1extrapolation_1assign 1039(JNIEnv* env, jobject j_this, jobject j_y, 1040 jobject j_cs, jobject j_by_ref_int) try { 1041 @CPP_CLASS@* this_ptr 1042 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1043 @CPP_CLASS@* y_ptr 1044 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 1045 @!CONSTRAINER@_System cs = build_cxx_@CONSTRAINER@_system(env, j_cs); 1046 if (j_by_ref_int == NULL) 1047 this_ptr->@LIMITEDBOUNDED@_@WIDENEXPN@_extrapolation_assign(*y_ptr, cs); 1048 else { 1049 jobject j_integer = get_by_reference(env, j_by_ref_int); 1050 unsigned int tokens = 1051 jtype_to_unsigned<unsigned int>(j_integer_to_j_int(env, j_integer)); 1052 this_ptr->@LIMITEDBOUNDED@_@WIDENEXPN@_extrapolation_assign 1053 (*y_ptr, cs, &tokens); 1054 j_integer = j_int_to_j_integer(env, tokens); 1055 set_by_reference(env, j_by_ref_int, j_integer); 1056 } 1057} 1058CATCH_ALL 1059 1060') 1061 1062m4_define(`ppl_@CLASS@_BGP99_@DISJUNCT_WIDEN@_extrapolation_assign_code', 1063`dnl 1064JNIEXPORT void JNICALL 1065Java_parma_1polyhedra_1library_@1CLASS@_BGP99_1@1DISJUNCT_WIDEN@_1extrapolation_1assign 1066(JNIEnv* env, jobject j_this, jobject j_y, jobject j_disjuncts) try { 1067 @CPP_CLASS@* this_ptr 1068 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1069 @CPP_CLASS@* y_ptr 1070 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 1071 unsigned int disjuncts = 1072 jtype_to_unsigned<unsigned int>(j_integer_to_j_int(env, j_disjuncts)); 1073 this_ptr->BGP99_extrapolation_assign 1074 (*y_ptr, 1075 widen_fun_ref(&@DISJUNCT_TOPOLOGY@@A_DISJUNCT@::@DISJUNCT_WIDEN@_widening_assign), 1076 disjuncts); 1077} 1078CATCH_ALL 1079 1080') 1081 1082m4_define(`ppl_@CLASS@_BHZ03_@A_DISJUNCT_WIDEN@_@DISJUNCT_WIDEN@_widening_assign_code', 1083`dnl 1084JNIEXPORT void JNICALL 1085Java_parma_1polyhedra_1library_@1CLASS@_BHZ03_1@1A_DISJUNCT_WIDEN@_1@1DISJUNCT_WIDEN@_1widening_1assign 1086(JNIEnv* env, jobject j_this, jobject j_y) try { 1087 @CPP_CLASS@* this_ptr 1088 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1089 @CPP_CLASS@* y_ptr 1090 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_y)); 1091 this_ptr->BHZ03_widening_assign<@A_DISJUNCT_WIDEN@_Certificate> 1092 (*y_ptr, 1093 widen_fun_ref( 1094 &@DISJUNCT_TOPOLOGY@@A_DISJUNCT@::@DISJUNCT_WIDEN@_widening_assign)); 1095} 1096CATCH_ALL 1097 1098') 1099 1100 1101m4_define(`ppl_@CLASS@_add_space_dimensions_@EMBEDPROJECT@_code', 1102`dnl 1103JNIEXPORT void JNICALL 1104Java_parma_1polyhedra_1library_@1CLASS@_add_1space_1dimensions_1@1EMBEDPROJECT@ 1105(JNIEnv* env, jobject j_this, jlong dim) try { 1106 dimension_type ppl_dim = jtype_to_unsigned<dimension_type>(dim); 1107 @CPP_CLASS@* this_ptr 1108 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1109 this_ptr->add_space_dimensions_@EMBEDPROJECT@(ppl_dim); 1110} 1111CATCH_ALL 1112 1113') 1114 1115m4_define(`ppl_@CLASS@_remove_space_dimensions_code', 1116`dnl 1117JNIEXPORT void JNICALL 1118Java_parma_1polyhedra_1library_@1CLASS@_remove_1space_1dimensions 1119(JNIEnv* env, jobject j_this, jobject j_v_set) try { 1120 @CPP_CLASS@* this_ptr 1121 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1122 Variables_Set v_set = build_cxx_variables_set(env, j_v_set); 1123 this_ptr->remove_space_dimensions(v_set); 1124} 1125CATCH_ALL 1126 1127') 1128 1129m4_define(`ppl_@CLASS@_remove_higher_space_dimensions_code', 1130`dnl 1131JNIEXPORT void JNICALL 1132Java_parma_1polyhedra_1library_@1CLASS@_remove_1higher_1space_1dimensions 1133(JNIEnv* env, jobject j_this, jlong dim) try { 1134 dimension_type ppl_dim = jtype_to_unsigned<dimension_type>(dim); 1135 @CPP_CLASS@* this_ptr 1136 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1137 this_ptr->remove_higher_space_dimensions(ppl_dim); 1138} 1139CATCH_ALL 1140 1141') 1142 1143m4_define(`ppl_@CLASS@_expand_space_dimension_code', 1144`dnl 1145JNIEXPORT void JNICALL 1146Java_parma_1polyhedra_1library_@1CLASS@_expand_1space_1dimension 1147(JNIEnv* env, jobject j_this, jobject j_variable, jlong dim) try { 1148 dimension_type ppl_dim = jtype_to_unsigned<dimension_type>(dim); 1149 @CPP_CLASS@* this_ptr 1150 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1151 Variable v = build_cxx_variable(env, j_variable); 1152 this_ptr->expand_space_dimension(v, ppl_dim); 1153} 1154CATCH_ALL 1155 1156') 1157 1158m4_define(`ppl_@CLASS@_fold_space_dimensions_code', 1159`dnl 1160JNIEXPORT void JNICALL Java_parma_1polyhedra_1library_@1CLASS@_fold_1space_1dimensions 1161(JNIEnv* env, jobject j_this, jobject j_v_set, jobject j_var) try { 1162 Variables_Set v_set = build_cxx_variables_set(env, j_v_set); 1163 @CPP_CLASS@* this_ptr 1164 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1165 Variable v = build_cxx_variable(env, j_var); 1166 this_ptr->fold_space_dimensions(v_set, v); 1167} 1168CATCH_ALL 1169 1170') 1171 1172m4_define(`ppl_@CLASS@_map_space_dimensions_code', 1173`dnl 1174JNIEXPORT void JNICALL 1175Java_parma_1polyhedra_1library_@1CLASS@_map_1space_1dimensions 1176(JNIEnv* env, jobject j_this, jobject j_p_func) try { 1177 @CPP_CLASS@* this_ptr 1178 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1179 Partial_Function* p_func_ptr 1180 = reinterpret_cast<Partial_Function*>(get_ptr(env, j_p_func)); 1181 this_ptr->map_space_dimensions(*p_func_ptr); 1182} 1183CATCH_ALL 1184 1185') 1186 1187m4_define(`ppl_@CLASS@_drop_some_non_integer_points_code', 1188`dnl 1189JNIEXPORT void JNICALL Java_parma_1polyhedra_1library_@1CLASS@_drop_1some_1non_1integer_1points__Lparma_1polyhedra_1library_Complexity_1Class_2 1190(JNIEnv* env, jobject j_this, jobject j_complexity) try { 1191 @CPP_CLASS@* this_ptr 1192 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1193 jint j_complexity_int 1194 = env->CallIntMethod(j_complexity, 1195 cached_FMIDs.Complexity_Class_ordinal_ID); 1196 CHECK_EXCEPTION_ASSERT(env); 1197 switch (j_complexity_int) { 1198 case 0: 1199 this_ptr->drop_some_non_integer_points(POLYNOMIAL_COMPLEXITY); 1200 break; 1201 case 1: 1202 this_ptr->drop_some_non_integer_points(SIMPLEX_COMPLEXITY); 1203 break; 1204 case 2: 1205 this_ptr->drop_some_non_integer_points(ANY_COMPLEXITY); 1206 break; 1207 default: 1208 PPL_JAVA_UNEXPECTED; 1209 break; 1210 } 1211} 1212CATCH_ALL 1213 1214') 1215 1216m4_define(`ppl_@CLASS@_drop_some_non_integer_points_2_code', 1217`dnl 1218JNIEXPORT void JNICALL Java_parma_1polyhedra_1library_@1CLASS@_drop_1some_1non_1integer_1points__Lparma_1polyhedra_1library_Variables_1Set_2Lparma_1polyhedra_1library_Complexity_1Class_2 1219(JNIEnv* env, jobject j_this, jobject j_v_set, jobject j_complexity) try { 1220 @CPP_CLASS@* this_ptr 1221 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1222 Variables_Set v_set = build_cxx_variables_set(env, j_v_set); 1223 jint j_complexity_int 1224 = env->CallIntMethod(j_complexity, 1225 cached_FMIDs.Complexity_Class_ordinal_ID); 1226 CHECK_EXCEPTION_ASSERT(env); 1227 switch (j_complexity_int) { 1228 case 0: 1229 this_ptr->drop_some_non_integer_points(v_set, POLYNOMIAL_COMPLEXITY); 1230 break; 1231 case 1: 1232 this_ptr->drop_some_non_integer_points(v_set, SIMPLEX_COMPLEXITY); 1233 break; 1234 case 2: 1235 this_ptr->drop_some_non_integer_points(v_set, ANY_COMPLEXITY); 1236 break; 1237 default: 1238 PPL_JAVA_UNEXPECTED; 1239 break; 1240 } 1241} 1242CATCH_ALL 1243 1244') 1245 1246m4_define(`ppl_@CLASS@_string_code', 1247`dnl 1248JNIEXPORT jstring JNICALL 1249Java_parma_1polyhedra_1library_@1CLASS@_toString 1250(JNIEnv* env, jobject j_this) { 1251 try { 1252 using namespace Parma_Polyhedra_Library::IO_Operators; 1253 @CPP_CLASS@* this_ptr 1254 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1255 std::ostringstream s; 1256 s << *this_ptr; 1257 std::string str = s.str(); 1258 return env->NewStringUTF(str.c_str()); 1259 } 1260 CATCH_ALL; 1261 return 0; 1262} 1263 1264') 1265 1266m4_define(`ppl_@CLASS@_@MEMBYTES@_code', 1267`dnl 1268JNIEXPORT jlong JNICALL 1269Java_parma_1polyhedra_1library_@1CLASS@_@1MEMBYTES@ 1270(JNIEnv* env, jobject j_this) { 1271 try { 1272 @CPP_CLASS@* this_ptr 1273 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1274 return this_ptr->@MEMBYTES@(); 1275 } 1276 CATCH_ALL; 1277 return 0; 1278} 1279 1280') 1281 1282m4_define(`ppl_@CLASS@_constrains_code', 1283`dnl 1284JNIEXPORT jboolean JNICALL 1285Java_parma_1polyhedra_1library_@1CLASS@_constrains 1286(JNIEnv* env, jobject j_this, jobject j_var) { 1287 try { 1288 @CPP_CLASS@* this_ptr 1289 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1290 Variable v = build_cxx_variable(env, j_var); 1291 return this_ptr->constrains(v); 1292 } 1293 CATCH_ALL; 1294 return false; 1295} 1296 1297') 1298 1299m4_define(`ppl_@CLASS@_ascii_dump_code', 1300`dnl 1301JNIEXPORT jstring JNICALL 1302Java_parma_1polyhedra_1library_@1CLASS@_ascii_1dump 1303(JNIEnv* env, jobject j_this) { 1304 try { 1305 using namespace Parma_Polyhedra_Library::IO_Operators; 1306 @CPP_CLASS@* this_ptr 1307 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_this)); 1308 std::ostringstream s; 1309 this_ptr->ascii_dump(s); 1310 std::string str = s.str(); 1311 return env->NewStringUTF(str.c_str()); 1312 } 1313 CATCH_ALL; 1314 return 0; 1315} 1316 1317') 1318 1319m4_define(`ppl_@CLASS@_linear_@PARTITION@_code', 1320`dnl 1321JNIEXPORT jobject JNICALL 1322Java_parma_1polyhedra_1library_@1TOPOLOGY@@1CLASS@_linear_1@PARTITION@ 1323(JNIEnv* env, jclass, jobject j_p, jobject j_q) { 1324 try { 1325 @TOPOLOGY@@CPP_CLASS@* p_ptr 1326 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p)); 1327 @TOPOLOGY@@CPP_CLASS@* q_ptr 1328 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_q)); 1329 std::pair<@TOPOLOGY@@CPP_CLASS@|COMMA| 1330 Pointset_Powerset<NNC_Polyhedron> > 1331 r = linear_partition(*p_ptr, *q_ptr); 1332 1333 @TOPOLOGY@@CPP_CLASS@* r1 1334 = new @TOPOLOGY@@CPP_CLASS@(0, EMPTY); 1335 Pointset_Powerset<NNC_Polyhedron>* r2 1336 = new Pointset_Powerset<NNC_Polyhedron>(0, EMPTY); 1337 swap(*r1, r.first); 1338 swap(*r2, r.second); 1339 1340 jclass j_pair_class = env->FindClass("parma_polyhedra_library/Pair"); 1341 CHECK_RESULT_ASSERT(env, j_pair_class); 1342 jmethodID j_ctr_id_pair = env->GetMethodID(j_pair_class, "<init>", "()V"); 1343 CHECK_RESULT_ASSERT(env, j_ctr_id_pair); 1344 jobject j_pair_obj = env->NewObject(j_pair_class, j_ctr_id_pair); 1345 CHECK_RESULT_RETURN(env, j_pair_obj, 0); 1346 1347 jclass j_class_r1 = env->FindClass("parma_polyhedra_library/@TOPOLOGY@@CLASS@"); 1348 CHECK_RESULT_ASSERT(env, j_class_r1); 1349 jmethodID j_ctr_id_r1 = env->GetMethodID(j_class_r1, "<init>", "()V"); 1350 CHECK_RESULT_ASSERT(env, j_ctr_id_r1); 1351 jobject j_obj_r1 = env->NewObject(j_class_r1, j_ctr_id_r1); 1352 CHECK_RESULT_RETURN(env, j_obj_r1, 0); 1353 set_ptr(env, j_obj_r1, r1); 1354 1355 jclass j_class_r2 = env->FindClass("parma_polyhedra_library/Pointset_Powerset_NNC_Polyhedron"); 1356 CHECK_RESULT_ASSERT(env, j_class_r2); 1357 jmethodID j_ctr_id_r2 = env->GetMethodID(j_class_r2, "<init>", "()V"); 1358 CHECK_RESULT_ASSERT(env, j_ctr_id_r2); 1359 jobject j_obj_r2 = env->NewObject(j_class_r2, j_ctr_id_r2); 1360 CHECK_RESULT_RETURN(env, j_obj_r2, 0); 1361 set_ptr(env, j_obj_r2, r2); 1362 set_pair_element(env, j_pair_obj, 0, j_obj_r1); 1363 set_pair_element(env, j_pair_obj, 1, j_obj_r2); 1364 return j_pair_obj; 1365 } 1366 CATCH_ALL; 1367 return 0; 1368} 1369 1370') 1371 1372m4_define(`ppl_@CLASS@_approximate_@PARTITION@_code', 1373`dnl 1374JNIEXPORT jobject JNICALL 1375Java_parma_1polyhedra_1library_@1CLASS@_approximate_1@PARTITION@ 1376(JNIEnv* env, jclass, jobject j_p, jobject j_q, jobject j_ref_finite_bool) { 1377 try { 1378 @CPP_CLASS@* p_ptr 1379 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_p)); 1380 @CPP_CLASS@* q_ptr 1381 = reinterpret_cast<@CPP_CLASS@*>(get_ptr(env, j_q)); 1382 bool b_finite_val; 1383 std::pair<@CPP_CLASS@|COMMA| Pointset_Powerset<Grid> > 1384 r = approximate_partition(*p_ptr, *q_ptr, b_finite_val); 1385 1386 @CPP_CLASS@* r1 = new @CPP_CLASS@(0, EMPTY); 1387 Pointset_Powerset<Grid>* r2 = new Pointset_Powerset<Grid>(0, EMPTY); 1388 swap(*r1, r.first); 1389 swap(*r2, r.second); 1390 1391 jclass j_pair_class = env->FindClass("parma_polyhedra_library/Pair"); 1392 CHECK_RESULT_ASSERT(env, j_pair_class); 1393 jmethodID j_ctr_id_pair = env->GetMethodID(j_pair_class, "<init>", "()V"); 1394 CHECK_RESULT_ASSERT(env, j_ctr_id_pair); 1395 jobject j_pair_obj = env->NewObject(j_pair_class, j_ctr_id_pair); 1396 CHECK_RESULT_RETURN(env, j_pair_obj, 0); 1397 1398 jclass j_class_r1 = env->FindClass("parma_polyhedra_library/@CLASS@"); 1399 CHECK_RESULT_ASSERT(env, j_class_r1); 1400 jmethodID j_ctr_id_r1 = env->GetMethodID(j_class_r1, "<init>", "()V"); 1401 CHECK_RESULT_ASSERT(env, j_ctr_id_r1); 1402 jobject j_obj_r1 = env->NewObject(j_class_r1, j_ctr_id_r1); 1403 CHECK_RESULT_RETURN(env, j_obj_r1, 0); 1404 set_ptr(env, j_obj_r1, r1); 1405 1406 jclass j_class_r2 1407 = env->FindClass("parma_polyhedra_library/Pointset_Powerset_Grid"); 1408 CHECK_RESULT_ASSERT(env, j_class_r2); 1409 jmethodID j_ctr_id_r2 = env->GetMethodID(j_class_r2, "<init>", "()V"); 1410 CHECK_RESULT_ASSERT(env, j_ctr_id_r2); 1411 jobject j_obj_r2 = env->NewObject(j_class_r2, j_ctr_id_r2); 1412 CHECK_RESULT_RETURN(env, j_obj_r2, 0); 1413 set_ptr(env, j_obj_r2, r2); 1414 set_pair_element(env, j_pair_obj, 0, j_obj_r1); 1415 set_pair_element(env, j_pair_obj, 1, j_obj_r2); 1416 jobject j_finite_bool = bool_to_j_boolean_class(env, b_finite_val); 1417 set_by_reference(env, j_ref_finite_bool, j_finite_bool); 1418 return j_pair_obj; 1419 } 1420 CATCH_ALL; 1421 return 0; 1422} 1423 1424') 1425 1426m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', 1427`dnl 1428___END_OF_FILE___ 1429___BEGIN_OF_FILE___ ppl_java_Termination.cc << ___END_OF_FILE___ 1430 1431JNIEXPORT jboolean JNICALL 1432Java_parma_1polyhedra_1library_Termination_termination_1test_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@ 1433(JNIEnv* env, jclass, jobject j_p) { 1434 try { 1435 @TOPOLOGY@@CPP_CLASS@* p_ptr 1436 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p)); 1437 return termination_test_@TERMINATION_ID@(*p_ptr); 1438 } 1439 CATCH_ALL; 1440 return 0; 1441} 1442 1443') 1444 1445m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', 1446`dnl 1447___END_OF_FILE___ 1448___BEGIN_OF_FILE___ ppl_java_Termination.cc << ___END_OF_FILE___ 1449 1450JNIEXPORT jboolean JNICALL 1451Java_parma_1polyhedra_1library_Termination_termination_1test_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@_12 1452(JNIEnv* env, jclass, jobject j_p_before, jobject j_p_after) { 1453 try { 1454 @TOPOLOGY@@CPP_CLASS@* p_ptr_before 1455 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p_before)); 1456 @TOPOLOGY@@CPP_CLASS@* p_ptr_after 1457 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p_after)); 1458 return termination_test_@TERMINATION_ID@_2(*p_ptr_before, *p_ptr_after); 1459 } 1460 CATCH_ALL; 1461 return 0; 1462} 1463 1464') 1465 1466m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', 1467`dnl 1468___END_OF_FILE___ 1469___BEGIN_OF_FILE___ ppl_java_Termination.cc << ___END_OF_FILE___ 1470 1471JNIEXPORT jboolean JNICALL 1472Java_parma_1polyhedra_1library_Termination_one_1affine_1ranking_1function_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@ 1473(JNIEnv* env, jclass, jobject j_p, jobject j_g) { 1474 try { 1475 @TOPOLOGY@@CPP_CLASS@* p_ptr 1476 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p)); 1477 Generator g(point()); 1478 if (one_affine_ranking_function_@TERMINATION_ID@(*p_ptr, g)) { 1479 jobject j_g_result = build_java_generator(env, g);; 1480 set_generator(env, j_g, j_g_result); 1481 return true; 1482 } 1483 return false; 1484 } 1485 CATCH_ALL; 1486 return 0; 1487} 1488 1489') 1490 1491m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', 1492`dnl 1493___END_OF_FILE___ 1494___BEGIN_OF_FILE___ ppl_java_Termination.cc << ___END_OF_FILE___ 1495 1496JNIEXPORT jboolean JNICALL 1497Java_parma_1polyhedra_1library_Termination_one_1affine_1ranking_1function_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@_12 1498(JNIEnv* env, jclass, jobject j_p_before, jobject j_p_after, jobject j_g) { 1499 try { 1500 @TOPOLOGY@@CPP_CLASS@* p_ptr_before 1501 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p_before)); 1502 @TOPOLOGY@@CPP_CLASS@* p_ptr_after 1503 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p_after)); 1504 Generator g(point()); 1505 if (one_affine_ranking_function_@TERMINATION_ID@_2(*p_ptr_before, *p_ptr_after, g)) { 1506 jobject j_g_result = build_java_generator(env, g);; 1507 set_generator(env, j_g, j_g_result); 1508 return true; 1509 } 1510 return false; 1511 } 1512 CATCH_ALL; 1513 return 0; 1514} 1515 1516') 1517 1518m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', 1519`dnl 1520___END_OF_FILE___ 1521___BEGIN_OF_FILE___ ppl_java_Termination.cc << ___END_OF_FILE___ 1522 1523JNIEXPORT void JNICALL 1524Java_parma_1polyhedra_1library_Termination_all_1affine_1ranking_1functions_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@ 1525(JNIEnv* env, jclass, jobject j_p, jobject j_ph) { 1526 try { 1527 @TOPOLOGY@@CPP_CLASS@* p_ptr 1528 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p)); 1529 @A_TERMINATION_ID@Polyhedron* ph = new @A_TERMINATION_ID@Polyhedron(); 1530 all_affine_ranking_functions_@TERMINATION_ID@(*p_ptr, *ph); 1531 set_ptr(env, j_ph, ph); 1532 } 1533 CATCH_ALL; 1534} 1535 1536') 1537 1538m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', 1539`dnl 1540___END_OF_FILE___ 1541___BEGIN_OF_FILE___ ppl_java_Termination.cc << ___END_OF_FILE___ 1542 1543JNIEXPORT void JNICALL 1544Java_parma_1polyhedra_1library_Termination_all_1affine_1ranking_1functions_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@_12 1545(JNIEnv* env, jclass, jobject j_p_before, jobject j_p_after, jobject j_ph) { 1546 try { 1547 @TOPOLOGY@@CPP_CLASS@* p_ptr_before 1548 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p_before)); 1549 @TOPOLOGY@@CPP_CLASS@* p_ptr_after 1550 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p_after)); 1551 @A_TERMINATION_ID@Polyhedron* ph = new @A_TERMINATION_ID@Polyhedron(); 1552 all_affine_ranking_functions_@TERMINATION_ID@_2(*p_ptr_before, *p_ptr_after, *ph); 1553 set_ptr(env, j_ph, ph); 1554 } 1555 CATCH_ALL; 1556} 1557 1558') 1559 1560m4_define(`ppl_all_affine_quasi_ranking_functions_MS_@TOPOLOGY@@CLASS@_code', 1561`dnl 1562___END_OF_FILE___ 1563___BEGIN_OF_FILE___ ppl_java_Termination.cc << ___END_OF_FILE___ 1564 1565JNIEXPORT void JNICALL 1566Java_parma_1polyhedra_1library_Termination_all_1affine_1quasi_1ranking_1functions_1MS_1@TOPOLOGY@1@CLASS@ 1567(JNIEnv* env, jclass, jobject j_p, 1568 jobject j_ph_decreasing, jobject j_ph_bounded) { 1569 try { 1570 @TOPOLOGY@@CPP_CLASS@* p_ptr 1571 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p)); 1572 C_Polyhedron* ph_decreasing = new C_Polyhedron(); 1573 C_Polyhedron* ph_bounded = new C_Polyhedron(); 1574 all_affine_quasi_ranking_functions_MS(*p_ptr, *ph_decreasing, *ph_bounded); 1575 set_ptr(env, j_ph_decreasing, ph_decreasing); 1576 set_ptr(env, j_ph_bounded, ph_bounded); 1577 } 1578 CATCH_ALL; 1579} 1580 1581') 1582 1583m4_define(`ppl_all_affine_quasi_ranking_functions_MS_@TOPOLOGY@@CLASS@_2_code', 1584`dnl 1585___END_OF_FILE___ 1586___BEGIN_OF_FILE___ ppl_java_Termination.cc << ___END_OF_FILE___ 1587 1588JNIEXPORT void JNICALL 1589Java_parma_1polyhedra_1library_Termination_all_1affine_1quasi_1ranking_1functions_1MS_1@TOPOLOGY@1@CLASS@_12 1590(JNIEnv* env, jclass, jobject j_p_before, jobject j_p_after, 1591 jobject j_ph_decreasing, jobject j_ph_bounded) { 1592 try { 1593 @TOPOLOGY@@CPP_CLASS@* p_ptr_before 1594 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p_before)); 1595 @TOPOLOGY@@CPP_CLASS@* p_ptr_after 1596 = reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(get_ptr(env, j_p_after)); 1597 C_Polyhedron* ph_decreasing = new C_Polyhedron(); 1598 C_Polyhedron* ph_bounded = new C_Polyhedron(); 1599 all_affine_quasi_ranking_functions_MS_2(*p_ptr_before, *p_ptr_after, 1600 *ph_decreasing, *ph_bounded); 1601 set_ptr(env, j_ph_decreasing, ph_decreasing); 1602 set_ptr(env, j_ph_bounded, ph_bounded); 1603 } 1604 CATCH_ALL; 1605} 1606 1607') 1608