Changeset 4480 for trunk/compiler/logtalk.pl
- Timestamp:
- 10/04/08 08:30:04 (3 months ago)
- Files:
-
- 1 modified
-
trunk/compiler/logtalk.pl (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/compiler/logtalk.pl
r4474 r4480 2184 2184 ( '$lgt_debugging_'(Obj) -> 2185 2185 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx), 2186 asserta((THead :- ('$lgt_nop'(Body), '$lgt_dbg_head'(Head, DbgCtx), DBody)))2186 asserta((THead :- ('$lgt_nop'(Body), '$lgt_dbg_head'(Head, 0, DbgCtx), DBody))) 2187 2187 ; asserta((THead :- ('$lgt_nop'(Body), TBody))) 2188 2188 ) … … 2216 2216 '$lgt_ctx_ctx'(Ctx, _, GSender, GThis, GSelf, Prefix, [], _), 2217 2217 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx), 2218 asserta((THead :- '$lgt_dbg_fact'(Head, DbgCtx)))2218 asserta((THead :- '$lgt_dbg_fact'(Head, 0, DbgCtx))) 2219 2219 ; '$lgt_add_db_lookup_cache_entry'(Obj, Head, SCtn, DclScope, Sender, THead, DDef, Update), 2220 2220 asserta(THead) … … 2286 2286 ( '$lgt_debugging_'(Obj) -> 2287 2287 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx), 2288 assertz((THead :- ('$lgt_nop'(Body), '$lgt_dbg_head'(Head, DbgCtx), DBody)))2288 assertz((THead :- ('$lgt_nop'(Body), '$lgt_dbg_head'(Head, 0, DbgCtx), DBody))) 2289 2289 ; assertz((THead :- ('$lgt_nop'(Body), TBody))) 2290 2290 ) … … 2318 2318 '$lgt_ctx_ctx'(Ctx, _, GSender, GThis, GSelf, Prefix, [], _), 2319 2319 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx), 2320 assertz((THead :- '$lgt_dbg_fact'(Head, DbgCtx)))2320 assertz((THead :- '$lgt_dbg_fact'(Head, 0, DbgCtx))) 2321 2321 ; '$lgt_add_db_lookup_cache_entry'(Obj, Head, SCtn, DclScope, Sender, THead, DDef, Update), 2322 2322 assertz(THead) … … 2401 2401 ( TBody = ('$lgt_nop'(Body), _) -> % rules (compiled both in normal and debug mode) 2402 2402 true 2403 ; TBody = '$lgt_dbg_fact'(_, _ ) -> % facts compiled in debug mode2403 ; TBody = '$lgt_dbg_fact'(_, _, _) -> % facts compiled in debug mode 2404 2404 Body = true 2405 2405 ; TBody = Body % facts compiled in normal mode … … 2416 2416 ( TBody = ('$lgt_nop'(Body), _) -> 2417 2417 true 2418 ; TBody = '$lgt_dbg_fact'(_, _ ) ->2418 ; TBody = '$lgt_dbg_fact'(_, _, _) -> 2419 2419 Body = true 2420 2420 ; TBody = Body … … 2435 2435 ( TBody = ('$lgt_nop'(Body), _) -> 2436 2436 true 2437 ; TBody = '$lgt_dbg_fact'(_, _ ) ->2437 ; TBody = '$lgt_dbg_fact'(_, _, _) -> 2438 2438 Body = true 2439 2439 ; TBody = Body … … 2489 2489 ( TBody = ('$lgt_nop'(Body), _) -> 2490 2490 true 2491 ; TBody = '$lgt_dbg_fact'(_, _ ) ->2491 ; TBody = '$lgt_dbg_fact'(_, _, _) -> 2492 2492 Body = true 2493 2493 ; TBody = Body … … 2498 2498 ( TBody = ('$lgt_nop'(Body), _) -> 2499 2499 true 2500 ; TBody = '$lgt_dbg_fact'(_, _ ) ->2500 ; TBody = '$lgt_dbg_fact'(_, _, _) -> 2501 2501 Body = true 2502 2502 ; TBody = Body … … 2518 2518 ( TBody = ('$lgt_nop'(Body), _) -> 2519 2519 true 2520 ; TBody = '$lgt_dbg_fact'(_, _ ) ->2520 ; TBody = '$lgt_dbg_fact'(_, _, _) -> 2521 2521 Body = true 2522 2522 ; TBody = Body … … 2577 2577 ( call_with_args(DDef, Head, _, _, _, Call) -> 2578 2578 ( '$lgt_debugging_'(Obj) -> 2579 retract((Call :- '$lgt_dbg_fact'(_, _ )))2579 retract((Call :- '$lgt_dbg_fact'(_, _, _))) 2580 2580 ; '$lgt_add_db_lookup_cache_entry'(Obj, Head, SCtn, PScope, Sender, Call, DDef, true), 2581 2581 retract(Call) … … 2584 2584 ; call_with_args(Def, Head, _, _, _, Call) -> 2585 2585 ( '$lgt_debugging_'(Obj) -> 2586 retract((Call :- '$lgt_dbg_fact'(_, _ )))2586 retract((Call :- '$lgt_dbg_fact'(_, _, _))) 2587 2587 ; '$lgt_add_db_lookup_cache_entry'(Obj, Head, PScope, Sender, Call), 2588 2588 retract(Call) … … 2601 2601 ( call_with_args(DDef, Head, _, _, _, Call) -> 2602 2602 ( '$lgt_debugging_'(Obj) -> 2603 retract((Call :- '$lgt_dbg_fact'(_, _ )))2603 retract((Call :- '$lgt_dbg_fact'(_, _, _))) 2604 2604 ; '$lgt_add_db_lookup_cache_entry'(Obj, Head, p, Sender, Call), 2605 2605 retract(Call) … … 3774 3774 3775 3775 3776 '$lgt_dbg_fact'(Fact, DbgCtx) :-3776 '$lgt_dbg_fact'(Fact, N, DbgCtx) :- 3777 3777 ( '$lgt_dbg_debugging_', \+ '$lgt_dbg_skipping_' -> 3778 '$lgt_dbg_port'(fact , Fact, _, DbgCtx, Action),3778 '$lgt_dbg_port'(fact(N), Fact, _, DbgCtx, Action), 3779 3779 call(Action) 3780 3780 ; true … … 3782 3782 3783 3783 3784 '$lgt_dbg_head'(Head, DbgCtx) :-3784 '$lgt_dbg_head'(Head, N, DbgCtx) :- 3785 3785 ( '$lgt_dbg_debugging_', \+ '$lgt_dbg_skipping_' -> 3786 '$lgt_dbg_port'(rule , Head, _, DbgCtx, Action),3786 '$lgt_dbg_port'(rule(N), Head, _, DbgCtx, Action), 3787 3787 call(Action) 3788 3788 ; true … … 3843 3843 3844 3844 3845 '$lgt_dbg_write_port_name'(fact) :- 3846 write(' Fact: '). 3847 '$lgt_dbg_write_port_name'(rule) :- 3848 write(' Rule: '). 3845 '$lgt_dbg_write_port_name'(fact(N)) :- 3846 ( N =:= 0 -> 3847 write(' Fact: ') 3848 ; write(' Fact('), write(N), write('): ') 3849 ). 3850 '$lgt_dbg_write_port_name'(rule(N)) :- 3851 ( N =:= 0 -> 3852 write(' Rule: ') 3853 ; write(' Rule('), write(N), write('): ') 3854 ). 3849 3855 '$lgt_dbg_write_port_name'(call) :- 3850 3856 write(' Call: '). … … 6431 6437 throw(type_error(callable, Body)). 6432 6438 6433 '$lgt_tr_clause'((Head:-Body), (THead:-'$lgt_nop'(Body), SBody), (THead:-'$lgt_nop'(Body),'$lgt_dbg_head'(Head, DbgCtx),DBody), Ctx, Input) :-6439 '$lgt_tr_clause'((Head:-Body), (THead:-'$lgt_nop'(Body), SBody), (THead:-'$lgt_nop'(Body),'$lgt_dbg_head'(Head, 0, DbgCtx),DBody), Ctx, Input) :- 6434 6440 functor(Head, Functor, Arity), 6435 6441 '$lgt_pp_dynamic_'(Functor, Arity), … … 6442 6448 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx). 6443 6449 6444 '$lgt_tr_clause'((Head:-Body), TClause, (THead:-'$lgt_dbg_head'(Head, DbgCtx),DBody), Ctx, Input) :-6450 '$lgt_tr_clause'((Head:-Body), TClause, (THead:-'$lgt_dbg_head'(Head, N, DbgCtx),DBody), Ctx, Input) :- 6445 6451 !, 6446 6452 '$lgt_pred_meta_vars'(Head, MetaVars), … … 6453 6459 ; TClause = (THead:-SBody) 6454 6460 ), 6455 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx). 6461 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx), 6462 '$lgt_clause_number'(THead, N). 6456 6463 6457 6464 '$lgt_tr_clause'(Fact, _, _, _, _) :- … … 6459 6466 throw(type_error(callable, Fact)). 6460 6467 6461 '$lgt_tr_clause'(Fact, TFact, (TFact:-'$lgt_dbg_fact'(Fact, DbgCtx)), Ctx, Input) :-6468 '$lgt_tr_clause'(Fact, TFact, (TFact:-'$lgt_dbg_fact'(Fact, N, DbgCtx)), Ctx, Input) :- 6462 6469 '$lgt_tr_head'(Fact, TFact, Ctx, Input), 6463 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx). 6470 '$lgt_ctx_dbg_ctx'(Ctx, DbgCtx), 6471 '$lgt_clause_number'(TFact, N). 6472 6473 6474 '$lgt_clause_number'(THead, N) :- 6475 functor(THead, TFunctor, TArity), 6476 functor(Template, TFunctor, TArity), 6477 findall(1, ('$lgt_pp_eclause_'(Template); '$lgt_pp_eclause_'((Template :- _))), List), 6478 '$lgt_length'(List, 0, Length), 6479 N is Length + 1. 6480 6481 '$lgt_length'([], Length, Length). 6482 '$lgt_length'([_| Tail], Acc, Length) :- 6483 Acc2 is Acc + 1, 6484 '$lgt_length'(Tail, Acc2, Length). 6485 6464 6486 6465 6487
