PPL Prolog Language Interface  1.2
Prolog Interface System-Dependent Features

CIAO Prolog

The Ciao Prolog interface to the PPL is available both as ``PPL enhanced'' Ciao Prolog interpreter and as a library that can be linked to Ciao Prolog programs. Only Ciao Prolog versions 1.10 `#5 and later are supported.'

So that it can be used with the Ciao Prolog PPL interface, the Ciao Prolog installation must be configured with the –disable-regs option.

The ppl_ciao Executable

If an appropriate version of Ciao Prolog is installed on the machine on which you compiled the library, the command make install will install the executable ppl_ciao in the directory prefix/bin. The ppl_ciao executable is simply the Ciao Prolog interpreter with the Parma Polyhedra Library linked in. The only thing you should do to use the library is to call ppl_initialize/0 before any other PPL predicate and to call ppl_finalize/0 when you are done with the library.

Linking the Library To Ciao Prolog Programs

In order to allow linking Ciao Prolog programs to the PPL, the following files are installed in the directory prefix/lib/ppl: ppl_ciao.pl contains the required foreign declarations; libppl_ciao.* contain the executable code for the Ciao Prolog interface in various formats (static library, shared library, libtool library). If your Ciao Prolog program is constituted by, say, source1.pl and source2.pl and you want to create the executable myprog, your compilation command may look like

ciaoc -o myprog prefix/lib/ppl/ppl_ciao.pl ciao_pl_check.pl \
-L '-Lprefix/lib/ppl -lppl_ciao -Lprefix/lib -lppl -lgmpxx -lgmp -lstdc++'

GNU Prolog

The GNU Prolog interface to the PPL is available both as a ``PPL enhanced'' GNU Prolog interpreter and as a library that can be linked to GNU Prolog programs. The only GNU Prolog version that is known to work is a patched version of the ``unstable version'' tagged 20040608 (which unpacks to a directory called gprolog-1.2.18). The patch is contained in the interfaces/Prolog/GNU/README file of the PPL's distribution.

So that it can be used with the GNU Prolog PPL interface (and, for that matter, with any foreign code), the GNU Prolog installation must be configured with the –disable-regs option.

The ppl_gprolog Executable

If an appropriate version of GNU Prolog is installed on the machine on which you compiled the library, the command make install will install the executable ppl_gprolog in the directory prefix/bin. The ppl_gprolog executable is simply the GNU Prolog interpreter with the Parma Polyhedra Library linked in. The only thing you should do to use the library is to call ppl_initialize/0 before any other PPL predicate and to call ppl_finalize/0 when you are done with the library.

Linking the Library To GNU Prolog Programs

In order to allow linking GNU Prolog programs to the PPL, the following files are installed in the directory prefix/lib/ppl: ppl_gprolog.pl contains the required foreign declarations; libppl_gprolog.* contain the executable code for the GNU Prolog interface in various formats (static library, shared library, libtool library). If your GNU Prolog program is constituted by, say, source1.pl and source2.pl and you want to create the executable myprog, your compilation command may look like

gplc -o myprog prefix/lib/ppl/ppl_gprolog.pl source1.pl source2.pl \
-L '-Lprefix/lib/ppl -lppl_gprolog -Lprefix/lib -lppl -lgmpxx -lgmp -lstdc++'

GNU Prolog uses several stacks to execute a Prolog program each with a pre-defined default size. If the size of a stack is too small for the application an overflow will occur. To change the default size of a stack, the user has to set the value of the relevant environment variable; in particular, to execute some of the tests, we found it necessary to increase the size of GLOBALSZ. Thus, for the above example, the compilation command would be

GLOBALSZ=32768 gplc -o myprog prefix/lib/ppl/ppl_gprolog.pl source1.pl source2.pl \
-L '-Lprefix/lib/ppl -lppl_gprolog -Lprefix/lib -lppl -lgmpxx -lgmp -lstdc++'

More information on adjusting the size of the stacks can be found in Section 3.3 in the GNU Prolog Manual

SICStus Prolog

The SICStus Prolog interface to the PPL is available both as a statically linked module or as a dynamically linked one. Only SICStus Prolog versions 3.9.0 and later are supported.

The Statically Linked ppl_sicstus Executable

If an appropriate version of SICStus Prolog is installed on the machine on which you compiled the library, the command make install will install the executable ppl_sicstus in the directory prefix/bin. The ppl_sicstus executable is simply the SICStus Prolog system with the Parma Polyhedra Library statically linked. The only thing you should do to use the library is to load prefix/lib/ppl/ppl_sicstus.pl.

Loading the SICStus Interface Dynamically

In order to dynamically load the library from SICStus Prolog you should simply load prefix/lib/ppl/ppl_sicstus.pl. Notice that, for dynamic linking to work, you should have configured the library with the –enable-shared option.

SWI-Prolog

The SWI-Prolog interface to the PPL is available both as a statically linked module or as a dynamically linked one. Only SWI-Prolog version 5.6.0 and later versions are supported.

The ppl_pl Executable

If an appropriate version of SWI-Prolog is installed on the machine on which you compiled the library, the command make install will install the executable ppl_pl in the directory prefix/bin. The ppl_pl executable is simply the SWI-Prolog shell with the Parma Polyhedra Library statically linked: from within ppl_pl all the services of the library are available without further action.

Loading the SWI-Prolog Interface Dynamically

In order to dynamically load the library from SWI-Prolog you should simply load prefix/lib/ppl/ppl_swiprolog.pl. This will invoke ppl_initialize/0 and ppl_finalize/0 automatically. Alternatively, you can load the library directly with

:- load_foreign_library('prefix/lib/ppl/libppl_swiprolog').

This will call ppl_initialize/0 automatically. Analogously,

:- unload_foreign_library('prefix/lib/ppl/libppl_swiprolog').

will, as part of the unload process, invoke ppl_finalize/0.

Notice that, for dynamic linking to work, you should have configured the library with the –enable-shared option.

XSB

The XSB Prolog interface to the PPL is available as a dynamically linked module. Only some CVS versions of XSB starting from 2 July 2005 are known to work. CVS versions starting from 11 November 2005 are known not to work.

In order to dynamically load the library from XSB you should load the ppl_xsb module and import the predicates you need. For things to work, you may have to copy the files prefix/lib/ppl/ppl_xsb.xwam and prefix/lib/ppl/ppl_xsb.so in your current directory or in one of the XSB library directories.

YAP

The YAP Prolog interface to the PPL is available as a dynamically linked module. Only YAP versions following 5.1.0 and CVS HEAD versions starting from 4 January 2006 are supported. Notice that support for unbounded integers in YAP is young and may have errors that could affect programs using the PPL (see, e.g., http://www.cs.unipr.it/pipermail/ppl-devel/2006-January/007780.html).

In order to dynamically load the library from YAP you should simply load prefix/lib/ppl/ppl_yap.pl. This will invoke ppl_initialize/0 automatically; it is the programmer's responsibility to call ppl_finalize/0 when the PPL library is no longer needed. Notice that, for dynamic linking to work, you should have configured the library with the –enable-shared option.