Did you know ... Search Documentation:
sicstus.pl -- SICStus compatibility library
PublicShow source

This library is intended to be activated using the directive below in files that are designed for use with SICStus Prolog. The changes are in effect until the end of the file and in each file loaded from this file.

:- expects_dialect(sicstus).
To be done
- The dialect-compatibility packages are developed in a `demand-driven' fashion. Please contribute to this package.
Source if(:If, :Then, :Else)
Same as SWI-Prolog soft-cut construct. Normally, this is translated using goal-expansion. If either term contains a !, we use meta-calling for full compatibility (i.e., scoping the cut).
Source rename_module(?SICStusModule, ?RenamedSICSTusModule) is nondet[multifile]
True if RenamedSICSTusModule is the name that we use for the SICStus native module SICStusModule. We do this in places where the module-name conflicts. All explicitely qualified goals are mapped to the SICStus equivalent of the module.
Source use_module(+Module, -File, +Imports) is det
use_module(-Module, +File, +Imports) is det
This predicate can be used to import from a named module while the file-location of the module is unknown or to get access to the module-name loaded from a file.

If both Module and File are given, we use Module and try to unify File with the absolute canonical path to the file from which Module was loaded. However, we succeed regardless of the success of this unification.

Source bb_put(:Name, +Value) is det
Source bb_get(:Name, -Value) is semidet
Source bb_delete(:Name, -Value) is semidet
Source bb_update(:Name, -Old, +New) is semidet
SICStus compatible blackboard routines. The implementations only deal with cases where the module-sensitive key is unknown and meta-calling. Simple cases are directly mapped to SWI-Prolog non-backtrackable global variables.
Source create_mutable(?Value, -Mutable) is det
Create a mutable term with the given initial Value.
Compatibility
- sicstus
Source get_mutable(?Value, +Mutable) is semidet
True if Value unifies with the current value of Mutable.
Compatibility
- sicstus
Source update_mutable(?Value, !Mutable) is det
Set the value of Mutable to Value. The old binding is restored on backtracking.
See also
- setarg/3.
Compatibility
- sicstus
Source read_line(-Codes) is det
Source read_line(+Stream, -Codes) is det
Read a line from the given or current input. The line read does not include the line-termination character. Unifies Codes with end_of_file if the end of the input is reached.
See also
- The SWI-Prolog primitive is read_line_to_codes/2.
Compatibility
- sicstus
Source trimcore
Trims the stacks. Other tasks of the SICStus trimcore/0 are automatically scheduled by SWI-Prolog.
Source prolog_flag(+Flag, -Old, +New) is semidet
Query and set a Prolog flag. Use the debug/1 topic prolog_flag to find the flags accessed using this predicate.
Source prolog_flag(+Flag, -Value) is semidet
Query a Prolog flag, mapping SICSTus flags to SWI-Prolog flags

Re-exported predicates

The following predicates are re-exported from other modules

Source block(+Heads)
Declare predicates to suspend on certain modes. The argument is, like meta_predicate/1, a comma-separated list of modes (BlockSpecs). Calls to the predicate is suspended if at least one of the conditions implies by a blockspec evaluated to true. A blockspec evaluated to true iff all arguments specified as `-' are unbound.

Multiple BlockSpecs for a single predicate can appear in one or more :- block declarations. The predicate is suspended untill all mode patterns that apply to it are satisfied.

The implementation is realised by creating a wrapper that uses when/2 to realize suspension of the renamed predicate.

Compatibility
- SICStus Prolog
- If the predicate is blocked on multiple conditions, it will not unblock before all conditions are satisfied. SICStus unblocks when one arbitrary condition is satisfied.
bug
- It is not possible to block on a dynamic predicate because we cannot wrap assert/1. Likewise, we cannot block foreign predicates, although it would be easier to support this.