diff --git a/C/absmi.c b/C/absmi.c index e6acff277..ee02b96f6 100755 --- a/C/absmi.c +++ b/C/absmi.c @@ -2702,7 +2702,9 @@ Yap_absmi(int inp) /* don't do a creep here; also, if our instruction is followed by a execute_c, just wait a bit more */ - if (ActiveSignals & YAP_CREEP_SIGNAL || + if ( (ActiveSignals & YAP_CREEP_SIGNAL && + /* keep on going if there is something else */ + !(ActiveSignals & ~YAP_CREEP_SIGNAL)) || (PREG->opc != Yap_opcode(_procceed) && PREG->opc != Yap_opcode(_cut_e))) { GONext(); @@ -4261,17 +4263,17 @@ Yap_absmi(int inp) ENDD(d0); ENDOp(); - Op(get_bigint, xc); + Op(get_bigint, xN); #ifdef USE_GMP BEGD(d0); - d0 = XREG(PREG->u.xc.x); + d0 = XREG(PREG->u.xN.x); deref_head(d0, gbigint_unk); gbigint_nonvar: if (!IsApplTerm(d0)) FAIL(); /* we have met a preexisting bigint */ - START_PREFETCH(xc); + START_PREFETCH(xN); BEGP(pt0); pt0 = RepAppl(d0); /* check functor */ @@ -4279,9 +4281,9 @@ Yap_absmi(int inp) { FAIL(); } - if (Yap_gmp_tcmp_big_big(d0,PREG->u.xc.c)) + if (Yap_gmp_tcmp_big_big(d0,PREG->u.xN.b)) FAIL(); - PREG = NEXTOP(PREG, xc); + PREG = NEXTOP(PREG, xN); ENDP(pt0); /* enter read mode */ GONext(); @@ -4291,10 +4293,10 @@ Yap_absmi(int inp) deref_body(d0, pt0, gbigint_unk, gbigint_nonvar); /* Enter Write mode */ /* set d1 to be the new structure we are going to create */ - START_PREFETCH(xc); + START_PREFETCH(xN); BEGD(d1); - d1 = PREG->u.xc.c; - PREG = NEXTOP(PREG, xc); + d1 = PREG->u.xN.b; + PREG = NEXTOP(PREG, xN); BIND(pt0, d1, bind_gbigint); #ifdef COROUTINING DO_TRAIL(pt0, d1); @@ -4313,16 +4315,16 @@ Yap_absmi(int inp) ENDOp(); - Op(get_dbterm, xc); + Op(get_dbterm, xD); BEGD(d0); - d0 = XREG(PREG->u.xc.x); + d0 = XREG(PREG->u.xD.x); deref_head(d0, gdbterm_unk); gdbterm_nonvar: BEGD(d1); /* we have met a preexisting dbterm */ - d1 = PREG->u.xc.c; - PREG = NEXTOP(PREG, xc); + d1 = PREG->u.xD.D; + PREG = NEXTOP(PREG, xD); UnifyBound(d0,d1); ENDD(d1); @@ -4330,10 +4332,10 @@ Yap_absmi(int inp) deref_body(d0, pt0, gdbterm_unk, gdbterm_nonvar); /* Enter Write mode */ /* set d1 to be the new structure we are going to create */ - START_PREFETCH(xc); + START_PREFETCH(xD); BEGD(d1); - d1 = PREG->u.xc.c; - PREG = NEXTOP(PREG, xc); + d1 = PREG->u.xD.D; + PREG = NEXTOP(PREG, xD); BIND(pt0, d1, bind_gdbterm); #ifdef COROUTINING DO_TRAIL(pt0, d1); @@ -6347,7 +6349,7 @@ Yap_absmi(int inp) GONext(); ENDOp(); - Op(unify_bigint, oc); + Op(unify_bigint, oN); #ifdef USE_GMP BEGD(d0); BEGP(pt0); @@ -6368,16 +6370,16 @@ Yap_absmi(int inp) FAIL(); } ENDD(d1); - if (Yap_gmp_tcmp_big_big(d0,PREG->u.oc.c)) + if (Yap_gmp_tcmp_big_big(d0,PREG->u.oN.b)) FAIL(); - PREG = NEXTOP(PREG, oc); + PREG = NEXTOP(PREG, oN); ENDP(pt0); GONext(); derefa_body(d0, pt0, ubigint_unk, ubigint_nonvar); BEGD(d1); - d1 = PREG->u.oc.c; - PREG = NEXTOP(PREG, oc); + d1 = PREG->u.oN.b; + PREG = NEXTOP(PREG, oN); BIND_GLOBAL(pt0, d1, bind_ubigint); #ifdef COROUTINING DO_TRAIL(pt0, d1); @@ -6393,7 +6395,7 @@ Yap_absmi(int inp) #endif ENDOp(); - Op(unify_l_bigint, oc); + Op(unify_l_bigint, oN); #ifdef USE_GMP BEGD(d0); CACHE_S(); @@ -6413,16 +6415,16 @@ Yap_absmi(int inp) FAIL(); } ENDD(d0); - if (Yap_gmp_tcmp_big_big(d0,PREG->u.oc.c)) + if (Yap_gmp_tcmp_big_big(d0,PREG->u.oN.b)) FAIL(); - PREG = NEXTOP(PREG, oc); + PREG = NEXTOP(PREG, oN); ENDP(pt0); GONext(); derefa_body(d0, S_SREG, ulbigint_unk, ulbigint_nonvar); BEGD(d1); - d1 = PREG->u.oc.c; - PREG = NEXTOP(PREG, oc); + d1 = PREG->u.oN.b; + PREG = NEXTOP(PREG, oN); BIND_GLOBAL(S_SREG, d1, bind_ulbigint); #ifdef COROUTINING DO_TRAIL(S_SREG, d1); @@ -6438,7 +6440,7 @@ Yap_absmi(int inp) #endif ENDOp(); - Op(unify_dbterm, oc); + Op(unify_dbterm, oD); BEGD(d0); BEGP(pt0); pt0 = SREG++; @@ -6447,15 +6449,15 @@ Yap_absmi(int inp) udbterm_nonvar: BEGD(d1); /* we have met a preexisting dbterm */ - d1 = PREG->u.oc.c; - PREG = NEXTOP(PREG, oc); + d1 = PREG->u.oD.D; + PREG = NEXTOP(PREG, oD); UnifyBound(d0,d1); ENDD(d1); derefa_body(d0, pt0, udbterm_unk, udbterm_nonvar); BEGD(d1); - d1 = PREG->u.oc.c; - PREG = NEXTOP(PREG, oc); + d1 = PREG->u.oD.D; + PREG = NEXTOP(PREG, oD); BIND_GLOBAL(pt0, d1, bind_udbterm); #ifdef COROUTINING DO_TRAIL(pt0, d1); @@ -6468,7 +6470,7 @@ Yap_absmi(int inp) ENDD(d0); ENDOp(); - Op(unify_l_dbterm, oc); + Op(unify_l_dbterm, oD); BEGD(d0); CACHE_S(); READ_IN_S(); @@ -6477,15 +6479,15 @@ Yap_absmi(int inp) uldbterm_nonvar: BEGD(d1); /* we have met a preexisting dbterm */ - d1 = PREG->u.oc.c; - PREG = NEXTOP(PREG, oc); + d1 = PREG->u.oD.D; + PREG = NEXTOP(PREG, oD); UnifyBound(d0,d1); ENDD(d1); derefa_body(d0, S_SREG, uldbterm_unk, uldbterm_nonvar); BEGD(d1); - d1 = PREG->u.oc.c; - PREG = NEXTOP(PREG, oc); + d1 = PREG->u.oD.D; + PREG = NEXTOP(PREG, oD); BIND_GLOBAL(S_SREG, d1, bind_uldbterm); #ifdef COROUTINING DO_TRAIL(S_SREG, d1); @@ -6907,8 +6909,26 @@ Yap_absmi(int inp) GONext(); ENDD(d0); ENDOp(); + + Op(put_dbterm, xD); + BEGD(d0); + d0 = PREG->u.xD.D; + XREG(PREG->u.xD.x) = d0; + PREG = NEXTOP(PREG, xD); + GONext(); + ENDD(d0); + ENDOp(); - Op(put_float, xd); + Op(put_bigint, xN); + BEGD(d0); + d0 = PREG->u.xN.b; + XREG(PREG->u.xN.x) = d0; + PREG = NEXTOP(PREG, xN); + GONext(); + ENDD(d0); + ENDOp(); + + Op(put_float, xd); BEGD(d0); d0 = AbsAppl(PREG->u.xd.d); XREG(PREG->u.xd.x) = d0; @@ -7101,6 +7121,24 @@ Yap_absmi(int inp) GONext(); ENDOp(); + Op(write_bigint, N); + BEGD(d0); + d0 = PREG->u.N.b; + *SREG++ = d0; + ENDD(d0); + PREG = NEXTOP(PREG, N); + GONext(); + ENDOp(); + + Op(write_dbterm, D); + BEGD(d0); + d0 = PREG->u.D.D; + *SREG++ = d0; + ENDD(d0); + PREG = NEXTOP(PREG, D); + GONext(); + ENDOp(); + Op(write_float, d); BEGD(d0); d0 = AbsAppl(PREG->u.d.d); diff --git a/C/agc.c b/C/agc.c index fe13d64bb..d81b692ac 100755 --- a/C/agc.c +++ b/C/agc.c @@ -114,20 +114,6 @@ AtomAdjust(Atom a) static Term AdjustDBTerm(Term, Term *); -static Term -CodeComposedTermAdjust(Term t) -{ - Term *base; - - if (IsApplTerm(t)) { - base = RepAppl(t); - } else { - base = RepPair(t); - } - return AdjustDBTerm(t, base); -} - - #define IsOldCode(P) FALSE #define IsOldCodeCellPtr(P) FALSE #define IsOldDelay(P) FALSE @@ -161,7 +147,7 @@ CodeComposedTermAdjust(Term t) #define ModEntryPtrAdjust(P) (P) #define AtomEntryAdjust(P) (P) #define GlobalEntryAdjust(P) (P) -#define BlobTermAdjust(P) (P) +#define BlobTermInCodeAdjust(P) (P) #define CellPtoHeapAdjust(P) (P) #define PtoAtomHashEntryAdjust(P) (P) #define CellPtoHeapCellAdjust(P) (P) diff --git a/C/amasm.c b/C/amasm.c index c66965342..c5702d73a 100755 --- a/C/amasm.c +++ b/C/amasm.c @@ -1083,15 +1083,15 @@ a_uc(CELL rnd1, op_numbers opcode, op_numbers opcode_w, yamop *code_p, int pass_ } inline static yamop * -a_blob(CELL rnd1, op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, struct intermediates *cip) +a_wblob(CELL rnd1, op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, struct intermediates *cip) { if (pass_no) { code_p->opc = emit_op(opcode); - code_p->u.c.c = + code_p->u.N.b = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[rnd1])); } *clause_has_blobsp = TRUE; - GONEXT(c); + GONEXT(N); return code_p; } @@ -1117,11 +1117,11 @@ a_wdbt(CELL rnd1, op_numbers opcode, int *clause_has_dbtermp, yamop *code_p, int { if (pass_no) { code_p->opc = emit_op(opcode); - code_p->u.c.c = rnd1; + code_p->u.D.D = rnd1; add_to_dbtermsl(cip, cip->cpc->rnd1); } *clause_has_dbtermp = TRUE; - GONEXT(c); + GONEXT(D); return code_p; } @@ -1130,13 +1130,13 @@ a_ublob(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_blobs { if (pass_no) { code_p->opc = emit_op(opcode); - code_p->u.oc.opcw = emit_op(opcode_w); - code_p->u.oc.c = + code_p->u.oN.opcw = emit_op(opcode_w); + code_p->u.oN.b = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[rnd1])); } *clause_has_blobsp = TRUE; - GONEXT(oc); + GONEXT(oN); return code_p; } @@ -1145,12 +1145,12 @@ a_udbt(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_dbterm { if (pass_no) { code_p->opc = emit_op(opcode); - code_p->u.oc.opcw = emit_op(opcode_w); - code_p->u.oc.c = cip->cpc->rnd1; + code_p->u.oD.opcw = emit_op(opcode_w); + code_p->u.oD.D = cip->cpc->rnd1; add_to_dbtermsl(cip, cip->cpc->rnd1); } *clause_has_dbtermp = TRUE; - GONEXT(oc); + GONEXT(oD); return code_p; } @@ -1372,11 +1372,11 @@ a_rb(op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, stru { if (pass_no) { code_p->opc = emit_op(opcode); - code_p->u.xc.x = emit_x(cip->cpc->rnd2); - code_p->u.xc.c = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1])); + code_p->u.xN.x = emit_x(cip->cpc->rnd2); + code_p->u.xN.b = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1])); } *clause_has_blobsp = TRUE; - GONEXT(xc); + GONEXT(xN); return code_p; } @@ -1385,12 +1385,12 @@ a_dbt(op_numbers opcode, int *clause_has_dbtermp, yamop *code_p, int pass_no, st { if (pass_no) { code_p->opc = emit_op(opcode); - code_p->u.xc.x = emit_x(cip->cpc->rnd2); - code_p->u.xc.c = cip->cpc->rnd1; + code_p->u.xD.x = emit_x(cip->cpc->rnd2); + code_p->u.xD.D = cip->cpc->rnd1; add_to_dbtermsl(cip, cip->cpc->rnd1); } *clause_has_dbtermp = TRUE; - GONEXT(xc); + GONEXT(xD); return code_p; } @@ -1480,7 +1480,7 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, struct i op = _p_equal; /* just to make some compilers happy */ Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "internal assembler error for built-in (%d)", (Flags & 0x7f)); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); } if (is_test) { UInt lab; @@ -1503,7 +1503,7 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, struct i Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "user defined predicate cannot be a test predicate"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); } else code_p->opc = emit_op(_call_c_wfail); code_p->u.slp.s = @@ -2053,7 +2053,7 @@ a_try(op_numbers opcode, CELL lab, CELL opr, int nofalts, int hascut, yamop *cod if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) { /* OOOPS, got in trouble, must do a longjmp and recover space */ save_machine_regs(); - _longjmp(cip->CompilerBotch,2); + siglongjmp(cip->CompilerBotch,2); } Yap_LUIndexSpace_CP += size; #ifdef DEBUG @@ -2693,7 +2693,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _plus: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for +/2 (should be XC)"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _minus: code_p->opc = emit_op(_p_minus_y_cv); @@ -2701,7 +2701,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _times: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for */2 (should be XC)"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _div: code_p->opc = emit_op(_p_div_y_cv); @@ -2709,12 +2709,12 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _and: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for /\\/2 (should be XC)"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _or: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for \\//2 (should be XC)"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _sll: code_p->opc = emit_op(_p_sll_y_cv); @@ -2744,7 +2744,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _minus: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error XC for -/2"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _times: code_p->opc = emit_op(_p_times_y_vc); @@ -2777,7 +2777,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _arg: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error for arg/3"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _functor: code_p->opc = emit_op(_p_func2s_y_vc); @@ -2838,7 +2838,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _plus: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for +/2"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _minus: code_p->opc = emit_op(_p_minus_cv); @@ -2846,7 +2846,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _times: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for */2"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _div: code_p->opc = emit_op(_p_div_cv); @@ -2854,12 +2854,12 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _and: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for /\\/2"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _or: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for \\//2"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _sll: code_p->opc = emit_op(_p_sll_cv); @@ -2889,7 +2889,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _minus: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error XC for -/2"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _times: code_p->opc = emit_op(_p_times_vc); @@ -2922,7 +2922,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci case _arg: Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error for arg/3"); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); break; case _functor: code_p->opc = emit_op(_p_func2s_vc); @@ -3248,10 +3248,10 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp code_p = a_ri(_put_longint, code_p, pass_no, cip->cpc); break; case put_bigint_op: - code_p = a_rb(_put_atom, clause_has_blobsp, code_p, pass_no, cip); + code_p = a_rb(_put_bigint, clause_has_blobsp, code_p, pass_no, cip); break; case put_dbterm_op: - code_p = a_dbt(_put_atom, clause_has_dbtermp, code_p, pass_no, cip); + code_p = a_dbt(_put_dbterm, clause_has_dbtermp, code_p, pass_no, cip); break; case get_list_op: code_p = a_glist(&do_not_optimise_uatom, code_p, pass_no, cip); @@ -3344,10 +3344,10 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp code_p = a_wi(_write_longint, code_p, pass_no, cip->cpc); break; case write_bigint_op: - code_p = a_blob(cip->cpc->rnd1, _write_atom, clause_has_blobsp, code_p, pass_no, cip); + code_p = a_wblob(cip->cpc->rnd1, _write_bigint, clause_has_blobsp, code_p, pass_no, cip); break; case write_dbterm_op: - code_p = a_wdbt(cip->cpc->rnd1, _write_atom, clause_has_dbtermp, code_p, pass_no, cip); + code_p = a_wdbt(cip->cpc->rnd1, _write_dbterm, clause_has_dbtermp, code_p, pass_no, cip); break; case unify_list_op: code_p = a_ue(_unify_list, _unify_list_write, code_p, pass_no); @@ -3540,7 +3540,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp if (CellPtr(cip->label_offset+cip->cpc->rnd1) > ASP-256) { Yap_Error_Size = 256+((char *)(cip->label_offset+cip->cpc->rnd1) - (char *)H); save_machine_regs(); - _longjmp(cip->CompilerBotch, 3); + siglongjmp(cip->CompilerBotch, 3); } if ( (char *)(cip->label_offset+cip->cpc->rnd1) >= cip->freep) cip->freep = (char *)(cip->label_offset+(cip->cpc->rnd1+1)); @@ -3722,7 +3722,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp if (cip->cpc->nextInst->op != bccall_op) { Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "compiling binary test", (int) cip->cpc->op); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); } code_p = a_bfunc(cip->cpc->nextInst->rnd2, &clinfo, code_p, pass_no, cip); break; @@ -3762,7 +3762,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp default: Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "instruction %d found while assembling", (int) cip->cpc->op); save_machine_regs(); - _longjmp(cip->CompilerBotch, 1); + siglongjmp(cip->CompilerBotch, 1); } cip->cpc = cip->cpc->nextInst; } @@ -3788,7 +3788,7 @@ fetch_clause_space(Term* tp, UInt size, struct intermediates *cip, UInt *osizep) case OUT_OF_STACK_ERROR: Yap_Error_Size = 256+((char *)cip->freep - (char *)H); save_machine_regs(); - _longjmp(cip->CompilerBotch,3); + siglongjmp(cip->CompilerBotch,3); case OUT_OF_TRAIL_ERROR: /* don't just return NULL */ ARG1 = *tp; @@ -3865,7 +3865,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates Yap_LabelFirstArraySz = DEFAULT_NLABELS; if (!Yap_LabelFirstArray) { save_machine_regs(); - _longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); + siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); } } if (Yap_LabelFirstArray && max_label <= Yap_LabelFirstArraySz) { @@ -3874,7 +3874,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates cip->label_offset = (Int *)Yap_AllocCodeSpace(sizeof(Int)*max_label); if (!cip->label_offset) { save_machine_regs(); - _longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); + siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); } } } diff --git a/C/cdmgr.c b/C/cdmgr.c index 46cc99f1e..8a1929aa7 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -771,8 +771,10 @@ get_pred(Term t, Term tmod, char *pname) #define ModuleAdjust(X) (X) #define ExternalFunctionAdjust(X) (X) #define AdjustSwitchTable(X,Y,Z) +#define DBGroundTermAdjust(X) (X) #define rehash(A,B,C) -static Term BlobTermAdjust(Term t) + +static Term BlobTermInCodeAdjust(Term t) { #if TAGS_FAST_OPS return t-ClDiff; @@ -781,22 +783,12 @@ static Term BlobTermAdjust(Term t) #endif } -static Term ConstantTermAdjust (Term); - static Term ConstantTermAdjust (Term t) { if (IsAtomTerm(t)) return AtomTermAdjust(t); - else if (IsIntTerm(t)) - return t; - else if (IsApplTerm(t) && IsBlobFunctor(FunctorOfTerm(t))) { - return BlobTermAdjust(t); - } else if (IsApplTerm(t) || IsPairTerm(t)) { - return CodeComposedTermAdjust(t); - } else { - return t; - } + return t; } diff --git a/C/compiler.c b/C/compiler.c index dcd8ca7b1..8c949b142 100755 --- a/C/compiler.c +++ b/C/compiler.c @@ -533,7 +533,7 @@ optimize_ce(Term t, unsigned int arity, unsigned int level, compiler_struct *cgl if (H >= (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } p->NextCE = cglobs->common_exps; cglobs->common_exps = p; @@ -568,7 +568,7 @@ compile_sf_term(Term t, int argno, int level) Yap_Error_Term = TermNil; Yap_ErrorMessage = "illegal argument of soft functor"; save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } else c_var(t, -argno, arity, level, cglobs); @@ -595,7 +595,7 @@ c_args(Term app, unsigned int level, compiler_struct *cglobs) Yap_Error_Term = TermNil; Yap_ErrorMessage = "exceed maximum arity of compiled goal"; save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } if (Arity > cglobs->max_args) cglobs->max_args = Arity; @@ -615,7 +615,7 @@ try_store_as_dbterm(Term t, Int argno, unsigned int arity, int level, compiler_s /* oops, too deep a term */ save_machine_regs(); Yap_Error_Size = 0; - _longjmp(cglobs->cint.CompilerBotch, OUT_OF_AUX_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_AUX_BOTCH); } if (g < 16) return FALSE; @@ -626,18 +626,18 @@ try_store_as_dbterm(Term t, Int argno, unsigned int arity, int level, compiler_s switch(Yap_Error_TYPE) { case OUT_OF_STACK_ERROR: Yap_Error_TYPE = YAP_NO_ERROR; - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_STACK_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_STACK_BOTCH); case OUT_OF_TRAIL_ERROR: Yap_Error_TYPE = YAP_NO_ERROR; - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TRAIL_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TRAIL_BOTCH); case OUT_OF_HEAP_ERROR: Yap_Error_TYPE = YAP_NO_ERROR; - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_HEAP_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_HEAP_BOTCH); case OUT_OF_AUXSPACE_ERROR: Yap_Error_TYPE = YAP_NO_ERROR; - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_AUX_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_AUX_BOTCH); default: - _longjmp(cglobs->cint.CompilerBotch,COMPILER_ERR_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,COMPILER_ERR_BOTCH); } } H = h0; @@ -1004,7 +1004,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/2 with output bound", s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } } } else { /* t1 is bound */ @@ -1019,7 +1019,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/3",s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } } else { if (Op == _functor) { @@ -1035,7 +1035,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling functor/3"); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } i2 = IntegerOfTerm(t2); if (i2 < 0) { @@ -1047,7 +1047,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling functor/3"); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } if (IsNumTerm(t1)) { /* we will always fail */ @@ -1062,7 +1062,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling functor/3"); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } if (i2 == 0) c_eq(t1, t3, cglobs); @@ -1074,7 +1074,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler if (H+2 >= (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } RESET_VARIABLE(H); RESET_VARIABLE(H+1); @@ -1086,7 +1086,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler if (H >= (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } RESET_VARIABLE(H); H++; @@ -1098,7 +1098,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Prop p0 = PredPropByFunc(f, mod); if (EndOfPAEntr(p0)) { save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); } c_args(Goal, 0, cglobs); Yap_emit(safe_call_op, (CELL)p0 , Zero, &cglobs->cint); @@ -1120,7 +1120,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/2", s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } if (IsAtomicTerm(t2) || (IsApplTerm(t2) && IsExtensionFunctor(FunctorOfTerm(t2)))) { @@ -1132,7 +1132,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/2", s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } else if (IsApplTerm(t2)) { Functor f = FunctorOfTerm(t2); if (i1 < 1 || i1 > ArityOfFunctor(f)) { @@ -1163,7 +1163,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/2", s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } } if (Op == _functor) { @@ -1176,7 +1176,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/2", s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } else { if (!IsVarTerm(t2)) { Int arity; @@ -1191,7 +1191,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/2", s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } arity = IntOfTerm(t2); if (arity < 0) { @@ -1209,12 +1209,12 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/2", s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } if (H+1+arity >= (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } tnew = AbsAppl(H); *H++ = (CELL)Yap_MkFunctor(AtomOfTerm(t1),arity); @@ -1253,7 +1253,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/2 with output bound", s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } } /* then we compile the opcode/result */ @@ -1263,7 +1263,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler if (H == (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } c_var(tmpvar,f_flag,(unsigned int)Op, 0, cglobs); c_eq(tmpvar,t3, cglobs); @@ -1276,7 +1276,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler Yap_bip_name(Op, s); sprintf(Yap_ErrorMessage, "compiling %s/2 with input unbound", s); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } } else if (IsNewVar(t3) && cglobs->curbranch == 0 && cglobs->cint.CurrentPred->PredFlags & TabledPredFlag) { Term nv = MkVarTerm(); @@ -1342,7 +1342,7 @@ c_functor(Term Goal, Term mod, compiler_struct *cglobs) if (EndOfPAEntr(p0)) { save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); } if (profiling) Yap_emit(enter_profiling_op, (CELL)RepPredProp(p0), Zero, &cglobs->cint); @@ -1443,7 +1443,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) Yap_Error_Term = M; Yap_ErrorMessage = "in module name"; save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } Goal = ArgOfTerm(2, Goal); mod = M; @@ -1561,7 +1561,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) p = RepPredProp(p0 = Yap_PredPropByAtomNonThreadLocal(atom, mod)); if (EndOfPAEntr(p0)) { save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); } /* if we are profiling, make sure we register we entered this predicate */ if (profiling) @@ -1574,7 +1574,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) p = RepPredProp(p0 = Yap_PredPropByFunctorNonThreadLocal(f, mod)); if (EndOfPAEntr(p0)) { save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); } if (f == FunctorOr || f == FunctorVBar) { Term arg; @@ -1649,7 +1649,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) if (H == (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } savecpc = cglobs->cint.cpc; savencpc = FirstP->nextInst; @@ -1732,7 +1732,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) if (H == (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } push_branch(cglobs->onbranch, commitvar, cglobs); ++cglobs->curbranch; @@ -1767,7 +1767,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) if (H == (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } cglobs->onlast = FALSE; c_var(commitvar, save_b_flag, 1, 0, cglobs); @@ -1882,7 +1882,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) Yap_ErrorMessage = Yap_ErrorSay; sprintf(Yap_ErrorMessage, "compiling %s/2 with second arg unbound", RepAtom(NameOfFunctor(p->FunctorOfPred))->StrOfAE); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,1); + siglongjmp(cglobs->cint.CompilerBotch,1); } c_var(a1, bt1_flag, 2, 0, cglobs); cglobs->current_p0 = p0; @@ -1893,7 +1893,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) if (H == (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } c_eq(t2, a2, cglobs); c_var(a1, bt1_flag, 2, 0, cglobs); @@ -1906,7 +1906,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) if (H == (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } c_eq(t1, a1, cglobs); @@ -1920,7 +1920,7 @@ c_goal(Term Goal, Term mod, compiler_struct *cglobs) if (H == (CELL *)cglobs->cint.freep0) { /* oops, too many new variables */ save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TEMPS_BOTCH); } c_eq(t2, a2, cglobs); c_var(t1, bt1_flag, 2, 0, cglobs); @@ -2287,7 +2287,7 @@ clear_bvarray(int var, CELL *bvarray Yap_ErrorMessage = "compiler internal error: variable initialised twice"; fprintf(stderr," vsc: compiling7\n"); save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } cglobs->pbvars++; #endif @@ -2328,7 +2328,7 @@ push_bvmap(int label, PInstr *pcpc, compiler_struct *cglobs) Yap_Error_Term = TermNil; Yap_ErrorMessage = "Too many embedded disjunctions"; save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } /* the label instruction */ bvstack[bvindex].lab = label; @@ -2351,7 +2351,7 @@ reset_bvmap(CELL *bvarray, int nperm, compiler_struct *cglobs) Yap_Error_Term = TermNil; Yap_ErrorMessage = "No embedding in disjunctions"; save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } env_size = (bvstack[bvindex-1].pc)->rnd1; size = env_size/(8*sizeof(CELL)); @@ -2371,7 +2371,7 @@ pop_bvmap(CELL *bvarray, int nperm, compiler_struct *cglobs) Yap_Error_Term = TermNil; Yap_ErrorMessage = "Too few embedded disjunctions"; /* save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); */ + siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); */ } reset_bvmap(bvarray, nperm, cglobs); bvindex--; @@ -2641,7 +2641,7 @@ checktemp(Int arg, Int rn, compiler_vm_op ic, compiler_struct *cglobs) Yap_Error_Term = TermNil; Yap_ErrorMessage = "too many temporaries"; save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, COMPILER_ERR_BOTCH); } v->NoOfVE = cglobs->vadr = vadr = TempVar | target1; v->KindOfVE = TempVar; @@ -2774,7 +2774,7 @@ c_layout(compiler_struct *cglobs) Yap_Error_Term = TermNil; Yap_ErrorMessage = "wrong number of variables found in bitmap"; save_machine_regs(); - _longjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); + siglongjmp(cglobs->cint.CompilerBotch, OUT_OF_HEAP_BOTCH); } #endif } @@ -3319,7 +3319,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src) /* make sure we know there was no error yet */ Yap_ErrorMessage = NULL; - if ((botch_why = _setjmp(cglobs.cint.CompilerBotch))) { + if ((botch_why = sigsetjmp(cglobs.cint.CompilerBotch, 0))) { restore_machine_regs(); reset_vars(cglobs.vtable); Yap_ReleaseCMem(&cglobs.cint); @@ -3420,7 +3420,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src) cglobs.vtable = NULL; Yap_Error_Size = (256+maxvnum)*sizeof(CELL); save_machine_regs(); - _longjmp(cglobs.cint.CompilerBotch,3); + siglongjmp(cglobs.cint.CompilerBotch,3); } cglobs.Uses = (Int *)(H+maxvnum); cglobs.Contents = (Term *)(H+maxvnum+(sizeof(Int)/sizeof(CELL))*MaxTemps); diff --git a/C/computils.c b/C/computils.c index 2011bfe8c..27bac4e7a 100755 --- a/C/computils.c +++ b/C/computils.c @@ -122,7 +122,7 @@ AllocCMem (UInt size, struct intermediates *cip) if (!p) { Yap_Error_Size = size; save_machine_regs(); - _longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); + siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); } Yap_CMemFirstBlock = p; Yap_CMemFirstBlockSz = blksz; @@ -132,7 +132,7 @@ AllocCMem (UInt size, struct intermediates *cip) if (!p) { Yap_Error_Size = size; save_machine_regs(); - _longjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); + siglongjmp(cip->CompilerBotch, OUT_OF_HEAP_BOTCH); } } p->u.next = cip->blks; @@ -152,7 +152,7 @@ AllocCMem (UInt size, struct intermediates *cip) if (ASP <= CellPtr (cip->freep) + 256) { Yap_Error_Size = 256+((char *)cip->freep - (char *)H); save_machine_regs(); - _longjmp(cip->CompilerBotch, OUT_OF_STACK_BOTCH); + siglongjmp(cip->CompilerBotch, OUT_OF_STACK_BOTCH); } return (p); #endif diff --git a/C/heapgc.c b/C/heapgc.c index 53b51e8c1..38addd69b 100755 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -165,7 +165,7 @@ gc_growtrail(int committed, tr_fr_ptr begsTR, cont *old_cont_top0) #endif /* could not find more trail */ save_machine_regs(); - _longjmp(Yap_gc_restore, 2); + siglongjmp(Yap_gc_restore, 2); } } @@ -425,7 +425,7 @@ check_pr_trail(tr_fr_ptr trp) if (!Yap_growtrail(0, TRUE) || TRUE) { /* could not find more trail */ save_machine_regs(); - _longjmp(Yap_gc_restore, 2); + siglongjmp(Yap_gc_restore, 2); } } } @@ -3782,7 +3782,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop) } #endif time_start = Yap_cputime(); - if (_setjmp(Yap_gc_restore) == 2) { + if (sigsetjmp(Yap_gc_restore, 0) == 2) { UInt sz; /* we cannot recover, fail system */ diff --git a/C/index.c b/C/index.c index cbf541a6b..7e0425c96 100644 --- a/C/index.c +++ b/C/index.c @@ -188,7 +188,7 @@ * Revision 1.150 2005/12/23 00:20:13 vsc * updates to gprof * support for __POWER__ -* Try to saveregs before _longjmp. +* Try to saveregs before siglongjmp. * * Revision 1.149 2005/12/17 03:25:39 vsc * major changes to support online event-based profiling @@ -832,14 +832,14 @@ sort_group(GroupDef *grp, CELL *top, struct intermediates *cint) if (!(base = (CELL *)Yap_AllocCodeSpace(2*max*sizeof(CELL)))) { save_machine_regs(); Yap_Error_Size = 2*max*sizeof(CELL); - _longjmp(cint->CompilerBotch,2); + siglongjmp(cint->CompilerBotch,2); } #else base = top; while (top+2*max > (CELL *)Yap_TrailTop) { if (!Yap_growtrail(2*max*CellSize, TRUE)) { save_machine_regs(); - _longjmp(cint->CompilerBotch,4); + siglongjmp(cint->CompilerBotch,4); return; } } @@ -2046,11 +2046,11 @@ groups_in(ClauseDef *min, ClauseDef *max, GroupDef *grp, struct intermediates *c Yap_Error_Size = sz; /* grow stack */ save_machine_regs(); - _longjmp(cint->CompilerBotch,4); + siglongjmp(cint->CompilerBotch,4); #else if (!Yap_growtrail(sz, TRUE)) { save_machine_regs(); - _longjmp(cint->CompilerBotch,4); + siglongjmp(cint->CompilerBotch,4); return 0; } #endif @@ -2179,7 +2179,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_ if (cl == NULL) { /* grow stack */ save_machine_regs(); - _longjmp(cint->CompilerBotch,2); + siglongjmp(cint->CompilerBotch,2); } Yap_LUIndexSpace_SW += sz; cl->ClFlags = SwitchTableMask|LogUpdMask|func_mask; @@ -2199,7 +2199,7 @@ emit_switch_space(UInt n, UInt item_size, struct intermediates *cint, CELL func_ if (cl == NULL) { /* grow stack */ save_machine_regs(); - _longjmp(cint->CompilerBotch,2); + siglongjmp(cint->CompilerBotch,2); } Yap_IndexSpace_SW += sz; cl->ClFlags = SwitchTableMask; @@ -2518,7 +2518,7 @@ suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, struct intermedi sz = (UInt)NEXTOP((yamop *)NULL,sssllp)+tels*sizeof(yamop *); if ((ncode = (yamop *)Yap_AllocCodeSpace(sz)) == NULL) { save_machine_regs(); - _longjmp(cint->CompilerBotch, 2); + siglongjmp(cint->CompilerBotch, 2); } #if DEBUG Yap_ExpandClauses++; @@ -3130,7 +3130,7 @@ copy_clauses(ClauseDef *max0, ClauseDef *min0, CELL *top, struct intermediates * Yap_Error_Size = sz; /* grow stack */ save_machine_regs(); - _longjmp(cint->CompilerBotch,4); + siglongjmp(cint->CompilerBotch,4); } memcpy((void *)top, (void *)min0, sz); return (ClauseDef *)top; @@ -3324,7 +3324,7 @@ compile_index(struct intermediates *cint) Yap_Error_Size += NClauses*sizeof(ClauseDef); /* grow stack */ save_machine_regs(); - _longjmp(cint->CompilerBotch,2); + siglongjmp(cint->CompilerBotch,2); } } cint->freep = (char *)H; @@ -3336,7 +3336,7 @@ compile_index(struct intermediates *cint) Yap_Error_Size += NClauses*sizeof(ClauseDef); /* grow stack */ save_machine_regs(); - _longjmp(cint->CompilerBotch,3); + siglongjmp(cint->CompilerBotch,3); } cint->freep = (char *)(cint->cls+NClauses); #endif @@ -3381,7 +3381,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc) cint.cls = NULL; Yap_Error_Size = 0; - if ((setjres = _setjmp(cint.CompilerBotch)) == 3) { + if ((setjres = sigsetjmp(cint.CompilerBotch, 0)) == 3) { restore_machine_regs(); recover_from_failed_susp_on_cls(&cint, 0); if (!Yap_gcl(Yap_Error_Size, ap->ArityOfPE+NSlots, ENV, next_pc)) { @@ -3463,7 +3463,7 @@ push_stack(istack_entry *sp, Int arg, Term Tag, Term extra, struct intermediates { if (sp+1 > (istack_entry *)Yap_TrailTop) { save_machine_regs(); - _longjmp(cint->CompilerBotch,4); + siglongjmp(cint->CompilerBotch,4); } sp->pos = arg; sp->val = Tag; @@ -4349,7 +4349,7 @@ expand_index(struct intermediates *cint) { Yap_Error_Size += NClauses*sizeof(ClauseDef); /* grow stack */ save_machine_regs(); - _longjmp(cint->CompilerBotch,2); + siglongjmp(cint->CompilerBotch,2); } } #else @@ -4359,7 +4359,7 @@ expand_index(struct intermediates *cint) { Yap_Error_Size += 2*NClauses*sizeof(ClauseDef); /* grow stack */ save_machine_regs(); - _longjmp(cint->CompilerBotch,3); + siglongjmp(cint->CompilerBotch,3); } #endif if (ap->PredFlags & LogUpdatePredFlag) { @@ -4377,7 +4377,7 @@ expand_index(struct intermediates *cint) { Yap_Error_Size += NClauses*sizeof(ClauseDef); /* grow stack */ save_machine_regs(); - _longjmp(cint->CompilerBotch,2); + siglongjmp(cint->CompilerBotch,2); } } #else @@ -4386,7 +4386,7 @@ expand_index(struct intermediates *cint) { /* tell how much space we need (worst case) */ Yap_Error_Size += 2*NClauses*sizeof(ClauseDef); save_machine_regs(); - _longjmp(cint->CompilerBotch,3); + siglongjmp(cint->CompilerBotch,3); } #endif if (ap->PredFlags & LogUpdatePredFlag) { @@ -4485,7 +4485,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop) { cint.cls = NULL; cint.code_addr = NULL; cint.label_offset = NULL; - if ((cb = _setjmp(cint.CompilerBotch)) == 3) { + if ((cb = sigsetjmp(cint.CompilerBotch, 0)) == 3) { restore_machine_regs(); /* grow stack */ recover_from_failed_susp_on_cls(&cint, 0); @@ -4695,7 +4695,7 @@ push_path(path_stack_entry *sp, yamop **pipc, ClauseDef *clp, struct intermediat { if (sp+1 > (path_stack_entry *)Yap_TrailTop) { save_machine_regs(); - _longjmp(cint->CompilerBotch,4); + siglongjmp(cint->CompilerBotch,4); } sp->flag = pc_entry; sp->u.pce.pi_pc = pipc; @@ -4711,7 +4711,7 @@ fetch_new_block(path_stack_entry *sp, yamop **pipc, PredEntry *ap, struct interm { if (sp+1 > (path_stack_entry *)Yap_TrailTop) { save_machine_regs(); - _longjmp(cint->CompilerBotch,4); + siglongjmp(cint->CompilerBotch,4); } /* add current position */ sp->flag = block_entry; @@ -5484,9 +5484,9 @@ add_try(PredEntry *ap, ClauseDef *cls, yamop *next, struct intermediates *cint) LogUpdClause *lcl = ClauseCodeToLogUpdClause(cls->Code); if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) { - /* OOOPS, got in trouble, must do a _longjmp and recover space */ + /* OOOPS, got in trouble, must do a siglongjmp and recover space */ save_machine_regs(); - _longjmp(cint->CompilerBotch,2); + siglongjmp(cint->CompilerBotch,2); } Yap_LUIndexSpace_CP += size; #ifdef DEBUG @@ -5510,9 +5510,9 @@ add_trust(LogUpdIndex *icl, ClauseDef *cls, struct intermediates *cint) PredEntry *ap = lcl->ClPred; if ((newcp = (yamop *)Yap_AllocCodeSpace(size)) == NULL) { - /* OOOPS, got in trouble, must do a _longjmp and recover space */ + /* OOOPS, got in trouble, must do a siglongjmp and recover space */ save_machine_regs(); - _longjmp(cint->CompilerBotch,2); + siglongjmp(cint->CompilerBotch,2); } Yap_LUIndexSpace_CP += size; #ifdef DEBUG @@ -6000,7 +6000,7 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) { cint.CurrentPred = ap; cint.expand_block = NULL; cint.CodeStart = cint.BlobsStart = cint.cpc = cint.icpc = NIL; - if ((cb = _setjmp(cint.CompilerBotch)) == 3) { + if ((cb = sigsetjmp(cint.CompilerBotch, 0)) == 3) { restore_machine_regs(); Yap_gcl(Yap_Error_Size, ap->ArityOfPE, ENV, CP); save_machine_regs(); @@ -6476,7 +6476,7 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) { } cint.expand_block = NULL; cint.CodeStart = cint.BlobsStart = cint.cpc = cint.icpc = NULL; - if ((cb = _setjmp(cint.CompilerBotch)) == 3) { + if ((cb = sigsetjmp(cint.CompilerBotch, 0)) == 3) { restore_machine_regs(); Yap_gcl(Yap_Error_Size, ap->ArityOfPE, ENV, CP); save_machine_regs(); diff --git a/C/iopreds.c b/C/iopreds.c index dcc371bc6..76f3f9fbc 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -827,12 +827,16 @@ IOSWIPutc(int sno, int ch) static int IOSWIGetc(int sno) { - int i; + int ch; Yap_StartSlots(); - i = (SWIGetc)(Stream[sno].u.swi_stream.swi_ptr); + ch = (SWIGetc)(Stream[sno].u.swi_stream.swi_ptr); + if (ch == EOF) { + return post_process_eof(Stream+sno); + } + return post_process_read_char(ch, Stream+sno); Yap_CloseSlots(); YENV = ENV; - return i; + return ch; } /* static */ @@ -851,12 +855,16 @@ IOSWIWidePutc(int sno, int ch) static int IOSWIWideGetc(int sno) { - int i; + int ch; Yap_StartSlots(); - i = (SWIWideGetc)(Stream[sno].u.swi_stream.swi_ptr); + ch = (SWIWideGetc)(Stream[sno].u.swi_stream.swi_ptr); + if (ch == EOF) { + return post_process_eof(Stream+sno); + } + return post_process_read_char(ch, Stream+sno); Yap_CloseSlots(); YENV = ENV; - return i; + return ch; } #if USE_SOCKET @@ -4759,6 +4767,9 @@ StreamPosition(int sno) Term sargs[5]; Int cpos; cpos = Stream[sno].charcount; + if (Stream[sno].status & SWI_Stream_f) { + return Yap_get_stream_position(Stream[sno].u.swi_stream.swi_ptr); + } if (Stream[sno].stream_getc == PlUnGetc) { cpos--; } @@ -5955,10 +5966,9 @@ p_format(void) return res; } - static Int -p_format2(void) -{ /* 'format'(Stream,Control,Args) */ +format2(UInt stream_flag) +{ int old_c_stream = Yap_c_output_stream; int mem_stream = FALSE, codes_stream = FALSE; Int out; @@ -5977,7 +5987,7 @@ p_format2(void) mem_stream = TRUE; } else { /* needs to change Yap_c_output_stream for write */ - Yap_c_output_stream = CheckStream (ARG1, Output_Stream_f, "format/3"); + Yap_c_output_stream = CheckStream (ARG1, Output_Stream_f|stream_flag, "format/3"); } UNLOCK(Stream[Yap_c_output_stream].streamlock); if (Yap_c_output_stream == -1) { @@ -6009,6 +6019,18 @@ p_format2(void) return out; } +static Int +p_format2(void) +{ /* 'format'(Stream,Control,Args) */ + return format2(0); +} + +static Int +p_swi_format(void) +{ /* 'format'(Stream,Control,Args) */ + return format2(SWI_Stream_f); +} + static Int p_skip (void) @@ -6806,6 +6828,10 @@ Yap_InitIOPreds(void) Yap_InitCPred ("$tolower", 2, p_tolower, SafePredFlag|HiddenPredFlag); Yap_InitCPred ("file_base_name", 2, p_file_base_name, SafePredFlag|HiddenPredFlag); + CurrentModule = SYSTEM_MODULE; + Yap_InitCPred ("swi_format", 3, p_swi_format, SyncPredFlag); + CurrentModule = cm; + Yap_InitReadUtil (); #if USE_SOCKET Yap_InitSockets (); diff --git a/C/parser.c b/C/parser.c index 664022ce8..fed25a856 100644 --- a/C/parser.c +++ b/C/parser.c @@ -65,7 +65,7 @@ static char SccsId[] = "%W% %G%"; /* weak backtraking mechanism based on long_jump */ typedef struct jmp_buff_struct { - jmp_buf JmpBuff; + sigjmp_buf JmpBuff; } JMPBUFF; STATIC_PROTO(void GNextToken, (void)); @@ -81,7 +81,7 @@ STATIC_PROTO(Term ParseTerm, (int, JMPBUFF *)); Volatile CELL *saveH=H; \ Volatile int savecurprio=curprio; \ saveenv=FailBuff; \ - if(!_setjmp(newenv.JmpBuff)) { \ + if(!sigsetjmp(newenv.JmpBuff, 0)) { \ FailBuff = &newenv; \ S; \ FailBuff=saveenv; \ @@ -99,7 +99,7 @@ STATIC_PROTO(Term ParseTerm, (int, JMPBUFF *)); Volatile TokEntry *saveT=Yap_tokptr; \ Volatile CELL *saveH=H; \ saveenv=FailBuff; \ - if(!_setjmp(newenv.JmpBuff)) { \ + if(!sigsetjmp(newenv.JmpBuff, 0)) { \ FailBuff = &newenv; \ S; \ FailBuff=saveenv; \ @@ -113,7 +113,7 @@ STATIC_PROTO(Term ParseTerm, (int, JMPBUFF *)); } -#define FAIL _longjmp(FailBuff->JmpBuff,1) +#define FAIL siglongjmp(FailBuff->JmpBuff,1) VarEntry * Yap_LookupVar(char *var) /* lookup variable in variables table */ @@ -181,7 +181,7 @@ VarNames(VarEntry *p,Term l) VarNames(p->VarLeft,l))); if (H > ASP-4096) { save_machine_regs(); - _longjmp(Yap_IOBotch,1); + siglongjmp(Yap_IOBotch,1); } return(o); } else { @@ -706,7 +706,7 @@ Yap_Parse(void) Volatile Term t; JMPBUFF FailBuff; - if (!_setjmp(FailBuff.JmpBuff)) { + if (!sigsetjmp(FailBuff.JmpBuff, 0)) { t = ParseTerm(1200, &FailBuff); if (Yap_tokptr->Tok != Ord(eot_tok)) return (0L); diff --git a/H/Yap.h b/H/Yap.h index 194e916f5..eda704e84 100755 --- a/H/Yap.h +++ b/H/Yap.h @@ -245,11 +245,6 @@ typedef unsigned long int YAP_ULONG_LONG; #define LOW_PROF 1 #endif -#if !HAVE__SETJMP -#define _longjmp(A,B) longjmp(A,B) -#define _setjmp(A) setjmp(A) -#endif - #ifdef DEBUG extern char Yap_Option[20]; #endif diff --git a/H/YapHeap.h b/H/YapHeap.h index fe815007a..ead1a77b8 100755 --- a/H/YapHeap.h +++ b/H/YapHeap.h @@ -29,6 +29,7 @@ typedef int (*SWI_GetWideFunction)(void *); typedef int (*SWI_CloseFunction)(void *); typedef int (*SWI_FlushFunction)(void *); typedef int (*SWI_PLGetStreamFunction)(void *); +typedef int (*SWI_PLGetStreamPositionFunction)(void *); #include "../include/dswiatoms.h" diff --git a/H/YapOpcodes.h b/H/YapOpcodes.h index 740093710..8ae4247a7 100644 --- a/H/YapOpcodes.h +++ b/H/YapOpcodes.h @@ -67,8 +67,8 @@ OPCODE(get_struct ,xfa), OPCODE(get_float ,xd), OPCODE(get_longint ,xi), - OPCODE(get_bigint ,xc), - OPCODE(get_dbterm ,xc), + OPCODE(get_bigint ,xN), + OPCODE(get_dbterm ,xD), OPCODE(glist_valx ,xx), OPCODE(glist_valy ,yx), OPCODE(gl_void_varx ,xx), @@ -125,10 +125,10 @@ OPCODE(unify_longint_write ,oi), OPCODE(unify_l_longint ,oi), OPCODE(unify_l_longint_write ,oi), - OPCODE(unify_bigint ,oc), - OPCODE(unify_l_bigint ,oc), - OPCODE(unify_dbterm ,oc), - OPCODE(unify_l_dbterm ,oc), + OPCODE(unify_bigint ,oN), + OPCODE(unify_l_bigint ,oN), + OPCODE(unify_dbterm ,oD), + OPCODE(unify_l_dbterm ,oD), OPCODE(unify_list ,o), OPCODE(unify_list_write ,o), OPCODE(unify_l_list ,o), @@ -145,6 +145,8 @@ OPCODE(put_y_vals ,yyxx), OPCODE(put_unsafe ,yx), OPCODE(put_atom ,xc), + OPCODE(put_dbterm ,xD), + OPCODE(put_bigint ,xN), OPCODE(put_float ,xd), OPCODE(put_longint ,xi), OPCODE(put_list ,x), @@ -158,6 +160,8 @@ OPCODE(write_y_val ,y), OPCODE(write_y_loc ,y), OPCODE(write_atom ,c), + OPCODE(write_bigint ,N), + OPCODE(write_dbterm ,D), OPCODE(write_float ,d), OPCODE(write_longint ,i), OPCODE(write_n_atoms ,sc), diff --git a/H/Yapproto.h b/H/Yapproto.h index 5048b856f..6ac8085c9 100755 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -462,6 +462,7 @@ void STD_PROTO(Yap_InitMYDDAS_TopLevelPreds,(void)); void STD_PROTO(Yap_swi_install,(void)); void STD_PROTO(Yap_InitSWIHash,(void)); int STD_PROTO(Yap_get_stream_handle,(Term, int, int, void *)); +Term STD_PROTO(Yap_get_stream_position,(void *)); /* ypsocks.c */ void STD_PROTO(Yap_InitSockets,(void)); diff --git a/H/amidefs.h b/H/amidefs.h index c74c5263b..3ce1413fd 100644 --- a/H/amidefs.h +++ b/H/amidefs.h @@ -252,6 +252,7 @@ typedef enum { L: logic upd clause, logic_upd_clause * m: module, Term n: number, Integer + N: bigint, Blob (Term) o: opcode, OPCODE O: OR-parallel information, used by YAPOR, unsigned int p: predicate, struct pred_entry * @@ -276,6 +277,14 @@ typedef struct yami { Term c; CELL next; } c; + struct { + Term D; + CELL next; + } D; + struct { + Term b; + CELL next; + } N; struct { Term c1; Term c2; @@ -496,11 +505,21 @@ typedef struct yami { Term c; CELL next; } oc; + struct { + OPCODE opcw; + Term b; + CELL next; + } oN; struct { OPCODE opcw; CELL d[1+SIZEOF_DOUBLE/SIZEOF_INT_P]; CELL next; } od; + struct { + OPCODE opcw; + Term D; + CELL next; + } oD; struct { OPCODE opcw; Functor f; @@ -705,11 +724,21 @@ typedef struct yami { CELL c; CELL next; } xc; + struct { + wamreg x; + Term b; + CELL next; + } xN; struct { wamreg x; CELL d[1+SIZEOF_DOUBLE/SIZEOF_INT_P]; CELL next; } xd; + struct { + wamreg x; + Term D; + CELL next; + } xD; struct { wamreg x; Functor f; diff --git a/H/compile.h b/H/compile.h index 1b0a0e798..afbc18d02 100755 --- a/H/compile.h +++ b/H/compile.h @@ -263,7 +263,7 @@ typedef struct intermediates { Int *uses; Term *contents; struct pred_entry *CurrentPred; - jmp_buf CompilerBotch; + sigjmp_buf CompilerBotch; yamop *code_addr; yamop *expand_block; UInt i_labelno; diff --git a/H/dglobals.h b/H/dglobals.h index 36d72d2b4..17c514015 100644 --- a/H/dglobals.h +++ b/H/dglobals.h @@ -188,6 +188,7 @@ #define SWIClose Yap_global->swi_close #define SWIFlush Yap_global->swi_flush #define SWIGetStream Yap_global->swi_get_stream_f +#define SWIGetStreamPosition Yap_global->swi_get_stream_position_f #define Yap_AllowLocalExpansion Yap_global->allow_local_expansion #define Yap_AllowGlobalExpansion Yap_global->allow_global_expansion diff --git a/H/findclause.h b/H/findclause.h index e6fc557f2..bcc965c75 100644 --- a/H/findclause.h +++ b/H/findclause.h @@ -6,9 +6,15 @@ while (TRUE) { op_numbers op = Yap_op_from_opcode(cl->opc); switch (op) { + case _write_dbterm: + cl = NEXTOP(cl,D); + break; case _alloc_for_logical_pred: cl = NEXTOP(cl,L); break; + case _write_bigint: + cl = NEXTOP(cl,N); + break; case _ensure_space: cl = NEXTOP(cl,Osbpi); break; @@ -316,30 +322,30 @@ case _unify_void_write: cl = NEXTOP(cl,o); break; + case _unify_dbterm: + cl = NEXTOP(cl,oD); + break; + case _unify_l_dbterm: + cl = NEXTOP(cl,oD); + break; + case _unify_bigint: + cl = NEXTOP(cl,oN); + break; + case _unify_l_bigint: + cl = NEXTOP(cl,oN); + break; case _unify_atom: cl = NEXTOP(cl,oc); break; case _unify_atom_write: cl = NEXTOP(cl,oc); break; - case _unify_bigint: - cl = NEXTOP(cl,oc); - break; - case _unify_dbterm: - cl = NEXTOP(cl,oc); - break; case _unify_l_atom: cl = NEXTOP(cl,oc); break; case _unify_l_atom_write: cl = NEXTOP(cl,oc); break; - case _unify_l_bigint: - cl = NEXTOP(cl,oc); - break; - case _unify_l_dbterm: - cl = NEXTOP(cl,oc); - break; case _unify_float: cl = NEXTOP(cl,od); break; @@ -656,19 +662,28 @@ } cl = NEXTOP(cl,x); break; - case _get_atom: - if (is_regcopy(myregs, nofregs, cl->u.xc.x)) { - if (IsApplTerm(cl->u.xc.c)) { - CELL *pt = RepAppl(cl->u.xc.c); - clause->Tag = AbsAppl((CELL *)pt[0]); - clause->u.t_ptr = cl->u.xc.c; - } else - clause->Tag = cl->u.xc.c; + case _put_dbterm: + if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.xD.x))) { + clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,xc); + cl = NEXTOP(cl,xD); break; case _get_bigint: + if (is_regcopy(myregs, nofregs, cl->u.xN.x)) { + clause->Tag = cl->u.xN.b; + return; + } + cl = NEXTOP(cl,xN); + break; + case _put_bigint: + if (!(nofregs = delete_regcopy(myregs, nofregs, cl->u.xN.x))) { + clause->Tag = (CELL)NULL; + return; + } + cl = NEXTOP(cl,xN); + break; + case _get_atom: if (is_regcopy(myregs, nofregs, cl->u.xc.x)) { if (IsApplTerm(cl->u.xc.c)) { CELL *pt = RepAppl(cl->u.xc.c); diff --git a/H/headclause.h b/H/headclause.h index 9cb93cd98..a24f4df35 100644 --- a/H/headclause.h +++ b/H/headclause.h @@ -291,30 +291,30 @@ case _unify_void_write: cl = NEXTOP(cl,o); break; + case _unify_dbterm: + cl = NEXTOP(cl,oD); + break; + case _unify_l_dbterm: + cl = NEXTOP(cl,oD); + break; + case _unify_bigint: + cl = NEXTOP(cl,oN); + break; + case _unify_l_bigint: + cl = NEXTOP(cl,oN); + break; case _unify_atom: cl = NEXTOP(cl,oc); break; case _unify_atom_write: cl = NEXTOP(cl,oc); break; - case _unify_bigint: - cl = NEXTOP(cl,oc); - break; - case _unify_dbterm: - cl = NEXTOP(cl,oc); - break; case _unify_l_atom: cl = NEXTOP(cl,oc); break; case _unify_l_atom_write: cl = NEXTOP(cl,oc); break; - case _unify_l_bigint: - cl = NEXTOP(cl,oc); - break; - case _unify_l_dbterm: - cl = NEXTOP(cl,oc); - break; case _unify_float: cl = NEXTOP(cl,od); break; @@ -553,19 +553,28 @@ } cl = NEXTOP(cl,x); break; - case _get_atom: - if (iarg == cl->u.xc.x) { - if (IsApplTerm(cl->u.xc.c)) { - CELL *pt = RepAppl(cl->u.xc.c); - clause->Tag = AbsAppl((CELL *)pt[0]); - clause->u.t_ptr = cl->u.xc.c; - } else - clause->Tag = cl->u.xc.c; + case _put_dbterm: + if (iarg == cl->u.xD.x) { + clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,xc); + cl = NEXTOP(cl,xD); break; case _get_bigint: + if (iarg == cl->u.xN.x) { + clause->Tag = cl->u.xN.b; + return; + } + cl = NEXTOP(cl,xN); + break; + case _put_bigint: + if (iarg == cl->u.xN.x) { + clause->Tag = (CELL)NULL; + return; + } + cl = NEXTOP(cl,xN); + break; + case _get_atom: if (iarg == cl->u.xc.x) { if (IsApplTerm(cl->u.xc.c)) { CELL *pt = RepAppl(cl->u.xc.c); diff --git a/H/hglobals.h b/H/hglobals.h index 1e60fbbf0..87719458c 100644 --- a/H/hglobals.h +++ b/H/hglobals.h @@ -135,7 +135,7 @@ typedef struct worker_local { struct RB_red_blk_node* DB_root; struct RB_red_blk_node* DB_nil; #endif /* defined(YAPOR) || defined(THREADS) */ - jmp_buf gc_restore; + sigjmp_buf gc_restore; struct array_entry* dynamic_arrays; struct static_array_entry* static_arrays; struct global_entry* global_variables; @@ -190,6 +190,7 @@ typedef struct worker_shared { SWI_CloseFunction swi_close; SWI_FlushFunction swi_flush; SWI_PLGetStreamFunction swi_get_stream_f; + SWI_PLGetStreamPositionFunction swi_get_stream_position_f; int allow_local_expansion; int allow_global_expansion; diff --git a/H/iglobals.h b/H/iglobals.h index 978c91658..4c6012a7e 100644 --- a/H/iglobals.h +++ b/H/iglobals.h @@ -188,6 +188,7 @@ static void InitGlobal(void) { Yap_global->swi_close = NULL; Yap_global->swi_flush = NULL; Yap_global->swi_get_stream_f = NULL; + Yap_global->swi_get_stream_position_f = NULL; Yap_global->allow_local_expansion = TRUE; Yap_global->allow_global_expansion = TRUE; diff --git a/H/rclause.h b/H/rclause.h index a8dffffcf..17d715628 100644 --- a/H/rclause.h +++ b/H/rclause.h @@ -16,6 +16,11 @@ restore_opcodes(yamop *pc, yamop *max) fprintf(stderr, "%s ", Yap_op_names[op]); #endif switch (op) { + /* instructions type D */ + case _write_dbterm: + pc->u.D.D = DBGroundTermAdjust(pc->u.D.D); + pc = NEXTOP(pc,D); + break; /* instructions type Ills */ case _enter_lu_pred: pc->u.Ills.I = PtoLUIndexAdjust(pc->u.Ills.I); @@ -30,6 +35,11 @@ restore_opcodes(yamop *pc, yamop *max) pc->u.L.ClBase = PtoLUClauseAdjust(pc->u.L.ClBase); pc = NEXTOP(pc,L); break; + /* instructions type N */ + case _write_bigint: + pc->u.N.b = BlobTermInCodeAdjust(pc->u.N.b); + pc = NEXTOP(pc,N); + break; /* instructions type Osblp */ case _either: case _or_else: @@ -294,15 +304,25 @@ restore_opcodes(yamop *pc, yamop *max) pc->u.o.opcw = OpcodeAdjust(pc->u.o.opcw); pc = NEXTOP(pc,o); break; + /* instructions type oD */ + case _unify_dbterm: + case _unify_l_dbterm: + pc->u.oD.opcw = OpcodeAdjust(pc->u.oD.opcw); + pc->u.oD.D = DBGroundTermAdjust(pc->u.oD.D); + pc = NEXTOP(pc,oD); + break; + /* instructions type oN */ + case _unify_bigint: + case _unify_l_bigint: + pc->u.oN.opcw = OpcodeAdjust(pc->u.oN.opcw); + pc->u.oN.b = BlobTermInCodeAdjust(pc->u.oN.b); + pc = NEXTOP(pc,oN); + break; /* instructions type oc */ case _unify_atom: case _unify_atom_write: - case _unify_bigint: - case _unify_dbterm: case _unify_l_atom: case _unify_l_atom_write: - case _unify_l_bigint: - case _unify_l_dbterm: pc->u.oc.opcw = OpcodeAdjust(pc->u.oc.opcw); pc->u.oc.c = ConstantTermAdjust(pc->u.oc.c); pc = NEXTOP(pc,oc); @@ -525,10 +545,22 @@ restore_opcodes(yamop *pc, yamop *max) pc->u.x.x = XAdjust(pc->u.x.x); pc = NEXTOP(pc,x); break; + /* instructions type xD */ + case _get_dbterm: + case _put_dbterm: + pc->u.xD.x = XAdjust(pc->u.xD.x); + pc->u.xD.D = DBGroundTermAdjust(pc->u.xD.D); + pc = NEXTOP(pc,xD); + break; + /* instructions type xN */ + case _get_bigint: + case _put_bigint: + pc->u.xN.x = XAdjust(pc->u.xN.x); + pc->u.xN.b = BlobTermInCodeAdjust(pc->u.xN.b); + pc = NEXTOP(pc,xN); + break; /* instructions type xc */ case _get_atom: - case _get_bigint: - case _get_dbterm: case _put_atom: pc->u.xc.x = XAdjust(pc->u.xc.x); pc->u.xc.c = ConstantTermAdjust(pc->u.xc.c); diff --git a/H/rglobals.h b/H/rglobals.h index 81d3bb0e2..7aaa8d045 100644 --- a/H/rglobals.h +++ b/H/rglobals.h @@ -199,6 +199,7 @@ static void RestoreGlobal(void) { + #if HAVE_LIBREADLINE diff --git a/H/rheap.h b/H/rheap.h index e38d189e7..4011ae629 100755 --- a/H/rheap.h +++ b/H/rheap.h @@ -244,14 +244,17 @@ ConstantTermAdjust (Term t) { if (IsAtomTerm(t)) return AtomTermAdjust(t); - else if (IsIntTerm(t)) - return t; - else if (IsApplTerm(t) && IsBlobFunctor(FunctorOfTerm(t))) { - return BlobTermAdjust(t); - } else if (IsApplTerm(t) || IsPairTerm(t)) { - return CodeComposedTermAdjust(t); + return t; +} + +static Term +DBGroundTermAdjust (Term t) +{ + /* The term itself is restored by dbtermlist */ + if (IsPairTerm(t)) { + return AbsPair(PtoHeapCellAdjust(RepPair(t))); } else { - return t; + return AbsAppl(PtoHeapCellAdjust(RepAppl(t))); } } diff --git a/H/sshift.h b/H/sshift.h index 64a1f668c..96d6fdf07 100755 --- a/H/sshift.h +++ b/H/sshift.h @@ -449,10 +449,10 @@ CodeVarAdjust (Term var) #if TAGS_FAST_OPS -inline EXTERN Term BlobTermAdjust (Term); +inline EXTERN Term BlobTermInCodeAdjust (Term); inline EXTERN Term -BlobTermAdjust (Term t) +BlobTermInCodeAdjust (Term t) { return (Term) (CharP(t) - HDiff); } @@ -469,10 +469,10 @@ CodeComposedTermAdjust (Term t) #else -inline EXTERN Term BlobTermAdjust (Term); +inline EXTERN Term BlobTermInCodeAdjust (Term); inline EXTERN Term -BlobTermAdjust (Term t) +BlobTermInCodeAdjust (Term t) { return (Term) (CharP(t) + HDiff); } diff --git a/H/walkclause.h b/H/walkclause.h index f73e9114b..b5ff3d42e 100644 --- a/H/walkclause.h +++ b/H/walkclause.h @@ -9,12 +9,20 @@ op = Yap_op_from_opcode(pc->opc); /* C-code, maybe indexing */ switch (op) { + /* instructions type D */ + case _write_dbterm: + pc = NEXTOP(pc,D); + break; /* instructions type Ills */ case _enter_lu_pred: return walk_got_lu_block(pc->u.Ills.I, startp, endp); /* instructions type L */ case _alloc_for_logical_pred: return walk_got_lu_clause(pc->u.L.ClBase, startp, endp); + /* instructions type N */ + case _write_bigint: + pc = NEXTOP(pc,N); + break; /* instructions type Osblp */ case _either: case _or_else: @@ -225,15 +233,21 @@ case _unify_void_write: pc = NEXTOP(pc,o); break; + /* instructions type oD */ + case _unify_dbterm: + case _unify_l_dbterm: + pc = NEXTOP(pc,oD); + break; + /* instructions type oN */ + case _unify_bigint: + case _unify_l_bigint: + pc = NEXTOP(pc,oN); + break; /* instructions type oc */ case _unify_atom: case _unify_atom_write: - case _unify_bigint: - case _unify_dbterm: case _unify_l_atom: case _unify_l_atom_write: - case _unify_l_bigint: - case _unify_l_dbterm: pc = NEXTOP(pc,oc); break; /* instructions type od */ @@ -400,10 +414,18 @@ case _write_x_var: pc = NEXTOP(pc,x); break; + /* instructions type xD */ + case _get_dbterm: + case _put_dbterm: + pc = NEXTOP(pc,xD); + break; + /* instructions type xN */ + case _get_bigint: + case _put_bigint: + pc = NEXTOP(pc,xN); + break; /* instructions type xc */ case _get_atom: - case _get_bigint: - case _get_dbterm: case _put_atom: pc = NEXTOP(pc,xc); break; diff --git a/config.h.in b/config.h.in index 26d28cac7..f741308a0 100755 --- a/config.h.in +++ b/config.h.in @@ -167,7 +167,6 @@ #undef RETSIGTYPE #undef HAVE__NSGETENVIRON -#undef HAVE__SETJMP #undef HAVE_ACCESS #undef HAVE_ACOSH #undef HAVE_ALARM diff --git a/configure b/configure index 70f21fb5a..6e81b8aef 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67. +# Generated by GNU Autoconf 2.68. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -89,6 +89,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -214,11 +215,18 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -800,6 +808,9 @@ LIBS CPPFLAGS CXX CXXFLAGS +LDFLAGS +LIBS +CPPFLAGS CCC CPP' @@ -1206,7 +1217,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1542,7 +1553,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.67 +generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1588,7 +1599,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1626,7 +1637,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile @@ -1672,7 +1683,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1709,7 +1720,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1722,10 +1733,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1788,7 +1799,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1797,7 +1808,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -1838,7 +1849,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1852,7 +1863,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1870,7 +1881,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1882,7 +1893,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1937,7 +1948,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -2114,7 +2125,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ rm -f conftest.val fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2128,7 +2139,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -2169,7 +2180,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -2182,7 +2193,7 @@ ac_fn_c_check_member () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval "test \"\${$4+set}\"" = set; then : +if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2226,7 +2237,7 @@ fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member cat >config.log <<_ACEOF @@ -2234,7 +2245,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2492,7 +2503,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2596,7 +2607,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2636,7 +2647,7 @@ if test -z "$ac_cv_prog_CC"; then set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2689,7 +2700,7 @@ if test -z "$CC"; then set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2729,7 +2740,7 @@ if test -z "$CC"; then set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2788,7 +2799,7 @@ if test -z "$CC"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2832,7 +2843,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2887,7 +2898,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3002,7 +3013,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3045,7 +3056,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3104,7 +3115,7 @@ $as_echo "$ac_try_echo"; } >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -3115,7 +3126,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3156,7 +3167,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3166,7 +3177,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3203,7 +3214,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3281,7 +3292,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3392,7 +3403,7 @@ if test -z "$CXX"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -3436,7 +3447,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -3514,7 +3525,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : +if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3551,7 +3562,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then : +if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag @@ -3639,7 +3650,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -4202,7 +4213,7 @@ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias @@ -4218,7 +4229,7 @@ fi $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -4236,7 +4247,7 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then @@ -4251,7 +4262,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -4269,7 +4280,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } -if test "${ac_cv_target+set}" = set; then : +if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then @@ -4284,7 +4295,7 @@ fi $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' @@ -4513,7 +4524,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -4594,7 +4605,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -4634,7 +4645,7 @@ if test -z "$ac_cv_prog_RANLIB"; then set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -4686,7 +4697,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}indent; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_INDENT+set}" = set; then : +if ${ac_cv_prog_INDENT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$INDENT"; then @@ -4726,7 +4737,7 @@ if test -z "$ac_cv_prog_INDENT"; then set dummy indent; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_INDENT+set}" = set; then : +if ${ac_cv_prog_ac_ct_INDENT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_INDENT"; then @@ -4778,7 +4789,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -4818,7 +4829,7 @@ if test -z "$ac_cv_prog_AR"; then set dummy ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : +if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then @@ -4870,7 +4881,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}mpicc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_MPI_CC+set}" = set; then : +if ${ac_cv_prog_MPI_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MPI_CC"; then @@ -4910,7 +4921,7 @@ if test -z "$ac_cv_prog_MPI_CC"; then set dummy mpicc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_MPI_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_MPI_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MPI_CC"; then @@ -4961,7 +4972,7 @@ fi set dummy install-info; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_INSTALL_INFO+set}" = set; then : +if ${ac_cv_path_INSTALL_INFO+:} false; then : $as_echo_n "(cached) " >&6 else case $INSTALL_INFO in @@ -5003,7 +5014,7 @@ fi set dummy sh; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_SHELL+set}" = set; then : +if ${ac_cv_path_SHELL+:} false; then : $as_echo_n "(cached) " >&6 else case $SHELL in @@ -5050,7 +5061,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lws2_32" >&5 $as_echo_n "checking for main in -lws2_32... " >&6; } -if test "${ac_cv_lib_ws2_32_main+set}" = set; then : +if ${ac_cv_lib_ws2_32_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5078,7 +5089,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ws2_32_main" >&5 $as_echo "$ac_cv_lib_ws2_32_main" >&6; } -if test "x$ac_cv_lib_ws2_32_main" = x""yes; then : +if test "x$ac_cv_lib_ws2_32_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBWS2_32 1 _ACEOF @@ -5094,7 +5105,7 @@ fi CXX="${CXX} -mno-cygwin" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lwsock32" >&5 $as_echo_n "checking for main in -lwsock32... " >&6; } -if test "${ac_cv_lib_wsock32_main+set}" = set; then : +if ${ac_cv_lib_wsock32_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5122,7 +5133,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wsock32_main" >&5 $as_echo "$ac_cv_lib_wsock32_main" >&6; } -if test "x$ac_cv_lib_wsock32_main" = x""yes; then : +if test "x$ac_cv_lib_wsock32_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBWSOCK32 1 _ACEOF @@ -5135,7 +5146,7 @@ fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lwsock32" >&5 $as_echo_n "checking for main in -lwsock32... " >&6; } -if test "${ac_cv_lib_wsock32_main+set}" = set; then : +if ${ac_cv_lib_wsock32_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5163,7 +5174,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wsock32_main" >&5 $as_echo "$ac_cv_lib_wsock32_main" >&6; } -if test "x$ac_cv_lib_wsock32_main" = x""yes; then : +if test "x$ac_cv_lib_wsock32_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBWSOCK32 1 _ACEOF @@ -5176,7 +5187,7 @@ fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpsapi" >&5 $as_echo_n "checking for main in -lpsapi... " >&6; } -if test "${ac_cv_lib_psapi_main+set}" = set; then : +if ${ac_cv_lib_psapi_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5204,7 +5215,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_psapi_main" >&5 $as_echo "$ac_cv_lib_psapi_main" >&6; } -if test "x$ac_cv_lib_psapi_main" = x""yes; then : +if test "x$ac_cv_lib_psapi_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPSAPI 1 _ACEOF @@ -5240,7 +5251,7 @@ else ENABLE_WINCONSOLE="#" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin in -lm" >&5 $as_echo_n "checking for sin in -lm... " >&6; } -if test "${ac_cv_lib_m_sin+set}" = set; then : +if ${ac_cv_lib_m_sin+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5274,7 +5285,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sin" >&5 $as_echo "$ac_cv_lib_m_sin" >&6; } -if test "x$ac_cv_lib_m_sin" = x""yes; then : +if test "x$ac_cv_lib_m_sin" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF @@ -5285,7 +5296,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_socket+set}" = set; then : +if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5319,7 +5330,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = x""yes; then : +if test "x$ac_cv_lib_socket_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF @@ -5330,7 +5341,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getsockname in -lxnet" >&5 $as_echo_n "checking for getsockname in -lxnet... " >&6; } -if test "${ac_cv_lib_xnet_getsockname+set}" = set; then : +if ${ac_cv_lib_xnet_getsockname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5364,7 +5375,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xnet_getsockname" >&5 $as_echo "$ac_cv_lib_xnet_getsockname" >&6; } -if test "x$ac_cv_lib_xnet_getsockname" = x""yes; then : +if test "x$ac_cv_lib_xnet_getsockname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBXNET 1 _ACEOF @@ -5375,7 +5386,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lstdc++" >&5 $as_echo_n "checking for main in -lstdc++... " >&6; } -if test "${ac_cv_lib_stdcpp_main+set}" = set; then : +if ${ac_cv_lib_stdcpp_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5403,7 +5414,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_stdcpp_main" >&5 $as_echo "$ac_cv_lib_stdcpp_main" >&6; } -if test "x$ac_cv_lib_stdcpp_main" = x""yes; then : +if test "x$ac_cv_lib_stdcpp_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSTDC__ 1 _ACEOF @@ -5414,7 +5425,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5 $as_echo_n "checking for main in -lnsl... " >&6; } -if test "${ac_cv_lib_nsl_main+set}" = set; then : +if ${ac_cv_lib_nsl_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5442,7 +5453,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_main" >&5 $as_echo "$ac_cv_lib_nsl_main" >&6; } -if test "x$ac_cv_lib_nsl_main" = x""yes; then : +if test "x$ac_cv_lib_nsl_main" = xyes; then : have_nsl=yes else @@ -5451,7 +5462,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lcrypt" >&5 $as_echo_n "checking for main in -lcrypt... " >&6; } -if test "${ac_cv_lib_crypt_main+set}" = set; then : +if ${ac_cv_lib_crypt_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5479,7 +5490,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_main" >&5 $as_echo "$ac_cv_lib_crypt_main" >&6; } -if test "x$ac_cv_lib_crypt_main" = x""yes; then : +if test "x$ac_cv_lib_crypt_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCRYPT 1 _ACEOF @@ -5490,7 +5501,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnss_files" >&5 $as_echo_n "checking for main in -lnss_files... " >&6; } -if test "${ac_cv_lib_nss_files_main+set}" = set; then : +if ${ac_cv_lib_nss_files_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5518,7 +5529,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nss_files_main" >&5 $as_echo "$ac_cv_lib_nss_files_main" >&6; } -if test "x$ac_cv_lib_nss_files_main" = x""yes; then : +if test "x$ac_cv_lib_nss_files_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSS_FILES 1 _ACEOF @@ -5529,7 +5540,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnss_dns" >&5 $as_echo_n "checking for main in -lnss_dns... " >&6; } -if test "${ac_cv_lib_nss_dns_main+set}" = set; then : +if ${ac_cv_lib_nss_dns_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5557,7 +5568,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nss_dns_main" >&5 $as_echo "$ac_cv_lib_nss_dns_main" >&6; } -if test "x$ac_cv_lib_nss_dns_main" = x""yes; then : +if test "x$ac_cv_lib_nss_dns_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSS_DNS 1 _ACEOF @@ -5568,7 +5579,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lresolv" >&5 $as_echo_n "checking for main in -lresolv... " >&6; } -if test "${ac_cv_lib_resolv_main+set}" = set; then : +if ${ac_cv_lib_resolv_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5596,7 +5607,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_main" >&5 $as_echo "$ac_cv_lib_resolv_main" >&6; } -if test "x$ac_cv_lib_resolv_main" = x""yes; then : +if test "x$ac_cv_lib_resolv_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF @@ -5611,7 +5622,7 @@ if test "$yap_cv_readline" != "no" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lreadline" >&5 $as_echo_n "checking for main in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_main+set}" = set; then : +if ${ac_cv_lib_readline_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5639,7 +5650,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_main" >&5 $as_echo "$ac_cv_lib_readline_main" >&6; } -if test "x$ac_cv_lib_readline_main" = x""yes; then : +if test "x$ac_cv_lib_readline_main" = xyes; then : $as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h @@ -5651,7 +5662,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "--with-readline was given, but test for readline failed -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi @@ -5661,7 +5672,7 @@ if test "$yap_cv_gmp" != "no" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lgmp" >&5 $as_echo_n "checking for main in -lgmp... " >&6; } -if test "${ac_cv_lib_gmp_main+set}" = set; then : +if ${ac_cv_lib_gmp_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5689,7 +5700,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp_main" >&5 $as_echo "$ac_cv_lib_gmp_main" >&6; } -if test "x$ac_cv_lib_gmp_main" = x""yes; then : +if test "x$ac_cv_lib_gmp_main" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGMP 1 _ACEOF @@ -5703,7 +5714,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 $as_echo_n "checking for zlibVersion in -lz... " >&6; } -if test "${ac_cv_lib_z_zlibVersion+set}" = set; then : +if ${ac_cv_lib_z_zlibVersion+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5737,7 +5748,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 $as_echo "$ac_cv_lib_z_zlibVersion" >&6; } -if test "x$ac_cv_lib_z_zlibVersion" = x""yes; then : +if test "x$ac_cv_lib_z_zlibVersion" = xyes; then : ZLIBS="-lz" ZLIB=yes else @@ -5753,7 +5764,7 @@ if test "$yap_cv_myddas" != "no" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lmysqlclient" >&5 $as_echo_n "checking for main in -lmysqlclient... " >&6; } - if test "${yap_cv_mysql+set}" = set; then : + if ${yap_cv_mysql+:} false; then : $as_echo_n "(cached) " >&6 else @@ -5790,7 +5801,7 @@ $as_echo "$yap_cv_mysql" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lodbc" >&5 $as_echo_n "checking for main in -lodbc... " >&6; } - if test "${yap_cv_odbc+set}" = set; then : + if ${yap_cv_odbc+:} false; then : $as_echo_n "(cached) " >&6 else @@ -5851,7 +5862,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : +if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -5885,7 +5896,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF @@ -5906,7 +5917,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -6022,7 +6033,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -6034,7 +6045,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -6097,7 +6108,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -6164,7 +6175,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6294,7 +6305,7 @@ done for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = x""yes; then : +if test "x$ac_cv_header_pthread_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_H 1 _ACEOF @@ -6415,7 +6426,7 @@ then CC=${MPI_CC} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 $as_echo_n "checking for MPI_Init in -lmpi... " >&6; } -if test "${ac_cv_lib_mpi_MPI_Init+set}" = set; then : +if ${ac_cv_lib_mpi_MPI_Init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6449,7 +6460,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 $as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpi_MPI_Init" = x""yes; then : +if test "x$ac_cv_lib_mpi_MPI_Init" = xyes; then : $as_echo "#define HAVE_LIBMPI 1" >>confdefs.h else @@ -6464,7 +6475,7 @@ fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 $as_echo_n "checking for MPI_Init in -lmpich... " >&6; } -if test "${ac_cv_lib_mpich_MPI_Init+set}" = set; then : +if ${ac_cv_lib_mpich_MPI_Init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6498,7 +6509,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 $as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpich_MPI_Init" = x""yes; then : +if test "x$ac_cv_lib_mpich_MPI_Init" = xyes; then : $as_echo "#define HAVE_LIBMPICH 1" >>confdefs.h else @@ -6529,7 +6540,7 @@ then CC=${MPI_CC} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPE_Init_log in -lmpe" >&5 $as_echo_n "checking for MPE_Init_log in -lmpe... " >&6; } -if test "${ac_cv_lib_mpe_MPE_Init_log+set}" = set; then : +if ${ac_cv_lib_mpe_MPE_Init_log+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6563,7 +6574,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpe_MPE_Init_log" >&5 $as_echo "$ac_cv_lib_mpe_MPE_Init_log" >&6; } -if test "x$ac_cv_lib_mpe_MPE_Init_log" = x""yes; then : +if test "x$ac_cv_lib_mpe_MPE_Init_log" = xyes; then : $as_echo "#define HAVE_LIBMPE 1" >>confdefs.h else @@ -6591,7 +6602,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -6707,7 +6718,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -6723,7 +6734,7 @@ then else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } -if test "${ac_cv_header_sys_wait_h+set}" = set; then : +if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6764,14 +6775,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for restartable system calls" >&5 $as_echo_n "checking for restartable system calls... " >&6; } -if test "${ac_cv_sys_restartable_syscalls+set}" = set; then : +if ${ac_cv_sys_restartable_syscalls+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6853,7 +6864,7 @@ case "$target_os" in then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6887,7 +6898,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : have_dl=yes else @@ -7015,7 +7026,7 @@ fi then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7049,7 +7060,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : have_dl=yes else @@ -7085,7 +7096,7 @@ fi then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7119,7 +7130,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : have_dl=yes else @@ -7232,7 +7243,7 @@ fi *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7266,7 +7277,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : have_dl=yes else @@ -7426,7 +7437,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 $as_echo_n "checking for zlibVersion in -lz... " >&6; } -if test "${ac_cv_lib_z_zlibVersion+set}" = set; then : +if ${ac_cv_lib_z_zlibVersion+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7460,7 +7471,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 $as_echo "$ac_cv_lib_z_zlibVersion" >&6; } -if test "x$ac_cv_lib_z_zlibVersion" = x""yes; then : +if test "x$ac_cv_lib_z_zlibVersion" = xyes; then : ZLIBS="-lz" ZLIB=yes else @@ -7496,7 +7507,7 @@ OLD_CC=${CC} CC=${LAM_MPI_CC} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -llam" >&5 $as_echo_n "checking for main in -llam... " >&6; } -if test "${ac_cv_lib_lam_main+set}" = set; then : +if ${ac_cv_lib_lam_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7524,7 +7535,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lam_main" >&5 $as_echo "$ac_cv_lib_lam_main" >&6; } -if test "x$ac_cv_lib_lam_main" = x""yes; then : +if test "x$ac_cv_lib_lam_main" = xyes; then : LAMOBJS=yap_mpi."$SO" else LAMOBJS=no @@ -7534,7 +7545,7 @@ CC=${OLD_CC} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7646,7 +7657,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } -if test "${ac_cv_header_sys_wait_h+set}" = set; then : +if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7883,7 +7894,7 @@ done for ac_header in mach-o/dyld.h do : ac_fn_c_check_header_mongrel "$LINENO" "mach-o/dyld.h" "ac_cv_header_mach_o_dyld_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_o_dyld_h" = x""yes; then : +if test "x$ac_cv_header_mach_o_dyld_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MACH_O_DYLD_H 1 _ACEOF @@ -7897,7 +7908,7 @@ then for ac_header in gmp.h do : ac_fn_c_check_header_mongrel "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default" -if test "x$ac_cv_header_gmp_h" = x""yes; then : +if test "x$ac_cv_header_gmp_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GMP_H 1 _ACEOF @@ -7912,7 +7923,7 @@ then for ac_header in cudd.h do : ac_fn_c_check_header_mongrel "$LINENO" "cudd.h" "ac_cv_header_cudd_h" "$ac_includes_default" -if test "x$ac_cv_header_cudd_h" = x""yes; then : +if test "x$ac_cv_header_cudd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CUDD_H 1 _ACEOF @@ -7927,7 +7938,7 @@ then for ac_header in mysql/mysql.h do : ac_fn_c_check_header_mongrel "$LINENO" "mysql/mysql.h" "ac_cv_header_mysql_mysql_h" "$ac_includes_default" -if test "x$ac_cv_header_mysql_mysql_h" = x""yes; then : +if test "x$ac_cv_header_mysql_mysql_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MYSQL_MYSQL_H 1 _ACEOF @@ -7942,7 +7953,7 @@ then for ac_header in readline/readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" -if test "x$ac_cv_header_readline_readline_h" = x""yes; then : +if test "x$ac_cv_header_readline_readline_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_READLINE_READLINE_H 1 _ACEOF @@ -7955,7 +7966,7 @@ fi for ac_header in mpi.h do : ac_fn_c_check_header_mongrel "$LINENO" "mpi.h" "ac_cv_header_mpi_h" "$ac_includes_default" -if test "x$ac_cv_header_mpi_h" = x""yes; then : +if test "x$ac_cv_header_mpi_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MPI_H 1 _ACEOF @@ -7967,7 +7978,7 @@ done for ac_header in mpe.h do : ac_fn_c_check_header_mongrel "$LINENO" "mpe.h" "ac_cv_header_mpe_h" "$ac_includes_default" -if test "x$ac_cv_header_mpe_h" = x""yes; then : +if test "x$ac_cv_header_mpe_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MPE_H 1 _ACEOF @@ -7979,7 +7990,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then : +if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no @@ -8021,7 +8032,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if test "${ac_cv_struct_tm+set}" = set; then : +if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -8060,7 +8071,7 @@ fi # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int *" >&5 $as_echo_n "checking size of int *... " >&6; } -if test "${ac_cv_sizeof_int_p+set}" = set; then : +if ${ac_cv_sizeof_int_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int *))" "ac_cv_sizeof_int_p" "$ac_includes_default"; then : @@ -8070,7 +8081,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int *) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int_p=0 fi @@ -8093,7 +8104,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short int" >&5 $as_echo_n "checking size of short int... " >&6; } -if test "${ac_cv_sizeof_short_int+set}" = set; then : +if ${ac_cv_sizeof_short_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short int))" "ac_cv_sizeof_short_int" "$ac_includes_default"; then : @@ -8103,7 +8114,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short int) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short_int=0 fi @@ -8126,7 +8137,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if test "${ac_cv_sizeof_int+set}" = set; then : +if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -8136,7 +8147,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi @@ -8159,7 +8170,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long int" >&5 $as_echo_n "checking size of long int... " >&6; } -if test "${ac_cv_sizeof_long_int+set}" = set; then : +if ${ac_cv_sizeof_long_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long int))" "ac_cv_sizeof_long_int" "$ac_includes_default"; then : @@ -8169,7 +8180,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long int) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_int=0 fi @@ -8192,7 +8203,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long int" >&5 $as_echo_n "checking size of long long int... " >&6; } -if test "${ac_cv_sizeof_long_long_int+set}" = set; then : +if ${ac_cv_sizeof_long_long_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long int))" "ac_cv_sizeof_long_long_int" "$ac_includes_default"; then : @@ -8202,7 +8213,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long int) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long_int=0 fi @@ -8225,7 +8236,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } -if test "${ac_cv_sizeof_float+set}" = set; then : +if ${ac_cv_sizeof_float+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : @@ -8235,7 +8246,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_float=0 fi @@ -8258,7 +8269,7 @@ _ACEOF # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if test "${ac_cv_sizeof_double+set}" = set; then : +if ${ac_cv_sizeof_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -8268,7 +8279,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_double=0 fi @@ -8288,7 +8299,7 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of malloc" >&5 $as_echo_n "checking for type of malloc... " >&6; } -if test "${yap_cv_malloct+set}" = set; then : +if ${yap_cv_malloct+:} false; then : $as_echo_n "(cached) " >&6 else @@ -8328,7 +8339,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc inline" >&5 $as_echo_n "checking for gcc inline... " >&6; } -if test "${yap_cv_gcc+set}" = set; then : +if ${yap_cv_gcc+:} false; then : $as_echo_n "(cached) " >&6 else @@ -8435,7 +8446,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc threaded code" >&5 $as_echo_n "checking for gcc threaded code... " >&6; } -if test "${yap_cv_threaded_code+set}" = set; then : +if ${yap_cv_threaded_code+:} false; then : $as_echo_n "(cached) " >&6 else @@ -8480,7 +8491,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IEEE floats" >&5 $as_echo_n "checking for IEEE floats... " >&6; } -if test "${yap_cv_ffieee+set}" = set; then : +if ${yap_cv_ffieee+:} false; then : $as_echo_n "(cached) " >&6 else @@ -8521,7 +8532,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigsetjmp" >&5 $as_echo_n "checking for sigsetjmp... " >&6; } -if test "${yap_cv_sigsetjmp+set}" = set; then : +if ${yap_cv_sigsetjmp+:} false; then : $as_echo_n "(cached) " >&6 else @@ -8559,50 +8570,9 @@ $as_echo "#define HAVE_SIGSETJMP 0" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _setjmp" >&5 -$as_echo_n "checking for _setjmp... " >&6; } -if test "${yap_cv__setjmp+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -jmp_buf RestartEnv; - - _setjmp (RestartEnv); - _longjmp (RestartEnv, 1); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - yap_cv__setjmp=yes -else - yap_cv__setjmp=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $yap_cv__setjmp" >&5 -$as_echo "$yap_cv__setjmp" >&6; } -if test "$yap_cv__setjmp" = yes -then -$as_echo "#define HAVE__SETJMP 1" >>confdefs.h - -else -$as_echo "#define HAVE__SETJMP 0" >>confdefs.h - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigsegv" >&5 $as_echo_n "checking for sigsegv... " >&6; } -if test "${yap_cv_sigsegv+set}" = set; then : +if ${yap_cv_sigsegv+:} false; then : $as_echo_n "(cached) " >&6 else @@ -8641,7 +8611,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigprof" >&5 $as_echo_n "checking for sigprof... " >&6; } -if test "${yap_cv_sigprof+set}" = set; then : +if ${yap_cv_sigprof+:} false; then : $as_echo_n "(cached) " >&6 else @@ -8680,7 +8650,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for siginfo" >&5 $as_echo_n "checking for siginfo... " >&6; } -if test "${yap_cv_siginfo+set}" = set; then : +if ${yap_cv_siginfo+:} false; then : $as_echo_n "(cached) " >&6 else @@ -8781,7 +8751,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } -if test "${ac_cv_type_signal+set}" = set; then : +if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -8923,7 +8893,7 @@ done for ac_func in mbsnrtowcs do : ac_fn_c_check_func "$LINENO" "mbsnrtowcs" "ac_cv_func_mbsnrtowcs" -if test "x$ac_cv_func_mbsnrtowcs" = x""yes; then : +if test "x$ac_cv_func_mbsnrtowcs" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MBSNRTOWCS 1 _ACEOF @@ -9041,7 +9011,7 @@ done ac_fn_c_check_func "$LINENO" "regexec" "ac_cv_func_regexec" -if test "x$ac_cv_func_regexec" = x""yes; then : +if test "x$ac_cv_func_regexec" = xyes; then : NO_BUILTIN_REGEXP="#" else NO_BUILTIN_REGEXP="" @@ -9051,7 +9021,7 @@ fi for ac_func in NSLinkModule do : ac_fn_c_check_func "$LINENO" "NSLinkModule" "ac_cv_func_NSLinkModule" -if test "x$ac_cv_func_NSLinkModule" = x""yes; then : +if test "x$ac_cv_func_NSLinkModule" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NSLINKMODULE 1 _ACEOF @@ -9094,7 +9064,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpz_xor" >&5 $as_echo_n "checking for mpz_xor... " >&6; } -if test "${yap_cv_mpz_xor+set}" = set; then : +if ${yap_cv_mpz_xor+:} false; then : $as_echo_n "(cached) " >&6 else @@ -9140,7 +9110,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fflush(NULL) clobbers input pipes" >&5 $as_echo_n "checking if fflush(NULL) clobbers input pipes... " >&6; } -if test "${yap_cv_broken_fflush_null+set}" = set; then : +if ${yap_cv_broken_fflush_null+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_socket+set}" = set; then : +if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9291,7 +9261,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = x""yes; then : +if test "x$ac_cv_lib_socket_socket" = xyes; then : CLIB_NETLIBS="$CLIB_NETLIBS -lsocket" $as_echo "#define HAVE_LIBSOCKET 1" >>confdefs.h @@ -9301,13 +9271,13 @@ fi fi ac_fn_c_check_func "$LINENO" "gethostent" "ac_cv_func_gethostent" -if test "x$ac_cv_func_gethostent" = x""yes; then : +if test "x$ac_cv_func_gethostent" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostent in -lnsl" >&5 $as_echo_n "checking for gethostent in -lnsl... " >&6; } -if test "${ac_cv_lib_nsl_gethostent+set}" = set; then : +if ${ac_cv_lib_nsl_gethostent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9341,7 +9311,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostent" >&5 $as_echo "$ac_cv_lib_nsl_gethostent" >&6; } -if test "x$ac_cv_lib_nsl_gethostent" = x""yes; then : +if test "x$ac_cv_lib_nsl_gethostent" = xyes; then : CLIB_NETLIBS="$CLIB_NETLIBS -lnsl" $as_echo "#define HAVE_LIBNSL 1" >>confdefs.h @@ -9354,7 +9324,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : +if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9388,7 +9358,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : CLIB_PTHREADS="-lpthread" else CLIB_PTHREADS="" @@ -9398,7 +9368,7 @@ fi oldlibs="$LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 $as_echo_n "checking for crypt in -lcrypt... " >&6; } -if test "${ac_cv_lib_crypt_crypt+set}" = set; then : +if ${ac_cv_lib_crypt_crypt+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9432,7 +9402,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 $as_echo "$ac_cv_lib_crypt_crypt" >&6; } -if test "x$ac_cv_lib_crypt_crypt" = x""yes; then : +if test "x$ac_cv_lib_crypt_crypt" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCRYPT 1 _ACEOF @@ -9445,7 +9415,7 @@ CLIB_CRYPTLIBS="$LIBS" for ac_func in crypt do : ac_fn_c_check_func "$LINENO" "crypt" "ac_cv_func_crypt" -if test "x$ac_cv_func_crypt" = x""yes; then : +if test "x$ac_cv_func_crypt" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CRYPT 1 _ACEOF @@ -9466,7 +9436,7 @@ ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " #include " -if test "x$ac_cv_type_socklen_t" = x""yes; then : +if test "x$ac_cv_type_socklen_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SOCKLEN_T 1 @@ -9480,7 +9450,7 @@ ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" " #include " -if test "x$ac_cv_type_ssize_t" = x""yes; then : +if test "x$ac_cv_type_ssize_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SSIZE_T 1 @@ -9535,7 +9505,7 @@ fi ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include " -if test "x$ac_cv_member_struct_tm_tm_gmtoff" = x""yes; then : +if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then : $as_echo "#define HAVE_STRUCT_TIME_TM_GMTOFF /**/" >>confdefs.h @@ -9786,10 +9756,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -9821,7 +9802,7 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -9922,6 +9903,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -10229,7 +10211,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -10291,7 +10273,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.67, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -10456,7 +10438,7 @@ do "packages/swi-minisat2/Makefile") CONFIG_FILES="$CONFIG_FILES packages/swi-minisat2/Makefile" ;; "packages/swi-minisat2/C/Makefile") CONFIG_FILES="$CONFIG_FILES packages/swi-minisat2/C/Makefile" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -10478,9 +10460,10 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -10488,12 +10471,13 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -10515,7 +10499,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -10543,7 +10527,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -10591,7 +10575,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -10623,7 +10607,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -10657,7 +10641,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -10669,8 +10653,8 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -10771,7 +10755,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -10790,7 +10774,7 @@ do for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -10799,7 +10783,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -10825,8 +10809,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -10956,21 +10940,22 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -10981,20 +10966,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ + mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff --git a/configure.in b/configure.in index 8e477543e..ea2984c93 100755 --- a/configure.in +++ b/configure.in @@ -1567,26 +1567,6 @@ else AC_DEFINE(HAVE_SIGSETJMP,0) fi -dnl check for _setjmp -AC_MSG_CHECKING(for _setjmp) -AC_CACHE_VAL(yap_cv__setjmp,[ -AC_TRY_COMPILE( - #include - , - jmp_buf RestartEnv; - - _setjmp (RestartEnv); - _longjmp (RestartEnv, 1); - , - yap_cv__setjmp=yes,yap_cv__setjmp=no)]) -AC_MSG_RESULT($yap_cv__setjmp) -if test "$yap_cv__setjmp" = yes -then -AC_DEFINE(HAVE__SETJMP,1) -else -AC_DEFINE(HAVE__SETJMP,0) -fi - dnl check for sigsegv AC_MSG_CHECKING(for sigsegv) AC_CACHE_VAL(yap_cv_sigsegv,[ diff --git a/include/SWI-Prolog.h b/include/SWI-Prolog.h index a3b301169..7a5e77311 100755 --- a/include/SWI-Prolog.h +++ b/include/SWI-Prolog.h @@ -699,6 +699,7 @@ typedef struct SWI_IO { void *flush_s; void *close_s; void *get_stream_handle; + void *get_stream_position; } swi_io_struct; /* SWI stream info */ diff --git a/library/dialect/swi.yap b/library/dialect/swi.yap index 159acaa5a..5dac76471 100755 --- a/library/dialect/swi.yap +++ b/library/dialect/swi.yap @@ -242,6 +242,10 @@ goal_expansion(print(A),write_term(user_output,A,[swi(true),portray(true),number goal_expansion(print(S,A),write_term(S,A,[swi(true),portray(true),numbervars(true)])) :- swi_io. goal_expansion(write_term(A,Opts),write_term(user_output,A,Opts,[swi(true)|Opts])) :- swi_io. goal_expansion(write_term(S,A,Opts),write_term(S,A,[swi(true)|Opts])) :- swi_io, \+ member(swi(_), Opts). +goal_expansion(format(A),system:swi_format(user_output,A,[])) :- swi_io. +goal_expansion(format(A,Args),system:swi_format(user_output,A,Args)) :- swi_io. +goal_expansion(format(S,A,Args),system:swi_format(S,A,Args)) :- swi_io. +goal_expansion(writeln(A),system:swi_format(user_output,'~w~n',[A])) :- swi_io. % make sure we also use diff --git a/library/dialect/swi/fli/swi.c b/library/dialect/swi/fli/swi.c index f15cdc8d0..0a0d7f262 100755 --- a/library/dialect/swi/fli/swi.c +++ b/library/dialect/swi/fli/swi.c @@ -459,22 +459,35 @@ X_API int PL_get_chars(term_t l, char **sp, unsigned flags) if (!(flags & (CVT_ATOM|CVT_ATOMIC|CVT_WRITE|CVT_WRITE_CANONICAL|CVT_ALL))) return cv_error(flags); if (IsWideAtom(at)) { - size_t sz = wcslen(RepAtom(at)->WStrOfAE)*sizeof(wchar_t); - if (!(tmp = ensure_space(sp, (sz+1)*sizeof(wchar_t), flags))) + wchar_t* s = RepAtom(at)->WStrOfAE; + size_t sz = wcslen(s)+1; + if (!(tmp = ensure_space(sp, sz*sizeof(wchar_t), flags))) return 0; + memcpy(*sp,s,sz*sizeof(wchar_t)); } else { char *s = RepAtom(at)->StrOfAE; - size_t sz = strlen(RepAtom(at)->StrOfAE)+1; + size_t sz = strlen(s)+1; if (!(tmp = ensure_space(sp, sz, flags))) return 0; - strncpy(*sp,s,sz); + memcpy(*sp,s,sz); } } else if (IsNumTerm(t)) { if (IsFloatTerm(t)) { if (!(flags & (CVT_FLOAT|CVT_NUMBER|CVT_ATOMIC|CVT_WRITE|CVT_WRITE_CANONICAL|CVT_ALL))) return cv_error(flags); snprintf(tmp,SWI_BUF_SIZE,"%f",FloatOfTerm(t)); +#if USE_GMP + } else if (YAP_IsBigNumTerm(t)) { + if (!(flags & (CVT_FLOAT|CVT_NUMBER|CVT_ATOMIC|CVT_WRITE|CVT_WRITE_CANONICAL|CVT_ALL))) + return cv_error(flags); + MP_INT g; + YAP_BigNumOfTerm(t, (void *)&g); + if (mpz_sizeinbase(&g,2) > SWI_BUF_SIZE-1) { + return 0; + } + mpz_get_str (tmp, 10, &g); +#endif } else { if (!(flags & (CVT_INTEGER|CVT_NUMBER|CVT_ATOMIC|CVT_WRITE|CVT_WRITE_CANONICAL|CVT_ALL))) return cv_error(flags); @@ -520,7 +533,7 @@ X_API int PL_get_chars(term_t l, char **sp, unsigned flags) char *nbf = PL_malloc(sz+1); if (!nbf) return 0; - strncpy(nbf,tmp,sz+1); + memcpy(nbf,tmp,sz+1); free(tmp); *sp = nbf; } @@ -890,7 +903,7 @@ X_API atom_t PL_new_atom_nchars(size_t len, const char *c) return 0L; } } - strncpy(pt, c, len); + memcpy(pt, c, len); pt[len] = '\0'; } else { pt = (char *)c; @@ -1102,7 +1115,8 @@ X_API int PL_put_atom_nchars(term_t t, size_t len, const char *s) return FALSE; } } - strncpy(buf, s, len); + memcpy(buf, s, len); + buf[len] = 0; } else { buf = (char *)s; } @@ -1547,7 +1561,7 @@ X_API int PL_unify_atom_nchars(term_t t, size_t len, const char *s) if (!buf) return FALSE; - strncpy(buf, s, len); + memcpy(buf, s, len); buf[len] = '\0'; while (!(catom = Yap_LookupAtom(buf))) { if (!Yap_growheap(FALSE, 0L, NULL)) { @@ -1857,7 +1871,7 @@ LookupMaxAtom(size_t n, char *s) if (!buf) return FALSE; - strncpy(buf, s, n); + memcpy(buf, s, n); buf[n] = '\0'; while (!(catom = Yap_LookupAtom(buf))) { if (!Yap_growheap(FALSE, 0L, NULL)) { @@ -2212,7 +2226,7 @@ X_API int PL_is_float(term_t ts) X_API int PL_is_integer(term_t ts) { YAP_Term t = Yap_GetFromSlot(ts); - return YAP_IsIntTerm(t); + return YAP_IsIntTerm(t) || YAP_IsBigNumTerm(t); } X_API int PL_is_list(term_t ts) @@ -2224,7 +2238,7 @@ X_API int PL_is_list(term_t ts) X_API int PL_is_number(term_t ts) { YAP_Term t = Yap_GetFromSlot(ts); - return YAP_IsIntTerm(t) || YAP_IsFloatTerm(t); + return YAP_IsIntTerm(t) || YAP_IsBigNumTerm(t) || YAP_IsFloatTerm(t); } X_API int PL_is_string(term_t ts) @@ -3096,6 +3110,7 @@ PL_YAP_InitSWIIO(struct SWI_IO *swio) SWIFlush = swio->flush_s; SWIClose = swio->close_s; SWIGetStream = swio->get_stream_handle; + SWIGetStreamPosition = swio->get_stream_position; } typedef int (*GetStreamF)(term_t, int, int, IOSTREAM **s); @@ -3115,6 +3130,23 @@ Yap_get_stream_handle(Term t0, int read_mode, int write_mode, void *s){ } +typedef int (*GetStreamPosF)(IOSTREAM *s, term_t); + +Term +Yap_get_stream_position(void *s){ + term_t t; + Term t0; + GetStreamPosF f = (GetStreamPosF)SWIGetStreamPosition; + + t = (term_t)Yap_NewSlots(1); + if (!(*f)(s, t)) + return 0L; + t0 = Yap_GetFromSlot((Int)t); + Yap_RecoverSlots(1); + return t0; +} + + X_API void (*PL_signal(int sig, void (*func)(int)))(int) { // return Yap_signal2(sig,func); diff --git a/library/tries/base_tries.c b/library/tries/base_tries.c index 75d14483b..1f7831061 100644 --- a/library/tries/base_tries.c +++ b/library/tries/base_tries.c @@ -203,7 +203,7 @@ TrData trie_traverse_init(TrEntry trie, TrData init_data) { if (CURRENT_TRAVERSE_MODE == TRAVERSE_MODE_FORWARD) data = TrEntry_first_data(trie); else - data = TrEntry_last_data(trie); + data = trie_get_last_entry(trie); } TrEntry_traverse_data(trie) = data; return data; diff --git a/misc/GLOBALS b/misc/GLOBALS index 4313b1f87..1dcda6810 100644 --- a/misc/GLOBALS +++ b/misc/GLOBALS @@ -144,7 +144,7 @@ struct RB_red_blk_node* DB_nil db_nil =NULL #endif /* defined(YAPOR) || defined(THREADS) */ -jmp_buf gc_restore Yap_gc_restore void +sigjmp_buf gc_restore Yap_gc_restore void struct array_entry* dynamic_arrays DynamicArrays =NULL PtoArrayEAdjust struct static_array_entry* static_arrays StaticArrays =NULL PtoArraySAdjust struct global_entry* global_variables GlobalVariables =NULL PtoGlobalEAdjust @@ -211,6 +211,7 @@ SWI_PutWideFunction swi_wputc SWIWidePutc =NULL SWI_CloseFunction swi_close SWIClose =NULL SWI_FlushFunction swi_flush SWIFlush =NULL SWI_PLGetStreamFunction swi_get_stream_f SWIGetStream =NULL +SWI_PLGetStreamPositionFunction swi_get_stream_position_f SWIGetStreamPosition =NULL // stack overflow expansion/gc control int allow_local_expansion Yap_AllowLocalExpansion =TRUE diff --git a/misc/buildops b/misc/buildops index 3906566ff..afa8e458e 100644 --- a/misc/buildops +++ b/misc/buildops @@ -224,6 +224,7 @@ get_op(0'a,"Arity"). get_op(0'b,"CellPtoHeap"). get_op(0'c,"ConstantTerm"). get_op(0'd,"DoubleInCode"). +get_op(0'D,"DBGroundTerm"). get_op(0'f,"Func"). get_op(0'F,"ExternalFunction"). get_op(0'i,"IntegerInCode"). @@ -232,6 +233,7 @@ get_op(0'l,"PtoOp"). get_op(0'L,"PtoLUClause"). get_op(0'm,"Module"). get_op(0'n,"Integer"). +get_op(0'N,"BlobTermInCode"). get_op(0'o,"Opcode"). get_op(0'O,"OrArg"). get_op(0'p,"PtoPred"). @@ -850,10 +852,12 @@ opinfo("gl_void_vary",[bind("y","AbsPair(NULL)",workpc=currentop),new("y")]). opinfo("get_struct",[bind("x","AbsAppl((CELL *)cl->u.xfa.f)",workpc=nextop)]). opinfo("get_float",[bind("x","AbsAppl((CELL *)FunctorDouble)",t_ptr="d")]). opinfo("get_longint",[bind("x","AbsAppl((CELL *)FunctorLongInt)",t_ptr="i")]). -opinfo("get_bigint",[bind("x","c",[])]). +opinfo("get_bigint",[bind("x","b",[])]). opinfo("copy_idb_term",[logical]). opinfo("unify_idb_term",[logical]). opinfo("put_atom",[new("x")]). +opinfo("put_dbterm",[new("x")]). +opinfo("put_bigint",[new("x")]). opinfo("put_float",[new("x")]). opinfo("put_longint",[new("x")]). opinfo("put_list",[new("x")]). diff --git a/packages/PLStream/pl-file.c b/packages/PLStream/pl-file.c index 6c0fef260..14146fa47 100755 --- a/packages/PLStream/pl-file.c +++ b/packages/PLStream/pl-file.c @@ -4350,6 +4350,12 @@ get_stream_handle_no_errors(term_t t, int read, int write, IOSTREAM **s) return get_stream_handle(t, s, SH_ALIAS); } +static int +get_stream_position(IOSTREAM *s, term_t t) +{ GET_LD + return stream_position_prop(s, t); +} + static void init_yap_extras(void) { @@ -4363,6 +4369,7 @@ init_yap_extras(void) swiio.flush_s = Sflush; swiio.close_s = closeStream; swiio.get_stream_handle = get_stream_handle_no_errors; + swiio.get_stream_position = get_stream_position; PL_YAP_InitSWIIO(&swiio); initCharTypes(); initFiles(); diff --git a/packages/ProbLog/dtproblog.yap b/packages/ProbLog/dtproblog.yap index 0fca0f292..8ec1f3a14 100644 --- a/packages/ProbLog/dtproblog.yap +++ b/packages/ProbLog/dtproblog.yap @@ -707,6 +707,7 @@ bdd_optimization(N,EV,Decisions,Status) :- %(problog_flag(verbose,true) -> Debug = ' -d';Debug = ''), % messes up result parsing atomic_concat([ProblogBDD, Param, ' -l ',BDDFile,' -i ',BDDParFile,' -u ',UtilFile,' -m s',LocalPar,Forest,' -t ', BDDTime,' > ', ResultFile],Command), statistics(walltime,_), +% format(user,'$ ~w~n',[Command]), shell(Command,Return), (Return =\= 0 -> Status = timeout diff --git a/packages/ProbLog/problog.yap b/packages/ProbLog/problog.yap index 0f729fc5c..23ea671bc 100644 --- a/packages/ProbLog/problog.yap +++ b/packages/ProbLog/problog.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-11-23 11:47:48 +0100 (Tue, 23 Nov 2010) $ -% $Revision: 5027 $ +% $Date: 2010-12-15 11:12:48 +0100 (Wed, 15 Dec 2010) $ +% $Revision: 5138 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog @@ -350,16 +350,13 @@ :- use_module('problog/mc_DNF_sampling'). :- use_module('problog/timer'). :- use_module('problog/utils'). -:- catch(use_module('problog/ad_converter'),_,true). +:- use_module('problog/ad_converter'). :- catch(use_module('problog/variable_elimination'),_,true). % op attaching probabilities to facts :- op( 550, yfx, :: ). :- op( 550, fx, ?:: ). -% for annotated disjunctions -% :- op(1149, yfx, <-- ). - %%%%%%%%%%%%%%%%%%%%%%%% % control predicates on various levels %%%%%%%%%%%%%%%%%%%%%%%% @@ -509,7 +506,7 @@ problog_dir(PD):- problog_path(PD). %%%%%%%%%%%%%%%%%%%%%%%% init_global_params :- - %grow_atom_table(1000000), + grow_atom_table(1000000), % this will reserve us some memory, there are cases where you might need more %%%%%%%%%%%% % working directory: all the temporary and output files will be located there @@ -591,9 +588,9 @@ generate_atoms(N, A):- % dynamic predicate problog_predicate(Name,Arity) keeps track of predicates that already have wrapper clause %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% converts annotated disjunctions - if loaded -term_expansion_intern(A, B, C):- - catch(term_expansion_intern_ad(A, B, C), _, false). +% converts annotated disjunctions +term_expansion_intern(A, Module, C):- + term_expansion_intern_ad(A, Module, C). % converts ?:: prefix to ? :: infix, as handled by other clause term_expansion_intern((Annotation::Fact), Module, ExpandedClause) :- @@ -667,13 +664,12 @@ term_expansion_intern(Head :: Goal,Module,problog:ProbFact) :- ) ), - copy_term(((X,Distribution) :: Goal), ((X2,Distribution2) :: Goal2)), % bind_the_variable - X2=Distribution2, + X=Distribution, % find position in term - Goal2=..[Name|Args], - once(nth1(Pos,Args,Distribution2)), + Goal=..[Name|Args], + once(nth1(Pos,Args,Distribution)), length(Args,Arity), atomic_concat([problogcontinuous_,Name],ProblogName), @@ -1165,31 +1161,20 @@ set_continuous_fact_parameters(ID,Parameters) :- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% writing those facts with learnable parameters to File +% writing all probabilistic and continuous facts to Filename %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% export_facts(Filename) :- open(Filename,'write',Handle), - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ( % go over all probabilistic facts - P::Goal, - format(Handle,'~w :: ~q.~n',[P,Goal]), + forall(P::Goal, + format(Handle,'~10f :: ~q.~n',[P,Goal])), - fail; % go to next prob. fact - true - ), - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ( % go over all continuous facts - continuous_fact(ID), - get_continuous_fact_parameters(ID,Param), - format(Handle,'~q. % ~q~n',[Param,ID]), - - fail; % go to next cont. fact - true - ), - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + forall(continuous_fact(ID), + ( + get_continuous_fact_parameters(ID,Param), + format(Handle,'~q. % ~q~n',[Param,ID]) + ) + ), close(Handle). @@ -1946,14 +1931,12 @@ disjoin_hybrid_proofs([GroundID|T]) :- intervals_partition(Intervals,Partition), % go over all proofs where this fact occurs - ( - hybrid_proof(ProofID,ID,GroundID,Interval), - intervals_disjoin(Interval,Partition,PInterval), - assertz(hybrid_proof_disjoint(ProofID,ID,GroundID,PInterval)), - - fail; % go to next proof - true - ), + forall(hybrid_proof(ProofID,ID,GroundID,Interval), + ( + intervals_disjoin(Interval,Partition,PInterval), + assertz(hybrid_proof_disjoint(ProofID,ID,GroundID,PInterval)) + ) + ), disjoin_hybrid_proofs(T). @@ -1996,6 +1979,7 @@ problog_low(_, _, LP, Status) :- timer_stop(sld_time,SLD_Time), problog_var_set(sld_time, SLD_Time), nb_getval(problog_completed_proofs, Trie_Completed_Proofs), +%print_nested_ptree(Trie_Completed_Proofs), eval_dnf(Trie_Completed_Proofs, LP, Status), (problog_flag(verbose, true)-> problog_statistics diff --git a/packages/ProbLog/problog/ad_converter.yap b/packages/ProbLog/problog/ad_converter.yap index bb8fe601b..aae4b2fff 100644 --- a/packages/ProbLog/problog/ad_converter.yap +++ b/packages/ProbLog/problog/ad_converter.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-10-13 17:09:47 +0200 (Wed, 13 Oct 2010) $ -% $Revision: 4915 $ +% $Date: 2010-12-13 18:15:14 +0100 (Mon, 13 Dec 2010) $ +% $Revision: 5125 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog @@ -214,51 +214,64 @@ ]). % general yap modules -:- use_module(library(lists),[reverse/2]). +:- use_module(library(lists),[reverse/2,member/2,append/3]). + +:- use_module(flags). :- style_check(all). :- yap_flag(unknown,error). +:- discontiguous user:ad_intern/2. + :- op( 550, yfx, :: ). % for annotated disjunctions :- op(1149, yfx, <-- ). +:- initialization(problog_define_flag(show_ad_compilation,problog_flag_validate_boolean,'show compiled code for ADs',false,annotated_disjunctions)). +:- initialization(problog_define_flag(ad_cpl_semantics,problog_flag_validate_boolean,'use CP-logics semantics for ADs',true,annotated_disjunctions)). + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% term_expansion_intern_ad( (Head<--Body),Module,ad_intern((Head<--Body),ID)) :- - proper_tunable_annotated_disjunction(Head), - !, - compile_tunable_annotated_disjunction(Head,Body,Facts,Bodies,ID), - assert_all_ad_facts(Facts,Module), - assert_all_ad_bodies(Bodies,Module). -term_expansion_intern_ad( (Head<--Body),Module,ad_intern((Head<--Body),ID)) :- - proper_annotated_disjunction(Head), - !, - compile_annotated_disjunction(Head,Body,Facts,Bodies,ID), - assert_all_ad_facts(Facts,Module), - assert_all_ad_bodies(Bodies,Module). + problog_flag(ad_cpl_semantics,AD_CPL_Semantics), + ( + proper_tunable_annotated_disjunction(Head) + -> + compile_tunable_annotated_disjunction(Head,Body,Facts,Bodies,ID,AD_CPL_Semantics); + ( + proper_annotated_disjunction(Head), + compile_annotated_disjunction(Head,Body,Facts,Bodies,ID,AD_CPL_Semantics) + ) + ), + + forall(member(F,Facts),(once(problog:term_expansion_intern(F,Module,Atom)), + assertz(problog:Atom))), + forall(member(B,Bodies),assertz(Module:B)), + + problog_flag(show_ad_compilation,Show_AD_compilation), + + ( + Show_AD_compilation==true + -> + ( + format('Compiling the annotated disjunction~n ~q~ninto the following code~n',[(Head<--Body)]), + format('================================================~n',[]), + forall(member(F,Facts),format(' ~q.~n',[F])), + format(' - - - - - - - - - - - - - - - - - - - - - - ~n',[]), + forall(member(B,Bodies),format(' ~q.~n',[B])), + format('================================================~2n',[]) + ); + true + ). + term_expansion_intern_ad( (Head<--Body),_,_) :- format_to_chars('Error at compiling the annotated disjunction ~q<--Body.',[Head,Body],Error), print_message(error,Error), fail. -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -assert_all_ad_facts([],_). -assert_all_ad_facts([F|T],Module) :- - once(problog:term_expansion_intern(F,Module,Atom)), - assertz(problog:Atom), - assert_all_ad_facts(T,Module). - -assert_all_ad_bodies([],_). -assert_all_ad_bodies([B|T],Module) :- - assertz(Module:B), - assert_all_ad_bodies(T,Module). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -303,22 +316,36 @@ proper_tunable_annotated_disjunction((X;Y)) :- % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -compile_tunable_annotated_disjunction(Head,Body,Facts2,Bodies2,Extra_ID) :- +compile_tunable_annotated_disjunction(Head,Body,Facts2,Bodies2,Extra_ID,AD_CPL_Semantics) :- get_next_unique_id(Extra_ID), + + ( + AD_CPL_Semantics==true + -> + term_variables(Body,Body_Vars); + Body_Vars=[] + ), - convert_a_tunable(Head,Extra_ID,[],Facts), - convert_b(Head,Body,_NewBody,Extra_ID,[],Bodies), + convert_a_tunable(Head,Extra_ID,[],Facts,Body_Vars), + convert_b(Head,Body,_NewBody,Extra_ID,[],Bodies,Body_Vars), reverse(Facts,Facts2), reverse(Bodies,Bodies2). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -compile_annotated_disjunction(Head,Body,Facts2,Bodies2,Extra_ID) :- +compile_annotated_disjunction(Head,Body,Facts2,Bodies2,Extra_ID,AD_CPL_Semantics) :- get_next_unique_id(Extra_ID), + + ( + AD_CPL_Semantics==true + -> + term_variables(Body,Body_Vars); + Body_Vars=[] + ), - convert_a(Head,0.0,_Acc,Extra_ID,[],Facts), - convert_b(Head,Body,_NewBody,Extra_ID,[],Bodies), + convert_a(Head,0.0,_Acc,Extra_ID,[],Facts,Body_Vars), + convert_b(Head,Body,_NewBody,Extra_ID,[],Bodies,Body_Vars), reverse(Facts,Facts2), reverse(Bodies,Bodies2). @@ -326,16 +353,17 @@ compile_annotated_disjunction(Head,Body,Facts2,Bodies2,Extra_ID) :- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -convert_a((X;Y),OldAcc,Acc,Extra_ID,OldFacts,Facts) :- - convert_a(X,OldAcc,NewAcc,Extra_ID,OldFacts,NewFacts), - convert_a(Y,NewAcc,Acc,Extra_ID,NewFacts,Facts). -convert_a(P::Atom,OldAcc,NewAcc,Extra_ID,OldFacts,[P1::ProbFact|OldFacts]) :- +convert_a((X;Y),OldAcc,Acc,Extra_ID,OldFacts,Facts,Body_Vars) :- + convert_a(X,OldAcc,NewAcc,Extra_ID,OldFacts,NewFacts,Body_Vars), + convert_a(Y,NewAcc,Acc,Extra_ID,NewFacts,Facts,Body_Vars). +convert_a(P::Atom,OldAcc,NewAcc,Extra_ID,OldFacts,[P1::ProbFact|OldFacts],Body_Vars) :- Atom =.. [Functor|AllArguments], + append(AllArguments,Body_Vars,NewAllArguments), length(AllArguments,Arity), atomic_concat([mvs_fact_,Functor,'_',Arity,'_',Extra_ID],NewAtom), - ProbFact =.. [NewAtom|AllArguments], + ProbFact =.. [NewAtom|NewAllArguments], ( P=:=0 -> @@ -351,29 +379,31 @@ convert_a(P::Atom,OldAcc,NewAcc,Extra_ID,OldFacts,[P1::ProbFact|OldFacts]) :- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -convert_a_tunable((X;Y),Extra_ID,OldFacts,Facts) :- - convert_a_tunable(X,Extra_ID,OldFacts,NewFacts), - convert_a_tunable(Y,Extra_ID,NewFacts,Facts). -convert_a_tunable(P::Atom,Extra_ID,OldFacts,[P::ProbFact|OldFacts]) :- +convert_a_tunable((X;Y),Extra_ID,OldFacts,Facts,Body_Vars) :- + convert_a_tunable(X,Extra_ID,OldFacts,NewFacts,Body_Vars), + convert_a_tunable(Y,Extra_ID,NewFacts,Facts,Body_Vars). +convert_a_tunable(P::Atom,Extra_ID,OldFacts,[P::ProbFact|OldFacts],Body_Vars) :- Atom =.. [Functor|AllArguments], + append(AllArguments,Body_Vars,NewAllArguments), length(AllArguments,Arity), atomic_concat([mvs_fact_,Functor,'_',Arity,'_',Extra_ID],NewAtom), - ProbFact =.. [NewAtom|AllArguments]. + ProbFact =.. [NewAtom|NewAllArguments]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -convert_b((X;Y),OldBody,Body,ExtraID,OldBodies,Bodies) :- - convert_b(X,OldBody,NewBody,ExtraID,OldBodies,NewBodies), - convert_b(Y,NewBody,Body,ExtraID,NewBodies,Bodies). -convert_b(_::Atom,OldBody,NewBody,Extra_ID,OldBodies,[(Atom:-ThisBody)|OldBodies]) :- +convert_b((X;Y),OldBody,Body,ExtraID,OldBodies,Bodies,Body_Vars) :- + convert_b(X,OldBody,NewBody,ExtraID,OldBodies,NewBodies,Body_Vars), + convert_b(Y,NewBody,Body,ExtraID,NewBodies,Bodies,Body_Vars). +convert_b(_::Atom,OldBody,NewBody,Extra_ID,OldBodies,[(Atom:-ThisBody)|OldBodies],Body_Vars) :- Atom =.. [Functor|AllArguments], + append(AllArguments,Body_Vars,NewAllArguments), length(AllArguments,Arity), atomic_concat([mvs_fact_,Functor,'_',Arity,'_',Extra_ID],NewFunctor), - ProbFact =.. [NewFunctor|AllArguments], + ProbFact =.. [NewFunctor|NewAllArguments], tuple_append(OldBody,ProbFact,ThisBody), tuple_append(OldBody,problog_not(ProbFact),NewBody). diff --git a/packages/ProbLog/problog/extlists.yap b/packages/ProbLog/problog/extlists.yap index 5f58e03d6..667db8ba4 100644 --- a/packages/ProbLog/problog/extlists.yap +++ b/packages/ProbLog/problog/extlists.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/flags.yap b/packages/ProbLog/problog/flags.yap index fe53d4e52..54a77fb93 100644 --- a/packages/ProbLog/problog/flags.yap +++ b/packages/ProbLog/problog/flags.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/gflags.yap b/packages/ProbLog/problog/gflags.yap index 5680c7ec0..3c7454fd6 100644 --- a/packages/ProbLog/problog/gflags.yap +++ b/packages/ProbLog/problog/gflags.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/hash_table.yap b/packages/ProbLog/problog/hash_table.yap index 66e3f250d..cf47f9492 100644 --- a/packages/ProbLog/problog/hash_table.yap +++ b/packages/ProbLog/problog/hash_table.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/intervals.yap b/packages/ProbLog/problog/intervals.yap index 3352dccc9..e6f14f668 100644 --- a/packages/ProbLog/problog/intervals.yap +++ b/packages/ProbLog/problog/intervals.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/logger.yap b/packages/ProbLog/problog/logger.yap index cfd68feb3..31a5a4a0c 100644 --- a/packages/ProbLog/problog/logger.yap +++ b/packages/ProbLog/problog/logger.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-10-11 14:14:11 +0200 (Mon, 11 Oct 2010) $ -% $Revision: 4892 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/mc_DNF_sampling.yap b/packages/ProbLog/problog/mc_DNF_sampling.yap index 01c1e15fe..931cfc83e 100644 --- a/packages/ProbLog/problog/mc_DNF_sampling.yap +++ b/packages/ProbLog/problog/mc_DNF_sampling.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/nestedtries.yap b/packages/ProbLog/problog/nestedtries.yap index abeb512d2..bf63f3fed 100644 --- a/packages/ProbLog/problog/nestedtries.yap +++ b/packages/ProbLog/problog/nestedtries.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-11-03 19:13:53 +0100 (Wed, 03 Nov 2010) $ -% $Revision: 4986 $ +% $Date: 2010-12-16 13:33:43 +0100 (Thu, 16 Dec 2010) $ +% $Revision: 5156 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog @@ -211,9 +211,25 @@ :- module(nestedtries, [nested_trie_to_depth_breadth_trie/4]). -:- use_module(library(ordsets), [list_to_ord_set/2, ord_subset/2]). % this two might be better to do a custom fast implementation -:- use_module(library(lists), [memberchk/2, delete/3]). -:- use_module(library(tries), [trie_to_depth_breadth_trie/6, trie_get_depth_breadth_reduction_entry/1, trie_dup/2, trie_close/1, trie_open/1, trie_replace_nested_trie/3, trie_remove_entry/1, trie_get_entry/2, trie_put_entry/3, trie_traverse/2]). +:- use_module(library(ordsets), [list_to_ord_set/2, + ord_subset/2, + ord_union/3, + ord_intersection/3]). +:- use_module(library(lists), [append/3, + memberchk/2, + delete/3]). +:- use_module(library(tries), [trie_to_depth_breadth_trie/6, + trie_get_depth_breadth_reduction_entry/1, + trie_dup/2, + trie_close/1, + trie_open/1, + trie_replace_nested_trie/3, + trie_remove_entry/1, + trie_get_entry/2, + trie_put_entry/3, + trie_traverse/2, + trie_traverse_mode/1, + trie_usage/4]). :- use_module(flags, [problog_define_flag/5, problog_flag/2]). @@ -221,18 +237,21 @@ :- yap_flag(unknown,error). :- initialization(( -% problog_define_flag(subset_check, problog_flag_validate_boolean, 'perform subset check in nested tries', true, nested_tries), - problog_define_flag(loop_refine_ancs, problog_flag_validate_boolean, 'refine ancestors if no loop exists', true, nested_tries) -% problog_define_flag(trie_preprocess, problog_flag_validate_boolean, 'perform a preprocess step to nested tries', false, nested_tries), -% problog_define_flag(refine_anclst, problog_flag_validate_boolean, 'refine the ancestor list with their childs', false, nested_tries), -% problog_define_flag(anclst_represent,problog_flag_validate_in_list([list, integer]), 'represent the ancestor list', list, nested_tries) + problog_define_flag(subset_check, problog_flag_validate_boolean, 'perform subset check in nested tries', true, nested_tries), + problog_define_flag(loop_refine_ancs, problog_flag_validate_boolean, 'refine ancestors if no loop exists', true, nested_tries), + problog_define_flag(trie_preprocess, problog_flag_validate_boolean, 'perform a preprocess step to nested tries', false, nested_tries), + problog_define_flag(refine_anclst, problog_flag_validate_boolean, 'refine the ancestor list with their childs', false, nested_tries), + problog_define_flag(anclst_represent,problog_flag_validate_in_list([list, integer]), 'represent the ancestor list', list, nested_tries) )). -trie_replace_entry(_Trie, Entry, _E, false):- - !, trie_remove_entry(Entry). +trie_replace_entry(_Trie, Entry, E, false):- + trie_get_entry(Entry, Proof), + memberchk(E, Proof), !, + trie_remove_entry(Entry). trie_replace_entry(Trie, Entry, E, true):- - !, trie_get_entry(Entry, Proof), + trie_get_entry(Entry, Proof), + memberchk(E, Proof), !, delete(Proof, E, NewProof), (NewProof == [] -> trie_delete(Trie), @@ -275,6 +294,12 @@ is_label(Label, ID):- Label = not(NestedLabel), is_label(NestedLabel, ID). +simplify(not(false), true):- !. +simplify(not(true), false):- !. +simplify(not(not(A)), B):- + !, simplify(A, B). +simplify(A, A). + % Ancestor related stuff initialise_ancestors(0):- @@ -289,6 +314,13 @@ add_to_ancestors(ID, Ancestors, NewAncestors):- is_list(Ancestors), list_to_ord_set([ID|Ancestors], NewAncestors). +ancestors_union(Ancestors1, Ancestors2, NewAncestors):- + integer(Ancestors1), !, + NewAncestors is Ancestors1 \/ Ancestors2. +ancestors_union(Ancestors1, Ancestors2, NewAncestors):- + is_list(Ancestors1), + ord_union(Ancestors1, Ancestors2, NewAncestors). + ancestor_subset_check(SubAncestors, Ancestors):- integer(SubAncestors), !, SubAncestors is Ancestors /\ SubAncestors. @@ -302,17 +334,61 @@ ancestor_loop_refine(Loop, Ancestors, []):- var(Loop), is_list(Ancestors), !. ancestor_loop_refine(true, Ancestors, Ancestors). +ancestor_child_refine(true, Ancestors, Childs, NewAncestors):- + integer(Ancestors), !, + NewAncestors is Ancestors /\ Childs. +ancestor_child_refine(true, Ancestors, Childs, NewAncestors):- + is_list(Ancestors), !, + ord_intersection(Ancestors, Childs, NewAncestors). +ancestor_child_refine(false, Ancestors, _, Ancestors). + % Cycle check related stuff % missing synonym check cycle_check(ID, Ancestors):- + get_negated_synonym_id(ID, SynID), + cycle_check_intern(SynID, Ancestors). + +cycle_check_intern(ID, Ancestors):- integer(Ancestors), !, Bit is 1 << (ID - 1), Bit is Bit /\ Ancestors. -cycle_check(ID, Ancestors):- +cycle_check_intern(ID, Ancestors):- is_list(Ancestors), memberchk(ID, Ancestors). +get_negated_synonym_id(ID, ID). +get_negated_synonym_id(ID, NegID):- + tabling:has_synonyms, + recorded(problog_table, store(Pred, ID, _, _, _), _), + Pred =.. [Name0|Args], + atomic_concat(problog_, Name1, Name0), + atomic_concat(Name, '_original', Name1), + get_negated_name(Name, NotName1), + atomic_concat([problog_, NotName1, '_original'], NotName), + NegPred =.. [NotName|Args], + recorded(problog_table, store(NegPred, NegID, _, _, _), _). + +get_negated_name(Name, NotName1):- + recorded(problog_table_synonyms, negated(Name, NotName1), _), !. +get_negated_name(Name, NotName1):- + recorded(problog_table_synonyms, negated(NotName1, Name), _). + +trie_dup_reverse(Trie, DupTrie):- + trie_open(DupTrie), + trie_traverse_mode(backward), + trie_dup_rev(Trie, DupTrie), + trie_traverse_mode(forward). + +trie_dup_rev(Trie, DupTrie):- + \+ trie_usage(Trie, 0, 0, 0), + trie_traverse(Trie, Entry), + trie_get_entry(Entry, Term), + trie_put_entry(DupTrie, Term, _), + fail. +trie_dup_rev(_, _). + + preprocess(Index, DepthBreadthTrie, OptimizationLevel, StartCount, FinalEndCount):- problog:problog_chktabled(Index, Trie), !, trie_dup(Trie, CopyTrie), @@ -332,7 +408,7 @@ make_nested_trie_base_cases(Trie, t(ID), DepthBreadthTrie, OptimizationLevel, St make_nested_trie_base_cases(Trie, t(ID), DepthBreadthTrie, OptimizationLevel, EndCount, FinalEndCount, NewAncestors) ; FinalEndCount = EndCount, - get_set_trie(ID, Label, Ancestors) + set_trie(ID, Label, Ancestors) ). nested_trie_to_depth_breadth_trie(Trie, DepthBreadthTrie, FinalLabel, OptimizationLevel):- @@ -344,80 +420,69 @@ nested_trie_to_depth_breadth_trie(Trie, DepthBreadthTrie, FinalLabel, Optimizati StartCount = 0 ), initialise_ancestors(Ancestors), -% initialise_ancestors(Childs), (problog_flag(loop_refine_ancs, true) -> - trie_2_dbtrie_init(Trie, DepthBreadthTrie, OptimizationLevel, StartCount, _, Ancestors, FinalLabel, _) + trie_2_dbtrie_init(Trie, DepthBreadthTrie, OptimizationLevel, StartCount, _, Ancestors, FinalLabel, _, _Childs) ; - trie_2_dbtrie_init(Trie, DepthBreadthTrie, OptimizationLevel, StartCount, _, Ancestors, FinalLabel, true) + trie_2_dbtrie_init(Trie, DepthBreadthTrie, OptimizationLevel, StartCount, _, Ancestors, FinalLabel, true, _Childs) ), eraseall(problog_trie_table). -trie_2_dbtrie_init(ID, DepthBreadthTrie, OptimizationLevel, StartCount, EndCount, Ancestors, Label, ContainLoop):- +trie_2_dbtrie_init(ID, DepthBreadthTrie, OptimizationLevel, StartCount, EndCount, Ancestors, Label, ContainLoop, FinalChilds):- + initialise_ancestors(Childs), get_trie_pointer(ID, Trie), - trie_dup(Trie, CopyTrie), - trie_2_dbtrie_intern(CopyTrie, DepthBreadthTrie, OptimizationLevel, StartCount, EndCount, Ancestors, Label, ContainLoop), + trie_dup_reverse(Trie, CopyTrie), + trie_2_dbtrie_intern(CopyTrie, DepthBreadthTrie, OptimizationLevel, StartCount, EndCount, Ancestors, Label, ContainLoop, Childs, FinalChilds), trie_close(CopyTrie). -trie_2_dbtrie_intern(Trie, DepthBreadthTrie, OptimizationLevel, StartCount, FinalEndCount, Ancestors, TrieLabel, ContainLoop):- +trie_2_dbtrie_intern(Trie, DepthBreadthTrie, OptimizationLevel, StartCount, FinalEndCount, Ancestors, TrieLabel, ContainLoop, Childs, FinalChilds):- trie_to_depth_breadth_trie(Trie, DepthBreadthTrie, Label, OptimizationLevel, StartCount, EndCount), - (is_trie(Label, ID) -> % Label might have issues with negation + (is_trie(Label, ID) -> + problog_flag(refine_anclst, ChildRefineAncestors), trie_get_depth_breadth_reduction_entry(NestedEntry), - % check if Trie introduces a loop (cycle_check(ID, Ancestors) -> ContainLoop = true, NewLabel = false, + NewEndCount = EndCount, + initialise_ancestors(GrandChilds) + ; get_trie(ID, NewLabel, Ancestors) -> + GrandChilds = Ancestors, NewEndCount = EndCount ; - % check if Trie is resolved and extract it - (get_set_trie(ID, NewLabel, Ancestors) -> - NewEndCount = EndCount - ; - % calculate the nested trie - add_to_ancestors(ID, Ancestors, NewAncestors), % to be able to support 2 representations - trie_2_dbtrie_init(ID, DepthBreadthTrie, OptimizationLevel, EndCount, NewEndCount, NewAncestors, NewLabel, NewContainLoop), - ancestor_loop_refine(NewContainLoop, Ancestors, RefinedAncestors), - get_set_trie(ID, NewLabel, RefinedAncestors), - ContainLoop = NewContainLoop - ) + add_to_ancestors(ID, Ancestors, NewAncestors), + trie_2_dbtrie_init(ID, DepthBreadthTrie, OptimizationLevel, EndCount, NewEndCount, NewAncestors, DerefLabel, NewContainLoop, GrandChilds), + ancestor_loop_refine(NewContainLoop, Ancestors, RefinedAncestors1), + ancestor_child_refine(ChildRefineAncestors, RefinedAncestors1, GrandChilds, RefinedAncestors), + simplify(DerefLabel, NewLabel), + set_trie(ID, NewLabel, RefinedAncestors), + ContainLoop = NewContainLoop ), - trie_replace_entry(Trie, NestedEntry, t(ID), NewLabel), % should be careful to verify that it works also with not(t(ID)) - trie_2_dbtrie_intern(Trie, DepthBreadthTrie, OptimizationLevel, NewEndCount, FinalEndCount, Ancestors, TrieLabel, ContainLoop) + trie_replace_entry(Trie, NestedEntry, t(ID), NewLabel), + (ChildRefineAncestors -> + add_to_ancestors(ID, Childs, NewChilds1), + ancestors_union(NewChilds1, GrandChilds, NewChilds) + ; + NewChilds = Childs + ), + trie_2_dbtrie_intern(Trie, DepthBreadthTrie, OptimizationLevel, NewEndCount, FinalEndCount, Ancestors, TrieLabel, ContainLoop, NewChilds, FinalChilds) ; - % else we can terminate and return FinalEndCount = EndCount, - TrieLabel = Label + TrieLabel = Label, + FinalChilds = Childs ). % predicate to check/remember resolved tries -% no refiment of ancestor list included get_trie_pointer(ID, Trie):- problog:problog_chktabled(ID, Trie), !. get_trie_pointer(Trie, Trie). -get_set_trie(Trie, Label, Ancestors):- +get_trie(Trie, Label, Ancestors):- + problog_flag(subset_check, true), !, recorded(problog_trie_table, store(Trie, StoredAncestors, Label), _), - (problog_flag(subset_check, true) -> - ancestor_subset_check(StoredAncestors, Ancestors) - ; - StoredAncestors == Ancestors - ), !. -get_set_trie(Trie, Label, Ancestors):- - ground(Label), + ancestor_subset_check(StoredAncestors, Ancestors). +get_trie(Trie, Label, Ancestors):- + recorded(problog_trie_table, store(Trie, StoredAncestors, Label), _), + StoredAncestors == Ancestors. + +set_trie(Trie, Label, Ancestors):- recordz(problog_trie_table, store(Trie, Ancestors, Label), _). - - -% chk_negated([H|T], ID):- -% simplify(H, not(t(ID))), !. -% chk_negated([_|T], ID):- -% chk_negated(T, ID). - - -/* -chk_negated([], ID, ID). -chk_negated([H|T], ID, not(ID)):- - simplify(H, not(t(ID))), !. -chk_negated([H|T], ID, ID):- - simplify(H, t(ID)), !. -chk_negated([_|T], ID, FID):- - chk_negated(T, ID, FID).*/ diff --git a/packages/ProbLog/problog/os.yap b/packages/ProbLog/problog/os.yap index 670a9a28b..3067ab854 100644 --- a/packages/ProbLog/problog/os.yap +++ b/packages/ProbLog/problog/os.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-11-29 10:58:04 +0100 (Mon, 29 Nov 2010) $ -% $Revision: 5029 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/print.yap b/packages/ProbLog/problog/print.yap index 70fabd14d..b0b54a3aa 100644 --- a/packages/ProbLog/problog/print.yap +++ b/packages/ProbLog/problog/print.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-10-06 12:56:13 +0200 (Wed, 06 Oct 2010) $ -% $Revision: 4877 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/print_learning.yap b/packages/ProbLog/problog/print_learning.yap index 6a0e67bf9..8389bc570 100644 --- a/packages/ProbLog/problog/print_learning.yap +++ b/packages/ProbLog/problog/print_learning.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/ptree.yap b/packages/ProbLog/problog/ptree.yap index 2450f27b0..409895e22 100644 --- a/packages/ProbLog/problog/ptree.yap +++ b/packages/ProbLog/problog/ptree.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-12-02 14:35:05 +0100 (Thu, 02 Dec 2010) $ -% $Revision: 5041 $ +% $Date: 2010-12-16 13:33:43 +0100 (Thu, 16 Dec 2010) $ +% $Revision: 5156 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog @@ -282,12 +282,7 @@ problog_define_flag(use_naive_trie, problog_flag_validate_boolean, 'use the naive algorithm to generate bdd scripts', false), problog_define_flag(use_old_trie, problog_flag_validate_boolean, 'use the old trie 2 trie transformation no nested', true), problog_define_flag(use_dec_trie, problog_flag_validate_boolean, 'use the decomposition method', false), - problog_define_flag(subset_check, problog_flag_validate_boolean, 'perform subset check in nested tries', true), - problog_define_flag(deref_terms, problog_flag_validate_boolean, 'deref BDD terms after last use', false), - - problog_define_flag(trie_preprocess, problog_flag_validate_boolean, 'perform a preprocess step to nested tries', false), - problog_define_flag(refine_anclst, problog_flag_validate_boolean, 'refine the ancestor list with their childs', false), - problog_define_flag(anclst_represent,problog_flag_validate_in_list([list, integer]), 'represent the ancestor list', list) + problog_define_flag(deref_terms, problog_flag_validate_boolean, 'deref BDD terms after last use', false) )). @@ -1252,6 +1247,8 @@ add_to_vars(V):- variables_in_dbtrie(Trie, []):- empty_ptree(Trie), !. +variables_in_dbtrie(Trie, []):- + trie_check_entry(Trie, [true], _R), !. variables_in_dbtrie(Trie, L):- all(V, variable_in_dbtrie(Trie,V), L). @@ -1339,10 +1336,11 @@ is_state(false). nested_trie_to_bdd_trie(A, B, OutputFile, OptimizationLevel, FileParam):- % trie_nested_to_depth_breadth_trie(A, B, LL, OptimizationLevel, problog:problog_chktabled), nested_trie_to_depth_breadth_trie(A, B, LL, OptimizationLevel), - (is_label(LL) -> + simplify(LL, FLL), + (is_label(FLL) -> retractall(deref(_,_)), (problog_flag(deref_terms, true) -> - asserta(deref(LL,no)), + asserta(deref(FLL,no)), mark_for_deref(B), V = 3 ; @@ -1358,7 +1356,7 @@ nested_trie_to_bdd_trie(A, B, OutputFile, OptimizationLevel, FileParam):- write('@BDD'), write(V), nl, write(VarCNT), nl, write(0), nl, - (LL = not(NegL)-> + (FLL = not(NegL)-> atomic_concat('L', NegStep, NegL), number_atom(NegStepN, NegStep), InterStep is NegStepN + 1, @@ -1368,19 +1366,18 @@ nested_trie_to_bdd_trie(A, B, OutputFile, OptimizationLevel, FileParam):- write(FL), write(' = ~'), write(NegL), nl, write(FL), nl ; - atomic_concat('L', InterStep, LL), + atomic_concat('L', InterStep, FLL), write(InterStep), nl, - trie_write(B, LL), - write(LL), nl + trie_write(B, FLL), + write(FLL), nl ), told ; - (is_state(LL) -> + (is_state(FLL) -> Edges = [] ; - Edges = [LL] + Edges = [FLL] ), - writeln(Edges), tell(FileParam), simplify_list(Edges, SEdges), bdd_vars_script(SEdges), @@ -1390,12 +1387,11 @@ nested_trie_to_bdd_trie(A, B, OutputFile, OptimizationLevel, FileParam):- write(1), nl, write(0), nl, write(1), nl, - (LL = not(_) -> + (FLL = not(_) -> write('L1 = ~') ; write('L1 = ') ), - simplify(LL, FLL), get_var_name(FLL, NLL), write(NLL),nl, write('L1'), nl, @@ -1830,6 +1826,7 @@ ptree_decomposition(Trie, BDDFileName, VarFileName) :- tmpnam(TmpFile1), nb_setval(next_inter_step, 1), variables_in_dbtrie(Trie, T), + length(T, VarCnt), tell(VarFileName), bdd_vars_script(T), @@ -1860,6 +1857,9 @@ get_next_inter_step(I):- decompose_trie(Trie, _, false):- empty_ptree(Trie), !. +decompose_trie(Trie, _, 'TRUE'):- + trie_check_entry(Trie, [true], _R),!. + decompose_trie(Trie, [H|[]], Var):- trie_usage(Trie, 1, _, _), get_var_name(H, VarA), @@ -1871,9 +1871,6 @@ decompose_trie(Trie, [H|[]], Var):- ), !. -decompose_trie(Trie, _, 'TRUE'):- - trie_check_entry(Trie, [true], _R),!. - decompose_trie(Trie, [H|_T], L3):- trie_open(TrieWith), trie_open(TrieWithNeg), diff --git a/packages/ProbLog/problog/sampling.yap b/packages/ProbLog/problog/sampling.yap index 908ba692e..92a93b3e5 100644 --- a/packages/ProbLog/problog/sampling.yap +++ b/packages/ProbLog/problog/sampling.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/tabling.yap b/packages/ProbLog/problog/tabling.yap index 2a5780b5e..1171fd126 100644 --- a/packages/ProbLog/problog/tabling.yap +++ b/packages/ProbLog/problog/tabling.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-11-09 15:09:33 +0100 (Tue, 09 Nov 2010) $ -% $Revision: 4992 $ +% $Date: 2010-12-13 16:29:18 +0100 (Mon, 13 Dec 2010) $ +% $Revision: 5122 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog @@ -298,12 +298,6 @@ problog_table_next_index(Index):- NIndex is Index + 1, nb_setval(problog_tabling_next_index, NIndex). -makeargs(0, []):-!. -makeargs(N, [_Arg|L]):- - N > 0, - NN is N - 1, - makeargs(NN, L). - problog_table(M:P) :- !, problog_table(P, M). problog_table(P) :- @@ -311,21 +305,21 @@ problog_table(P) :- problog_table(P, M). problog_table(M:P, _) :- - problog_table(P, M). + problog_table(P, M). problog_table((P1, P2), M) :- - problog_table(P1, M), - problog_table(P2, M). + problog_table(P1, M), + problog_table(P2, M). problog_table(Name/Arity, Module) :- - makeargs(Arity, Args), - Head =.. [Name|Args], - \+ predicate_property(Module:Head, dynamic), !, - throw(error('problog_table: Problog tabling currently requires the predicate to be declared dynamic and compiles it to static.')). + length(Args,Arity), + Head =.. [Name|Args], + \+ predicate_property(Module:Head, dynamic), !, + throw(error('problog_table: Problog tabling currently requires the predicate to be declared dynamic and compiles it to static.')). problog_table(Name/Arity, Module) :- - makeargs(Arity, Args), - Head =.. [Name|Args], - atom_concat(['problog_', Name, '_original'], OriginalName), - atom_concat(['problog_', Name, '_mctabled'], MCName), - atom_concat(['problog_', Name, '_tabled'], ExactName), + length(Args,Arity), + Head =.. [Name|Args], + atom_concat(['problog_', Name, '_original'], OriginalName), + atom_concat(['problog_', Name, '_mctabled'], MCName), + atom_concat(['problog_', Name, '_tabled'], ExactName), % Monte carlo tabling catch((table(Module:MCName/Arity), @@ -413,8 +407,8 @@ problog_table(Name/Arity, Module) :- erase(Ref), (empty_ptree(HashTrie) -> recordz(problog_table, store(OriginalPred, Hash, HashTrie, SuspTrie, fail), _NRef), - delete_ptree(SuspTrie), - fail % no justification exists + delete_ptree(SuspTrie) %, + %fail % no justification exists ; recordz(problog_table, store(OriginalPred, Hash, HashTrie, SuspTrie, true), _NRef), merge_ptree(HashTrie, SuspTrie), diff --git a/packages/ProbLog/problog/timer.yap b/packages/ProbLog/problog/timer.yap index d8d6617d6..0369dd744 100644 --- a/packages/ProbLog/problog/timer.yap +++ b/packages/ProbLog/problog/timer.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-10-15 17:09:55 +0200 (Fri, 15 Oct 2010) $ -% $Revision: 4939 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/utils.yap b/packages/ProbLog/problog/utils.yap index 92291640c..fad3f2326 100644 --- a/packages/ProbLog/problog/utils.yap +++ b/packages/ProbLog/problog/utils.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-12-02 14:35:05 +0100 (Thu, 02 Dec 2010) $ -% $Revision: -1 $ +% $Date: 2010-12-15 15:52:58 +0100 (Wed, 15 Dec 2010) $ +% $Revision: 5144 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog @@ -211,20 +211,21 @@ slice_n/4, sorted_overlap_test/2, prefix_bdd_file_with_header/4, - split_list/3]). + split_list/3, + succeeds_n_times/2, + sum_forall/3]). :- use_module(library(system), [delete_file/1]). -% load swi library, at some point vitor will make swi_expand_file_name/2 a built-in -:- load_foreign_files([libplstream], [], initIO). - % load our own modules :- use_module(os). +:- meta_predicate succeeds_n_times(0,?), sum_forall(?,:,?). + %======================================================================== -%= -%= +%= deletes File, if it doesn't exists, it will succeed silently +%= delete_file_silently(+File) %======================================================================== delete_file_silently(File) :- @@ -232,9 +233,10 @@ delete_file_silently(File) :- !. delete_file_silently(_). + %======================================================================== -%= -%= +%= delete all the files in the list silently +%= delete_files_silently(+List) %======================================================================== delete_files_silently([]). @@ -242,23 +244,25 @@ delete_files_silently([H|T]) :- delete_file_silently(H), delete_files_silently(T). + %======================================================================== -%= -%= +%= delete all the files matching a certain pattern silently +%= i.e. delete_file_pattern_silently('~/a_path/b_path/','*.txt') +%= +%= delete_file_pattern_silently(+Path,+Pattern) %======================================================================== delete_file_pattern_silently(Path,Pattern) :- concat_path_with_filename(Path,Pattern,AbsolutePattern), - swi_expand_file_name(AbsolutePattern,Files), - + expand_file_name(AbsolutePattern,Files), delete_files_silently(Files). + %======================================================================== %= Split a list into the first n elements and the tail -%= +List +Integer -Prefix -Residuum +%= slice_n(+List, +Integer, -Prefix, -Residuum) %======================================================================== - slice_n([],_,[],[]) :- !. slice_n([H|T],N,[H|T2],T3) :- @@ -268,9 +272,11 @@ slice_n([H|T],N,[H|T2],T3) :- slice_n(T,N2,T2,T3). slice_n(L,0,[],L). + %======================================================================== %= succeeds if the variable V appears exactly once in the term T %======================================================================== + variable_in_term_exactly_once(T,V) :- term_variables(T,Vars), var_memberchk_once(Vars,V). @@ -287,6 +293,7 @@ var_memberchk_none([H|T],V) :- var_memberchk_none(T,V). var_memberchk_none([],_). + %======================================================================== %= sorted_overlap_test(+L1,+L2) %= L1 and L2 are ground sorted lists @@ -314,7 +321,7 @@ sorted_overlap_test([_|T1],[H2|T2]) :- prefix_bdd_file_with_header(BDD_File_Name,VarCount,IntermediateSteps,TmpFile) :- open(BDD_File_Name,write,H), % this is the header of the BDD script for problogbdd - format(H, '@BDD1~n~q~n0~n~q~n',[VarCount,IntermediateSteps]), + format(H, '@BDD1~n~w~n0~n~w~n',[VarCount,IntermediateSteps]), % append the content of the file TmpFile open(TmpFile,read,H2), @@ -333,12 +340,15 @@ prefix_bdd_file_with_header(BDD_File_Name,VarCount,IntermediateSteps,TmpFile) :- %======================================================================== +%= Split the list L in the two lists L1 and L2 such that +%= append(L1,L2,L) holds. %= +%= if length of L is even, then L1 and L2 will have the same length +%= if length of L is odd, then L1 will be one element longer than L2 %= -%= +%= split_list(+L,-L1,-L2) %======================================================================== - split_list([],[],[]). split_list([H|T],L1,L2) :- length([H|T],Len), @@ -349,4 +359,35 @@ split_list_intern(0,L,[],L). split_list_intern(N,[H|T],[H|T1],L) :- N>0, N2 is N-1, - split_list_intern(N2,T,T1,L). \ No newline at end of file + split_list_intern(N2,T,T1,L). + +%======================================================================== +%= Counts how often Goal succeeds +%= (taken from the YAP manual) +%======================================================================== + +succeeds_n_times(Goal, Times) :- + Counter = counter(0), + ( Goal, + arg(1, Counter, N0), + N is N0 + 1, + nb_setarg(1, Counter, N), + fail + ; arg(1, Counter, Times) + ). + + +%======================================================================== +%= +%= +%======================================================================== + +sum_forall(X,Goal, Sum) :- + Temp = sum(0), + ( Goal, + arg(1, Temp, Sum0), + Sum is Sum0+X, + nb_setarg(1, Temp, Sum), + fail + ; arg(1, Temp, Sum) + ). \ No newline at end of file diff --git a/packages/ProbLog/problog/utils_learning.yap b/packages/ProbLog/problog/utils_learning.yap index 64551487f..4f2dab94d 100644 --- a/packages/ProbLog/problog/utils_learning.yap +++ b/packages/ProbLog/problog/utils_learning.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-12-02 14:35:05 +0100 (Thu, 02 Dec 2010) $ -% $Revision: 5041 $ +% $Date: 2010-12-14 20:30:07 +0100 (Tue, 14 Dec 2010) $ +% $Revision: 5134 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog @@ -209,7 +209,10 @@ create_known_values_file_name/2, create_bdd_file_name/3, create_bdd_input_file_name/2, - create_bdd_output_file_name/4]). + create_bdd_output_file_name/4, + create_factprobs_file_name/2, + create_test_predictions_file_name/2, + create_training_predictions_file_name/2]). @@ -249,10 +252,7 @@ empty_output_directory :- delete_file_pattern_silently(Path,'values_*'), delete_file_pattern_silently(Path,'factprobs_*'), delete_file_pattern_silently(Path,'input_*'), - delete_file_pattern_silently(Path,'trainpredictions_*'), - delete_file_pattern_silently(Path,'testpredictions_*'), delete_file_pattern_silently(Path,'predictions_*'). - empty_output_directory :- throw(error(problog_flag_does_not_exist(output_directory))). @@ -311,4 +311,47 @@ create_bdd_input_file_name(Iteration,Absolute_File_Name) :- atomic_concat(['input_',Iteration,'.txt'],File_Name), concat_path_with_filename(Path,File_Name,Absolute_File_Name). create_bdd_input_file_name(_,_) :- + throw(error(problog_flag_does_not_exist(output_directory))). + +%======================================================================== +%= +%= +%======================================================================== + +create_factprobs_file_name(Iteration,Absolute_File_Name) :- + problog_flag(output_directory,Path), + !, + + atomic_concat(['factprobs_',Iteration,'.pl'],File_Name), + concat_path_with_filename(Path,File_Name,Absolute_File_Name). +create_factprobs_file_name(_,_) :- + throw(error(problog_flag_does_not_exist(output_directory))). + + +%======================================================================== +%= +%= +%======================================================================== + +create_test_predictions_file_name(Iteration,Absolute_File_Name) :- + problog_flag(output_directory,Path), + !, + + atomic_concat(['predictions_test_',Iteration,'.pl'],File_Name), + concat_path_with_filename(Path,File_Name,Absolute_File_Name). +create_test_predictions_file_name(_,_) :- + throw(error(problog_flag_does_not_exist(output_directory))). + +%======================================================================== +%= +%= +%======================================================================== + +create_training_predictions_file_name(Iteration,Absolute_File_Name) :- + problog_flag(output_directory,Path), + !, + + atomic_concat(['predictions_training_',Iteration,'.pl'],File_Name), + concat_path_with_filename(Path,File_Name,Absolute_File_Name). +create_training_predictions_file_name(_,_) :- throw(error(problog_flag_does_not_exist(output_directory))). \ No newline at end of file diff --git a/packages/ProbLog/problog/variable_elimination.yap b/packages/ProbLog/problog/variable_elimination.yap index fa07ba521..ba7d18836 100644 --- a/packages/ProbLog/problog/variable_elimination.yap +++ b/packages/ProbLog/problog/variable_elimination.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/variables.yap b/packages/ProbLog/problog/variables.yap index c34bb88d6..b6d521421 100644 --- a/packages/ProbLog/problog/variables.yap +++ b/packages/ProbLog/problog/variables.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-09-28 21:04:43 +0200 (Tue, 28 Sep 2010) $ -% $Revision: 4838 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog/version_control.yap b/packages/ProbLog/problog/version_control.yap index 0c86057ba..b1e4ffa6e 100644 --- a/packages/ProbLog/problog/version_control.yap +++ b/packages/ProbLog/problog/version_control.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-10-05 18:15:57 +0200 (Tue, 05 Oct 2010) $ -% $Revision: 4876 $ +% $Date: 2010-12-02 15:20:15 +0100 (Thu, 02 Dec 2010) $ +% $Revision: 5043 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog diff --git a/packages/ProbLog/problog_learning.yap b/packages/ProbLog/problog_learning.yap index 407e4f4c5..6055a8ef4 100644 --- a/packages/ProbLog/problog_learning.yap +++ b/packages/ProbLog/problog_learning.yap @@ -2,8 +2,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% $Date: 2010-12-02 14:35:05 +0100 (Thu, 02 Dec 2010) $ -% $Revision: 5041 $ +% $Date: 2010-12-15 15:05:44 +0100 (Wed, 15 Dec 2010) $ +% $Revision: 5142 $ % % This file is part of ProbLog % http://dtai.cs.kuleuven.be/problog @@ -216,7 +216,7 @@ % load modules from the YAP library :- use_module(library(lists), [max_list/2, min_list/2, sum_list/2]). -:- use_module(library(system), [delete_file/1, file_exists/1, shell/2]). +:- use_module(library(system), [file_exists/1, shell/2]). % load our own modules :- use_module(problog). @@ -226,6 +226,7 @@ :- use_module('problog/print_learning'). :- use_module('problog/utils_learning'). :- use_module('problog/utils'). +:- use_module('problog/tabling'). % used to indicate the state of the system :- dynamic(values_correct/0). @@ -256,76 +257,14 @@ user:test_example(A,B,C,=) :- %======================================================================== %= store the facts with the learned probabilities to a file -%= if F is a variable, a filename based on the current iteration is used -%= %======================================================================== save_model:- current_iteration(Iteration), - atomic_concat(['factprobs_',Iteration,'.pl'],Filename), - problog_flag(output_directory,Dir), - concat_path_with_filename(Dir,Filename,Filename2), - export_facts(Filename2). + create_factprobs_file_name(Iteration,Filename), + export_facts(Filename). -%======================================================================== -%= store the current succes probabilities for training and test examples -%= -%======================================================================== - -save_predictions:- - current_iteration(Iteration), - atomic_concat(['predictions_',Iteration,'.pl'],Filename), - problog_flag(output_directory,Dir), - concat_path_with_filename(Dir,Filename,Filename2), - - open(Filename2,'append',Handle), - format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",[]), - format(Handle,"% Iteration, train/test, QueryID, Query, GroundTruth, Prediction %\n",[]), - format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",[]), - !, - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % start save prediction test examples - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ( % go over all test examples - current_predicate(user:test_example/4), - user:test_example(Query_ID,Query,TrueQueryProb,_), - query_probability(Query_ID,LearnedQueryProb), - - format(Handle,'ex(~q,test,~q,~q,~10f,~10f).\n', - [Iteration,Query_ID,Query,TrueQueryProb,LearnedQueryProb]), - - fail; % go to next test example - true - ), - !, - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % stop save prediction test examples - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % start save prediction training examples - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ( % go over all training examples - current_predicate(user:example/4), - user:example(Query_ID,Query,TrueQueryProb,_), - query_probability(Query_ID,LearnedQueryProb), - - format(Handle,'ex(~q,train,~q,~q,~10f,~10f).\n', - [Iteration,Query_ID,Query,TrueQueryProb,LearnedQueryProb]), - - fail; % go to next training example - true - ), - !, - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % stop save prediction training examples - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - format(Handle,'~3n',[]), - close(Handle). - %======================================================================== @@ -339,7 +278,7 @@ check_examples :- % Check example IDs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ( - (current_predicate(user:example/4),user:example(ID,_,_,_), \+ atomic(ID)) + (user:example(ID,_,_,_), \+ atomic(ID)) -> ( format(user_error,'The example id of training example ~q ',[ID]), @@ -349,7 +288,7 @@ check_examples :- ), ( - (current_predicate(user:test_example/4),user:test_example(ID,_,_,_), \+ atomic(ID)) + (user:test_example(ID,_,_,_), \+ atomic(ID)) -> ( format(user_error,'The example id of test example ~q ',[ID]), @@ -362,7 +301,7 @@ check_examples :- % Check example probabilities %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ( - (current_predicate(user:example/4),user:example(ID,_,P,_), (\+ number(P); P>1 ; P<0)) + (user:example(ID,_,P,_), (\+ number(P); P>1 ; P<0)) -> ( format(user_error,'The training example ~q does not have a valid probability value (~q).~n',[ID,P]), @@ -371,7 +310,7 @@ check_examples :- ), ( - (current_predicate(user:test_example/4),user:test_example(ID,_,P,_), (\+ number(P); P>1 ; P<0)) + (user:test_example(ID,_,P,_), (\+ number(P); P>1 ; P<0)) -> ( format(user_error,'The test example ~q does not have a valid probability value (~q).~n',[ID,P]), @@ -387,22 +326,18 @@ check_examples :- ( ( ( - current_predicate(user:example/4), user:example(ID,QueryA,_,_), user:example(ID,QueryB,_,_), QueryA \= QueryB ) ; ( - current_predicate(user:test_example/4), user:test_example(ID,QueryA,_,_), user:test_example(ID,QueryB,_,_), QueryA \= QueryB ); ( - current_predicate(user:example/4), - current_predicate(user:test_example/4), user:example(ID,QueryA,_,_), user:test_example(ID,QueryB,_,_), QueryA \= QueryB @@ -419,9 +354,7 @@ check_examples :- %======================================================================== reset_learning :- - retractall(current_iteration(_)), retractall(learning_initialized), - retractall(values_correct), retractall(current_iteration(_)), retractall(example_count(_)), @@ -474,7 +407,6 @@ do_learning_intern(Iterations,Epsilon) :- logger_set_variable(iteration,CurrentIteration), logger_start_timer(duration), - mse_testset, ground_truth_difference, gradient_descent, @@ -484,10 +416,7 @@ do_learning_intern(Iterations,Epsilon) :- ( ( Log_Frequency>0, 0 =:= CurrentIteration mod Log_Frequency) -> - ( - once(save_predictions), - once(save_model) - ); + once(save_model); true ), @@ -583,55 +512,29 @@ init_learning :- ) -> ( - format('Theory uses continuous facts.~nWill use problog_exact/3 as initalization method.~2n',[]), + format_learning(2,'Theory uses continuous facts.~nWill use problog_exact/3 as initalization method.~2n',[]), + set_problog_flag(init_method,(Query,Probability,BDDFile,ProbFile,problog_exact_save(Query,Probability,_Status,BDDFile,ProbFile))) + ); + true + ), + + ( + problog_tabled(_) + -> + ( + format_learning(2,'Theory uses tabling.~nWill use problog_exact/3 as initalization method.~2n',[]), set_problog_flag(init_method,(Query,Probability,BDDFile,ProbFile,problog_exact_save(Query,Probability,_Status,BDDFile,ProbFile))) ); true ), - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % start count test examples - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - bb_put(test_examples,0), - ( % go over all test examples - current_predicate(user:test_example/4), - user:test_example(_,_,_,_), - bb_get(test_examples, OldCounter), - NewCounter is OldCounter+1, - bb_put(test_examples,NewCounter), - - fail; % go to next text example - true - ), - bb_delete(test_examples,TestExampleCount), + succeeds_n_times(user:example(_,_,_,_),TestExampleCount), format_learning(3,'~q test examples~n',[TestExampleCount]), - !, - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % stop count test examples - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % start count training examples - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - bb_put(training_examples,0), - ( % go over all training examples - current_predicate(user:example/4), - user:example(_,_,_,_), - bb_get(training_examples, OldCounter), - NewCounter is OldCounter+1, - bb_put(training_examples,NewCounter), - - fail; %go to next training example - true - ), - bb_delete(training_examples,TrainingExampleCount), + succeeds_n_times(user:example(_,_,_,_),TrainingExampleCount), assertz(example_count(TrainingExampleCount)), format_learning(3,'~q training examples~n',[TrainingExampleCount]), - !, - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % stop count training examples - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -647,8 +550,17 @@ init_learning :- ( problog_flag(alpha,auto) -> - auto_alpha; - true + ( + (user:example(_,_,P,_),P<1,P>0) + -> + set_problog_flag(alpha,1.0); + ( + succeed_n_times((user:example(_,_,P,=),P=:=1.0),Pos_Count), + succeed_n_times((user:example(_,_,P,=),P=:=0.0),Neg_Count), + Alpha is Pos_Count/Neg_Count, + set_problog_flag(alpha,Alpha) + ) + ) ), %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -675,33 +587,16 @@ init_learning :- init_queries :- format_learning(2,'Build BDDs for examples~n',[]), - ( % go over all test examples - current_predicate(user:test_example/4), - user:test_example(ID,Query,Prob,_), - format_learning(3,' test example ~q: ~q~n',[ID,Query]), - flush_output(user), - init_one_query(ID,Query,test), - - fail; % go to next test example - true - ), - ( % go over all training examples - current_predicate(user:example/4), - user:example(ID,Query,Prob,_), - format_learning(3,' training example ~q: ~q~n',[ID,Query]), - flush_output(user), - init_one_query(ID,Query,training), - - fail; %go to next training example - true - ). - + forall(user:test_example(ID,Query,_Prob,_),init_one_query(ID,Query,test)), + forall(user:example(ID,Query,_Prob,_),init_one_query(ID,Query,training)). bdd_input_file(Filename) :- problog_flag(output_directory,Dir), concat_path_with_filename(Dir,'input.txt',Filename). init_one_query(QueryID,Query,Type) :- + format_learning(3,' ~q example ~q: ~q~n',[Type,QueryID,Query]), + bdd_input_file(Probabilities_File), problog_flag(bdd_directory,Query_Directory), @@ -718,7 +613,7 @@ init_one_query(QueryID,Query,Type) :- ( problog_flag(init_method,(Query,_Prob,Filename,Probabilities_File,Call)), once(Call), - delete_file(Probabilities_File) + delete_file_silently(Probabilities_File) ) ), @@ -774,27 +669,19 @@ update_values :- open(Probabilities_File,'write',Handle), - ( % go over all probabilistic facts - get_fact_probability(ID,Prob), - inv_sigmoid(Prob,Value), - ( - non_ground_fact(ID) - -> - format(Handle,'@x~q_*~n~10f~n',[ID,Value]); - format(Handle,'@x~q~n~10f~n',[ID,Value]) - ), + forall(get_fact_probability(ID,Prob), + ( + inv_sigmoid(Prob,Value), + ( + non_ground_fact(ID) + -> + format(Handle,'@x~q_*~n~10f~n',[ID,Value]); + format(Handle,'@x~q~n~10f~n',[ID,Value]) + ) + )), - fail; % go to next probabilistic fact - true - ), - - ( % go over all continuous facts - get_continuous_fact_parameters(ID,gaussian(Mu,Sigma)), - format(Handle,'@x~q_*~n0~n0~n~10f;~10f~n',[ID,Mu,Sigma]), - - fail; % go to next continuous fact - true - ), + forall(get_continuous_fact_parameters(ID,gaussian(Mu,Sigma)), + format(Handle,'@x~q_*~n0~n0~n~10f;~10f~n',[ID,Mu,Sigma])), close(Handle), !, @@ -885,11 +772,10 @@ update_query(QueryID,Symbol,What_To_Update) :- ) ), - delete_file(Values_Filename), + delete_file_silently(Values_Filename), format_learning(4,'~w',[Symbol]) ) - ), - flush_output(user). + ). %======================================================================== @@ -998,73 +884,86 @@ ground_truth_difference :- %======================================================================== mse_trainingset_only_for_linesearch(MSE) :- - ( - current_predicate(user:example/4) - -> - ( - update_values, - findall(SquaredError, - (user:example(QueryID,_Query,QueryProb,Type), - once(update_query(QueryID,'.',probability)), - query_probability(QueryID,CurrentProb), - once(update_query_cleanup(QueryID)), - ( - (Type == '='; (Type == '<', CurrentProb>QueryProb); (Type=='>',CurrentProb - SquaredError is (CurrentProb-QueryProb)**2; - SquaredError = 0.0 - ) - ), - - AllSquaredErrors), + update_values, - length(AllSquaredErrors,Length), - sum_list(AllSquaredErrors,SumAllSquaredErrors), - MSE is SumAllSquaredErrors/Length, - format_learning(3,' (~8f)~n',[MSE]) - ); true - ), + example_count(Example_Count), + + bb_put(error_train_line_search,0.0), + forall(user:example(QueryID,_Query,QueryProb,Type), + ( + once(update_query(QueryID,'.',probability)), + query_probability(QueryID,CurrentProb), + once(update_query_cleanup(QueryID)), + ( + (Type == '='; (Type == '<', CurrentProb>QueryProb); (Type=='>',CurrentProb + ( + bb_get(error_train_line_search,Old_Error), + New_Error is Old_Error + (CurrentProb-QueryProb)**2, + bb_put(error_train_line_search,New_Error) + );true + ) + ) + ), + bb_delete(error_train_line_search,Error), + MSE is Error/Example_Count, + format_learning(3,' (~8f)~n',[MSE]), retractall(values_correct). mse_testset :- + current_iteration(Iteration), + create_test_predictions_file_name(Iteration,File_Name), + open(File_Name,'write',Handle), + format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%~n",[]), + format(Handle,"% Iteration, train/test, QueryID, Query, GroundTruth, Prediction %~n",[]), + format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%~n",[]), + + format_learning(2,'MSE_Test ',[]), + update_values, + bb_put(llh_test_queries,0.0), + findall(SquaredError, + (user:test_example(QueryID,Query,TrueQueryProb,Type), + once(update_query(QueryID,'+',probability)), + query_probability(QueryID,CurrentProb), + format(Handle,'ex(~q,test,~q,~q,~10f,~10f).~n',[Iteration,QueryID,Query,TrueQueryProb,CurrentProb]), + once(update_query_cleanup(QueryID)), + ( + (Type == '='; (Type == '<', CurrentProb>QueryProb); (Type=='>',CurrentProb + SquaredError is (CurrentProb-TrueQueryProb)**2; + SquaredError = 0.0 + ), + bb_get(llh_test_queries,Old_LLH_Test_Queries), + New_LLH_Test_Queries is Old_LLH_Test_Queries+log(CurrentProb), + bb_put(llh_test_queries,New_LLH_Test_Queries) + ), + AllSquaredErrors), + + close(Handle), + bb_delete(llh_test_queries,LLH_Test_Queries), + + length(AllSquaredErrors,Length), + ( - (current_predicate(user:test_example/4),user:test_example(_,_,_,_)) + Length>0 -> ( - format_learning(2,'MSE_Test ',[]), - update_values, - bb_put(llh_test_queries,0.0), - findall(SquaredError, - (user:test_example(QueryID,_Query,QueryProb,Type), - once(update_query(QueryID,'+',probability)), - query_probability(QueryID,CurrentProb), - once(update_query_cleanup(QueryID)), - ( - (Type == '='; (Type == '<', CurrentProb>QueryProb); (Type=='>',CurrentProb - SquaredError is (CurrentProb-QueryProb)**2; - SquaredError = 0.0 - ), - bb_get(llh_test_queries,Old_LLH_Test_Queries), - New_LLH_Test_Queries is Old_LLH_Test_Queries+log(CurrentProb), - bb_put(llh_test_queries,New_LLH_Test_Queries) - ), - AllSquaredErrors), - - length(AllSquaredErrors,Length), sum_list(AllSquaredErrors,SumAllSquaredErrors), min_list(AllSquaredErrors,MinError), max_list(AllSquaredErrors,MaxError), - MSE is SumAllSquaredErrors/Length, - bb_delete(llh_test_queries,LLH_Test_Queries), + MSE is SumAllSquaredErrors/Length + );( + MSE=0.0, + MinError=0.0, + MaxError=0.0 + ) + ), - logger_set_variable(mse_testset,MSE), - logger_set_variable(mse_min_testset,MinError), - logger_set_variable(mse_max_testset,MaxError), - logger_set_variable(llh_test_queries,LLH_Test_Queries), - format_learning(2,' (~8f)~n',[MSE]) - ); true - ). + logger_set_variable(mse_testset,MSE), + logger_set_variable(mse_min_testset,MinError), + logger_set_variable(mse_max_testset,MaxError), + logger_set_variable(llh_test_queries,LLH_Test_Queries), + format_learning(2,' (~8f)~n',[MSE]). %======================================================================== %= Calculates the sigmoid function respectivly the inverse of it @@ -1097,107 +996,100 @@ inv_sigmoid(T,InvSig) :- %======================================================================== save_old_probabilities :- - ( % go over all tunable facts - tunable_fact(FactID,_), - - ( - continuous_fact(FactID) - -> - - ( - get_continuous_fact_parameters(FactID,gaussian(OldMu,OldSigma)), - atomic_concat(['old_mu_',FactID],Key), - atomic_concat(['old_sigma_',FactID],Key2), - bb_put(Key,OldMu), - bb_put(Key2,OldSigma) - ); - ( - get_fact_probability(FactID,OldProbability), - atomic_concat(['old_prob_',FactID],Key), - bb_put(Key,OldProbability) - ) - ), - - fail; % go to next tunable fact - true - ). + forall(tunable_fact(FactID,_), + ( + continuous_fact(FactID) + -> + ( + get_continuous_fact_parameters(FactID,gaussian(OldMu,OldSigma)), + atomic_concat(['old_mu_',FactID],Key), + atomic_concat(['old_sigma_',FactID],Key2), + bb_put(Key,OldMu), + bb_put(Key2,OldSigma) + ); + ( + get_fact_probability(FactID,OldProbability), + atomic_concat(['old_prob_',FactID],Key), + bb_put(Key,OldProbability) + ) + ) + ). -forget_old_probabilities :- - ( % go over all tunable facts - tunable_fact(FactID,_), - ( - continuous_fact(FactID) - -> - ( - atomic_concat(['old_mu_',FactID],Key), - atomic_concat(['old_sigma_',FactID],Key2), - atomic_concat(['grad_mu_',FactID],Key3), - atomic_concat(['grad_sigma_',FactID],Key4), - bb_delete(Key,_), - bb_delete(Key2,_), - bb_delete(Key3,_), - bb_delete(Key4,_) - ); - ( - atomic_concat(['old_prob_',FactID],Key), - atomic_concat(['grad_',FactID],Key2), - bb_delete(Key,_), - bb_delete(Key2,_) - ) - ), - - fail; % go to next tunable fact - true - ). +forget_old_probabilities :- + forall(tunable_fact(FactID,_), + ( + continuous_fact(FactID) + -> + ( + atomic_concat(['old_mu_',FactID],Key), + atomic_concat(['old_sigma_',FactID],Key2), + atomic_concat(['grad_mu_',FactID],Key3), + atomic_concat(['grad_sigma_',FactID],Key4), + bb_delete(Key,_), + bb_delete(Key2,_), + bb_delete(Key3,_), + bb_delete(Key4,_) + ); + ( + atomic_concat(['old_prob_',FactID],Key), + atomic_concat(['grad_',FactID],Key2), + bb_delete(Key,_), + bb_delete(Key2,_) + ) + ) + ). add_gradient(Learning_Rate) :- - ( % go over all tunable facts - tunable_fact(FactID,_), - ( - continuous_fact(FactID) - -> - ( - atomic_concat(['old_mu_',FactID],Key), - atomic_concat(['old_sigma_',FactID],Key2), - atomic_concat(['grad_mu_',FactID],Key3), - atomic_concat(['grad_sigma_',FactID],Key4), - - bb_get(Key,Old_Mu), - bb_get(Key2,Old_Sigma), - bb_get(Key3,Grad_Mu), - bb_get(Key4,Grad_Sigma), + forall(tunable_fact(FactID,_), + ( + continuous_fact(FactID) + -> + ( + atomic_concat(['old_mu_',FactID],Key), + atomic_concat(['old_sigma_',FactID],Key2), + atomic_concat(['grad_mu_',FactID],Key3), + atomic_concat(['grad_sigma_',FactID],Key4), + + bb_get(Key,Old_Mu), + bb_get(Key2,Old_Sigma), + bb_get(Key3,Grad_Mu), + bb_get(Key4,Grad_Sigma), - Mu is Old_Mu -Learning_Rate* Grad_Mu, - Sigma is exp(log(Old_Sigma) -Learning_Rate* Grad_Sigma), + Mu is Old_Mu -Learning_Rate* Grad_Mu, + Sigma is exp(log(Old_Sigma) -Learning_Rate* Grad_Sigma), - set_continuous_fact_parameters(FactID,gaussian(Mu,Sigma)) - ); - ( - atomic_concat(['old_prob_',FactID],Key), - atomic_concat(['grad_',FactID],Key2), + set_continuous_fact_parameters(FactID,gaussian(Mu,Sigma)) + ); + ( + atomic_concat(['old_prob_',FactID],Key), + atomic_concat(['grad_',FactID],Key2), + + bb_get(Key,OldProbability), + bb_get(Key2,GradValue), - bb_get(Key,OldProbability), - bb_get(Key2,GradValue), + inv_sigmoid(OldProbability,OldValue), + NewValue is OldValue -Learning_Rate*GradValue, + sigmoid(NewValue,NewProbability), - inv_sigmoid(OldProbability,OldValue), - NewValue is OldValue -Learning_Rate*GradValue, - sigmoid(NewValue,NewProbability), - - % Prevent "inf" by using values too close to 1.0 - Prob_Secure is min(0.999999999,max(0.000000001,NewProbability)), - set_fact_probability(FactID,Prob_Secure) - ) - ), - - fail; % go to next tunable fact - true - ), + % Prevent "inf" by using values too close to 1.0 + Prob_Secure is min(0.999999999,max(0.000000001,NewProbability)), + set_fact_probability(FactID,Prob_Secure) + ) + ) + ), retractall(values_correct). gradient_descent :- + current_iteration(Iteration), + create_training_predictions_file_name(Iteration,File_Name), + open(File_Name,'write',Handle), + format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%~n",[]), + format(Handle,"% Iteration, train/test, QueryID, Query, GroundTruth, Prediction %~n",[]), + format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%~n",[]), + format_learning(2,'Gradient ',[]), save_old_probabilities, @@ -1206,33 +1098,26 @@ gradient_descent :- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % start set gradient to zero %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ( % go over all tunable facts + forall(tunable_fact(FactID,_), + ( + continuous_fact(FactID) + -> - tunable_fact(FactID,_), - ( - continuous_fact(FactID) - -> - - ( - atomic_concat(['grad_mu_',FactID],Key), - atomic_concat(['grad_sigma_',FactID],Key2), - bb_put(Key,0.0), - bb_put(Key2,0.0) - ); - ( - atomic_concat(['grad_',FactID],Key), - bb_put(Key,0.0) - ) - ), - - fail; % go to next tunable fact - - true - ), + ( + atomic_concat(['grad_mu_',FactID],Key), + atomic_concat(['grad_sigma_',FactID],Key2), + bb_put(Key,0.0), + bb_put(Key2,0.0) + ); + ( + atomic_concat(['grad_',FactID],Key), + bb_put(Key,0.0) + ) + ) + ), %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % stop gradient to zero %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - !, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % start calculate gradient @@ -1246,103 +1131,102 @@ gradient_descent :- logger_set_variable(alpha,Alpha), example_count(Example_Count), - ( % go over all training examples - current_predicate(user:example/4), - user:example(QueryID,_Query,QueryProb,Type), - once(update_query(QueryID,'.',all)), - query_probability(QueryID,BDDProb), - ( - QueryProb=:=0.0 - -> - Y2=Alpha; - Y2=1.0 - ), - ( - (Type == '='; (Type == '<', BDDProb>QueryProb); (Type=='>',BDDProb - Y is Y2*2/Example_Count * (BDDProb-QueryProb); - Y=0.0 - ), + forall(user:example(QueryID,Query,QueryProb,Type), + ( + once(update_query(QueryID,'.',all)), + query_probability(QueryID,BDDProb), + format(Handle,'ex(~q,train,~q,~q,~10f,~10f).~n',[Iteration,QueryID,Query,QueryProb,BDDProb]), + ( + QueryProb=:=0.0 + -> + Y2=Alpha; + Y2=1.0 + ), + ( + (Type == '='; (Type == '<', BDDProb>QueryProb); (Type=='>',BDDProb + Y is Y2*2/Example_Count * (BDDProb-QueryProb); + Y=0.0 + ), - % first do the calculations for the MSE on training set - ( - (Type == '='; (Type == '<', BDDProb>QueryProb); (Type=='>',BDDProb - Squared_Error is (BDDProb-QueryProb)**2; - Squared_Error=0.0 - ), + % first do the calculations for the MSE on training set + ( + (Type == '='; (Type == '<', BDDProb>QueryProb); (Type=='>',BDDProb + Squared_Error is (BDDProb-QueryProb)**2; + Squared_Error=0.0 + ), - bb_get(mse_train_sum,Old_MSE_Train_Sum), - bb_get(mse_train_min,Old_MSE_Train_Min), - bb_get(mse_train_max,Old_MSE_Train_Max), - bb_get(llh_training_queries,Old_LLH_Training_Queries), - New_MSE_Train_Sum is Old_MSE_Train_Sum+Squared_Error, - New_MSE_Train_Min is min(Old_MSE_Train_Min,Squared_Error), - New_MSE_Train_Max is max(Old_MSE_Train_Max,Squared_Error), - New_LLH_Training_Queries is Old_LLH_Training_Queries+log(BDDProb), - bb_put(mse_train_sum,New_MSE_Train_Sum), - bb_put(mse_train_min,New_MSE_Train_Min), - bb_put(mse_train_max,New_MSE_Train_Max), - bb_put(llh_training_queries,New_LLH_Training_Queries), + bb_get(mse_train_sum,Old_MSE_Train_Sum), + bb_get(mse_train_min,Old_MSE_Train_Min), + bb_get(mse_train_max,Old_MSE_Train_Max), + bb_get(llh_training_queries,Old_LLH_Training_Queries), + New_MSE_Train_Sum is Old_MSE_Train_Sum+Squared_Error, + New_MSE_Train_Min is min(Old_MSE_Train_Min,Squared_Error), + New_MSE_Train_Max is max(Old_MSE_Train_Max,Squared_Error), + New_LLH_Training_Queries is Old_LLH_Training_Queries+log(BDDProb), + bb_put(mse_train_sum,New_MSE_Train_Sum), + bb_put(mse_train_min,New_MSE_Train_Min), + bb_put(mse_train_max,New_MSE_Train_Max), + bb_put(llh_training_queries,New_LLH_Training_Queries), - ( % go over all tunable facts - tunable_fact(FactID,_), - ( - continuous_fact(FactID) - -> - - ( - atomic_concat(['grad_mu_',FactID],Key), - atomic_concat(['grad_sigma_',FactID],Key2), + ( % go over all tunable facts + tunable_fact(FactID,_), + ( + continuous_fact(FactID) + -> + ( + atomic_concat(['grad_mu_',FactID],Key), + atomic_concat(['grad_sigma_',FactID],Key2), % if the following query fails, % it means, the fact is not used in the proof % of QueryID, and the gradient is 0.0 and will % not contribute to NewValue either way % DON'T FORGET THIS IF YOU CHANGE SOMETHING HERE! - query_gradient(QueryID,FactID,mu,GradValueMu), - query_gradient(QueryID,FactID,sigma,GradValueSigma), + query_gradient(QueryID,FactID,mu,GradValueMu), + query_gradient(QueryID,FactID,sigma,GradValueSigma), - bb_get(Key,OldValueMu), - bb_get(Key2,OldValueSigma), + bb_get(Key,OldValueMu), + bb_get(Key2,OldValueSigma), - NewValueMu is OldValueMu + Y*GradValueMu, - NewValueSigma is OldValueSigma + Y*GradValueSigma, + NewValueMu is OldValueMu + Y*GradValueMu, + NewValueSigma is OldValueSigma + Y*GradValueSigma, - bb_put(Key,NewValueMu), - bb_put(Key2,NewValueSigma) - ); - ( - atomic_concat(['grad_',FactID],Key), + bb_put(Key,NewValueMu), + bb_put(Key2,NewValueSigma) + ); + ( + atomic_concat(['grad_',FactID],Key), % if the following query fails, % it means, the fact is not used in the proof % of QueryID, and the gradient is 0.0 and will % not contribute to NewValue either way % DON'T FORGET THIS IF YOU CHANGE SOMETHING HERE! - query_gradient(QueryID,FactID,p,GradValue), + query_gradient(QueryID,FactID,p,GradValue), - bb_get(Key,OldValue), - NewValue is OldValue + Y*GradValue, - bb_put(Key,NewValue) - ) - ), + bb_get(Key,OldValue), + NewValue is OldValue + Y*GradValue, + bb_put(Key,NewValue) + ) + ), - fail; % go to next fact - true - ), - - once(update_query_cleanup(QueryID)), - fail; % go to next training example - true - ), + fail; % go to next fact + true + ), + + once(update_query_cleanup(QueryID)) + )), %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % stop calculate gradient %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% !, + + close(Handle), %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % start statistics on gradient @@ -1431,85 +1315,67 @@ lineSearch(Final_X,Final_Value) :- % init values Acc is Tol * (B-A), InitRight is A + Tau*(B-A), - InitLeft is A + B - InitRight, + InitLeft is B - Tau*(B-A), line_search_evaluate_point(A,Value_A), line_search_evaluate_point(B,Value_B), line_search_evaluate_point(InitRight,Value_InitRight), line_search_evaluate_point(InitLeft,Value_InitLeft), - bb_put(line_search_a,A), - bb_put(line_search_b,B), - bb_put(line_search_left,InitLeft), - bb_put(line_search_right,InitRight), - bb_put(line_search_value_a,Value_A), - bb_put(line_search_value_b,Value_B), - bb_put(line_search_value_left,Value_InitLeft), - bb_put(line_search_value_right,Value_InitRight), - - bb_put(line_search_iteration,1), + Parameters=ls(A,B,InitLeft,InitRight,Value_A,Value_B,Value_InitLeft,Value_InitRight,1), %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% BEGIN BACK TRACKING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ( - repeat, + repeat, - bb_get(line_search_iteration,Iteration), - bb_get(line_search_a,Ak), - bb_get(line_search_b,Bk), - bb_get(line_search_left,Left), - bb_get(line_search_right,Right), - - bb_get(line_search_value_a,Fl), - bb_get(line_search_value_b,Fr), - bb_get(line_search_value_left,FLeft), - bb_get(line_search_value_right,FRight), + Parameters=ls(Ak,Bk,Left,Right,Fl,Fr,FLeft,FRight,Iteration), ( % check for infinity, if there is, go to the left - ( FLeft >= FRight, \+ FLeft = (+inf), \+ FRight = (+inf) ) - -> - ( - AkNew=Left, - FlNew=FLeft, - LeftNew=Right, - FLeftNew=FRight, - RightNew is AkNew + Bk - LeftNew, - line_search_evaluate_point(RightNew,FRightNew), - BkNew=Bk, - FrNew=Fr - ); - ( - BkNew=Right, - FrNew=FRight, - RightNew=Left, - FRightNew=FLeft, - LeftNew is Ak + BkNew - RightNew, + ( FLeft >= FRight, \+ FLeft = (+inf), \+ FRight = (+inf) ) + -> + ( + AkNew=Left, + FlNew=FLeft, + LeftNew=Right, + FLeftNew=FRight, + RightNew is Left + Bk - Right, + line_search_evaluate_point(RightNew,FRightNew), + BkNew=Bk, + FrNew=Fr, + Interval_Size is Bk-Left + ); + ( + BkNew=Right, + FrNew=FRight, + RightNew=Left, + FRightNew=FLeft, + LeftNew is Ak + Right - Left, - line_search_evaluate_point(LeftNew,FLeftNew), - AkNew=Ak, - FlNew=Fl - ) + line_search_evaluate_point(LeftNew,FLeftNew), + AkNew=Ak, + FlNew=Fl, + Interval_Size is Right-Ak + ) ), Next_Iteration is Iteration + 1, - - bb_put(line_search_iteration,Next_Iteration), - bb_put(line_search_a,AkNew), - bb_put(line_search_b,BkNew), - bb_put(line_search_left,LeftNew), - bb_put(line_search_right,RightNew), + nb_setarg(9,Parameters,Next_Iteration), + nb_setarg(1,Parameters,AkNew), + nb_setarg(2,Parameters,BkNew), + nb_setarg(3,Parameters,LeftNew), + nb_setarg(4,Parameters,RightNew), + nb_setarg(5,Parameters,FlNew), + nb_setarg(6,Parameters,FrNew), + nb_setarg(7,Parameters,FLeftNew), + nb_setarg(8,Parameters,FRightNew), - bb_put(line_search_value_a,FlNew), - bb_put(line_search_value_b,FrNew), - bb_put(line_search_value_left,FLeftNew), - bb_put(line_search_value_right,FRightNew), - - % is the search interval smaller than the tolerance level? - BkNew-AkNew0, - !, - set_problog_flag(alpha,1.0). -auto_alpha :- - findall(1,(user:example(_,_,P,=),P=:=1.0),Pos), - findall(0,(user:example(_,_,P,=),P=:=0.0),Neg), - length(Pos,NP), - length(Neg,NN), - Alpha is NP/NN, - set_problog_flag(alpha,Alpha). - - %======================================================================== %= initialize the logger module and set the flags for learning diff --git a/packages/ProbLog/simplecudd/problogmath.c b/packages/ProbLog/simplecudd/problogmath.c index d768fb790..bc06f5ba9 100644 --- a/packages/ProbLog/simplecudd/problogmath.c +++ b/packages/ProbLog/simplecudd/problogmath.c @@ -7,8 +7,8 @@ * * * Author: Bernd Gutmann * * File: problogmath.c * -* $Date:: 2010-10-06 13:20:59 +0200 (Wed, 06 Oct 2010) $ * -* $Revision:: 4880 $ * +* $Date:: 2010-12-17 12:21:58 +0100 (Fri, 17 Dec 2010) $ * +* $Revision:: 5159 $ * * * ******************************************************************************** * * @@ -187,7 +187,7 @@ \******************************************************************************/ #include "problogmath.h" - +#include "general.h" double sigmoid(double x, double slope) { return 1.0 / (1.0 + exp(-x * slope)); diff --git a/packages/ProbLog/simplecudd/problogmath.h b/packages/ProbLog/simplecudd/problogmath.h index 2df38c626..2b56d41a4 100644 --- a/packages/ProbLog/simplecudd/problogmath.h +++ b/packages/ProbLog/simplecudd/problogmath.h @@ -7,8 +7,8 @@ * * * Author: Bernd Gutmann * * File: problogmath.h * -* $Date:: 2010-10-06 13:20:59 +0200 (Wed, 06 Oct 2010) $ * -* $Revision:: 4880 $ * +* $Date:: 2010-12-17 12:21:58 +0100 (Fri, 17 Dec 2010) $ * +* $Revision:: 5159 $ * * * ******************************************************************************** * * @@ -212,4 +212,6 @@ double cumulative_normal_upper(double high, double mu, double sigma); double cumulative_normal_upper_dsigma(double high,double mu,double sigma); double cumulative_normal_upper_dmu(double high,double mu,double sigma); +double normal(double x, double mu,double sigma); + density_integral parse_density_integral_string(char *input, char *variablename); diff --git a/packages/ProbLog/simplecudd/simplecudd.c b/packages/ProbLog/simplecudd/simplecudd.c index 07698b2f8..56a76807c 100644 --- a/packages/ProbLog/simplecudd/simplecudd.c +++ b/packages/ProbLog/simplecudd/simplecudd.c @@ -7,8 +7,8 @@ * * * Author: Theofrastos Mantadelis * * File: simplecudd.c * -* $Date:: 2010-10-06 13:20:59 +0200 (Wed, 06 Oct 2010) $ * -* $Revision:: 4880 $ * +* $Date:: 2010-12-17 12:21:58 +0100 (Fri, 17 Dec 2010) $ * +* $Revision:: 5159 $ * * * ******************************************************************************** * * @@ -1688,7 +1688,7 @@ int GetParam(char *inputline, int iParam) { void onlinetraverse(DdManager *manager, namedvars varmap, hisqueue *HisQueue, DdNode *bdd) { char buf, *inputline; - int icur, maxlinesize, iline, index, iloop, iQsize, i, inQ, iRoot; //ivalue, + int icur, maxlinesize, iline, index, iloop, iQsize, i, iRoot; //ivalue,inQ, // double dvalue; DdNode **Q, **Q2, *h_node, *l_node, *curnode; hisqueue *his; diff --git a/pl/signals.yap b/pl/signals.yap index 298e7bf93..cd7eb7612 100644 --- a/pl/signals.yap +++ b/pl/signals.yap @@ -191,11 +191,21 @@ Run \= off, '$zip'(-1, G, Mod), !, '$signal_creep', - '$execute_nonstop'(G,Mod). + '$execute_goal'(G, Mod). '$start_creep'([Mod|G]) :- CP is '$last_choice_pt', '$do_spy'(G, Mod, CP, no). +'$execute_goal'(G, Mod) :- + ( + '$is_metapredicate'(G, Mod) + -> + '$meta_call'(G,Mod) + ; + '$execute_nonstop'(G,Mod) + ). + + '$signal_do'(Sig, Goal) :- recorded('$signal_handler', action(Sig,Goal), _), !. '$signal_do'(Sig, Goal) :-