diff --git a/C/c_interface.c b/C/c_interface.c index dda827e18..edcf5a05a 100644 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -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; } diff --git a/C/iopreds.c b/C/iopreds.c index 7e93e55bc..7449f0917 100755 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -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; diff --git a/library/tries/tries.c b/library/tries/tries.c index 87d8966b1..111cd89c1 100644 --- a/library/tries/tries.c +++ b/library/tries/tries.c @@ -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; } diff --git a/packages/chr b/packages/chr index f6a790076..c325e4564 160000 --- a/packages/chr +++ b/packages/chr @@ -1 +1 @@ -Subproject commit f6a79007615bf46dc79712c41d61289834f28ba3 +Subproject commit c325e4564bb8d4e32c27f2061df85f13d315974e diff --git a/packages/jpl b/packages/jpl index eb6d27251..a2d2f0310 160000 --- a/packages/jpl +++ b/packages/jpl @@ -1 +1 @@ -Subproject commit eb6d27251c2548c25e6d37fff2a27a014caaa7aa +Subproject commit a2d2f03107eecd45462cd61a678035132cf06326 diff --git a/pl/yio.yap b/pl/yio.yap index c0f674744..e6836643d 100644 --- a/pl/yio.yap +++ b/pl/yio.yap @@ -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]) :-