1 /* Definitions of print_ppl_*_to_buffer() functions. 2 Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> 3 Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com) 4 5 This file is part of the Parma Polyhedra Library (PPL). 6 7 The PPL is free software; you can redistribute it and/or modify it 8 under the terms of the GNU General Public License as published by the 9 Free Software Foundation; either version 3 of the License, or (at your 10 option) any later version. 11 12 The PPL is distributed in the hope that it will be useful, but WITHOUT 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software Foundation, 19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. 20 21 For the most up-to-date information see the Parma Polyhedra Library 22 site: http://bugseng.com/products/ppl/ . */ 23 24 #include "ppl_c.h" 25 #include "print_to_buffer.h" 26 #include <stdlib.h> 27 #include <string.h> 28 29 #define DEFINE_PRINT_TO_BUFFER(Type) \ 30 char* \ 31 print_ppl_##Type##_to_buffer(ppl_const_##Type##_t p, \ 32 unsigned indent_depth, \ 33 unsigned preferred_first_line_length, \ 34 unsigned preferred_line_length) { \ 35 char *buf, *ret; \ 36 int r = ppl_io_asprint_##Type(&buf, p); \ 37 if (r != 0) \ 38 return 0; \ 39 ret = ppl_io_wrap_string(buf, indent_depth, \ 40 preferred_first_line_length, \ 41 preferred_line_length); \ 42 free(buf); \ 43 return ret; \ 44 } 45 46 DEFINE_PRINT_TO_BUFFER(Coefficient) 47 48 DEFINE_PRINT_TO_BUFFER(Linear_Expression) 49 50 DEFINE_PRINT_TO_BUFFER(Constraint) 51 52 DEFINE_PRINT_TO_BUFFER(Constraint_System) 53 54 DEFINE_PRINT_TO_BUFFER(Generator) 55 56 DEFINE_PRINT_TO_BUFFER(Generator_System) 57 58 DEFINE_PRINT_TO_BUFFER(Congruence) 59 60 DEFINE_PRINT_TO_BUFFER(Congruence_System) 61 62 DEFINE_PRINT_TO_BUFFER(Grid_Generator) 63 64 DEFINE_PRINT_TO_BUFFER(Grid_Generator_System) 65 66 DEFINE_PRINT_TO_BUFFER(MIP_Problem) 67 68 DEFINE_PRINT_TO_BUFFER(PIP_Problem) 69