<h1><aclass="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><aclass="back"title="Return to index"name="requirements"href="index.html#configuration_requirements">Hardware & software requirements</a></h2>
<h3><aclass="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><aclass="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>
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>
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><aclass="back"title="Return to index"name="files"href="index.html#configuration_files">Configuration files</a></h2>
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.
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.