Go to the first, previous, next, last section, table of contents.


Release notes and installation guide for Windows

This chapter assumes that the environment variable PATH includes %SP_PATH%\bin, where SP_PATH points to the SICStus installation directory.

Installation

The development system comes in two flavors:

  1. A character based executable which is suitable to run from a DOS-prompt, from batch files, or under Emacs. It provides command line editing; see section Command line editing.
  2. A windowed executable which uses a public domain console (see below).

The distribution is divided in the following files. The .exe-files are self-extracting archives/setup programs.

Installed files on a shared drive can be reused for installation on other machines.

SICStus Prolog requires a license code to run. You should have received from SICS your site name, the expiration date and the code. This information is normally entered during installation:

Expiration date: ExpirationDate
Site: Site
License Code: Code

but it can also be entered later on by executing the following commands at a command prompt:

% splm -i Site
% splm -a sicstus3.7 ExpirationDate Code

Foreign language interface

Linked foreign resources come in two flavors, static and dynamic.

Static linked foreign resources are static libraries on Win32 (.lib files). These are not portable between different C-compiler environments. Static linked foreign resources are used for building statically linked runtime and development systems.

Dynamic linked foreign resources are DLLs on Win32. They are C-compiler independent but must use the cdecl calling convention, i.e. arguments are pushed on the stack; symbols are prepended with a `_'.

Linked foreign resources may be created using the command splfr as described in the manual. This command invokes the C-compiler, linker and library manager through the scripts `spcc.bat' and `spld.bat'. These scripts are configured by default for MS Visual C++ 5.0. The distribution includes alternative scripts:

If you are using e.g. Watcom, do:

% cd %SP_PATH%\bin
% copy spcc.msc spcc.bat
% copy spld.msc spld.bat

Runtime systems and customized development systems may be created using the commands spmkrs and spmkds respectively. These commands also use the scripts `spcc.bat' and `spld.bat'. Runtime systems require `%SP_PATH%\..\sprt37.dll' (at runtime) and an import library for `sprt37.dll' at build time.

Customized development systems also require `%SP_PATH%\..\spds37.dll' (at runtime) and an import library for `spds37.dll' at build time:

Only `rtimpmsc.lib' is distributed with SICStus. `rtimpbc.lib' can be made with the command:

% implib rtimpbc.lib sprt37.dll

Please contact SICStus support at sicstus-support@sics.se if you need `rtimpwat.lib'.

The names of these .libs are assumed in respective spld.

The directory `samples' contains detailed examples on building resources and a runtime system.

MS Visual C++ symbols

As MSVC does not export/import symbols with a leading underscore, like Borland or Watcom, the SICStus header files defines the interface functions with an extra leading underscore when included by MSVC. This enables the runtime DLL compiled with Watcom to be imported to programs compiled with MSVC (or vice versa).

Long File names

The file name arguments to splfr, spmkds and spmkrs should not have embedded spaces. The reason for this is that not all C-compilers/linkers seem to support quoting of file name arguments.

Runtime Systems

A runtime system will need to load the `sprt37.dll'. It will also need to load the Runtime Library, `sp37\bin\sprt.sav'. `sprt37.dll' will be looked up by Windows' normal search for DLLs. `sp37\bin\sprt.sav' is looked up in the directory containing `sprt37.dll'. Furthermore, the initial library_directory/1 fact will initially be set to the same directory with sp37/library appended. This altogether makes it easy to organize the files of an application, e.g:

myapp.exe
sprt37.dll
sp37\
        bin\
                sprt.sav
        library\
                <whatever files from %SP_PATH%\library needed>

The sp* files can also be put somewhere else in order to be shared by several applications provided the `sprt37.dll' can be located by the DLL search.

The 37 in the file names above is derived from SICStus' major version number and patch level, i.e. currently 3 and 7. Naming the files with version number enables applications using different sicstus versions to install the sp* files in the same directory.

Generic Runtime Systems

As an alternative to using spmkrs to create runtime systems, there is a ready made runtime system provided: `%SP_PATH%\library\sprt.exe'. This is particularly useful if you don't have a C-compiler available. It will, after loading the runtime DLL and runtime library, try to restore the file `main.sav' from its own directory and, if successful, call the predicate main/0. Command line arguments will be available for the prolog program. The `sprt.exe' is a console based executable, suitable for applications which read/write on the stdio streams. There is also a winmain executable provided with otherwise the same properties: `%SP_PATH%\library\sprtw.exe'.

Command line editing

Command line editing supporting Emacs-like commands and IBMPC arrow keys is provided: in the character based executable. The following commands are provided:

^h
erase previous char
^d
erase next char
^u
kill line
^f
forward char
^b
backward char
^a
begin of line
^e
end of line
^p
previous line
^n
next line
^i
insert space
^s
forward search
^r
reverse search
^v
view history
^q
input next char blindly
^k
kill to end of line

Options may be specified in the file `%HOME%\spcmd.ini' as:

Option Value

on separate lines. Recognized options are:

lines
Value is the number of lines in the history buffer. 1-100 is accepted; the default is 30.
save
Value is either 0 (don't save or restore history buffer) or 1 (save history buffer in `%HOME%\spcmd.hst' on exit, restore history from the same file on start up.

The command line editing is switched off by giving the option `-nocmd' when starting SICStus. Command line editing will be automatically turned off if SICStus is run with piped input (e.g. from Emacs).

The console

The console used for the windowed executable is public domain, kindly provided by Jan Wielemaker <jan@swi.psy.uva.nl>.

The stream-based console window is a completely separate library, using its own configuration info. It will look at the environment variable CONSOLE which should contain a string of the form name:value{,name:value} where name is one of:

sl
The number of lines you can scroll back. There is no limit, but the more you specify the more memory will be used. Memory is allocated when data becomes available. The default is 200.
rows
The initial number of lines. The default is 24.
cols
The initial number of columns. The default is 80.
x
The X coordinate of the top-left corner. The default is CW_USEDEFAULT.
y
The Y coordinate of the top-left corner. The default is CW_USEDEFAULT.

You will normally specify this in your `autoexec.bat' file. Here is what an example:

% set CONSOLE=sl:600,x:400,y:400

Tcl/Tk interface

The interface is compiled with Tcl/Tk version 8.0.3 DLLs. Note that Tcl/Tk itself is not included in the SICStus distribution. It must be installed in order to use the interface. See section Tcl/Tk notes.

Tk Console

The Tcl/Tk interface includes an undocumented predicate:

tk_terminal(Interp, TextWidget, InStream, OutStream, ErrStream)
Given a TextWidget, e.g. .top.myterm, this predicate opens three prolog streams for which the text widget acts as a terminal.

There is also a library(tkconsol), making use of tk_terminal/5, which switches the Prolog top level to a Tk window. This is done by simply loading the library module.

The described features are still experimental, comments are appreciated.

Emacs Interface

Choosing EOF from menu seems to generate an eternal EOF which is not useful for e.g. escaping a break level. Instead a C-d can be generated by typing C-q C-d.

Limitations


Go to the first, previous, next, last section, table of contents.