Did you know ... Search Documentation:
sicstus4.pl -- SICStus 4 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 4. The changes are in effect until the end of the file and in each file loaded from this file.

:- expects_dialect(sicstus4).

This library only provides compatibility with version 4 of SICStus Prolog. For SICStus Prolog 3 compatibility, use library(dialect/sicstus) instead.

To be done
- The dialect-compatibility packages are developed in a `demand-driven' fashion. Please contribute to this package.
Source push_sicstus4_library[private]
Pushes searching for dialect/sicstus4 in front of every library directory that contains such as sub-directory.
Source setup_dialect[private]
Further dialect initialization.

sicstus4 currently performs the same initialization as the sicstus (SICStus 3) dialect.

Source rename_module(?SICStus4Module, ?RenamedSICStus4Module) is nondet[multifile]
True if RenamedSICStus4Module is the name that we use for the SICStus 4 native module SICStus4Module. We do this in places where the module-name conflicts. All explicitly qualified goals are mapped to the SICStus 4 equivalent of the module.
Source nonmember(?Element, ?List) is semidet
True if Element doesn't unify with any element in List. No variables are bound.

Re-exported predicates

The following predicates are re-exported from other modules

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 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 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 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 prolog_flag(+Flag, -Value) is semidet
Query a Prolog flag, mapping SICSTus flags to SWI-Prolog flags
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 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 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 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.
Source get_mutable(?Value, +Mutable) is semidet
True if Value unifies with the current value of Mutable.
Compatibility
- sicstus
Source create_mutable(?Value, -Mutable) is det
Create a mutable term with the given initial Value.
Compatibility
- sicstus
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 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

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source mutable(Arg1)
Source statistics(Arg1, Arg2)
Source sicstus_is_readable_stream(Arg1)