:- op(foo,xfy,800), op(bar, fx, 10).instead use separate directives, like:
:- op(foo,xfy,800). :- op(bar, fx, 10).This is required also for ISO compliance.
The following example shows how conditional compilation can be used to supply SPIDER with special definitions of predicates etc.
:- if(current_prolog_flag(dialect,spider)). %% Dummy definitions for SPIDER. SICStus will not see these. foo(_,_). bar(_,_). :- elif(current_prolog_flag(dialect,sicstus)). %% SICStus, but not SPIDER, will see this code foo(X,Y) :- some_goal(X,Y). %% include some code that is not available in SPIDER %% Presumably it defines bar/2. :- include(generated_code). :- else. %% This code is for Prolog dialects other than SICStus. foo(X,Y) :- throw(unsupported(foo(X,Y))). bar(X,Y) :- throw(unsupported(bar(X,Y))). :- endif.
SPIDER-specific code is useful with pseudo-directives, e.g. det/1 and nondet/1, that you only want SPIDER to see. For instance,
:- module(animals, [mybird/0, set_bird/1]).
:- if(current_prolog_flag(dialect,spider)).
%% Dummy definitions for SPIDER. SICStus will not see these.
%% These prevent SPIDER from complaing about undefined predicates
%% When they are used in directives.
det(_).
nondet(_).
:- endif. % SPIDER
mybird :-
animals(bird(Bird)),
selected_bird(Bird),
!,
format('The selected bird was ~w~n', [Bird]).
:- if(current_prolog_flag(dialect,spider)).
% The SPIDER determinacy analyzer understands these.
:- nondet(animals/1).
:- det(selected_bird/1).
:- endif. % SPIDER
% SPIDER will infer that this predicate is not
% determinate in its first argument. The nondet-declaration above will
% ensure that SPIDER does not complain about this at higher warning
% levels.
animals(bird(penguin)).
animals(bird(pigeon).
animals(mammal(horse)).
% SPIDER would normally assume that a dynamic predicate is
(potentially) non-determinate but we know that this particular
predicate will always have at most one solution.
:- dynamic selected_bird/1.
% Set the bird.
% Usage example: set_bird(pigeon)
set_bird(Bird) :-
retractall(selected_bird(_)),
assert(selected_bird(Bird)).
Note: SICStus Prolog 4.2.1 provides an improved
syntax for declaring determinacy that does not require conditional
compilation, see the documentation for
the determinacy analyzer.
) button.
Note that line breakpoints only work if source info is enabled, i.e. with set_prolog_flag(source_info, on).
Breakpoints are persisted and automatically installed in any Prolog started from within SPIDER. You can temporarily disable all breakpoints from the Breakpoints view.
You can select a file, folder or Project in the Eclipse Project Explorer and select Properties from the context menu. There is a Prolog properties page with the following choices:
It may be worthwhile to uncheck this for some example folders in the SICStus library tree.
Note that the Indexer will skip non-Prolog files even if Index is checked so you do not need to uncheck this option for non-Prolog files.
There are also some Indexer-related preferences.