home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
plbin.zip
/
pl
/
PORTING
< prev
next >
Wrap
Text File
|
1993-02-08
|
3KB
|
90 lines
Installation Problems
Below are some notes meant for those who decide to modify or port
SWI-Prolog. It is by no means complete.
DEBUGGING SWI-Prolog ON A NEW MACHINE
=====================================
1. Machine Description file.
Create a md- file for the new architecture. You can use a similar one
as starting point and look at md-gener.h for a full description of the
options. For the first port, I advice to set the following flags to
0:
- O_FOREIGN
- O_SAVE
- O_STORE_PROGRAM
- O_PCE
- O_SHARED_MEMORY
- O_CAN_MAP
During debugging, make sure to give -g and -DO_DEBUG to the C
compiler, so you can debug the resulting prolog system using the -d
level option. -DO_DEBUG also includes some consistency checks. For
final installation use -O and drop -DO_DEBUG (which makes the system
about 20% slower).
Various options define the memory layout of your machine. The program
m-model.c may be used to determine the right settings. Compile this
file with any C-compiler and run it.
MEMORY ERRORS (BUS ERROR; SEGMENTATION FAULT)
=============================================
It is very likely that the system crashes during the boot compilation
called from make (./pl -O -o ... -b ... -c ...). Below is a
description of various such problems:
WORKING ON A SMALL PROGRAM
==========================
If you are very lucky the system will compile and perform the
bootstrap compilation in one go. Normally you are not. On how to get
it through the C compiler, you are on your own. If the system does
not want to do the bootstrap compilation, write a small prolog program
that can be handled by the bootstrap compiler and work on that.
Normally, I use
:- write('Hello World!').
:- nl.
You can compile this using `pl -d level -b file'. If this finally
writes `Hello World' on your terminal you are getting close. Next
test program can be:
test :-
write('Hello World'),
nl.
$init :-
test,
halt.
If you can compile this and you can run the result by typing `a.out'
or `pl -x a.out -d level' you can try to do the entire boot
compilation. If you decide to write more elaborate test programs you
should realise many things are not yet defined. Initially you can
only call the foreign language predicates, defined in pl-ext.c.
Constructs handles by the compiler (,/2, !, ->/2, ;/2, etc.) cannot
be called via metacall or directives (but can be used in program
text).
CODE USED ATOMS OR FUNCTORS
===========================
Atoms needed by the C sources are addressed using macros of the form
ATOM_<name>. Functors have the form FUNCTOR_<name><arity>. See the
file ATOMS. The awk script defatoms is invoked by make to create the
necessary C source and header files. These files are named *.i[ch].