1/* Part of SWI-Prolog 2 3 Author: Jan Wielemaker 4 E-mail: J.Wielemaker@vu.nl 5 WWW: http://www.swi-prolog.org 6 Copyright (c) 1999-2019, University of Amsterdam 7 VU University Amsterdam 8 CWI, Amsterdam 9 All rights reserved. 10 11 Redistribution and use in source and binary forms, with or without 12 modification, are permitted provided that the following conditions 13 are met: 14 15 1. Redistributions of source code must retain the above copyright 16 notice, this list of conditions and the following disclaimer. 17 18 2. Redistributions in binary form must reproduce the above copyright 19 notice, this list of conditions and the following disclaimer in 20 the documentation and/or other materials provided with the 21 distribution. 22 23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 POSSIBILITY OF SUCH DAMAGE. 35*/ 36 37:- module(edinburgh, 38 [ display/1, 39 display/2, 40 unknown/2, 41 reconsult/1, 42 debug/0, 43 nodebug/0, 44 fileerrors/2 45 ]). 46 47:- meta_predicate 48 unknown( , ), 49 reconsult( ).
59 /******************************* 60 * TERM I/O * 61 *******************************/
{a}
) and lists ([a,b,c]
). Currently does print
dicts using the dict notation.
75display(Term) :- 76 display(current_output, Term). 77display(Stream, Term) :- 78 write_term(Stream, Term, 79 [ quoted(true), 80 ignore_ops(true), 81 no_lists(true), 82 brace_terms(false) 83 ]).
90unknown(M:Old, M:New) :- 91 current_prolog_flag(Munknown, O), 92 map_unknown(O, Old), 93 map_unknown(N, New), 94 !, 95 set_prolog_flag(Munknown, N). 96 97map_unknown(error, trace). 98map_unknown(warning, trace). 99map_unknown(fail, fail).
file(s)
, wiping the old content first. SWI-Prolog's
consult/1 and related predicates always do this.
109reconsult(File) :-
110 consult(File).
118debug :- set_prolog_flag(debug, true). 119nodebug :- notrace, set_prolog_flag(debug, false). 120 121:- '$hide'(nodebug/0).
true
, causing file operations to raise an exception. Setting
it to false
activates the old Edinburgh mode of silent
failure.
133fileerrors(Old, New) :-
134 current_prolog_flag(fileerrors, Old),
135 ( Old == New
136 -> true
137 ; set_prolog_flag(fileerrors, New)
138 )
Some traditional Edinburgh predicates
This module defines predicates from `traditional Edinburgh Prolog' (Dec10 and C-Prolog) whose functionality has been replaced by (ISO) Standard Prolog. */