1/* System-Dependent Documentation for Prolog.
2   Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3   Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4
5This file is part of the Parma Polyhedra Library (PPL).
6
7The PPL is free software; you can redistribute it and/or modify it
8under the terms of the GNU General Public License as published by the
9Free Software Foundation; either version 3 of the License, or (at your
10option) any later version.
11
12The PPL is distributed in the hope that it will be useful, but WITHOUT
13ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software Foundation,
19Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20
21For the most up-to-date information see the Parma Polyhedra Library
22site: http://bugseng.com/products/ppl/ . */
23
24/*! \page PI_SD_Features Prolog Interface System-Dependent Features
25
26\anchor CIAO_Prolog
27<H2>CIAO Prolog</H2>
28
29The Ciao Prolog interface to the PPL is available
30both as ``PPL enhanced'' Ciao Prolog interpreter
31and as a library that can be linked to Ciao Prolog programs.
32Only Ciao Prolog versions 1.10 `#5 and later are supported.'
33
34So that it can be used with the Ciao Prolog PPL interface, the
35Ciao Prolog installation must be configured with the
36<CODE>--disable-regs</CODE> option.
37
38<H3>The <CODE>ppl_ciao</CODE> Executable</H3>
39
40If an appropriate version of Ciao Prolog is installed on the machine
41on which you compiled the library, the command <CODE>make install</CODE>
42will install the executable <CODE>ppl_ciao</CODE> in the directory
43<CODE>prefix/bin</CODE>.
44The <CODE>ppl_ciao</CODE> executable is simply the Ciao Prolog
45interpreter with the Parma Polyhedra Library linked in.
46The only thing you should do to use the library is to
47call <CODE>ppl_initialize/0</CODE> before any other PPL predicate
48and to call <CODE>ppl_finalize/0</CODE> when you are done with the
49library.
50
51<H3>Linking the Library To Ciao Prolog Programs</H3>
52
53In order to allow linking Ciao Prolog programs to the PPL,
54the following files are installed in the directory
55<CODE>prefix/lib/ppl</CODE>:
56<CODE>ppl_ciao.pl</CODE> contains the required foreign declarations;
57<CODE>libppl_ciao.*</CODE> contain the executable code for the
58Ciao Prolog interface in various formats (static library, shared library,
59libtool library).
60If your Ciao Prolog program is constituted by, say, <CODE>source1.pl</CODE>
61and <CODE>source2.pl</CODE> and you want to create the executable
62<CODE>myprog</CODE>, your compilation command may look like
63\code
64ciaoc -o myprog prefix/lib/ppl/ppl_ciao.pl ciao_pl_check.pl \
65  -L '-Lprefix/lib/ppl -lppl_ciao -Lprefix/lib -lppl -lgmpxx -lgmp -lstdc++'
66\endcode
67
68\anchor GNU_Prolog
69<H2>GNU Prolog</H2>
70
71The GNU Prolog interface to the PPL is available both as a
72``PPL enhanced'' GNU Prolog interpreter and as a library that can be
73linked to GNU Prolog programs.
74The only GNU Prolog version that is known to work is a patched
75version of the ``unstable version'' tagged
76<A HREF="ftp://ftp.inria.fr/INRIA/Projects/contraintes/gprolog/unstable/gprolog-20040608.tgz">20040608</A>
77(which unpacks to a directory called <CODE>gprolog-1.2.18</CODE>).
78The patch is contained in the
79<CODE>interfaces/Prolog/GNU/README</CODE> file of the PPL's distribution.
80
81So that it can be used with the GNU Prolog PPL interface
82(and, for that matter, with any foreign code),
83the GNU Prolog installation must be configured with the
84<CODE>--disable-regs</CODE> option.
85
86<H3>The <CODE>ppl_gprolog</CODE> Executable</H3>
87
88If an appropriate version of GNU Prolog is installed on the machine
89on which you compiled the library, the command <CODE>make install</CODE>
90will install the executable <CODE>ppl_gprolog</CODE> in the directory
91<CODE>prefix/bin</CODE>.
92The <CODE>ppl_gprolog</CODE> executable is simply the GNU Prolog
93interpreter with the Parma Polyhedra Library linked in.
94The only thing you should do to use the library is to
95call <CODE>ppl_initialize/0</CODE> before any other PPL predicate
96and to call <CODE>ppl_finalize/0</CODE> when you are done with the
97library.
98
99<H3>Linking the Library To GNU Prolog Programs</H3>
100
101In order to allow linking GNU Prolog programs to the PPL,
102the following files are installed in the directory
103<CODE>prefix/lib/ppl</CODE>:
104<CODE>ppl_gprolog.pl</CODE> contains the required foreign declarations;
105<CODE>libppl_gprolog.*</CODE> contain the executable code for the
106GNU Prolog interface in various formats (static library, shared library,
107libtool library).
108If your GNU Prolog program is constituted by, say, <CODE>source1.pl</CODE>
109and <CODE>source2.pl</CODE> and you want to create the executable
110<CODE>myprog</CODE>, your compilation command may look like
111\code
112gplc -o myprog prefix/lib/ppl/ppl_gprolog.pl source1.pl source2.pl \
113  -L '-Lprefix/lib/ppl -lppl_gprolog -Lprefix/lib -lppl -lgmpxx -lgmp -lstdc++'
114\endcode
115
116GNU Prolog uses several stacks to execute a Prolog program each with a
117pre-defined default size.  If the size of a stack is too small for the
118application an overflow will occur.  To change the default size of a
119stack, the user has to set the value of the relevant environment
120variable; in particular, to execute some of the tests, we found it
121necessary to increase the size of GLOBALSZ.
122Thus, for the above example, the compilation command would be
123\code
124GLOBALSZ=32768 gplc -o myprog prefix/lib/ppl/ppl_gprolog.pl source1.pl source2.pl \
125  -L '-Lprefix/lib/ppl -lppl_gprolog -Lprefix/lib -lppl -lgmpxx -lgmp -lstdc++'
126\endcode
127More information on
128adjusting the size of the stacks can be found in Section 3.3 in the
129<A HREF="http://www.gprolog.org/manual/gprolog.html">GNU Prolog
130Manual</A>
131
132\anchor SICStus_Prolog
133<H2>SICStus Prolog</H2>
134
135The SICStus Prolog interface to the PPL is available
136both as a statically linked module or as a dynamically linked one.
137Only SICStus Prolog versions 3.9.0 and later are supported.
138
139<H3>The Statically Linked <CODE>ppl_sicstus</CODE> Executable</H3>
140
141If an appropriate version of SICStus Prolog is installed on the machine
142on which you compiled the library, the command <CODE>make install</CODE>
143will install the executable <CODE>ppl_sicstus</CODE> in the directory
144<CODE>prefix/bin</CODE>.
145The <CODE>ppl_sicstus</CODE> executable is simply the SICStus Prolog
146system with the Parma Polyhedra Library statically linked.
147The only thing you should do to use the library is to
148load <CODE>prefix/lib/ppl/ppl_sicstus.pl</CODE>.
149
150<H3>Loading the SICStus Interface Dynamically</H3>
151
152In order to dynamically load the library from SICStus Prolog you should
153simply load <CODE>prefix/lib/ppl/ppl_sicstus.pl</CODE>.
154Notice that, for dynamic linking to work, you should have configured
155the library with the <CODE>--enable-shared</CODE> option.
156
157
158\anchor SWI_Prolog
159<H2>SWI-Prolog</H2>
160
161The SWI-Prolog interface to the PPL is available
162both as a statically linked module or as a dynamically linked one.
163Only SWI-Prolog version 5.6.0 and later versions are supported.
164
165<H3>The <CODE>ppl_pl</CODE> Executable</H3>
166
167If an appropriate version of SWI-Prolog is installed on the machine
168on which you compiled the library, the command <CODE>make install</CODE>
169will install the executable <CODE>ppl_pl</CODE> in the directory
170<CODE>prefix/bin</CODE>.
171The <CODE>ppl_pl</CODE> executable is simply the SWI-Prolog
172shell with the Parma Polyhedra Library statically linked:
173from within <CODE>ppl_pl</CODE> all the services of the library
174are available without further action.
175
176<H3>Loading the SWI-Prolog Interface Dynamically</H3>
177
178In order to dynamically load the library from SWI-Prolog you should
179simply load <CODE>prefix/lib/ppl/ppl_swiprolog.pl</CODE>.
180This will invoke <CODE>ppl_initialize/0</CODE> and
181<CODE>ppl_finalize/0</CODE> automatically.
182Alternatively, you can load the library directly with
183\code
184:- load_foreign_library('prefix/lib/ppl/libppl_swiprolog').
185\endcode
186This will call <CODE>ppl_initialize/0</CODE> automatically.
187Analogously,
188\code
189:- unload_foreign_library('prefix/lib/ppl/libppl_swiprolog').
190\endcode
191will, as part of the unload process, invoke <CODE>ppl_finalize/0</CODE>.
192
193Notice that, for dynamic linking to work, you should have configured
194the library with the <CODE>--enable-shared</CODE> option.
195
196
197\anchor XSB_Prolog
198<H2>XSB</H2>
199
200The XSB Prolog interface to the PPL is available
201as a dynamically linked module.
202Only some CVS versions of XSB starting from 2 July 2005 are known to work.
203CVS versions starting from 11 November 2005 are known not to work.
204
205In order to dynamically load the library from XSB you should
206load the <CODE>ppl_xsb</CODE> module and import the predicates
207you need.
208For things to work, you may have to copy the files
209<CODE>prefix/lib/ppl/ppl_xsb.xwam</CODE>
210and
211<CODE>prefix/lib/ppl/ppl_xsb.so</CODE>
212in your current directory or in one of the XSB library directories.
213
214
215\anchor YAP_Prolog
216<H2>YAP</H2>
217
218The YAP Prolog interface to the PPL is available
219as a dynamically linked module.
220Only YAP versions following 5.1.0 and CVS HEAD versions starting from
2214 January 2006 are supported.  Notice that support for unbounded
222integers in YAP is young and may have errors that could affect
223programs using the PPL (see, e.g.,
224<A HREF="http://www.cs.unipr.it/pipermail/ppl-devel/2006-January/007780.html">http://www.cs.unipr.it/pipermail/ppl-devel/2006-January/007780.html</A>).
225
226In order to dynamically load the library from YAP you should
227simply load <CODE>prefix/lib/ppl/ppl_yap.pl</CODE>.
228This will invoke <CODE>ppl_initialize/0</CODE> automatically;
229it is the programmer's responsibility to call <CODE>ppl_finalize/0</CODE>
230when the PPL library is no longer needed.
231Notice that, for dynamic linking to work, you should have configured
232the library with the <CODE>--enable-shared</CODE> option.
233
234*/ /* \page PI_SD_Features */
235
236