1/* Part of XPCE --- The SWI-Prolog GUI toolkit 2 3 Author: Jan Wielemaker and Anjo Anjewierden 4 E-mail: J.Wielemaker@vu.nl 5 WWW: http://www.swi-prolog.org/projects/xpce/ 6 Copyright (c) 1996-2012, University of Amsterdam 7 VU University Amsterdam 8 All rights reserved. 9 10 Redistribution and use in source and binary forms, with or without 11 modification, are permitted provided that the following conditions 12 are met: 13 14 1. Redistributions of source code must retain the above copyright 15 notice, this list of conditions and the following disclaimer. 16 17 2. Redistributions in binary form must reproduce the above copyright 18 notice, this list of conditions and the following disclaimer in 19 the documentation and/or other materials provided with the 20 distribution. 21 22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 25 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 26 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 30 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 POSSIBILITY OF SUCH DAMAGE. 34*/ 35 36:- module(pce_compatibility_layer, 37 [ auto_call/1, 38 callable_predicate/1, 39 modified_since_last_loaded/1, 40 pce_error/1, 41 pce_warn/1, 42 pce_info/1 43 ]).
52:- meta_predicate
53 auto_call( ),
54 callable_predicate( ).
61auto_call(G) :- 62 call(). 63 64 65 /******************************* 66 * DIALOG EDITOR SUPPORT * 67 *******************************/
74callable_predicate(M:Head) :-
75 callable(Head),
76 functor(Head, Name, Arity),
77 current_predicate(M:Name/Arity).
83modified_since_last_loaded(File) :- 84 '$time_source_file'(File, LoadTime, user), 85 !, 86 time_file(File, Modified), 87 Modified > LoadTime. 88modified_since_last_loaded(InFile) :- 89 '$time_source_file'(File, LoadTime, user), 90 same_file(InFile, File), 91 !, 92 time_file(File, Modified), 93 Modified > LoadTime. 94 95 96 /******************************* 97 * MESSAGES * 98 *******************************/ 99 100:- consult(library('english/pce_messages')). 101 102:- multifile 103 prolog:message/3. 104 105prologmessage(Spec) --> 106 pce_message(Spec). 107prologmessage(context_error(Goal, Context, What)) --> 108 [ '~w: ~w '-[Goal, What] ], 109 pce_message_context(Context). 110prologmessage(type_error(Goal, ArgN, Type, _Value)) --> 111 [ '~w: argument ~w must be a ~w'-[Goal, ArgN, Type], nl ].
119pce_error(Term) :- 120 ( current_prolog_flag(xref, true) 121 -> true 122 ; print_message(error, Term) 123 ). 124 125pce_warn(Term) :- 126 ( current_prolog_flag(xref, true) 127 -> true 128 ; print_message(warning, Term) 129 ). 130 131pce_info(Term) :- 132 print_message(informational, Term)
XPCE Compatibility layer
This layer defines some predicates to enhance portability with SICStus and Quintus Prolog. These systems are no longer supported, but it is probably wise to keep this layer for `just-in-case'. */