1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
/* $Id: backcomp.pl,v 1.12 1999/12/20 14:14:06 jan Exp $
Designed and implemented by Jan Wielemaker
E-mail: jan@swi.psy.uva.nl
Copyright (C) 1994 University of Amsterdam. All rights reserved.
*/
:- module(backward_compatibility,
[ '$arch'/2,
'$version'/1,
'$home'/1,
'$argv'/1,
displayq/1,
displayq/2,
(ed)/1,
concat/3,
read_variables/2,
read_variables/3,
feature/2,
set_feature/2,
substring/4,
flush/0
]).
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This library defines predicates that used to exist in older version of
SWI-Prolog, but are considered obsolete as there functionality is neatly
covered by new features. Most often, these constructs are superceeded by
ISO-standard compliant predicates.
Please also note the existence of library(quintus) and
library(edinburgh) for more compatibility predicates.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
'$arch'(Arch, unknown) :-
current_prolog_flag(arch, Arch).
'$version'(Version) :-
current_prolog_flag(version, Version).
'$home'(Home) :-
current_prolog_flag(home, Home).
'$argv'(Argv) :-
current_prolog_flag(argv, Argv).
% or write_canonical/[1,2]
displayq(Term) :-
write_term(Term, [ignore_ops(true),quoted(true)]).
displayq(Stream, Term) :-
write_term(Stream, Term, [ignore_ops(true),quoted(true)]).
% use edit/1
ed(PredName) :-
atom(PredName), !,
edit(PredName/_Arity).
ed(Pred) :-
edit(Pred).
% concat/3 is superseeded by ISO atom_concat/3
concat(A, B, C) :-
atom_concat(A, B, C).
% Replaced by ISO read_term/[2,3].
read_variables(Term, Vars) :-
read_term(Term, [variable_names(Vars)]).
read_variables(Stream, Term, Vars) :-
read_term(Stream, Term, [variable_names(Vars)]).
% feature(?Key, ?Value)
% set_feature(+Key, @Term)
%
% Replaced by ISO current_prolog_flag/2 and set_prolog_flag/2.
feature(Key, Value) :-
current_prolog_flag(Key, Value).
set_feature(Key, Value) :-
set_prolog_flag(Key, Value).
% substring(+String, +Offset, +Length, -Sub)
substring(String, Offset, Length, Sub) :-
Offset0 is Offset - 1,
sub_string(String, Offset0, Length, _After, Sub).
% flush/0
flush :-
flush_output.
|