/* Prolog main program for the toy PPL/XSB-Prolog CLP(Q) interpreter.
   Copyright (C) 2001-2004 Roberto Bagnara <bagnara@cs.unipr.it>

This file is part of the Parma Polyhedra Library (PPL).

The PPL is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.

The PPL is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.

For the most up-to-date information see the Parma Polyhedra Library
site: http://www.cs.unipr.it/ppl/ . */

:- compiler_options([xpp_on]).
:- import xpp_include_dir/1 from parse.
:- assert(xpp_include_dir('.')).

:- import append/3, length/2, member/2 from basics.
:- import
	ppl_initialize/0,
	ppl_finalize/0,
	ppl_new_Polyhedron_from_dimension/3,
	ppl_new_Polyhedron_from_Polyhedron/4,
	ppl_delete_Polyhedron/1,
	ppl_Polyhedron_space_dimension/2,
	ppl_Polyhedron_get_constraints/2,
	ppl_Polyhedron_add_constraints_and_minimize/2,
	ppl_Polyhedron_add_dimensions_and_embed/2,
	ppl_Polyhedron_remove_higher_dimensions/2
   from ppl_xsb.

:- [ppl_xsb].

#define user_input user
#include "clpq.pl"

eat_eol.

main :-
    common_main.


% XSB (up to version 2.6) does not offer read_term/2.
% We just provide the functionality we need.

:- import file_read/3 from xsb_read.

read_term(Term, [variable_names(VN)]) :-
  file_read(0, Term, L),
  convert_variable_names_list(L, VN).

convert_variable_names_list(L, VN) :-
  var(L),
  !,
  VN = [].
convert_variable_names_list([A|L], [Name=Var|VN]) :-
  A =.. [_, Name, Var],
  convert_variable_names_list(L, VN).

:- import file_flush/2 from file_io.

flush_output(user_output) :-
  file_flush(0, _).


:- ppl_initialize, main, ppl_finalize.


syntax highlighted by Code2HTML, v. 0.9.1