From: David S. W. <dw...@us...> - 2010-04-27 16:15:13
|
Update of /cvsroot/xsb/XSB/syslib In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv5097 Modified Files: assert.P assert.xwam Log Message: Added explicit module reference to be allowed in retract and retractall. (But noticed a bug in retract(mod:pred(a,b)) for trie-indexed pred/2. It sometimes aborts exiting xsb, and seems due to a global variable not being set, but I'm not sure why. I'll try to find time to track it down.) Index: assert.P =================================================================== RCS file: /cvsroot/xsb/XSB/syslib/assert.P,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- assert.P 16 Mar 2010 16:41:37 -0000 1.50 +++ assert.P 27 Apr 2010 16:14:59 -0000 1.51 @@ -197,7 +197,7 @@ (Clause = (Head:-Body) -> check_assert_fact(Head, Pred), ( check_body(Body) -> true ; type_error(callable,Body,Pred,1)), - ('_$trie_asserted'(Head) -> + ('_$trie_asserted'(Head), Body \== true -> warning(['Asserting clause with non-empty body for ',Head, ' which is trie-indexed. ', 'Indexing for this predicate may not be efficient.']) ; true), @@ -438,9 +438,15 @@ /*======================================================================*/ retract(Rule) :- % changed for multifile predicates (9/2008) - (Rule = (Head :- Body) + (Rule = (Head0 :- Body) -> true - ; Head = Rule, Body = true + ; Head0 = Rule, Body = true + ), + (nonvar(Head0),Head0 = Mod:Head1 + -> term_new_mod(Mod,Head1,Head), + Head1 =.. [_|Args], + Head =.. [_|Args] + ; Head = Head0 ), call_xsb_hook(xsb_retract_hook(_),[Head,Body],all), (nonvar(Head), '_$multifile'(Head) @@ -487,7 +493,13 @@ get_dynamic_pred_ep(Head,'retract/1',PredEP,PSC), db_retract(Head, Body, PredEP,PSC). -retractall(Fact) :- +retractall(Fact0) :- + (nonvar(Fact0),Fact0 = Mod:Fact1 + -> term_new_mod(Mod,Fact1,Fact), + Fact1 =.. [_|Args], + Fact =.. [_|Args] + ; Fact = Fact0 + ), call_xsb_hook(xsb_retract_hook(_),[Fact,true],all), (nonvar(Fact), '_$multifile'(Fact) -> do_multifile_retractall(Fact) Index: assert.xwam =================================================================== RCS file: /cvsroot/xsb/XSB/syslib/assert.xwam,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 Binary files /tmp/cvsFNTrMV and /tmp/cvsxCJuh5 differ |