00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "ppl_c_implementation_common.defs.hh"
00027
00028 namespace Parma_Polyhedra_Library {
00029
00030 namespace Interfaces {
00031
00032 namespace C {
00033
00034 error_handler_type user_error_handler = 0;
00035
00036 extern "C" const char*
00037 c_variable_default_output_function(ppl_dimension_type var) {
00038 #if PPL_SIZEOF_SIZE_T == PPL_SIZEOF_INT
00039 # define FORMAT "%u"
00040 # define CONVERSION (unsigned)
00041 #elif PPL_SIZEOF_SIZE_T == PPL_SIZEOF_LONG
00042 # define FORMAT "%lu"
00043 # define CONVERSION (unsigned long)
00044 #elif PPL_SIZEOF_SIZE_T == PPL_SIZEOF_LONG_LONG
00045 # define FORMAT "%llu"
00046 # define CONVERSION (unsigned long long)
00047 #else
00048 # error "Unsupported definition for `size_t'."
00049 #endif
00050
00051
00052
00053 #if defined(ULLONG_MAX) && ULLONG_MAX > 18446744073709551615ULL
00054 # error "Please enlarge the buffer in the following line."
00055 #endif
00056 static char buffer[20];
00057 buffer[0] = static_cast<char>('A' + var % 26);
00058 if (ppl_dimension_type i = var / 26) {
00059 int r = sprintf(buffer+1, FORMAT, CONVERSION i);
00060 if (r < 0)
00061 return 0;
00062 else if (r >= 19) {
00063 errno = ERANGE;
00064 return 0;
00065 }
00066 }
00067 else
00068 buffer[1] = '\0';
00069 return buffer;
00070 }
00071
00072
00073 ppl_io_variable_output_function_type* c_variable_output_function;
00074
00075 void
00076 cxx_Variable_output_function(std::ostream& s, const Variable& v) {
00077 const char* b = c_variable_output_function(v.id());
00078 if (b == 0)
00079
00080
00081 return;
00082 s << b;
00083 }
00084
00085 extern "C" typedef const char*
00086 c_variable_output_function_type(ppl_dimension_type var);
00087
00088
00089 Variable::output_function_type* saved_cxx_Variable_output_function;
00090
00091 void
00092 notify_error(enum ppl_enum_error_code code, const char* description) {
00093 if (user_error_handler != 0)
00094 user_error_handler(code, description);
00095 }
00096
00097 #ifdef PPL_WATCHDOG_LIBRARY_ENABLED
00098
00099 Parma_Watchdog_Library::Watchdog* p_timeout_object = 0;
00100
00101 typedef
00102 Parma_Watchdog_Library::Threshold_Watcher
00103 <Parma_Polyhedra_Library::Weightwatch_Traits> Weightwatch;
00104
00105 Weightwatch* p_deterministic_timeout_object = 0;
00106
00107 #endif // PPL_WATCHDOG_LIBRARY_ENABLED
00108
00109 void
00110 reset_timeout() {
00111 #ifdef PPL_WATCHDOG_LIBRARY_ENABLED
00112 if (p_timeout_object) {
00113 delete p_timeout_object;
00114 p_timeout_object = 0;
00115 abandon_expensive_computations = 0;
00116 }
00117 #endif // PPL_WATCHDOG_LIBRARY_ENABLED
00118 }
00119
00120 void
00121 reset_deterministic_timeout() {
00122 #ifdef PPL_WATCHDOG_LIBRARY_ENABLED
00123 if (p_deterministic_timeout_object) {
00124 delete p_deterministic_timeout_object;
00125 p_deterministic_timeout_object = 0;
00126 abandon_expensive_computations = 0;
00127 }
00128 #endif // PPL_WATCHDOG_LIBRARY_ENABLED
00129 }
00130
00131 }
00132
00133 }
00134
00135 }
00136
00137 using namespace Parma_Polyhedra_Library;
00138 using namespace Parma_Polyhedra_Library::Interfaces::C;
00139
00140 unsigned int PPL_POLY_CON_RELATION_IS_DISJOINT;
00141 unsigned int PPL_POLY_CON_RELATION_STRICTLY_INTERSECTS;
00142 unsigned int PPL_POLY_CON_RELATION_IS_INCLUDED;
00143 unsigned int PPL_POLY_CON_RELATION_SATURATES;
00144
00145 unsigned int PPL_POLY_GEN_RELATION_SUBSUMES;
00146
00147 unsigned int PPL_COMPLEXITY_CLASS_POLYNOMIAL;
00148 unsigned int PPL_COMPLEXITY_CLASS_SIMPLEX;
00149 unsigned int PPL_COMPLEXITY_CLASS_ANY;
00150
00151 int PPL_MIP_PROBLEM_STATUS_UNFEASIBLE;
00152 int PPL_MIP_PROBLEM_STATUS_UNBOUNDED;
00153 int PPL_MIP_PROBLEM_STATUS_OPTIMIZED;
00154
00155 int PPL_MIP_PROBLEM_CONTROL_PARAMETER_NAME_PRICING;
00156 int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_STEEPEST_EDGE_FLOAT;
00157 int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_STEEPEST_EDGE_EXACT;
00158 int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_TEXTBOOK;
00159
00160 int PPL_PIP_PROBLEM_STATUS_UNFEASIBLE;
00161 int PPL_PIP_PROBLEM_STATUS_OPTIMIZED;
00162
00163 int PPL_PIP_PROBLEM_CONTROL_PARAMETER_NAME_CUTTING_STRATEGY;
00164 int PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_FIRST;
00165 int PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_DEEPEST;
00166 int PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_ALL;
00167 int PPL_PIP_PROBLEM_CONTROL_PARAMETER_NAME_PIVOT_ROW_STRATEGY;
00168 int PPL_PIP_PROBLEM_CONTROL_PARAMETER_PIVOT_ROW_STRATEGY_FIRST;
00169 int PPL_PIP_PROBLEM_CONTROL_PARAMETER_PIVOT_ROW_STRATEGY_MAX_COLUMN;
00170
00171 int PPL_OPTIMIZATION_MODE_MINIMIZATION;
00172 int PPL_OPTIMIZATION_MODE_MAXIMIZATION;
00173
00174 int
00175 ppl_set_error_handler(error_handler_type h) {
00176 user_error_handler = h;
00177 return 0;
00178 }
00179
00180 int
00181 ppl_initialize(void) try {
00182 initialize();
00183
00184 PPL_POLY_CON_RELATION_IS_DISJOINT
00185 = Poly_Con_Relation::is_disjoint().get_flags();
00186 PPL_POLY_CON_RELATION_STRICTLY_INTERSECTS
00187 = Poly_Con_Relation::strictly_intersects().get_flags();
00188 PPL_POLY_CON_RELATION_IS_INCLUDED
00189 = Poly_Con_Relation::is_included().get_flags();
00190 PPL_POLY_CON_RELATION_SATURATES
00191 = Poly_Con_Relation::saturates().get_flags();
00192
00193 PPL_POLY_GEN_RELATION_SUBSUMES
00194 = Poly_Gen_Relation::subsumes().get_flags();
00195
00196 PPL_COMPLEXITY_CLASS_POLYNOMIAL = POLYNOMIAL_COMPLEXITY;
00197 PPL_COMPLEXITY_CLASS_SIMPLEX = SIMPLEX_COMPLEXITY;
00198 PPL_COMPLEXITY_CLASS_ANY = ANY_COMPLEXITY;
00199
00200 PPL_MIP_PROBLEM_STATUS_UNFEASIBLE = UNFEASIBLE_MIP_PROBLEM;
00201 PPL_MIP_PROBLEM_STATUS_UNBOUNDED = UNBOUNDED_MIP_PROBLEM;
00202 PPL_MIP_PROBLEM_STATUS_OPTIMIZED = OPTIMIZED_MIP_PROBLEM;
00203
00204 PPL_MIP_PROBLEM_CONTROL_PARAMETER_NAME_PRICING
00205 = MIP_Problem::PRICING;
00206 PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_STEEPEST_EDGE_FLOAT
00207 = MIP_Problem::PRICING_STEEPEST_EDGE_FLOAT;
00208 PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_STEEPEST_EDGE_EXACT
00209 = MIP_Problem::PRICING_STEEPEST_EDGE_EXACT;
00210 PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_TEXTBOOK
00211 = MIP_Problem::PRICING_TEXTBOOK;
00212
00213 PPL_PIP_PROBLEM_STATUS_UNFEASIBLE = UNFEASIBLE_PIP_PROBLEM;
00214 PPL_PIP_PROBLEM_STATUS_OPTIMIZED = OPTIMIZED_PIP_PROBLEM;
00215
00216 PPL_PIP_PROBLEM_CONTROL_PARAMETER_NAME_CUTTING_STRATEGY
00217 = PIP_Problem::CUTTING_STRATEGY;
00218 PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_FIRST
00219 = PIP_Problem::CUTTING_STRATEGY_FIRST;
00220 PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_DEEPEST
00221 = PIP_Problem::CUTTING_STRATEGY_DEEPEST;
00222 PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_ALL
00223 = PIP_Problem::CUTTING_STRATEGY_ALL;
00224 PPL_PIP_PROBLEM_CONTROL_PARAMETER_NAME_PIVOT_ROW_STRATEGY
00225 = PIP_Problem::PIVOT_ROW_STRATEGY;
00226 PPL_PIP_PROBLEM_CONTROL_PARAMETER_PIVOT_ROW_STRATEGY_FIRST
00227 = PIP_Problem::PIVOT_ROW_STRATEGY_FIRST;
00228 PPL_PIP_PROBLEM_CONTROL_PARAMETER_PIVOT_ROW_STRATEGY_MAX_COLUMN
00229 = PIP_Problem::PIVOT_ROW_STRATEGY_MAX_COLUMN;
00230
00231 PPL_OPTIMIZATION_MODE_MINIMIZATION = MINIMIZATION;
00232 PPL_OPTIMIZATION_MODE_MAXIMIZATION = MAXIMIZATION;
00233
00234 c_variable_output_function = c_variable_default_output_function;
00235 saved_cxx_Variable_output_function = Variable::get_output_function();
00236 Variable::set_output_function(cxx_Variable_output_function);
00237
00238 return 0;
00239 }
00240 CATCH_ALL
00241
00242 int
00243 ppl_finalize(void) try {
00244 Variable::set_output_function(saved_cxx_Variable_output_function);
00245
00246 finalize();
00247 return 0;
00248 }
00249 CATCH_ALL
00250
00251 int
00252 ppl_set_timeout(unsigned time) try {
00253 #ifndef PPL_WATCHDOG_LIBRARY_ENABLED
00254 used(time);
00255 const char* what = "PPL C interface error:\n"
00256 "ppl_set_timeout: the PPL Watchdog library is not enabled.";
00257 throw std::runtime_error(what);
00258 #else
00259
00260 reset_timeout();
00261 static timeout_exception e;
00262 using Parma_Watchdog_Library::Watchdog;
00263 p_timeout_object = new Watchdog(time, abandon_expensive_computations, e);
00264 return 0;
00265 #endif // PPL_WATCHDOG_LIBRARY_ENABLED
00266 }
00267 CATCH_ALL
00268
00269 int
00270 ppl_reset_timeout(void) try {
00271 #ifndef PPL_WATCHDOG_LIBRARY_ENABLED
00272 const char* what = "PPL C interface error:\n"
00273 "ppl_reset_timeout: the PPL Watchdog library is not enabled.";
00274 throw std::runtime_error(what);
00275 #else
00276 reset_timeout();
00277 return 0;
00278 #endif // PPL_WATCHDOG_LIBRARY_ENABLED
00279 }
00280 CATCH_ALL
00281
00282 int
00283 ppl_set_deterministic_timeout(unsigned weight) try {
00284 #ifndef PPL_WATCHDOG_LIBRARY_ENABLED
00285 used(weight);
00286 const char* what = "PPL C interface error:\n"
00287 "ppl_set_deterministic_timeout: the PPL Watchdog library is not enabled.";
00288 throw std::runtime_error(what);
00289 #else
00290
00291 reset_deterministic_timeout();
00292 static timeout_exception e;
00293 p_deterministic_timeout_object
00294 = new Weightwatch(weight, abandon_expensive_computations, e);
00295 return 0;
00296 #endif // PPL_WATCHDOG_LIBRARY_ENABLED
00297 }
00298 CATCH_ALL
00299
00300 int
00301 ppl_reset_deterministic_timeout(void) try {
00302 #ifndef PPL_WATCHDOG_LIBRARY_ENABLED
00303 const char* what = "PPL C interface error:\n"
00304 "ppl_reset_deterministic_timeout: the PPL Watchdog library is not enabled.";
00305 throw std::runtime_error(what);
00306 #else
00307 reset_deterministic_timeout();
00308 return 0;
00309 #endif // PPL_WATCHDOG_LIBRARY_ENABLED
00310 }
00311 CATCH_ALL
00312
00313 int
00314 ppl_set_rounding_for_PPL(void) try {
00315 set_rounding_for_PPL();
00316 return 0;
00317 }
00318 CATCH_ALL
00319
00320 int
00321 ppl_restore_pre_PPL_rounding(void) try {
00322 restore_pre_PPL_rounding();
00323 return 0;
00324 }
00325 CATCH_ALL
00326
00327 int
00328 ppl_irrational_precision(unsigned* p) try {
00329 *p = irrational_precision();
00330 return 0;
00331 }
00332 CATCH_ALL
00333
00334 int
00335 ppl_set_irrational_precision(unsigned p) try {
00336 set_irrational_precision(p);
00337 return 0;
00338 }
00339 CATCH_ALL
00340
00341 int
00342 ppl_version_major(void) try {
00343 return version_major();
00344 }
00345 CATCH_ALL
00346
00347 int
00348 ppl_version_minor(void) try {
00349 return version_minor();
00350 }
00351 CATCH_ALL
00352
00353 int
00354 ppl_version_revision(void) try {
00355 return version_revision();
00356 }
00357 CATCH_ALL
00358
00359 int
00360 ppl_version_beta(void) try {
00361 return version_beta();
00362 }
00363 CATCH_ALL
00364
00365 int
00366 ppl_version(const char** p) try {
00367
00368
00369
00370 *p = Parma_Polyhedra_Library::version();
00371 return 0;
00372 }
00373 CATCH_ALL
00374
00375 int
00376 ppl_banner(const char** p) try {
00377 *p = banner();
00378 return 0;
00379 }
00380 CATCH_ALL
00381
00382 int
00383 ppl_max_space_dimension(ppl_dimension_type* m) try {
00384 *m = max_space_dimension();
00385 return 0;
00386 }
00387 CATCH_ALL
00388
00389 int
00390 ppl_not_a_dimension(ppl_dimension_type* m) try {
00391 *m = not_a_dimension();
00392 return 0;
00393 }
00394 CATCH_ALL
00395
00396 int
00397 ppl_new_Coefficient(ppl_Coefficient_t* pc) try {
00398 *pc = to_nonconst(new Coefficient(0));
00399 return 0;
00400 }
00401 CATCH_ALL
00402
00403 int
00404 ppl_new_Coefficient_from_mpz_t(ppl_Coefficient_t* pc, mpz_t z) try {
00405 *pc = to_nonconst(new Coefficient(reinterpret_mpz_class(z)));
00406 return 0;
00407 }
00408 CATCH_ALL
00409
00410 int
00411 ppl_new_Coefficient_from_Coefficient(ppl_Coefficient_t* pc,
00412 ppl_const_Coefficient_t c) try {
00413 const Coefficient& cc = *to_const(c);
00414 *pc = to_nonconst(new Coefficient(cc));
00415 return 0;
00416 }
00417 CATCH_ALL
00418
00419 int
00420 ppl_Coefficient_to_mpz_t(ppl_const_Coefficient_t c, mpz_t z) try {
00421 assign_r(reinterpret_mpz_class(z), *to_const(c), ROUND_NOT_NEEDED);
00422 return 0;
00423 }
00424 CATCH_ALL
00425
00426 int
00427 ppl_delete_Coefficient(ppl_const_Coefficient_t c) try {
00428 delete to_const(c);
00429 return 0;
00430 }
00431 CATCH_ALL
00432
00433 int
00434 ppl_assign_Coefficient_from_mpz_t(ppl_Coefficient_t dst, mpz_t z) try {
00435 Coefficient& ddst = *to_nonconst(dst);
00436 ddst = reinterpret_mpz_class(z);
00437 return 0;
00438 }
00439 CATCH_ALL
00440
00441 int
00442 ppl_assign_Coefficient_from_Coefficient(ppl_Coefficient_t dst,
00443 ppl_const_Coefficient_t src) try {
00444 const Coefficient& ssrc = *to_const(src);
00445 Coefficient& ddst = *to_nonconst(dst);
00446 ddst = ssrc;
00447 return 0;
00448 }
00449 CATCH_ALL
00450
00451 int
00452 ppl_Coefficient_OK(ppl_const_Coefficient_t ) try {
00453 return 1;
00454 }
00455 CATCH_ALL
00456
00457 int
00458 ppl_Coefficient_is_bounded(void) try {
00459 return std::numeric_limits<Coefficient>::is_bounded ? 1 : 0;
00460 }
00461 CATCH_ALL
00462
00463 int
00464 ppl_Coefficient_min(mpz_t min) try {
00465 if (std::numeric_limits<Coefficient>::is_bounded) {
00466 assign_r(reinterpret_mpz_class(min),
00467 std::numeric_limits<Coefficient>::min(),
00468 ROUND_NOT_NEEDED);
00469 return 1;
00470 }
00471 else
00472 return 0;
00473 }
00474 CATCH_ALL
00475
00476 int
00477 ppl_Coefficient_max(mpz_t max) try {
00478 if (std::numeric_limits<Coefficient>::is_bounded) {
00479 assign_r(reinterpret_mpz_class(max),
00480 std::numeric_limits<Coefficient>::max(),
00481 ROUND_NOT_NEEDED);
00482 return 1;
00483 }
00484 else
00485 return 0;
00486 }
00487 CATCH_ALL
00488
00489
00490
00491 int
00492 ppl_new_Linear_Expression(ppl_Linear_Expression_t* ple) try {
00493 *ple = to_nonconst(new Linear_Expression());
00494 return 0;
00495 }
00496 CATCH_ALL
00497
00498 int
00499 ppl_new_Linear_Expression_with_dimension(ppl_Linear_Expression_t* ple,
00500 ppl_dimension_type d) try {
00501 *ple = to_nonconst(d == 0
00502 ? new Linear_Expression(0)
00503 : new Linear_Expression(0*Variable(d-1)));
00504 return 0;
00505 }
00506 CATCH_ALL
00507
00508 int
00509 ppl_new_Linear_Expression_from_Linear_Expression
00510 (ppl_Linear_Expression_t* ple, ppl_const_Linear_Expression_t le) try {
00511 const Linear_Expression& lle = *to_const(le);
00512 *ple = to_nonconst(new Linear_Expression(lle));
00513 return 0;
00514 }
00515 CATCH_ALL
00516
00517 int
00518 ppl_delete_Linear_Expression(ppl_const_Linear_Expression_t le) try {
00519 delete to_const(le);
00520 return 0;
00521 }
00522 CATCH_ALL
00523
00524 int
00525 ppl_assign_Linear_Expression_from_Linear_Expression
00526 (ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src) try {
00527 const Linear_Expression& ssrc = *to_const(src);
00528 Linear_Expression& ddst = *to_nonconst(dst);
00529 ddst = ssrc;
00530 return 0;
00531 }
00532 CATCH_ALL
00533
00534 int
00535 ppl_Linear_Expression_add_to_coefficient(ppl_Linear_Expression_t le,
00536 ppl_dimension_type var,
00537 ppl_const_Coefficient_t n) try {
00538 Linear_Expression& lle = *to_nonconst(le);
00539 const Coefficient& nn = *to_const(n);
00540 add_mul_assign(lle, nn, Variable(var));
00541 return 0;
00542 }
00543 CATCH_ALL
00544
00545 int
00546 ppl_Linear_Expression_add_to_inhomogeneous(ppl_Linear_Expression_t le,
00547 ppl_const_Coefficient_t n) try {
00548 Linear_Expression& lle = *to_nonconst(le);
00549 const Coefficient& nn = *to_const(n);
00550 lle += nn;
00551 return 0;
00552 }
00553 CATCH_ALL
00554
00555 int
00556 ppl_add_Linear_Expression_to_Linear_Expression
00557 (ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src) try {
00558 Linear_Expression& ddst = *to_nonconst(dst);
00559 const Linear_Expression& ssrc = *to_const(src);
00560 ddst += ssrc;
00561 return 0;
00562 }
00563 CATCH_ALL
00564
00565 int
00566 ppl_subtract_Linear_Expression_from_Linear_Expression
00567 (ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src) try {
00568 Linear_Expression& ddst = *to_nonconst(dst);
00569 const Linear_Expression& ssrc = *to_const(src);
00570 ddst -= ssrc;
00571 return 0;
00572 }
00573 CATCH_ALL
00574
00575 int
00576 ppl_multiply_Linear_Expression_by_Coefficient(ppl_Linear_Expression_t le,
00577 ppl_const_Coefficient_t n) try {
00578 Linear_Expression& lle = *to_nonconst(le);
00579 const Coefficient& nn = *to_const(n);
00580 lle *= nn;
00581 return 0;
00582 }
00583 CATCH_ALL
00584
00585 int
00586 ppl_Linear_Expression_space_dimension(ppl_const_Linear_Expression_t le,
00587 ppl_dimension_type* m) try {
00588 *m = to_const(le)->space_dimension();
00589 return 0;
00590 }
00591 CATCH_ALL
00592
00593 int
00594 ppl_Linear_Expression_coefficient(ppl_const_Linear_Expression_t le,
00595 ppl_dimension_type var,
00596 ppl_Coefficient_t n) try {
00597 const Linear_Expression& lle = *to_const(le);
00598 Coefficient& nn = *to_nonconst(n);
00599 nn = lle.coefficient(Variable(var));
00600 return 0;
00601 }
00602 CATCH_ALL
00603
00604 int
00605 ppl_Linear_Expression_inhomogeneous_term(ppl_const_Linear_Expression_t le,
00606 ppl_Coefficient_t n) try {
00607 const Linear_Expression& lle = *to_const(le);
00608 Coefficient& nn = *to_nonconst(n);
00609 nn = lle.inhomogeneous_term();
00610 return 0;
00611 }
00612 CATCH_ALL
00613
00614 int
00615 ppl_Linear_Expression_OK(ppl_const_Linear_Expression_t le) try {
00616 return to_const(le)->OK() ? 1 : 0;
00617 }
00618 CATCH_ALL
00619
00620 int
00621 ppl_Linear_Expression_is_zero(ppl_const_Linear_Expression_t le) try {
00622 return to_const(le)->is_zero() ? 1 : 0;
00623 }
00624 CATCH_ALL
00625
00626 int
00627 ppl_Linear_Expression_all_homogeneous_terms_are_zero
00628 (ppl_const_Linear_Expression_t le) try {
00629 return to_const(le)->all_homogeneous_terms_are_zero() ? 1 : 0;
00630 }
00631 CATCH_ALL
00632
00633
00634
00635 int
00636 ppl_new_Constraint(ppl_Constraint_t* pc,
00637 ppl_const_Linear_Expression_t le,
00638 enum ppl_enum_Constraint_Type t) try {
00639 Constraint* ppc;
00640 const Linear_Expression& lle = *to_const(le);
00641 switch (t) {
00642 case PPL_CONSTRAINT_TYPE_EQUAL:
00643 ppc = new Constraint(lle == 0);
00644 break;
00645 case PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL:
00646 ppc = new Constraint(lle >= 0);
00647 break;
00648 case PPL_CONSTRAINT_TYPE_GREATER_THAN:
00649 ppc = new Constraint(lle > 0);
00650 break;
00651 case PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL:
00652 ppc = new Constraint(lle <= 0);
00653 break;
00654 case PPL_CONSTRAINT_TYPE_LESS_THAN:
00655 ppc = new Constraint(lle < 0);
00656 break;
00657 default:
00658 throw std::invalid_argument("ppl_new_Constraint(pc, le, t): "
00659 "t invalid");
00660 }
00661 *pc = to_nonconst(ppc);
00662 return 0;
00663 }
00664 CATCH_ALL
00665
00666 int
00667 ppl_new_Constraint_zero_dim_false(ppl_Constraint_t* pc) try {
00668 *pc = to_nonconst(new Constraint(Constraint::zero_dim_false()));
00669 return 0;
00670 }
00671 CATCH_ALL
00672
00673 int
00674 ppl_new_Constraint_zero_dim_positivity(ppl_Constraint_t* pc) try {
00675 *pc = to_nonconst(new Constraint(Constraint::zero_dim_positivity()));
00676 return 0;
00677 }
00678 CATCH_ALL
00679
00680 int
00681 ppl_new_Constraint_from_Constraint(ppl_Constraint_t* pc,
00682 ppl_const_Constraint_t c) try {
00683 const Constraint& cc = *to_const(c);
00684 *pc = to_nonconst(new Constraint(cc));
00685 return 0;
00686 }
00687 CATCH_ALL
00688
00689 int
00690 ppl_delete_Constraint(ppl_const_Constraint_t le) try {
00691 delete to_const(le);
00692 return 0;
00693 }
00694 CATCH_ALL
00695
00696 int
00697 ppl_assign_Constraint_from_Constraint(ppl_Constraint_t dst,
00698 ppl_const_Constraint_t src) try {
00699 const Constraint& ssrc = *to_const(src);
00700 Constraint& ddst = *to_nonconst(dst);
00701 ddst = ssrc;
00702 return 0;
00703 }
00704 CATCH_ALL
00705
00706 int
00707 ppl_Constraint_space_dimension(ppl_const_Constraint_t c,
00708 ppl_dimension_type* m) try {
00709 *m = to_const(c)->space_dimension();
00710 return 0;
00711 }
00712 CATCH_ALL
00713
00714 int
00715 ppl_Constraint_type(ppl_const_Constraint_t c) try {
00716 switch (to_const(c)->type()) {
00717 case Constraint::EQUALITY:
00718 return PPL_CONSTRAINT_TYPE_EQUAL;
00719 case Constraint::NONSTRICT_INEQUALITY:
00720 return PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL;
00721 case Constraint::STRICT_INEQUALITY:
00722 return PPL_CONSTRAINT_TYPE_GREATER_THAN;
00723 default:
00724 throw std::runtime_error("ppl_Constraint_type()");
00725 }
00726 }
00727 CATCH_ALL
00728
00729 int
00730 ppl_Constraint_coefficient(ppl_const_Constraint_t c,
00731 ppl_dimension_type var,
00732 ppl_Coefficient_t n) try {
00733 const Constraint& cc = *to_const(c);
00734 Coefficient& nn = *to_nonconst(n);
00735 nn = cc.coefficient(Variable(var));
00736 return 0;
00737 }
00738 CATCH_ALL
00739
00740 int
00741 ppl_Constraint_inhomogeneous_term(ppl_const_Constraint_t c,
00742 ppl_Coefficient_t n) try {
00743 const Constraint& cc = *to_const(c);
00744 Coefficient& nn = *to_nonconst(n);
00745 nn = cc.inhomogeneous_term();
00746 return 0;
00747 }
00748 CATCH_ALL
00749
00750 int
00751 ppl_Constraint_OK(ppl_const_Constraint_t c) try {
00752 return to_const(c)->OK() ? 1 : 0;
00753 }
00754 CATCH_ALL
00755
00756 int
00757 ppl_new_Linear_Expression_from_Constraint(ppl_Linear_Expression_t* ple,
00758 ppl_const_Constraint_t c) try {
00759 const Constraint& cc = *to_const(c);
00760 *ple = to_nonconst(new Linear_Expression(cc));
00761 return 0;
00762 }
00763 CATCH_ALL
00764
00765
00766
00767 int
00768 ppl_new_Constraint_System(ppl_Constraint_System_t* pcs) try {
00769 *pcs = to_nonconst(new Constraint_System());
00770 return 0;
00771 }
00772 CATCH_ALL
00773
00774 int
00775 ppl_new_Constraint_System_zero_dim_empty(ppl_Constraint_System_t* pcs) try {
00776 *pcs = to_nonconst(new
00777 Constraint_System(Constraint_System::zero_dim_empty()));
00778 return 0;
00779 }
00780 CATCH_ALL
00781
00782
00783 int
00784 ppl_new_Constraint_System_from_Constraint(ppl_Constraint_System_t* pcs,
00785 ppl_const_Constraint_t c) try {
00786 const Constraint& cc = *to_const(c);
00787 *pcs = to_nonconst(new Constraint_System(cc));
00788 return 0;
00789 }
00790 CATCH_ALL
00791
00792 int
00793 ppl_new_Constraint_System_from_Constraint_System
00794 (ppl_Constraint_System_t* pcs, ppl_const_Constraint_System_t cs) try {
00795 const Constraint_System& ccs = *to_const(cs);
00796 *pcs = to_nonconst(new Constraint_System(ccs));
00797 return 0;
00798 }
00799 CATCH_ALL
00800
00801 int
00802 ppl_delete_Constraint_System(ppl_const_Constraint_System_t cs) try {
00803 delete to_const(cs);
00804 return 0;
00805 }
00806 CATCH_ALL
00807
00808 int
00809 ppl_assign_Constraint_System_from_Constraint_System
00810 (ppl_Constraint_System_t dst, ppl_const_Constraint_System_t src) try {
00811 const Constraint_System& ssrc = *to_const(src);
00812 Constraint_System& ddst = *to_nonconst(dst);
00813 ddst = ssrc;
00814 return 0;
00815 }
00816 CATCH_ALL
00817
00818 int
00819 ppl_Constraint_System_space_dimension(ppl_const_Constraint_System_t cs,
00820 ppl_dimension_type* m) try {
00821 *m = to_const(cs)->space_dimension();
00822 return 0;
00823 }
00824 CATCH_ALL
00825
00826 int
00827 ppl_Constraint_System_empty
00828 (ppl_const_Constraint_System_t cs) try {
00829 const Constraint_System& ccs = *to_const(cs);
00830 return ccs.empty() ? 1 : 0;
00831 }
00832 CATCH_ALL
00833
00834 int
00835 ppl_Constraint_System_has_strict_inequalities
00836 (ppl_const_Constraint_System_t cs) try {
00837 const Constraint_System& ccs = *to_const(cs);
00838 return ccs.has_strict_inequalities() ? 1 : 0;
00839 }
00840 CATCH_ALL
00841
00842 int
00843 ppl_Constraint_System_clear(ppl_Constraint_System_t cs) try {
00844 to_nonconst(cs)->clear();
00845 return 0;
00846 }
00847 CATCH_ALL
00848
00849 int
00850 ppl_Constraint_System_insert_Constraint(ppl_Constraint_System_t cs,
00851 ppl_const_Constraint_t c) try {
00852 const Constraint& cc = *to_const(c);
00853 Constraint_System& ccs = *to_nonconst(cs);
00854 ccs.insert(cc);
00855 return 0;
00856 }
00857 CATCH_ALL
00858
00859 int
00860 ppl_Constraint_System_OK(ppl_const_Constraint_System_t cs) try {
00861 return to_const(cs)->OK() ? 1 : 0;
00862 }
00863 CATCH_ALL
00864
00865
00866
00867 int
00868 ppl_new_Constraint_System_const_iterator
00869 (ppl_Constraint_System_const_iterator_t* pcit) try {
00870 *pcit = to_nonconst(new Constraint_System::const_iterator());
00871 return 0;
00872 }
00873 CATCH_ALL
00874
00875 int
00876 ppl_new_Constraint_System_const_iterator_from_Constraint_System_const_iterator
00877 (ppl_Constraint_System_const_iterator_t* pcit,
00878 ppl_const_Constraint_System_const_iterator_t cit) try {
00879 *pcit = to_nonconst(new Constraint_System::const_iterator(*to_const(cit)));
00880 return 0;
00881 }
00882 CATCH_ALL
00883
00884 int
00885 ppl_delete_Constraint_System_const_iterator
00886 (ppl_const_Constraint_System_const_iterator_t cit)
00887 try {
00888 delete to_const(cit);
00889 return 0;
00890 }
00891 CATCH_ALL
00892
00893 int
00894 ppl_assign_Constraint_System_const_iterator_from_Constraint_System_const_iterator
00895 (ppl_Constraint_System_const_iterator_t dst,
00896 ppl_const_Constraint_System_const_iterator_t src) try {
00897 const Constraint_System::const_iterator& ssrc = *to_const(src);
00898 Constraint_System::const_iterator& ddst = *to_nonconst(dst);
00899 ddst = ssrc;
00900 return 0;
00901 }
00902 CATCH_ALL
00903
00904 int
00905 ppl_Constraint_System_begin(ppl_const_Constraint_System_t cs,
00906 ppl_Constraint_System_const_iterator_t cit) try {
00907 const Constraint_System& ccs = *to_const(cs);
00908 Constraint_System::const_iterator& ccit = *to_nonconst(cit);
00909 ccit = ccs.begin();
00910 return 0;
00911 }
00912 CATCH_ALL
00913
00914 int
00915 ppl_Constraint_System_end(ppl_const_Constraint_System_t cs,
00916 ppl_Constraint_System_const_iterator_t cit) try {
00917 const Constraint_System& ccs = *to_const(cs);
00918 Constraint_System::const_iterator& ccit = *to_nonconst(cit);
00919 ccit = ccs.end();
00920 return 0;
00921 }
00922 CATCH_ALL
00923
00924 int
00925 ppl_Constraint_System_const_iterator_dereference
00926 (ppl_const_Constraint_System_const_iterator_t cit,
00927 ppl_const_Constraint_t* pc) try {
00928 const Constraint_System::const_iterator& ccit = *to_const(cit);
00929 const Constraint& c = *ccit;
00930 *pc = to_const(&c);
00931 return 0;
00932 }
00933 CATCH_ALL
00934
00935 int
00936 ppl_Constraint_System_const_iterator_increment
00937 (ppl_Constraint_System_const_iterator_t cit) try {
00938 Constraint_System::const_iterator& ccit = *to_nonconst(cit);
00939 ++ccit;
00940 return 0;
00941 }
00942 CATCH_ALL
00943
00944 int
00945 ppl_Constraint_System_const_iterator_equal_test
00946 (ppl_const_Constraint_System_const_iterator_t x,
00947 ppl_const_Constraint_System_const_iterator_t y) try {
00948 const Constraint_System::const_iterator& xx = *to_const(x);
00949 const Constraint_System::const_iterator& yy = *to_const(y);
00950 return (xx == yy) ? 1 : 0;
00951 }
00952 CATCH_ALL
00953
00954
00955
00956 int
00957 ppl_new_Generator(ppl_Generator_t* pg,
00958 ppl_const_Linear_Expression_t le,
00959 enum ppl_enum_Generator_Type t,
00960 ppl_const_Coefficient_t d) try {
00961 Generator* ppg;
00962 const Linear_Expression& lle = *to_const(le);
00963 const Coefficient& dd = *to_const(d);
00964 switch (t) {
00965 case PPL_GENERATOR_TYPE_POINT:
00966 ppg = new Generator(Generator::point(lle, dd));
00967 break;
00968 case PPL_GENERATOR_TYPE_CLOSURE_POINT:
00969 ppg = new Generator(Generator::closure_point(lle, dd));
00970 break;
00971 case PPL_GENERATOR_TYPE_RAY:
00972 ppg = new Generator(Generator::ray(lle));
00973 break;
00974 case PPL_GENERATOR_TYPE_LINE:
00975 ppg = new Generator(Generator::line(lle));
00976 break;
00977 default:
00978 throw std::invalid_argument("ppl_new_Generator(pg, le, t, d): "
00979 "t invalid");
00980 }
00981 *pg = to_nonconst(ppg);
00982 return 0;
00983 }
00984 CATCH_ALL
00985
00986 int
00987 ppl_new_Generator_zero_dim_point(ppl_Generator_t* pg) try {
00988 *pg = to_nonconst(new Generator(Generator::zero_dim_point()));
00989 return 0;
00990 }
00991 CATCH_ALL
00992
00993 int
00994 ppl_new_Generator_zero_dim_closure_point(ppl_Generator_t* pg) try {
00995 *pg = to_nonconst(new Generator(Generator::zero_dim_closure_point()));
00996 return 0;
00997 }
00998 CATCH_ALL
00999
01000 int
01001 ppl_new_Generator_from_Generator(ppl_Generator_t* pg,
01002 ppl_const_Generator_t g) try {
01003 const Generator& gg = *to_const(g);
01004 *pg = to_nonconst(new Generator(gg));
01005 return 0;
01006 }
01007 CATCH_ALL
01008
01009 int
01010 ppl_delete_Generator(ppl_const_Generator_t le) try {
01011 delete to_const(le);
01012 return 0;
01013 }
01014 CATCH_ALL
01015
01016 int
01017 ppl_assign_Generator_from_Generator(ppl_Generator_t dst,
01018 ppl_const_Generator_t src) try {
01019 const Generator& ssrc = *to_const(src);
01020 Generator& ddst = *to_nonconst(dst);
01021 ddst = ssrc;
01022 return 0;
01023 }
01024 CATCH_ALL
01025
01026 int
01027 ppl_Generator_space_dimension(ppl_const_Generator_t g,
01028 ppl_dimension_type* m) try {
01029 *m = to_const(g)->space_dimension();
01030 return 0;
01031 }
01032 CATCH_ALL
01033
01034 int
01035 ppl_Generator_type(ppl_const_Generator_t g) try {
01036 switch (to_const(g)->type()) {
01037 case Generator::LINE:
01038 return PPL_GENERATOR_TYPE_LINE;
01039 case Generator::RAY:
01040 return PPL_GENERATOR_TYPE_RAY;
01041 case Generator::POINT:
01042 return PPL_GENERATOR_TYPE_POINT;
01043 case Generator::CLOSURE_POINT:
01044 return PPL_GENERATOR_TYPE_CLOSURE_POINT;
01045 default:
01046 throw std::runtime_error("ppl_Generator_type()");
01047 }
01048 }
01049 CATCH_ALL
01050
01051 int
01052 ppl_Generator_coefficient(ppl_const_Generator_t g,
01053 ppl_dimension_type var,
01054 ppl_Coefficient_t n) try {
01055 const Generator& gg = *to_const(g);
01056 Coefficient& nn = *to_nonconst(n);
01057 nn = gg.coefficient(Variable(var));
01058 return 0;
01059 }
01060 CATCH_ALL
01061
01062 int
01063 ppl_Generator_divisor(ppl_const_Generator_t g,
01064 ppl_Coefficient_t n) try {
01065 const Generator& gg = *to_const(g);
01066 Coefficient& nn = *to_nonconst(n);
01067 nn = gg.divisor();
01068 return 0;
01069 }
01070 CATCH_ALL
01071
01072 int
01073 ppl_Generator_OK(ppl_const_Generator_t g) try {
01074 return to_const(g)->OK() ? 1 : 0;
01075 }
01076 CATCH_ALL
01077
01078 int
01079 ppl_new_Linear_Expression_from_Generator(ppl_Linear_Expression_t* ple,
01080 ppl_const_Generator_t g) try {
01081 const Generator& gg = *to_const(g);
01082 *ple = to_nonconst(new Linear_Expression(gg));
01083 return 0;
01084 }
01085 CATCH_ALL
01086
01087
01088
01089 int
01090 ppl_new_Generator_System(ppl_Generator_System_t* pgs) try {
01091 *pgs = to_nonconst(new Generator_System());
01092 return 0;
01093 }
01094 CATCH_ALL
01095
01096 int
01097 ppl_new_Generator_System_zero_dim_univ(ppl_Generator_System_t* pgs) try {
01098 *pgs = to_nonconst(new Generator_System(Generator_System::zero_dim_univ()));
01099 return 0;
01100 }
01101 CATCH_ALL
01102
01103 int
01104 ppl_new_Generator_System_from_Generator(ppl_Generator_System_t* pgs,
01105 ppl_const_Generator_t g) try {
01106 const Generator& gg = *to_const(g);
01107 *pgs = to_nonconst(new Generator_System(gg));
01108 return 0;
01109 }
01110 CATCH_ALL
01111
01112 int
01113 ppl_new_Generator_System_from_Generator_System
01114 (ppl_Generator_System_t* pgs, ppl_const_Generator_System_t gs) try {
01115 const Generator_System& ggs = *to_const(gs);
01116 *pgs = to_nonconst(new Generator_System(ggs));
01117 return 0;
01118 }
01119 CATCH_ALL
01120
01121 int
01122 ppl_delete_Generator_System(ppl_const_Generator_System_t gs) try {
01123 delete to_const(gs);
01124 return 0;
01125 }
01126 CATCH_ALL
01127
01128 int
01129 ppl_assign_Generator_System_from_Generator_System
01130 (ppl_Generator_System_t dst, ppl_const_Generator_System_t src) try {
01131 const Generator_System& ssrc = *to_const(src);
01132 Generator_System& ddst = *to_nonconst(dst);
01133 ddst = ssrc;
01134 return 0;
01135 }
01136 CATCH_ALL
01137
01138 int
01139 ppl_Generator_System_space_dimension(ppl_const_Generator_System_t gs,
01140 ppl_dimension_type* m) try {
01141 *m = to_const(gs)->space_dimension();
01142 return 0;
01143 }
01144 CATCH_ALL
01145
01146 int
01147 ppl_Generator_System_empty
01148 (ppl_const_Generator_System_t gs) try {
01149 const Generator_System& cgs = *to_const(gs);
01150 return cgs.empty() ? 1 : 0;
01151 }
01152 CATCH_ALL
01153
01154 int
01155 ppl_Generator_System_clear(ppl_Generator_System_t gs) try {
01156 to_nonconst(gs)->clear();
01157 return 0;
01158 }
01159 CATCH_ALL
01160
01161 int
01162 ppl_Generator_System_insert_Generator(ppl_Generator_System_t gs,
01163 ppl_const_Generator_t g) try {
01164 const Generator& gg = *to_const(g);
01165 Generator_System& ggs = *to_nonconst(gs);
01166 ggs.insert(gg);
01167 return 0;
01168 }
01169 CATCH_ALL
01170
01171 int
01172 ppl_Generator_System_OK(ppl_const_Generator_System_t gs) try {
01173 return to_const(gs)->OK() ? 1 : 0;
01174 }
01175 CATCH_ALL
01176
01177
01178
01179 int
01180 ppl_new_Generator_System_const_iterator
01181 (ppl_Generator_System_const_iterator_t* pgit) try {
01182 *pgit = to_nonconst(new Generator_System::const_iterator());
01183 return 0;
01184 }
01185 CATCH_ALL
01186
01187 int
01188 ppl_new_Generator_System_const_iterator_from_Generator_System_const_iterator
01189 (ppl_Generator_System_const_iterator_t* pgit,
01190 ppl_const_Generator_System_const_iterator_t git) try {
01191 *pgit = to_nonconst(new Generator_System::const_iterator(*to_const(git)));
01192 return 0;
01193 }
01194 CATCH_ALL
01195
01196 int
01197 ppl_delete_Generator_System_const_iterator
01198 (ppl_const_Generator_System_const_iterator_t git) try {
01199 delete to_const(git);
01200 return 0;
01201 }
01202 CATCH_ALL
01203
01204 int
01205 ppl_assign_Generator_System_const_iterator_from_Generator_System_const_iterator
01206 (ppl_Generator_System_const_iterator_t dst,
01207 ppl_const_Generator_System_const_iterator_t src) try {
01208 const Generator_System::const_iterator& ssrc = *to_const(src);
01209 Generator_System::const_iterator& ddst = *to_nonconst(dst);
01210 ddst = ssrc;
01211 return 0;
01212 }
01213 CATCH_ALL
01214
01215 int
01216 ppl_Generator_System_begin(ppl_const_Generator_System_t gs,
01217 ppl_Generator_System_const_iterator_t git) try {
01218 const Generator_System& ggs = *to_const(gs);
01219 Generator_System::const_iterator& ggit = *to_nonconst(git);
01220 ggit = ggs.begin();
01221 return 0;
01222 }
01223 CATCH_ALL
01224
01225 int
01226 ppl_Generator_System_end(ppl_const_Generator_System_t gs,
01227 ppl_Generator_System_const_iterator_t git) try {
01228 const Generator_System& ggs = *to_const(gs);
01229 Generator_System::const_iterator& ggit = *to_nonconst(git);
01230 ggit = ggs.end();
01231 return 0;
01232 }
01233 CATCH_ALL
01234
01235 int
01236 ppl_Generator_System_const_iterator_dereference
01237 (ppl_const_Generator_System_const_iterator_t git,
01238 ppl_const_Generator_t* pg) try {
01239 const Generator_System::const_iterator& ggit = *to_const(git);
01240 const Generator& c = *ggit;
01241 *pg = to_const(&c);
01242 return 0;
01243 }
01244 CATCH_ALL
01245
01246 int
01247 ppl_Generator_System_const_iterator_increment
01248 (ppl_Generator_System_const_iterator_t git) try {
01249 Generator_System::const_iterator& ggit = *to_nonconst(git);
01250 ++ggit;
01251 return 0;
01252 }
01253 CATCH_ALL
01254
01255 int
01256 ppl_Generator_System_const_iterator_equal_test
01257 (ppl_const_Generator_System_const_iterator_t x,
01258 ppl_const_Generator_System_const_iterator_t y) try {
01259 const Generator_System::const_iterator& xx = *to_const(x);
01260 const Generator_System::const_iterator& yy = *to_const(y);
01261 return (xx == yy) ? 1 : 0;
01262 }
01263 CATCH_ALL
01264
01265
01266
01267 int
01268 ppl_new_Congruence(ppl_Congruence_t* pc,
01269 ppl_const_Linear_Expression_t le,
01270 ppl_const_Coefficient_t m) try {
01271 Congruence* ppc;
01272 const Linear_Expression& lle = *to_const(le);
01273 const Coefficient& mm = *to_const(m);
01274 ppc = new Congruence((lle %= 0) / mm);
01275 *pc = to_nonconst(ppc);
01276 return 0;
01277 }
01278 CATCH_ALL
01279
01280 int
01281 ppl_new_Congruence_zero_dim_false(ppl_Congruence_t* pc) try {
01282 *pc = to_nonconst(new Congruence(Congruence::zero_dim_false()));
01283 return 0;
01284 }
01285 CATCH_ALL
01286
01287 int
01288 ppl_new_Congruence_zero_dim_integrality(ppl_Congruence_t* pc) try {
01289 *pc = to_nonconst(new Congruence(Congruence::zero_dim_integrality()));
01290 return 0;
01291 }
01292 CATCH_ALL
01293
01294 int
01295 ppl_new_Congruence_from_Congruence(ppl_Congruence_t* pc,
01296 ppl_const_Congruence_t c) try {
01297 const Congruence& cc = *to_const(c);
01298 *pc = to_nonconst(new Congruence(cc));
01299 return 0;
01300 }
01301 CATCH_ALL
01302
01303 int
01304 ppl_delete_Congruence(ppl_const_Congruence_t le) try {
01305 delete to_const(le);
01306 return 0;
01307 }
01308 CATCH_ALL
01309
01310 int
01311 ppl_assign_Congruence_from_Congruence(ppl_Congruence_t dst,
01312 ppl_const_Congruence_t src) try {
01313 const Congruence& ssrc = *to_const(src);
01314 Congruence& ddst = *to_nonconst(dst);
01315 ddst = ssrc;
01316 return 0;
01317 }
01318 CATCH_ALL
01319
01320 int
01321 ppl_Congruence_space_dimension(ppl_const_Congruence_t c,
01322 ppl_dimension_type* m) try {
01323 *m = to_const(c)->space_dimension();
01324 return 0;
01325 }
01326 CATCH_ALL
01327
01328 int
01329 ppl_Congruence_coefficient(ppl_const_Congruence_t c,
01330 ppl_dimension_type var,
01331 ppl_Coefficient_t n) try {
01332 const Congruence& cc = *to_const(c);
01333 Coefficient& nn = *to_nonconst(n);
01334 nn = cc.coefficient(Variable(var));
01335 return 0;
01336 }
01337 CATCH_ALL
01338
01339 int
01340 ppl_Congruence_inhomogeneous_term(ppl_const_Congruence_t c,
01341 ppl_Coefficient_t n) try {
01342 const Congruence& cc = *to_const(c);
01343 Coefficient& nn = *to_nonconst(n);
01344 nn = cc.inhomogeneous_term();
01345 return 0;
01346 }
01347 CATCH_ALL
01348
01349 int
01350 ppl_Congruence_modulus(ppl_const_Congruence_t c,
01351 ppl_Coefficient_t m) try {
01352 const Congruence& cc = *to_const(c);
01353 Coefficient& mm = *to_nonconst(m);
01354 mm = cc.modulus();
01355 return 0;
01356 }
01357 CATCH_ALL
01358
01359 int
01360 ppl_Congruence_OK(ppl_const_Congruence_t c) try {
01361 return to_const(c)->OK() ? 1 : 0;
01362 }
01363 CATCH_ALL
01364
01365 int
01366 ppl_new_Linear_Expression_from_Congruence(ppl_Linear_Expression_t* ple,
01367 ppl_const_Congruence_t c) try {
01368 const Congruence& cc = *to_const(c);
01369 *ple = to_nonconst(new Linear_Expression(cc));
01370 return 0;
01371 }
01372 CATCH_ALL
01373
01374
01375
01376 int
01377 ppl_new_Congruence_System(ppl_Congruence_System_t* pcs) try {
01378 *pcs = to_nonconst(new Congruence_System());
01379 return 0;
01380 }
01381 CATCH_ALL
01382
01383 int
01384 ppl_new_Congruence_System_zero_dim_empty(ppl_Congruence_System_t* pcs) try {
01385 *pcs = to_nonconst(new
01386 Congruence_System(Congruence_System::zero_dim_empty()));
01387 return 0;
01388 }
01389 CATCH_ALL
01390
01391
01392 int
01393 ppl_new_Congruence_System_from_Congruence(ppl_Congruence_System_t* pcs,
01394 ppl_const_Congruence_t c) try {
01395 const Congruence& cc = *to_const(c);
01396 *pcs = to_nonconst(new Congruence_System(cc));
01397 return 0;
01398 }
01399 CATCH_ALL
01400
01401 int
01402 ppl_new_Congruence_System_from_Congruence_System
01403 (ppl_Congruence_System_t* pcs, ppl_const_Congruence_System_t cs) try {
01404 const Congruence_System& ccs = *to_const(cs);
01405 *pcs = to_nonconst(new Congruence_System(ccs));
01406 return 0;
01407 }
01408 CATCH_ALL
01409
01410 int
01411 ppl_delete_Congruence_System(ppl_const_Congruence_System_t cs) try {
01412 delete to_const(cs);
01413 return 0;
01414 }
01415 CATCH_ALL
01416
01417 int
01418 ppl_assign_Congruence_System_from_Congruence_System
01419 (ppl_Congruence_System_t dst, ppl_const_Congruence_System_t src) try {
01420 const Congruence_System& ssrc = *to_const(src);
01421 Congruence_System& ddst = *to_nonconst(dst);
01422 ddst = ssrc;
01423 return 0;
01424 }
01425 CATCH_ALL
01426
01427 int
01428 ppl_Congruence_System_space_dimension(ppl_const_Congruence_System_t cs,
01429 ppl_dimension_type* m) try {
01430 *m = to_const(cs)->space_dimension();
01431 return 0;
01432 }
01433 CATCH_ALL
01434
01435 int
01436 ppl_Congruence_System_empty
01437 (ppl_const_Congruence_System_t cs) try {
01438 const Congruence_System& ccs = *to_const(cs);
01439 return ccs.empty() ? 1 : 0;
01440 }
01441 CATCH_ALL
01442
01443 int
01444 ppl_Congruence_System_clear(ppl_Congruence_System_t cs) try {
01445 to_nonconst(cs)->clear();
01446 return 0;
01447 }
01448 CATCH_ALL
01449
01450 int
01451 ppl_Congruence_System_insert_Congruence(ppl_Congruence_System_t cs,
01452 ppl_const_Congruence_t c) try {
01453 const Congruence& cc = *to_const(c);
01454 Congruence_System& ccs = *to_nonconst(cs);
01455 ccs.insert(cc);
01456 return 0;
01457 }
01458 CATCH_ALL
01459
01460 int
01461 ppl_Congruence_System_OK(ppl_const_Congruence_System_t cs) try {
01462 return to_const(cs)->OK() ? 1 : 0;
01463 }
01464 CATCH_ALL
01465
01466
01467
01468 int
01469 ppl_new_Congruence_System_const_iterator
01470 (ppl_Congruence_System_const_iterator_t* pcit) try {
01471 *pcit = to_nonconst(new Congruence_System::const_iterator());
01472 return 0;
01473 }
01474 CATCH_ALL
01475
01476 int
01477 ppl_new_Congruence_System_const_iterator_from_Congruence_System_const_iterator
01478 (ppl_Congruence_System_const_iterator_t* pcit,
01479 ppl_const_Congruence_System_const_iterator_t cit) try {
01480 *pcit = to_nonconst(new Congruence_System::const_iterator(*to_const(cit)));
01481 return 0;
01482 }
01483 CATCH_ALL
01484
01485 int
01486 ppl_delete_Congruence_System_const_iterator
01487 (ppl_const_Congruence_System_const_iterator_t cit)
01488 try {
01489 delete to_const(cit);
01490 return 0;
01491 }
01492 CATCH_ALL
01493
01494 int
01495 ppl_assign_Congruence_System_const_iterator_from_Congruence_System_const_iterator
01496 (ppl_Congruence_System_const_iterator_t dst,
01497 ppl_const_Congruence_System_const_iterator_t src) try {
01498 const Congruence_System::const_iterator& ssrc = *to_const(src);
01499 Congruence_System::const_iterator& ddst = *to_nonconst(dst);
01500 ddst = ssrc;
01501 return 0;
01502 }
01503 CATCH_ALL
01504
01505 int
01506 ppl_Congruence_System_begin(ppl_const_Congruence_System_t cs,
01507 ppl_Congruence_System_const_iterator_t cit) try {
01508 const Congruence_System& ccs = *to_const(cs);
01509 Congruence_System::const_iterator& ccit = *to_nonconst(cit);
01510 ccit = ccs.begin();
01511 return 0;
01512 }
01513 CATCH_ALL
01514
01515 int
01516 ppl_Congruence_System_end(ppl_const_Congruence_System_t cs,
01517 ppl_Congruence_System_const_iterator_t cit) try {
01518 const Congruence_System& ccs = *to_const(cs);
01519 Congruence_System::const_iterator& ccit = *to_nonconst(cit);
01520 ccit = ccs.end();
01521 return 0;
01522 }
01523 CATCH_ALL
01524
01525 int
01526 ppl_Congruence_System_const_iterator_dereference
01527 (ppl_const_Congruence_System_const_iterator_t cit,
01528 ppl_const_Congruence_t* pc) try {
01529 const Congruence_System::const_iterator& ccit = *to_const(cit);
01530 const Congruence& c = *ccit;
01531 *pc = to_const(&c);
01532 return 0;
01533 }
01534 CATCH_ALL
01535
01536 int
01537 ppl_Congruence_System_const_iterator_increment
01538 (ppl_Congruence_System_const_iterator_t cit) try {
01539 Congruence_System::const_iterator& ccit = *to_nonconst(cit);
01540 ++ccit;
01541 return 0;
01542 }
01543 CATCH_ALL
01544
01545 int
01546 ppl_Congruence_System_const_iterator_equal_test
01547 (ppl_const_Congruence_System_const_iterator_t x,
01548 ppl_const_Congruence_System_const_iterator_t y) try {
01549 const Congruence_System::const_iterator& xx = *to_const(x);
01550 const Congruence_System::const_iterator& yy = *to_const(y);
01551 return (xx == yy) ? 1 : 0;
01552 }
01553 CATCH_ALL
01554
01555
01556
01557 int
01558 ppl_new_Grid_Generator(ppl_Grid_Generator_t* pg,
01559 ppl_const_Linear_Expression_t le,
01560 enum ppl_enum_Grid_Generator_Type t,
01561 ppl_const_Coefficient_t d) try {
01562 Grid_Generator* ppg;
01563 const Linear_Expression& lle = *to_const(le);
01564 const Coefficient& dd = *to_const(d);
01565 switch (t) {
01566 case PPL_GRID_GENERATOR_TYPE_LINE:
01567 ppg = new Grid_Generator(Grid_Generator::grid_line(lle));
01568 break;
01569 case PPL_GRID_GENERATOR_TYPE_PARAMETER:
01570 ppg = new Grid_Generator(Grid_Generator::parameter(lle));
01571 break;
01572 case PPL_GRID_GENERATOR_TYPE_POINT:
01573 ppg = new Grid_Generator(Grid_Generator::grid_point(lle, dd));
01574 break;
01575 default:
01576 throw std::invalid_argument("ppl_new_Grid_Generator(pg, le, t, d): "
01577 "t invalid");
01578 }
01579 *pg = to_nonconst(ppg);
01580 return 0;
01581 }
01582 CATCH_ALL
01583
01584 int
01585 ppl_new_Grid_Generator_zero_dim_point(ppl_Grid_Generator_t* pg) try {
01586 *pg = to_nonconst(new Grid_Generator(Grid_Generator::zero_dim_point()));
01587 return 0;
01588 }
01589 CATCH_ALL
01590
01591 int
01592 ppl_new_Grid_Generator_from_Grid_Generator(ppl_Grid_Generator_t* pg,
01593 ppl_const_Grid_Generator_t g) try {
01594 const Grid_Generator& gg = *to_const(g);
01595 *pg = to_nonconst(new Grid_Generator(gg));
01596 return 0;
01597 }
01598 CATCH_ALL
01599
01600 int
01601 ppl_delete_Grid_Generator(ppl_const_Grid_Generator_t le) try {
01602 delete to_const(le);
01603 return 0;
01604 }
01605 CATCH_ALL
01606
01607 int
01608 ppl_assign_Grid_Generator_from_Grid_Generator
01609 (ppl_Grid_Generator_t dst,
01610 ppl_const_Grid_Generator_t src) try {
01611 const Grid_Generator& ssrc = *to_const(src);
01612 Grid_Generator& ddst = *to_nonconst(dst);
01613 ddst = ssrc;
01614 return 0;
01615 }
01616 CATCH_ALL
01617
01618 int
01619 ppl_Grid_Generator_space_dimension(ppl_const_Grid_Generator_t g,
01620 ppl_dimension_type* m) try {
01621 *m = to_const(g)->space_dimension();
01622 return 0;
01623 }
01624 CATCH_ALL
01625
01626 int
01627 ppl_Grid_Generator_type(ppl_const_Grid_Generator_t g) try {
01628 switch (to_const(g)->type()) {
01629 case Grid_Generator::LINE:
01630 return PPL_GRID_GENERATOR_TYPE_LINE;
01631 case Grid_Generator::PARAMETER:
01632 return PPL_GRID_GENERATOR_TYPE_PARAMETER;
01633 case Grid_Generator::POINT:
01634 return PPL_GRID_GENERATOR_TYPE_POINT;
01635 default:
01636 throw std::runtime_error("ppl_Grid_Generator_type()");
01637 }
01638 }
01639 CATCH_ALL
01640
01641 int
01642 ppl_Grid_Generator_coefficient(ppl_const_Grid_Generator_t g,
01643 ppl_dimension_type var,
01644 ppl_Coefficient_t n) try {
01645 const Grid_Generator& gg = *to_const(g);
01646 Coefficient& nn = *to_nonconst(n);
01647 nn = gg.coefficient(Variable(var));
01648 return 0;
01649 }
01650 CATCH_ALL
01651
01652 int
01653 ppl_Grid_Generator_divisor(ppl_const_Grid_Generator_t g,
01654 ppl_Coefficient_t n) try {
01655 const Grid_Generator& gg = *to_const(g);
01656 Coefficient& nn = *to_nonconst(n);
01657 nn = gg.divisor();
01658 return 0;
01659 }
01660 CATCH_ALL
01661
01662 int
01663 ppl_Grid_Generator_OK(ppl_const_Grid_Generator_t g) try {
01664 return to_const(g)->OK() ? 1 : 0;
01665 }
01666 CATCH_ALL
01667
01668
01669
01670
01671
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681 int
01682 ppl_new_Grid_Generator_System(ppl_Grid_Generator_System_t* pgs) try {
01683 *pgs = to_nonconst(new Grid_Generator_System());
01684 return 0;
01685 }
01686 CATCH_ALL
01687
01688 int
01689 ppl_new_Grid_Generator_System_zero_dim_univ
01690 (ppl_Grid_Generator_System_t* pgs) try {
01691 *pgs = to_nonconst
01692 (new Grid_Generator_System(Grid_Generator_System::zero_dim_univ()));
01693 return 0;
01694 }
01695 CATCH_ALL
01696
01697 int
01698 ppl_new_Grid_Generator_System_from_Grid_Generator
01699 (ppl_Grid_Generator_System_t* pgs, ppl_const_Grid_Generator_t g) try {
01700 const Grid_Generator& gg = *to_const(g);
01701 *pgs = to_nonconst(new Grid_Generator_System(gg));
01702 return 0;
01703 }
01704 CATCH_ALL
01705
01706 int
01707 ppl_new_Grid_Generator_System_from_Grid_Generator_System
01708 (ppl_Grid_Generator_System_t* pgs, ppl_const_Grid_Generator_System_t gs) try {
01709 const Grid_Generator_System& ggs = *to_const(gs);
01710 *pgs = to_nonconst(new Grid_Generator_System(ggs));
01711 return 0;
01712 }
01713 CATCH_ALL
01714
01715 int
01716 ppl_delete_Grid_Generator_System(ppl_const_Grid_Generator_System_t gs) try {
01717 delete to_const(gs);
01718 return 0;
01719 }
01720 CATCH_ALL
01721
01722 int
01723 ppl_assign_Grid_Generator_System_from_Grid_Generator_System
01724 (ppl_Grid_Generator_System_t dst, ppl_const_Grid_Generator_System_t src) try {
01725 const Grid_Generator_System& ssrc = *to_const(src);
01726 Grid_Generator_System& ddst = *to_nonconst(dst);
01727 ddst = ssrc;
01728 return 0;
01729 }
01730 CATCH_ALL
01731
01732 int
01733 ppl_Grid_Generator_System_space_dimension(ppl_const_Grid_Generator_System_t gs,
01734 ppl_dimension_type* m) try {
01735 *m = to_const(gs)->space_dimension();
01736 return 0;
01737 }
01738 CATCH_ALL
01739
01740 int
01741 ppl_Grid_Generator_System_empty
01742 (ppl_const_Grid_Generator_System_t gs) try {
01743 const Grid_Generator_System& cgs = *to_const(gs);
01744 return cgs.empty() ? 1 : 0;
01745 }
01746 CATCH_ALL
01747
01748 int
01749 ppl_Grid_Generator_System_clear(ppl_Grid_Generator_System_t gs) try {
01750 to_nonconst(gs)->clear();
01751 return 0;
01752 }
01753 CATCH_ALL
01754
01755 int
01756 ppl_Grid_Generator_System_insert_Grid_Generator
01757 (ppl_Grid_Generator_System_t gs,
01758 ppl_const_Grid_Generator_t g) try {
01759 const Grid_Generator& gg = *to_const(g);
01760 Grid_Generator_System& ggs = *to_nonconst(gs);
01761 ggs.insert(gg);
01762 return 0;
01763 }
01764 CATCH_ALL
01765
01766 int
01767 ppl_Grid_Generator_System_OK(ppl_const_Grid_Generator_System_t gs) try {
01768 return to_const(gs)->OK() ? 1 : 0;
01769 }
01770 CATCH_ALL
01771
01772
01773
01774 int
01775 ppl_new_Grid_Generator_System_const_iterator
01776 (ppl_Grid_Generator_System_const_iterator_t* pgit) try {
01777 *pgit = to_nonconst(new Grid_Generator_System::const_iterator());
01778 return 0;
01779 }
01780 CATCH_ALL
01781
01782 int
01783 ppl_new_Grid_Generator_System_const_iterator_from_Grid_Generator_System_const_iterator
01784 (ppl_Grid_Generator_System_const_iterator_t* pgit,
01785 ppl_const_Grid_Generator_System_const_iterator_t git) try {
01786 *pgit = to_nonconst
01787 (new Grid_Generator_System::const_iterator(*to_const(git)));
01788 return 0;
01789 }
01790 CATCH_ALL
01791
01792 int
01793 ppl_delete_Grid_Generator_System_const_iterator
01794 (ppl_const_Grid_Generator_System_const_iterator_t git) try {
01795 delete to_const(git);
01796 return 0;
01797 }
01798 CATCH_ALL
01799
01800 int
01801 ppl_assign_Grid_Generator_System_const_iterator_from_Grid_Generator_System_const_iterator
01802 (ppl_Grid_Generator_System_const_iterator_t dst,
01803 ppl_const_Grid_Generator_System_const_iterator_t src) try {
01804 const Grid_Generator_System::const_iterator& ssrc = *to_const(src);
01805 Grid_Generator_System::const_iterator& ddst = *to_nonconst(dst);
01806 ddst = ssrc;
01807 return 0;
01808 }
01809 CATCH_ALL
01810
01811 int
01812 ppl_Grid_Generator_System_begin
01813 (ppl_const_Grid_Generator_System_t gs,
01814 ppl_Grid_Generator_System_const_iterator_t git) try {
01815 const Grid_Generator_System& ggs = *to_const(gs);
01816 Grid_Generator_System::const_iterator& ggit = *to_nonconst(git);
01817 ggit = ggs.begin();
01818 return 0;
01819 }
01820 CATCH_ALL
01821
01822 int
01823 ppl_Grid_Generator_System_end
01824 (ppl_const_Grid_Generator_System_t gs,
01825 ppl_Grid_Generator_System_const_iterator_t git) try {
01826 const Grid_Generator_System& ggs = *to_const(gs);
01827 Grid_Generator_System::const_iterator& ggit = *to_nonconst(git);
01828 ggit = ggs.end();
01829 return 0;
01830 }
01831 CATCH_ALL
01832
01833 int
01834 ppl_Grid_Generator_System_const_iterator_dereference
01835 (ppl_const_Grid_Generator_System_const_iterator_t git,
01836 ppl_const_Grid_Generator_t* pg) try {
01837 const Grid_Generator_System::const_iterator& ggit = *to_const(git);
01838 const Grid_Generator& g = *ggit;
01839 *pg = to_const(&g);
01840 return 0;
01841 }
01842 CATCH_ALL
01843
01844 int
01845 ppl_Grid_Generator_System_const_iterator_increment
01846 (ppl_Grid_Generator_System_const_iterator_t git) try {
01847 Grid_Generator_System::const_iterator& ggit = *to_nonconst(git);
01848 ++ggit;
01849 return 0;
01850 }
01851 CATCH_ALL
01852
01853 int
01854 ppl_Grid_Generator_System_const_iterator_equal_test
01855 (ppl_const_Grid_Generator_System_const_iterator_t x,
01856 ppl_const_Grid_Generator_System_const_iterator_t y) try {
01857 const Grid_Generator_System::const_iterator& xx = *to_const(x);
01858 const Grid_Generator_System::const_iterator& yy = *to_const(y);
01859 return (xx == yy) ? 1 : 0;
01860 }
01861 CATCH_ALL
01862
01863 int
01864 ppl_new_MIP_Problem_from_space_dimension(ppl_MIP_Problem_t* pmip,
01865 ppl_dimension_type d) try {
01866 *pmip = to_nonconst(new MIP_Problem(d));
01867 return 0;
01868 }
01869 CATCH_ALL
01870
01871 int
01872 ppl_new_MIP_Problem(ppl_MIP_Problem_t* pmip,
01873 ppl_dimension_type d,
01874 ppl_const_Constraint_System_t cs,
01875 ppl_const_Linear_Expression_t le, int m) try {
01876 const Constraint_System& ccs = *to_const(cs);
01877 const Linear_Expression& lle = *to_const(le);
01878 Optimization_Mode mm = (m == PPL_OPTIMIZATION_MODE_MINIMIZATION)
01879 ? MINIMIZATION : MAXIMIZATION;
01880 *pmip = to_nonconst(new MIP_Problem(d, ccs, lle, mm));
01881 return 0;
01882 }
01883 CATCH_ALL
01884
01885 int
01886 ppl_new_MIP_Problem_from_MIP_Problem(ppl_MIP_Problem_t* pmip,
01887 ppl_const_MIP_Problem_t mip) try {
01888 const MIP_Problem& mmip = *to_const(mip);
01889 *pmip = to_nonconst(new MIP_Problem(mmip));
01890 return 0;
01891 }
01892 CATCH_ALL
01893
01894 int
01895 ppl_delete_MIP_Problem(ppl_const_MIP_Problem_t mip) try {
01896 delete to_const(mip);
01897 return 0;
01898 }
01899 CATCH_ALL
01900
01901 int
01902 ppl_assign_MIP_Problem_from_MIP_Problem(ppl_MIP_Problem_t dst,
01903 ppl_const_MIP_Problem_t src) try {
01904 const MIP_Problem& ssrc = *to_const(src);
01905 MIP_Problem& ddst = *to_nonconst(dst);
01906 ddst = ssrc;
01907 return 0;
01908 }
01909 CATCH_ALL
01910
01911 int
01912 ppl_MIP_Problem_space_dimension(ppl_const_MIP_Problem_t mip,
01913 ppl_dimension_type* m) try {
01914 *m = to_const(mip)->space_dimension();
01915 return 0;
01916 }
01917 CATCH_ALL
01918
01919 int
01920 ppl_MIP_Problem_number_of_integer_space_dimensions(ppl_const_MIP_Problem_t mip,
01921 ppl_dimension_type* m) try {
01922 const MIP_Problem& mmip = *to_const(mip);
01923 *m = mmip.integer_space_dimensions().size();
01924 return 0;
01925 }
01926 CATCH_ALL
01927
01928 int
01929 ppl_MIP_Problem_integer_space_dimensions(ppl_const_MIP_Problem_t mip,
01930 ppl_dimension_type ds[]) try {
01931 const Variables_Set& vars = to_const(mip)->integer_space_dimensions();
01932 ppl_dimension_type* ds_i = ds;
01933 for (Variables_Set::const_iterator v_iter = vars.begin(),
01934 v_end = vars.end(); v_iter != v_end; ++v_iter, ++ds_i)
01935 *ds_i = *v_iter;
01936 return 0;
01937 }
01938 CATCH_ALL
01939
01940 int
01941 ppl_MIP_Problem_number_of_constraints(ppl_const_MIP_Problem_t mip,
01942 ppl_dimension_type* m) try {
01943 const MIP_Problem& mmip = *to_const(mip);
01944 *m = mmip.constraints_end() - mmip.constraints_begin();
01945 return 0;
01946 }
01947 CATCH_ALL
01948
01949 int
01950 ppl_MIP_Problem_constraint_at_index(ppl_const_MIP_Problem_t mip,
01951 ppl_dimension_type i,
01952 ppl_const_Constraint_t* pc) try {
01953 #ifndef NDEBUG
01954 ppl_dimension_type num_constraints;
01955 ppl_MIP_Problem_number_of_constraints(mip, &num_constraints);
01956 assert(i < num_constraints);
01957 #endif
01958 const MIP_Problem& mmip = *to_const(mip);
01959 const Constraint& c = *(mmip.constraints_begin() + i);
01960 *pc = to_const(&c);
01961 return 0;
01962 }
01963 CATCH_ALL
01964
01965 int
01966 ppl_MIP_Problem_objective_function(ppl_const_MIP_Problem_t mip,
01967 ppl_const_Linear_Expression_t* ple) try {
01968 const Linear_Expression& le = to_const(mip)->objective_function();
01969 *ple = to_const(&le);
01970 return 0;
01971 }
01972 CATCH_ALL
01973
01974 int
01975 ppl_MIP_Problem_optimization_mode(ppl_const_MIP_Problem_t mip) try {
01976 return to_const(mip)->optimization_mode();
01977 }
01978 CATCH_ALL
01979
01980 int
01981 ppl_MIP_Problem_clear(ppl_MIP_Problem_t mip) try {
01982 to_nonconst(mip)->clear();
01983 return 0;
01984 }
01985 CATCH_ALL
01986
01987 int
01988 ppl_MIP_Problem_add_space_dimensions_and_embed(ppl_MIP_Problem_t mip,
01989 ppl_dimension_type d) try {
01990 MIP_Problem& mmip = *to_nonconst(mip);
01991 mmip.add_space_dimensions_and_embed(d);
01992 return 0;
01993 }
01994 CATCH_ALL
01995
01996 int
01997 ppl_MIP_Problem_add_to_integer_space_dimensions(ppl_MIP_Problem_t mip,
01998 ppl_dimension_type ds[],
01999 size_t n) try {
02000 MIP_Problem& mmip = *to_nonconst(mip);
02001 Variables_Set vars;
02002 for (ppl_dimension_type i = n; i-- > 0; )
02003 vars.insert(ds[i]);
02004 mmip.add_to_integer_space_dimensions(vars);
02005 return 0;
02006 }
02007 CATCH_ALL
02008
02009 int
02010 ppl_MIP_Problem_add_constraint(ppl_MIP_Problem_t mip,
02011 ppl_const_Constraint_t c) try {
02012 const Constraint& cc = *to_const(c);
02013 MIP_Problem& mmip = *to_nonconst(mip);
02014 mmip.add_constraint(cc);
02015 return 0;
02016 }
02017 CATCH_ALL
02018
02019 int
02020 ppl_MIP_Problem_add_constraints(ppl_MIP_Problem_t mip,
02021 ppl_const_Constraint_System_t cs) try {
02022 const Constraint_System& ccs = *to_const(cs);
02023 MIP_Problem& mmip = *to_nonconst(mip);
02024 mmip.add_constraints(ccs);
02025 return 0;
02026 }
02027 CATCH_ALL
02028
02029 int
02030 ppl_MIP_Problem_set_objective_function(ppl_MIP_Problem_t mip,
02031 ppl_const_Linear_Expression_t le) try {
02032 const Linear_Expression& lle = *to_const(le);
02033 MIP_Problem& mmip = *to_nonconst(mip);
02034 mmip.set_objective_function(lle);
02035 return 0;
02036 }
02037 CATCH_ALL
02038
02039 int
02040 ppl_MIP_Problem_set_optimization_mode(ppl_MIP_Problem_t mip, int mode) try {
02041 MIP_Problem& mmip = *to_nonconst(mip);
02042 Optimization_Mode m = (mode == PPL_OPTIMIZATION_MODE_MINIMIZATION)
02043 ? MINIMIZATION : MAXIMIZATION;
02044 mmip.set_optimization_mode(m);
02045 return 0;
02046 }
02047 CATCH_ALL
02048
02049 int
02050 ppl_MIP_Problem_is_satisfiable(ppl_const_MIP_Problem_t mip) try {
02051 return to_const(mip)->is_satisfiable() ? 1 : 0;
02052 }
02053 CATCH_ALL
02054
02055 int
02056 ppl_MIP_Problem_solve(ppl_const_MIP_Problem_t mip) try {
02057 return to_const(mip)->solve();
02058 }
02059 CATCH_ALL
02060
02061 int
02062 ppl_MIP_Problem_evaluate_objective_function(ppl_const_MIP_Problem_t mip,
02063 ppl_const_Generator_t g,
02064 ppl_Coefficient_t num,
02065 ppl_Coefficient_t den) try {
02066 const MIP_Problem& mmip = *to_const(mip);
02067 const Generator& gg = *to_const(g);
02068 Coefficient& nnum = *to_nonconst(num);
02069 Coefficient& dden = *to_nonconst(den);
02070 mmip.evaluate_objective_function(gg, nnum, dden);
02071 return 0;
02072 }
02073 CATCH_ALL
02074
02075 int
02076 ppl_MIP_Problem_feasible_point(ppl_const_MIP_Problem_t mip,
02077 ppl_const_Generator_t* pg) try {
02078 const Generator& g = to_const(mip)->feasible_point();
02079 *pg = to_const(&g);
02080 return 0;
02081 }
02082 CATCH_ALL
02083
02084 int
02085 ppl_MIP_Problem_optimizing_point(ppl_const_MIP_Problem_t mip,
02086 ppl_const_Generator_t* pg) try {
02087 const Generator& g = to_const(mip)->optimizing_point();
02088 *pg = to_const(&g);
02089 return 0;
02090 }
02091 CATCH_ALL
02092
02093 int
02094 ppl_MIP_Problem_optimal_value(ppl_const_MIP_Problem_t mip,
02095 ppl_Coefficient_t num,
02096 ppl_Coefficient_t den) try {
02097 Coefficient& nnum = *to_nonconst(num);
02098 Coefficient& dden = *to_nonconst(den);
02099 to_const(mip)->optimal_value(nnum, dden);
02100 return 0;
02101 }
02102 CATCH_ALL
02103
02104 int
02105 ppl_MIP_Problem_get_control_parameter(ppl_const_MIP_Problem_t mip,
02106 int name) try {
02107 MIP_Problem::Control_Parameter_Name n
02108 = static_cast<MIP_Problem::Control_Parameter_Name>(name);
02109 return to_const(mip)->get_control_parameter(n);
02110 }
02111 CATCH_ALL
02112
02113 int
02114 ppl_MIP_Problem_set_control_parameter(ppl_MIP_Problem_t mip,
02115 int value) try {
02116 MIP_Problem::Control_Parameter_Value v
02117 = static_cast<MIP_Problem::Control_Parameter_Value>(value);
02118 to_nonconst(mip)->set_control_parameter(v);
02119 return 0;
02120 }
02121 CATCH_ALL
02122
02123 int
02124 ppl_MIP_Problem_OK(ppl_const_MIP_Problem_t mip) try {
02125 return to_const(mip)->OK() ? 1 : 0;
02126 }
02127 CATCH_ALL
02128
02129 int
02130 ppl_MIP_Problem_total_memory_in_bytes(ppl_const_MIP_Problem_t mip,
02131 size_t* sz) try {
02132 *sz = to_const(mip)->total_memory_in_bytes();
02133 return 0;
02134 }
02135 CATCH_ALL
02136
02137 int
02138 ppl_MIP_Problem_external_memory_in_bytes(ppl_const_MIP_Problem_t mip,
02139 size_t* sz) try {
02140 *sz = to_const(mip)->external_memory_in_bytes();
02141 return 0;
02142 }
02143 CATCH_ALL
02144
02145 int
02146 ppl_new_PIP_Problem_from_space_dimension(ppl_PIP_Problem_t* ppip,
02147 ppl_dimension_type d) try {
02148 *ppip = to_nonconst(new PIP_Problem(d));
02149 return 0;
02150 }
02151 CATCH_ALL
02152
02153 int
02154 ppl_new_PIP_Problem_from_PIP_Problem(ppl_PIP_Problem_t* dpip,
02155 ppl_const_PIP_Problem_t pip) try {
02156 const PIP_Problem& spip = *to_const(pip);
02157 *dpip = to_nonconst(new PIP_Problem(spip));
02158 return 0;
02159 }
02160 CATCH_ALL
02161
02162 int
02163 ppl_new_PIP_Problem_from_constraints
02164 (ppl_PIP_Problem_t* ppip,
02165 ppl_dimension_type d,
02166 ppl_Constraint_System_const_iterator_t first,
02167 ppl_Constraint_System_const_iterator_t last,
02168 size_t n,
02169 ppl_dimension_type ds[]) try {
02170 Variables_Set p_vars;
02171 for (ppl_dimension_type i = n; i-- > 0; )
02172 p_vars.insert(ds[i]);
02173 *ppip = to_nonconst(new PIP_Problem(d, *to_const(first),
02174 *to_const(last), p_vars));
02175 return 0;
02176 }
02177 CATCH_ALL
02178
02179 int
02180 ppl_assign_PIP_Problem_from_PIP_Problem(ppl_PIP_Problem_t dst,
02181 ppl_const_PIP_Problem_t src) try {
02182 const PIP_Problem& ssrc = *to_const(src);
02183 PIP_Problem& ddst = *to_nonconst(dst);
02184 ddst = ssrc;
02185 return 0;
02186 }
02187 CATCH_ALL
02188
02189 int
02190 ppl_delete_PIP_Problem(ppl_const_PIP_Problem_t pip) try {
02191 delete to_const(pip);
02192 return 0;
02193 }
02194 CATCH_ALL
02195
02196 int
02197 ppl_PIP_Problem_space_dimension(ppl_const_PIP_Problem_t pip,
02198 ppl_dimension_type* m) try {
02199 *m = to_const(pip)->space_dimension();
02200 return 0;
02201 }
02202 CATCH_ALL
02203
02204 int
02205 ppl_PIP_Problem_number_of_parameter_space_dimensions
02206 (ppl_const_PIP_Problem_t pip, ppl_dimension_type* m) try {
02207 const PIP_Problem& ppip = *to_const(pip);
02208 *m = ppip.parameter_space_dimensions().size();
02209 return 0;
02210 }
02211 CATCH_ALL
02212
02213 int
02214 ppl_PIP_Problem_parameter_space_dimensions(ppl_const_PIP_Problem_t pip,
02215 ppl_dimension_type ds[]) try {
02216 const Variables_Set& vars = to_const(pip)->parameter_space_dimensions();
02217 ppl_dimension_type* ds_i = ds;
02218 for (Variables_Set::const_iterator v_iter = vars.begin(),
02219 v_end = vars.end(); v_iter != v_end; ++v_iter, ++ds_i)
02220 *ds_i = *v_iter;
02221 return 0;
02222 }
02223 CATCH_ALL
02224
02225 int
02226 ppl_PIP_Problem_number_of_constraints(ppl_const_PIP_Problem_t pip,
02227 ppl_dimension_type* m) try {
02228 const PIP_Problem& ppip = *to_const(pip);
02229 *m = ppip.constraints_end() - ppip.constraints_begin();
02230 return 0;
02231 }
02232 CATCH_ALL
02233
02234 int
02235 ppl_PIP_Problem_constraint_at_index(ppl_const_PIP_Problem_t pip,
02236 ppl_dimension_type i,
02237 ppl_const_Constraint_t* pc) try {
02238 #ifndef NDEBUG
02239 ppl_dimension_type num_constraints;
02240 ppl_PIP_Problem_number_of_constraints(pip, &num_constraints);
02241 assert(i < num_constraints);
02242 #endif
02243 const PIP_Problem& ppip = *to_const(pip);
02244 const Constraint& c = *(ppip.constraints_begin() + i);
02245 *pc = to_const(&c);
02246 return 0;
02247 }
02248 CATCH_ALL
02249 int
02250 ppl_PIP_Problem_clear(ppl_PIP_Problem_t pip) try {
02251 to_nonconst(pip)->clear();
02252 return 0;
02253 }
02254 CATCH_ALL
02255 int
02256 ppl_PIP_Problem_add_space_dimensions_and_embed(ppl_PIP_Problem_t pip,
02257 ppl_dimension_type pip_vars,
02258 ppl_dimension_type pip_params)
02259 try {
02260 PIP_Problem& spip = *to_nonconst(pip);
02261 spip.add_space_dimensions_and_embed(pip_vars,pip_params);
02262 return 0;
02263 }
02264 CATCH_ALL
02265 int
02266 ppl_PIP_Problem_add_to_parameter_space_dimensions(ppl_PIP_Problem_t pip,
02267 ppl_dimension_type ds[],
02268 size_t n) try {
02269 PIP_Problem& ppip = *to_nonconst(pip);
02270 Variables_Set vars;
02271 for (ppl_dimension_type i = n; i-- > 0; )
02272 vars.insert(ds[i]);
02273 ppip.add_to_parameter_space_dimensions(vars);
02274 return 0;
02275 }
02276 CATCH_ALL
02277 int
02278 ppl_PIP_Problem_add_constraint(ppl_PIP_Problem_t pip,
02279 ppl_const_Constraint_t c) try {
02280 const Constraint& cc = *to_const(c);
02281 PIP_Problem& ppip = *to_nonconst(pip);
02282 ppip.add_constraint(cc);
02283 return 0;
02284 }
02285 CATCH_ALL
02286
02287 int
02288 ppl_PIP_Problem_add_constraints(ppl_PIP_Problem_t pip,
02289 ppl_const_Constraint_System_t cs) try {
02290 const Constraint_System& ccs = *to_const(cs);
02291 PIP_Problem& ppip = *to_nonconst(pip);
02292 ppip.add_constraints(ccs);
02293 return 0;
02294 }
02295 CATCH_ALL
02296 int
02297 ppl_PIP_Problem_is_satisfiable(ppl_const_PIP_Problem_t pip) try {
02298 return to_const(pip)->is_satisfiable() ? 1 : 0;
02299 }
02300 CATCH_ALL
02301 int
02302 ppl_PIP_Problem_solve(ppl_const_PIP_Problem_t pip) try {
02303 return to_const(pip)->solve();
02304 }
02305 CATCH_ALL
02306
02307 int
02308 ppl_PIP_Problem_solution(ppl_const_PIP_Problem_t pip,
02309 ppl_const_PIP_Tree_Node_t* ppip_tree) try {
02310 *ppip_tree = to_const(to_const(pip)->solution());
02311 return 0;
02312 }
02313 CATCH_ALL
02314
02315 int
02316 ppl_PIP_Problem_optimizing_solution(ppl_const_PIP_Problem_t pip,
02317 ppl_const_PIP_Tree_Node_t* ppip_tree) try {
02318 *ppip_tree = to_const(to_const(pip)->optimizing_solution());
02319 return 0;
02320 }
02321 CATCH_ALL
02322
02323 int
02324 ppl_PIP_Problem_OK(ppl_const_PIP_Problem_t pip) try {
02325 return to_const(pip)->OK() ? 1 : 0;
02326 }
02327 CATCH_ALL
02328
02329 int
02330 ppl_PIP_Problem_get_control_parameter(ppl_const_PIP_Problem_t pip,
02331 int name) try {
02332 PIP_Problem::Control_Parameter_Name n
02333 = static_cast<PIP_Problem::Control_Parameter_Name>(name);
02334 return to_const(pip)->get_control_parameter(n);
02335 }
02336 CATCH_ALL
02337
02338 int
02339 ppl_PIP_Problem_set_control_parameter(ppl_PIP_Problem_t pip,
02340 int value) try {
02341 PIP_Problem::Control_Parameter_Value v
02342 = static_cast<PIP_Problem::Control_Parameter_Value>(value);
02343 to_nonconst(pip)->set_control_parameter(v);
02344 return 0;
02345 }
02346 CATCH_ALL
02347
02348 int
02349 ppl_PIP_Problem_get_big_parameter_dimension(ppl_const_PIP_Problem_t pip,
02350 ppl_dimension_type* pd) try {
02351 *pd = to_const(pip)->get_big_parameter_dimension();
02352 return 0;
02353 }
02354 CATCH_ALL
02355
02356 int
02357 ppl_PIP_Problem_set_big_parameter_dimension(ppl_PIP_Problem_t pip,
02358 ppl_dimension_type d) try {
02359 to_nonconst(pip)->set_big_parameter_dimension(d);
02360 return 0;
02361 }
02362 CATCH_ALL
02363
02364 int
02365 ppl_PIP_Problem_total_memory_in_bytes(ppl_const_PIP_Problem_t pip,
02366 size_t* sz) try {
02367 *sz = to_const(pip)->total_memory_in_bytes();
02368 return 0;
02369 }
02370 CATCH_ALL
02371
02372 int
02373 ppl_PIP_Problem_external_memory_in_bytes(ppl_const_PIP_Problem_t pip,
02374 size_t* sz) try {
02375 *sz = to_const(pip)->external_memory_in_bytes();
02376 return 0;
02377 }
02378 CATCH_ALL
02379
02380 int
02381 ppl_PIP_Tree_Node_as_solution(ppl_const_PIP_Tree_Node_t spip_tree,
02382 ppl_const_PIP_Solution_Node_t* dpip_tree) try {
02383 *dpip_tree = to_const(to_const(spip_tree)->as_solution());
02384 return 0;
02385 }
02386 CATCH_ALL
02387
02388 int
02389 ppl_PIP_Tree_Node_as_decision(ppl_const_PIP_Tree_Node_t spip_tree,
02390 ppl_const_PIP_Decision_Node_t* dpip_tree) try {
02391 *dpip_tree = to_const(to_const(spip_tree)->as_decision());
02392 return 0;
02393 }
02394 CATCH_ALL
02395
02396 int
02397 ppl_PIP_Tree_Node_get_constraints(ppl_const_PIP_Tree_Node_t pip_tree,
02398 ppl_const_Constraint_System_t* pcs) try {
02399 const PIP_Tree_Node& spip_tree = *to_const(pip_tree);
02400 const Constraint_System& cs = spip_tree.constraints();
02401 *pcs = to_const(&cs);
02402 return 0;
02403 }
02404 CATCH_ALL
02405
02406 int
02407 ppl_PIP_Tree_Node_OK(ppl_const_PIP_Tree_Node_t pip_tree) try {
02408 return to_const(pip_tree)->OK() ? 1 : 0;
02409 }
02410 CATCH_ALL
02411
02412 int
02413 ppl_PIP_Tree_Node_number_of_artificials(ppl_const_PIP_Tree_Node_t pip_tree,
02414 ppl_dimension_type* m) try {
02415 const PIP_Tree_Node& node = *to_const(pip_tree);
02416 *m = node.art_parameter_count();
02417 return 0;
02418 }
02419 CATCH_ALL
02420
02421 int
02422 ppl_PIP_Tree_Node_begin
02423 (ppl_const_PIP_Tree_Node_t pip_tree,
02424 ppl_Artificial_Parameter_Sequence_const_iterator_t pit) try {
02425 PIP_Tree_Node::Artificial_Parameter_Sequence::const_iterator& spit
02426 = *to_nonconst(pit);
02427 spit = to_const(pip_tree)->art_parameter_begin();
02428 return 0;
02429 }
02430 CATCH_ALL
02431
02432 int
02433 ppl_PIP_Tree_Node_end
02434 (ppl_const_PIP_Tree_Node_t pip_tree,
02435 ppl_Artificial_Parameter_Sequence_const_iterator_t pit) try {
02436 PIP_Tree_Node::Artificial_Parameter_Sequence::const_iterator& spit
02437 = *to_nonconst(pit);
02438 spit = to_const(pip_tree)->art_parameter_end();
02439 return 0;
02440 }
02441 CATCH_ALL
02442
02443 int
02444 ppl_PIP_Solution_Node_get_parametric_values
02445 (ppl_const_PIP_Solution_Node_t pip_sol,
02446 ppl_dimension_type var,
02447 ppl_const_Linear_Expression_t* le) try {
02448 const PIP_Solution_Node& spip_sol = *to_const(pip_sol);
02449 const Linear_Expression& lle = spip_sol.parametric_values(Variable(var));
02450 *le = to_const(&lle);
02451 return 0;
02452 }
02453 CATCH_ALL
02454
02455 int
02456 ppl_PIP_Solution_Node_OK(ppl_const_PIP_Solution_Node_t pip_sol) try {
02457 return to_const(pip_sol)->OK() ? 1 : 0;
02458 }
02459 CATCH_ALL
02460
02461 int
02462 ppl_PIP_Decision_Node_OK(ppl_const_PIP_Decision_Node_t pip_dec) try {
02463 return to_const(pip_dec)->OK() ? 1 : 0;
02464 }
02465 CATCH_ALL
02466
02467 int
02468 ppl_PIP_Decision_Node_get_child_node(ppl_const_PIP_Decision_Node_t pip_dec,
02469 int b,
02470 ppl_const_PIP_Tree_Node_t* pip_tree) try {
02471 *pip_tree = to_const(to_const(pip_dec)->child_node(b));
02472 return 0;
02473 }
02474 CATCH_ALL
02475
02476 int
02477 ppl_Artificial_Parameter_get_Linear_Expression
02478 (ppl_const_Artificial_Parameter_t ap,
02479 ppl_Linear_Expression_t le) try {
02480 const Artificial_Parameter& sap = *to_const(ap);
02481 Linear_Expression& lle = *to_nonconst(le);
02482 lle = sap;
02483 return 0;
02484 }
02485 CATCH_ALL
02486
02487 int
02488 ppl_Artificial_Parameter_coefficient(ppl_const_Artificial_Parameter_t ap,
02489 ppl_dimension_type var,
02490 ppl_Coefficient_t n) try {
02491 const Artificial_Parameter& sap = *to_const(ap);
02492 Coefficient& nn = *to_nonconst(n);
02493 nn = sap.coefficient(Variable(var));
02494 return 0;
02495 }
02496 CATCH_ALL
02497
02498 int
02499 ppl_Artificial_Parameter_inhomogeneous_term
02500 (ppl_const_Artificial_Parameter_t ap, ppl_Coefficient_t n) try {
02501 const Artificial_Parameter& sap = *to_const(ap);
02502 Coefficient& nn = *to_nonconst(n);
02503 nn = sap.inhomogeneous_term();
02504 return 0;
02505 }
02506 CATCH_ALL
02507
02508
02509 int
02510 ppl_Artificial_Parameter_denominator(ppl_const_Artificial_Parameter_t ap,
02511 ppl_Coefficient_t n) try {
02512 const Artificial_Parameter& sap = *to_const(ap);
02513 Coefficient& nn = *to_nonconst(n);
02514 nn = sap.denominator();
02515 return 0;
02516 }
02517 CATCH_ALL
02518
02519
02520
02521
02522 int
02523 ppl_new_Artificial_Parameter_Sequence_const_iterator
02524 (ppl_Artificial_Parameter_Sequence_const_iterator_t* papit) try {
02525 *papit = to_nonconst(new Artificial_Parameter_Sequence::const_iterator());
02526 return 0;
02527 }
02528 CATCH_ALL
02529
02530 int
02531 ppl_new_Artificial_Parameter_Sequence_const_iterator_from_Artificial_Parameter_Sequence_const_iterator
02532 (ppl_Artificial_Parameter_Sequence_const_iterator_t* papit,
02533 ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit) try {
02534 *papit = to_nonconst(new Artificial_Parameter_Sequence::const_iterator(*to_const(apit)));
02535 return 0;
02536 }
02537 CATCH_ALL
02538
02539 int
02540 ppl_delete_Artificial_Parameter_Sequence_const_iterator
02541 (ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit)
02542 try {
02543 delete to_const(apit);
02544 return 0;
02545 }
02546 CATCH_ALL
02547
02548 int
02549 ppl_assign_Artificial_Parameter_Sequence_const_iterator_from_Artificial_Parameter_Sequence_const_iterator
02550 (ppl_Artificial_Parameter_Sequence_const_iterator_t dst,
02551 ppl_const_Artificial_Parameter_Sequence_const_iterator_t src) try {
02552 const Artificial_Parameter_Sequence::const_iterator& ssrc = *to_const(src);
02553 Artificial_Parameter_Sequence::const_iterator& ddst = *to_nonconst(dst);
02554 ddst = ssrc;
02555 return 0;
02556 }
02557 CATCH_ALL
02558
02559 int
02560 ppl_Artificial_Parameter_Sequence_const_iterator_dereference
02561 (ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit,
02562 ppl_const_Artificial_Parameter_t* pap) try {
02563 const Artificial_Parameter_Sequence::const_iterator& papit = *to_const(apit);
02564 const Artificial_Parameter& ap = *papit;
02565 *pap = to_const(&ap);
02566 return 0;
02567 }
02568 CATCH_ALL
02569
02570 int
02571 ppl_Artificial_Parameter_Sequence_const_iterator_increment
02572 (ppl_Artificial_Parameter_Sequence_const_iterator_t apit) try {
02573 Artificial_Parameter_Sequence::const_iterator& papit = *to_nonconst(apit);
02574 ++papit;
02575 return 0;
02576 }
02577 CATCH_ALL
02578
02579 int
02580 ppl_Artificial_Parameter_Sequence_const_iterator_equal_test
02581 (ppl_const_Artificial_Parameter_Sequence_const_iterator_t x,
02582 ppl_const_Artificial_Parameter_Sequence_const_iterator_t y) try {
02583 const Artificial_Parameter_Sequence::const_iterator& xx = *to_const(x);
02584 const Artificial_Parameter_Sequence::const_iterator& yy = *to_const(y);
02585 return (xx == yy) ? 1 : 0;
02586 }
02587 CATCH_ALL
02588
02589 int
02590 ppl_io_print_variable(ppl_dimension_type var) try {
02591 const char* b = c_variable_output_function(var);
02592 if (b == 0 || puts(b) < 0)
02593 return PPL_STDIO_ERROR;
02594 return 0;
02595 }
02596 CATCH_ALL
02597
02598 int
02599 ppl_io_fprint_variable(FILE* stream, ppl_dimension_type var) try {
02600 const char* b = c_variable_output_function(var);
02601 if (b == 0 || fputs(b, stream) < 0)
02602 return PPL_STDIO_ERROR;
02603 return 0;
02604 }
02605 CATCH_ALL
02606
02607 int
02608 ppl_io_asprint_variable(char** strp, ppl_dimension_type var) try {
02609 const char* b = c_variable_output_function(var);
02610 if (b == 0)
02611 return PPL_STDIO_ERROR;
02612 *strp = strdup(b);
02613 if (*strp == 0)
02614 return PPL_ERROR_OUT_OF_MEMORY;
02615 return 0;
02616 }
02617 CATCH_ALL
02618
02619
02620 DEFINE_PRINT_FUNCTIONS(Coefficient)
02621
02622 DEFINE_OUTPUT_FUNCTIONS(Linear_Expression)
02623
02624 DEFINE_OUTPUT_FUNCTIONS(Constraint)
02625
02626 DEFINE_OUTPUT_FUNCTIONS(Constraint_System)
02627
02628 DEFINE_OUTPUT_FUNCTIONS(Generator)
02629
02630 DEFINE_OUTPUT_FUNCTIONS(Generator_System)
02631
02632 DEFINE_OUTPUT_FUNCTIONS(Congruence)
02633
02634 DEFINE_OUTPUT_FUNCTIONS(Congruence_System)
02635
02636 DEFINE_OUTPUT_FUNCTIONS(Grid_Generator)
02637
02638 DEFINE_OUTPUT_FUNCTIONS(Grid_Generator_System)
02639
02640 DEFINE_OUTPUT_FUNCTIONS(MIP_Problem)
02641
02642 DEFINE_OUTPUT_FUNCTIONS(PIP_Problem)
02643
02644 DEFINE_OUTPUT_FUNCTIONS(PIP_Tree_Node)
02645
02646 DEFINE_OUTPUT_FUNCTIONS(PIP_Decision_Node)
02647
02648 DEFINE_OUTPUT_FUNCTIONS(PIP_Solution_Node)
02649
02650 DEFINE_OUTPUT_FUNCTIONS(Artificial_Parameter)
02651
02652 char*
02653 ppl_io_wrap_string(const char* src,
02654 unsigned indent_depth,
02655 unsigned preferred_first_line_length,
02656 unsigned preferred_line_length) {
02657 using namespace IO_Operators;
02658 return strdup(wrap_string(src, indent_depth,
02659 preferred_first_line_length,
02660 preferred_line_length).c_str());
02661 }
02662
02663 int
02664 ppl_io_set_variable_output_function(ppl_io_variable_output_function_type* p)
02665 try {
02666 c_variable_output_function = p;
02667 return 0;
02668 }
02669 CATCH_ALL
02670
02671 int
02672 ppl_io_get_variable_output_function(ppl_io_variable_output_function_type** pp)
02673 try {
02674 *pp = c_variable_output_function;
02675 return 0;
02676 }
02677 CATCH_ALL