/* GNU Prolog compatibility layer SWI file This implements empty stubs to be used in conjunction with the SWI/YAP compatibility layers. Generally, these predicates behave as expected; in exceptional circumstances (i.e. errors/argument instantiation which throw an exception),these predicates may silently fail. In an implementation that is ready to be compiled (and that's what's GNU Prolog good at), these bugs should have been eliminated. Time-complexity and optimization issues may be differ between SWI/GNU/YAP. In general, SWI will be much faster at things like flag/3, as we simply use the assert/retract mechanism. Additionally, you need to include lists.pl from the SWI distribution. Some predicates cannot be used in their original form: Use eval_arith/2 instead of is/2 to enable custom functions in GNU/YAP. Author: David Reitter, reitter at mle.media.mit.edu -- stealing and copying stuff from various sources, in particular from Jan Wielemaker's SWI Prolog. Version: $Id: compat_swi.pl,v 1.4 2003/11/02 20:00:21 dr Exp $ (C) 2003 Media Lab Europe Ltd. Licensed under the GNU public license. See end for licensing information. */ eval_arith(Expr, Result) :- Result is Expr. if_init. % must be called at initialization time, % otherwise program will slow down in GNU if(Goal, Then) :- ((Goal *-> Then); true). if(Goal, Then, Else) :- ((Goal *-> Then); Else). % predicates contribute by Steve Moyle: :- redefine_system_predicate(false), style_check(+singleton), style_check(-discontiguous), dynamic(false/0), dynamic(example/3). gc:- garbage_collect. depth_bound_call(G,L):-call_with_depth_limit(G,L,_). :- (predicate_property(numbervars(_,_,_),built_in) -> true; assert((numbervars(A,B,C):- numbervars(A,'$VAR',B,C)))), (predicate_property(thread_local(_),_) -> true; assert(thread_local(_))), (predicate_property(delete_file(_),built_in) -> true; assert_static(delete_file(_))). assert_static(X):- assert(X). system(X):- shell(X). exists(X):- exists_file(X). /* Authors: David Reitter, Steve Moyle Copyright (C): 2003 Media Lab Europe This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA As a special exception, if you link this library with other files, compiled with a Free Software compiler, to produce an executable, this library does not by itself cause the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */