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/packages/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( ).
This predicate should be used to open new IDE tools, for example the manual opening the editor, etc.
65auto_call(G) :- 66 current_prolog_flag(autoload, true), 67 !, 68 call(G). 69auto_call(G) :- 70 '$pi_head'(PI, G), 71 current_prolog_flag(autoload, Old), 72 setup_call_cleanup( 73 asserta(user:thread_message_hook(autoload(disabled(_Count)),_,_), Ref), 74 setup_call_cleanup( 75 set_prolog_flag(autoload, true), 76 '$autoload'(PI), 77 set_prolog_flag(autoload, Old)), 78 erase(Ref)), 79 call(G). 80 81 82 /******************************* 83 * DIALOG EDITOR SUPPORT * 84 *******************************/
91callable_predicate(M:Head) :-
92 callable(Head),
93 functor(Head, Name, Arity),
94 current_predicate(M:Name/Arity).
100modified_since_last_loaded(File) :- 101 '$time_source_file'(File, LoadTime, user), 102 !, 103 time_file(File, Modified), 104 Modified > LoadTime. 105modified_since_last_loaded(InFile) :- 106 '$time_source_file'(File, LoadTime, user), 107 same_file(InFile, File), 108 !, 109 time_file(File, Modified), 110 Modified > LoadTime. 111 112 113 /******************************* 114 * MESSAGES * 115 *******************************/
123pce_error(Term) :- 124 ( current_prolog_flag(xref, true) 125 -> true 126 ; print_message(error, Term) 127 ). 128 129pce_warn(Term) :- 130 ( current_prolog_flag(xref, true) 131 -> true 132 ; print_message(warning, Term) 133 ). 134 135pce_info(Term) :- 136 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'. */