Merge branch 'master' of gitosis@yap.dcc.fc.up.pt:yap-6

This commit is contained in:
Vitor Santos Costa 2010-01-12 22:21:46 +00:00
commit 8d5c490ff7
6 changed files with 39 additions and 11 deletions

View File

@ -1027,13 +1027,14 @@ YAP_cut_up(void)
cut_pt = B->cp_b;
CUT_prune_to(cut_pt);
Yap_TrimTrail();
B = cut_pt;
}
#else /* YAPOR */
#else
Yap_TrimTrail();
B = B->cp_b; /* cut_fail */
#endif
HB = B->cp_h; /* cut_fail */
Yap_TrimTrail();
RECOVER_B();
}
@ -1340,10 +1341,12 @@ YAP_ExecuteFirst(PredEntry *pe, CPredicate exec_code)
} else if (val == 1) { /* TRUE */
cut_succeed();
} else {
if ((val & REDO_PTR) == REDO_PTR)
/*
if ((val & REDO_PTR) == REDO_PTR)
ctx->context = (int *)(val & ~REDO_PTR);
else
else
ctx->context = (int *)((val & ~REDO_PTR)>>FRG_REDO_BITS);
*/
return TRUE;
}
} else {
@ -1355,7 +1358,7 @@ YAP_ExecuteFirst(PredEntry *pe, CPredicate exec_code)
Int
YAP_ExecuteNext(PredEntry *pe, CPredicate exec_code)
{
if (pe->PredFlags & SWIEnvPredFlag) {
if (pe->PredFlags & (SWIEnvPredFlag|CArgsPredFlag)) {
Int val;
CPredicateV codev = (CPredicateV)exec_code;
struct foreign_context *ctx = (struct foreign_context *)(&EXTRA_CBACK_ARG(pe->ArityOfPE,1));
@ -1371,10 +1374,12 @@ YAP_ExecuteNext(PredEntry *pe, CPredicate exec_code)
} else if (val == 1) { /* TRUE */
cut_succeed();
} else {
if ((val & REDO_PTR) == REDO_PTR)
/*
if ((val & REDO_PTR) == REDO_PTR)
ctx->context = (int *)(val & ~REDO_PTR);
else
else
ctx->context = (int *)((val & ~REDO_PTR)>>FRG_REDO_BITS);
*/
}
return TRUE;
}

View File

@ -2361,8 +2361,11 @@ p_open (void)
}
unix_upd_stream_info (st);
if (opts != 0) {
if (opts & 2)
if (opts & 2) {
st->status |= Binary_Stream_f;
/* we should not search for a byter order mark on a binary file */
avoid_bom = TRUE;
}
if (opts & 4) {
if (st->status & (Tty_Stream_f|Socket_Stream_f|InMemory_Stream_f)) {
Term ta[1], t;

View File

@ -387,7 +387,6 @@ static int p_trie_traverse_init(void) {
/* traverse trie */
if (!(data = trie_traverse_init((TrEntry) YAP_IntOfTerm(arg_trie), (TrData) YAP_IntOfTerm(arg_init_ref)))) {
printf("cut fail no init!!!\n");
YAP_cut_fail();
return FALSE;
}

@ -1 +1 @@
Subproject commit f6a79007615bf46dc79712c41d61289834f28ba3
Subproject commit c325e4564bb8d4e32c27f2061df85f13d315974e

@ -1 +1 @@
Subproject commit eb6d27251c2548c25e6d37fff2a27a014caaa7aa
Subproject commit a2d2f03107eecd45462cd61a678035132cf06326

View File

@ -226,6 +226,8 @@ open(F,T,S,Opts) :-
'$check_opt_sp'(A, G) :-
'$do_error'(domain_error(stream_property,A),G).
'$check_opt_write'(attributes(T), G) :- !,
'$check_write_attributes'(T, G).
'$check_opt_write'(cycles(T), G) :- !,
'$check_cycles_arg'(T, G).
'$check_opt_write'(quoted(T), G) :- !,
@ -236,6 +238,8 @@ open(F,T,S,Opts) :-
'$check_write_numbervars_arg'(T, G).
'$check_opt_write'(portrayed(T), G) :- !,
'$check_write_portrayed'(T, G).
'$check_opt_write'(portray(T), G) :- !,
'$check_write_portrayed'(T, G).
'$check_opt_write'(priority(T), G) :- !,
'$check_priority_arg'(T, G).
'$check_opt_write'(max_depth(T), G) :- !,
@ -316,6 +320,15 @@ open(F,T,S,Opts) :-
'$check_read_syntax_errors_arg'(X,G) :-
'$do_error'(domain_error(read_option,syntax_errors(X)),G).
'$check_write_attributes'(X, G) :- var(X), !,
'$do_error'(instantiation_error,G).
'$check_write_attributes'(ignore,_) :- !.
'$check_write_attributes'(dots,_) :- !.
'$check_write_attributes'(write,_) :- !.
'$check_write_attributes'(portray,_) :- !.
'$check_write_attributes'(X,G) :-
'$do_error'(domain_error(write_option,attributes(X)),G).
'$check_write_quoted_arg'(X, G) :- var(X), !,
'$do_error'(instantiation_error,G).
'$check_write_quoted_arg'(true,_) :- !.
@ -597,6 +610,14 @@ write_term(_,_,_).
'$process_wt_opts'([portrayed(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 /\ 23,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([portray(true)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 \/ 8,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([portray(false)|Opts], Flag0, Flag, Priority, CallBacks) :-
FlagI is Flag0 /\ 23,
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([attributes(_)|Opts], Flag0, Flag, Priority, CallBacks) :-
'$process_wt_opts'(Opts, FlagI, Flag, Priority, CallBacks).
'$process_wt_opts'([priority(Priority)|Opts], Flag0, Flag, Priority, CallBacks) :-
'$process_wt_opts'(Opts, Flag0, Flag, _, CallBacks).
'$process_wt_opts'([max_depth(D)|Opts], Flag0, Flag, Priority, [max_depth(D1,D0,D2)|CallBacks]) :-