This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/manuals/userman/configuration.html
pmoura 18498c43d2 Logtalk 2.14.2 release files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@576 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2002-08-26 16:45:50 +00:00

82 lines
6.2 KiB
HTML

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/css" href="../styles.css" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Logtalk configuration</title>
<link rel="stylesheet" href="../styles.css" type="text/css" />
</head>
<body>
<hr />
<h1><a class="back" title="Return to index" href="index.html#configuration">Logtalk configuration</a></h1>
<p>
The Logtalk system is entirely written in Prolog, without resorting to other programming languages. In spite of that, the fact that the ISO standard <a
href="../bibliography.html#ISO95">[ISO 95]</a> has only recently been approved causes a lot of problems when we try to ensure compatibility with most of the existing Prolog compilers <a
href="../bibliography.html#Moura99">[Moura 99]</a>. If most syntax problems can be easily solved, the same does not happen when we talk about built-in predicates, where we face several difficulties. In the first place, many compilers do not implement the total of the predicates defined in ISO standard, which can be considered quite minimalist in this respect. Sometimes they implement those predicates in a way that does not match the standard or other compilers, thus concurring to the existence of subtle errors quite difficult to detect. To make things worse, it is not possible to replace some of the absent predicates and directives with our own definitions, due to the very nature of those predicates and directives. Consequently, some of the Logtalk system features (e.g., error handling) may not work in some compilers.
</p>
<p>
The adopted solution consists on developing a universal Logtalk version, linked to a given compiler through the definition of a small set of predicates and operators, assembled in a configuration file. These predicates can be divided in two groups. The first group contains Logtalk specific predicates. The second group tries to implement predicates that, although they are defined in the approved ISO Prolog Standard, are not available in the specific compiler we want to use. This manual session explains how to build a configuration file for a Prolog compiler.
</p>
<hr />
<h2><a class="back" title="Return to index" name="requirements" href="index.html#configuration_requirements">Hardware &amp; software requirements</a></h2>
<h3><a class="back" title="Return to index" name="computer" href="index.html#configuration_computer">Computer and operating system</a></h3>
<p>
Logtalk is compatible with almost any machine/operating system with a modern Prolog compiler available. Currently, my main development environment is an upgraded Apple PowerMacintosh 7600 running Mac OS 9 and LinuxPPC; most used compilers are the Mac port of GNU Prolog and, under Linux, YAP and SWI Prolog. Being written in Prolog and distributed in source form, the only issue regarding operating system compatibility are the end-of-line codes in the source text files! Most example source file names do not fit in the 8+3 MS-DOS file length limitation, so this may prevent those examples from running under this operating system (or in any other system with similar limitations).
</p>
<h3><a class="back" title="Return to index" name="compiler" href="index.html#configuration_compiler">Prolog compiler</a></h3>
<p>
In writing Logtalk I have tried to follow the recently approved Prolog ISO standard whenever possible. Capabilities needed by Logtalk that are not defined in the ISO standard are:
</p>
<ul>
<li>access to predicate properties (<code>dynamic</code>, <code>static</code>, <code>built_in</code>)</li>
</ul>
<p>
Logtalk needs access to the predicate property<code>built_in</code> to properly compile objects and categories that contain Prolog built-in predicates calls. In addition, some Logtalk built-ins need to know the dynamic/static status of predicates to ensure correct application. The ISO standard for Prolog modules defines a <code>predicate_property/2</code> predicate that is already implemented by most Prolog compilers. Note that if these capabilities are not built-in the user cannot easily define them.</p>
<p>
For optimal performance, Logtalk requires that the Prolog compiler supports <strong>first-argument indexing</strong> for both static and dynamic code (most modern compilers support this feature).
</p>
<p>
Because most Prolog implementers are slowly moving toward more ISO compliant compilers, it is advisable that you try to use the most recent version of your favorite Prolog compiler.
</p>
<hr />
<h2><a class="back" title="Return to index" name="files" href="index.html#configuration_files">Configuration files</a></h2>
<p>
Configuration files provide the glue code between the Logtalk preprocessor/runtime and a Prolog compiler. Each configuration file contains two sets of predicates: ISO Prolog standard predicates and directives not built-in in the target Prolog compiler and Logtalk-specific predicates.
</p>
<p>
Logtalk already includes ready to use configuration files for most Prolog compilers. However, you may need to write your own configuration file if one is not available for your Prolog compiler. In most cases, you can borrow code from some of the predefined configuration files. If you send me your configuration file, with a reference to the target Prolog compiler, maybe I can include it in the next release of Logtalk.
</p>
<p>
Start by making a copy of the file <code>configs/template.config</code>. Carefully check (or complete if needed) each listed definition. If your Prolog compiler conforms to the ISO standard, this task should only take you a few minutes.
</p>
<p>
If you are unsure that your Prolog compiler provides all the ISO predicates needed by Logtalk, try to run the system by setting the unknown predicate error handler to report as an error any call to a missing predicate. Better yet, switch to a modern, ISO compliant, Prolog compiler.
</p>
<hr />
<p class="center">
<strong><a href="documenting.html">Previous</a> | <a href="installing.html">Next</a> | <a href="index.html">Table of Contents</a> | <a href="../bibliography.html">Bibliography</a> | <a href="../glossary.html">Glossary</a></strong>
</p>
<p class="center">
Last updated on: August 6, 2002
</p>
<hr />
</body>
</html>