top
This commit is contained in:
parent
4a0dd26ecb
commit
0f313755cc
9
C/exec.c
9
C/exec.c
@ -1009,6 +1009,7 @@ static bool complete_ge(bool out, Term omod, yhandle_t sl, bool creeping) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Int _user_expand_goal(USES_REGS1) {
|
static Int _user_expand_goal(USES_REGS1) {
|
||||||
|
BACKUP_MACHINE_REGS();
|
||||||
yhandle_t sl = Yap_StartSlots();
|
yhandle_t sl = Yap_StartSlots();
|
||||||
Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL);
|
Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL);
|
||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
@ -1055,12 +1056,15 @@ static Int _user_expand_goal(USES_REGS1) {
|
|||||||
Yap_GetPredPropByFunc(FunctorGoalExpansion2, USER_MODULE))) &&
|
Yap_GetPredPropByFunc(FunctorGoalExpansion2, USER_MODULE))) &&
|
||||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||||
Yap_execute_pred(pe, NULL PASS_REGS, false)) {
|
Yap_execute_pred(pe, NULL PASS_REGS, false)) {
|
||||||
|
RECOVER_MACHINE_REGS();
|
||||||
return complete_ge(true, omod, sl, creeping);
|
return complete_ge(true, omod, sl, creeping);
|
||||||
}
|
}
|
||||||
|
RECOVER_MACHINE_REGS();
|
||||||
return complete_ge(false, omod, sl, creeping);
|
return complete_ge(false, omod, sl, creeping);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Int do_term_expansion(USES_REGS1) {
|
static Int do_term_expansion(USES_REGS1) {
|
||||||
|
BACKUP_MACHINE_REGS();
|
||||||
yhandle_t sl = Yap_StartSlots();
|
yhandle_t sl = Yap_StartSlots();
|
||||||
Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL);
|
Int creeping = Yap_get_signal(YAP_CREEP_SIGNAL);
|
||||||
PredEntry *pe;
|
PredEntry *pe;
|
||||||
@ -1075,6 +1079,7 @@ static Int do_term_expansion(USES_REGS1) {
|
|||||||
Yap_GetPredPropByFunc(FunctorTermExpansion, USER_MODULE))) &&
|
Yap_GetPredPropByFunc(FunctorTermExpansion, USER_MODULE))) &&
|
||||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||||
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
||||||
|
RECOVER_MACHINE_REGS();
|
||||||
return complete_ge(true, omod, sl, creeping);
|
return complete_ge(true, omod, sl, creeping);
|
||||||
}
|
}
|
||||||
/* CurMod:term_expansion(A,B) */
|
/* CurMod:term_expansion(A,B) */
|
||||||
@ -1083,6 +1088,7 @@ static Int do_term_expansion(USES_REGS1) {
|
|||||||
(pe = RepPredProp(Yap_GetPredPropByFunc(FunctorTermExpansion, cmod))) &&
|
(pe = RepPredProp(Yap_GetPredPropByFunc(FunctorTermExpansion, cmod))) &&
|
||||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||||
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
||||||
|
RECOVER_MACHINE_REGS();
|
||||||
return complete_ge(true, omod, sl, creeping);
|
return complete_ge(true, omod, sl, creeping);
|
||||||
}
|
}
|
||||||
/* system:term_expansion(A,B) */
|
/* system:term_expansion(A,B) */
|
||||||
@ -1094,8 +1100,10 @@ static Int do_term_expansion(USES_REGS1) {
|
|||||||
Yap_GetPredPropByFunc(FunctorTermExpansion, SYSTEM_MODULE))) &&
|
Yap_GetPredPropByFunc(FunctorTermExpansion, SYSTEM_MODULE))) &&
|
||||||
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
pe->OpcodeOfPred != FAIL_OPCODE && pe->OpcodeOfPred != UNDEF_OPCODE &&
|
||||||
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
Yap_execute_pred(pe, NULL, false PASS_REGS)) {
|
||||||
|
RECOVER_MACHINE_REGS();
|
||||||
return complete_ge(true, omod, sl, creeping);
|
return complete_ge(true, omod, sl, creeping);
|
||||||
}
|
}
|
||||||
|
RECOVER_MACHINE_REGS();
|
||||||
return complete_ge(false, omod, sl, creeping);
|
return complete_ge(false, omod, sl, creeping);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1659,7 +1667,6 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) {
|
|||||||
yamop *saved_p, *saved_cp;
|
yamop *saved_p, *saved_cp;
|
||||||
yamop *CodeAdr;
|
yamop *CodeAdr;
|
||||||
bool out;
|
bool out;
|
||||||
|
|
||||||
saved_p = P;
|
saved_p = P;
|
||||||
saved_cp = CP;
|
saved_cp = CP;
|
||||||
LOCAL_PrologMode |= TopGoalMode;
|
LOCAL_PrologMode |= TopGoalMode;
|
||||||
|
@ -218,9 +218,9 @@ INLINE_ONLY yhandle_t Yap_InitHandle__(Term t USES_REGS) {
|
|||||||
ensure_slots(1 PASS_REGS);
|
ensure_slots(1 PASS_REGS);
|
||||||
if (t==0) {
|
if (t==0) {
|
||||||
t = MkVarTerm();
|
t = MkVarTerm();
|
||||||
} else if (IsVarTerm(t) ) {
|
} else if (IsVarTerm(t) && VarOfTerm(t) > HR ) {
|
||||||
Term tg = MkVarTerm();
|
Term tg = MkVarTerm();
|
||||||
Bind_Global( VarOfTerm(t), tg);
|
Bind_Local(VarOfTerm(t), tg);
|
||||||
}
|
}
|
||||||
LOCAL_HandleBase[old_slots] = t;
|
LOCAL_HandleBase[old_slots] = t;
|
||||||
LOCAL_CurHandle++;
|
LOCAL_CurHandle++;
|
||||||
|
@ -834,7 +834,7 @@ nb_setval('$if_le1vel',0).
|
|||||||
erase(R),
|
erase(R),
|
||||||
G \= '$',
|
G \= '$',
|
||||||
strip_module(user:G, M0, G0),
|
strip_module(user:G, M0, G0),
|
||||||
( catch(M0:G0, Error, loop_error(Error, top))
|
( catch(M0:G0, Error, error_handler(Error, top))
|
||||||
->
|
->
|
||||||
true
|
true
|
||||||
;
|
;
|
||||||
@ -851,7 +851,7 @@ nb_setval('$if_le1vel',0).
|
|||||||
'$process_init_goal'([G|_]) :-
|
'$process_init_goal'([G|_]) :-
|
||||||
'$yap_strip_module'( G, M0, G0),
|
'$yap_strip_module'( G, M0, G0),
|
||||||
(
|
(
|
||||||
catch(M0:G0, Error, loop_error(Error, top))
|
catch(M0:G0, Error, error_handler(Error, top))
|
||||||
->
|
->
|
||||||
true
|
true
|
||||||
;
|
;
|
||||||
@ -915,7 +915,7 @@ nb_setval('$if_le1vel',0).
|
|||||||
'$init_win_graphics',
|
'$init_win_graphics',
|
||||||
fail.
|
fail.
|
||||||
'$do_startup_reconsult'(X) :-
|
'$do_startup_reconsult'(X) :-
|
||||||
catch(load_files(user:X, [silent(true)]), Error, loop_error(Error, consult)),
|
catch(load_files(user:X, [silent(true)]), Error, error_handler(Error, consult)),
|
||||||
!,
|
!,
|
||||||
( current_prolog_flag(halt_after_consult, false) -> true ; halt).
|
( current_prolog_flag(halt_after_consult, false) -> true ; halt).
|
||||||
'$do_startup_reconsult'(_).
|
'$do_startup_reconsult'(_).
|
||||||
@ -1463,7 +1463,7 @@ initialization(G,OPT) :-
|
|||||||
(
|
(
|
||||||
OPT == now
|
OPT == now
|
||||||
->
|
->
|
||||||
( catch(G,E,loop_error(E)) -> true ; format(user_error,':- ~w failed.~n',[G]) )
|
( catch(G,E,error_handler(E)) -> true ; format(user_error,':- ~w failed.~n',[G]) )
|
||||||
;
|
;
|
||||||
OPT == after_load
|
OPT == after_load
|
||||||
->
|
->
|
||||||
|
@ -599,7 +599,7 @@ halt(X) :-
|
|||||||
'$run_atom_goal'(GA) :-
|
'$run_atom_goal'(GA) :-
|
||||||
'$current_module'(Module),
|
'$current_module'(Module),
|
||||||
atom_to_term(GA, G, _),
|
atom_to_term(GA, G, _),
|
||||||
catch(once(Module:G), Error,loop_error(Error)).
|
catch(once(Module:G), Error,error_handler(Error)).
|
||||||
|
|
||||||
'$add_dot_to_atom_goal'([],[0'.]) :- !. %'
|
'$add_dot_to_atom_goal'([],[0'.]) :- !. %'
|
||||||
'$add_dot_to_atom_goal'([0'.],[0'.]) :- !.
|
'$add_dot_to_atom_goal'([0'.],[0'.]) :- !.
|
||||||
|
@ -497,7 +497,7 @@ be lost.
|
|||||||
).
|
).
|
||||||
|
|
||||||
'$debugger':execute_nonstop(G,M) :-
|
'$debugger':execute_nonstop(G,M) :-
|
||||||
'$execute_nonstop'(G,M)
|
'$execute_nonstop'(G,M).
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pred '$sys':enter_trace(+L, 0:G, +Module, +Info)
|
* @pred '$sys':enter_trace(+L, 0:G, +Module, +Info)
|
||||||
|
@ -94,6 +94,9 @@ Grammar related built-in predicates:
|
|||||||
Also, phrase/2-3 check their first argument.
|
Also, phrase/2-3 check their first argument.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
prolog:'$translate_rule'(Rule, T) :-
|
||||||
|
translate_rule(Rule, T ).
|
||||||
|
|
||||||
translate_rule(Rule, (NH :- B) ) :-
|
translate_rule(Rule, (NH :- B) ) :-
|
||||||
source_module( SM ),
|
source_module( SM ),
|
||||||
'$yap_strip_module'( SM:Rule, M0, (LP-->RP) ),
|
'$yap_strip_module'( SM:Rule, M0, (LP-->RP) ),
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
fail.
|
fail.
|
||||||
'$startup_goals' :-
|
'$startup_goals' :-
|
||||||
recorded('$startup_goal',G,_),
|
recorded('$startup_goal',G,_),
|
||||||
catch(once(user:G),Error,loop_error(Error)),
|
catch(once(user:G),Error,error_handler(Error)),
|
||||||
fail.
|
fail.
|
||||||
'$startup_goals' :-
|
'$startup_goals' :-
|
||||||
get_value('$init_goal',GA),
|
get_value('$init_goal',GA),
|
||||||
@ -125,7 +125,7 @@
|
|||||||
'$startup_goals' :-
|
'$startup_goals' :-
|
||||||
recorded('$restore_flag', goal(Module:GA), R),
|
recorded('$restore_flag', goal(Module:GA), R),
|
||||||
erase(R),
|
erase(R),
|
||||||
catch(once(Module:GA),Error,loop_error(Error)),
|
catch(once(Module:GA),Error,error_handler(Error)),
|
||||||
fail.
|
fail.
|
||||||
'$startup_goals' :-
|
'$startup_goals' :-
|
||||||
get_value('$myddas_goal',GA), GA \= [],
|
get_value('$myddas_goal',GA), GA \= [],
|
||||||
@ -204,7 +204,7 @@
|
|||||||
recorded('$restore_goal',G,R),
|
recorded('$restore_goal',G,R),
|
||||||
erase(R),
|
erase(R),
|
||||||
prompt(_,'| '),
|
prompt(_,'| '),
|
||||||
catch(once(user:G),Error,loop_error(Error)),
|
catch(once(user:G),Error,error_handler(Error)),
|
||||||
fail.
|
fail.
|
||||||
|
|
||||||
'$init_path_extensions' :-
|
'$init_path_extensions' :-
|
||||||
|
@ -76,7 +76,7 @@ live :-
|
|||||||
% stop at spy-points if debugging is on.
|
% stop at spy-points if debugging is on.
|
||||||
nb_setval('$debug_run',off),
|
nb_setval('$debug_run',off),
|
||||||
nb_setval('$debug_jump',off),
|
nb_setval('$debug_jump',off),
|
||||||
catch('$sys':command(Command,Varnames,Pos,top),E,loop_error(E)),
|
catch('$sys':command(Command,Varnames,Pos,top),E,error_handler(E)),
|
||||||
current_prolog_flag(break_level, BreakLevel),
|
current_prolog_flag(break_level, BreakLevel),
|
||||||
(
|
(
|
||||||
BreakLevel \= 0
|
BreakLevel \= 0
|
||||||
@ -785,7 +785,7 @@ write_query_answer( Bindings ) :-
|
|||||||
format(user_error, ':- ~w failed.~n', [Goal]).
|
format(user_error, ':- ~w failed.~n', [Goal]).
|
||||||
|
|
||||||
'$boot_dcg'( H, B, Where ) :-
|
'$boot_dcg'( H, B, Where ) :-
|
||||||
'$_grammar':translate_rule((H --> B), (NH :- NB) ),
|
'$translate_rule'((H --> B), (NH :- NB) ),
|
||||||
'$$compile'((NH :- NB), Where, ( H --> B), _R),
|
'$$compile'((NH :- NB), Where, ( H --> B), _R),
|
||||||
!.
|
!.
|
||||||
'$boot_dcg'( H, B, _ ) :-
|
'$boot_dcg'( H, B, _ ) :-
|
||||||
@ -810,7 +810,7 @@ write_query_answer( Bindings ) :-
|
|||||||
;
|
;
|
||||||
read_clause(Stream, Command, Options)
|
read_clause(Stream, Command, Options)
|
||||||
),
|
),
|
||||||
catch('$sys':command(Command,Vars,Pos, Status), Error, loop_error(Error,top)).
|
catch('$sys':command(Command,Vars,Pos, Status), Error, error_handler(Error,top)).
|
||||||
|
|
||||||
/** @pred user:expand_term( _T_,- _X_) is dynamic,multifile.
|
/** @pred user:expand_term( _T_,- _X_) is dynamic,multifile.
|
||||||
|
|
||||||
@ -909,7 +909,7 @@ expand_term(Term,Expanded) :-
|
|||||||
% Grammar Rules expansion
|
% Grammar Rules expansion
|
||||||
%
|
%
|
||||||
'$expand_term_grammar'((A-->B), C) :-
|
'$expand_term_grammar'((A-->B), C) :-
|
||||||
'$_grammar':translate_rule((A-->B),C), !.
|
'$translate_rule'((A-->B),C), !.
|
||||||
'$expand_term_grammar'(A, A).
|
'$expand_term_grammar'(A, A).
|
||||||
|
|
||||||
%
|
%
|
||||||
|
@ -181,7 +181,7 @@ display(Stream, T) :-
|
|||||||
/* interface to user portray */
|
/* interface to user portray */
|
||||||
'$portray'(T) :-
|
'$portray'(T) :-
|
||||||
\+ '$undefined'(portray(_),user),
|
\+ '$undefined'(portray(_),user),
|
||||||
catch(user:portray(T),Error,loop_error(Error)), !,
|
catch(user:portray(T),Error,error_handler(Error)), !,
|
||||||
set_value('$portray',true), fail.
|
set_value('$portray',true), fail.
|
||||||
'$portray'(_) :- set_value('$portray',false), fail.
|
'$portray'(_) :- set_value('$portray',false), fail.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user