diff --git a/.gitignore b/.gitignore index faccf25e8..dbae7786b 100644 --- a/.gitignore +++ b/.gitignore @@ -215,3 +215,4 @@ cmake/docs/Doxyfile *.stackdump *.gz +.Rproj.user diff --git a/C/absmi.c b/C/absmi.c index 1ec017858..fcd31e639 100755 --- a/C/absmi.c +++ b/C/absmi.c @@ -916,26 +916,24 @@ static int interrupt_dexecute(USES_REGS1) { static void undef_goal(USES_REGS1) { PredEntry *pe = PredFromDefCode(P); - /* avoid trouble with undefined dynamic procedures */ - /* I assume they were not locked beforehand */ - #if defined(YAPOR) || defined(THREADS) + BEGD(d0); +/* avoid trouble with undefined dynamic procedures */ +/* I assume they were not locked beforehand */ +#if defined(YAPOR) || defined(THREADS) if (!PP) { PELOCK(19, pe); PP = pe; } #endif - BACKUP_MACHINE_REGS(); -if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag) ) { + if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag) ) { #if defined(YAPOR) || defined(THREADS) UNLOCKPE(19, PP); PP = NULL; #endif CalculateStackGap(PASS_REGS1); P = FAILCODE; - RECOVER_MACHINE_REGS(); return; } -#if DEBUG if (UndefCode == NULL || UndefCode->OpcodeOfPred == UNDEF_OPCODE) { fprintf(stderr,"call to undefined Predicates %s ->", IndicatorOfPred(pe)); Yap_DebugPlWriteln(ARG1); @@ -948,28 +946,16 @@ if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag) ) { #endif CalculateStackGap(PASS_REGS1); P = FAILCODE; - RECOVER_MACHINE_REGS(); return; } -#endif #if defined(YAPOR) || defined(THREADS) UNLOCKPE(19, PP); PP = NULL; - #endif - CELL o = AbsPair(HR); - if (pe->ModuleOfPred == PROLOG_MODULE) { - if (CurrentModule == PROLOG_MODULE) - HR[0] = TermProlog; - else - HR[0] = CurrentModule; - } else { - HR[0] = Yap_Module_Name(pe); - } - HR += 2; +#endif if (pe->ArityOfPE == 0) { - HR[-1] = MkAtomTerm((Atom)(pe->FunctorOfPred)); + d0 = MkAtomTerm((Atom)(pe->FunctorOfPred)); } else { - HR[-1] = AbsAppl(HR); + d0 = AbsAppl(HR); *HR++ = (CELL)pe->FunctorOfPred; CELL *ip=HR; UInt imax = pe->ArityOfPE; @@ -998,20 +984,30 @@ if (pe->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MultiFileFlag) ) { ENDD(d1); } } - ARG1 = o; - ARG2 = MkVarTerm(); + ARG1 = AbsPair(HR); + HR[1] = d0; +ENDD(d0); + if (pe->ModuleOfPred == PROLOG_MODULE) { + if (CurrentModule == PROLOG_MODULE) + HR[0] = TermProlog; + else + HR[0] = CurrentModule; + } else { + HR[0] = Yap_Module_Name(pe); + } + ARG2 = Yap_getUnknownModule(Yap_GetModuleEntry(HR[0])); + HR += 2; #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) low_level_trace(enter_pred, UndefCode, XREGS + 1); #endif /* LOW_LEVEL_TRACE */ P = UndefCode->CodeOfPred; - RECOVER_MACHINE_REGS(); } static void spy_goal(USES_REGS1) { PredEntry *pe = PredFromDefCode(P); - BACKUP_MACHINE_REGS(); + #if defined(YAPOR) || defined(THREADS) if (!PP) { PELOCK(14, pe); @@ -1031,7 +1027,6 @@ static void spy_goal(USES_REGS1) { PP = NULL; } #endif - RECOVER_MACHINE_REGS(); return; } } @@ -1049,7 +1044,6 @@ static void spy_goal(USES_REGS1) { } #endif Yap_NilError(CALL_COUNTER_UNDERFLOW_EVENT, ""); - RECOVER_MACHINE_REGS(); return; } LOCAL_PredEntriesCounter--; @@ -1061,7 +1055,6 @@ static void spy_goal(USES_REGS1) { } #endif Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT, ""); - RECOVER_MACHINE_REGS(); return; } if ((pe->PredFlags & (CountPredFlag | ProfiledPredFlag | SpiedPredFlag)) == @@ -1073,7 +1066,6 @@ static void spy_goal(USES_REGS1) { } #endif P = pe->cs.p_code.TrueCodeOfPred; - RECOVER_MACHINE_REGS(); return; } } @@ -1092,7 +1084,6 @@ static void spy_goal(USES_REGS1) { PP = NULL; } #endif - RECOVER_MACHINE_REGS(); return; } } @@ -1162,7 +1153,6 @@ static void spy_goal(USES_REGS1) { low_level_trace(enter_pred, pt0, XREGS + 1); #endif /* LOW_LEVEL_TRACE */ } - RECOVER_MACHINE_REGS(); } Int Yap_absmi(int inp) { diff --git a/C/absmi_insts.h b/C/absmi_insts.h index a26eb830b..5499274c2 100644 --- a/C/absmi_insts.h +++ b/C/absmi_insts.h @@ -9,8 +9,8 @@ #endif /* INDENT_CODE */ BOp(Ystop, l); - //LOCAL_CBorder = 0; - //SET_ASP(YREG, E_CB * sizeof(CELL)); + LOCAL_CBorder = 0; + SET_ASP(YREG, E_CB * sizeof(CELL)); /* make sure ASP is initialized */ saveregs(); @@ -20,12 +20,12 @@ #if BP_FREE P1REG = PCBACKUP; #endif - //LOCAL_CBorder = 0; + LOCAL_CBorder = 0; return 1; ENDBOp(); BOp(Nstop, e); - //SET_ASP(YREG, E_CB * sizeof(CELL)); + SET_ASP(YREG, E_CB * sizeof(CELL)); saveregs(); #if PUSH_REGS restore_absmi_regs(old_regs); diff --git a/C/c_interface.c b/C/c_interface.c index 6efe45e64..bd0496267 100755 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -1,4 +1,4 @@ -/************************************************************************* * +/************************************************************************* * * YAP Prolog * * Yap Prolog was developed at NCCUP - Universidade do Porto * * * @@ -421,25 +421,8 @@ X_API void *YAP_BlobOfTerm(Term t) { if (IsVarTerm(t)) return NULL; - if (!IsBigIntTerm(t)) { - if (IsAtomTerm(t)) { - AtomEntry *ae = RepAtom(AtomOfTerm(t)); - StaticArrayEntry *pp; - - READ_LOCK(ae->ARWLock); - pp = RepStaticArrayProp(ae->PropsOfAE); - while (!EndOfPAEntr(pp) && pp->KindOfPE != ArrayProperty) - pp = RepStaticArrayProp(pp->NextOfPE); - if (EndOfPAEntr(pp) || pp->ValueOfVE.ints == NULL) { - READ_UNLOCK(ae->ARWLock); - return NULL; - } else { - READ_UNLOCK(ae->ARWLock); - return pp->ValueOfVE.ints; - } - } + if (!IsBigIntTerm(t)) return NULL; - } src = (MP_INT *)(RepAppl(t) + 2); return (void *)(src + 1); } @@ -1159,6 +1142,8 @@ X_API Int YAP_Execute(PredEntry *pe, CPredicate exec_code) { // if (pe->PredFlags & CArgsPredFlag) { // CurrentModule = pe->ModuleOfPred; //} + int lvl = push_text_stack(); + yhandle_t hdl = Yap_CurrentHandle(); if (pe->PredFlags & SWIEnvPredFlag) { CPredicateV codev = (CPredicateV)exec_code; struct foreign_context ctx; @@ -1178,12 +1163,15 @@ X_API Int YAP_Execute(PredEntry *pe, CPredicate exec_code) { // check for junk: open frames, etc */ if (ret) complete_exit(((choiceptr)(LCL0 - OASP)), FALSE, FALSE PASS_REGS); - else + else { complete_fail(((choiceptr)(LCL0 - OASP)), FALSE PASS_REGS); + } // CurrentModule = omod; if (!ret) { Yap_RaiseException(); } + Yap_RecoverHandles(0, hdl); + pop_text_stack( lvl ); return ret; } @@ -1756,36 +1744,35 @@ X_API bool YAP_EnterGoal(YAP_PredEntryPtr ape, CELL *ptr, YAP_dogoalinfo *dgi) { CACHE_REGS PredEntry *pe = ape; bool out; - fprintf(stderr,"EnterGoal: H=%ld ENV=%ld B=%ld TR=%ld P=%p CP=%p, Slots=%ld\n",HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, - LOCAL_CurSlot); + // fprintf(stderr,"1EnterGoal: H=%d ENV=%p B=%d TR=%d P=%p CP=%p + // Slots=%d\n",HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, + // LOCAL_CurSlot); BACKUP_MACHINE_REGS(); + dgi->lvl = push_text_stack(); LOCAL_ActiveError->errorNo = YAP_NO_ERROR; LOCAL_PrologMode = UserMode; dgi->p = P; dgi->cp = CP; dgi->b0 = LCL0 - (CELL *)B; - dgi->e = LCL0-ENV; - dgi->CurSlot = LOCAL_CurSlot; + dgi->env0 = LCL0 - ENV; // ensure our current ENV receives current P. - Yap_PrepGoal(pe->ArityOfPE, nullptr, dgi PASS_REGS); + Yap_PrepGoal(pe->ArityOfPE, nullptr, B PASS_REGS); P = pe->CodeOfPred; - // __android_log_print(ANDROID_LOG_INFO, "YAP ", "ap=%p %ld %x %x args=%x,%x - // slot=%ld", pe, pe->CodeOfPred->opc, FAILCODE, Deref(ARG1), Deref(ARG2), + // __android_log_print(ANDROID_LOG_INFO, "YAP ", "ap=%p %d %x %x args=%x,%x + // slot=%d", pe, pe->CodeOfPred->opc, FAILCODE, Deref(ARG1), Deref(ARG2), // LOCAL_CurSlot); - dgi->b = LCL0 - (CELL *)B; + dgi->b_entry = LCL0 - (CELL *)B; dgi->h = HR - H0; dgi->tr = (CELL *)TR - LCL0; - // fprintf(stderr,"PrepGoal: H=%ld ENV=%p B=%ld TR=%ld P=%p CP=%p Slots=%ld\n", + // fprintf(stderr,"PrepGoal: H=%d ENV=%p B=%d TR=%d P=%p CP=%p Slots=%d\n", // HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, LOCAL_CurSlot); out = Yap_exec_absmi(true, false); - // fprintf(stderr,"EnterGoal success=%ld: H=%ld ENV=%p B=%ld TR=%ld P=%p CP=%p - // Slots=%ld\n", out,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, + // fprintf(stderr,"EnterGoal success=%d: H=%d ENV=%p B=%d TR=%d P=%p CP=%p + // Slots=%d\n", out,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, // LOCAL_CurSlot); - dgi->b = (LCL0 - (CELL*)B); - dgi->e = LCL0 - (CELL *)B; - dgi->a = LCL0 - (CELL *)ASP; + dgi->b_exit = LCL0 - (CELL *)B; if (out) { dgi->EndSlot = LOCAL_CurSlot; Yap_StartSlots(); @@ -1793,6 +1780,7 @@ X_API bool YAP_EnterGoal(YAP_PredEntryPtr ape, CELL *ptr, YAP_dogoalinfo *dgi) { LOCAL_CurSlot = dgi->CurSlot; // ignore any slots created within the called goal } + pop_text_stack(dgi->lvl); RECOVER_MACHINE_REGS(); return out; } @@ -1803,8 +1791,9 @@ X_API bool YAP_RetryGoal(YAP_dogoalinfo *dgi) { bool out; BACKUP_MACHINE_REGS(); - myB = (choiceptr)(LCL0 - dgi->b); - myB0 = (choiceptr)(LCL0 - dgi->b0); + dgi->lvl = push_text_stack(); + myB = (choiceptr)(LCL0 - dgi->b_exit); + myB0 = (choiceptr)(LCL0 - dgi->b_entry); CP = myB->cp_cp; /* sanity check */ if (B >= myB0) { @@ -1814,64 +1803,60 @@ X_API bool YAP_RetryGoal(YAP_dogoalinfo *dgi) { // get rid of garbage choice-points B = myB; } - // fprintf(stderr,"RetryGoal: H=%ld ENV=%p B=%ld TR=%ld P=%p CP=%p Slots=%ld\n", + // fprintf(stderr,"RetryGoal: H=%d ENV=%p B=%d TR=%d P=%p CP=%p Slots=%d\n", // HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, CP, LOCAL_CurSlot); P = FAILCODE; /* make sure we didn't leave live slots when we backtrack */ + ASP = (CELL *)B; LOCAL_CurSlot = dgi->EndSlot; out = Yap_exec_absmi(true, true ); if (out) { dgi->EndSlot = LOCAL_CurSlot; - dgi->b = LCL0-CellPtr(myB); + dgi->b_exit = LCL0 - (CELL *)B; } else { + printf("F %ld\n", dgi->CurSlot); LOCAL_CurSlot = dgi->CurSlot; // ignore any slots created within the called goal } + pop_text_stack(dgi->lvl); RECOVER_MACHINE_REGS(); return out; } X_API bool YAP_LeaveGoal(bool successful, YAP_dogoalinfo *dgi) { CACHE_REGS - choiceptr myB, handler; - // fprintf(stderr,"LeaveGoal success=%ld: H=%d ENV=%p B=%ldd myB=%ldd TR=%ld - // P=%p CP=%p Slots=%ld\n", + // fprintf(stderr,"LeaveGoal success=%d: H=%d ENV=%p B=%ld myB=%ld TR=%d + // P=%p CP=%p Slots=%d\n", // successful,HR-H0,LCL0-ENV,LCL0-(CELL*)B,dgi->b0,(CELL*)TR-LCL0, P, CP, // LOCAL_CurSlot); BACKUP_MACHINE_REGS(); - myB = (choiceptr)(LCL0 - dgi->b); - if (LOCAL_PrologMode & AsyncIntMode) { - Yap_signal(YAP_FAIL_SIGNAL); - } - handler = B; - while (handler && - LCL0 - LOCAL_CBorder > (CELL *)handler - //&& handler->cp_ap != NOCODE - && handler->cp_b != NULL && handler != myB) { - if (handler < myB) { - handler->cp_ap = TRUSTFAILCODE; - } - B = handler; - handler = handler->cp_b; + + dgi->lvl = push_text_stack(); if (successful) { + choiceptr nB = (choiceptr)(LCL0 - dgi->b_entry); + if (B <= nB) { + B = nB; + } Yap_TrimTrail(); - } else if (!(LOCAL_PrologMode & AsyncIntMode)) { - P = FAILCODE; - Yap_exec_absmi(true, YAP_EXEC_ABSMI); - } - } - if (LOCAL_PrologMode & AsyncIntMode) { + B = B->cp_b; + } else if (LOCAL_PrologMode & AsyncIntMode) { Yap_signal(YAP_FAIL_SIGNAL); } + B = (choiceptr)(LCL0 - dgi->b0); +#ifdef DEPTH_LIMIT + DEPTH = B->cp_depth; +#endif P = dgi->p; CP = dgi->cp; - ENV = LCL0-dgi->e; - ASP = LCL0-dgi->a; - B = (choiceptr)(LCL0-dgi->b) + YENV = ENV = LCL0-dgi->env0; + LOCAL_CurSlot = + dgi->CurSlot; // ignore any slots created within the called goal + pop_text_stack(dgi->lvl); RECOVER_MACHINE_REGS(); - fprintf(stderr,"LeftGoal success=%d: H=%ld ENV=%ld B=%ld TR=%ld P=%p CP=%p, Slots=%ld\n", successful,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, - CP, LOCAL_CurSlot); + // fprintf(stderr," LeftGoal success=%d: H=%d ENV=%p B=%d TR=%d P=%p CP=%p + // Slots=%d\n", successful,HR-H0,LCL0-ENV,LCL0-(CELL*)B,(CELL*)TR-LCL0, P, + // CP, LOCAL_CurSlot); return TRUE; } @@ -1881,6 +1866,8 @@ X_API Int YAP_RunGoal(Term t) { yhandle_t cslot = LOCAL_CurSlot; BACKUP_MACHINE_REGS(); +int lvl = push_text_stack(); + LOCAL_AllowRestart = FALSE; LOCAL_PrologMode = UserMode; out = Yap_RunTopGoal(t, true); @@ -1889,6 +1876,7 @@ X_API Int YAP_RunGoal(Term t) { // We'll pass it through RECOVER_MACHINE_REGS(); LOCAL_CurSlot = cslot; + pop_text_stack(lvl); return out; } @@ -1962,11 +1950,12 @@ X_API CELL *YAP_HeapStoreOpaqueTerm(Term t) { X_API Int YAP_RunGoalOnce(Term t) { CACHE_REGS Term out; - yamop *old_CP = CP; + yamop *old_CP = CP, *old_P = P; Int oldPrologMode = LOCAL_PrologMode; yhandle_t CSlot; BACKUP_MACHINE_REGS(); + int lvl = push_text_stack(); CSlot = Yap_StartSlots(); LOCAL_PrologMode = UserMode; // Yap_heap_regs->yap_do_low_level_trace=true; @@ -1975,6 +1964,7 @@ X_API Int YAP_RunGoalOnce(Term t) { // Yap_CloseSlots(CSlot); if (!(oldPrologMode & UserCCallMode)) { /* called from top-level */ + pop_text_stack( lvl); LOCAL_AllowRestart = FALSE; RECOVER_MACHINE_REGS(); return out; @@ -2009,13 +1999,14 @@ X_API Int YAP_RunGoalOnce(Term t) { ASP = B->cp_env; ENV = (CELL *)ASP[E_E]; B = (choiceptr)ASP[E_CB]; -#ifdef DEPTH_LIMITxs +#ifdef DEPTH_LIMIT DEPTH = ASP[E_DEPTH]; #endif - P = (yamop *)ASP[E_CP]; + P = old_P; CP = old_CP; LOCAL_AllowRestart = FALSE; RECOVER_MACHINE_REGS(); + pop_text_stack( lvl); return out; } @@ -2098,7 +2089,7 @@ X_API void YAP_PruneGoal(YAP_dogoalinfo *gi) { CACHE_REGS BACKUP_B(); - choiceptr myB = (choiceptr)(LCL0 - gi->b); + choiceptr myB = (choiceptr)(LCL0 - gi->b_entry); while (B != myB) { /* make sure we prune C-choicepoints */ if (POP_CHOICE_POINT(B->cp_b)) { @@ -2155,7 +2146,7 @@ int lvl = push_text_stack(); sno = Yap_OpenStream(tat, "r", MkAtomTerm(Yap_LookupAtom(fname)), LOCAL_encoding); __android_log_print( - ANDROID_LOG_INFO, "YAPDroid", "OpenStream got %ld ",sno); + ANDROID_LOG_INFO, "YAPDroid", "OpenStream got %d ",sno); if (sno < 0 || !Yap_ChDir(dirname((char *)d))) { *full = NULL; pop_text_stack(lvl); @@ -2197,7 +2188,7 @@ X_API void YAP_EndConsult(int sno, int *osnop, const char *full) { if (osnop >= 0) Yap_AddAlias(AtomLoopStream, *osnop); Yap_end_consult(); - __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s:%s(%ld), %ld", + __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s:%s(%d), %d", CurrentModule == 0 ? "prolog" : RepAtom(AtomOfTerm(CurrentModule))->StrOfAE, @@ -2226,8 +2217,8 @@ X_API Term YAP_ReadFromStream(int sno) { sigjmp_buf signew; if (sigsetjmp(signew, 0)) { Yap_syntax_error(LOCAL_toktide, sno, "ReadFromStream"); - RECOVER_MACHINE_REGS(); - return 0; + RECOVER_MACHINE_REGS(); + return 0; } else { o = Yap_read_term(sno, TermNil, false); } @@ -2291,6 +2282,7 @@ X_API char *YAP_WriteBuffer(Term t, char *buf, size_t sze, int flags) { } else { RECOVER_MACHINE_REGS(); if (buf == out.val.c) { + pop_text_stack(l); return buf; } else { if ( strlen(out.val.c ) < sze) { diff --git a/C/cdmgr.c b/C/cdmgr.c index 7feda492c..024d4e617 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -202,210 +202,6 @@ restart: return NULL; } -/****************************************************************** - - Mega Clauses - -******************************************************************/ - -#define OrArgAdjust(P) -#define TabEntryAdjust(P) -#define DoubleInCodeAdjust(D) -#define IntegerInCodeAdjust(D) -#define IntegerAdjust(D) (D) -#define PtoPredAdjust(X) (X) -#define PtoOpAdjust(X) (X) -#define PtoLUClauseAdjust(P) (P) -#define PtoLUIndexAdjust(P) (P) -#define XAdjust(X) (X) -#define YAdjust(X) (X) -#define AtomTermAdjust(X) (X) -#define CellPtoHeapAdjust(X) (X) -#define FuncAdjust(X) (X) -#define CodeAddrAdjust(X) (X) -#define CodeComposedTermAdjust(X) (X) -#define ConstantAdjust(X) (X) -#define ArityAdjust(X) (X) -#define OpcodeAdjust(X) (X) -#define ModuleAdjust(X) (X) -#define ExternalFunctionAdjust(X) (X) -#define AdjustSwitchTable(X, Y, Z) -#define DBGroundTermAdjust(X) (X) -#define rehash(A, B, C) - -static Term BlobTermInCodeAdjust(Term t) { - CACHE_REGS -#if TAGS_FAST_OPS - return t - LOCAL_ClDiff; -#else - return t + LOCAL_ClDiff; -#endif -} - -static Term ConstantTermAdjust(Term t) { - if (IsAtomTerm(t)) - return AtomTermAdjust(t); - return t; -} - -#include "rclause.h" - -#ifdef DEBUG -static UInt total_megaclause, total_released, nof_megaclauses; -#endif - -void Yap_BuildMegaClause(PredEntry *ap) { - CACHE_REGS - StaticClause *cl; - UInt sz; - MegaClause *mcl; - yamop *ptr; - size_t required; - UInt has_blobs = 0; - - if (ap->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MegaClausePredFlag -#ifdef TABLING - | TabledPredFlag -#endif /* TABLING */ - | UDIPredFlag) || - ap->cs.p_code.FirstClause == NULL || ap->cs.p_code.NOfClauses < 16) { - return; - } - cl = ClauseCodeToStaticClause(ap->cs.p_code.FirstClause); - sz = cl->ClSize; - while (TRUE) { - if (!(cl->ClFlags & FactMask)) - return; /* no mega clause, sorry */ - if (cl->ClSize != sz) - return; /* no mega clause, sorry */ - if (cl->ClCode == ap->cs.p_code.LastClause) - break; - has_blobs |= (cl->ClFlags & HasBlobsMask); - cl = cl->ClNext; - } - /* ok, we got the chance for a mega clause */ - if (has_blobs) { - sz -= sizeof(StaticClause); - } else { - sz -= (UInt)NEXTOP((yamop *)NULL, p) + sizeof(StaticClause); - } - required = sz * ap->cs.p_code.NOfClauses + sizeof(MegaClause) + - (UInt)NEXTOP((yamop *)NULL, l); - while (!(mcl = (MegaClause *)Yap_AllocCodeSpace(required))) { - if (!Yap_growheap(FALSE, required, NULL)) { - /* just fail, the system will keep on going */ - return; - } - } -#ifdef DEBUG - total_megaclause += required; - cl = ClauseCodeToStaticClause(ap->cs.p_code.FirstClause); - total_released += ap->cs.p_code.NOfClauses * cl->ClSize; - nof_megaclauses++; -#endif - Yap_ClauseSpace += required; - /* cool, it's our turn to do the conversion */ - mcl->ClFlags = MegaMask | has_blobs; - mcl->ClSize = required; - mcl->ClPred = ap; - mcl->ClItemSize = sz; - mcl->ClNext = NULL; - cl = ClauseCodeToStaticClause(ap->cs.p_code.FirstClause); - mcl->ClLine = cl->usc.ClLine; - ptr = mcl->ClCode; - while (TRUE) { - memmove((void *)ptr, (void *)cl->ClCode, sz); - if (has_blobs) { - LOCAL_ClDiff = (char *)(ptr) - (char *)cl->ClCode; - restore_opcodes(ptr, NULL PASS_REGS); - } - ptr = (yamop *)((char *)ptr + sz); - if (cl->ClCode == ap->cs.p_code.LastClause) - break; - cl = cl->ClNext; - } - ptr->opc = Yap_opcode(_Ystop); - cl = ClauseCodeToStaticClause(ap->cs.p_code.FirstClause); - /* recover the space spent on the original clauses */ - while (TRUE) { - StaticClause *ncl, *curcl = cl; - - ncl = cl->ClNext; - Yap_InformOfRemoval(cl); - Yap_ClauseSpace -= cl->ClSize; - Yap_FreeCodeSpace((ADDR)cl); - if (curcl->ClCode == ap->cs.p_code.LastClause) - break; - cl = ncl; - } - ap->cs.p_code.FirstClause = ap->cs.p_code.LastClause = mcl->ClCode; - ap->PredFlags |= MegaClausePredFlag; - Yap_inform_profiler_of_clause(mcl, (char *)mcl + required, ap, GPROF_MEGA); -} - -static void split_megaclause(PredEntry *ap) { - StaticClause *start = NULL, *prev = NULL; - MegaClause *mcl; - yamop *ptr; - UInt ncls = ap->cs.p_code.NOfClauses, i; - - mcl = ClauseCodeToMegaClause(ap->cs.p_code.FirstClause); - if (mcl->ClFlags & ExoMask) { - Yap_Error(PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE, Yap_PredicateToIndicator(ap), - "while deleting clause from exo predicate %s/%d\n", - RepAtom(NameOfFunctor(ap->FunctorOfPred))->StrOfAE, - ap->ArityOfPE); - return; - } - RemoveIndexation(ap); - for (i = 0, ptr = mcl->ClCode; i < ncls; i++) { - StaticClause *new = (StaticClause *)Yap_AllocCodeSpace( - sizeof(StaticClause) + mcl->ClItemSize + - (UInt)NEXTOP((yamop *)NULL, p)); - if (new == NULL) { - if (!Yap_growheap(FALSE, - (sizeof(StaticClause) + mcl->ClItemSize) * (ncls - i), - NULL)) { - while (start) { - StaticClause *cl = start; - start = cl->ClNext; - Yap_InformOfRemoval(cl); - Yap_ClauseSpace -= cl->ClSize; - Yap_FreeCodeSpace((char *)cl); - } - if (ap->ArityOfPE) { - Yap_Error(RESOURCE_ERROR_HEAP, TermNil, - "while breaking up mega clause for %s/%d\n", - RepAtom(NameOfFunctor(ap->FunctorOfPred))->StrOfAE, - ap->ArityOfPE); - } else { - Yap_Error(RESOURCE_ERROR_HEAP, TermNil, - "while breaking up mega clause for %s\n", - RepAtom((Atom)ap->FunctorOfPred)->StrOfAE); - } - return; - } - break; - } - Yap_ClauseSpace += - sizeof(StaticClause) + mcl->ClItemSize + (UInt)NEXTOP((yamop *)NULL, p); - new->ClFlags = StaticMask | FactMask; - new->ClSize = mcl->ClItemSize; - new->usc.ClLine = Yap_source_line_no(); - new->ClNext = NULL; - memmove((void *)new->ClCode, (void *)ptr, mcl->ClItemSize); - if (prev) { - prev->ClNext = new; - } else { - start = new; - } - ptr = (yamop *)((char *)ptr + mcl->ClItemSize); - prev = new; - } - ap->PredFlags &= ~MegaClausePredFlag; - ap->cs.p_code.FirstClause = start->ClCode; - ap->cs.p_code.LastClause = prev->ClCode; -} /****************************************************************** @@ -1763,7 +1559,7 @@ bool Yap_addclause(Term t, yamop *cp, Term tmode, Term mod, Term *t4ref) pflags = p->PredFlags; /* we are redefining a prolog module predicate */ if (pflags & MegaClausePredFlag) { - split_megaclause(p); + Yap_split_megaclause(p); } /* The only problem we have now is when we need to throw away Indexing blocks @@ -1929,11 +1725,11 @@ void Yap_EraseMegaClause(yamop *cl, PredEntry *ap) { void Yap_EraseStaticClause(StaticClause *cl, PredEntry *ap, Term mod) { /* ok, first I need to find out the parent predicate */ - if (ap->PredFlags & MegaClausePredFlag) { - split_megaclause(ap); - } if (ap->PredFlags & IndexedPredFlag) RemoveIndexation(ap); + if (ap->PredFlags & MegaClausePredFlag) { + Yap_split_megaclause(ap); + } ap->cs.p_code.NOfClauses--; if (ap->cs.p_code.FirstClause == cl->ClCode) { /* got rid of first clause */ @@ -2240,7 +2036,7 @@ static Int p_sys_export(USES_REGS1) { /* '$set_spy'(+Fun,+M) */ ******************************************************************/ -static Int p_is_no_trace(USES_REGS1) { /* '$undefined'(P,Mod) */ +static Int p_is_private(USES_REGS1) { /* '$undefined'(P,Mod) */ PredEntry *pe; pe = Yap_get_pred(Deref(ARG1), Deref(ARG2), "undefined/1"); @@ -2255,7 +2051,7 @@ static Int p_is_no_trace(USES_REGS1) { /* '$undefined'(P,Mod) */ return false; } -static Int p_set_no_trace(USES_REGS1) { /* '$set_no_trace'(+Fun,+M) */ +static Int p_set_private(USES_REGS1) { /* '$set_private'(+Fun,+M) */ PredEntry *pe; pe = Yap_get_pred(Deref(ARG1), Deref(ARG2), "undefined/1"); @@ -2271,7 +2067,7 @@ int Yap_SetNoTrace(char *name, arity_t arity, Term tmod) { PredEntry *pe; if (arity == 0) { - pe = Yap_get_pred(MkAtomTerm(Yap_LookupAtom(name)), tmod, "no_trace"); + pe = Yap_get_pred(MkAtomTerm(Yap_LookupAtom(name)), tmod, "private"); } else { pe = RepPredProp( PredPropByFunc(Yap_MkFunctor(Yap_LookupAtom(name), arity), tmod)); @@ -3937,224 +3733,6 @@ p_continue_static_clause(USES_REGS1) { return fetch_next_static_clause(pe, ipc, Deref(ARG3), ARG4, ARG5, B->cp_ap, false); } - -static UInt compute_dbcl_size(arity_t arity) { - UInt sz; - switch (arity) { - case 2: - sz = (UInt)NEXTOP((yamop *)NULL, cc); - break; - case 3: - sz = (UInt)NEXTOP((yamop *)NULL, ccc); - break; - case 4: - sz = (UInt)NEXTOP((yamop *)NULL, cccc); - break; - case 5: - sz = (UInt)NEXTOP((yamop *)NULL, ccccc); - break; - case 6: - sz = (UInt)NEXTOP((yamop *)NULL, cccccc); - break; - default: - sz = arity * (UInt)NEXTOP((yamop *)NULL, xc); - break; - } - return (UInt)NEXTOP((yamop *)sz, p); -} - -#define DerefAndCheck(t, V) \ - t = Deref(V); \ - if (IsVarTerm(t) || !(IsAtomOrIntTerm(t))) \ - Yap_Error(TYPE_ERROR_ATOM, t0, "load_db"); - -static int store_dbcl_size(yamop *pc, arity_t arity, Term t0, PredEntry *pe) { - Term t; - CELL *tp = RepAppl(t0) + 1; - switch (arity) { - case 2: - pc->opc = Yap_opcode(_get_2atoms); - DerefAndCheck(t, tp[0]); - pc->y_u.cc.c1 = t; - DerefAndCheck(t, tp[1]); - pc->y_u.cc.c2 = t; - pc = NEXTOP(pc, cc); - break; - case 3: - pc->opc = Yap_opcode(_get_3atoms); - DerefAndCheck(t, tp[0]); - pc->y_u.ccc.c1 = t; - DerefAndCheck(t, tp[1]); - pc->y_u.ccc.c2 = t; - DerefAndCheck(t, tp[2]); - pc->y_u.ccc.c3 = t; - pc = NEXTOP(pc, ccc); - break; - case 4: - pc->opc = Yap_opcode(_get_4atoms); - DerefAndCheck(t, tp[0]); - pc->y_u.cccc.c1 = t; - DerefAndCheck(t, tp[1]); - pc->y_u.cccc.c2 = t; - DerefAndCheck(t, tp[2]); - pc->y_u.cccc.c3 = t; - DerefAndCheck(t, tp[3]); - pc->y_u.cccc.c4 = t; - pc = NEXTOP(pc, cccc); - break; - case 5: - pc->opc = Yap_opcode(_get_5atoms); - DerefAndCheck(t, tp[0]); - pc->y_u.ccccc.c1 = t; - DerefAndCheck(t, tp[1]); - pc->y_u.ccccc.c2 = t; - DerefAndCheck(t, tp[2]); - pc->y_u.ccccc.c3 = t; - DerefAndCheck(t, tp[3]); - pc->y_u.ccccc.c4 = t; - DerefAndCheck(t, tp[4]); - pc->y_u.ccccc.c5 = t; - pc = NEXTOP(pc, ccccc); - break; - case 6: - pc->opc = Yap_opcode(_get_6atoms); - DerefAndCheck(t, tp[0]); - pc->y_u.cccccc.c1 = t; - DerefAndCheck(t, tp[1]); - pc->y_u.cccccc.c2 = t; - DerefAndCheck(t, tp[2]); - pc->y_u.cccccc.c3 = t; - DerefAndCheck(t, tp[3]); - pc->y_u.cccccc.c4 = t; - DerefAndCheck(t, tp[4]); - pc->y_u.cccccc.c5 = t; - DerefAndCheck(t, tp[5]); - pc->y_u.cccccc.c6 = t; - pc = NEXTOP(pc, cccccc); - break; - default: { - arity_t i; - for (i = 0; i < arity; i++) { - pc->opc = Yap_opcode(_get_atom); -#if PRECOMPUTE_REGADDRESS - pc->y_u.xc.x = (CELL)(XREGS + (i + 1)); -#else - pc->y_u.xc.x = i + 1; -#endif - DerefAndCheck(t, tp[0]); - pc->y_u.xc.c = t; - tp++; - pc = NEXTOP(pc, xc); - } - } break; - } - pc->opc = Yap_opcode(_procceed); - pc->y_u.p.p = pe; - return TRUE; -} - -static Int - p_dbload_get_space(USES_REGS1) { /* '$number_of_clauses'(Predicate,M,N) */ - Term t = Deref(ARG1); - Term mod = Deref(ARG2); - Term tn = Deref(ARG3); - arity_t arity; - Prop pe; - PredEntry *ap; - UInt sz; - MegaClause *mcl; - yamop *ptr; - UInt ncls; - UInt required; - - if (IsVarTerm(mod) || !IsAtomTerm(mod)) { - return (FALSE); - } - if (IsAtomTerm(t)) { - Atom a = AtomOfTerm(t); - arity = 0; - pe = PredPropByAtom(a, mod); - } else if (IsApplTerm(t)) { - register Functor f = FunctorOfTerm(t); - arity = ArityOfFunctor(f); - pe = PredPropByFunc(f, mod); - } else { - return FALSE; - } - if (EndOfPAEntr(pe)) - return FALSE; - ap = RepPredProp(pe); - if (ap->PredFlags & (DynamicPredFlag | LogUpdatePredFlag -#ifdef TABLING - | TabledPredFlag -#endif /* TABLING */ - )) { - Yap_Error(PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE, Yap_PredicateToIndicator(ap), - "dbload_get_space/4"); - return FALSE; - } - if (IsVarTerm(tn) || !IsIntegerTerm(tn)) { - return FALSE; - } - ncls = IntegerOfTerm(tn); - if (ncls <= 1) { - return FALSE; - } - - sz = compute_dbcl_size(arity); - required = sz * ncls + sizeof(MegaClause) + (UInt)NEXTOP((yamop *)NULL, l); -#ifdef DEBUG - total_megaclause += required; - nof_megaclauses++; -#endif - while (!(mcl = (MegaClause *)Yap_AllocCodeSpace(required))) { - if (!Yap_growheap(FALSE, required, NULL)) { - /* just fail, the system will keep on going */ - return FALSE; - } - } - Yap_ClauseSpace += required; - /* cool, it's our turn to do the conversion */ - mcl->ClFlags = MegaMask; - mcl->ClSize = sz * ncls; - mcl->ClPred = ap; - mcl->ClItemSize = sz; - mcl->ClNext = NULL; - ap->cs.p_code.FirstClause = ap->cs.p_code.LastClause = mcl->ClCode; - ap->PredFlags |= (MegaClausePredFlag); - ap->cs.p_code.NOfClauses = ncls; - if (ap->PredFlags & (SpiedPredFlag | CountPredFlag | ProfiledPredFlag)) { - ap->OpcodeOfPred = Yap_opcode(_spy_pred); - } else { - ap->OpcodeOfPred = INDEX_OPCODE; - } - ap->CodeOfPred = ap->cs.p_code.TrueCodeOfPred = - (yamop *)(&(ap->OpcodeOfPred)); - ptr = (yamop *)((ADDR)mcl->ClCode + ncls * sz); - ptr->opc = Yap_opcode(_Ystop); - return Yap_unify(ARG4, MkIntegerTerm((Int)mcl)); -} - -static Int p_dbassert(USES_REGS1) { /* '$number_of_clauses'(Predicate,M,N) */ - Term thandle = Deref(ARG2); - Term tn = Deref(ARG3); - PredEntry *pe; - MegaClause *mcl; - Int n; - - if (IsVarTerm(thandle) || !IsIntegerTerm(thandle)) { - return FALSE; - } - mcl = (MegaClause *)IntegerOfTerm(thandle); - if (IsVarTerm(tn) || !IsIntegerTerm(tn)) { - return FALSE; - } - n = IntegerOfTerm(tn); - pe = mcl->ClPred; - return store_dbcl_size((yamop *)((ADDR)mcl->ClCode + n * (mcl->ClItemSize)), - pe->ArityOfPE, Deref(ARG1), pe); -} - #define CL_PROP_ERASED 0 #define CL_PROP_PRED 1 #define CL_PROP_FILE 2 @@ -4674,7 +4252,7 @@ static Int init_pred_flag_vals(USES_REGS1) { ModuleTransparentPredFlag PASS_REGS); pred_flag_clause(f, mod, "multi", MultiFileFlag PASS_REGS); pred_flag_clause(f, mod, "no_spy", NoSpyPredFlag PASS_REGS); - pred_flag_clause(f, mod, "no_trace", NoTracePredFlag PASS_REGS); + pred_flag_clause(f, mod, "private", NoTracePredFlag PASS_REGS); pred_flag_clause(f, mod, "number_db", NumberDBPredFlag PASS_REGS); pred_flag_clause(f, mod, "profiled", ProfiledPredFlag PASS_REGS); pred_flag_clause(f, mod, "quasi_quotation", QuasiQuotationPredFlag PASS_REGS); @@ -4698,8 +4276,6 @@ static Int init_pred_flag_vals(USES_REGS1) { void Yap_InitCdMgr(void) { CACHE_REGS - Term cm = CurrentModule; - Yap_InitCPred("$init_pred_flag_vals", 2, init_pred_flag_vals, SyncPredFlag); Yap_InitCPred("$start_consult", 3, p_startconsult, SafePredFlag | SyncPredFlag); @@ -4755,9 +4331,9 @@ void Yap_InitCdMgr(void) { SafePredFlag | SyncPredFlag); Yap_InitCPred("$is_discontiguous", 2, p_is_discontiguous, TestPredFlag | SafePredFlag); - Yap_InitCPred("$is_no_trace", 2, p_is_no_trace, TestPredFlag | SafePredFlag); - Yap_InitCPred("$set_no_trace", 2, p_set_no_trace, - TestPredFlag | SafePredFlag); + Yap_InitCPred("$is_private", 2, p_is_private, TestPredFlag | SafePredFlag); + Yap_InitCPred("$set_private", 2, p_set_private, + SyncPredFlag | SafePredFlag); Yap_InitCPred("$is_profiled", 1, p_is_profiled, SafePredFlag | SyncPredFlag); Yap_InitCPred("$profile_info", 3, p_profile_info, SafePredFlag | SyncPredFlag); @@ -4792,10 +4368,6 @@ void Yap_InitCdMgr(void) { Yap_InitCPred("instance_property", 3, instance_property, SafePredFlag | SyncPredFlag); Yap_InitCPred("$fetch_nth_clause", 4, p_nth_instance, SyncPredFlag); - CurrentModule = DBLOAD_MODULE; - Yap_InitCPred("dbload_get_space", 4, p_dbload_get_space, 0L); - Yap_InitCPred("dbassert", 3, p_dbassert, 0L); - CurrentModule = cm; Yap_InitCPred("$predicate_erased_statistics", 5, p_predicate_erased_statistics, SyncPredFlag); Yap_InitCPred("$including", 2, including, SyncPredFlag | HiddenPredFlag); @@ -4804,3 +4376,7 @@ void Yap_InitCdMgr(void) { Yap_InitCPred("$predicate_lu_cps", 4, p_predicate_lu_cps, 0L); #endif } + +void Yap_InitCLoadDB(void) { + +} diff --git a/C/dbload.c b/C/dbload.c new file mode 100644 index 000000000..c4a9273b2 --- /dev/null +++ b/C/dbload.c @@ -0,0 +1,459 @@ +/************************************************************************* + * * + * YAP Prolog * + * * + * Yap Prolog was developed at NCCUP - Universidade do Porto * + * * + * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * + * * + ************************************************************************** + * * + * File: cdmgr.c * + * comments: Code manager * + * * + * Last rev: $Date: 2008-07-22 23:34:44 $,$Author: vsc $ 8 + *************************************************************************/ + +#include "Yap.h" +#include "YapEval.h" +#include "clause.h" +#include "tracer.h" +#include "yapio.h" + +#include +#include +#include +#include + + + +#ifdef DEBUG +static UInt total_megaclause, total_released, nof_megaclauses; +#endif + +/****************************************************************** + + Mega Clauses + +******************************************************************/ + +#define OrArgAdjust(P) +#define TabEntryAdjust(P) +#define DoubleInCodeAdjust(D) +#define IntegerInCodeAdjust(D) +#define IntegerAdjust(D) (D) +#define PtoPredAdjust(X) (X) +#define PtoOpAdjust(X) (X) +#define PtoLUClauseAdjust(P) (P) +#define PtoLUIndexAdjust(P) (P) +#define XAdjust(X) (X) +#define YAdjust(X) (X) +#define AtomTermAdjust(X) (X) +#define CellPtoHeapAdjust(X) (X) +#define FuncAdjust(X) (X) +#define CodeAddrAdjust(X) (X) +#define CodeComposedTermAdjust(X) (X) +#define ConstantAdjust(X) (X) +#define ArityAdjust(X) (X) +#define OpcodeAdjust(X) (X) +#define ModuleAdjust(X) (X) +#define ExternalFunctionAdjust(X) (X) +#define AdjustSwitchTable(X, Y, Z) +#define DBGroundTermAdjust(X) (X) +#define rehash(A, B, C) + +static Term BlobTermInCodeAdjust(Term t) { + CACHE_REGS +#if TAGS_FAST_OPS + return t - LOCAL_ClDiff; +#else + return t + LOCAL_ClDiff; +#endif +} + +static Term ConstantTermAdjust(Term t) { + if (IsAtomTerm(t)) + return AtomTermAdjust(t); + return t; +} + +#include "rclause.h" + + +void Yap_BuildMegaClause(PredEntry *ap) { + CACHE_REGS + StaticClause *cl; + UInt sz; + MegaClause *mcl; + yamop *ptr; + size_t required; + UInt has_blobs = 0; + + if (ap->PredFlags & (DynamicPredFlag | LogUpdatePredFlag | MegaClausePredFlag +#ifdef TABLING + | TabledPredFlag +#endif /* TABLING */ + | UDIPredFlag) || + ap->cs.p_code.FirstClause == NULL || ap->cs.p_code.NOfClauses < 16) { + return; + } + cl = ClauseCodeToStaticClause(ap->cs.p_code.FirstClause); + sz = cl->ClSize; + while (TRUE) { + if (!(cl->ClFlags & FactMask)) + return; /* no mega clause, sorry */ + if (cl->ClSize != sz) + return; /* no mega clause, sorry */ + if (cl->ClCode == ap->cs.p_code.LastClause) + break; + has_blobs |= (cl->ClFlags & HasBlobsMask); + cl = cl->ClNext; + } + /* ok, we got the chance for a mega clause */ + if (has_blobs) { + sz -= sizeof(StaticClause); + } else { + sz -= (UInt)NEXTOP((yamop *)NULL, p) + sizeof(StaticClause); + } + required = sz * ap->cs.p_code.NOfClauses + sizeof(MegaClause) + + (UInt)NEXTOP((yamop *)NULL, l); + while (!(mcl = (MegaClause *)Yap_AllocCodeSpace(required))) { + if (!Yap_growheap(FALSE, required, NULL)) { + /* just fail, the system will keep on going */ + return; + } + } +#ifdef DEBUG + total_megaclause += required; + cl = ClauseCodeToStaticClause(ap->cs.p_code.FirstClause); + total_released += ap->cs.p_code.NOfClauses * cl->ClSize; + nof_megaclauses++; +#endif + Yap_ClauseSpace += required; + /* cool, it's our turn to do the conversion */ + mcl->ClFlags = MegaMask | has_blobs; + mcl->ClSize = required; + mcl->ClPred = ap; + mcl->ClItemSize = sz; + mcl->ClNext = NULL; + cl = ClauseCodeToStaticClause(ap->cs.p_code.FirstClause); + mcl->ClLine = cl->usc.ClLine; + ptr = mcl->ClCode; + while (TRUE) { + memmove((void *)ptr, (void *)cl->ClCode, sz); + if (has_blobs) { + LOCAL_ClDiff = (char *)(ptr) - (char *)cl->ClCode; + restore_opcodes(ptr, NULL PASS_REGS); + } + ptr = (yamop *)((char *)ptr + sz); + if (cl->ClCode == ap->cs.p_code.LastClause) + break; + cl = cl->ClNext; + } + ptr->opc = Yap_opcode(_Ystop); + cl = ClauseCodeToStaticClause(ap->cs.p_code.FirstClause); + /* recover the space spent on the original clauses */ + while (TRUE) { + StaticClause *ncl, *curcl = cl; + + ncl = cl->ClNext; + Yap_InformOfRemoval(cl); + Yap_ClauseSpace -= cl->ClSize; + Yap_FreeCodeSpace((ADDR)cl); + if (curcl->ClCode == ap->cs.p_code.LastClause) + break; + cl = ncl; + } + ap->cs.p_code.FirstClause = ap->cs.p_code.LastClause = mcl->ClCode; + ap->PredFlags |= MegaClausePredFlag; + Yap_inform_profiler_of_clause(mcl, (char *)mcl + required, ap, GPROF_MEGA); +} + +void Yap_split_megaclause(PredEntry *ap) { + StaticClause *start = NULL, *prev = NULL; + MegaClause *mcl; + yamop *ptr; + UInt ncls = ap->cs.p_code.NOfClauses, i; + + mcl = ClauseCodeToMegaClause(ap->cs.p_code.FirstClause); + if (mcl->ClFlags & ExoMask) { + Yap_Error(PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE, Yap_PredicateToIndicator(ap), + "while deleting clause from exo predicate %s/%d\n", + RepAtom(NameOfFunctor(ap->FunctorOfPred))->StrOfAE, + ap->ArityOfPE); + return; + } + for (i = 0, ptr = mcl->ClCode; i < ncls; i++) { + StaticClause *new = (StaticClause *)Yap_AllocCodeSpace( + sizeof(StaticClause) + mcl->ClItemSize + + (UInt)NEXTOP((yamop *)NULL, p)); + if (new == NULL) { + if (!Yap_growheap(FALSE, + (sizeof(StaticClause) + mcl->ClItemSize) * (ncls - i), + NULL)) { + while (start) { + StaticClause *cl = start; + start = cl->ClNext; + Yap_InformOfRemoval(cl); + Yap_ClauseSpace -= cl->ClSize; + Yap_FreeCodeSpace((char *)cl); + } + if (ap->ArityOfPE) { + Yap_Error(RESOURCE_ERROR_HEAP, TermNil, + "while breaking up mega clause for %s/%d\n", + RepAtom(NameOfFunctor(ap->FunctorOfPred))->StrOfAE, + ap->ArityOfPE); + } else { + Yap_Error(RESOURCE_ERROR_HEAP, TermNil, + "while breaking up mega clause for %s\n", + RepAtom((Atom)ap->FunctorOfPred)->StrOfAE); + } + return; + } + break; + } + Yap_ClauseSpace += + sizeof(StaticClause) + mcl->ClItemSize + (UInt)NEXTOP((yamop *)NULL, p); + new->ClFlags = StaticMask | FactMask; + new->ClSize = mcl->ClItemSize; + new->usc.ClLine = Yap_source_line_no(); + new->ClNext = NULL; + memmove((void *)new->ClCode, (void *)ptr, mcl->ClItemSize); + if (prev) { + prev->ClNext = new; + } else { + start = new; + } + ptr = (yamop *)((char *)ptr + mcl->ClItemSize); + prev = new; + } + ap->PredFlags &= ~MegaClausePredFlag; + ap->cs.p_code.FirstClause = start->ClCode; + ap->cs.p_code.LastClause = prev->ClCode; +} + + +static UInt compute_dbcl_size(arity_t arity) { + UInt sz; + switch (arity) { + case 2: + sz = (UInt)NEXTOP((yamop *)NULL, cc); + break; + case 3: + sz = (UInt)NEXTOP((yamop *)NULL, ccc); + break; + case 4: + sz = (UInt)NEXTOP((yamop *)NULL, cccc); + break; + case 5: + sz = (UInt)NEXTOP((yamop *)NULL, ccccc); + break; + case 6: + sz = (UInt)NEXTOP((yamop *)NULL, cccccc); + break; + default: + sz = arity * (UInt)NEXTOP((yamop *)NULL, xc); + break; + } + return (UInt)NEXTOP((yamop *)sz, p); +} + +#define DerefAndCheck(t, V) \ + t = Deref(V); \ + if (IsVarTerm(t) || !(IsAtomOrIntTerm(t))) \ + Yap_Error(TYPE_ERROR_ATOM, t0, "load_db"); + +static int store_dbcl_size(yamop *pc, arity_t arity, Term t0, PredEntry *pe) { + Term t; + CELL *tp = RepAppl(t0) + 1; + switch (arity) { + case 2: + pc->opc = Yap_opcode(_get_2atoms); + DerefAndCheck(t, tp[0]); + pc->y_u.cc.c1 = t; + DerefAndCheck(t, tp[1]); + pc->y_u.cc.c2 = t; + pc = NEXTOP(pc, cc); + break; + case 3: + pc->opc = Yap_opcode(_get_3atoms); + DerefAndCheck(t, tp[0]); + pc->y_u.ccc.c1 = t; + DerefAndCheck(t, tp[1]); + pc->y_u.ccc.c2 = t; + DerefAndCheck(t, tp[2]); + pc->y_u.ccc.c3 = t; + pc = NEXTOP(pc, ccc); + break; + case 4: + pc->opc = Yap_opcode(_get_4atoms); + DerefAndCheck(t, tp[0]); + pc->y_u.cccc.c1 = t; + DerefAndCheck(t, tp[1]); + pc->y_u.cccc.c2 = t; + DerefAndCheck(t, tp[2]); + pc->y_u.cccc.c3 = t; + DerefAndCheck(t, tp[3]); + pc->y_u.cccc.c4 = t; + pc = NEXTOP(pc, cccc); + break; + case 5: + pc->opc = Yap_opcode(_get_5atoms); + DerefAndCheck(t, tp[0]); + pc->y_u.ccccc.c1 = t; + DerefAndCheck(t, tp[1]); + pc->y_u.ccccc.c2 = t; + DerefAndCheck(t, tp[2]); + pc->y_u.ccccc.c3 = t; + DerefAndCheck(t, tp[3]); + pc->y_u.ccccc.c4 = t; + DerefAndCheck(t, tp[4]); + pc->y_u.ccccc.c5 = t; + pc = NEXTOP(pc, ccccc); + break; + case 6: + pc->opc = Yap_opcode(_get_6atoms); + DerefAndCheck(t, tp[0]); + pc->y_u.cccccc.c1 = t; + DerefAndCheck(t, tp[1]); + pc->y_u.cccccc.c2 = t; + DerefAndCheck(t, tp[2]); + pc->y_u.cccccc.c3 = t; + DerefAndCheck(t, tp[3]); + pc->y_u.cccccc.c4 = t; + DerefAndCheck(t, tp[4]); + pc->y_u.cccccc.c5 = t; + DerefAndCheck(t, tp[5]); + pc->y_u.cccccc.c6 = t; + pc = NEXTOP(pc, cccccc); + break; + default: { + arity_t i; + for (i = 0; i < arity; i++) { + pc->opc = Yap_opcode(_get_atom); +#if PRECOMPUTE_REGADDRESS + pc->y_u.xc.x = (CELL)(XREGS + (i + 1)); +#else + pc->y_u.xc.x = i + 1; +#endif + DerefAndCheck(t, tp[0]); + pc->y_u.xc.c = t; + tp++; + pc = NEXTOP(pc, xc); + } + } break; + } + pc->opc = Yap_opcode(_procceed); + pc->y_u.p.p = pe; + return TRUE; +} + +static Int + p_dbload_get_space(USES_REGS1) { /* '$number_of_clauses'(Predicate,M,N) */ + Term t = Deref(ARG1); + Term mod = Deref(ARG2); + Term tn = Deref(ARG3); + arity_t arity; + Prop pe; + PredEntry *ap; + UInt sz; + MegaClause *mcl; + yamop *ptr; + UInt ncls; + UInt required; + + if (IsVarTerm(mod) || !IsAtomTerm(mod)) { + return (FALSE); + } + if (IsAtomTerm(t)) { + Atom a = AtomOfTerm(t); + arity = 0; + pe = PredPropByAtom(a, mod); + } else if (IsApplTerm(t)) { + register Functor f = FunctorOfTerm(t); + arity = ArityOfFunctor(f); + pe = PredPropByFunc(f, mod); + } else { + return FALSE; + } + if (EndOfPAEntr(pe)) + return FALSE; + ap = RepPredProp(pe); + if (ap->PredFlags & (DynamicPredFlag | LogUpdatePredFlag +#ifdef TABLING + | TabledPredFlag +#endif /* TABLING */ + )) { + Yap_Error(PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE, Yap_PredicateToIndicator(ap), + "dbload_get_space/4"); + return FALSE; + } + if (IsVarTerm(tn) || !IsIntegerTerm(tn)) { + return FALSE; + } + ncls = IntegerOfTerm(tn); + if (ncls <= 1) { + return FALSE; + } + + sz = compute_dbcl_size(arity); + required = sz * ncls + sizeof(MegaClause) + (UInt)NEXTOP((yamop *)NULL, l); +#ifdef DEBUG + total_megaclause += required; + nof_megaclauses++; +#endif + while (!(mcl = (MegaClause *)Yap_AllocCodeSpace(required))) { + if (!Yap_growheap(FALSE, required, NULL)) { + /* just fail, the system will keep on going */ + return FALSE; + } + } + Yap_ClauseSpace += required; + /* cool, it's our turn to do the conversion */ + mcl->ClFlags = MegaMask; + mcl->ClSize = sz * ncls; + mcl->ClPred = ap; + mcl->ClItemSize = sz; + mcl->ClNext = NULL; + ap->cs.p_code.FirstClause = ap->cs.p_code.LastClause = mcl->ClCode; + ap->PredFlags |= (MegaClausePredFlag); + ap->cs.p_code.NOfClauses = ncls; + if (ap->PredFlags & (SpiedPredFlag | CountPredFlag | ProfiledPredFlag)) { + ap->OpcodeOfPred = Yap_opcode(_spy_pred); + } else { + ap->OpcodeOfPred = INDEX_OPCODE; + } + ap->CodeOfPred = ap->cs.p_code.TrueCodeOfPred = + (yamop *)(&(ap->OpcodeOfPred)); + ptr = (yamop *)((ADDR)mcl->ClCode + ncls * sz); + ptr->opc = Yap_opcode(_Ystop); + return Yap_unify(ARG4, MkIntegerTerm((Int)mcl)); +} + +static Int p_dbassert(USES_REGS1) { /* '$number_of_clauses'(Predicate,M,N) */ + Term thandle = Deref(ARG2); + Term tn = Deref(ARG3); + PredEntry *pe; + MegaClause *mcl; + Int n; + + if (IsVarTerm(thandle) || !IsIntegerTerm(thandle)) { + return FALSE; + } + mcl = (MegaClause *)IntegerOfTerm(thandle); + if (IsVarTerm(tn) || !IsIntegerTerm(tn)) { + return FALSE; + } + n = IntegerOfTerm(tn); + pe = mcl->ClPred; + return store_dbcl_size((yamop *)((ADDR)mcl->ClCode + n * (mcl->ClItemSize)), + pe->ArityOfPE, Deref(ARG1), pe); +} + +void Yap_InitDBLoadPreds(void) { + CACHE_REGS + //CurrentModule = DBLOAD_MODULE; + Yap_InitCPred("$dbload_get_space", 4, p_dbload_get_space, 0L); + Yap_InitCPred("$dbassert", 3, p_dbassert, 0L); + //CurrentModule = cm; +} diff --git a/C/errors.c b/C/errors.c index 791113072..dae0a41bb 100755 --- a/C/errors.c +++ b/C/errors.c @@ -1254,7 +1254,7 @@ static Int is_callable(USES_REGS1) { // Term Context = Deref(ARG2); while (true) { if (IsVarTerm(G)) { - Yap_ThrowError(INSTANTIATION_ERROR, G, NULL); + //Yap_ThrowError(INSTANTIATION_ERROR, G, NULL); return false; } if (IsApplTerm(G)) { diff --git a/C/exec.c b/C/exec.c index c0c51f72c..4db48eb05 100755 --- a/C/exec.c +++ b/C/exec.c @@ -792,6 +792,14 @@ restart_exec: return CallPredicate(RepPredProp(pe), cut_cp, code PASS_REGS); } +static Int creep_clause(USES_REGS1) { /* '$execute_clause'(Goal) */ + Int rc = execute_clause( PASS_REGS1 ); + if (!LOCAL_InterruptsDisabled) { + Yap_signal(YAP_CREEP_SIGNAL); + } + return rc; +} + static Int execute_in_mod(USES_REGS1) { /* '$execute'(Goal) */ return do_execute(Deref(ARG1), Deref(ARG2) PASS_REGS); } @@ -804,11 +812,11 @@ static Int execute_in_mod(USES_REGS1) { /* '$execute'(Goal) */ static void prune_inner_computation(choiceptr parent) { /* code */ choiceptr cut_pt; - yamop *oP = P, *oCP = CP; - Int oENV = LCL0 - ENV; cut_pt = B; while (cut_pt && cut_pt->cp_b < parent) { + if (cut_pt->cp_ap == NOCODE) + break; cut_pt = cut_pt->cp_b; } if (!cut_pt) @@ -819,9 +827,6 @@ static void prune_inner_computation(choiceptr parent) { B = cut_pt; Yap_TrimTrail(); LOCAL_AllowRestart = FALSE; - P = oP; - CP = oCP; - ENV = LCL0 - oENV; B = parent; } @@ -901,6 +906,10 @@ static bool watch_cut(Term ext USES_REGS) { bool active = ArgOfTerm(5, task) == TermTrue; bool ex_mode = false; + LOCAL_Signals = 0; + CalculateStackGap(PASS_REGS1); + LOCAL_PrologMode = UserMode; + if (complete) { return true; } @@ -948,6 +957,9 @@ static bool watch_retry(Term d0 USES_REGS) { bool complete = !IsVarTerm(ArgOfTerm(4, task)); bool active = ArgOfTerm(5, task) == TermTrue; choiceptr B0 = (choiceptr)(LCL0 - IntegerOfTerm(ArgOfTerm(6, task))); + LOCAL_Signals = 0; + CalculateStackGap(PASS_REGS1); + LOCAL_PrologMode = UserMode; if (complete) return true; @@ -1006,6 +1018,9 @@ static Int setup_call_catcher_cleanup(USES_REGS1) { Int oENV = LCL0 - ENV; Int oYENV = LCL0 - YENV; bool rc; + LOCAL_Signals = 0; + CalculateStackGap(PASS_REGS1); + LOCAL_PrologMode = UserMode; Yap_DisableInterrupts(worker_id); rc = Yap_RunTopGoal(Setup, false); Yap_EnableInterrupts(worker_id); @@ -1041,6 +1056,9 @@ static Int cleanup_on_exit(USES_REGS1) { bool box = ArgOfTerm(1, task) == TermTrue; Term cleanup = ArgOfTerm(3, task); Term complete = IsNonVarTerm(ArgOfTerm(4, task)); + LOCAL_Signals = 0; + CalculateStackGap(PASS_REGS1); + LOCAL_PrologMode = UserMode; while (B->cp_ap->opc == FAIL_OPCODE) B = B->cp_b; @@ -1062,8 +1080,6 @@ static Int cleanup_on_exit(USES_REGS1) { complete_pt[0] = TermExit; } Yap_ignore(cleanup, false); - if (B0->cp_ap == NOCODE) - B0->cp_ap = TRUSTFAILCODE; if (Yap_RaiseException()) { return false; } @@ -1598,7 +1614,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) { ASP = (CELL *)PROTECT_FROZEN_B(B); if (B == NULL || B->cp_b == NULL || - (CELL *)(B->cp_b) >= LCL0 - LOCAL_CBorder) { + (CELL *)(B->cp_b) > LCL0 - LOCAL_CBorder) { LOCAL_RestartEnv = sighold; LOCAL_CBorder = OldBorder; pop_text_stack(i + 1); @@ -1609,19 +1625,18 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) { } YENV = ASP; YENV[E_CB] = Unsigned(B); + pop_text_stack(i + 1); out = Yap_absmi(0); - /* make sure we don't leave a FAIL signal hanging around */ Yap_get_signal(YAP_FAIL_SIGNAL); if (!Yap_has_a_signal()) CalculateStackGap(PASS_REGS1); LOCAL_CBorder = OldBorder; LOCAL_RestartEnv = sighold; - pop_text_stack(i + 1); return out; } -void Yap_PrepGoal(arity_t arity, CELL *pt, YAP_dogoalinfo *gip USES_REGS) { +void Yap_PrepGoal(arity_t arity, CELL *pt, choiceptr saved_b USES_REGS) { /* create an initial pseudo environment so that when garbage collection is going up in the environment chain it doesn't get confused */ @@ -1655,18 +1670,20 @@ void Yap_PrepGoal(arity_t arity, CELL *pt, YAP_dogoalinfo *gip USES_REGS) { B->cp_cp = CP; B->cp_ap = NOCODE; B->cp_env = ENV; + B->cp_b = saved_b; #ifdef DEPTH_LIMIT B->cp_depth = DEPTH; #endif /* DEPTH_LIMIT */ YENV = ASP = (CELL *)B; YENV[E_CB] = (CELL)B; HB = HR; - gip->b = LCL0-CellPtr(B); + CP = YESCODE; } -static bool do_goal(yamop *CodeAdr, int arity, CELL *pt, YAP_dogoalinfo *gi, bool top USES_REGS) { +static bool do_goal(yamop *CodeAdr, int arity, CELL *pt, bool top USES_REGS) { + choiceptr saved_b = B; bool out; - Yap_PrepGoal(arity, pt, gi PASS_REGS); + Yap_PrepGoal(arity, pt, saved_b PASS_REGS); // CACHE_A1(); P = (yamop *)CodeAdr; // S = CellPtr(RepPredProp( @@ -1738,21 +1755,18 @@ void Yap_fail_all(choiceptr bb USES_REGS) { } bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) { + yamop *saved_p, *saved_cp; yamop *CodeAdr; bool out; - YAP_dogoalinfo gi; - gi.p = P; - gi.cp = CP; - gi.b0 = LCL0-CellPtr(B); - gi.CurSlot = Yap_CurrentHandle(); - gi.a = LCL0-ASP; - gi.e = LCL0-ENV; + + saved_p = P; + saved_cp = CP; LOCAL_PrologMode |= TopGoalMode; PELOCK(81, ppe); CodeAdr = ppe->CodeOfPred; UNLOCK(ppe->PELock); - out = do_goal(CodeAdr, ppe->ArityOfPE, pt, &gi, false PASS_REGS); + out = do_goal(CodeAdr, ppe->ArityOfPE, pt, false PASS_REGS); if (out) { choiceptr cut_B; @@ -1773,14 +1787,14 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) { #endif } #endif /* TABLING */ - B = (choiceptr)(LCL0-gi.b0); - CP = gi.cp; - P = gi.p; - ASP = LCL0-gi.a; + B = cut_B; + CP = saved_cp; + P = saved_p; + ASP = ENV; #ifdef DEPTH_LIMIT DEPTH = ENV[E_DEPTH]; #endif - ENV = LCL0-gi.e; + ENV = (CELL *)(ENV[E_E]); /* we have failed, and usually we would backtrack to this B, trouble is, we may also have a delayed cut to do */ if (B != NULL) @@ -1799,18 +1813,18 @@ bool Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS) { } return true; } else if (out == 0) { - P = gi.p; - CP = gi.cp; + P = saved_p; + CP = saved_cp; HR = B->cp_h; #ifdef DEPTH_LIMIT DEPTH = B->cp_depth; #endif /* ASP should be set to the top of the local stack when we did the call */ - ASP = LCL0-gi.a; + ASP = B->cp_env; /* YENV should be set to the current environment */ - YENV = ENV = LCL0-gi.e; - B =(choiceptr)(LCL0-gi.b); + YENV = ENV = (CELL *)((B->cp_env)[E_E]); + B = B->cp_b; SET_BB(B); HB = PROTECT_FROZEN_H(B); // should we catch the exception or pass it through? @@ -1894,14 +1908,7 @@ Term Yap_RunTopGoal(Term t, bool handle_errors) { UInt arity; Term tmod = CurrentModule; Term goal_out = 0; - YAP_dogoalinfo gi; - gi.p = P; - gi.cp = CP; - gi.b0 = gi.b = LCL0-CellPtr(B); - gi.CurSlot = Yap_CurrentHandle(); - gi.a = LCL0-ASP; - gi.e = LCL0-ENV; - LOCAL_PrologMode |= TopGoalMode; + LOCAL_PrologMode |= TopGoalMode; t = Yap_YapStripModule(t, &tmod); if (IsVarTerm(t)) { @@ -1971,7 +1978,7 @@ Term Yap_RunTopGoal(Term t, bool handle_errors) { "unable to boot because of too little Trail space"); } #endif - goal_out = do_goal(CodeAdr, arity, pt, &gi, handle_errors PASS_REGS); + goal_out = do_goal(CodeAdr, arity, pt, handle_errors PASS_REGS); return goal_out; } @@ -2235,7 +2242,6 @@ static Int generate_pred_info(USES_REGS1) { void Yap_InitYaamRegs(int myworker_id, bool full_reset) { Term h0var; - YAP_dogoalinfo gi; // getchar(); #if PUSH_REGS /* Guarantee that after a longjmp we go back to the original abstract @@ -2281,7 +2287,7 @@ void Yap_InitYaamRegs(int myworker_id, bool full_reset) { REMOTE_AttsMutableList(myworker_id) = Yap_NewTimedVar(h0var); #endif size_t defsz = 128*1024; - Yap_AllocateDefaultArena(defsz, myworker_id); + Yap_AllocateDefaultArena(defsz, myworker_id, NULL); } else { HR = Yap_ArenaLimit(REMOTE_GlobalArena(myworker_id)); } @@ -2307,7 +2313,7 @@ void Yap_InitYaamRegs(int myworker_id, bool full_reset) { PREG_ADDR = NULL; #endif cut_c_initialize(myworker_id); - Yap_PrepGoal(0, NULL, &gi PASS_REGS); + Yap_PrepGoal(0, NULL, NULL PASS_REGS); #ifdef FROZEN_STACKS H_FZ = HR; #ifdef YAPOR_SBA @@ -2391,6 +2397,7 @@ void Yap_InitExecFs(void) { Yap_InitCPred("$execute_nonstop", 1, execute_nonstop1, NoTracePredFlag); Yap_InitCPred("$creep_step", 2, creep_step, NoTracePredFlag); Yap_InitCPred("$execute_clause", 4, execute_clause, NoTracePredFlag); + Yap_InitCPred("$creep_clause", 4,creep_clause, NoTracePredFlag); Yap_InitCPred("$current_choice_point", 1, current_choice_point, 0); Yap_InitCPred("$current_choicepoint", 1, current_choice_point, 0); CurrentModule = HACKS_MODULE; diff --git a/C/globals.c b/C/globals.c index 77e0d4868..e1c128900 100644 --- a/C/globals.c +++ b/C/globals.c @@ -78,7 +78,7 @@ assert/1 or recorda/3. + The value lives on the Prolog (global) stack. This implies that lookup time is independent from the size of the term. This is particulary interesting for large data structures -such as parsed XML documents or the CHR global constraint +qqqsuch as parsed XML documents or the CHR global constraint store. They support both global assignment using nb_setval/2 and @@ -139,6 +139,26 @@ threads that are created after the registration. #define HEAP_ARENA 2 #define HEAP_START 3 +/// A cell_space is a short code region, where we want bindings to proceed locally. +/// It is used in copy_term,,,,,,,,,,,,,,,,,,,,,,, +/// +typedef struct cell_space { + struct cell_space *parent; //` + CELL *oASP, *oH, *oHB; +} cell_space_t; + +INLINE_ONLY void enter_cell_space(cell_space_t *cs) { + cs->oH = HR; + cs->oHB = HB; + cs->oASP = ASP; +} + +INLINE_ONLY void exit_cell_space(cell_space_t *cs) { + HR = cs->oH; + HB = cs->oHB; + ASP = cs->oASP; +} + #define MIN_ARENA_SIZE (1048L) #define MAX_ARENA_SIZE (2048 * 16) @@ -186,33 +206,37 @@ static Term CreateNewArena(CELL *ptr, UInt size) { return t; } -static Term NewArena(UInt size, int wid, UInt arity, CELL *where) { +static Term NewArena(UInt size, int wid, UInt arity, CELL *where, struct cell_space *cellSpace) { Term t; UInt new_size; WORKER_REGS(wid) - - if (where == NULL || where == HR) { - while (HR + size > ASP - 1024) { +exit_cell_space(cellSpace); + // make sure we have enough room + while (HR + size > ASP - 2*MIN_ARENA_SIZE) { if (!Yap_gcl(size * sizeof(CELL), arity, ENV, P)) { - Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage); + Yap_ThrowError(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage); return TermNil; } } + if (where == NULL || where == HR) { t = CreateNewArena(HR, size); HR += size; + new_size = size; } else { if ((new_size = Yap_InsertInGlobal(where, size * sizeof(CELL))) == 0) { - Yap_Error(RESOURCE_ERROR_STACK, TermNil, + Yap_ThrowError(RESOURCE_ERROR_STACK, TermNil, "No Stack Space for Non-Backtrackable terms"); return TermNil; } size = new_size / sizeof(CELL); t = CreateNewArena(where, size); } + enter_cell_space(cellSpace); return t; } static Int p_allocate_arena(USES_REGS1) { + cell_space_t cspace; Term t = Deref(ARG1); if (IsVarTerm(t)) { Yap_Error(INSTANTIATION_ERROR, t, "allocate_arena"); @@ -221,15 +245,21 @@ static Int p_allocate_arena(USES_REGS1) { Yap_Error(TYPE_ERROR_INTEGER, t, "allocate_arena"); return FALSE; } - return Yap_unify(ARG2, NewArena(IntegerOfTerm(t), worker_id, 1, NULL)); + enter_cell_space(&cspace); + return Yap_unify(ARG2, NewArena(IntegerOfTerm(t), worker_id, 1, NULL, &cspace)); } static Int p_default_arena_size(USES_REGS1) { return Yap_unify(ARG1, MkIntegerTerm(ArenaSz(LOCAL_GlobalArena))); } -void Yap_AllocateDefaultArena(size_t gsize, int wid) { - REMOTE_GlobalArena(wid) = NewArena(gsize, wid, 2, NULL); +void Yap_AllocateDefaultArena(size_t gsize, int wid, void *cs) { + cell_space_t ics; + if (cs == NULL) { + enter_cell_space(&ics); + cs = &ics; + } + REMOTE_GlobalArena(wid) = NewArena(gsize, wid, 2, NULL, cs); } static void adjust_cps(UInt size USES_REGS) { @@ -241,8 +271,9 @@ static void adjust_cps(UInt size USES_REGS) { } } -static int GrowArena(Term arena, CELL *pt, size_t old_size, size_t size, - UInt arity USES_REGS) { +static Term GrowArena(Term arena, CELL *pt, size_t old_size, size_t size, + UInt arity, cell_space_t *cspace USES_REGS) { + size_t sz; LOCAL_ArenaOverflows++; if (size == 0) { if (old_size < 128 * 1024) { @@ -251,59 +282,51 @@ static int GrowArena(Term arena, CELL *pt, size_t old_size, size_t size, size = old_size + 128 * 1024; } } - if (size < 4096) { - size = 4096; + if (size < 4*MIN_ARENA_SIZE) { + size = 4*MIN_ARENA_SIZE; } - if (pt == HR) { - if (HR + size > ASP - 1024) { - + while (HR + size > ASP - MIN_ARENA_SIZE) { XREGS[arity + 1] = arena; if (!Yap_gcl(size * sizeof(CELL), arity + 1, ENV, gc_P(P, CP))) { - Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage); - return FALSE; + Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage); + return false; } arena = XREGS[arity + 1]; - /* we don't know if the GC added junk on top of the global */ - pt = ArenaLimit(arena); - return GrowArena(arena, pt, old_size, size, arity PASS_REGS); - } - adjust_cps(size PASS_REGS); - HR += size; - } else { - XREGS[arity + 1] = arena; - /* try to recover some room */ - Yap_gcl(size * sizeof(CELL), arity + 1, ENV, gc_P(P, CP)); - arena = XREGS[arity + 1]; - pt = ArenaLimit(arena); - if ((size = Yap_InsertInGlobal(pt, size * sizeof(CELL))) == 0) { - return FALSE; - } - size = size / sizeof(CELL); - arena = XREGS[arity + 1]; + adjust_cps(size PASS_REGS); } - CreateNewArena(ArenaPt(arena), size + old_size); - return TRUE; + pt = ArenaLimit(arena); + sz = old_size + size; + if (pt == HR) { + HR += size; + HR[ - 1] = EndSpecials; + } else { + if ((sz = Yap_InsertInGlobal(pt, size * sizeof(CELL))) == 0) { + return FALSE; + } + pt[size-1] = EndSpecials; + } + arena = XREGS[arity + 1]; + MP_INT *dst = (MP_INT *)(RepAppl(arena) + 2); + dst->_mp_alloc+= size; + arena = XREGS[arity + 1]; + return sz; } CELL *Yap_GetFromArena(Term *arenap, UInt cells, UInt arity) { CACHE_REGS -restart : { Term arena = *arenap; CELL *max = ArenaLimit(arena); CELL *base = ArenaPt(arena); CELL *newH; UInt old_sz = ArenaSz(arena), new_size; - + while(true) { if (IN_BETWEEN(base, HR, max)) { base = HR; HR += cells; return base; } - if (base + cells > max - 1024) { - if (!GrowArena(arena, max, old_sz, old_sz + sizeof(CELL) * 1024, - arity PASS_REGS)) - return NULL; - goto restart; + if (base + cells > ASP - 1024) { + continue; } newH = base + cells; @@ -313,17 +336,15 @@ restart : { } } -static void CloseArena(CELL *oldH, CELL *oldHB, CELL *oldASP, Term *oldArenaP, +static void CloseArena(cell_space_t *region, Term *oldArenaP, UInt old_size USES_REGS) { UInt new_size; - if (HR == oldH) + if (HR == region->oH) return; new_size = old_size - (HR - RepAppl(*oldArenaP)); *oldArenaP = CreateNewArena(HR, new_size); - HR = oldH; - HB = oldHB; - ASP = oldASP; + exit_cell_space( region ); } static inline void clean_dirty_tr(tr_fr_ptr TR0 USES_REGS) { @@ -474,7 +495,9 @@ loop: HR += ap2[1] + 3; break; default: { - /* big int */ + + + /* big int */ UInt sz = (sizeof(MP_INT) + 3 * CellSize + ((MP_INT *)(ap2 + 2))->_mp_alloc * sizeof(mp_limb_t)) / CellSize, @@ -482,7 +505,7 @@ loop: if (HR > ASP - (MIN_ARENA_SIZE + sz)) { goto overflow; - } + } *ptf++ = AbsAppl(HR); HR[0] = (CELL)f; for (i = 1; i < sz; i++) { @@ -494,6 +517,7 @@ loop: continue; } *ptf = AbsAppl(HR); + ptf++; /* store the terms to visit */ #ifdef RATIONAL_TREES @@ -643,14 +667,14 @@ static Term CopyTermToArena(Term t, Term arena, bool share, bool copy_att_vars, UInt arity, Term *newarena, size_t min_grow USES_REGS) { size_t old_size = ArenaSz(arena); - CELL *oldH = HR; - CELL *oldHB = HB; - CELL *oldASP = ASP; + cell_space_t cspace; int res = 0; Term tn; + int restarts = 0; restart: t = Deref(t); + enter_cell_space( & cspace); if (IsVarTerm(t)) { ASP = ArenaLimit(arena); HR = HB = ArenaPt(arena); @@ -664,12 +688,12 @@ restart: if ((res = copy_complex_term(Hi - 2, Hi - 1, share, copy_att_vars, Hi, Hi PASS_REGS)) < 0) goto error_handler; - CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS); + CloseArena(&cspace, newarena, old_size PASS_REGS); return Hi[0]; } #endif if (share && VarOfTerm(t) > ArenaPt(arena)) { - CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS); + CloseArena(&cspace, newarena, old_size PASS_REGS); return t; } tn = MkVarTerm(); @@ -677,7 +701,7 @@ restart: res = -1; goto error_handler; } - CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS); + CloseArena(&cspace, newarena, old_size PASS_REGS); return tn; } else if (IsAtomOrIntTerm(t)) { return t; @@ -699,7 +723,7 @@ restart: Hi PASS_REGS)) < 0) { goto error_handler; } - CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS); + CloseArena(&cspace, newarena, old_size PASS_REGS); return tf; } else { Functor f; @@ -720,7 +744,7 @@ restart: if (IsExtensionFunctor(f)) { switch ((CELL)f) { case (CELL) FunctorDBRef: - CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS); + CloseArena(&cspace, newarena, old_size PASS_REGS); return t; case (CELL) FunctorLongInt: if (HR > ASP - (MIN_ARENA_SIZE + 3)) { @@ -779,25 +803,25 @@ restart: goto error_handler; } } - CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS); + CloseArena(&cspace, newarena, old_size PASS_REGS); return tf; } error_handler: HR = HB; - CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS); + CloseArena(&cspace, newarena, old_size PASS_REGS); XREGS[arity + 1] = t; XREGS[arity + 2] = arena; XREGS[arity + 3] = (CELL)newarena; { CELL *old_top = ArenaLimit(*newarena); - ASP = oldASP; - HR = oldH; - HB = oldHB; + exit_cell_space(&cspace); switch (res) { case -1: if (arena == LOCAL_GlobalArena) LOCAL_GlobalArenaOverflows++; - if (!GrowArena(arena, old_top, old_size, min_grow, arity + 3 PASS_REGS)) { + restarts++; + min_grow += (restarts < 16 ? 16*1024*restarts*restarts : 128*1024*1024); + if ((arena=GrowArena(arena, old_top, old_size, min_grow, arity + 3, &cspace PASS_REGS))==0) { Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage); return 0L; } @@ -807,9 +831,7 @@ error_handler: } } - oldH = HR; - oldHB = HB; - oldASP = ASP; + enter_cell_space(&cspace); newarena = (CELL *)XREGS[arity + 3]; arena = Deref(XREGS[arity + 2]); t = XREGS[arity + 1]; @@ -819,10 +841,9 @@ error_handler: static Term CreateTermInArena(Term arena, Atom Na, UInt Nar, UInt arity, Term *newarena, Term init USES_REGS) { + cell_space_t cells; UInt old_size = ArenaSz(arena); - CELL *oldH = HR; - CELL *oldHB = HB; - CELL *oldASP = ASP; + enter_cell_space(&cells); Term tf; CELL *HB0; Functor f = Yap_MkFunctor(Na, Nar); @@ -838,26 +859,20 @@ restart: if (HR > ASP - MIN_ARENA_SIZE) { /* overflow */ HR = HB; - CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS); + CloseArena(&cells, newarena, old_size PASS_REGS); XREGS[arity + 1] = arena; XREGS[arity + 2] = (CELL)newarena; { CELL *old_top = ArenaLimit(*newarena); - ASP = oldASP; - HR = oldH; - HB = oldHB; if (arena == LOCAL_GlobalArena) LOCAL_GlobalArenaOverflows++; - if (!GrowArena(arena, old_top, old_size, Nar * sizeof(CELL), - arity + 2 PASS_REGS)) { + if ((arena=GrowArena(arena, old_top, old_size, Nar * sizeof(CELL), + arity + 2, &cells PASS_REGS))==0) { Yap_Error(RESOURCE_ERROR_STACK, TermNil, "while creating large global term"); return 0L; } } - oldH = HR; - oldHB = HB; - oldASP = ASP; newarena = (CELL *)XREGS[arity + 2]; arena = Deref(XREGS[arity + 1]); old_size = ArenaSz(arena); @@ -872,7 +887,7 @@ restart: HB0[i] = init; } } - CloseArena(oldH, oldHB, oldASP, newarena, old_size PASS_REGS); + CloseArena(&cells, newarena, old_size PASS_REGS); return tf; } @@ -1534,9 +1549,9 @@ static Int p_nb_create2(USES_REGS1) { static Int nb_queue(UInt arena_sz USES_REGS) { + cell_space_t cspace; Term queue_arena, queue, ar[QUEUE_FUNCTOR_ARITY], *nar; Term t = Deref(ARG1); - LOCAL_DepthArenas++; if (!IsVarTerm(t)) { if (!IsApplTerm(t)) { @@ -1549,15 +1564,16 @@ static Int nb_queue(UInt arena_sz USES_REGS) { queue = Yap_MkApplTerm(FunctorNBQueue, QUEUE_FUNCTOR_ARITY, ar); if (!Yap_unify(queue, ARG1)) return FALSE; - if (arena_sz < 4 * 1024) - arena_sz = 4 * 1024; - queue_arena = NewArena(arena_sz, worker_id, 1, NULL); + if (arena_sz < 32 * 1024) + arena_sz = 32 * 1024; + enter_cell_space(&cspace); + queue_arena = NewArena(arena_sz, worker_id, 1, NULL, &cspace); if (queue_arena == 0L) { return FALSE; } nar = RepAppl(Deref(ARG1)) + 1; nar[QUEUE_ARENA] = queue_arena; - return TRUE; + return true; } static Int p_nb_queue(USES_REGS1) { @@ -1656,7 +1672,7 @@ static Int p_nb_queue_close(USES_REGS1) { } static Int p_nb_queue_enqueue(USES_REGS1) { - CELL *qd = GetQueue(ARG1, "enqueue"), *oldH, *oldHB; + CELL *qd = GetQueue(ARG1, "enqueue"); UInt old_sz; Term arena, qsize, to; UInt min_size; @@ -1664,8 +1680,10 @@ static Int p_nb_queue_enqueue(USES_REGS1) { if (!qd) return FALSE; arena = GetQueueArena(qd, "enqueue"); - if (arena == 0L) - return FALSE; + if (arena == 0L) { + return FALSE; + } + if (IsPairTerm(qd[QUEUE_HEAD])) { min_size = ArenaPt(arena) - RepPair(qd[QUEUE_HEAD]); } else { @@ -1675,37 +1693,15 @@ static Int p_nb_queue_enqueue(USES_REGS1) { min_size PASS_REGS); if (to == 0L) return FALSE; + cell_space_t cspace; qd = GetQueue(ARG1, "enqueue"); arena = GetQueueArena(qd, "enqueue"); /* garbage collection ? */ - oldH = HR; - oldHB = HB; + enter_cell_space(&cspace); HR = HB = ArenaPt(arena); old_sz = ArenaSz(arena); qsize = IntegerOfTerm(qd[QUEUE_SIZE]); - while (old_sz < MIN_ARENA_SIZE) { - UInt gsiz = HR - RepPair(qd[QUEUE_HEAD]); - HR = oldH; - HB = oldHB; - if (gsiz > 1024 * 1024) { - gsiz = 1024 * 1024; - } else if (gsiz < 1024) { - gsiz = 1024; - } - ARG3 = to; - /* fprintf(stderr,"growing %ld cells\n",(unsigned long int)gsiz);*/ - if (!GrowArena(arena, ArenaLimit(arena), old_sz, gsiz, 3 PASS_REGS)) { - Yap_Error(RESOURCE_ERROR_STACK, arena, LOCAL_ErrorMessage); - return 0L; - } - to = ARG3; - qd = RepAppl(Deref(ARG1)) + 1; - arena = GetQueueArena(qd, "enqueue"); - oldH = HR; - oldHB = HB; - HR = HB = ArenaPt(arena); - old_sz = ArenaSz(arena); - } + qd[QUEUE_SIZE] = Global_MkIntegerTerm(qsize + 1); if (qsize == 0) { qd[QUEUE_HEAD] = AbsPair(HR); @@ -1716,7 +1712,7 @@ static Int p_nb_queue_enqueue(USES_REGS1) { RESET_VARIABLE(HR); qd[QUEUE_TAIL] = (CELL)HR; HR++; - CloseArena(oldH, oldHB, ASP, qd + QUEUE_ARENA, old_sz PASS_REGS); + CloseArena(&cspace, qd + QUEUE_ARENA, old_sz PASS_REGS); return TRUE; } @@ -1724,7 +1720,7 @@ static Int p_nb_queue_dequeue(USES_REGS1) { CELL *qd = GetQueue(ARG1, "dequeue"); UInt old_sz, qsz; Term arena, out; - CELL *oldH, *oldHB; + cell_space_t cspace; if (!qd) return FALSE; @@ -1738,10 +1734,9 @@ static Int p_nb_queue_dequeue(USES_REGS1) { out = HeadOfTerm(qd[QUEUE_HEAD]); qd[QUEUE_HEAD] = TailOfTerm(qd[QUEUE_HEAD]); /* garbage collection ? */ - oldH = HR; - oldHB = HB; + enter_cell_space(&cspace); qd[QUEUE_SIZE] = Global_MkIntegerTerm(qsz - 1); - CloseArena(oldH, oldHB, ASP, &arena, old_sz PASS_REGS); + CloseArena(&cspace, &arena, old_sz PASS_REGS); return Yap_unify(out, ARG2); } @@ -1838,6 +1833,7 @@ static Term MkZeroApplTerm(Functor f, UInt sz USES_REGS) { static Int p_nb_heap(USES_REGS1) { Term heap_arena, heap, *ar, *nar; UInt hsize; + cell_space_t cspace; Term tsize = Deref(ARG1); UInt arena_sz = (ASP-HR) / 16; @@ -1868,7 +1864,7 @@ static Int p_nb_heap(USES_REGS1) { ar[HEAP_MAX] = tsize; if (arena_sz < 1024) arena_sz = 1024; - heap_arena = NewArena(arena_sz, worker_id, 1, NULL); + heap_arena = NewArena(arena_sz, worker_id, 1, NULL, &cspace); if (heap_arena == 0L) { return FALSE; } @@ -1946,10 +1942,11 @@ static void DelHeapRoot(CELL *pt, UInt sz) { } static Int p_nb_heap_add_to_heap(USES_REGS1) { - CELL *qd = GetHeap(ARG1, "add_to_heap"), *oldH, *oldHB, *pt; + CELL *qd = GetHeap(ARG1, "add_to_heap"), *pt; UInt hsize, hmsize, old_sz; Term arena, to, key; UInt mingrow; + cell_space_t cspace; if (!qd) return FALSE; @@ -1971,7 +1968,8 @@ restart: "No Stack Space for Non-Backtrackable terms"); return FALSE; } - extra_size = extra_size / (2 * sizeof(CELL)); + enter_cell_space(&cspace); + extra_size = extra_size / (2 * sizeof(CELL)); qd = GetHeap(ARG1, "add_to_heap"); hmsize += extra_size; if (!qd) @@ -1986,11 +1984,9 @@ restart: } arena = qd[HEAP_ARENA]; old_sz = ArenaSz(arena); - oldH = HR; - oldHB = HB; HR = HB = ArenaPt(arena); qd[HEAP_MAX] = Global_MkIntegerTerm(hmsize); - CloseArena(oldH, oldHB, ASP, qd + HEAP_ARENA, old_sz PASS_REGS); + CloseArena(&cspace, qd + HEAP_ARENA, old_sz PASS_REGS); goto restart; } arena = qd[HEAP_ARENA]; @@ -2010,30 +2006,25 @@ restart: qd = GetHeap(ARG1, "add_to_heap"); arena = qd[HEAP_ARENA]; /* garbage collection ? */ - oldH = HR; - oldHB = HB; + enter_cell_space(&cspace); HR = HB = ArenaPt(arena); old_sz = ArenaSz(arena); while (old_sz < MIN_ARENA_SIZE) { UInt gsiz = hsize * 2; - HR = oldH; - HB = oldHB; if (gsiz > 1024 * 1024) { gsiz = 1024 * 1024; } else if (gsiz < 1024) { gsiz = 1024; } ARG3 = to; - if (!GrowArena(arena, ArenaLimit(arena), old_sz, gsiz, 3 PASS_REGS)) { + if ((arena=GrowArena(arena, ArenaLimit(arena), old_sz, gsiz, 3, &cspace PASS_REGS))==0) { Yap_Error(RESOURCE_ERROR_STACK, arena, LOCAL_ErrorMessage); return 0L; } to = ARG3; qd = RepAppl(Deref(ARG1)) + 1; arena = qd[HEAP_ARENA]; - oldH = HR; - oldHB = HB; HR = HB = ArenaPt(arena); old_sz = ArenaSz(arena); } @@ -2042,7 +2033,7 @@ restart: pt[2 * hsize + 1] = to; PushHeap(pt, hsize); qd[HEAP_SIZE] = Global_MkIntegerTerm(hsize + 1); - CloseArena(oldH, oldHB, ASP, qd + HEAP_ARENA, old_sz PASS_REGS); + CloseArena(&cspace, qd + HEAP_ARENA, old_sz PASS_REGS); return TRUE; } @@ -2100,6 +2091,7 @@ static Int p_nb_heap_size(USES_REGS1) { } static Int p_nb_beam(USES_REGS1) { + cell_space_t cspace; Term beam_arena, beam, *ar, *nar; UInt hsize; Term tsize = Deref(ARG1); @@ -2130,7 +2122,7 @@ static Int p_nb_beam(USES_REGS1) { ar[HEAP_MAX] = tsize; if (arena_sz < 1024) arena_sz = 1024; - beam_arena = NewArena(arena_sz, worker_id, 1, NULL); + beam_arena = NewArena(arena_sz, worker_id, 1, NULL, &cspace); if (beam_arena == 0L) { return FALSE; } @@ -2339,10 +2331,11 @@ static Term DelBeamMin(CELL *pt, CELL *pt2, UInt sz) { } static Int p_nb_beam_add_to_beam(USES_REGS1) { - CELL *qd = GetHeap(ARG1, "add_to_beam"), *oldH, *oldHB, *pt; + CELL *qd = GetHeap(ARG1, "add_to_beam"), *pt; UInt hsize, hmsize, old_sz; - Term arena, to, key; + Term arena, to, qsize, key; UInt mingrow; +cell_space_t cspace; if (!qd) return FALSE; @@ -2373,37 +2366,32 @@ static Int p_nb_beam_add_to_beam(USES_REGS1) { qd = GetHeap(ARG1, "add_to_beam"); arena = qd[HEAP_ARENA]; /* garbage collection ? */ - oldH = HR; - oldHB = HB; + enter_cell_space(&cspace); HR = HB = ArenaPt(arena); old_sz = ArenaSz(arena); + qsize = IntegerOfTerm(qd[QUEUE_SIZE]); while (old_sz < MIN_ARENA_SIZE) { - UInt gsiz = hsize * 2; - - HR = oldH; - HB = oldHB; + UInt gsiz = HR - RepPair(qd[QUEUE_HEAD]); if (gsiz > 1024 * 1024) { gsiz = 1024 * 1024; } else if (gsiz < 1024) { gsiz = 1024; } ARG3 = to; - if (!GrowArena(arena, ArenaLimit(arena), old_sz, gsiz, 3 PASS_REGS)) { + /* fprintf(stderr,"growing %ld cells\n",(unsigned long int)gsiz);*/ + if (!GrowArena(arena, ArenaLimit(arena), old_sz, gsiz, 3, &cspace PASS_REGS)) { Yap_Error(RESOURCE_ERROR_STACK, arena, LOCAL_ErrorMessage); return 0L; } to = ARG3; qd = RepAppl(Deref(ARG1)) + 1; arena = qd[HEAP_ARENA]; - oldH = HR; - oldHB = HB; - HR = HB = ArenaPt(arena); old_sz = ArenaSz(arena); } pt = qd + HEAP_START; PushBeam(pt, pt + 2 * hmsize, hsize, key, to); qd[HEAP_SIZE] = Global_MkIntegerTerm(hsize + 1); - CloseArena(oldH, oldHB, ASP, qd + HEAP_ARENA, old_sz PASS_REGS); + CloseArena(&cspace, qd + HEAP_ARENA, old_sz PASS_REGS); return TRUE; } @@ -2411,8 +2399,8 @@ static Int p_nb_beam_del(USES_REGS1) { CELL *qd = GetHeap(ARG1, "debeam"); UInt old_sz, qsz; Term arena; - CELL *oldH, *oldHB; Term tk, tv; + cell_space_t cspace; if (!qd) return FALSE; @@ -2424,10 +2412,9 @@ static Int p_nb_beam_del(USES_REGS1) { return FALSE; old_sz = ArenaSz(arena); /* garbage collection ? */ - oldH = HR; - oldHB = HB; + enter_cell_space(&cspace); qd[HEAP_SIZE] = Global_MkIntegerTerm(qsz - 1); - CloseArena(oldH, oldHB, ASP, &arena, old_sz PASS_REGS); + CloseArena(&cspace, &arena, old_sz PASS_REGS); tk = qd[HEAP_START]; tv = DelBeamMin(qd + HEAP_START, qd + (HEAP_START + 2 * IntegerOfTerm(qd[HEAP_MAX])), qsz); diff --git a/C/grow.c b/C/grow.c index e80ee26f1..431af42c8 100755 --- a/C/grow.c +++ b/C/grow.c @@ -324,15 +324,15 @@ MoveGlobalWithHole( USES_REGS1 ) } static void -MoveHalfGlobal(CELL *OldPt USES_REGS) +MoveHalfGlobal(CELL *OldPt, size_t request USES_REGS) { /* * cpcellsd(To,From,NOfCells) - copy the cells downwards - in * absmi.asm */ UInt diff = LOCAL_OldH-OldPt; - CELL *NewPt = (CELL *)((char*)OldPt+LOCAL_GDiff); CELL *IntPt = (CELL *)((char*)OldPt+LOCAL_GDiff0); + CELL *NewPt = IntPt+request/sizeof(CELL); cpcellsd(NewPt, IntPt, diff); } @@ -393,7 +393,7 @@ AdjustTrail(bool adjusting_heap, bool thread_copying USES_REGS) register CELL reg = TrailTerm(ptt-1); #ifdef FROZEN_STACKS register CELL reg2 = TrailVal(ptt-1); -#endif + #endif ptt--; if (IsVarTerm(reg)) { @@ -436,6 +436,8 @@ fixPointerCells(CELL *pt, CELL *pt_bot, bool thread_copying USES_REGS) { while (pt > pt_bot) { CELL reg = *--pt; + // if (pt-pt_bot> 4300 && pt-pt_bot < 4500) + // printf("%d %d %lx\n", pt-pt_bot, pt-LOCAL_GSplit, reg); if (IsVarTerm(reg)) { if (IsOldLocal(reg)) *pt = LocalAdjust(reg); @@ -450,6 +452,8 @@ fixPointerCells(CELL *pt, CELL *pt_bot, bool thread_copying USES_REGS) } else if (IsPairTerm(reg)) { *pt = AdjustPair(reg PASS_REGS); } + // if (pt-pt_bot> 4300 && pt-pt_bot < 4500) + // printf("%lx\n", *pt); } } @@ -889,12 +893,11 @@ static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS) char *omax = (char *)H0; ADDR old_GlobalBase = LOCAL_GlobalBase; UInt minimal_request = 0L; - Int size = request; + Int size = request/sizeof(CELL); char vb_msg1 = '\0', *vb_msg2; bool do_grow = true; - bool insert_in_delays = false; /* - request is the amount of memory we requested, in bytes; + request is the amount of memory we requesd, in bytes; base_move is the shift in global stacks we had to do size is how much space we allocate: it's negative if we just expand the delay stack. @@ -902,55 +905,42 @@ static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS) */ if (hsplit) { - /* just a little bit of sanity checking */ - if (hsplit < H0 && hsplit > (CELL *)LOCAL_GlobalBase) { - insert_in_delays = TRUE; - /* expanding attributed variables */ - if (omax - size > LOCAL_GlobalBase+4096*sizeof(CELL)) { - /* we can just ask for more room */ - size = 0; - do_grow = FALSE; - } - } else if (hsplit < (CELL*)omax || + if (hsplit < H0 || hsplit > HR) - return FALSE; - else if (hsplit == (CELL *)omax) - hsplit = NULL; - if (size < 0 || - (Unsigned(HR)+size < Unsigned(ASP)-StackGap( PASS_REGS1 ) && - hsplit > H0)) { - /* don't need to expand stacks */ - insert_in_delays = FALSE; - do_grow = FALSE; - } - } else { - if (Unsigned(HR)+size < Unsigned(ASP)-CreepFlag) { - /* we can just ask for more room */ - do_grow = FALSE; + return false; + if (hsplit == HR && Unsigned(HR)+request < Unsigned(ASP)-StackGap( PASS_REGS1 )) { + return request; } } + if (size < 0 || + (Unsigned(HR)+request < Unsigned(ASP-StackGap( PASS_REGS1 )))) { + do_grow = false; + } if (do_grow) { - if (size < YAP_ALLOC_SIZE) - size = YAP_ALLOC_SIZE; - size = AdjustPageSize(size); + if (request < YAP_ALLOC_SIZE) + request = YAP_ALLOC_SIZE; + request = AdjustPageSize(request); } + + printf("grow=%d\n", do_grow); /* adjust to a multiple of 256) */ LOCAL_ErrorMessage = NULL; LOCAL_PrologMode |= GrowStackMode; start_growth_time = Yap_cputime(); + if (do_grow) { if (!GLOBAL_AllowGlobalExpansion) { LOCAL_ErrorMessage = "Global Stack crashed against Local Stack"; LeaveGrowMode(GrowStackMode); return 0; } - if (!GLOBAL_AllowGlobalExpansion || !Yap_ExtendWorkSpace(size)) { + if (!GLOBAL_AllowGlobalExpansion || !Yap_ExtendWorkSpace(request)) { /* always fails when using malloc */ LOCAL_ErrorMessage = NULL; - size += AdjustPageSize(((CELL)LOCAL_TrailTop-(CELL)LOCAL_GlobalBase)+MinHeapGap); - minimal_request = size; - size = Yap_ExtendWorkSpaceThroughHole(size); - if (size < 0) { + request += AdjustPageSize(((CELL)LOCAL_TrailTop-(CELL)LOCAL_GlobalBase)+MinHeapGap); + minimal_request = request; + request = Yap_ExtendWorkSpaceThroughHole(request); + if (request < 0) { LOCAL_ErrorMessage = "Global Stack crashed against Local Stack"; LeaveGrowMode(GrowStackMode); return 0; @@ -958,15 +948,11 @@ static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS) } } gc_verbose = Yap_is_gc_verbose(); - LOCAL_delay_overflows++; if (gc_verbose) { if (hsplit) { if (hsplit > H0) { vb_msg1 = 'H'; vb_msg2 = "Global Variable Space"; - } else { - vb_msg1 = 'D'; - vb_msg2 = "Global Variable Delay Space"; } } else { vb_msg1 = 'D'; @@ -976,8 +962,9 @@ static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS) fprintf(stderr, "%% Worker Id %d:\n", worker_id); #endif fprintf(stderr, "%% %cO %s Overflow %d\n", vb_msg1, vb_msg2, LOCAL_delay_overflows); - fprintf(stderr, "%% %cO growing the stacks " UInt_FORMAT " bytes\n", vb_msg1, size); + fprintf(stderr, "%% %cO growing the stacks " UInt_FORMAT " bytes\n", vb_msg1, request); } + printf("grow=%d %p\n", do_grow, ASP); ASP -= 256; YAPEnterCriticalSection(); /* we always shift the local and the stack by the same amount */ @@ -985,13 +972,13 @@ static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS) /* we got over a hole */ if (minimal_request) { /* we went over a hole */ - LOCAL_BaseDiff = size+((CELL)LOCAL_TrailTop-(CELL)LOCAL_GlobalBase)-minimal_request; - LOCAL_LDiff = LOCAL_TrDiff = size; + LOCAL_BaseDiff = request+((CELL)LOCAL_TrailTop-(CELL)LOCAL_GlobalBase)-minimal_request; + LOCAL_LDiff = LOCAL_TrDiff = request; } else { /* we may still have an overflow */ LOCAL_BaseDiff = LOCAL_GlobalBase - old_GlobalBase; /* if we grow, we need to move the stacks */ - LOCAL_LDiff = LOCAL_TrDiff = LOCAL_BaseDiff+size; + LOCAL_LDiff = LOCAL_TrDiff = LOCAL_BaseDiff+request; } } else { /* stay still */ @@ -1002,25 +989,21 @@ static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS) hole in global */ if (!hsplit) { if (!do_grow) { - LOCAL_DelayDiff = LOCAL_GDiff = LOCAL_GDiff0 = size; + LOCAL_GDiff = LOCAL_GDiff0 = request; request = 0L; } else { - /* expand delay stack */ - LOCAL_DelayDiff = LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_LDiff; - } - } else if (insert_in_delays) { /* we want to expand a hole for the delay stack */ - LOCAL_DelayDiff = size-request; - LOCAL_GDiff = LOCAL_GDiff0 = size; + LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_LDiff; + } } else { /* we want to expand a hole for the delay stack */ - LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff; + LOCAL_GDiff0 = LOCAL_BaseDiff; LOCAL_GDiff = LOCAL_BaseDiff+request; } LOCAL_GSplit = hsplit; LOCAL_XDiff = LOCAL_HDiff = 0; LOCAL_GlobalBase = old_GlobalBase; - SetHeapRegs(FALSE PASS_REGS); + SetHeapRegs(FALSE PASS_REGS); if (do_grow) { MoveLocalAndTrail( PASS_REGS1 ); if (hsplit) { @@ -1042,17 +1025,13 @@ static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS) *ptr = PtoLocAdjust(*ptr); } if (hsplit) { - if (insert_in_delays) { - /* we have things not quite where we want to have them */ - cpcellsd((CELL *)(omax+LOCAL_DelayDiff), (CELL *)(omax+LOCAL_GDiff0), (ADDR)hsplit-omax); - } else { - MoveHalfGlobal(hsplit PASS_REGS); - } + MoveHalfGlobal(hsplit, request PASS_REGS); + printf("done\n"); } YAPLeaveCriticalSection(); ASP += 256; if (minimal_request) { - Yap_AllocHole(minimal_request, size); + Yap_AllocHole(minimal_request, request); } growth_time = Yap_cputime()-start_growth_time; LOCAL_total_delay_overflow_time += growth_time; @@ -1063,8 +1042,9 @@ static_growglobal(size_t request, CELL **ptr, CELL *hsplit USES_REGS) LeaveGrowMode(GrowStackMode); if (hsplit) { return request; - } else + } else { return LOCAL_GDiff-LOCAL_BaseDiff; + } } static void @@ -1503,7 +1483,7 @@ Yap_growheap(bool fix_code, size_t in_size, void *cip) int Yap_growheap_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep) { - CACHE_REGS + CACHE_REGS int res; res=do_growheap(FALSE, 0L, NULL, old_trp, tksp, vep PASS_REGS); @@ -1576,6 +1556,7 @@ Yap_growstack(size_t size) int res; LOCAL_PrologMode |= GrowStackMode; + printf("extra %dBs\n",size); res=growstack(size PASS_REGS); LeaveGrowMode(GrowStackMode); return res; diff --git a/C/heapgc.c b/C/heapgc.c index badd63c7e..34f5de684 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -1,4 +1,4 @@ -/************************************************************************** +/************************************************************************* * * * YAP Prolog * * * @@ -2090,12 +2090,12 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, bool very_verbose restart_cp: switch (opnum) { case _Nstop: - if (gc_B->cp_b != NULL) { - nargs = 0; - break; - } else { - /* this is the last choice point, the work is done ;-) */ - return; + if (gc_B->cp_env == LCL0) { + return; + } else { + // This must be a border choicepoint, just move up + gc_B = (choiceptr)(gc_B->cp_env[E_B]); + continue; } case _retry_c: case _retry_userc: @@ -3025,11 +3025,14 @@ sweep_choicepoints(choiceptr gc_B USES_REGS) sweep_environments(gc_B->cp_env, EnvSizeInCells, NULL PASS_REGS); - if (gc_B->cp_b != NULL) { - break; - } else - return; - case _trust_fail: + if (gc_B->cp_env == LCL0) { + return; + } else { + // This must be a border choicepoint, just move up + gc_B = (choiceptr)(gc_B->cp_env[E_B]); + continue; + } + case _trust_fail: break; case _or_else: case _or_last: @@ -4191,7 +4194,7 @@ call_gc(UInt gc_lim, Int predarity, CELL *current_env, yamop *nextop USES_REGS) int gc_on = FALSE, gc_t = FALSE; if (Yap_GetValue(AtomGc) != TermNil) - gc_on = TRUE; + gc_on = false; if (IsIntegerTerm(Tgc_margin = Yap_GetValue(AtomGcMargin)) && gc_margin > 0) { gc_margin = (UInt)IntegerOfTerm(Tgc_margin); @@ -4343,3 +4346,4 @@ Yap_inc_mark_variable() CACHE_REGS LOCAL_total_marked++; } + diff --git a/C/index.c b/C/index.c index 03e9d41b0..23dd4da49 100755 --- a/C/index.c +++ b/C/index.c @@ -2039,7 +2039,7 @@ static UInt suspend_indexing(ClauseDef *min, ClauseDef *max, PredEntry *ap, /* give it some slack */ tels = cls + 4; } else { - tels = cls; + tels = cls+1; } sz = (UInt)NEXTOP((yamop *)NULL, sssllp) + tels * sizeof(yamop *); if ((ncode = (yamop *)Yap_AllocCodeSpace(sz)) == NULL) { diff --git a/C/lu_absmi_insts.h b/C/lu_absmi_insts.h index 3d57b09e4..bc67bebdf 100644 --- a/C/lu_absmi_insts.h +++ b/C/lu_absmi_insts.h @@ -470,6 +470,7 @@ LogUpdClause *lcl = PREG->y_u.OtILl.d; UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]); + /* fprintf(stderr,"- %p/%p %d %d %p\n",PREG,ap,timestamp,ap->TimeStampOfPred,PREG->y_u.OtILl.d->ClCode);*/ #if defined(YAPOR) || defined(THREADS) if (PP != ap) { if (PP) UNLOCKPE(16,PP); diff --git a/C/prim_absmi_insts.h b/C/prim_absmi_insts.h index 679e9df4f..d1ac34027 100644 --- a/C/prim_absmi_insts.h +++ b/C/prim_absmi_insts.h @@ -1949,12 +1949,12 @@ Op(p_arg_vv, xxx); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - CELL HRs[3]; - HRs[0] = XREG(PREG->y_u.xxx.x1); - HRs[1] = XREG(PREG->y_u.xxx.x2); - HRs[2] = TermNil; + Term ts[3]; + ts[0] = XREG(PREG->y_u.xxx.x1); + ts[1] = XREG(PREG->y_u.xxx.x2); + RESET_VARIABLE(ts + 2); low_level_trace(enter_pred, - RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HRs); + RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), ts); } #endif /* LOW_LEVEL_TRACE */ BEGD(d0); @@ -2045,14 +2045,16 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); Op(p_arg_cv, xxn); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - CELL HRs[3]; + CELL *Ho = HR; + Term ts[3]; Term t = MkIntegerTerm(PREG->y_u.xxn.c); - HRs[0] = t; - HRs[1] = XREG(PREG->y_u.xxn.xi); - HRs[2] = TermFoundVar; + ts[0] = t; + ts[1] = XREG(PREG->y_u.xxn.xi); + RESET_VARIABLE(ts + 2); low_level_trace(enter_pred, - RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HRs); - } + RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), ts); + HR = Ho; + } #endif /* LOW_LEVEL_TRACE */ BEGD(d0); d0 = PREG->y_u.xxn.c; @@ -2118,13 +2120,13 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); Op(p_arg_y_vv, yxx); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - CELL HRs[3]; - - HRs[0] = XREG(PREG->y_u.yxx.x1); - HRs[1] = XREG(PREG->y_u.yxx.x2); - HRs[2] = TermFoundVar; - low_level_trace(enter_pred, - RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HRs); + Term ts[3]; + ts[0] = XREG(PREG->y_u.yxx.x1); + ts[1] = XREG(PREG->y_u.yxx.x2); + ts[2] = YREG[PREG->y_u.yxx.y]; + RESET_VARIABLE(ts + 2); + low_level_trace(enter_pred, + RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), ts); } #endif /* LOW_LEVEL_TRACE */ BEGD(d0); @@ -2216,13 +2218,16 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); Op(p_arg_y_cv, yxn); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - CELL HRs[3]; + CELL *Ho = HR; + Term ts[3]; Term t = MkIntegerTerm(PREG->y_u.yxn.c); - HRs[0] = t; - HRs[1] = XREG(PREG->y_u.yxn.xi); - HRs[2] = TermNil; + ts[0] = t; + ts[1] = XREG(PREG->y_u.yxn.xi); + ts[2] = YREG[PREG->y_u.yxn.y]; + RESET_VARIABLE(ts + 2); low_level_trace(enter_pred, - RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), HRs); + RepPredProp(Yap_GetPredPropByFunc(FunctorArg, 0)), ts); + HR = Ho; } #endif /* LOW_LEVEL_TRACE */ BEGD(d0); @@ -2294,13 +2299,13 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); restart_func2s: #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - CELL HRs[3]; - HRs[0] = TermNil; - HRs[1] = XREG(PREG->y_u.xxx.x1); - HRs[2] = XREG(PREG->y_u.xxx.x2); + Term ts[3]; + RESET_VARIABLE(ts); + ts[1] = XREG(PREG->y_u.xxx.x1); + ts[2] = XREG(PREG->y_u.xxx.x2); low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); } #endif /* LOW_LEVEL_TRACE */ /* We have to build the structure */ @@ -2412,13 +2417,13 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); restart_func2s_cv: #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - CELL HRs[3]; - HRs[0] = TermNil; - HRs[1] = PREG->y_u.xxc.c; - HRs[2] = XREG(PREG->y_u.xxc.xi); + Term ts[3]; + RESET_VARIABLE(ts); + ts[1] = PREG->y_u.xxc.c; + ts[2] = XREG(PREG->y_u.xxc.xi); low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); } #endif /* LOW_LEVEL_TRACE */ BEGD(d0); @@ -2518,14 +2523,17 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { Term ti; - CELL HRs[3]; - HRs[0] = TermNil; + Term ts[3]; + CELL *hi = HR; + ti = MkIntegerTerm(PREG->y_u.xxn.c); - HRs[1] = XREG(PREG->y_u.xxn.xi); - HRs[2] = ti; + RESET_VARIABLE(ts); + ts[1] = XREG(PREG->y_u.xxn.xi); + ts[2] = ti; low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); + HR = hi; } #endif /* LOW_LEVEL_TRACE */ /* We have to build the structure */ @@ -2610,13 +2618,13 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); restart_func2s_y: #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - CELL HRs[3]; - HRs[0] = TermNil; - HRs[1] = XREG(PREG->y_u.yxx.x1); - HRs[2] = XREG(PREG->y_u.yxx.x2); + Term ts[3]; + RESET_VARIABLE(ts); + ts[1] = XREG(PREG->y_u.yxx.x1); + ts[2] = XREG(PREG->y_u.yxx.x2); low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); } #endif /* LOW_LEVEL_TRACE */ /* We have to build the structure */ @@ -2735,13 +2743,13 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); restart_func2s_y_cv: #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - CELL HRs[3]; - HRs[0] = TermNil; - HRs[1] = PREG->y_u.yxc.c; - HRs[2] = XREG(PREG->y_u.yxc.xi); + Term ts[3]; + RESET_VARIABLE(ts); + ts[1] = PREG->y_u.yxc.c; + ts[2] = XREG(PREG->y_u.yxc.xi); low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); } #endif /* LOW_LEVEL_TRACE */ /* We have to build the structure */ @@ -2847,15 +2855,17 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { Term ti; - CELL HRs[3]; + CELL *hi = HR; + Term ts[3]; ti = MkIntegerTerm((Int)(PREG->y_u.yxn.c)); - HRs[0] = TermFoundVar; - HRs[1] = XREG(PREG->y_u.yxn.xi); - HRs[2] = ti; + RESET_VARIABLE(ts); + ts[1] = XREG(PREG->y_u.yxn.xi); + ts[2] = ti; low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); + HR = hi; } #endif /* LOW_LEVEL_TRACE */ /* We have to build the structure */ @@ -2952,12 +2962,13 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); Op(p_func2f_xx, xxx); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - Term HRs[3]; - HRs[0] = XREG(PREG->y_u.xxx.x); - HRs[1] = HRs[2] = TermFoundVar; + Term ts[3]; + ts[0] = XREG(PREG->y_u.xxx.x); + RESET_VARIABLE(ts + 1); + RESET_VARIABLE(ts + 2); low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); } #endif /* LOW_LEVEL_TRACE */ BEGD(d0); @@ -3000,12 +3011,13 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); Op(p_func2f_xy, xxy); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - Term HRs[3]; - HRs[0] = XREG(PREG->y_u.xxy.x); - HRs[1] = HRs[2] = TermFoundVar; + Term ts[3]; + ts[0] = XREG(PREG->y_u.xxy.x); + RESET_VARIABLE(ts + 1); + RESET_VARIABLE(ts + 2); low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); } #endif /* LOW_LEVEL_TRACE */ BEGD(d0); @@ -3051,12 +3063,13 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); Op(p_func2f_yx, yxx); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - Term HRs[3]; - HRs[0] = XREG(PREG->y_u.yxx.x2); - HRs[1] = HRs[2] = TermFoundVar; + Term ts[3]; + ts[0] = XREG(PREG->y_u.yxx.x2); + RESET_VARIABLE(ts + 1); + RESET_VARIABLE(ts + 2); low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); } #endif /* LOW_LEVEL_TRACE */ BEGD(d0); @@ -3102,12 +3115,13 @@ Yap_AsmError( DOMAIN_ERROR_NOT_LESS_THAN_ZERO ); Op(p_func2f_yy, yyx); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { - CELL HRs[3]; - HRs[0] = XREG(PREG->y_u.yyx.x); - HRs[1] = HRs[2] = TermFoundVar; + Term ts[3]; + ts[0] = XREG(PREG->y_u.yyx.x); + RESET_VARIABLE(ts + 1); + RESET_VARIABLE(ts + 2); low_level_trace(enter_pred, RepPredProp(Yap_GetPredPropByFunc(FunctorFunctor, 0)), - HRs); + ts); } #endif /* LOW_LEVEL_TRACE */ BEGD(d0); diff --git a/C/scanner.c b/C/scanner.c index eea251712..b232b3816 100755 --- a/C/scanner.c +++ b/C/scanner.c @@ -435,7 +435,7 @@ writing, writing a BOM can be requested using the option #define my_islower(C) (C >= 'a' && C <= 'z') static Term float_send(char *, int); -static Term get_num(int *, int *, struct stream_desc *, int); +static Term get_num(int *, int *, struct stream_desc *, int, char **, size_t *); static void Yap_setCurrentSourceLocation(struct stream_desc *s) { CACHE_REGS @@ -579,21 +579,6 @@ static TokEntry *TrailSpaceError__(TokEntry *t, TokEntry *l USES_REGS) { return l; } -#define AuxSpaceError(p, l, msg) AuxSpaceError__(p, l, msg PASS_REGS) -static TokEntry *AuxSpaceError__(TokEntry *p, TokEntry *l, - const char *msg USES_REGS) { - /* huge atom or variable, we are in trouble */ - LOCAL_ErrorMessage = (char *)msg; - LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK; - Yap_ReleasePreAllocCodeSpace((COBEADDR)TokImage); - if (p) { - p->Tok = eot_tok; - p->TokInfo = TermOutOfAuxspaceError; - } - /* serious error now */ - return l; -} - static void *InitScannerMemory(void) { CACHE_REGS LOCAL_ErrorMessage = NULL; @@ -879,32 +864,22 @@ static int num_send_error_message(char s[]) { #define number_overflow() \ { \ - size_t nsz = Yap_Min(max_size * 2, max_size); \ + imgsz = Yap_Min(imgsz * 2, imgsz); \ char *nbuf; \ - \ - if (buf == buf0) { \ - nbuf = Malloc(nsz); \ - } else { \ - nbuf = realloc(buf, nsz); \ - } \ - if (!nbuf) { \ - return num_send_error_message("Number Too Long"); \ - } else { \ - left = nsz - max_size; \ - max_size = nsz; \ + nbuf = Realloc(buf, imgsz); left = imgsz - max_size; \ + max_size = imgsz; \ buf = nbuf; \ - } \ } /* reads a number, either integer or float */ -static Term get_num(int *chp, int *chbuffp, StreamDesc *st, int sign) { +static Term get_num(int *chp, int *chbuffp, StreamDesc *st, int sign, char **bufp, size_t *szp) { int ch = *chp; Int val = 0L, base = ch - '0'; int might_be_float = TRUE, has_overflow = FALSE; const unsigned char *decimalpoint; - char buf0[256], *sp = buf0, *buf = buf0; - int max_size = 254, left = 254; + char *buf0 = *bufp, *sp = buf0, *buf = buf0; + size_t imgsz = *szp, max_size = imgsz, left = max_size-2; *sp++ = ch; ch = getchr(st); @@ -1167,7 +1142,11 @@ Term Yap_scan_num(StreamDesc *inp, bool error_on) { LOCAL_Error_TYPE = RESOURCE_ERROR_STACK; return 0; } - out = get_num(&ch, &cherr, inp, sign); /* */ + size_t sz = 1024; + char *buf = Malloc(sz); + int lvl = push_text_stack(); + out = get_num(&ch, &cherr, inp, sign, &buf, &sz); /* */ + pop_text_stack(lvl); } else { out = 0; } @@ -1340,9 +1319,13 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, TokEntry *t, *l, *p; enum TokenKinds kind; int solo_flag = TRUE; + int lvl = push_text_stack(); int32_t ch, och = ' '; struct qq_struct_t *cur_qq = NULL; int sign = 1; + size_t imgsz = 1024; + char *TokImage = Malloc(imgsz PASS_REGS); + InitScannerMemory(); LOCAL_VarTable = NULL; @@ -1362,11 +1345,11 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, int quote, isvar; unsigned char *charp, *mp; size_t len; - unsigned char *TokImage = NULL; t = (TokEntry *)AllocScannerMemory(sizeof(TokEntry)); t->TokNext = NULL; if (t == NULL) { + pop_text_stack(lvl); return TrailSpaceError(p, l); } if (!l) @@ -1428,39 +1411,39 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, ch = getchr(st); scan_name: { - size_t sz = 1024; - TokImage = Malloc(sz PASS_REGS); charp = (unsigned char *)TokImage; isvar = (chtype(och) != LC); add_ch_to_buff(och); for (; chtype(ch) <= NU; ch = getchr(st)) { - if (charp == TokImage + (sz - 1)) { - unsigned char *p0 = TokImage; - sz = Yap_Min(sz * 2, sz + MBYTE); - TokImage = Realloc(p0, sz); + if (charp == (unsigned char *)TokImage + (imgsz - 1)) { + unsigned char *p0 = (unsigned char *)TokImage; + imgsz = Yap_Min(imgsz * 2, imgsz + MBYTE); + TokImage = Realloc(p0, imgsz); if (TokImage == NULL) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } - charp = TokImage + (charp - p0); + charp =(unsigned char *) TokImage + (charp - p0); } add_ch_to_buff(ch); } while (ch == '\'' && isvar && trueGlobalPrologFlag(VARIABLE_NAMES_MAY_END_WITH_QUOTES_FLAG)) { if (charp == (unsigned char *)AuxSp - 1024) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } add_ch_to_buff(ch); ch = getchr(st); } add_ch_to_buff('\0'); - if (!isvar) { + if (!isvar || (ch == '(' && trueLocalPrologFlag(ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG) ) ) { Atom ae; /* don't do this in iso */ - ae = Yap_ULookupAtom(TokImage); - Free(TokImage); + ae = Yap_LookupAtom(TokImage); if (ae == NIL) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } t->TokInfo = MkAtomTerm(ae); if (ch == '(') @@ -1468,7 +1451,6 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, t->Tok = Ord(kind = Name_tok); } else { VarEntry *ve = Yap_LookupVar((const char *)TokImage); - Free(TokImage); t->TokInfo = Unsigned(ve); if (cur_qq) { ve->refs++; @@ -1487,13 +1469,14 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, cha = ch; cherr = 0; CHECK_SPACE(); - if ((t->TokInfo = get_num(&cha, &cherr, st, sign)) == 0L) { + if ((t->TokInfo = get_num(&cha, &cherr, st, sign,&TokImage,&imgsz)) == 0L) { if (t->TokInfo == 0) { p->Tok = eot_tok; t->TokInfo = TermError; } /* serious error now */ - return l; + pop_text_stack(lvl); + return l; } ch = cha; if (cherr) { @@ -1503,7 +1486,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, t->TokLine = GetCurInpLine(st); e = (TokEntry *)AllocScannerMemory(sizeof(TokEntry)); if (e == NULL) { - return TrailSpaceError(p, l); + pop_text_stack(lvl); + return TrailSpaceError(p, l); } else { e->TokNext = NULL; @@ -1529,7 +1513,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, t->TokLine = GetCurInpLine(st); e2 = (TokEntry *)AllocScannerMemory(sizeof(TokEntry)); if (e2 == NULL) { - return TrailSpaceError(p, l); + pop_text_stack(lvl); + return TrailSpaceError(p, l); } else { e2->TokNext = NULL; } @@ -1563,7 +1548,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, t->TokPos = GetCurInpPos(st); e2 = (TokEntry *)AllocScannerMemory(sizeof(TokEntry)); if (e2 == NULL) { - return TrailSpaceError(p, l); + pop_text_stack(lvl); + return TrailSpaceError(p, l); } else { e2->TokNext = NULL; } @@ -1583,24 +1569,24 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, case QT: case DC: quoted_string: - TokImage = Malloc(1048); - charp = TokImage; + charp =(unsigned char *) TokImage; quote = ch; len = 0; ch = getchrq(st); - size_t sz = 1024; while (TRUE) { - if (charp > TokImage + (sz - 1)) { - size_t sz = charp-TokImage; - TokImage = Realloc(TokImage, Yap_Min(sz * 2, sz + MBYTE)); + if (charp > (unsigned char *)TokImage + (imgsz - 1)) { + size_t sz = charp-(unsigned char *)TokImage; + TokImage = Realloc(TokImage, (imgsz = Yap_Min(imgsz * 2, imgsz + MBYTE))); if (TokImage == NULL) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } - charp = TokImage+sz; + charp = (unsigned char *)TokImage+sz; break; } - if (ch == 10 && trueGlobalPrologFlag(ISO_FLAG)) { + if (ch == 10 && (trueGlobalPrologFlag(ISO_FLAG) || + trueLocalPrologFlag(MULTILINE_QUOTED_TEXT_FLAG))) { /* in ISO a new line terminates a string */ LOCAL_ErrorMessage = "layout character \n inside quotes"; break; @@ -1634,22 +1620,24 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, t->TokInfo = Yap_CharsToTDQ((char *)TokImage, CurrentModule, LOCAL_encoding PASS_REGS); if (!(t->TokInfo)) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } t->Tok = Ord(kind = String_tok); } else if (quote == '`') { t->TokInfo = Yap_CharsToTBQ((char *)TokImage, CurrentModule, LOCAL_encoding PASS_REGS); if (!(t->TokInfo)) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } t->Tok = Ord(kind = String_tok); } else { - t->TokInfo = MkAtomTerm(Yap_ULookupAtom(TokImage)); + t->TokInfo = MkAtomTerm(Yap_LookupAtom(TokImage)); if (!(t->TokInfo)) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } - Free(TokImage); t->Tok = Ord(kind = Name_tok); if (ch == '(') solo_flag = false; @@ -1668,7 +1656,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, t->TokInfo = TermNewLine; } t->TokInfo = TermEof; - return l; + pop_text_stack(lvl); + return l; } else ch = getchr(st); break; @@ -1682,9 +1671,11 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, // consume... if (pch == '%') { t->TokInfo = TermNewLine; - return l; + pop_text_stack(lvl); + return l; } - return l; + pop_text_stack(lvl); + return l; } if (ch == '`') goto quoted_string; @@ -1695,7 +1686,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, t->Tok = Ord(kind = eot_tok); if (ch == '%') { t->TokInfo = TermNewLine; - return l; + pop_text_stack(lvl); + return l; } if (chtype(ch) == EF) { mark_eof(st); @@ -1703,7 +1695,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, } else { t->TokInfo = TermNewLine; } - return l; + pop_text_stack(lvl); + return l; } } if (och == '/' && ch == '*') { @@ -1752,7 +1745,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, t->Tok = Ord(kind = eot_tok); if (ch == '%') { t->TokInfo = TermNewLine; - return l; + pop_text_stack(lvl); + return l; } if (chtype(ch) == EF) { mark_eof(st); @@ -1760,32 +1754,36 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, } else { t->TokInfo = TermNl; } - return l; + pop_text_stack(lvl); + return l; } else { Atom ae; - sz = 1024; - TokImage = Malloc(sz); - charp = TokImage; + charp = (unsigned char *)TokImage; add_ch_to_buff(och); for (; chtype(ch) == SY; ch = getchr(st)) { - if (charp >= TokImage + (sz - 10)) { - sz = Yap_Min(sz * 2, sz + MBYTE); - TokImage = Realloc(TokImage, sz); - if (!TokImage) - return CodeSpaceError(t, p, l); + if (charp >= (unsigned char *)TokImage + (imgsz - 10)) { + size_t sz = charp - (unsigned char *)TokImage; + imgsz = Yap_Min(imgsz * 2, imgsz + MBYTE); + TokImage = Realloc(TokImage, imgsz); + if (!TokImage) { + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); + } + charp = (unsigned char *)TokImage+sz; } add_ch_to_buff(ch); } add_ch_to_buff('\0'); - ae = Yap_ULookupAtom(TokImage); + ae = Yap_LookupAtom(TokImage); if (ae == NIL) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } t->TokInfo = MkAtomTerm(ae); if (t->TokInfo == (CELL)NIL) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } - Free(TokImage); t->Tok = Ord(kind = Name_tok); if (ch == '(') solo_flag = false; @@ -1809,8 +1807,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, och = ch; ch = getchr(st); { - unsigned char chs[10]; - TokImage = charp = chs; + unsigned char *chs; + charp = chs = (unsigned char *)TokImage; add_ch_to_buff(och); charp[0] = '\0'; t->TokInfo = MkAtomTerm(Yap_ULookupAtom(chs)); @@ -1847,15 +1845,16 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, LOCAL_ErrorMessage = "not enough heap space to read in quasi quote"; t->Tok = Ord(kind = eot_tok); t->TokInfo = TermOutOfHeapError; - return l; + pop_text_stack(lvl); + return l; } if (cur_qq) { LOCAL_ErrorMessage = "quasi quote in quasi quote"; Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage); t->Tok = Ord(kind = eot_tok); t->TokInfo = TermOutOfHeapError; - Free(qq); - return l; + pop_text_stack(lvl); + return l; } else { cur_qq = qq; } @@ -1892,7 +1891,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, cur_qq = NULL; t->Tok = Ord(kind = eot_tok); t->TokInfo = TermError; - return l; + pop_text_stack(lvl); + return l; } cur_qq = NULL; t->TokInfo = (CELL)qq; @@ -1906,16 +1906,7 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, qq->mid.charno = st->charcount - 1; t->Tok = Ord(kind = QuasiQuotes_tok); ch = getchr(st); - sz = 1024; - TokImage = Malloc(sz); - if (!TokImage) { - LOCAL_ErrorMessage = - "not enough heap space to read in a quasi quoted atom"; - t->Tok = Ord(kind = eot_tok); - t->TokInfo = TermError; - return l; - } - charp = TokImage; + charp = (unsigned char *)TokImage; quote = ch; len = 0; ch = getchrq(st); @@ -1931,7 +1922,6 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, break; } } else if (chtype(ch) == EF) { - Free(TokImage); mark_eof(st); t->Tok = Ord(kind = eot_tok); t->TokInfo = TermOutOfHeapError; @@ -1940,24 +1930,18 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, charp += put_utf8(charp, ch); ch = getchrq(st); } - if (charp > (unsigned char *)AuxSp - 1024) { - /* Not enough space to read in the string. */ - return AuxSpaceError( - t, l, "not enough space to read in string or quoted atom"); - } } len = charp - (unsigned char *)TokImage; - mp = Malloc(len + 1); + mp = malloc(len + 1); if (mp == NULL) { LOCAL_ErrorMessage = "not enough heap space to read in quasi quote"; - Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage); t->Tok = Ord(kind = eot_tok); t->TokInfo = TermOutOfHeapError; - return l; + pop_text_stack(lvl); + return l; } strncpy((char *)mp, (const char *)TokImage, len + 1); qq->text = (unsigned char *)mp; - Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage); if (st->status & Seekable_Stream_f) { qq->end.byteno = fseek(st->file, 0, 0); } else { @@ -1967,7 +1951,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, qq->end.linepos = st->linepos - 1; qq->end.charno = st->charcount - 1; if (!(t->TokInfo)) { - return CodeSpaceError(t, p, l); + pop_text_stack(lvl); + return CodeSpaceError(t, p, l); } Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage); solo_flag = FALSE; @@ -1980,7 +1965,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, mark_eof(st); t->Tok = Ord(kind = eot_tok); t->TokInfo = TermEof; - return l; + pop_text_stack(lvl); + return l; default: { kind = Error_tok; @@ -1995,7 +1981,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, /* insert an error token to inform the system of what happened */ TokEntry *e = (TokEntry *)AllocScannerMemory(sizeof(TokEntry)); if (e == NULL) { - return TrailSpaceError(p, l); + pop_text_stack(lvl); + return TrailSpaceError(p, l); } p->TokNext = e; e->Tok = Error_tok; @@ -2007,6 +1994,7 @@ TokEntry *Yap_tokenizer(struct stream_desc *st, bool store_comments, p = e; } } while (kind != eot_tok); + pop_text_stack(lvl); return (l); } diff --git a/C/sort.c b/C/sort.c index bb6e60296..8381306dd 100644 --- a/C/sort.c +++ b/C/sort.c @@ -59,7 +59,7 @@ build_new_list(CELL *pt, Term t USES_REGS) pt += 2; if (pt > ASP - 4096) { if (!Yap_gcl((ASP-HR)*sizeof(CELL), 2, ENV, gc_P(P,CP))) { - Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage); + Yap_ThrowError(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage); return(FALSE); } t = Deref(ARG1); diff --git a/C/stack.c b/C/stack.c index 62e411d85..ef8bdc5c0 100644 --- a/C/stack.c +++ b/C/stack.c @@ -304,6 +304,8 @@ bool Yap_search_for_static_predicate_in_use(PredEntry *p, return true; } env_ptr = b_ptr->cp_env; + if (b_ptr->cp_ap == NOCODE) + return false; b_ptr = b_ptr->cp_b; } while (b_ptr != NULL); return (FALSE); diff --git a/C/stdpreds.c b/C/stdpreds.c index e14d54e9d..9e87d82a7 100755 --- a/C/stdpreds.c +++ b/C/stdpreds.c @@ -1579,6 +1579,7 @@ void Yap_InitCPreds(void) { Yap_InitGlobals(); Yap_InitInlines(); Yap_InitIOPreds(); + Yap_InitDBLoadPreds(); Yap_InitExoPreds(); Yap_InitLoadForeign(); Yap_InitModulesC(); diff --git a/C/terms.c b/C/terms.c index 4927b0df0..05834c382 100644 --- a/C/terms.c +++ b/C/terms.c @@ -82,25 +82,20 @@ typedef struct non_single_struct_t { #define WALK_COMPLEX_TERM__(LIST0, STRUCT0, PRIMI0) \ \ - int lvl = push_text_stack();\ - CELL *pt0, *pt0_end; \ - size_t auxsz = 1024 * sizeof(struct non_single_struct_t);\ - struct non_single_struct_t *to_visit0=NULL, *to_visit,* to_visit_max;\ - CELL *InitialH = HR;\ - tr_fr_ptr TR0 = TR;\ - if (TR > (tr_fr_ptr)LOCAL_TrailTop - 256) { \ + reset:\ + lvl = push_text_stack();\ + to_visit0 = Malloc(auxsz); \ +pt0 = pt0_; pt0_end = pt0_end_; \ +to_visit = to_visit0, \ + to_visit_max = to_visit + auxsz/sizeof(struct non_single_struct_t);\ + \ + if (TR > (tr_fr_ptr)LOCAL_TrailTop - 256) { \ /* Trail overflow */\ goto trail_overflow;\ }\ if (HR + 1024 > ASP) { \ goto global_overflow;\ }\ - reset:\ - to_visit0 = Realloc(to_visit0,auxsz); \ -pt0 = pt0_; pt0_end = pt0_end_; \ -to_visit = to_visit0, \ - to_visit_max = to_visit + auxsz/sizeof(struct non_single_struct_t);\ - \ while (to_visit >= to_visit0) { \ CELL d0; \ CELL *ptd0; \ @@ -193,7 +188,8 @@ aux_overflow : { \ } \ clean_tr(TR0 PASS_REGS); \ auxsz += auxsz;\ - goto reset; } + pop_text_stack(lvl); \ + goto reset; } #define def_trail_overflow() \ trail_overflow: { \ @@ -221,6 +217,7 @@ global_overflow : { \ *ptd0 = to_visit->d0; \ } \ clean_tr(TR0 PASS_REGS); \ + pop_text_stack(lvl); \ HR = InitialH; \ LOCAL_Error_TYPE = RESOURCE_ERROR_STACK; \ size_t expand = 0L; \ @@ -228,7 +225,7 @@ global_overflow : { \ Yap_ThrowError(RESOURCE_ERROR_STACK, TermNil, sizeof(CELL)*(HR-H0)); \ return false;\ }\ - goto reset;\ + goto reset;\ } #define CYC_LIST \ @@ -244,9 +241,9 @@ if (IS_VISIT_MARKER) { \ #define def_overflow() \ def_aux_overflow(); \ def_global_overflow(); \ - def_trail_overflow() + def_trail_overflow() + - #define CYC_APPL \ if (IS_VISIT_MARKER) { \ while (to_visit > to_visit0) { \ @@ -261,6 +258,13 @@ if (IS_VISIT_MARKER) { \ @brief routine to locate all variables in a term, and its applications */ static Term cyclic_complex_term(CELL *pt0_, CELL *pt0_end_ USES_REGS) { + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; + WALK_COMPLEX_TERM__(CYC_LIST, CYC_APPL, {}); /* leave an empty slot to fill in later */ END_WALK(); @@ -308,21 +312,22 @@ static Term BREAK_LOOP(CELL d0,struct non_single_struct_t *to_visit ) { static int cycles_in_complex_term( CELL *pt0_, CELL *pt0_end_ USES_REGS) { CELL *pt0, *pt0_end; - int lvl = push_text_stack(); size_t auxsz = 1024 * sizeof(struct non_single_struct_t); - struct non_single_struct_t *to_visit0=NULL, *to_visit, *to_visit_max; + struct non_single_struct_t *to_visit0, *to_visit, *to_visit_max; + int lvl; + + reset: + lvl = push_text_stack(); + pt0 = pt0_, pt0_end = pt0_end_; + to_visit0 = Malloc(auxsz); + to_visit= to_visit0; + to_visit_max = to_visit0 + auxsz/sizeof(struct non_single_struct_t); CELL *InitialH = HR; tr_fr_ptr TR0 = TR; if (TR > (tr_fr_ptr)LOCAL_TrailTop - 256) { \ /* Trail overflow */\ goto trail_overflow;\ }\ - - reset: - pt0 = pt0_, pt0_end = pt0_end_; - to_visit0 = Realloc(to_visit0,auxsz); - to_visit= to_visit0; - to_visit_max = to_visit0 + auxsz/sizeof(struct non_single_struct_t); auxsz *= 2; int rc = 0; CELL *ptf; @@ -428,7 +433,7 @@ return rc; def_overflow(); - + } Term Yap_CyclesInTerm(Term t USES_REGS) { @@ -467,6 +472,12 @@ static Int cycles_in_term(USES_REGS1) /* cyclic_term(+T) */ @brief routine to locate all variables in a term, and its applications */ static bool ground_complex_term(CELL * pt0_, CELL * pt0_end_ USES_REGS) { + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; WALK_COMPLEX_TERM(); /* leave an empty slot to fill in later */ @@ -515,6 +526,12 @@ static Int ground(USES_REGS1) /* ground(+T) */ static Int var_in_complex_term(CELL *pt0_, CELL *pt0_end_ , Term v USES_REGS) { + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; WALK_COMPLEX_TERM(); @@ -594,9 +611,16 @@ static Term vars_in_complex_term(CELL *pt0_, CELL *pt0_end_ , } inp = TailOfTerm(inp); } - + CELL output = AbsPair(HR); - WALK_COMPLEX_TERM(); + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; + + WALK_COMPLEX_TERM(); /* do or pt2 are unbound */ if (HR + 1024 > ASP) { @@ -756,6 +780,12 @@ typedef struct att_rec { static Term attvars_in_complex_term( CELL *pt0_, CELL *pt0_end_ , Term inp USES_REGS) { + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; CELL output = inp; WALK_COMPLEX_TERM(); if (IsAttVar(ptd0)) { @@ -821,27 +851,37 @@ static Int term_attvars(USES_REGS1) /* variables in term t */ */ static Term new_vars_in_complex_term( CELL *pt0_, CELL *pt0_end_ , Term inp USES_REGS) { + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; Int n=0; CELL output = TermNil; - { - int lvl = push_text_stack(); + Term inp0 = inp; + while (!IsVarTerm(inp) && IsPairTerm(inp)) { Term t = HeadOfTerm(inp); if (IsVarTerm(t)) { n++; - TrailTerm(TR++) = t; - *VarOfTerm(t) = TermFoundVar; - if ((tr_fr_ptr)LOCAL_TrailTop - TR < 1024) { - - if (!Yap_growtrail(n * sizeof(tr_fr_ptr *), true)) { - goto trail_overflow; - } - } - } - inp = TailOfTerm(inp); - } - pop_text_stack(lvl); - } + TrailTerm(TR++) = t; + TrailTerm(TR++) = t; + *VarOfTerm(t) = TermFoundVar; + if ((tr_fr_ptr)LOCAL_TrailTop - TR < 1024) { + size_t expand = (tr_fr_ptr)LOCAL_TrailTop - TR; + clean_tr(TR0 PASS_REGS); + *HR++ = inp0; + /* Trail overflow */ + if (!Yap_growtrail(expand, false)) { + Yap_ThrowError(RESOURCE_ERROR_TRAIL, TermNil, expand); + } + inp = *--HR; + continue; + } + inp = TailOfTerm(inp); + } + } WALK_COMPLEX_TERM(); output = MkPairTerm((CELL)ptd0, output); TrailTerm(TR++) = *ptd0; @@ -855,7 +895,7 @@ if (HR + 1024 > ASP) { } END_WALK(); -clean_tr(TR0-n PASS_REGS); +clean_tr(TR0 PASS_REGS); pop_text_stack(lvl); return output; @@ -904,7 +944,13 @@ static Term vars_within_complex_term( CELL *pt0_, CELL *pt0_end_, Term inp USES_REGS) { Int n=0; CELL output = AbsPair(HR); - + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; + while (!IsVarTerm(inp) && IsPairTerm(inp)) { Term t = HeadOfTerm(inp); if (IsVarTerm(t)) { @@ -923,7 +969,7 @@ static Term vars_within_complex_term( goto restart; END_WALK(); - clean_tr(TR0-n PASS_REGS); + clean_tr(TR0 PASS_REGS); pop_text_stack(lvl); if (HR != InitialH) { HR[-1] = TermNil; @@ -991,7 +1037,7 @@ static Int free_variables_in_term( else { out = new_vars_in_complex_term(&(t)-1, &(t), Yap_TermVariables(bounds, 3) PASS_REGS); } - + if (found_module && t != t0) { Term ts[2]; ts[0] = found_module; @@ -1012,6 +1058,12 @@ return Yap_unify(ARG2, t) && Yap_unify(ARG3, out); static Term non_singletons_in_complex_term(CELL * pt0_, CELL * pt0_end_ USES_REGS) { + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; WALK_COMPLEX_TERM__({}, {}, FOUND_VAR_AGAIN()); /* do or pt2 are unbound */ @@ -1080,6 +1132,12 @@ if (singles) { \ static Int numbervars_in_complex_term(CELL * pt0_, CELL * pt0_end_, Int numbv, int singles USES_REGS) { + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; WALK_COMPLEX_TERM__({}, {}, {}); @@ -1162,6 +1220,12 @@ if (FunctorOfTerm(d0) == FunctorDollarVar) { \ static int max_numbered_var(CELL * pt0_, CELL * pt0_end_, Int * maxp USES_REGS) { + CELL *pt0, *pt0_end; + int lvl; + size_t auxsz = 1024 * sizeof(struct non_single_struct_t); + struct non_single_struct_t *to_visit0, *to_visit,* to_visit_max; + CELL *InitialH = HR; + tr_fr_ptr TR0 = TR; WALK_COMPLEX_TERM__({}, MAX_NUMBERED, {}); END_WALK(); @@ -1302,7 +1366,7 @@ Int cp_link(Term t, Int i, Int j, cl_connector * q, Int max, CELL * tailp) { if (IsVarTerm(ref)) { q[i].copy[j] = ref; // fprintf(stderr," - %p\n", ref); - } + } else { Term v = UNFOLD_LOOP(ref, tailp); q[i].copy[j] = v; diff --git a/C/text.c b/C/text.c index f7effd524..737ae5a88 100644 --- a/C/text.c +++ b/C/text.c @@ -195,7 +195,8 @@ void *Realloc(void *pt, size_t sz USES_REGS) { if (!pt) return Malloc(sz PASS_REGS); old--; - sz = ALIGN_BY_TYPE(sz + sizeof(struct mblock), Yap_Max(CELLSIZE,sizeof(struct mblock))); + sz = ALIGN_BY_TYPE(sz, Yap_Max(CELLSIZE,sizeof(struct mblock))); + sz += 2*sizeof(struct mblock); o = realloc(old, sz); if (o->next) { o->next->prev = o; diff --git a/C/utilpreds.c b/C/utilpreds.c index 2247f9344..1c6b52e15 100644 --- a/C/utilpreds.c +++ b/C/utilpreds.c @@ -52,14 +52,13 @@ typedef struct non_single_struct_t { } #define def_aux_overflow() \ - aux_overflow:{ \ + while (to_visit_max-to_visit0 < 32) { \ size_t d1 = to_visit-to_visit0; \ - size_t d2 = to_visit_max-to_visit0; \ - to_visit0 = Realloc(to_visit0,(d2+128)*sizeof(struct non_single_struct_t)); \ + size_t d2 = to_visit_max-to_visit0; \ + size_t d3 = Yap_Min(d2+1024, d2 *2); \ + to_visit0 = Realloc(to_visit0,d3*sizeof(struct non_single_struct_t)); \ to_visit = to_visit0+d1; \ - to_visit_max = to_visit0+(d2+128); \ - pt0--; \ - goto restart; \ + to_visit_max = to_visit0+(d3); \ } #define def_global_overflow() \ @@ -152,7 +151,8 @@ clean_complex_tr(tr_fr_ptr TR0 USES_REGS) { #define expand_stack(S0,SP,SF,TYPE) \ { size_t sz = SF-S0, used = SP-S0; \ - S0 = Realloc(S0, (1024+sz)*sizeof(TYPE) PASS_REGS); \ + sz += 1024;\ + S0 = Realloc(S0, sz*sizeof(TYPE) PASS_REGS); \ SP = S0+used; SF = S0+sz; } #define MIN_ARENA_SIZE (1048L) @@ -207,6 +207,8 @@ int Yap_copy_complex_term(register CELL *pt0, register CELL *pt0_end, to_visit++; // move to new list d0 = *headp; + if ((ADDR)TR > LOCAL_TrailTop - MIN_ARENA_SIZE) + goto trail_overflow; TrailedMaBind(headp, AbsPair(HR)); pt0 = headp; pt0_end = headp + 1; @@ -306,6 +308,8 @@ int Yap_copy_complex_term(register CELL *pt0, register CELL *pt0_end, if (++to_visit >= to_visit_max-32) { expand_stack(to_visit0, to_visit, to_visit_max, struct cp_frame); } + if ((ADDR)TR > LOCAL_TrailTop - MIN_ARENA_SIZE) + goto trail_overflow; TrailedMaBind(headp,AbsAppl(HR)); ptf = HR; *ptf++ = (CELL)f; @@ -345,18 +349,14 @@ int Yap_copy_complex_term(register CELL *pt0, register CELL *pt0_end, } to_visit = bp; new = *ptf; - if (TR > (tr_fr_ptr)LOCAL_TrailTop - 256) { - /* Trail overflow */ - if (!Yap_growtrail((TR - TR0) * sizeof(tr_fr_ptr *), TRUE)) { - goto trail_overflow; - } - } + if ((ADDR)TR > LOCAL_TrailTop - MIN_ARENA_SIZE) + goto trail_overflow; TrailedMaBind(ptd0, new); ptf++; } else { /* first time we met this term */ RESET_VARIABLE(ptf); - if ((ADDR)TR > LOCAL_TrailTop - MIN_ARENA_SIZE) + if ((ADDR)TR > LOCAL_TrailTop - MIN_ARENA_SIZE) goto trail_overflow; TrailedMaBind(ptd0, (CELL)ptf); ptf++; diff --git a/CXX/yapi.cpp b/CXX/yapi.cpp index 7258e1c3b..4783eca7a 100644 --- a/CXX/yapi.cpp +++ b/CXX/yapi.cpp @@ -252,11 +252,10 @@ YAPStringTerm::YAPStringTerm(wchar_t *s, size_t len) YAPApplTerm::YAPApplTerm(YAPFunctor f, YAPTerm ts[]) { BACKUP_H(); arity_t arity = ArityOfFunctor(f.f); - Term o = AbsAppl(HR); - *HR++ = (CELL)f.f; + Term o = Yap_MkNewApplTerm(f.f, arity); Term *tt = RepAppl(o) + 1; for (arity_t i = 0; i < arity; i++) - *HR++ = ts[i].term(); + tt[i] = ts[i].term(); mk(o); RECOVER_H(); } @@ -587,18 +586,18 @@ bool YAPEngine::call(YAPPredicate ap, YAPTerm ts[]) { q.p = P; q.cp = CP; + q.b0 = LCL0-CellPtr(B); + q.env0 = LCL0-ENV; for (arity_t i = 0; i < arity; i++) XREGS[i + 1] = ts[i].term(); // allow Prolog style exceotion handling // don't forget, on success these bindings will still be there); - result = YAP_LeaveGoal(true, &q); + result = YAP_EnterGoal(ap.ap, nullptr, &q); + YAP_LeaveGoal(result, &q); YAPCatchError(); - Yap_CloseHandles(q.CurSlot); - pop_text_stack(q.lvl + 1); - RECOVER_MACHINE_REGS(); return result; } @@ -612,10 +611,54 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) { // _save = PyEval_SaveThread(); #endif CACHE_REGS + YAP_dogoalinfo q; BACKUP_MACHINE_REGS(); +<<<<<<< HEAD bool rc = YAP_RunGoalOnce(t); RECOVER_MACHINE_REGS(); return rc; +======= + Term *ts = nullptr; + q.CurSlot = Yap_StartSlots(); + q.p = P; + q.cp = CP; + Int oenv = LCL0-ENV; + Int oB = LCL0-CellPtr(B); + Term omod = CurrentModule; + PredEntry *ap = nullptr; + if (IsStringTerm(tmod)) + tmod = MkAtomTerm(Yap_LookupAtom(StringOfTerm(tmod))); + ap = Yap_get_pred(t, tmod, "C++"); + if (ap == nullptr || + ap->OpcodeOfPred == UNDEF_OPCODE) { + ap = rewriteUndefEngineQuery(ap, t, tmod); + } + if (IsApplTerm(t)) + ts = RepAppl(t) + 1; + else if (IsPairTerm(t)) + ts = RepPair(t); + /* legal ap */ + arity_t arity = ap->ArityOfPE; + + for (arity_t i = 0; i < arity; i++) { + XREGS[i + 1] = ts[i]; + } + ts = nullptr; + bool result; + // allow Prolog style exception handling + // don't forget, on success these guys may create slots + //__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec "); + + result = (bool)YAP_EnterGoal(ap, nullptr, &q); + // std::cerr << "mgoal " << YAPTerm(tmod).text() << ":" << YAPTerm(t).text() << "\n + YAP_LeaveGoal(result && !release, &q); + ENV = LCL0-oenv; + B = (choiceptr)(LCL0-oB); + CurrentModule = LOCAL_SourceModule = omod; + // PyEval_RestoreThread(_save); + RECOVER_MACHINE_REGS(); + return result; +>>>>>>> ef3d435dec2b9606993430da2f66e06d38f3a399 } /** * called when a query must be terminated and its state fully recovered, @@ -624,21 +667,31 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) { void YAPEngine::release() { BACKUP_MACHINE_REGS(); - YAP_LeaveGoal(FALSE, &q); + // YAP_LeaveGoal(FALSE, &q); RECOVER_MACHINE_REGS(); } Term YAPEngine::fun(Term t) { CACHE_REGS BACKUP_MACHINE_REGS(); + YAP_dogoalinfo q; Term tmod = Yap_CurrentModule(), *ts = nullptr; PredEntry *ap; arity_t arity; Functor f; Atom name; +<<<<<<< HEAD YAP_dogoalinfo backup = q; CELL *spt; +======= + q.CurSlot = Yap_StartSlots(); + q.p = P; + q.cp = CP; + + Int oenv = LCL0-ENV; + Int oB = LCL0-CellPtr(B); +>>>>>>> ef3d435dec2b9606993430da2f66e06d38f3a399 if (IsApplTerm(t)) { ts = RepAppl(t) + 1; f = (Functor)ts[-1]; @@ -661,6 +714,7 @@ Term YAPEngine::fun(Term t) { throw YAPError(SOURCE(), TYPE_ERROR_CALLABLE, t, 0); return 0L; } +<<<<<<< HEAD HR += arity+1; RESET_VARIABLE(HR-1); yhandle yt = Yap_InitHandle(t); @@ -671,6 +725,36 @@ Term YAPEngine::fun(Term t) { else ot = TermNone; RECOVER_MACHINE_REGS(); +======= + Term ot = XREGS[arity + 1] = MkVarTerm(); + yhandle_t h = Yap_InitHandle(ot); + arity++; + HR += arity; + f = Yap_MkFunctor(name, arity); + ap = (PredEntry *)(PredPropByFunc(f, tmod)); + if (ap == nullptr || ap->OpcodeOfPred == UNDEF_OPCODE) { + Term g = (Yap_MkApplTerm(f, arity, ts)); + ap = rewriteUndefEngineQuery(ap, g, (ap->ModuleOfPred)); + } + // make sure this is safe + // allow Prolog style exception handling + //__android_log_print(ANDROID_LOG_INFO, "YAPDroid", "exec "); + + bool result = (bool)YAP_EnterGoal(ap, nullptr, &q); + if (result) + ot = Yap_GetFromHandle(h); + else + ot = TermNone; + YAPCatchError(); + { + YAP_LeaveGoal(result, &q); + ENV = LCL0-oenv; + B = (choiceptr)(LCL0-oB); + // PyEval_RestoreThread(_save); + RECOVER_MACHINE_REGS(); + return ot; + } +>>>>>>> ef3d435dec2b9606993430da2f66e06d38f3a399 } YAPQuery::YAPQuery(YAPFunctor f, YAPTerm mod, YAPTerm ts[]) @@ -755,6 +839,9 @@ bool YAPQuery::next() { CACHE_REGS bool result = false; // std::cerr << "next " << YAPTerm(goal).text() << "\n"; + q_h.CurSlot = Yap_StartSlots(); + q_h.p = P; + q_h.cp = CP; sigjmp_buf buf, *oldp = LOCAL_RestartEnv; e = nullptr; @@ -816,7 +903,7 @@ bool YAPQuery::deterministic() { BACKUP_MACHINE_REGS(); if (!q_open || q_state == 0) return false; - choiceptr myB = (choiceptr)(LCL0 - q_h.b); + choiceptr myB = (choiceptr)(LCL0 - q_h.b_entry); return (B >= myB); RECOVER_MACHINE_REGS(); } @@ -1082,13 +1169,15 @@ std::stringstream s; void YAPEngine::reSet() { /* ignore flags for now */ if (B && B->cp_b && B->cp_ap != NOCODE) - YAP_LeaveGoal(false, &q); + // YAP_LeaveGoal(false, &q); LOCAL_ActiveError->errorNo = YAP_NO_ERROR; if (LOCAL_CommittedError) { LOCAL_CommittedError->errorNo = YAP_NO_ERROR; free(LOCAL_CommittedError); LOCAL_CommittedError = NULL; } + pop_text_stack(0); + LOCAL_CurSlot = 0; } Term YAPEngine::top_level(std::string s) { diff --git a/CXX/yapq.hh b/CXX/yapq.hh index 9a13b7a38..9b1c1aafc 100644 --- a/CXX/yapq.hh +++ b/CXX/yapq.hh @@ -39,7 +39,6 @@ class X_API YAPQuery : public YAPPredicate { bool q_open; int q_state; yhandle_t q_handles; - struct yami *q_p, *q_cp; int q_flags; YAP_dogoalinfo q_h; YAPPairTerm names; @@ -54,10 +53,10 @@ class X_API YAPQuery : public YAPPredicate { q_state = 0; q_flags = true; // PL_Q_PASS_EXCEPTION; - q_p = P; - q_cp = CP; + q_h.p = P; + q_h.cp = CP; // make sure this is safe - q_handles = LOCAL_CurSlot; + q_h.CurSlot = LOCAL_CurSlot; }; void openQuery(); @@ -321,7 +320,6 @@ private: YAPCallback *_callback; YAPError yerror; void doInit(YAP_file_type_t BootMode, YAPEngineArgs *cargs); - YAP_dogoalinfo q; YAPError e; PredEntry *rewriteUndefEngineQuery(PredEntry *ap, Term &t, Term tmod); diff --git a/H/Regs.h b/H/Regs.h index e4c3ef110..7d850b650 100755 --- a/H/Regs.h +++ b/H/Regs.h @@ -681,8 +681,9 @@ CalculateStackGap( USES_REGS1 ) #define SET_ASP(Y,S) SET_ASP__(Y,S PASS_REGS) -static inline -void SET_ASP__(CELL *yreg, Int sz USES_REGS) { +INLINE_ONLY void SET_ASP__(CELL *yreg, Int sz USES_REGS); + +INLINE_ONLY void SET_ASP__(CELL *yreg, Int sz USES_REGS) { ASP = (CELL *) (((char *) yreg) + sz); if (ASP > (CELL *)PROTECT_FROZEN_B(B)) ASP = (CELL *)PROTECT_FROZEN_B(B); diff --git a/H/Yap.h b/H/Yap.h index e2764eb6f..412a394fc 100755 --- a/H/Yap.h +++ b/H/Yap.h @@ -91,7 +91,6 @@ typedef YAP_Term Term; #define CellSize sizeof(CELL) #define SmallSize sizeof(SMALLUNSGN) -typedef YAP_Int Int; typedef YAP_Float Float; typedef YAP_handle_t yhandle_t; diff --git a/H/YapGFlagInfo.h b/H/YapGFlagInfo.h index 73cc33054..631c06ca4 100644 --- a/H/YapGFlagInfo.h +++ b/H/YapGFlagInfo.h @@ -53,21 +53,6 @@ opportunity. Initial value is 10,000. May be changed. A value of 0 "allow_assert_for_static_predicates", true, booleanFlag, "true", NULL), - /**< - - boolean flag allows syntax such - as - ~~~ - Tree(Node(L,node,R)) :- - Tree(L), - Tree(R). - ~~~ - */ - YAP_FLAG(ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG, - "allow_variable_name_as_functor", false, booleanFlag, "false", - NULL), - - /**< how to present answers, default is `~p`. */ YAP_FLAG(ANSWER_FORMAT_FLAG, "answer_format", true, isatom, "~p", NULL), /**< diff --git a/H/YapLFlagInfo.h b/H/YapLFlagInfo.h index 0269c16e2..611f9a229 100644 --- a/H/YapLFlagInfo.h +++ b/H/YapLFlagInfo.h @@ -26,6 +26,13 @@ START_LOCAL_FLAGS +/**< Allow constructs such as 'Functor( V )'. Functor is parsed as an + atom. The token `V` is still understood as a variable. + +Originally a SWI-Prolog flag. + */ +YAP_FLAG(ALLOW_VARIABLE_NAME_AS_FUNCTOR_FLAG, "allow_variable_name_as_functor", true, booleanFlag, "false", NULL), + /**< set the system to look for undefined procedures */ YAP_FLAG(AUTOLOAD_FLAG, "autoload", true, booleanFlag, "false", NULL), @@ -72,6 +79,11 @@ YAP_FLAG(AUTOLOAD_FLAG, "autoload", true, booleanFlag, "false", NULL), */ YAP_FLAG(LANGUAGE_MODE_FLAG, "language_mode", true, isatom, "yap", NULL), + /**< If true, quoted atoms, string, lists of codes and of chars may extend over several lines, without the need to escape the new-line characters. Otherwise, unquoted line breaks cause a syntax error. + + The default was for it to be true, except if in iso mode. YAP-6.5 changed the default, in order to ensure compatibility. + */ + YAP_FLAG(MULTILINE_QUOTED_TEXT_FLAG, "multiline_quoted_text", false, booleanFlag, "false", NULL), /**< Show the execution stack in exceptions. */ YAP_FLAG(STACK_DUMP_ON_ERROR_FLAG, "stack_dump_on_error", false, booleanFlag, "true", NULL), diff --git a/H/YapText.h b/H/YapText.h index 822bd8bec..dbf972f9f 100644 --- a/H/YapText.h +++ b/H/YapText.h @@ -46,22 +46,31 @@ extern const void *MallocExportAsRO(const void *blk); /* Character types for tokenizer and write.c */ extern int AllocLevel(void); +#if 0 #define push_text_stack() \ - (/* fprintf(stderr, " + *** %d %s:%s:%d\n", AllocLevel(),*/ \ - /* __FILE__, __FUNCTION__, __LINE__), */ \ + ( fprintf(stderr, " + *** %d %s:%s:%d\n", AllocLevel(), \ + __FILE__, __FUNCTION__, __LINE__), \ push_text_stack__(PASS_REGS1)) -extern int push_text_stack__(USES_REGS1); -#define pop_text_stack(lvl) \ - (/* fprintf(stderr, " - *** %d %s:%s:%d\n", AllocLevel(), __FILE__,*/ \ - /* __FUNCTION__, __LINE__), */ \ - pop_text_stack__(lvl)) + #define pop_text_stack(lvl) \ + ( fprintf(stderr, " - *** %d %s:%s:%d\n", AllocLevel(), __FILE__, \ + __FUNCTION__, __LINE__), \ + pop_text_stack__(lvl PASS_REGS)) + + #define pop_output_text_stack(lvl,p) \ + (fprintf(stderr, "-- *** %d %s:%s:%d\n", AllocLevel(), __FILE__, \ + __FUNCTION__, __LINE__), \ + pop_output_text_stack__(lvl,p)) +#else +#define push_text_stack() push_text_stack__(PASS_REGS1) +#define pop_text_stack(lvl) pop_text_stack__(lvl PASS_REGS) +#define pop_output_text_stack(lvl,p) pop_output_text_stack__(lvl,p PASS_REGS) +#endif + +extern int push_text_stack__(USES_REGS1); extern int pop_text_stack__(int lvl USES_REGS); -#define pop_output_text_stack(lvl,p) \ - (/*fprintf(stderr, "-- *** %d %s:%s:%d\n", AllocLevel(), __FILE__,*/ \ - /* __FUNCTION__, __LINE__),*/ \ - pop_output_text_stack__(lvl,p)) + extern void *pop_output_text_stack__(int lvl, const void *ox USES_REGS); /****************** character definition table **************************/ diff --git a/H/Yapproto.h b/H/Yapproto.h index 2e27c7f29..44eca3def 100755 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -207,8 +207,8 @@ extern Term Yap_RunTopGoal(Term, bool); extern bool Yap_execute_goal(Term, int, Term, bool); extern bool Yap_exec_absmi(bool, yap_reset_t); extern void Yap_trust_last(void); - -extern void Yap_PrepGoal(UInt, CELL *, struct goal_info * USES_REGS); +extern void Yap_closeGoal(bool out, yamop *saved_p, yamop * saved_cp, Int saved_e, Int saved_b, yhandle_t hdl, bool pass_ex); +extern void Yap_PrepGoal(UInt, CELL *, choiceptr USES_REGS); extern bool Yap_execute_pred(struct pred_entry *ppe, CELL *pt, bool pass_exception USES_REGS); extern int Yap_dogc(int extra_args, Term *tp USES_REGS); @@ -247,7 +247,7 @@ extern Term Yap_SaveTerm(Term); extern Term Yap_SetGlobalVal(Atom, Term); extern Term Yap_GetGlobal(Atom); extern Int Yap_DeleteGlobal(Atom); -extern void Yap_AllocateDefaultArena(size_t gsize, int wid); +extern void Yap_AllocateDefaultArena(size_t gsize, int wid, void *cs); extern CELL *Yap_ArenaLimit(Term arena); /* grow.c */ diff --git a/H/absmi.h b/H/absmi.h index b05baa93a..01884cc3d 100755 --- a/H/absmi.h +++ b/H/absmi.h @@ -2322,7 +2322,7 @@ static inline void prune(choiceptr cp USES_REGS) { POP_EXECUTE(); } if (B->cp_b == NULL) - break; + return; B = B->cp_b; } if (POP_CHOICE_POINT(B->cp_b)) { @@ -2398,6 +2398,7 @@ Int (*Yap_traced_absmi)(void); extern JIT_Compiler *J; #endif + extern NativeContext *NativeArea; extern IntermediatecodeContext *IntermediatecodeArea; @@ -2421,7 +2422,7 @@ extern yamop *headoftrace; #ifdef SHADOW_S #define PROCESS_INT(F, C) \ BEGD(d0); \ - Yap_REGS.S_ = SREG; \ + Yap_REGSS_ = SREG; \ saveregs(); \ d0 = F(PASS_REGS1); \ setregs(); \ @@ -2444,8 +2445,8 @@ extern yamop *headoftrace; FAIL(); \ if (d0 == 2) \ goto C; \ - JMPNext(); \ - ENDD(d0); + JMPNext();\ + ENDD(d0); #endif #define Yap_AsmError(e, d) \ diff --git a/H/amiops.h b/H/amiops.h index 44718dae2..6c05af2db 100644 --- a/H/amiops.h +++ b/H/amiops.h @@ -577,4 +577,5 @@ static inline int do_cut(int i) { #define cut_fail() return do_cut(FALSE) + #endif diff --git a/H/clause.h b/H/clause.h index 0889798d6..06256b84c 100644 --- a/H/clause.h +++ b/H/clause.h @@ -465,6 +465,8 @@ extern yap_error_descriptor_t *Yap_bug_location(yap_error_descriptor_t *t, yamop extern yap_error_descriptor_t *Yap_pc_add_location(yap_error_descriptor_t *t, void *p, void *b_ptr, void *env); extern yap_error_descriptor_t * Yap_env_add_location(yap_error_descriptor_t *t, void *p, void *b_ptr, void *env, YAP_Int ignore_first); +void Yap_split_megaclause(PredEntry *ap); + #if LOW_PROF void Yap_InformOfRemoval(void *); void Yap_dump_code_area_for_profiler(void); diff --git a/H/heap.h b/H/heap.h deleted file mode 100644 index bbe073c2d..000000000 --- a/H/heap.h +++ /dev/null @@ -1,523 +0,0 @@ -// -// File defining fields in the Yap_heap_codes global structure -// -// these fields used to spread all over the place, because they must be used in -// 4 ways: -// - they must be defined somewhere -// - they have an #ifdef to get a shorter name -// - they must be initialised somewhere -// - they must be restorable and collectable (from the atom gc). -// -// -// The defs include 4+ components: -// Type -// name in structured -// global name -// init code and restore code (optional) -// -// -// -// MkAT\(MkAtomTerm) cvts from a predefined atom to a term -// MkPred constructs a pr%ed_entry -// MkOp gets an opcode -// void does nothing -// =VALUE inits as VALUE -// Init... sets up call to InitFunc -// Restore... sets up call to RestoreFunc - -// HM refers to standard field -// HI refers to field that does not need restore -// H_R refers to field that does not need init, but needs restore -// HSPACE refers to a field without init not recovery -// HMLOCK refers to a lock -// HRWLOCK refers to a rwlock -// HOPCODE refers to a opcode -// HOPCODE refers to a field initialized/restored with a proceeding - -/* memory management */ -HSPACE(struct malloc_state *, Yap_av) - -#if USE_DL_MALLOC -HSPACE(struct memory_hole, Yap_MemoryHoles) -HSPACE(UInt, Yap_NOfMemoryHoles) -#if defined(YAPOR) || defined(THREADS) -HMLOCK(lockvar, DLMallocLock) -#endif -#endif -#if USE_DL_MALLOC || (USE_SYSTEM_MALLOC && HAVE_MALLINFO) -#ifndef HeapUsed -#define HeapUsed Yap_givemallinfo() -#endif -HSPACE(Int, NotHeapUsed) -#else -HSPACE(Int, HeapUsed) -#endif -HSPACE(Int, HeapMax) -HSPACE(ADDR, HeapTop) -HSPACE(ADDR, HeapLim) -HSPACE(struct FREEB *, FreeBlocks) -#if defined(YAPOR) || defined(THREADS) -HMLOCK(lockvar, FreeBlocksLock) -HMLOCK(lockvar, HeapUsedLock) -HMLOCK(lockvar, HeapTopLock) -HI(int, HeapTopOwner, -1) -#endif -HI(UInt, MaxStack, 0) -HI(UInt, MaxTrail, 0) - -/* execution info */ -/* OPCODE REVERSE TABLE, needed to recover op tables */ -#if USE_THREADED_CODE -HM(op_entry, OP_RTABLE, NULL, OpRTableAdjust) -#endif - -/* popular opcodes */ -HMOPCODE(EXECUTE_CPRED_OP_CODE, _execute_cpred) -HMOPCODE(EXPAND_OP_CODE, _expand_index) -HMOPCODE(FAIL_OPCODE, _op_fail) -HMOPCODE(INDEX_OPCODE, _index_pred) -HMOPCODE(LOCKPRED_OPCODE, _lock_pred) -HMOPCODE(ORLAST_OPCODE, _or_last) -HMOPCODE(UNDEF_OPCODE, _undef_p) -HMOPCODE(RETRY_USERC_OPCODE, _retry_userc) -HMOPCODE(EXECUTE_CPRED_OPCODE, _execute_cpred) - -/* atom tables */ -HSPACE(UInt, NOfAtoms) -HSPACE(UInt, AtomHashTableSize) -HSPACE(UInt, WideAtomHashTableSize) -HSPACE(UInt, NOfWideAtoms) -HPROC(AtomHashEntry, INVISIBLECHAIN, InitInvisibleAtoms(), - RestoreInvisibleAtoms()) -HPROC(AtomHashEntry *, WideHashChain, InitWideAtoms(), RestoreWideAtoms()) -HPROC(AtomHashEntry *, HashChain, InitAtoms(), RestoreAtoms()) - -#if __INIT_C__ -/* use atom defs here */ -#include "iatoms.h" -#endif - -#ifdef EUROTRA -HATOMT(TermDollarU, AtomDollarU) -#endif - -// modules -HATOMT(USER_MODULE, AtomUser) -HATOMT(IDB_MODULE, AtomIDB) -HATOMT(ATTRIBUTES_MODULE, AtomAttributes) -HATOMT(CHARSIO_MODULE, AtomCharsio) -HATOMT(CHTYPE_MODULE, AtomChType) -HATOMT(TERMS_MODULE, AtomTerms) -HATOMT(SYSTEM_MODULE, AtomSystem) -HATOMT(READUTIL_MODULE, AtomReadutil) -HATOMT(HACKS_MODULE, AtomYapHacks) -HATOMT(ARG_MODULE, AtomArg) -HATOMT(GLOBALS_MODULE, AtomNb) -HATOMT(SWI_MODULE, AtomSwi) -HATOMT(DBLOAD_MODULE, AtomDBLoad) -HATOMT(RANGE_MODULE, AtomRange) -HATOMT(ERROR_MODULE, AtomError) - -// -// Module list -// -HM(struct mod_entry *, CurrentModules, NULL, ModEntryPtrAdjust) - -// make sure we have the modules set at this point. -// don't actually want to define a field -#if __INIT_C__ -Yap_InitModules(); -#endif - -// hidden predicates -HM(Prop, HIDDEN_PREDICATES, NULL, RestoreHiddenPredicates()) - -// make sure we have the streams set at this point. -// don't actually want to define a field -#if __INIT_C__ -Yap_InitPlIO(); -#endif - -HSPACE(union flagTerm *, GFlags) -HM(UInt, GLOBAL_flagCount, Yap_InitFlags(true), RestoreFlags(GLOBAL_flagCount)) - -/* Anderson's JIT */ -HM(yap_exec_mode, Yap_ExecutionMode, INTERPRETED, rv_void) -/* The Predicate Hash Table: fast access to predicates. */ -HPROC(struct pred_entry **, PredHash, InitPredHash(), RestorePredHash()) -#if defined(YAPOR) || defined(THREADS) -HRWLOCK(rwlock_t, PredHashRWLock) -#endif -HSPACE(UInt, PredsInHashTable) -HSPACE(UInt, PredHashTableSize) - -/* Well-Known Predicates */ -HAROP(CreepCode, AtomCreep, 1, PROLOG_MODULE) -HAROP(UndefCode, AtomUndefp, 2, PROLOG_MODULE) -HAROP(SpyCode, AtomSpy, 1, PROLOG_MODULE) -HAROP(PredFail, AtomFail, 0, PROLOG_MODULE) -HAROP(PredTrue, AtomTrue, 0, PROLOG_MODULE) -#ifdef COROUTINING -HAROP(WakeUpCode, AtomWakeUpGoal, 2, PROLOG_MODULE) -#endif -HFOP(PredGoalExpansion, FunctorGoalExpansion, USER_MODULE) -HFOP(PredMetaCall, FunctorMetaCall, PROLOG_MODULE) -HFOP(PredTraceMetaCall, FunctorTraceMetaCall, PROLOG_MODULE) -HFOP(PredDollarCatch, FunctorCatch, PROLOG_MODULE) -HFOP(PredRecordedWithKey, FunctorRecordedWithKey, PROLOG_MODULE) -HFOP(PredLogUpdClause, FunctorDoLogUpdClause, PROLOG_MODULE) -HFOP(PredLogUpdClauseErase, FunctorDoLogUpdClauseErase, PROLOG_MODULE) -HFOP(PredLogUpdClause0, FunctorDoLogUpdClause, PROLOG_MODULE) -HFOP(PredStaticClause, FunctorDoStaticClause, PROLOG_MODULE) -HFOP(PredThrow, FunctorThrow, PROLOG_MODULE) -HFOP(PredHandleThrow, FunctorHandleThrow, PROLOG_MODULE) -HFOP(PredIs, FunctorIs, PROLOG_MODULE) -HFOP(PredSafeCallCleanup, FunctorSafeCallCleanup, PROLOG_MODULE) -HFOP(PredRestoreRegs, FunctorRestoreRegs, PROLOG_MODULE) -HFOP(PredCommentHook, FunctorCommentHook, PROLOG_MODULE) -#ifdef YAPOR -HAROP(PredGetwork, AtomGetwork, 0, PROLOG_MODULE) -HFOP(PredProcedure, MkLogPred, FunctorProcedure, PROLOG_MODULE) -#endif /* YAPOR */ - -/* low-level tracer */ -#ifdef LOW_LEVEL_TRACER -HSPACE(bool, Yap_do_low_level_trace) -#if defined(YAPOR) || defined(THREADS) -HMLOCK(Yap_low_level_trace_lock) -#endif -#endif - -/* code management info */ -HI(UInt, Yap_ClauseSpace, 0) -HI(UInt, Yap_IndexSpace_Tree, 0) -HI(UInt, Yap_IndexSpace_EXT, 0) -HI(UInt, Yap_IndexSpace_SW, 0) -HI(UInt, Yap_LUClauseSpace, 0) -HI(UInt, Yap_LUIndexSpace_Tree, 0) -HI(UInt, Yap_LUIndexSpace_CP, 0) -HI(UInt, Yap_LUIndexSpace_EXT, 0) -HI(UInt, Yap_LUIndexSpace_SW, 0) - -/* static code: may be shared by many predicate or may be used for - * meta-execution */ -HYOP(5, COMMA_CODE, _op_fail) -HYOP(1, DUMMYCODE, _op_fail) -HYOP(1, FAILCODE, _op_fail) -HYOP(1, NOCODE, _Nstop) -#ifdef BEAM -HYOP(beam_retry_code, 1, BEAM_RETRY_CODE, _beam_retry_code) -#endif /* BEAM */ - -HENVYOP(2, ENV_FOR_TRUSTFAIL, _trust_fail, PredFail, TRUSTFAILCODE) -HSPACE(yamop *, TRUSTFAILCODE) - -HENVYOP(2, ENV_FOR_YESCODE, _Ystop, PredFail, YESCODE) -HSPACE(yamop *, YESCODE) - -HCPYOP(1, RTRYCODE, _retry_and_mark, PredFail) -#ifdef BEAM -HCPYOP(1, BEAM_RETRY_CODE, PredFail) -#endif -#ifdef YAPOR -HCPYOP(1, GETWORK, _getwork, PredGetwork) -HCPYOP(1, GETWORK_SEQ, _getwork_seq, PredGetworkSeq) -HCPYOP(1, GETWORK_FIRST_TIME, _getwork_first_time, PredGetworkFirstTime) -#endif /* YAPOR */ -#ifdef TABLING -HCPYOP(1, LOAD_ANSWER, _table_load_answer, PredFail) -HCPYOP(1, TRY_ANSWER, _table_try_answer, PredFail) -HCPYOP(1, ANSWER_RESOLUTION, _table_load_answer, PredFail) -HCPYOP(1, COMPLETION, _table_completion, PredFail) -#ifdef THREADS_CONSUMER_SHARING -HCPYOP(1, ANSWER_RESOLUTION_COMPLETION, _table_answer_resolution_completion, - PredFail) -#endif /* THREADS_CONSUMER_SHARING */ -#endif /* TABLING */ - -/* */ -/* PREG just before we enter $spy. We use that to find out the clause which - */ -/* was calling the debugged goal. */ -/* */ -HM(struct yami *, P_before_spy, NULL, PtoOpAdjust(P_before_spy)) - -/* support recorded_k */ -HM(struct yami *, RETRY_C_RECORDEDP_CODE, NULL, - PtoOpAdjust(RETRY_C_RECORDEDP_CODE)) - -HM(struct yami *, RETRY_C_RECORDED_K_CODE, NULL, - PtoOpAdjust(RETRY_C_RECORDED__CODE)) - -/* compiler flags */ -HI(bool, PROFILING, false) -HI(bool, CALL_COUNTING, false) -HI(bool, optimizer_on, true) -HI(bool, compile_mode, false) -HI(bool, profiling, false) -HI(bool, call_counting, false) -/********* whether we should try to compile array references ******************/ -HI(bool, compile_arrays, false) - -/* DBTerms: pre-compiled ground terms */ -#if defined(YAPOR) || defined(THREADS) -HMLOCK(lockvar, DBTermsListLock) -#endif -HM(struct dbterm_list *, DBTermsList, NULL, RestoreDBTermsList()) - -/* JITI support */ -HI(yamop, ExpandClausesFirst, NULL) -HM(yamop, ExpandClausesLast, NULL, RestoreExpandList()) -HI(UInt, Yap_ExpandClauses, 0) -#if defined(YAPOR) || defined(THREADS) -HMLOCK(lockvar, ExpandClausesListLock) -HMLOCK(lockvar, OpListLock) -#endif -/* instrumentation */ -#ifdef DEBUG -HI(UInt, Yap_NewCps, 0L) -HI(UInt, Yap_LiveCps, 0L) -HI(UInt, Yap_DirtyCps, 0L) -HI(UInt, Yap_FreedCps, 0L) -#endif -HI(UInt, Yap_expand_clauses_sz, 0L) - -/* UDI support */ -H_R(struct udi_info *, UdiControlBlocks, RestoreUdiControlBlocks()) - -/* data-base statistics */ -/* system boots in compile mode */ -HI(Int, STATIC_PREDICATES_MARKED, false) - -/* Internal Database */ -HM(Prop, INT_KEYS, NULL, RestoreIntKeys()) -HM(Prop, INT_LU_KEYS, NULL, RestoreIntLUKeys()) -HM(Prop, INT_BB_KEYS, NULL, RestoreIntBBKeys()) - -/* Internal Database Statistics */ -HI(UInt, INT_KEYS_SIZE, INT_KEYS_DEFAULT_SIZE) -HI(UInt, INT_KEYS_TIMESTAMP, 0L) -HI(UInt, INT_BB_KEYS_SIZE, INT_KEYS_DEFAULT_SIZE) - -/* Internal Data-Base Control */ -HI(int, UPDATE_MODE, UPDATE_MODE_LOGICAL) - -/* nasty IDB stuff */ -HPROC(struct DB_STRUCT *, DBErasedMarker, InitDBErasedMarker(), - RestoreDBErasedMarker()) -HPROC(struct logic_upd_clause *, LogDBErasedMarker, InitLogDBErasedMarker(), - RestoreLogDBErasedMarker()) - -/* Dead clauses and IDB entries */ -H_R(struct static_clause *, DeadStaticClauses, RestoreDeadStaticClauses()) -H_R(struct static_mega_clause *, DeadMegaClauses, RestoreDeadMegaClauses()) -H_R(struct static_index *, DeadStaticIndices, RestoreDeadStaticIndices()) -H_R(struct logic_upd_clause *, DBErasedList, RestoreDBErasedList()) -H_R(struct logic_upd_index *, DBErasedIList, RestoreDBErasedIList()) -#if defined(YAPOR) || defined(THREADS) -HMLOCK(lockvar, DeadStaticClausesLock) -HMLOCK(lockvar, DeadMegaClausesLock) -HMLOCK(lockvar, DeadStaticIndicesLock) -#endif - -#ifdef COROUTINING -/* number of attribute modules */ -HI(int, NUM_OF_ATTS, 1) -/* initialised by memory allocator */ -HI(UInt, Yap_AttsSize, 0) -#endif - -/* Operators */ -HM(struct operator_entry *, OpList, NULL, OpListAdjust) - -/* foreign code loaded */ -HM(struct ForeignLoadItem *, ForeignCodeLoaded, NULL, RestoreForeignCode()) -HI(ADDR, ForeignCodeBase, NULL) -HI(ADDR, ForeignCodeTop, NULL) -HI(ADDR, ForeignCodeMax, NULL) - -/* recorded terms */ -HM(struct record_list *, Yap_Records, NULL, RestoreYapRecords()) - -/* SWI atoms and functors */ -HPROC(struct atom_entry *, SWI_Atoms, InitSWIAtoms(), RestoreSWIAtoms()) -HSPACE(struct functor_entry *, SWI_Functors) - -HSPACEN(struct swi_reverse_hash, N_SWI_HASH, SWI_ReverseHash) - -/* integer access to atoms */ -HSPACE(Int, AtomTranslations) -HSPACE(Int, MaxAtomTranslations) - -// initialization: tell whether the system has been initialised and by whom. -HI(int, Initialised, false) -HI(int, InitialisedFromPL, false) -HI(int, PL_Argc, 0) -HI(char **, PL_Argv, NULL) -HI(bool, FAST_BOOT_FLAG, false) - -// halt hooks -HI(struct halt_hook *, HaltHooks, NULL) -HI(fptr_t, JIT_finalizer, NULL) - -// stack overflow expansion/gc control -HI(int, AllowLocalExpansion, true) -HI(int, AllowGlobalExpansion, true) -HI(int, AllowTrailExpansion, true) -HI(UInt, SizeOfOverflow, 0) - -// amount of space recovered in all garbage collections -HI(UInt, AGcThreshold, 10000) -HI(Agc_hook, AGCHook, NULL) - -/* integer access to functors */ -HSPACE(Int, FunctorTranslations) -HSPACE(Int, MaxFunctorTranslations) - -HPROCN(Atom, MAX_EMPTY_WAKEUPS, EmptyWakeups, InitEmptyWakeups(), - RestoreEmptyWakeups()) -HSPACE(int, MaxEmptyWakeups) - -/* SWI blobs */ -HM(struct YAP_blob_t *, BlobTypes, NULL, RestoreBlobTypes()) -HM(struct AtomEntryStruct *, Blobs, NULL, RestoreBlobs()) -HI(UInt, NOfBlobs, 0) - -HI(UInt, NOfBlobsMax, 256) -#if defined(YAPOR) || defined(THREADS) -HMLOCK(lockvar blobs_lock, Blobs_Lock) -#endif - -#if __ANDROID__ -// no need to perform initialization, it is done before we start the Prolog -// engine. -HI(struct AAssetManager *, assetManager, NULL) -HI(char *, AssetsWD, NULL) -#endif - -/* multi-thread support */ -#if THREADS -/* number of threads and processes in system */ -HI(UInt, NOfThreads, 1) -/* number of threads created since start */ -HI(UInt, NOfThreadsCreated, 1) -/* total run time for dead threads */ -HI(UInt, ThreadsTotalTime, 0L) -// Threads Array -HI(lockvar, ThreadHandlesLock, MkLock) -#endif - -#if defined(YAPOR) || defined(THREADS) -// protect long critical regions -HI(lockvar, BGL, MkLock) -#endif - -#if defined(YAPOR) || defined(TABLING) -HSPACE(struct global_optyap_data, optyap_data) -#endif /* YAPOR || TABLING */ - -// whether Yap is responsible for signal handling - -HSPACE(int, PrologShouldHandleInterrupts) - -/* This is the guy who actually started the system, and who has the correct - * registers */ -#if defined(THREADS) -HSPACE(pthread_t, master_thread) -HI(struct thread_mbox *, named_mboxes, NULL) -HI(lockvar, mboxq_lock, MkLock) -HI(UInt, mbox_count, 0) -HSPACE(struct swi_mutex *, WithMutex) -#endif /* THREADS */ - -// streams -HSPACE(struct stream_desc *, Stream) -#if defined(THREADS) || defined(YAPOR) -HI(lockvar, StreamDescLock MkLock) -#endif - -// access to yap initial arguments -HSPACE(char **, argv) -HSPACE(int, argc) - -// extensions to Terms -#ifdef COROUTINING -/* array with the ops for your favourite extensions */ -HSPACEN(ext_op, attvars_ext + 1, attas) -#endif - -// agc.c -HSPACE(int, agc_calls) -HSPACE(YAP_ULONG_LONG, agc_collected) -/* total time spent in GC */ -HI(Int, tot_agc_time, 0) -/* number of heap objects in all garbage collections */ -HI(Int, tot_agc_recovered, 0) - -// arrays.c -#if HAVE_MMAP -HI(struct MMAP_ARRAY_BLOCK *, mmap_arrays, NULL) -#endif - -#ifdef DEBUG -// computils.c -HSPACEN(char, 20, Option) -HSPACE(YP_FILE *, logfile) -// init.c -// int , output_msg , false -#endif - -#if defined(COFF) || defined(A_OUT) -// loada_coff.c && load_aout.c -HSPACEN(char, Executable, YAP_FILENAME_MAX) -#endif - -HI(int, OpaqueHandlersCount, 0) -HI(struct opaque_handler_struct *, OpaqueHandlers, NULL) - -#if __simplescalar__ -HSPACEN(char, pwd, YAP_FILENAME_MAX) -#endif - -// udi.c -// struct udi_control_block , RtreeCmd, void, - -HSPACE(char *, RestoreFile) - -// gprof.c -HSPACE(Int, ProfCalls) -HSPACE(Int, ProfGCs) -HSPACE(Int, ProfHGrows) -HSPACE(Int, ProfSGrows) -HSPACE(Int, ProfMallocs) -HSPACE(Int, ProfIndexing) -HSPACE(Int, ProfOn) -HSPACE(Int, ProfOns) -HSPACE(struct RB_red_blk_node *, ProfilerRoot) -HSPACE(struct RB_red_blk_node *, ProfilerNil) -HI(char *, DIRNAME, NULL) -#if LOW_PROF -HI(int, ProfilerOn, false) -HI(FILE *, FProf, NULL) -HI(FILE *, FPreds, NULL) -#endif /* LOW_PROF */ - -// Mutexes -#if THREADS -HI(struct swi_mutex *, FreeMutexes, NULL) -HI(struct swi_mutex *, mutex_backbone, NULL) -HSPACEN(struct swi_reverse_hash, N_SWI_HASH. SWI_ReverseHash -HI(lockvar, MUT_ACCESS, MkLock) -#endif - -HI(char *, Home, NULL) - -/* ISO char conversion: I will make no comments */ -HI(char *, CharConversionTable, NULL) -HI(char *, CharConversionTable2, NULL) - -/* time */ -HI(void *, LastWTimePtr, NULL) - -/* max priority */ -HI(int, MaxPriority, 1200) diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 094d3ce42..2564ec571 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -297,6 +297,7 @@ check_function_exists(mkstemp HAVE_MKSTEMP) check_function_exists(mktemp HAVE_MKTEMP) check_function_exists(nanosleep HAVE_NANOSLEEP) check_function_exists(mktime HAVE_MKTIME) +check_function_exists(mtrace HAVE_MTRACE) check_function_exists(opendir HAVE_OPENDIR) if (NOT APPLE) check_function_exists(open_memstream HAVE_OPEN_MEMSTREAM) diff --git a/cmake/Sources.cmake b/cmake/Sources.cmake index 6bd9429d5..9e6e6e9fe 100644 --- a/cmake/Sources.cmake +++ b/cmake/Sources.cmake @@ -31,6 +31,7 @@ set (ENGINE_SOURCES C/corout.c C/cut_c.c C/dbase.c + C/dbload.c C/dlmalloc.c C/errors.c C/eval.c diff --git a/config.h.cmake b/config.h.cmake index bc2ab1242..822ad3116 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -942,6 +942,11 @@ function. */ #cmakedefine HAVE_MPI_H ${HAVE_MPI_H} #endif +/* Define to 1 if you have the glibc extension. */ +#ifndef HAVE_MPI_H +#cmakedefine HAVE_MTRACE ${HAVE_TRACE} +#endif + /* Older versions of MPZ didn't have XOR */ #ifndef HAVE_MPZ_XOR #cmakedefine HAVE_MPZ_XOR ${HAVE_MPZ_XOR} diff --git a/include/YapDefs.h b/include/YapDefs.h index b2b684e1e..aa3c49001 100755 --- a/include/YapDefs.h +++ b/include/YapDefs.h @@ -137,13 +137,14 @@ typedef enum { #include "YapInit.h" /* this should be opaque to the user */ -typedef struct goal_info { - unsigned long b, b0, e, a; //> choice-point at entry +typedef struct { + unsigned long b0, b_entry, b_exit; //> choice-point at entry YAP_handle_t CurSlot; //> variables at entry YAP_handle_t EndSlot; //> variables at successful execution struct yami *p; //> Program Counter at entry struct yami *cp; //> Continuation PC at entry int lvl; + long env0; unsigned long tr, h; } YAP_dogoalinfo; diff --git a/include/YapError.h b/include/YapError.h index b5d4d3135..65981351c 100644 --- a/include/YapError.h +++ b/include/YapError.h @@ -73,7 +73,8 @@ Yap_Error__(false, __FILE__, __FUNCTION__, __LINE__, id, TermNil, __VA_ARGS__) { if ( (TF = Yap_ensure_atom__(__FILE__, __FUNCTION__, __LINE__, T0 ) == 0L ) return false; \ } -INLINE_ONLY Term Yap_ensure_atom__(const char *fu, const char *fi, int line, +//INLINE_ONLY + static Term Yap_ensure_atom__(const char *fu, const char *fi, int line, Term in) { Term t = Deref(in); // Term Context = Deref(ARG2); diff --git a/info/build.sh b/info/build.sh index 98ccbf15e..cc1fdc7c9 100644 --- a/info/build.sh +++ b/info/build.sh @@ -13,11 +13,11 @@ mkdir $PREFIX/conda cd $PREFIX/conda # The datarootdir option places the docs into a temp folder that won't $CMAKE --build=. --target=install \ - -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_BUILD_TYPE=Debug -GNinja \ -DCMAKE_INSTALL_PREFIX="$PREFIX" \ - $RECIPE_DIR/.. + $RECIPE_DIR/.. -DWITH_CUDD=NO -DWITH_GECODE=NO -DWITH_JAVA=NO -DWITH_RAPTOR=NO - make -j install + ninja install # Remove the created lib64 directory diff --git a/info/meta.yaml b/info/meta.yaml index 8a51f5bbd..25d2122e3 100644 --- a/info/meta.yaml +++ b/info/meta.yaml @@ -15,7 +15,6 @@ requirements: - r - notebook - pkgconfig - - make - libxml2 run: - jupyterlab diff --git a/library/maplist.yap b/library/maplist.yap index 5583d446c..e1f134907 100644 --- a/library/maplist.yap +++ b/library/maplist.yap @@ -710,7 +710,7 @@ scanl_([H1|T1], [H2|T2], [H3|T3], [H4|T4], Goal, V, [VH|VT]) :- goal_expansion(checklist(Meta, List), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -731,7 +731,7 @@ goal_expansion(checklist(Meta, List), Mod:Goal) :- goal_expansion(maplist(Meta, List), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -752,7 +752,7 @@ goal_expansion(maplist(Meta, List), Mod:Goal) :- goal_expansion(maplist(Meta, ListIn, ListOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -766,14 +766,13 @@ goal_expansion(maplist(Meta, ListIn, ListOut), Mod:Goal) :- append_args(HeadPrefix, [[In|Ins], [Out|Outs]], RecursionHead), append_args(Pred, [In, Out], Apply), append_args(HeadPrefix, [Ins, Outs], RecursiveCall), - compile_aux([ - Base, + compile_aux([ Base, (RecursionHead :- Apply, RecursiveCall) ], Mod). goal_expansion(maplist(Meta, L1, L2, L3), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -794,7 +793,7 @@ goal_expansion(maplist(Meta, L1, L2, L3), Mod:Goal) :- goal_expansion(maplist(Meta, L1, L2, L3, L4), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -815,7 +814,7 @@ goal_expansion(maplist(Meta, L1, L2, L3, L4), Mod:Goal) :- goal_expansion(maplist(Meta, L1, L2, L3, L4, L5), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -836,7 +835,7 @@ goal_expansion(maplist(Meta, L1, L2, L3, L4, L5), Mod:Goal) :- goal_expansion(selectlist(Meta, ListIn, ListOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -859,7 +858,7 @@ goal_expansion(selectlist(Meta, ListIn, ListOut), Mod:Goal) :- goal_expansion(selectlist(Meta, ListIn, ListIn1, ListOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -882,31 +881,31 @@ goal_expansion(selectlist(Meta, ListIn, ListIn1, ListOut), Mod:Goal) :- goal_expansion(selectlists(Meta, ListIn, ListIn1, ListOut, ListOut1), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, % the new goal - pred_name(selectlist, 4, Proto, GoalName), + pred_name(selectlists, 4, Proto, GoalName), append(MetaVars, [ListIn, ListIn1, ListOut, ListOut1], GoalArgs), Goal =.. [GoalName|GoalArgs], % the new predicate declaration HeadPrefix =.. [GoalName|PredVars], append_args(HeadPrefix, [[], [], [], []], Base), append_args(HeadPrefix, [[In|Ins], [In1|Ins1], Outs, Outs1], RecursionHead), - append_args(Pred, [In, In1], Apply), + append_args(Pred, [In, Out], Apply), append_args(HeadPrefix, [Ins, Ins1, NOuts, NOuts1], RecursiveCall), compile_aux([ Base, (RecursionHead :- - (Apply -> Outs = [In|NOuts], Outs1 = [In1|NOuts1]; Outs = NOuts, Outs1 = NOuts1), + (Apply -> Outs = [Out|NOuts], Outs1 = [In1|NOuts1]; Outs = NOuts, Outs1 = NOuts1), RecursiveCall) ], Mod). % same as selectlist goal_expansion(include(Meta, ListIn, ListOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -929,7 +928,7 @@ goal_expansion(include(Meta, ListIn, ListOut), Mod:Goal) :- goal_expansion(exclude(Meta, ListIn, ListOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -952,7 +951,7 @@ goal_expansion(exclude(Meta, ListIn, ListOut), Mod:Goal) :- goal_expansion(partition(Meta, ListIn, List1, List2), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -975,7 +974,7 @@ goal_expansion(partition(Meta, ListIn, List1, List2), Mod:Goal) :- goal_expansion(partition(Meta, ListIn, List1, List2, List3), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1015,7 +1014,7 @@ goal_expansion(partition(Meta, ListIn, List1, List2, List3), Mod:Goal) :- goal_expansion(convlist(Meta, ListIn, ListOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1038,7 +1037,7 @@ goal_expansion(convlist(Meta, ListIn, ListOut), Mod:Goal) :- goal_expansion(convlist(Meta, ListIn, ListExtra, ListOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1061,7 +1060,7 @@ goal_expansion(convlist(Meta, ListIn, ListExtra, ListOut), Mod:Goal) :- goal_expansion(sumlist(Meta, List, AccIn, AccOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1082,7 +1081,7 @@ goal_expansion(sumlist(Meta, List, AccIn, AccOut), Mod:Goal) :- goal_expansion(foldl(Meta, List, AccIn, AccOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1103,7 +1102,7 @@ goal_expansion(foldl(Meta, List, AccIn, AccOut), Mod:Goal) :- goal_expansion(foldl(Meta, List1, List2, AccIn, AccOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1124,7 +1123,7 @@ goal_expansion(foldl(Meta, List1, List2, AccIn, AccOut), Mod:Goal) :- goal_expansion(foldl(Meta, List1, List2, List3, AccIn, AccOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1145,7 +1144,7 @@ goal_expansion(foldl(Meta, List1, List2, List3, AccIn, AccOut), Mod:Goal) :- goal_expansion(foldl2(Meta, List, AccIn, AccOut, W0, W), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1166,7 +1165,7 @@ goal_expansion(foldl2(Meta, List, AccIn, AccOut, W0, W), Mod:Goal) :- goal_expansion(foldl2(Meta, List1, List2, AccIn, AccOut, W0, W), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1187,7 +1186,7 @@ goal_expansion(foldl2(Meta, List1, List2, AccIn, AccOut, W0, W), Mod:Goal) :- goal_expansion(foldl2(Meta, List1, List2, List3, AccIn, AccOut, W0, W), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1208,7 +1207,7 @@ goal_expansion(foldl2(Meta, List1, List2, List3, AccIn, AccOut, W0, W), Mod:Goal goal_expansion(foldl3(Meta, List, AccIn, AccOut, W0, W, X0, X), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1229,7 +1228,7 @@ goal_expansion(foldl3(Meta, List, AccIn, AccOut, W0, W, X0, X), Mod:Goal) :- goal_expansion(foldl4(Meta, List, AccIn, AccOut, W0, W, X0, X, Y0, Y), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1250,7 +1249,7 @@ goal_expansion(foldl4(Meta, List, AccIn, AccOut, W0, W, X0, X, Y0, Y), Mod:Goal) goal_expansion(mapnodes(Meta, InTerm, OutTerm), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1282,7 +1281,7 @@ goal_expansion(mapnodes(Meta, InTerm, OutTerm), Mod:Goal) :- goal_expansion(checknodes(Meta, Term), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, @@ -1312,7 +1311,7 @@ goal_expansion(checknodes(Meta, Term), Mod:Goal) :- goal_expansion(sumnodes(Meta, Term, AccIn, AccOut), Mod:Goal) :- goal_expansion_allowed, - is_callable(Meta), + callable(Meta), current_source_module(Mod,Mod), aux_preds(Meta, MetaVars, Pred, PredVars, Proto), !, diff --git a/library/matrix.yap b/library/matrix.yap index 9efefb539..cdbd51a88 100644 --- a/library/matrix.yap +++ b/library/matrix.yap @@ -29,6 +29,7 @@ (+=)/2, op(800, xfx, +=), (-=)/2, op(800, xfx, -=), op(700, xfx, in), + op(700, xfx, within), op(700, xfx, ins), op(450, xfx, ..), % should bind more tightly than \/ op(710, xfx, of), of/2, @@ -974,8 +975,6 @@ mtimes(I1, I2, V) :- V = I1*I2 ) ; V = I1 *I2. - - % % three types of matrix: integers, floats and general terms. % diff --git a/library/rbtrees.yap b/library/rbtrees.yap index 8b52743b4..bef880120 100644 --- a/library/rbtrees.yap +++ b/library/rbtrees.yap @@ -1455,4 +1455,4 @@ with _NewVal_. Fails if it cannot find _Key_ in _T_. */ -%%! @} \ No newline at end of file +%%! @} diff --git a/os/sysbits.c b/os/sysbits.c index 966ee2eaf..97d103822 100644 --- a/os/sysbits.c +++ b/os/sysbits.c @@ -1933,6 +1933,19 @@ static Int p_sleep(USES_REGS1) { return FALSE: #endif } + + +static Int + p_mtrace() + { +#ifdef HAVE_MTRACE + Term t = Deref(ARG1); + if (t == TermTrue) mtrace(); + else if (t == TermFalse) return muntrace(); + else return false; +#endif + return true; + } void Yap_InitSysPreds(void) { Yap_InitCPred("log_event", 1, p_log_event, SafePredFlag | SyncPredFlag); @@ -1972,5 +1985,6 @@ void Yap_InitSysPreds(void) { Yap_InitCPred("rmdir", 2, p_rmdir, SyncPredFlag); Yap_InitCPred("sleep", 1, p_sleep, SyncPredFlag); Yap_InitCPred("make_directory", 1, make_directory, SyncPredFlag); + Yap_InitCPred("mtrace", 1, p_mtrace, SyncPredFlag); } diff --git a/os/writeterm.c b/os/writeterm.c index ce96bf572..ecaa14503 100644 --- a/os/writeterm.c +++ b/os/writeterm.c @@ -729,6 +729,7 @@ char *Yap_TermToBuffer(Term t, int flags) { t = Deref(t); GLOBAL_Stream[sno].encoding = LOCAL_encoding; GLOBAL_Stream[sno].status |= CloseOnException_Stream_f; + GLOBAL_Stream[sno].status &= ~FreeOnClose_Stream_f; Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, GLOBAL_MaxPriority); char *new = Yap_MemExportStreamPtr(sno); diff --git a/packages/bee/CMakeLists.txt b/packages/bee/CMakeLists.txt new file mode 100644 index 000000000..e7918b8ad --- /dev/null +++ b/packages/bee/CMakeLists.txt @@ -0,0 +1,105 @@ +set (MINISAT_SOURCES +#minisat-2.0.2/core/Main.cc +minisat-2.0.2/core/Solver.cc +#minisat-2.0.2/simp/Main.cc +minisat-2.0.2/simp/SimpSolver.cc +minisat-2.0.2/utils/Options.cc +minisat-2.0.2/utils/System.cc + ) + +add_library( MINISAT + ${MINISAT_SOURCES} + minisat-interface.cc + ) + + target_link_libraries (MINISAT libYap) + +set_target_properties(MINISAT PROPERTIES CXX_STANDARD 11) +target_include_directories(MINISAT PRIVATE BEFORE minisat-2.0.2/core) +target_include_directories(MINISAT PRIVATE BEFORE minisat-2.0.2) + +set_target_properties(MINISAT PROPERTIES COMPILE_FLAGS -DMINISAT=1) + +set_target_properties(MINISAT PROPERTIES CXX_STANDARD 11) +set(solver minisat) +set (Solver Minisat) +configure_file(yap-interface.cc.cmake minisat-interface.cc) + +if(OFF) + + set( + CRYPTOMINISAT_SOURCES + cryptominisat-2.5.1/Solver/Clause.cpp +cryptominisat-2.5.1/Solver/ClauseCleaner.cpp +cryptominisat-2.5.1/Solver/FailedVarSearcher.cpp +cryptominisat-2.5.1/Solver/FindUndef.cpp +cryptominisat-2.5.1/Solver/Gaussian.cpp +cryptominisat-2.5.1/Solver/Logger.cpp +cryptominisat-2.5.1/Solver/MatrixFinder.cpp +cryptominisat-2.5.1/Solver/PackedRow.cpp +cryptominisat-2.5.1/Solver/PartFinder.cpp +cryptominisat-2.5.1/Solver/PartHandler.cpp +cryptominisat-2.5.1/Solver/RestartTypeChooser.cpp +cryptominisat-2.5.1/Solver/SmallPtr.cpp +cryptominisat-2.5.1/Solver/Solver.cpp +cryptominisat-2.5.1/Solver/StateSaver.cpp +cryptominisat-2.5.1/Solver/Subsumer.cpp +cryptominisat-2.5.1/Solver/VarReplacer.cpp +cryptominisat-2.5.1/Solver/XorFinder.cpp +cryptominisat-2.5.1/Solver/XorSubsumer.cpp + + ) +add_library( CRYPTOMINISAT + ${CRYPTOMINISAT_SOURCES} + cryptominisat-interface.cc + ) + target_link_libraries (CRYPTOMINISAT libYap) + +# target_include_directories(GLUCOSE4 PRIVATE glucose-4/parallel) +target_include_directories(CRYPTOMINISAT PRIVATE BEFORE cryptominisat-2.5.1/MTRand) +target_include_directories(CRYPTOMINISAT PRIVATE BEFORE cryptominisat-2.5.1/mtl) +target_include_directories(CRYPTOMINISAT PRIVATE BEFORE cryptominisat-2.5.1/Solver) + +target_compile_definitions(CRYPTOMINISAT PUBLIC CRYPTOMINISAT=1 register=) + +# set_target_properties(CRYPTOMINISAT PROPERTIES CXX_STANDARD 11) +set(solver cryptominisat) +set (Solver Cryptominisat) +configure_file(yap-interface.cc.cmake cryptominisat-interface.cc) + +endif() + +set( + GLUCOSE_SOURCES +# glucose-2.2/core/Main.cc +glucose-2.2/core/Solver.cc +# glucose-2.2/simp/Main.cc +glucose-2.2/simp/SimpSolver.cc +glucose-2.2/utils/Options.cc +glucose-2.2/utils/System.cc + ) +add_library( GLUCOSE + ${GLUCOSE_SOURCES} + glucose-interface.cc + ) + target_link_libraries (GLUCOSE libYap) + +set_target_properties(GLUCOSE PROPERTIES COMPILE_FLAGS -DGLUCOSE=1) +#set_target_properties(GLUCOSE PROPERTIES CXX_STANDARD 11) +target_include_directories(GLUCOSE PRIVATE glucose-2.2) +target_include_directories(GLUCOSE PRIVATE glucose-2.2/core) + +set_target_properties(GLUCOSE PROPERTIES CXX_STANDARD 11) +set(solver glucose) +set (Solver Glucose) +configure_file(yap-interface.cc.cmake glucose-interface.cc) + +# add_library( GLUCOSE4 +# ${GLUCOSE4_SOURCES} +# ${PL_SOURCE} +# ) + +# set_target_properties(GLUCOSE4 PROPERTIES COMPILE_FLAGS -DGLUCOSE4=1) +# set_target_properties(GLUCOSE4 PROPERTIES CXX_STANDARD 11) +# target_include_directories(GLUCOSE4 PRIVATE glucose-4/parallel) +# target_include_directories(GLUCOSE4 PRIVATE glucose-4) diff --git a/packages/bee/cryptominisat-2.5.1/AUTHORS b/packages/bee/cryptominisat-2.5.1/AUTHORS new file mode 100755 index 000000000..bbd40eece --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/AUTHORS @@ -0,0 +1,25 @@ +Mate Soos + +People whose code has been incorporated: +- Niklas Eén +- Niklas Sörensson +- Gilles Audemard +- Laurent Simon +- Some of Armin Biere's code +->> Great thanks to all of the above. They were not +in any way associated with the development of CryptoMiniSat. +Please don't blame them or write to them regarding bugs etc. + +Special thanks to: +- the author's professors +- the gcc compiler team +- libstdc team +- Bjarne Stroustrup for C++ + +Bug-hunting thanks to: +- Martin Maurer for helping with Visual C-specific things + and reporting on multiple bugs +- Trevor Hansen, for fuzztesting the code on millions of problems + and reporting on a good number of bugs +- Vijay Ganesh for finding a lots of bugs +- Users of STP (Simple Theorem Prover) for their feedback diff --git a/packages/bee/cryptominisat-2.5.1/CMakeLists.txt b/packages/bee/cryptominisat-2.5.1/CMakeLists.txt new file mode 100755 index 000000000..486d66e62 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/CMakeLists.txt @@ -0,0 +1,48 @@ +cmake_minimum_required(VERSION 2.6 FATAL_ERROR) + +IF(DEFINED CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") +ELSE() + SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") +ENDIF() + +#set(CMAKE_C_COMPILER "gcc-4.4") +#set(CMAKE_CXX_COMPILER "/usr/bin/g++-4.4") + +PROJECT(cryptoms) +SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-m32 -O3 -Wall -Werror -DSTATS_NEEDED -g -mtune=native") +SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -Werror -DSTATS_NEEDED -O0 -ggdb") +SET(CMAKE_CXX_FLAGS_RELEASE "-Wall -fprofile-use -Werror -O3 -g0 -fno-exceptions -DNDEBUG -mtune=native -fomit-frame-pointer") +SET(CMAKE_EXE_LINKER_FLAGS "-static") + +find_package( ZLIB ) +link_directories( ${ZLIB_LIBRARY} ) +include_directories( ${ZLIB_INCLUDE_DIR} ) + +find_package(Boost) +if(Boost_FOUND) + message("Boost found --- clauses will be packed (speedup)") + add_definitions(-DUSE_POOLS) +else(Boost_FOUND) + message("Boost NOT found, so clauses will NOT be packed (slowdown)") +endif(Boost_FOUND) + +add_definitions(-DVERSION="2.5.1") + +#FIND_PACKAGE(Threads REQUIRED) +#set(thread_library "${CMAKE_THREAD_LIBS_INIT}") + +add_subdirectory(Solver) +#add_subdirectory(SatELite) + +add_custom_target(copy ALL + COMMENT "Copying binaries from subdirs to build directory") + +add_custom_command( + TARGET copy + COMMAND ${CMAKE_COMMAND} -E copy Solver/cryptominisat . +# COMMAND ${CMAKE_COMMAND} -E copy SatELite/satelite . +) + +#add_dependencies(copy cryptominisat satelite) +add_dependencies(copy cryptominisat) diff --git a/packages/bee/cryptominisat-2.5.1/HOWTO_MinGW32 b/packages/bee/cryptominisat-2.5.1/HOWTO_MinGW32 new file mode 100755 index 000000000..3df8b9319 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/HOWTO_MinGW32 @@ -0,0 +1,82 @@ +***************************** + general info +***************************** + +mingw32-w32 is in Debian + +http://man.gnusquad.org/i586-mingw32msvc-ar/section-1/en/ + +64-bit mingw32 build instructions: +http://www.cadforte.com/wiki/index.php/How_to_build + +building libraries: +http://wiki.njh.eu/Cross_Compiling_for_Win32 + +http://stackoverflow.com/questions/1399252/boost-cross-compile-from-linux-to-windows + +in my user-config.jam: "using gcc : m : i586-mingw32msvc-g++ ;". I then run: "bjam toolset=gcc-m target-os=windows variant=debug --with-program_options". +So the whole command is: "./bjam --layout=system variant=release threading=multi link=shared runtime-link=shared toolset=gcc target-os=windows threadapi=win32 stage". cannot compile these libraries: -graph -graph_parallel -iostreams -math (partly) -python The others can be compiled. + +use --without-xxx to disable building unneeded libraries + +boost build: +./bootstrap + +./bjam --layout=system variant=release threading=multi link=shared runtime-link=shared toolset=gcc target-os=windows threadapi=win32 --without-graph --without-graph_parallel --without-iostreams --without-math --without-python stage + +***************************** + how to compile stuff on debian mingw32-w32 +***************************** +make line: +PATH=/usr/i586-mingw32msvc/bin:$PATH \ +make CC=i586-mingw32msvc-gcc AR=i586-mingw32msvc-ar \ + RC=i586-mingw32msvc-windres + +for libz, the last line is: +i586-mingw32msvc-ar qs libz.a adler32.o \ + compress.o crc32.o gzio.o uncompr.o \ + deflate.o trees.o zutil.o inflate.o \ + infback.o inftrees.o inffast.o + +make install PREFIX=/usr/i586-mingw32msvc + + +***************************** + how to compile stuff on debian mingw32-w64 +***************************** +make line: +PATH=/usr/x86_64-w64-mingw32/bin:$PATH \ + make CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar \ + RC=x86_64-w64-mingw32-windres + +for libz, the last line is: +x86_64-w64-mingw32-ar qs libz.a adler32.o \ + compress.o crc32.o gzio.o uncompr.o \ + deflate.o trees.o zutil.o inflate.o \ + infback.o inftrees.o inffast.o + + +***************************** + compile minisat +***************************** + +i586-mingw32msvc-g++ -O3 -march=i586 -DVERSION=\"2.5.1\" -DCROSS_COMPILE \ + -I../mtl/ -I../MTRand/ Main.C /usr/i586-mingw32msvc/lib/libz.a \ + Logger.cpp Solver.cpp ClauseCleaner.cpp FindUndef.cpp \ + PackedRow.cpp RestartTypeChooser.cpp MatrixFinder.cpp Gaussian.cpp \ + VarReplacer.cpp XorFinder.cpp SmallPtr.cpp Clause.cpp PartHandler.cpp \ + Subsumer.cpp XorSubsumer.cpp FailedVarSearcher.cpp PartFinder.cpp \ + StateSaver.cpp -o cryptominisat.exe + +***************************** + useful for examining archives: +***************************** + +i586-mingw32msvc-nm libz.a +i586-mingw32msvc-objdump -G libz.a + + +***************************** +Useful +***************************** +./configure --host=x86_64-pc-linux --target=x86_64-pc-mingw32 diff --git a/packages/bee/cryptominisat-2.5.1/HOWTO_VisualCpp b/packages/bee/cryptominisat-2.5.1/HOWTO_VisualCpp new file mode 100755 index 000000000..bdb43096a --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/HOWTO_VisualCpp @@ -0,0 +1,21 @@ +If compiling with Visual C, the CHUNK_LIMIT poses problems. +Problem is, that VC2008 seems to have a too small default stack, which is not big enough. +With default command line parameters it will crash. +The workaround is to give the command line parameter /F. With this you can +increase the stack to a certain size. Setting it to 2 MB is good enough + +ZLIB might also pose problems. If you cannot correctly compile it under +windows, I suggest you add the -DDISABLE_ZLIB to your compilation flags. + +The compilation instruction should therefore be: +cl /favor:INTEL64 /O2 /Fecryptominisat.exe -DDISABLE_ZLIB /F2097152 +/TP /EHsc -I. -I../mtl/ -I../MTRand/ Main.C Logger.cpp Solver.cpp +ClauseCleaner.cpp Conglomerate.cpp FindUndef.cpp +PackedRow.cpp RestartTypeChooser.cpp VarReplacer.cpp +XorFinder.cpp XorSubsumer.cpp Subsumer.cpp PartFinder.cpp +PartHandler.cpp FailedVarSearcher.cpp Gaussian.cpp +MatrixFinder.cpp + +executed from the 'Solver' subdirectory + +--- Bulid instructions by Martin M., thanks for all Visual C-based testing diff --git a/packages/bee/cryptominisat-2.5.1/INSTALL b/packages/bee/cryptominisat-2.5.1/INSTALL new file mode 100755 index 000000000..049beb18e --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/INSTALL @@ -0,0 +1,88 @@ +----------- +Libraries needed +----------- +You will need the following libraries to compile the sources: +* libz + +----------------- +Building the source +----------------- +There are two ways to build the source. With cmake or with autotools. +I personally use cmake. + +----------------- +Building using cmake +----------------- +* Install cmake +* Go into the 'build' directory +* Issue 'cmake ../' +* Issue 'make' +* Issue './cryptominisat satfile.cnf' + to test your new code. + +------------------ +Building using autotools +------------------ +* Go to the 'build' directory +* Issue '../configure' +* Issue 'make' +* Issue './cryptominisat satfile.cnf' to test your new code + +If you got your source from the GIT/SVN, then you should do the following +before doing the above:: +* Install automake, autoconf, libtool +* Issue 'make -f Makefile.cvs' in the root dir of the source + +--------- +Please read help +--------- +For help, build the program, and issue: +'./cryptominisat -help' + +-------------- +Verbose debug +------------- +You can also turn on verbose debugging. +Simply remove the comment before + +"//#define VERBOSE_DEBUG" +in Solver/constants.h and re-compile + +When executing: + +'./cryptominisat satfile.cnf' +You will see a LOT of debug info. You should therefore maybe do: + +'./cryptominisat satfile.cnf > debuginfo.txt' +then you can open the 'debuginfo.txt' file from a text editor and have a look + +-------------------------- +Windows binary generation +------------------------- +It should be possible f you compile under windows +using Visual C++. Please read the HOWTO_VisualCpp for details + +I compile under linux all windows binaries, using gcc that generates +windows executables. It works really well. There is a sort-of-howto in +the "HOWTO_MinGW32" text file. A short step-by-step is here: + +1) Install gcc that generates windows binaries: + +i586-mingw32msvc + +1) Install all libraries (libz) + +libz: +get from source and compile as per "Solver/win32-howto" + +2) complie: + +go to the "Solver" subdir and execute: + +i586-mingw32msvc-g++ -O3 -g -DCROSS_COMPILE -march=i586 -I../mtl/ -I../MTRand/ \ +/usr/i586-mingw32msvc/lib/libz.a Main.C Solver.C Logger.C Clause.cpp \ +VarReplacer.cpp FindUndef.cpp XorFinder.cpp XorSubsumer.cpp Subsumer.cpp \ +Conglomerate.cpp PackedRow.cpp FailedVarSearcher.cpp PartFinder.cpp \ +PartHander.cpp -o cryptominisat.exe + +I test the generated binary under wine, in Linux. diff --git a/packages/bee/cryptominisat-2.5.1/LICENSE-GPL b/packages/bee/cryptominisat-2.5.1/LICENSE-GPL new file mode 100755 index 000000000..94a9ed024 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/LICENSE-GPL @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/packages/bee/cryptominisat-2.5.1/LICENSE-MIT b/packages/bee/cryptominisat-2.5.1/LICENSE-MIT new file mode 100755 index 000000000..beb079905 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/LICENSE-MIT @@ -0,0 +1,21 @@ +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/bee/cryptominisat-2.5.1/MTRand/MersenneTwister.h b/packages/bee/cryptominisat-2.5.1/MTRand/MersenneTwister.h new file mode 100755 index 000000000..16e64581a --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/MTRand/MersenneTwister.h @@ -0,0 +1,423 @@ +// MersenneTwister.h +// Mersenne Twister random number generator -- a C++ class MTRand +// Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus +// Richard J. Wagner v1.0 15 May 2003 rjwagner@writeme.com + +// The Mersenne Twister is an algorithm for generating random numbers. It +// was designed with consideration of the flaws in various other generators. +// The period, 2^19937-1, and the order of equidistribution, 623 dimensions, +// are far greater. The generator is also fast; it avoids multiplication and +// division, and it benefits from caches and pipelines. For more information +// see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html + +// Reference +// M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally +// Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on +// Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30. + +// Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, +// Copyright (C) 2000 - 2003, Richard J. Wagner +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The names of its contributors may not be used to endorse or promote +// products derived from this software without specific prior written +// permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// The original code included the following notice: +// +// When you use this, send an email to: matumoto@math.keio.ac.jp +// with an appropriate reference to your work. +// +// It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu +// when you write. + +#ifndef MERSENNETWISTER_H +#define MERSENNETWISTER_H + +// Not thread safe (unless auto-initialization is avoided and each thread has +// its own MTRand object) + +#include +#include +#include +#include +#include + +class MTRand { +// Data +public: + typedef unsigned long uint32; // unsigned integer type, at least 32 bits + + enum { N = 624 }; // length of state vector + enum { SAVE = N + 1 }; // length of array for save() + +protected: + enum { M = 397 }; // period parameter + + uint32 state[N]; // internal state + uint32 *pNext; // next value to get from state + int left; // number of values left before reload needed + + +//Methods +public: + MTRand( const uint32& oneSeed ); // initialize with a simple uint32 + MTRand( uint32 *const bigSeed, uint32 const seedLength = N ); // or an array + MTRand(); // auto-initialize with /dev/urandom or time() and clock() + + // Do NOT use for CRYPTOGRAPHY without securely hashing several returned + // values together, otherwise the generator state can be learned after + // reading 624 consecutive values. + + // Access to 32-bit random numbers + double rand(); // real number in [0,1] + double rand( const double& n ); // real number in [0,n] + double randExc(); // real number in [0,1) + double randExc( const double& n ); // real number in [0,n) + double randDblExc(); // real number in (0,1) + double randDblExc( const double& n ); // real number in (0,n) + uint32 randInt(); // integer in [0,2^32-1] + uint32 randInt( const uint32& n ); // integer in [0,n] for n < 2^32 + double operator()() { return rand(); } // same as rand() + + // Access to 53-bit random numbers (capacity of IEEE double precision) + double rand53(); // real number in [0,1) + + // Access to nonuniform random number distributions + double randNorm( const double& mean = 0.0, const double& variance = 0.0 ); + + // Re-seeding functions with same behavior as initializers + void seed( const uint32 oneSeed ); + void seed( uint32 *const bigSeed, const uint32 seedLength = N ); + void seed(); + + // Saving and loading generator state + void save( uint32* saveArray ) const; // to array of size SAVE + void load( uint32 *const loadArray ); // from such array + friend std::ostream& operator<<( std::ostream& os, const MTRand& mtrand ); + friend std::istream& operator>>( std::istream& is, MTRand& mtrand ); + +protected: + void initialize( const uint32 oneSeed ); + void reload(); + uint32 hiBit( const uint32& u ) const { return u & 0x80000000UL; } + uint32 loBit( const uint32& u ) const { return u & 0x00000001UL; } + uint32 loBits( const uint32& u ) const { return u & 0x7fffffffUL; } + uint32 mixBits( const uint32& u, const uint32& v ) const + { return hiBit(u) | loBits(v); } + uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const + { return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL); } + static uint32 hash( time_t t, clock_t c ); +}; + + +inline MTRand::MTRand( const uint32& oneSeed ) + { seed(oneSeed); } + +inline MTRand::MTRand( uint32 *const bigSeed, const uint32 seedLength ) + { seed(bigSeed,seedLength); } + +inline MTRand::MTRand() + { seed(); } + +inline double MTRand::rand() + { return double(randInt()) * (1.0/4294967295.0); } + +inline double MTRand::rand( const double& n ) + { return rand() * n; } + +inline double MTRand::randExc() + { return double(randInt()) * (1.0/4294967296.0); } + +inline double MTRand::randExc( const double& n ) + { return randExc() * n; } + +inline double MTRand::randDblExc() + { return ( double(randInt()) + 0.5 ) * (1.0/4294967296.0); } + +inline double MTRand::randDblExc( const double& n ) + { return randDblExc() * n; } + +inline double MTRand::rand53() +{ + uint32 a = randInt() >> 5, b = randInt() >> 6; + return ( a * 67108864.0 + b ) * (1.0/9007199254740992.0); // by Isaku Wada +} + +inline double MTRand::randNorm( const double& mean, const double& variance ) +{ + // Return a real number from a normal (Gaussian) distribution with given + // mean and variance by Box-Muller method + double r = sqrt( -2.0 * log( 1.0-randDblExc()) ) * variance; + double phi = 2.0 * 3.14159265358979323846264338328 * randExc(); + return mean + r * cos(phi); +} + +inline MTRand::uint32 MTRand::randInt() +{ + // Pull a 32-bit integer from the generator state + // Every other access function simply transforms the numbers extracted here + + if( left == 0 ) reload(); + --left; + + register uint32 s1; + s1 = *pNext++; + s1 ^= (s1 >> 11); + s1 ^= (s1 << 7) & 0x9d2c5680UL; + s1 ^= (s1 << 15) & 0xefc60000UL; + return ( s1 ^ (s1 >> 18) ); +} + +inline MTRand::uint32 MTRand::randInt( const uint32& n ) +{ + // Find which bits are used in n + // Optimized by Magnus Jonsson (magnus@smartelectronix.com) + uint32 used = n; + used |= used >> 1; + used |= used >> 2; + used |= used >> 4; + used |= used >> 8; + used |= used >> 16; + + // Draw numbers until one is found in [0,n] + uint32 i; + do + i = randInt() & used; // toss unused bits to shorten search + while( i > n ); + return i; +} + + +inline void MTRand::seed( const uint32 oneSeed ) +{ + // Seed the generator with a simple uint32 + initialize(oneSeed); + reload(); +} + + +inline void MTRand::seed( uint32 *const bigSeed, const uint32 seedLength ) +{ + // Seed the generator with an array of uint32's + // There are 2^19937-1 possible initial states. This function allows + // all of those to be accessed by providing at least 19937 bits (with a + // default seed length of N = 624 uint32's). Any bits above the lower 32 + // in each element are discarded. + // Just call seed() if you want to get array from /dev/urandom + initialize(19650218UL); + register int i = 1; + register uint32 j = 0; + register int k = ( N > seedLength ? N : seedLength ); + for( ; k; --k ) + { + state[i] = + state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1664525UL ); + state[i] += ( bigSeed[j] & 0xffffffffUL ) + j; + state[i] &= 0xffffffffUL; + ++i; ++j; + if( i >= N ) { state[0] = state[N-1]; i = 1; } + if( j >= seedLength ) j = 0; + } + for( k = N - 1; k; --k ) + { + state[i] = + state[i] ^ ( (state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL ); + state[i] -= i; + state[i] &= 0xffffffffUL; + ++i; + if( i >= N ) { state[0] = state[N-1]; i = 1; } + } + state[0] = 0x80000000UL; // MSB is 1, assuring non-zero initial array + reload(); +} + + +inline void MTRand::seed() +{ + // Seed the generator with an array from /dev/urandom if available + // Otherwise use a hash of time() and clock() values + + // First try getting an array from /dev/urandom + FILE* urandom = fopen( "/dev/urandom", "rb" ); + if( urandom ) + { + uint32 bigSeed[N]; + register uint32 *s = bigSeed; + register int i = N; + register bool success = true; + while( success && i-- ) + success = fread( s++, sizeof(uint32), 1, urandom ); + fclose(urandom); + if( success ) { seed( bigSeed, N ); return; } + } + + // Was not successful, so use time() and clock() instead + seed( hash( time(NULL), clock() ) ); +} + + +inline void MTRand::initialize( const uint32 seed ) +{ + // Initialize generator state with seed + // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. + // In previous versions, most significant bits (MSBs) of the seed affect + // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. + register uint32 *s = state; + register uint32 *r = state; + register int i = 1; + *s++ = seed & 0xffffffffUL; + for( ; i < N; ++i ) + { + *s++ = ( 1812433253UL * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffUL; + r++; + } +} + + +inline void MTRand::reload() +{ + // Generate N new values in state + // Made clearer and faster by Matthew Bellew (matthew.bellew@home.com) + register uint32 *p = state; + register int i; + for( i = N - M; i--; ++p ) + *p = twist( p[M], p[0], p[1] ); + for( i = M; --i; ++p ) + *p = twist( p[M-N], p[0], p[1] ); + *p = twist( p[M-N], p[0], state[0] ); + + left = N, pNext = state; +} + + +inline MTRand::uint32 MTRand::hash( time_t t, clock_t c ) +{ + // Get a uint32 from t and c + // Better than uint32(x) in case x is floating point in [0,1] + // Based on code by Lawrence Kirby (fred@genesis.demon.co.uk) + + static uint32 differ = 0; // guarantee time-based seeds will change + + uint32 h1 = 0; + unsigned char *p = (unsigned char *) &t; + for( size_t i = 0; i < sizeof(t); ++i ) + { + h1 *= UCHAR_MAX + 2U; + h1 += p[i]; + } + uint32 h2 = 0; + p = (unsigned char *) &c; + for( size_t j = 0; j < sizeof(c); ++j ) + { + h2 *= UCHAR_MAX + 2U; + h2 += p[j]; + } + return ( h1 + differ++ ) ^ h2; +} + + +inline void MTRand::save( uint32* saveArray ) const +{ + register uint32 *sa = saveArray; + register const uint32 *s = state; + register int i = N; + for( ; i--; *sa++ = *s++ ) {} + *sa = left; +} + + +inline void MTRand::load( uint32 *const loadArray ) +{ + register uint32 *s = state; + register uint32 *la = loadArray; + register int i = N; + for( ; i--; *s++ = *la++ ) {} + left = *la; + pNext = &state[N-left]; +} + + +inline std::ostream& operator<<( std::ostream& os, const MTRand& mtrand ) +{ + register const MTRand::uint32 *s = mtrand.state; + register int i = mtrand.N; + for( ; i--; os << *s++ << "\t" ) {} + return os << mtrand.left; +} + + +inline std::istream& operator>>( std::istream& is, MTRand& mtrand ) +{ + register MTRand::uint32 *s = mtrand.state; + register int i = mtrand.N; + for( ; i--; is >> *s++ ) {} + is >> mtrand.left; + mtrand.pNext = &mtrand.state[mtrand.N-mtrand.left]; + return is; +} + +#endif // MERSENNETWISTER_H + +// Change log: +// +// v0.1 - First release on 15 May 2000 +// - Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus +// - Translated from C to C++ +// - Made completely ANSI compliant +// - Designed convenient interface for initialization, seeding, and +// obtaining numbers in default or user-defined ranges +// - Added automatic seeding from /dev/urandom or time() and clock() +// - Provided functions for saving and loading generator state +// +// v0.2 - Fixed bug which reloaded generator one step too late +// +// v0.3 - Switched to clearer, faster reload() code from Matthew Bellew +// +// v0.4 - Removed trailing newline in saved generator format to be consistent +// with output format of built-in types +// +// v0.5 - Improved portability by replacing static const int's with enum's and +// clarifying return values in seed(); suggested by Eric Heimburg +// - Removed MAXINT constant; use 0xffffffffUL instead +// +// v0.6 - Eliminated seed overflow when uint32 is larger than 32 bits +// - Changed integer [0,n] generator to give better uniformity +// +// v0.7 - Fixed operator precedence ambiguity in reload() +// - Added access for real numbers in (0,1) and (0,n) +// +// v0.8 - Included time.h header to properly support time_t and clock_t +// +// v1.0 - Revised seeding to match 26 Jan 2002 update of Nishimura and Matsumoto +// - Allowed for seeding with arrays of any length +// - Added access for real numbers in [0,1) with 53-bit resolution +// - Added access for real numbers from normal (Gaussian) distributions +// - Increased overall speed by optimizing twist() +// - Doubled speed of integer [0,n] generation +// - Fixed out-of-range number generation on 64-bit machines +// - Improved portability by substituting literal constants for long enum's +// - Changed license from GNU LGPL to BSD diff --git a/packages/bee/cryptominisat-2.5.1/Makefile.am b/packages/bee/cryptominisat-2.5.1/Makefile.am new file mode 100755 index 000000000..7b281d7c1 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Makefile.am @@ -0,0 +1,10 @@ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = Solver + +all-local: Solver + cp Solver/cryptominisat . + diff --git a/packages/bee/cryptominisat-2.5.1/Makefile.cvs b/packages/bee/cryptominisat-2.5.1/Makefile.cvs new file mode 100755 index 000000000..e05092bad --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Makefile.cvs @@ -0,0 +1,10 @@ +default: all + +all: + aclocal + autoheader + libtoolize --copy + automake --copy --add-missing + automake + autoconf + diff --git a/packages/bee/cryptominisat-2.5.1/Makefile.in b/packages/bee/cryptominisat-2.5.1/Makefile.in new file mode 100755 index 000000000..1ba590caf --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Makefile.in @@ -0,0 +1,733 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS INSTALL NEWS TODO config.guess \ + config.sub depcomp install-sh ltmain.sh missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4-extra/boost.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(distdir)"; }; } +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ +BOOST_ROOT = @BOOST_ROOT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I m4 +SUBDIRS = Solver +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h all-local +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am all-local am--refresh check check-am clean \ + clean-generic clean-libtool ctags ctags-recursive dist \ + dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ + dist-xz dist-zip distcheck distclean distclean-generic \ + distclean-hdr distclean-libtool distclean-tags distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +all-local: Solver + cp Solver/cryptominisat . + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/packages/bee/cryptominisat-2.5.1/NEWS b/packages/bee/cryptominisat-2.5.1/NEWS new file mode 100755 index 000000000..c54e82cff --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/NEWS @@ -0,0 +1,174 @@ +ver 2.5.1 -- 8/06/2010 --- 'The Obvious Child' +* Printing updates: everyting is printed much more nicely now +* Approximated degrees of literals in binary graph are not reset between + calculations + +ver 2.5.0 -- 7/06/2010 (SAT Race'10 version) +* A lot of performance bugs have been fixed. Activities of clauses were wrongly + updated with their abstract representation during subsumtion for example. + Also, we now use a well-tested set of magic constants instead of making + them up using intuition. Apparently, intuition in the field of SAT leads + to headaches and (in severe cases) to dementia. +* A lot of code has been added regarding binary clause graphs. It is now + regularly cleaned from useless binary clauses. Also, the useless binary + clauses are regularly generated to subsume and strenghthen other clauses + with them -- and once used, these useless binary clauses are thrown away. +* Hyper-binary clauses are now generated using an algorithm relying purely + on the datastrucures available in modern SAT solvers -- i.e. the fact that + binary clauses have their own watchlists, and so allow for efficient + propagation of the binary clauses separately from other clauses. + +ver 2.4.2 -- 9/05/2010 +* Gaussian elimination has finally been fixed. It can now be tried out with + the command-line switch "--gaussuntil=X", where X is the maximum depth. I + usually set 100, but this is probably a wrong default. You should experiment + with your own cipher. NOTE: Gauss is still experimental. If it segfaults, + please file a bug. +* The solver can now print out all the solutions to a problem. Simply use the + "--maxsolutions=X" option, where X is the maximum number of solutions you + need. You may use this option in conjunction with the very experimental + "--greedyunbound" which unassigns some variables in such a way that the + given solution is still correct, but some variables may not appear in it. +* Command line switches have been corrected. They are now all lower-case and + use the prefix "--" instead of "-" + +ver 2.4.1 -- 30/04/2010 +Serious bug fixed that read data from change memory in subsume0, and +hyper-binary resolution has been disabled, since it caused satisfiable +instances to become unsatisfiable. + +ver 2.4.0 -- 26/04/2010 +The first real release of CryptoMiniSat v2. It contains the following set +of improvements: + * XOR clauses are extracted at the beginning of the solving + * Anti- or equivalent variables are detected at regular intervals + and are replaced with one another, eliminating variables during + solving + * xor-clauses are regularly XOR-ed with one another such as to obtain + binary XOR clauses. These binary xor-clauses are then treated as variable + replacements instructions (i.e. "v1 XOR v2 = false" means that v1 is + replaced with v2) + * Phase calculation using Jeroslow and Wang, and phase saving with + randomised search space exploration. The average branch depth is + measured for each instance, and the solver makes a random phase + flip with 1/avgBranchDepth probability + * Random search burst are used to search unexplored areas of the + search space at regular intervals + * Automatic detection of cryptographic and industrial instances. Dynamic + restart is used for industrial instances, and static restart for + cryptographical instances. Detection is based on xor-clause percentage + and variable activity stability. + * Regular full restarts are performed to detect if the problem hasn't + changed enough due to learnt clauses and assigned variables to behave + more like a cryptographical instance than an industrial instance or + vice-versa. + * Both GLUCOSE-type learnt clause activity and MiniSat-type learnt clause + activity heuristics are supported. During dynamic restarts, the GLUCOSE + heuristic is used, while during static restarts, the MiniSat-type + heuristic is used. + * SatELite-type variable elimination, clause subsumption and clause + strengthening is regularly performed. The occurrence lists are, however, + not updated all the time such as the case is with PrecoSat. Instead, + occurrences are calculated on per-use basis + * On-the-fly subsumption is used to check whether the conflict clause + automatically subsumes the clause that caused the conflict. + * Binary clauses are propagated first before non-binary clauses are + propagated. + * 32-bit pointers are used for the watchlists on 64-bit architectures, + using out the fact that most bits in the 64-bit pointer are actually fixed + * Hyper-binary resolution is used when the hyper-binary clause subsumes + any of the original clauses + * Clauses are regularly scrubbed from variables that have been assigned + * Preliminary blocked-clause elimination is used to remove pure literals + * Distinct subproblems are regularly searched for and detected. These + subproblems and solved with subsolvers. As a side-ntoe, this eliminates + the original theoretical need for phase-saving (enabling the random + flipping of phase, which is also used) + * xor-clause subsumption is regularly performed + * So-called dependent variables are removed along with their xor-clauses. + This means that variables that only occur in one xor-clause and in no + other clause are removed along with the XOR clause. Once the solving has + finished, this xor-clause is re-introduced and a suitable value for the + variable is found to satisfy the XOR. + * Failed variable probing with both-propagated and binary XOR detection. + All variables are successively propagated both to TRUE and FALSE. If one + of these branches fails, the variable is assigned the other branch. + If none fails, but the intersection of assignments is non-empty, those + assignments are made. Essentially the same is done to non-binary XOR-s: + if both v and !v propagate a given binary XOR, that XOR is learnt. + * Designed to work as a library and as a drop-in replacement for MiniSat + +ver 2.3.2 -- 28/12/2009 +* further ints have been replaced with uints +* ZLIB can now be disabled +* Visual C++ 2008 can now compile the sources +* Statistics generation is much faster + (thanks to Martin Maurer for spotting this) + +ver 2.3.0 -- 17/12/2009 +* binary learnts are converted to 2-long xors if possible, and eliminated +* lots of heuristics tuning +* Cleanclauses is now default instead of removeSatisfied in simplify() +* Stable in case used as a library +* Lots of regression tests added +* Cleaner logging +* ints have been replaced with uints (less warnings with -Wall) +* a lot of speedups for gauss -- packed, multi-matrix representation + +ver 2.2 -- 20/11/2009 +* xor-clause finding +* matrix finding +* var-replacing +* heuristics to disable gauss +* much better+cleaner stats generation (e.g. fcopy.cpp removed) +* lots of bug-fixing +* satelite added, with cryptominisat_ext.sh as a wrapper script + +ver 2.1.1 -- 30/10/2009 +* Learnt clause distribution stats +* Added regression testing + +ver 2.1.0 -- 28/10/2009 +* hand-made (non-GPL Bignum) packed representation of both matrix' rows +* removed dependency on GPL Bignum library + +ver 2.0.1 -- 24/10/2009 +* Added Gaussian elimination + +ver 1.2.6 -- 24/10/2009 +* Corrected unitialised maxRestarts + + +ver 1.2.6 -- 24/10/2009 +* Corrected unitialised maxRestarts + +ver 1.2.5 -- 24/10/2009 +* Maximum restarts can be configured +* Better verbose debug printing + +ver 1.2.4 -- 22/10/2009 +* CryptoMiniSat is printed as the first line of the program + (instead of "This is MiniSat 2.0 beta") + +ver 1.2.3 -- 22/10/2009 +* better README file +* better use of the automake autoconf toolchain + +ver 1.2.2 -- 22/10/2009 +* phase saving added (thank you, glucose solver team) +* better printing of statistics +* better explanation of statistics +* accept 'v' and 'var', 'g' and 'group' +* better parsing of 'v','var' and 'g','group' +* don't allow too long group and variable names +* branch length distribution added +* better Makefile.cvs +* cmake option added +* updated INSTALL instructions +* '-march=native' is default when using cmake + +ver 1.1 -- 29/04/2009 +* Renamed to CryptoMiniSat + +ver 1.0 -- 15/04/2009 +* Some updated statistics! Now average rank of guessed var is shown diff --git a/packages/bee/cryptominisat-2.5.1/README b/packages/bee/cryptominisat-2.5.1/README new file mode 100755 index 000000000..8cd2d3731 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/README @@ -0,0 +1,152 @@ +CryptoMiniSat integrates a lot of advancements relative to MiniSat. +You can find these under the NEWS file. Here, we will explain how to +use the xor-clause and logging facilities of CryptoMiniSat: + +* Xor-clauses. If you want to express a xor, e.g. + + "var1 + var2 + !var3 = true" + + then you simply need to put into the sat file the line: + + "x1 2 -3 0". The "x" in + + front of the line means that this is a xor-clause clause. + +* Clause grouping. Usage: "-grouping" in command line. Used to give a + name to each and every clause. Useful if you wish to create meaningful + statistics. To use it, you must have after each and every clause a line + "c g GROUPNUM NAME". + Example: + + 161 18 20 -22 0 + c g 11 nice name + 161 -18 -20 0 + c g 11 nice name + 141 68 -66 74 0 + c g 234 somewhat nicer name + + These are three clauses. The first two belong to group 11, which has + the name "nice name". The third clause belongs to group 234, and is + named "somewhat nicer name". Grouping is important once you need to have + more than one clause to express the same concept. I.e. if you were describing + an equation in ANF (Algebraic Normal Form), you could easily give the same + group to the different clauses representing the same equation. You can find + examples of the usage in the "satfile" file under the "bulid" directory + +* Variable naming. In the CNF file, you have to add a line describing the + name of each variable. The lines must follow the pattern + "c v VAR NAME" + for each variable. Example: + + c v 36 sr[0][35] (real unknown) + + This sets variable number 36 to be named "sr[0][35] (real unknown)". + You can find examples of this in the "satfile" under the "build" + directory. I personally add the definition of all variables at the + end of my CNF file.s + +* Advanced statistics. The output of the sample satfile that is under + "/optimized/src/satfile" if running with statistics: + + -------------- + soos@charmille:$ ./cryptominisat -stats -grouping satfile + + [..printed data..] + + + +===========================================================+ + ||********* STATS FOR THIS RESTART BEGIN ******************|| + +===========================================================+ + +-----------------------------------------------------------+ + | No. times variable branched on | + |var var name no. times | + +-----------------------------------------------------------+ + |54 sr[0][65](real unknown) 1608 | + |45 sr[0][49](real unknown) 1480 | + |82 sr[0][43](real unknown) 1461 | + |66 sr[0][54](real unknown) 1420 | + |195 sr[0][59](real unknown) 1407 | + |218 sr[0][69](real unknown) 1318 | + |88 sr[0][57](real unknown) 1307 | + |223 sr[0][51](real unknown) 1260 | + |426 sr[0][70](real unknown) 1201 | + |236 sr[0][47](real unknown) 1149 | + |83 sr[0][56](real unknown) 1118 | + |43 sr[0][45](real unknown) 1050 | + |387 sr[0][74](real unknown) 1014 | + |46 sr[0][72](real unknown) 1012 | + |378 sr[0][55](real unknown) 975 | + |349 sr[0][58](real unknown) 890 | + |9 sr[0][66](real unknown) 889 | + |279 sr[0][44](real unknown) 841 | + |108 sr[0][61](real unknown) 841 | + |401 sr[0][42](real unknown) 820 | + +-----------------------------------------------------------+ + + This list means that variable 54, which represents the 65th bit + in the shift register has been branched upon 1608 times during the + solving. This, by the way, is logical, as we were trying to solve the + state of the stream cipher, which is of course the shift register's + state. + + The statistics also gives you the following for each restart + (minisat does re-starts every so often, these are the lines that + appear one after the other when you are running it): + + +-----------------------------------------------------------+ + | Advanced statistics | + +-----------------------------------------------------------+ + |No. branches visited 15585 | + |Avg. branch depth 84.81 | + |No. decisions 32755 | + |No. propagations 1151570 | + |sum decisions on branches/no. branches | + | (in a given branch, what is the avg. | + | no. of decisions?) 8.518 | + |sum propagations on branches/no. branches | + | (in a given branch, what is the | + | avg. no. of propagations?) 76.29 | + +-----------------------------------------------------------+ + + You can see, for example, that 8.52 + 76.29 = 84.81 so things add up. + + +* "-randomize=XXX" randomizes the clause order and initial variable pick order. + You can measure how much time it takes for minisat on average to solve a + problem written down in a SAT file. Useful to calculate average speed of a + given problem instance. Just run the problem with multiple "-randomize=xx" + numbers and make the average. + +* If you create a directory "proofs", and then you execute + "./minisat -proof-log -grouping satfile" + then CryptoMiniSat produces a set of files, named "NUM-proofX.dot" in the + "proofs" directory, where NUM is a fixed number for a given run, and X is + the restart number. For the example "satfile" under the "build" directory: + + $ ls proofs/ + 7491-proof0.dot + 7491-proof1.dot + 7491-proof2.dot + [...] + + First you need to get graphviz (free software, available form + http://www.graphviz.org/Download..php for both windows and linux). If you + now issue "dot -Tsvg 7491-proof1.dot > proof1.svg" and wait a couple of + minutes, you get a file "proof1.svg" that contains what happened at the 1st + restart (which is not really a restart, it's the first run: the 0th restart + is the inserting of clauses). This SVG file is included into this email + (zipped). You can view it only with a very good SVG-reader, like the + free-software inkscape ( http://www.inkscape.org/download/?lang=en ), + available under windows and linux. + +* There is an option to have a LOT of debugging output from CryptoMiniSat. To + turn it on, define VERBOSE_DEBUG. See the "INSTALL" file how to do this. + After re-compilation, run CryptoMiniSat as usual. This will give you a LOT + of information regarding what happens inside CryptoMiniSat. Propagations, + cancellations, conflicts, conflict clauses, etc. To handle the amount of + information, I suggest you to run CryptoMiniSat as: + + "./cryptominisat satfile > debug.txt" + + and then open the "debug.txt" with your favourite text editor. + (I use "less" if the file is gigabyte-sized files) diff --git a/packages/bee/cryptominisat-2.5.1/Solver/BitArray.h b/packages/bee/cryptominisat-2.5.1/Solver/BitArray.h new file mode 100755 index 000000000..4b03d9e4e --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/BitArray.h @@ -0,0 +1,187 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef BITARRAY_H +#define BITARRAY_H + +//#define DEBUG_BITARRAY + +#include +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +class BitArray +{ +public: + BitArray() : + size(0) + , mp(NULL) + { + } + + BitArray(const BitArray& b) : + size(b.size) + { + mp = new uint64_t[size]; + memcpy(mp, b.mp, sizeof(uint64_t)*size); + } + + BitArray& operator=(const BitArray& b) + { + if (size != b.size) { + delete[] mp; + size = b.size; + mp = new uint64_t[size]; + } + memcpy(mp, b.mp, sizeof(uint64_t)*size); + + return *this; + } + + BitArray& operator&=(const BitArray& b) + { + assert(size == b.size); + uint64_t* t1 = mp; + uint64_t* t2 = b.mp; + for (uint64_t i = 0; i < size; i++) { + *t1 &= *t2; + t1++; + t2++; + } + + return *this; + } + + const bool nothingInCommon(const BitArray& b) const + { + assert(size == b.size); + const uint64_t* t1 = mp; + const uint64_t* t2 = b.mp; + for (uint64_t i = 0; i < size; i++) { + if ((*t1)&(*t2)) return false; + t1++; + t2++; + } + + return true; + } + + BitArray& removeThese(const BitArray& b) + { + assert(size == b.size); + uint64_t* t1 = mp; + uint64_t* t2 = b.mp; + for (uint64_t i = 0; i < size; i++) { + *t1 &= ~(*t2); + t1++; + t2++; + } + + return *this; + } + + template + BitArray& removeThese(const T& rem) + { + for (uint32_t i = 0; i < rem.size(); i++) { + clearBit(rem[i]); + } + + return *this; + } + + void resize(uint _size, const bool fill) + { + _size = _size/64 + (bool)(_size%64); + if (size != _size) { + delete[] mp; + size = _size; + mp = new uint64_t[size]; + } + if (fill) setOne(); + else setZero(); + } + + ~BitArray() + { + delete[] mp; + } + + inline const bool isZero() const + { + const uint64_t* mp2 = (const uint64_t*)mp; + + for (uint i = 0; i < size; i++) { + if (mp2[i]) return false; + } + return true; + } + + inline void setZero() + { + memset(mp, 0, size*sizeof(uint64_t)); + } + + inline void setOne() + { + memset(mp, 0, size*sizeof(uint64_t)); + } + + inline void clearBit(const uint i) + { + #ifdef DEBUG_BITARRAY + assert(size*64 > i); + #endif + + mp[i/64] &= ~((uint64_t)1 << (i%64)); + } + + inline void setBit(const uint i) + { + #ifdef DEBUG_BITARRAY + assert(size*64 > i); + #endif + + mp[i/64] |= ((uint64_t)1 << (i%64)); + } + + inline const bool operator[](const uint& i) const + { + #ifdef DEBUG_BITARRAY + assert(size*64 > i); + #endif + + return (mp[i/64] >> (i%64)) & 1; + } + + inline const uint getSize() const + { + return size*64; + } + +private: + + uint size; + uint64_t* mp; +}; + +#endif //BITARRAY_H + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/BoundedQueue.h b/packages/bee/cryptominisat-2.5.1/Solver/BoundedQueue.h new file mode 100755 index 000000000..073b88ef6 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/BoundedQueue.h @@ -0,0 +1,82 @@ +/*****************************************************************************************[Queue.h] +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson + 2008 - Gilles Audemard, Laurent Simon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef BoundedQueue_h +#define BoundedQueue_h + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "Vec.h" + +//================================================================================================= + + +template +class bqueue { + vec elems; + int first; + int last; + uint64_t sumofqueue; + int maxsize; + int queuesize; // Number of current elements (must be < maxsize !) + +public: + bqueue(void) : first(0), last(0), sumofqueue(0), maxsize(0), queuesize(0) { } + + void initSize(int size) {growTo(size);} // Init size of bounded size queue + + void push(T x) { + if (queuesize==maxsize) { + assert(last==first); // The queue is full, next value to enter will replace oldest one + sumofqueue -= elems[last]; + if ((++last) == maxsize) last = 0; + } else + queuesize++; + sumofqueue += x; + elems[first] = x; + if ((++first) == maxsize) first = 0; + } + + T peek() { assert(queuesize>0); return elems[last]; } + void pop() {sumofqueue-=elems[last]; queuesize--; if ((++last) == maxsize) last = 0;} + + uint64_t getsum() const {return sumofqueue;} + uint32_t getavg() const {return (uint64_t)sumofqueue/(uint64_t)queuesize;} + int isvalid() const {return (queuesize==maxsize);} + + void growTo(int size) { + elems.growTo(size); + first=0; maxsize=size; queuesize = 0; + for(int i=0;i +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +class Clause; + +template +uint32_t calcAbstraction(const T& ps) { + uint32_t abstraction = 0; + for (uint32_t i = 0; i != ps.size(); i++) + abstraction |= 1 << (ps[i].toInt() & 31); + return abstraction; +} + +//#pragma pack(push) +//#pragma pack(1) +class ClauseSimp +{ + public: + ClauseSimp(Clause* c, const uint32_t _index) : + clause(c) + , index(_index) + {} + + Clause* clause; + uint32_t index; +}; +//#pragma pack(pop) + +class CSet { + vec where; // Map clause ID to position in 'which'. + vec which; // List of clauses (for fast iteration). May contain 'Clause_NULL'. + vec free; // List of positions holding 'Clause_NULL'. + + public: + //ClauseSimp& operator [] (uint32_t index) { return which[index]; } + void reserve(uint32_t size) { where.reserve(size);} + uint32_t size(void) const { return which.size(); } + uint32_t nElems(void) const { return which.size() - free.size(); } + + bool add(const ClauseSimp& c) { + assert(c.clause != NULL); + where.growTo(c.index+1, std::numeric_limits::max()); + if (where[c.index] != std::numeric_limits::max()) { + return true; + } + if (free.size() > 0){ + where[c.index] = free.last(); + which[free.last()] = c; + free.pop(); + }else{ + where[c.index] = which.size(); + which.push(c); + } + return false; + } + + bool exclude(const ClauseSimp& c) { + assert(c.clause != NULL); + if (c.index >= where.size() || where[c.index] == std::numeric_limits::max()) { + //not inside + return false; + } + free.push(where[c.index]); + which[where[c.index]].clause = NULL; + where[c.index] = std::numeric_limits::max(); + return true; + } + + void clear(void) { + for (uint32_t i = 0; i < which.size(); i++) { + if (which[i].clause != NULL) { + where[which[i].index] = std::numeric_limits::max(); + } + } + which.clear(); + free.clear(); + } + + class iterator + { + public: + iterator(ClauseSimp* _it) : + it(_it) + {} + + void operator++() + { + it++; + } + + const bool operator!=(const iterator& iter) const + { + return (it != iter.it);; + } + + ClauseSimp& operator*() { + return *it; + } + + ClauseSimp*& operator->() { + return it; + } + private: + ClauseSimp* it; + }; + + iterator begin() + { + return iterator(which.getData()); + } + + iterator end() + { + return iterator(which.getData() + which.size()); + } +}; + +#endif //CSET_H + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Clause.cpp b/packages/bee/cryptominisat-2.5.1/Solver/Clause.cpp new file mode 100755 index 000000000..e8a68b005 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Clause.cpp @@ -0,0 +1,9 @@ +#include "Clause.h" + +#ifdef USE_POOLS +#ifdef USE_4POOLS +boost::pool<> clausePoolQuad(sizeof(Clause) + 5*sizeof(Lit)); +#endif //USE_4POOLS +boost::pool<> clausePoolTri(sizeof(Clause) + 3*sizeof(Lit)); +boost::pool<> clausePoolBin(sizeof(Clause) + 2*sizeof(Lit)); +#endif //USE_POOLS diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Clause.h b/packages/bee/cryptominisat-2.5.1/Solver/Clause.h new file mode 100755 index 000000000..1e8637daf --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Clause.h @@ -0,0 +1,489 @@ +/***********************************************************************************[SolverTypes.h] +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef CLAUSE_H +#define CLAUSE_H + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER +#include +#include +#include +#include "Vec.h" +#include "SolverTypes.h" +#include "PackedRow.h" +#include "constants.h" +#include "SmallPtr.h" +#ifdef USE_POOLS +#include +#endif //USE_POOLS +#ifndef uint +#define uint unsigned int +#endif + +//#define USE_4POOLS + +using std::vector; + +//================================================================================================= +// Clause -- a simple class for representing a clause: + +class MatrixFinder; + +class Clause +{ +protected: + + #ifdef STATS_NEEDED + uint group; + #endif + + uint32_t isLearnt:1; + uint32_t strenghtened:1; + uint32_t varChanged:1; + uint32_t sorted:1; + uint32_t invertedXor:1; + uint32_t isXorClause:1; + uint32_t subsume0Done:1; + uint32_t isRemoved:1; + #ifdef USE_POOLS + uint32_t wasTriOriginallyInt:1; + uint32_t wasBinOriginallyInt:1; + #ifdef USE_4POOLS + uint32_t wasQuadOriginallyInt:1; + #endif //USE_4POOLS + #endif //USE_POOLS + uint32_t mySize:20; + + union {uint32_t act; uint32_t abst;} extra; + float oldActivityInter; + #ifdef _MSC_VER + Lit data[1]; + #else + Lit data[0]; + #endif //_MSC_VER + +#ifdef _MSC_VER +public: +#endif //_MSC_VER + template + Clause(const V& ps, const uint _group, const bool learnt) + { + isXorClause = false; + strenghtened = false; + sorted = false; + varChanged = true; + subsume0Done = false; + mySize = ps.size(); + isLearnt = learnt; + isRemoved = false; + setGroup(_group); + #ifdef USE_POOLS + setAllocSize(); + #endif //USE_POOLS + + for (uint i = 0; i < ps.size(); i++) data[i] = ps[i]; + if (learnt) { + extra.act = 0; + oldActivityInter = 0; + } else + calcAbstraction(); + } + +public: + #ifndef _MSC_VER + // -- use this function instead: + template + friend Clause* Clause_new(const T& ps, const uint group, const bool learnt); + friend Clause* Clause_new(Clause& c); + #endif //_MSC_VER + + const uint size () const { + return mySize; + } + void resize (const uint size) { + mySize = size; + } + void shrink (const uint i) { + assert(i <= size()); + mySize -= i; + } + void pop () { + shrink(1); + } + const bool isXor () { + return isXorClause; + } + const bool learnt () const { + return isLearnt; + } + float& oldActivity () { + return oldActivityInter; + } + + const float& oldActivity () const { + return oldActivityInter; + } + + + const bool getStrenghtened() const { + return strenghtened; + } + void setStrenghtened() { + strenghtened = true; + sorted = false; + subsume0Done = false; + } + void unsetStrenghtened() { + strenghtened = false; + } + const bool getVarChanged() const { + return varChanged; + } + void setVarChanged() { + varChanged = true; + sorted = false; + subsume0Done = false; + } + void unsetVarChanged() { + varChanged = false; + } + const bool getSorted() const { + return sorted; + } + void setSorted() { + sorted = true; + } + void setUnsorted() { + sorted = false; + } + void subsume0Finished() { + subsume0Done = 1; + } + const bool subsume0IsFinished() { + return subsume0Done; + } + + Lit& operator [] (uint32_t i) { + return data[i]; + } + const Lit& operator [] (uint32_t i) const { + return data[i]; + } + + void setActivity(uint32_t i) { + extra.act = i; + } + + const uint32_t& activity () const { + return extra.act; + } + + void makeNonLearnt() { + assert(isLearnt); + isLearnt = false; + calcAbstraction(); + } + + void makeLearnt(const uint32_t newActivity) { + extra.act = newActivity; + oldActivityInter = 0; + isLearnt = true; + } + + inline void strengthen(const Lit p) + { + remove(*this, p); + sorted = false; + calcAbstraction(); + } + + void calcAbstraction() { + assert(!learnt()); + extra.abst = 0; + for (uint32_t i = 0; i != size(); i++) + extra.abst |= 1 << (data[i].toInt() & 31); + } + + uint32_t getAbst() + { + return extra.abst; + } + + const Lit* getData () const { + return data; + } + Lit* getData () { + return data; + } + const Lit* getDataEnd () const { + return data+size(); + } + Lit* getDataEnd () { + return data+size(); + } + void print(FILE* to = stdout) { + plainPrint(to); + fprintf(to, "c clause learnt %s group %d act %d oldAct %f\n", (learnt() ? "yes" : "no"), getGroup(), activity(), oldActivity()); + } + void plainPrint(FILE* to = stdout) const { + for (uint i = 0; i < size(); i++) { + if (data[i].sign()) fprintf(to, "-"); + fprintf(to, "%d ", data[i].var() + 1); + } + fprintf(to, "0\n"); + } + #ifdef STATS_NEEDED + const uint32_t getGroup() const + { + return group; + } + void setGroup(const uint32_t _group) + { + group = _group; + } + #else + const uint getGroup() const + { + return 0; + } + void setGroup(const uint32_t _group) + { + return; + } + #endif //STATS_NEEDED + void setRemoved() { + isRemoved = true; + } + + const bool removed() const { + return isRemoved; + } + #ifdef USE_POOLS + const bool wasTriOriginally() const + { + return wasTriOriginallyInt; + } + const bool wasBinOriginally() const + { + return wasBinOriginallyInt; + } + #ifdef USE_4POOLS + const bool wasQuadOriginally() const + { + return wasQuadOriginallyInt; + } + #endif //USE_4POOLS + void setAllocSize() + { + wasTriOriginallyInt = false; + wasBinOriginallyInt = false; + #ifdef USE_4POOLS + wasQuadOriginallyInt = false; + #endif //USE_4POOLS + switch(size()) { + case 2: + wasBinOriginallyInt = true; + break; + case 3: + wasTriOriginallyInt = true; + break; + #ifdef USE_4POOLS + case 4: + wasQuadOriginallyInt = true; + break; + case 5: + wasQuadOriginallyInt = true; + break; + #endif //USE_4POOLS + } + } + #endif //USE_POOLS +}; + +class XorClause : public Clause +{ + +#ifdef _MSC_VER +public: +#else //_MSC_VER +protected: +#endif //_MSC_VER + + // NOTE: This constructor cannot be used directly (doesn't allocate enough memory). + template + XorClause(const V& ps, const bool inverted, const uint _group) : + Clause(ps, _group, false) + { + invertedXor = inverted; + isXorClause = true; + calcXorAbstraction(); + } + +public: + #ifndef _MSC_VER + // -- use this function instead: + template + friend XorClause* XorClause_new(const V& ps, const bool inverted, const uint group); + #endif //_MSC_VER + + inline bool xor_clause_inverted() const + { + return invertedXor; + } + inline void invert(bool b) + { + invertedXor ^= b; + } + void calcXorAbstraction() { + extra.abst = 0; + for (uint32_t i = 0; i != size(); i++) + extra.abst |= 1 << (data[i].var() & 31); + } + + void print() { + printf("XOR Clause group: %d, size: %d, learnt:%d, lits:\"", getGroup(), size(), learnt()); + plainPrint(); + } + + void plainPrint(FILE* to = stdout) const { + fprintf(to, "x"); + if (xor_clause_inverted()) + printf("-"); + for (uint i = 0; i < size(); i++) { + fprintf(to, "%d ", data[i].var() + 1); + } + fprintf(to, "0\n"); + } + + friend class MatrixFinder; +}; + +#ifdef USE_POOLS +extern boost::pool<> clausePoolTri; +extern boost::pool<> clausePoolBin; +#ifdef USE_4POOLS +extern boost::pool<> clausePoolQuad; +#endif //USE_4POOLS +#endif //USE_POOLS + +template +inline void* allocEnough(const T& ps) +{ + void* mem; + switch(ps.size()) { + #ifdef USE_POOLS + case 2: + mem = clausePoolBin.malloc(); + break; + case 3: + mem = clausePoolTri.malloc(); + break; + #ifdef USE_4POOLS + case 4: + mem = clausePoolQuad.malloc(); + break; + case 5: + mem = clausePoolQuad.malloc(); + break; + #endif //USE_4POOLS + #endif //USE_POOLS + default: + mem = malloc(sizeof(Clause) + sizeof(Lit)*(ps.size())); + break; + } + + return mem; +} + +template +Clause* Clause_new(const T& ps, const uint group, const bool learnt = false) +{ + void* mem = allocEnough(ps); + Clause* real= new (mem) Clause(ps, group, learnt); + return real; +} + +template +XorClause* XorClause_new(const T& ps, const bool inverted, const uint group) +{ + void* mem = allocEnough(ps); + XorClause* real= new (mem) XorClause(ps, inverted, group); + return real; +} + +inline Clause* Clause_new(Clause& c) +{ + void* mem = allocEnough(c); + //Clause* real= new (mem) Clause(ps, group, learnt); + memcpy(mem, &c, sizeof(Clause)+sizeof(Lit)*c.size()); + Clause& c2 = *(Clause*)mem; + #ifdef USE_POOLS + c2.setAllocSize(); + #endif //USE_POOLS + + return &c2; +} + +inline void clauseFree(Clause* c) +{ + #ifdef USE_POOLS + if (c->wasTriOriginally()) + clausePoolTri.free(c); + else if (c->wasBinOriginally()) + clausePoolBin.free(c); + #ifdef USE_4POOLS + else if (c->wasQuadOriginally()) + clausePoolQuad.free(c); + #endif //USE_4POOLS + else + #endif //USE_POOLS + free(c); +} + +#ifdef _MSC_VER +typedef Clause* ClausePtr; +typedef XorClause* XorClausePtr; +#else +typedef sptr ClausePtr; +typedef sptr XorClausePtr; +#endif //_MSC_VER + +#pragma pack(push) +#pragma pack(1) +class WatchedBin { + public: + WatchedBin(Clause *_clause, Lit _impliedLit) : clause(_clause), impliedLit(_impliedLit) {}; + ClausePtr clause; + Lit impliedLit; +}; + +class Watched { + public: + Watched(Clause *_clause, Lit _blockedLit) : clause(_clause), blockedLit(_blockedLit) {}; + ClausePtr clause; + Lit blockedLit; +}; +#pragma pack(pop) + +#endif //CLAUSE_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/ClauseCleaner.cpp b/packages/bee/cryptominisat-2.5.1/Solver/ClauseCleaner.cpp new file mode 100755 index 000000000..62ed21a5c --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/ClauseCleaner.cpp @@ -0,0 +1,416 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "ClauseCleaner.h" +#include "VarReplacer.h" + +#ifdef _MSC_VER +#define __builtin_prefetch(a,b,c) +#endif //_MSC_VER + +//#define DEBUG_CLEAN +//#define VERBOSE_DEBUG + +ClauseCleaner::ClauseCleaner(Solver& _solver) : + solver(_solver) +{ + for (uint i = 0; i < 6; i++) { + lastNumUnitarySat[i] = solver.get_unitary_learnts_num(); + lastNumUnitaryClean[i] = solver.get_unitary_learnts_num(); + } +} + +void ClauseCleaner::removeSatisfied(vec& cs, ClauseSetType type, const uint limit) +{ + #ifdef DEBUG_CLEAN + assert(solver.decisionLevel() == 0); + #endif + + if (lastNumUnitarySat[type] + limit >= solver.get_unitary_learnts_num()) + return; + + uint32_t i,j; + for (i = j = 0; i < cs.size(); i++) { + if (satisfied(*cs[i])) + solver.removeClause(*cs[i]); + else + cs[j++] = cs[i]; + } + cs.shrink(i - j); + + lastNumUnitarySat[type] = solver.get_unitary_learnts_num(); +} + +void ClauseCleaner::removeSatisfied(vec& cs, ClauseSetType type, const uint limit) +{ + #ifdef DEBUG_CLEAN + assert(solver.decisionLevel() == 0); + #endif + + if (lastNumUnitarySat[type] + limit >= solver.get_unitary_learnts_num()) + return; + + Clause **i,**j, **end; + for (i = j = cs.getData(), end = i + cs.size(); i != end; i++) { + if (i+1 != end) + __builtin_prefetch(*(i+1), 0, 0); + if (satisfied(**i)) + solver.removeClause(**i); + else + *j++ = *i; + } + cs.shrink(i - j); + + lastNumUnitarySat[type] = solver.get_unitary_learnts_num(); +} + +void ClauseCleaner::cleanClauses(vec& cs, ClauseSetType type, const uint limit) +{ + assert(solver.decisionLevel() == 0); + assert(solver.qhead == solver.trail.size()); + + if (lastNumUnitaryClean[type] + limit >= solver.get_unitary_learnts_num()) + return; + + #ifdef VERBOSE_DEBUG + std::cout << "Cleaning " << (type==binaryClauses ? "binaryClauses" : "normal clauses" ) << std::endl; + #endif //VERBOSE_DEBUG + + Clause **s, **ss, **end; + for (s = ss = cs.getData(), end = s + cs.size(); s != end;) { + if (s+1 != end) + __builtin_prefetch(*(s+1), 1, 0); + if (cleanClause(*s)) { + clauseFree(*s); + s++; + } else if (type != ClauseCleaner::binaryClauses && (*s)->size() == 2) { + solver.binaryClauses.push(*s); + solver.becameBinary++; + s++; + } else { + *ss++ = *s++; + } + } + cs.shrink(s-ss); + + lastNumUnitaryClean[type] = solver.get_unitary_learnts_num(); + + #ifdef VERBOSE_DEBUG + cout << "cleanClauses(Clause) useful ?? Removed: " << s-ss << endl; + #endif +} + +inline const bool ClauseCleaner::cleanClause(Clause*& cc) +{ + Clause& c = *cc; + + Lit origLit1 = c[0]; + Lit origLit2 = c[1]; + uint32_t origSize = c.size(); + + Lit *i, *j, *end; + for (i = j = c.getData(), end = i + c.size(); i != end; i++) { + lbool val = solver.value(*i); + if (val == l_Undef) { + *j++ = *i; + continue; + } + + if (val == l_True) { + solver.detachModifiedClause(origLit1, origLit2, origSize, &c); + return true; + } + } + c.shrink(i-j); + + if (i != j) { + c.setStrenghtened(); + if (c.size() == 2) { + solver.detachModifiedClause(origLit1, origLit2, origSize, &c); + Clause *c2 = Clause_new(c); + clauseFree(&c); + cc = c2; + solver.attachClause(*c2); + /*} else if (c.size() == 3) { + solver.detachModifiedClause(origLit1, origLit2, origSize, &c); + Clause *c2 = Clause_new(c); + clauseFree(&c); + cc = c2; + solver.attachClause(*c2);*/ + } else { + if (c.learnt()) + solver.learnts_literals -= i-j; + else + solver.clauses_literals -= i-j; + } + } + + return false; +} + +void ClauseCleaner::cleanClauses(vec& cs, ClauseSetType type, const uint limit) +{ + assert(solver.decisionLevel() == 0); + assert(solver.qhead == solver.trail.size()); + + if (lastNumUnitaryClean[type] + limit >= solver.get_unitary_learnts_num()) + return; + + XorClause **s, **ss, **end; + for (s = ss = cs.getData(), end = s + cs.size(); s != end; s++) { + if (s+1 != end) + __builtin_prefetch(*(s+1), 1, 0); + + #ifdef DEBUG_ATTACH + assert(find(solver.xorwatches[(**s)[0].var()], *s)); + assert(find(solver.xorwatches[(**s)[1].var()], *s)); + if (solver.assigns[(**s)[0].var()]!=l_Undef || solver.assigns[(**s)[1].var()]!=l_Undef) { + satisfied(**s); + } + #endif //DEBUG_ATTACH + + if (cleanClause(**s)) { + solver.freeLater.push(*s); + (*s)->setRemoved(); + } else { + #ifdef DEBUG_ATTACH + assert(find(solver.xorwatches[(**s)[0].var()], *s)); + assert(find(solver.xorwatches[(**s)[1].var()], *s)); + #endif //DEBUG_ATTACH + *ss++ = *s; + } + } + cs.shrink(s-ss); + + lastNumUnitaryClean[type] = solver.get_unitary_learnts_num(); + + #ifdef VERBOSE_DEBUG + cout << "cleanClauses(XorClause) useful: ?? Removed: " << s-ss << endl; + #endif +} + +inline const bool ClauseCleaner::cleanClause(XorClause& c) +{ + Lit *i, *j, *end; + Var origVar1 = c[0].var(); + Var origVar2 = c[1].var(); + uint32_t origSize = c.size(); + for (i = j = c.getData(), end = i + c.size(); i != end; i++) { + const lbool& val = solver.assigns[i->var()]; + if (val.isUndef()) { + *j = *i; + j++; + } else c.invert(val.getBool()); + } + c.shrink(i-j); + + assert(c.size() != 1); + switch (c.size()) { + case 0: { + solver.detachModifiedClause(origVar1, origVar2, origSize, &c); + return true; + } + case 2: { + c[0] = c[0].unsign(); + c[1] = c[1].unsign(); + solver.varReplacer->replace(c, c.xor_clause_inverted(), c.getGroup()); + solver.detachModifiedClause(origVar1, origVar2, origSize, &c); + return true; + } + default: { + if (i-j > 0) { + c.setStrenghtened(); + solver.clauses_literals -= i-j; + } + return false; + } + } + + assert(false); + return false; +} + +void ClauseCleaner::cleanClausesBewareNULL(vec& cs, ClauseCleaner::ClauseSetType type, Subsumer& subs, const uint limit) +{ + assert(solver.decisionLevel() == 0); + assert(solver.qhead == solver.trail.size()); + + if (lastNumUnitaryClean[type] + limit >= solver.get_unitary_learnts_num()) + return; + + ClauseSimp *s, *end; + for (s = cs.getData(), end = s + cs.size(); s != end; s++) { + if (s+1 != end) + __builtin_prefetch((s+1)->clause, 1, 0); + if (s->clause == NULL) + continue; + + if (cleanClauseBewareNULL(*s, subs)) { + continue; + } else if (s->clause->size() == 2) + solver.becameBinary++; + } + + lastNumUnitaryClean[type] = solver.get_unitary_learnts_num(); +} + +inline const bool ClauseCleaner::cleanClauseBewareNULL(ClauseSimp cc, Subsumer& subs) +{ + Clause& c = *cc.clause; + vec origClause(c.size()); + memcpy(origClause.getData(), c.getData(), sizeof(Lit)*c.size()); + + Lit *i, *j, *end; + for (i = j = c.getData(), end = i + c.size(); i != end; i++) { + lbool val = solver.value(*i); + if (val == l_Undef) { + *j++ = *i; + continue; + } + + if (val == l_True) { + subs.unlinkModifiedClause(origClause, cc); + clauseFree(cc.clause); + return true; + } + } + + if (i != j) { + c.setStrenghtened(); + if (origClause.size() > 2 && origClause.size()-(i-j) == 2) { + subs.unlinkModifiedClause(origClause, cc); + subs.clauses[cc.index] = cc; + c.shrink(i-j); + solver.attachClause(c); + subs.linkInAlreadyClause(cc); + } else { + c.shrink(i-j); + subs.unlinkModifiedClauseNoDetachNoNULL(origClause, cc); + subs.linkInAlreadyClause(cc); + if (c.learnt()) + solver.learnts_literals -= i-j; + else + solver.clauses_literals -= i-j; + } + c.calcAbstraction(); + subs.updateClause(cc); + } + + return false; +} + +void ClauseCleaner::cleanXorClausesBewareNULL(vec& cs, ClauseCleaner::ClauseSetType type, XorSubsumer& subs, const uint limit) +{ + assert(solver.decisionLevel() == 0); + assert(solver.qhead == solver.trail.size()); + + if (lastNumUnitaryClean[type] + limit >= solver.get_unitary_learnts_num()) + return; + + XorClauseSimp *s, *end; + for (s = cs.getData(), end = s + cs.size(); s != end; s++) { + if (s+1 != end) + __builtin_prefetch((s+1)->clause, 1, 0); + if (s->clause == NULL) + continue; + + cleanXorClauseBewareNULL(*s, subs); + } + + lastNumUnitaryClean[type] = solver.get_unitary_learnts_num(); +} + +inline const bool ClauseCleaner::cleanXorClauseBewareNULL(XorClauseSimp cc, XorSubsumer& subs) +{ + XorClause& c = *cc.clause; + vec origClause(c.size()); + memcpy(origClause.getData(), c.getData(), sizeof(Lit)*c.size()); + + Lit *i, *j, *end; + for (i = j = c.getData(), end = i + c.size(); i != end; i++) { + const lbool& val = solver.assigns[i->var()]; + if (val.isUndef()) { + *j = *i; + j++; + } else c.invert(val.getBool()); + } + c.shrink(i-j); + + switch(c.size()) { + case 0: { + subs.unlinkModifiedClause(origClause, cc); + clauseFree(cc.clause); + return true; + } + case 2: { + vec ps(2); + ps[0] = c[0].unsign(); + ps[1] = c[1].unsign(); + solver.varReplacer->replace(ps, c.xor_clause_inverted(), c.getGroup()); + subs.unlinkModifiedClause(origClause, cc); + clauseFree(cc.clause); + return true; + } + default: + if (i-j > 0) { + subs.unlinkModifiedClauseNoDetachNoNULL(origClause, cc); + subs.linkInAlreadyClause(cc); + c.calcXorAbstraction(); + } + } + + return false; +} + +bool ClauseCleaner::satisfied(const Clause& c) const +{ + for (uint i = 0; i != c.size(); i++) + if (solver.value(c[i]) == l_True) + return true; + return false; +} + +bool ClauseCleaner::satisfied(const XorClause& c) const +{ + bool final = c.xor_clause_inverted(); + for (uint k = 0; k != c.size(); k++ ) { + const lbool& val = solver.assigns[c[k].var()]; + if (val.isUndef()) return false; + final ^= val.getBool(); + } + return final; +} + +void ClauseCleaner::moveBinClausesToBinClauses() +{ + assert(solver.decisionLevel() == 0); + assert(solver.qhead == solver.trail.size()); + + vec& cs = solver.clauses; + Clause **s, **ss, **end; + for (s = ss = cs.getData(), end = s + cs.size(); s != end; s++) { + if (s+1 != end) + __builtin_prefetch(*(s+1), 1, 0); + + if ((**s).size() == 2) { + (**s).setUnsorted(); + solver.binaryClauses.push(*s); + } else + *ss++ = *s; + } + cs.shrink(s-ss); +} diff --git a/packages/bee/cryptominisat-2.5.1/Solver/ClauseCleaner.h b/packages/bee/cryptominisat-2.5.1/Solver/ClauseCleaner.h new file mode 100755 index 000000000..6d5ef8803 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/ClauseCleaner.h @@ -0,0 +1,75 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef CLAUSECLEANER_H +#define CLAUSECLEANER_H + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "Solver.h" +#include "Subsumer.h" +#include "XorSubsumer.h" + +class ClauseCleaner +{ + public: + ClauseCleaner(Solver& solver); + + enum ClauseSetType {clauses, xorclauses, learnts, binaryClauses, simpClauses, xorSimpClauses}; + + void cleanClauses(vec& cs, ClauseSetType type, const uint limit = 0); + void cleanClausesBewareNULL(vec& cs, ClauseSetType type, Subsumer& subs, const uint limit = 0); + void cleanXorClausesBewareNULL(vec& cs, ClauseSetType type, XorSubsumer& subs, const uint limit = 0); + const bool cleanClauseBewareNULL(ClauseSimp c, Subsumer& subs); + const bool cleanXorClauseBewareNULL(XorClauseSimp c, XorSubsumer& subs); + + void cleanClauses(vec& cs, ClauseSetType type, const uint limit = 0); + void removeSatisfied(vec& cs, ClauseSetType type, const uint limit = 0); + void removeSatisfied(vec& cs, ClauseSetType type, const uint limit = 0); + void removeAndCleanAll(const bool nolimit = false); + bool satisfied(const Clause& c) const; + bool satisfied(const XorClause& c) const; + + void moveBinClausesToBinClauses(); + + private: + const bool cleanClause(XorClause& c); + const bool cleanClause(Clause*& c); + + uint lastNumUnitarySat[6]; + uint lastNumUnitaryClean[6]; + + Solver& solver; +}; + +inline void ClauseCleaner::removeAndCleanAll(const bool nolimit) +{ + //uint limit = std::min((uint)((double)solver.order_heap.size() * PERCENTAGECLEANCLAUSES), FIXCLEANREPLACE); + uint limit = (double)solver.order_heap.size() * PERCENTAGECLEANCLAUSES; + if (nolimit) limit = 0; + + removeSatisfied(solver.binaryClauses, ClauseCleaner::binaryClauses, limit); + cleanClauses(solver.clauses, ClauseCleaner::clauses, limit); + cleanClauses(solver.xorclauses, ClauseCleaner::xorclauses, limit); + cleanClauses(solver.learnts, ClauseCleaner::learnts, limit); +} + +#endif //CLAUSECLEANER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/DoublePackedRow.h b/packages/bee/cryptominisat-2.5.1/Solver/DoublePackedRow.h new file mode 100755 index 000000000..50cfd8aee --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/DoublePackedRow.h @@ -0,0 +1,173 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef DOUBLEPACKEDROW_H +#define DOUBLEPACKEDROW_H + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include + +#include "SolverTypes.h" + +namespace MINISAT +{ +using namespace MINISAT; + +class DoublePackedRow +{ + private: + class BitIter { + public: + inline void operator=(const lbool toSet) + { + val &= ~((unsigned char)3 << offset); + val |= toSet.value << offset; + } + + inline operator lbool() const + { + return lbool((val >> offset) & 3); + } + + inline const bool isUndef() const { + return ((lbool)*this).isUndef(); + } + inline const bool isDef() const { + return ((lbool)*this).isDef(); + } + inline const bool getBool() const { + return ((lbool)*this).getBool(); + } + inline const bool operator==(lbool b) const { + return ((lbool)*this) == b; + } + inline const bool operator!=(lbool b) const { + return ((lbool)*this) != b; + } + const lbool operator^(const bool b) const { + return ((lbool)*this) ^ b; + } + + private: + friend class DoublePackedRow; + inline BitIter(unsigned char& mp, const uint32_t _offset) : + val(mp) + , offset(_offset) + {} + + unsigned char& val; + const uint32_t offset; + }; + + class BitIterConst { + public: + inline operator lbool() const + { + return lbool((val >> offset) & 3); + } + + inline const bool isUndef() const { + return ((lbool)*this).isUndef(); + } + inline const bool isDef() const { + return ((lbool)*this).isDef(); + } + inline const bool getBool() const { + return ((lbool)*this).getBool(); + } + inline const bool operator==(lbool b) const { + return ((lbool)*this) == b; + } + inline const bool operator!=(lbool b) const { + return ((lbool)*this) != b; + } + const lbool operator^(const bool b) const { + return ((lbool)*this) ^ b; + } + + + private: + friend class DoublePackedRow; + inline BitIterConst(unsigned char& mp, const uint32_t _offset) : + val(mp) + , offset(_offset) + {} + + const unsigned char& val; + const uint32_t offset; + }; + + public: + DoublePackedRow() : + numElems(0) + , mp(NULL) + {} + + uint32_t size() const + { + return numElems; + } + + void growTo(const uint32_t newNumElems) + { + uint32_t oldSize = numElems/4 + (bool)(numElems % 4); + uint32_t newSize = newNumElems/4 + (bool)(newNumElems % 4); + + if (oldSize >= newSize) { + numElems = std::max(newNumElems, numElems); + return; + } + + mp = (unsigned char*)realloc(mp, newSize*sizeof(unsigned char)); + numElems = newNumElems; + } + + inline BitIter operator[](const uint32_t at) + { + return BitIter(mp[at/4], (at%4)*2); + } + + inline const BitIterConst operator[](const uint32_t at) const + { + return BitIterConst(mp[at/4], (at%4)*2); + } + + inline void push(const lbool val) + { + growTo(numElems+1); + (*this)[numElems-1] = val; + } + + /*void clear(const uint32_t at) + { + mp[at/32] &= ~((uint64_t)3 << ((at%32)*2)); + }*/ + + private: + + Var numElems; + unsigned char *mp; +}; + +}; //NAMESPACE MINISAT + +#endif //DOUBLEPACKEDROW_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/FailedVarSearcher.cpp b/packages/bee/cryptominisat-2.5.1/Solver/FailedVarSearcher.cpp new file mode 100755 index 000000000..c58dfdb42 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/FailedVarSearcher.cpp @@ -0,0 +1,1049 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "FailedVarSearcher.h" + +#include +#include +#include +using std::make_pair; +using std::set; + +#include "Solver.h" +#include "ClauseCleaner.h" +#include "time_mem.h" +#include "VarReplacer.h" +#include "ClauseCleaner.h" +#include "StateSaver.h" + +#ifdef _MSC_VER +#define __builtin_prefetch(a,b,c) +#endif //_MSC_VER + +//#define VERBOSE_DEUBUG + +FailedVarSearcher::FailedVarSearcher(Solver& _solver): + solver(_solver) + , tmpPs(2) + , finishedLastTimeVar(true) + , lastTimeWentUntilVar(0) + , finishedLastTimeBin(true) + , lastTimeWentUntilBin(0) + , numPropsMultiplier(1.0) + , lastTimeFoundTruths(0) + , numCalls(0) +{ +} + +void FailedVarSearcher::addFromSolver(const vec< XorClause* >& cs) +{ + xorClauseSizes.clear(); + xorClauseSizes.growTo(cs.size()); + occur.resize(solver.nVars()); + for (Var var = 0; var < solver.nVars(); var++) { + occur[var].clear(); + } + + uint32_t i = 0; + for (XorClause * const*it = cs.getData(), * const*end = it + cs.size(); it != end; it++, i++) { + if (it+1 != end) + __builtin_prefetch(*(it+1), 0, 0); + + const XorClause& cl = **it; + xorClauseSizes[i] = cl.size(); + for (const Lit *l = cl.getData(), *end2 = l + cl.size(); l != end2; l++) { + occur[l->var()].push_back(i); + } + } +} + +inline void FailedVarSearcher::removeVarFromXors(const Var var) +{ + vector& occ = occur[var]; + if (occ.empty()) return; + + for (uint32_t *it = &occ[0], *end = it + occ.size(); it != end; it++) { + xorClauseSizes[*it]--; + if (!xorClauseTouched[*it]) { + xorClauseTouched.setBit(*it); + investigateXor.push(*it); + } + } +} + +inline void FailedVarSearcher::addVarFromXors(const Var var) +{ + vector& occ = occur[var]; + if (occ.empty()) return; + + for (uint32_t *it = &occ[0], *end = it + occ.size(); it != end; it++) { + xorClauseSizes[*it]++; + } +} + +const TwoLongXor FailedVarSearcher::getTwoLongXor(const XorClause& c) +{ + TwoLongXor tmp; + uint32_t num = 0; + tmp.inverted = c.xor_clause_inverted(); + + for(const Lit *l = c.getData(), *end = l + c.size(); l != end; l++) { + if (solver.assigns[l->var()] == l_Undef) { + assert(num < 2); + tmp.var[num] = l->var(); + num++; + } else { + tmp.inverted ^= (solver.assigns[l->var()] == l_True); + } + } + + #ifdef VERBOSE_DEUBUG + if (num != 2) { + std::cout << "Num:" << num << std::endl; + c.plainPrint(); + } + #endif + + std::sort(&tmp.var[0], &tmp.var[0]+2); + assert(num == 2); + return tmp; +} + +const bool FailedVarSearcher::search(uint64_t numProps) +{ + assert(solver.decisionLevel() == 0); + solver.testAllClauseAttach(); + double myTime = cpuTime(); + uint32_t origHeapSize = solver.order_heap.size(); + StateSaver savedState(solver); + Heap order_heap_copy(solver.order_heap); //for hyperbin + uint64_t origBinClauses = solver.binaryClauses.size(); + + if (solver.readdOldLearnts && !readdRemovedLearnts()) goto end; + + //General Stats + numFailed = 0; + goodBothSame = 0; + numCalls++; + + //If failed var searching is going good, do successively more and more of it + if (lastTimeFoundTruths > 500 || (double)lastTimeFoundTruths > (double)solver.order_heap.size() * 0.03) std::max(numPropsMultiplier*1.7, 5.0); + else numPropsMultiplier = 1.0; + numProps = (uint64_t) ((double)numProps * numPropsMultiplier *3); + + //For BothSame + propagated.resize(solver.nVars(), 0); + propValue.resize(solver.nVars(), 0); + + //For calculating how many variables have really been set + origTrailSize = solver.trail.size(); + + //For 2-long xor (rule 6 of Equivalent literal propagation in the DLL procedure by Chu-Min Li) + toReplaceBefore = solver.varReplacer->getNewToReplaceVars(); + lastTrailSize = solver.trail.size(); + binXorFind = true; + twoLongXors.clear(); + if (solver.xorclauses.size() < 5 || + solver.xorclauses.size() > 30000 || + solver.order_heap.size() > 30000 || + solver.nClauses() > 100000) + binXorFind = false; + if (binXorFind) { + solver.clauseCleaner->cleanClauses(solver.xorclauses, ClauseCleaner::xorclauses); + addFromSolver(solver.xorclauses); + } + xorClauseTouched.resize(solver.xorclauses.size(), 0); + newBinXor = 0; + + //For 2-long xor through Le Berre paper + bothInvert = 0; + + //For HyperBin + unPropagatedBin.resize(solver.nVars(), 0); + myimplies.resize(solver.nVars(), 0); + hyperbinProps = 0; + if (solver.addExtraBins && !orderLits()) return false; + maxHyperBinProps = numProps/8; + + //uint32_t fromBin; + uint32_t fromVar; + if (finishedLastTimeVar || lastTimeWentUntilVar >= solver.nVars()) + fromVar = 0; + else + fromVar = lastTimeWentUntilVar; + finishedLastTimeVar = true; + lastTimeWentUntilVar = solver.nVars(); + origProps = solver.propagations; + for (Var var = fromVar; var < solver.nVars(); var++) { + if (solver.assigns[var] != l_Undef || !solver.decision_var[var]) + continue; + if (solver.propagations - origProps >= numProps) { + finishedLastTimeVar = false; + lastTimeWentUntilVar = var; + break; + } + if (!tryBoth(Lit(var, false), Lit(var, true))) + goto end; + } + + numProps = (double)numProps * 1.2; + hyperbinProps = 0; + while (!order_heap_copy.empty()) { + Var var = order_heap_copy.removeMin(); + if (solver.assigns[var] != l_Undef || !solver.decision_var[var]) + continue; + if (solver.propagations - origProps >= numProps) { + finishedLastTimeVar = false; + lastTimeWentUntilVar = var; + break; + } + if (!tryBoth(Lit(var, false), Lit(var, true))) + goto end; + } + + /*if (solver.verbosity >= 1) printResults(myTime); + if (finishedLastTimeBin || lastTimeWentUntilBin >= solver.binaryClauses.size()) + fromBin = 0; + else + fromBin = lastTimeWentUntilBin; + finishedLastTimeBin = true; + lastTimeWentUntilBin = solver.nVars(); + for (uint32_t binCl = 0; binCl < solver.binaryClauses.size(); binCl++) { + if ((double)(solver.propagations - origProps) >= 1.1*(double)numProps) { + finishedLastTimeBin = false; + lastTimeWentUntilBin = binCl; + break; + } + + Clause& cl = *solver.binaryClauses[binCl]; + if (solver.value(cl[0]) == l_Undef && solver.value(cl[1]) == l_Undef) { + if (!tryBoth(cl[0], cl[1])) + goto end; + } + }*/ + + /*for (Clause **it = solver.clauses.getData(), **end = solver.clauses.getDataEnd(); it != end; it++) { + Clause& c = **it; + for (uint i = 0; i < c.size(); i++) { + if (solver.value(c[i]) != l_Undef) goto next; + } + if (!tryAll(c.getData(), c.getDataEnd())) + goto end; + + next:; + } + + for (Clause **it = solver.learnts.getData(), **end = solver.learnts.getDataEnd(); it != end; it++) { + Clause& c = **it; + for (uint i = 0; i < c.size(); i++) { + if (solver.value(c[i]) != l_Undef) goto next2; + } + if (!tryAll(c.getData(), c.getDataEnd())) + goto end; + + next2:; + }*/ + +end: + bool removedOldLearnts = false; + binClauseAdded = solver.binaryClauses.size() - origBinClauses; + //Print results + if (solver.verbosity >= 1) printResults(myTime); + + solver.order_heap.filter(Solver::VarFilter(solver)); + + if (solver.ok && (numFailed || goodBothSame)) { + double time = cpuTime(); + if ((int)origHeapSize - (int)solver.order_heap.size() > (int)origHeapSize/15 && solver.nClauses() + solver.learnts.size() > 500000) { + completelyDetachAndReattach(); + removedOldLearnts = true; + } else { + solver.clauseCleaner->removeAndCleanAll(); + } + if (solver.verbosity >= 1 && numFailed + goodBothSame > 100) { + std::cout << "c | Cleaning up after failed var search: " << std::setw(8) << std::fixed << std::setprecision(2) << cpuTime() - time << " s " + << std::setw(39) << " | " << std::endl; + } + } + + if (solver.ok && solver.readdOldLearnts && !removedOldLearnts) { + if (solver.removedLearnts.size() < 100000) { + removeOldLearnts(); + } else { + completelyDetachAndReattach(); + } + } + + lastTimeFoundTruths = solver.trail.size() - origTrailSize; + + savedState.restore(); + + solver.testAllClauseAttach(); + return solver.ok; +} + +void FailedVarSearcher::completelyDetachAndReattach() +{ + solver.clauses_literals = 0; + solver.learnts_literals = 0; + for (uint32_t i = 0; i < solver.nVars(); i++) { + solver.binwatches[i*2].clear(); + solver.binwatches[i*2+1].clear(); + solver.watches[i*2].clear(); + solver.watches[i*2+1].clear(); + solver.xorwatches[i].clear(); + } + solver.varReplacer->reattachInternalClauses(); + cleanAndAttachClauses(solver.binaryClauses); + cleanAndAttachClauses(solver.clauses); + cleanAndAttachClauses(solver.learnts); + cleanAndAttachClauses(solver.xorclauses); +} + +void FailedVarSearcher::printResults(const double myTime) const +{ + std::cout << "c | Flit: "<< std::setw(5) << numFailed << + " Blit: " << std::setw(6) << goodBothSame << + " bXBeca: " << std::setw(4) << newBinXor << + " bXProp: " << std::setw(4) << bothInvert << + " Bins:" << std::setw(7) << binClauseAdded << + " P: " << std::setw(4) << std::fixed << std::setprecision(1) << (double)(solver.propagations - origProps)/1000000.0 << "M" + " T: " << std::setw(5) << std::fixed << std::setprecision(2) << cpuTime() - myTime << + std::setw(5) << " |" << std::endl; +} + +const bool FailedVarSearcher::orderLits() +{ + uint64_t oldProps = solver.propagations; + double myTime = cpuTime(); + uint32_t numChecked = 0; + if (litDegrees.size() != solver.nVars()) + litDegrees.resize(solver.nVars()*2, 0); + BitArray alreadyTested; + alreadyTested.resize(solver.nVars()*2, 0); + uint32_t i; + + for (i = 0; i < 3*solver.order_heap.size(); i++) { + if (solver.propagations - oldProps > 1500000) break; + Var var = solver.order_heap[solver.mtrand.randInt(solver.order_heap.size()-1)]; + if (solver.assigns[var] != l_Undef || !solver.decision_var[var]) continue; + + Lit randLit(var, solver.mtrand.randInt(1)); + if (alreadyTested[randLit.toInt()]) continue; + alreadyTested.setBit(randLit.toInt()); + + numChecked++; + solver.newDecisionLevel(); + solver.uncheckedEnqueueLight(randLit); + failed = (solver.propagateBin() != NULL); + if (failed) { + solver.cancelUntil(0); + solver.uncheckedEnqueue(~randLit); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) return false; + continue; + } + assert(solver.decisionLevel() > 0); + for (int c = solver.trail.size()-1; c > (int)solver.trail_lim[0]; c--) { + Lit x = solver.trail[c]; + litDegrees[x.toInt()]++; + } + solver.cancelUntil(0); + } + if (solver.verbosity >= 1) { + std::cout << "c binary deg approx." + << " time: " << std::fixed << std::setw(5) << std::setprecision(2) << cpuTime() - myTime << " s" + << " num checked: " << std::setw(6) << numChecked + << " i: " << std::setw(7) << i + << " props: " << std::setw(4) << (solver.propagations - oldProps)/1000 << "k" + << std::setw(13) << " |" << std::endl; + } + solver.propagations = oldProps; + + return true; +} + +void FailedVarSearcher::removeOldLearnts() +{ + for (Clause **it = solver.removedLearnts.getData(), **end = solver.removedLearnts.getDataEnd(); it != end; it++) { + solver.detachClause(**it); + } +} + +struct reduceDB_ltOldLearnt +{ + bool operator () (const Clause* x, const Clause* y) { + return x->size() > y->size(); + } +}; + +const bool FailedVarSearcher::readdRemovedLearnts() +{ + uint32_t toRemove = (solver.removedLearnts.size() > MAX_OLD_LEARNTS) ? (solver.removedLearnts.size() - MAX_OLD_LEARNTS/4) : 0; + if (toRemove > 0) + std::sort(solver.removedLearnts.getData(), solver.removedLearnts.getDataEnd(), reduceDB_ltOldLearnt()); + + Clause **it1, **it2; + it1 = it2 = solver.removedLearnts.getData(); + for (Clause **end = solver.removedLearnts.getDataEnd(); it1 != end; it1++) { + if (toRemove > 0) { + clauseFree(*it1); + toRemove--; + continue; + } + + Clause* c = solver.addClauseInt(**it1, (**it1).getGroup()); + clauseFree(*it1); + if (c != NULL) { + *it2 = c; + it2++; + } + if (!solver.ok) { + it1++; + for (; it1 != end; it1++) clauseFree(*it1); + } + } + solver.removedLearnts.shrink(it1-it2); + //std::cout << "Readded old learnts. New facts:" << (int)origHeapSize - (int)solver.order_heap.size() << std::endl; + + return solver.ok; +} + +#define MAX_REMOVE_BIN_FULL_PROPS 20000000 +#define EXTRATIME_DIVIDER 3 + +template +const bool FailedVarSearcher::removeUslessBinFull() +{ + if (!solver.performReplace) return true; + while (solver.performReplace && solver.varReplacer->getClauses().size() > 0) { + if (!solver.varReplacer->performReplace(true)) return false; + solver.clauseCleaner->removeAndCleanAll(true); + } + assert(solver.varReplacer->getClauses().size() == 0); + solver.testAllClauseAttach(); + if (startUp) { + solver.clauseCleaner->moveBinClausesToBinClauses(); + } + + double myTime = cpuTime(); + toDeleteSet.clear(); + toDeleteSet.growTo(solver.nVars()*2, 0); + uint32_t origHeapSize = solver.order_heap.size(); + uint64_t origProps = solver.propagations; + bool fixed = false; + uint32_t extraTime = solver.binaryClauses.size() / EXTRATIME_DIVIDER; + + uint32_t startFrom = solver.mtrand.randInt(solver.order_heap.size()); + for (uint32_t i = 0; i != solver.order_heap.size(); i++) { + Var var = solver.order_heap[(i+startFrom)%solver.order_heap.size()]; + if (solver.propagations - origProps + extraTime > MAX_REMOVE_BIN_FULL_PROPS) break; + if (solver.assigns[var] != l_Undef || !solver.decision_var[var]) continue; + + Lit lit(var, true); + if (!removeUselessBinaries(lit)) { + fixed = true; + solver.cancelUntil(0); + solver.uncheckedEnqueue(~lit); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) return false; + continue; + } + + lit = ~lit; + if (!removeUselessBinaries(lit)) { + fixed = true; + solver.cancelUntil(0); + solver.uncheckedEnqueue(~lit); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) return false; + continue; + } + } + + Clause **i, **j; + i = j = solver.binaryClauses.getData(); + uint32_t num = 0; + for (Clause **end = solver.binaryClauses.getDataEnd(); i != end; i++, num++) { + if (!(*i)->removed()) { + *j++ = *i; + } else { + clauseFree(*i); + } + } + uint32_t removedUselessBin = i - j; + solver.binaryClauses.shrink(i - j); + + if (fixed) solver.order_heap.filter(Solver::VarFilter(solver)); + + if (solver.verbosity >= 1) { + std::cout + << "c Removed useless bin:" << std::setw(8) << removedUselessBin + << " fixed: " << std::setw(5) << (origHeapSize - solver.order_heap.size()) + << " props: " << std::fixed << std::setprecision(2) << std::setw(6) << (double)(solver.propagations - origProps)/1000000.0 << "M" + << " time: " << std::fixed << std::setprecision(2) << std::setw(5) << cpuTime() - myTime << " s" + << std::setw(16) << " |" << std::endl; + } + + return true; +} + +const bool FailedVarSearcher::tryBoth(const Lit lit1, const Lit lit2) +{ + if (binXorFind) { + if (lastTrailSize < solver.trail.size()) { + for (uint32_t i = lastTrailSize; i != solver.trail.size(); i++) { + removeVarFromXors(solver.trail[i].var()); + } + } + lastTrailSize = solver.trail.size(); + xorClauseTouched.setZero(); + investigateXor.clear(); + } + + propagated.setZero(); + twoLongXors.clear(); + propagatedVars.clear(); + unPropagatedBin.setZero(); + bothSame.clear(); + + solver.newDecisionLevel(); + solver.uncheckedEnqueueLight(lit1); + failed = (solver.propagateLight() != NULL); + if (failed) { + solver.cancelUntil(0); + numFailed++; + solver.uncheckedEnqueue(~lit1); + solver.ok = (solver.propagate(false) == NULL); + if (!solver.ok) return false; + return true; + } else { + assert(solver.decisionLevel() > 0); + for (int c = solver.trail.size()-1; c >= (int)solver.trail_lim[0]; c--) { + Var x = solver.trail[c].var(); + propagated.setBit(x); + if (solver.addExtraBins) { + unPropagatedBin.setBit(x); + propagatedVars.push(x); + } + if (solver.assigns[x].getBool()) propValue.setBit(x); + else propValue.clearBit(x); + + if (binXorFind) removeVarFromXors(x); + } + + if (binXorFind) { + for (uint32_t *it = investigateXor.getData(), *end = investigateXor.getDataEnd(); it != end; it++) { + if (xorClauseSizes[*it] == 2) + twoLongXors.insert(getTwoLongXor(*solver.xorclauses[*it])); + } + for (int c = solver.trail.size()-1; c >= (int)solver.trail_lim[0]; c--) { + addVarFromXors(solver.trail[c].var()); + } + xorClauseTouched.setZero(); + investigateXor.clear(); + } + + solver.cancelUntil(0); + } + + if (solver.addExtraBins && hyperbinProps < maxHyperBinProps) addBinClauses(lit1); + propagatedVars.clear(); + unPropagatedBin.setZero(); + + solver.newDecisionLevel(); + solver.uncheckedEnqueueLight(lit2); + failed = (solver.propagateLight() != NULL); + if (failed) { + solver.cancelUntil(0); + numFailed++; + solver.uncheckedEnqueue(~lit2); + solver.ok = (solver.propagate(false) == NULL); + if (!solver.ok) return false; + return true; + } else { + assert(solver.decisionLevel() > 0); + for (int c = solver.trail.size()-1; c >= (int)solver.trail_lim[0]; c--) { + Var x = solver.trail[c].var(); + if (propagated[x]) { + if (solver.addExtraBins) { + unPropagatedBin.setBit(x); + propagatedVars.push(x); + } + if (propValue[x] == solver.assigns[x].getBool()) { + //they both imply the same + bothSame.push(Lit(x, !propValue[x])); + } else if (c != (int)solver.trail_lim[0]) { + bool invert; + if (lit1.var() == lit2.var()) { + assert(lit1.sign() == false && lit2.sign() == true); + tmpPs[0] = Lit(lit1.var(), false); + tmpPs[1] = Lit(x, false); + invert = propValue[x]; + } else { + tmpPs[0] = Lit(lit1.var(), false); + tmpPs[1] = Lit(lit2.var(), false); + invert = lit1.sign() ^ lit2.sign(); + } + if (!solver.varReplacer->replace(tmpPs, invert, 0)) + return false; + bothInvert += solver.varReplacer->getNewToReplaceVars() - toReplaceBefore; + toReplaceBefore = solver.varReplacer->getNewToReplaceVars(); + } + } + if (solver.assigns[x].getBool()) propValue.setBit(x); + else propValue.clearBit(x); + if (binXorFind) removeVarFromXors(x); + } + + if (binXorFind) { + if (twoLongXors.size() > 0) { + for (uint32_t *it = investigateXor.getData(), *end = it + investigateXor.size(); it != end; it++) { + if (xorClauseSizes[*it] == 2) { + TwoLongXor tmp = getTwoLongXor(*solver.xorclauses[*it]); + if (twoLongXors.find(tmp) != twoLongXors.end()) { + tmpPs[0] = Lit(tmp.var[0], false); + tmpPs[1] = Lit(tmp.var[1], false); + if (!solver.varReplacer->replace(tmpPs, tmp.inverted, solver.xorclauses[*it]->getGroup())) + return false; + newBinXor += solver.varReplacer->getNewToReplaceVars() - toReplaceBefore; + toReplaceBefore = solver.varReplacer->getNewToReplaceVars(); + } + } + } + } + for (int c = solver.trail.size()-1; c >= (int)solver.trail_lim[0]; c--) { + addVarFromXors(solver.trail[c].var()); + } + } + + solver.cancelUntil(0); + } + + if (solver.addExtraBins && hyperbinProps < maxHyperBinProps) addBinClauses(lit2); + + for(uint32_t i = 0; i != bothSame.size(); i++) { + solver.uncheckedEnqueue(bothSame[i]); + } + goodBothSame += bothSame.size(); + solver.ok = (solver.propagate(false) == NULL); + if (!solver.ok) return false; + + return true; +} + +struct litOrder +{ + litOrder(const vector& _litDegrees) : + litDegrees(_litDegrees) + {} + + bool operator () (const Lit& x, const Lit& y) { + return litDegrees[x.toInt()] > litDegrees[y.toInt()]; + } + + const vector& litDegrees; +}; + +void FailedVarSearcher::addBinClauses(const Lit& lit) +{ + uint64_t oldProps = solver.propagations; + #ifdef VERBOSE_DEBUG + std::cout << "Checking one BTC vs UP" << std::endl; + #endif //VERBOSE_DEBUG + vec toVisit; + + solver.newDecisionLevel(); + solver.uncheckedEnqueueLight(lit); + failed = (solver.propagateBin() != NULL); + assert(!failed); + + assert(solver.decisionLevel() > 0); + if (propagatedVars.size() - (solver.trail.size()-solver.trail_lim[0]) == 0) { + solver.cancelUntil(0); + goto end; + } + for (int c = solver.trail.size()-1; c >= (int)solver.trail_lim[0]; c--) { + Lit x = solver.trail[c]; + unPropagatedBin.clearBit(x.var()); + toVisit.push(x); + } + solver.cancelUntil(0); + + std::sort(toVisit.getData(), toVisit.getDataEnd(), litOrder(litDegrees)); + /************************* + //To check that the ordering is the right way + // --> i.e. to avoid mistake present in Glucose's ordering + for (uint32_t i = 0; i < toVisit.size(); i++) { + std::cout << "i:" << std::setw(8) << i << " degree:" << litDegrees[toVisit[i].toInt()] << std::endl; + } + std::cout << std::endl; + ***************************/ + + //difference between UP and BTC is in unPropagatedBin + for (Lit *l = toVisit.getData(), *end = toVisit.getDataEnd(); l != end; l++) { + #ifdef VERBOSE_DEBUG + std::cout << "Checking visit level " << end-l-1 << std::endl; + uint32_t thisLevel = 0; + #endif //VERBOSE_DEBUG + fillImplies(*l); + if (unPropagatedBin.nothingInCommon(myimplies)) goto next; + for (const Var *var = propagatedVars.getData(), *end2 = propagatedVars.getDataEnd(); var != end2; var++) { + if (unPropagatedBin[*var] && myimplies[*var]) { + #ifdef VERBOSE_DEBUG + thisLevel++; + #endif //VERBOSE_DEBUG + addBin(~*l, Lit(*var, !propValue[*var])); + unPropagatedBin.removeThese(myImpliesSet); + if (unPropagatedBin.isZero()) { + myimplies.removeThese(myImpliesSet); + myImpliesSet.clear(); + goto end; + } + } + } + next: + myimplies.removeThese(myImpliesSet); + myImpliesSet.clear(); + #ifdef VERBOSE_DEBUG + if (thisLevel > 0) { + std::cout << "Added " << thisLevel << " level diff:" << end-l-1 << std::endl; + } + #endif //VERBOSE_DEBUG + } + assert(unPropagatedBin.isZero()); + + end: + hyperbinProps += solver.propagations - oldProps; +} + +void FailedVarSearcher::fillImplies(const Lit& lit) +{ + solver.newDecisionLevel(); + solver.uncheckedEnqueue(lit); + failed = (solver.propagateLight() != NULL); + assert(!failed); + + assert(solver.decisionLevel() > 0); + for (int c = solver.trail.size()-1; c >= (int)solver.trail_lim[0]; c--) { + Lit x = solver.trail[c]; + myimplies.setBit(x.var()); + myImpliesSet.push(x.var()); + } + solver.cancelUntil(0); +} + +template +const bool FailedVarSearcher::fillBinImpliesMinusLast(const Lit& origLit, const Lit& lit, vec& wrong) +{ + solver.newDecisionLevel(); + solver.uncheckedEnqueueLight(lit); + //if it's a cycle, it doesn't work, so don't propagate origLit + failed = (solver.propagateBinExcept(origLit) != NULL); + if (failed) return false; + + assert(solver.decisionLevel() > 0); + int c; + extraTime += (solver.trail.size() - solver.trail_lim[0]) / EXTRATIME_DIVIDER; + for (c = solver.trail.size()-1; c > (int)solver.trail_lim[0]; c--) { + Lit x = solver.trail[c]; + if (toDeleteSet[x.toInt()]) { + wrong.push(x); + toDeleteSet[x.toInt()] = false; + }; + solver.assigns[x.var()] = l_Undef; + } + solver.assigns[solver.trail[c].var()] = l_Undef; + + solver.qhead = solver.trail_lim[0]; + solver.trail.shrink_(solver.trail.size() - solver.trail_lim[0]); + solver.trail_lim.clear(); + //solver.cancelUntil(0); + + return true; +} + +void FailedVarSearcher::addBin(const Lit& lit1, const Lit& lit2) +{ + #ifdef VERBOSE_DEBUG + std::cout << "Adding extra bin: "; + lit1.print(); std::cout << " "; lit2.printFull(); + #endif //VERBOSE_DEBUG + + tmpPs[0] = lit1; + tmpPs[1] = lit2; + solver.addLearntClause(tmpPs, 0, 0); + tmpPs.growTo(2); + assert(solver.ok); +} + +template +const bool FailedVarSearcher::removeUselessBinaries(const Lit& lit) +{ + //Nothing can be learnt at this point! + //Otherwise, it might happen that the path to X has learnts, + //but binary clause to X is not learnt. + //So we remove X , then we might remove + //the path (since it's learnt) -- removing a FACT!! + //[note:removal can be through variable elimination + //, and removeWrong() will happily remove it + assert(!startUp || solver.learnts.size() == 0); + + solver.newDecisionLevel(); + solver.uncheckedEnqueueLight(lit); + failed = (solver.propagateBinOneLevel() != NULL); + if (failed) return false; + bool ret = true; + + oneHopAway.clear(); + assert(solver.decisionLevel() > 0); + int c; + if (solver.trail.size()-solver.trail_lim[0] == 0) { + solver.cancelUntil(0); + goto end; + } + extraTime += (solver.trail.size() - solver.trail_lim[0]) / EXTRATIME_DIVIDER; + for (c = solver.trail.size()-1; c > (int)solver.trail_lim[0]; c--) { + Lit x = solver.trail[c]; + toDeleteSet[x.toInt()] = true; + oneHopAway.push(x); + solver.assigns[x.var()] = l_Undef; + } + solver.assigns[solver.trail[c].var()] = l_Undef; + + solver.qhead = solver.trail_lim[0]; + solver.trail.shrink_(solver.trail.size() - solver.trail_lim[0]); + solver.trail_lim.clear(); + //solver.cancelUntil(0); + + wrong.clear(); + for(uint32_t i = 0; i < oneHopAway.size(); i++) { + //no need to visit it if it already queued for removal + //basically, we check if it's in 'wrong' + if (toDeleteSet[oneHopAway[i].toInt()]) { + if (!fillBinImpliesMinusLast(lit, oneHopAway[i], wrong)) { + ret = false; + goto end; + } + } + } + + for (uint32_t i = 0; i < wrong.size(); i++) { + removeBin(~lit, wrong[i]); + } + + end: + for(uint32_t i = 0; i < oneHopAway.size(); i++) { + toDeleteSet[oneHopAway[i].toInt()] = false; + } + + return ret; +} +template const bool FailedVarSearcher::removeUselessBinaries (const Lit& lit); +template const bool FailedVarSearcher::removeUselessBinaries (const Lit& lit); +template const bool FailedVarSearcher::fillBinImpliesMinusLast (const Lit& origLit, const Lit& lit, vec& wrong); +template const bool FailedVarSearcher::fillBinImpliesMinusLast (const Lit& origLit, const Lit& lit, vec& wrong); +template const bool FailedVarSearcher::removeUslessBinFull (); +template const bool FailedVarSearcher::removeUslessBinFull (); + +void FailedVarSearcher::removeBin(const Lit& lit1, const Lit& lit2) +{ + /******************* + Lit litFind1 = lit_Undef; + Lit litFind2 = lit_Undef; + + if (solver.binwatches[(~lit1).toInt()].size() < solver.binwatches[(~lit2).toInt()].size()) { + litFind1 = lit1; + litFind2 = lit2; + } else { + litFind1 = lit2; + litFind2 = lit1; + } + ********************/ + + //Find AND remove from watches + vec& bwin = solver.binwatches[(~lit1).toInt()]; + extraTime += bwin.size() / EXTRATIME_DIVIDER; + Clause *cl = NULL; + WatchedBin *i, *j; + i = j = bwin.getData(); + for (const WatchedBin *end = bwin.getDataEnd(); i != end; i++) { + if (i->impliedLit == lit2 && cl == NULL) { + cl = i->clause; + } else { + *j++ = *i; + } + } + bwin.shrink(1); + assert(cl != NULL); + + bool found = false; + vec& bwin2 = solver.binwatches[(~lit2).toInt()]; + extraTime += bwin2.size() / EXTRATIME_DIVIDER; + i = j = bwin2.getData(); + for (const WatchedBin *end = bwin2.getDataEnd(); i != end; i++) { + if (i->clause == cl) { + found = true; + } else { + *j++ = *i; + } + } + bwin2.shrink(1); + assert(found); + + #ifdef VERBOSE_DEBUG + std::cout << "Removing useless bin: "; + cl->plainPrint(); + #endif //VERBOSE_DEBUG + + cl->setRemoved(); + solver.clauses_literals -= 2; +} + +template +inline void FailedVarSearcher::cleanAndAttachClauses(vec& cs) +{ + T **i = cs.getData(); + T **j = i; + for (T **end = cs.getDataEnd(); i != end; i++) { + if (cleanClause(**i)) { + solver.attachClause(**i); + *j++ = *i; + } else { + clauseFree(*i); + } + } + cs.shrink(i-j); +} + +inline const bool FailedVarSearcher::cleanClause(Clause& ps) +{ + uint32_t origSize = ps.size(); + + Lit *i = ps.getData(); + Lit *j = i; + for (Lit *end = ps.getDataEnd(); i != end; i++) { + if (solver.value(*i) == l_True) return false; + if (solver.value(*i) == l_Undef) { + *j++ = *i; + } + } + ps.shrink(i-j); + assert(ps.size() > 1); + + if (ps.size() != origSize) ps.setStrenghtened(); + if (origSize != 2 && ps.size() == 2) + solver.becameBinary++; + + return true; +} + +inline const bool FailedVarSearcher::cleanClause(XorClause& ps) +{ + uint32_t origSize = ps.size(); + + Lit *i = ps.getData(), *j = i; + for (Lit *end = ps.getDataEnd(); i != end; i++) { + if (solver.assigns[i->var()] == l_True) ps.invert(true); + if (solver.assigns[i->var()] == l_Undef) { + *j++ = *i; + } + } + ps.shrink(i-j); + + if (ps.size() == 0) return false; + assert(ps.size() > 1); + + if (ps.size() != origSize) ps.setStrenghtened(); + if (ps.size() == 2) { + ps[0] = ps[0].unsign(); + ps[1] = ps[1].unsign(); + solver.varReplacer->replace(ps, ps.xor_clause_inverted(), ps.getGroup()); + return false; + } + + return true; +} + + + +/*************** +UNTESTED CODE +***************** +const bool FailedVarSearcher::tryAll(const Lit* begin, const Lit* end) +{ + propagated.setZero(); + BitArray propagated2; + propagated2.resize(solver.nVars(), 0); + propValue.resize(solver.nVars(), 0); + bool first = true; + bool last = false; + + for (const Lit *it = begin; it != end; it++, first = false) { + if (it+1 == end) last = true; + + if (!first && !last) propagated2.setZero(); + solver.newDecisionLevel(); + solver.uncheckedEnqueue(*it); + failed = (solver.propagate(false) != NULL); + if (failed) { + solver.cancelUntil(0); + numFailed++; + solver.uncheckedEnqueue(~(*it)); + solver.ok = (solver.propagate(false) == NULL); + if (!solver.ok) return false; + return true; + } else { + assert(solver.decisionLevel() > 0); + for (int c = solver.trail.size()-1; c >= (int)solver.trail_lim[0]; c--) { + Var x = solver.trail[c].var(); + if (last) { + if (propagated[x] && propValue[x] == solver.assigns[x].getBool()) + bothSame.push_back(make_pair(x, !propValue[x])); + } else { + if (first) { + propagated.setBit(x); + if (solver.assigns[x].getBool()) + propValue.setBit(x); + else + propValue.clearBit(x); + } else if (propValue[x] == solver.assigns[x].getBool()) { + propagated2.setBit(x); + } + } + } + solver.cancelUntil(0); + } + if (!last && !first) { + propagated &= propagated2; + if (propagated.isZero()) return true; + } + } + + for(uint32_t i = 0; i != bothSame.size(); i++) { + solver.uncheckedEnqueue(Lit(bothSame[i].first, bothSame[i].second)); + } + goodBothSame += bothSame.size(); + bothSame.clear(); + solver.ok = (solver.propagate(false) == NULL); + if (!solver.ok) return false; + + return true; +} +************** +Untested code end +**************/ diff --git a/packages/bee/cryptominisat-2.5.1/Solver/FailedVarSearcher.h b/packages/bee/cryptominisat-2.5.1/Solver/FailedVarSearcher.h new file mode 100755 index 000000000..24c54ee58 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/FailedVarSearcher.h @@ -0,0 +1,164 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef FAILEDVARSEARCHER_H +#define FAILEDVARSEARCHER_H + +#include +#include +using std::map; + +#include "SolverTypes.h" +#include "Clause.h" +#include "BitArray.h" +class Solver; + +class TwoLongXor +{ + public: + const bool operator==(const TwoLongXor& other) const + { + if (var[0] == other.var[0] && var[1] == other.var[1] && inverted == other.inverted) + return true; + return false; + } + const bool operator<(const TwoLongXor& other) const + { + if (var[0] < other.var[0]) return true; + if (var[0] > other.var[0]) return false; + + if (var[1] < other.var[1]) return true; + if (var[1] > other.var[1]) return false; + + if (inverted < other.inverted) return true; + if (inverted > other.inverted) return false; + + return false; + } + + Var var[2]; + bool inverted; +}; + +class FailedVarSearcher { + public: + FailedVarSearcher(Solver& _solver); + + const bool search(uint64_t numProps); + template + const bool removeUslessBinFull(); + + private: + //For 2-long xor + const TwoLongXor getTwoLongXor(const XorClause& c); + void addFromSolver(const vec& cs); + uint32_t newBinXor; + + //For detach&re-attach (when lots of vars found) + template + void cleanAndAttachClauses(vec& cs); + const bool cleanClause(Clause& ps); + const bool cleanClause(XorClause& ps); + void completelyDetachAndReattach(); + + //For re-adding old removed learnt clauses + const bool readdRemovedLearnts(); + void removeOldLearnts(); + + //Main + const bool tryBoth(const Lit lit1, const Lit lit2); + const bool tryAll(const Lit* begin, const Lit* end); + void printResults(const double myTime) const; + + Solver& solver; + + //Time + uint32_t extraTime; + + //For failure + bool failed; + + //bothprop finding + BitArray propagated; + BitArray propValue; + vec bothSame; + + //2-long xor-finding + vec xorClauseSizes; + vector > occur; + void removeVarFromXors(const Var var); + void addVarFromXors(const Var var); + BitArray xorClauseTouched; + vec investigateXor; + std::set twoLongXors; + bool binXorFind; + uint32_t lastTrailSize; + + //2-long xor-finding no.2 through + // 1) (a->b, ~a->~b) -> a=b + // 2) binary clause (a,c): (a->g, c->~g) -> a = ~c + uint32_t bothInvert; + + //finding HyperBins + void addBinClauses(const Lit& lit); + BitArray unPropagatedBin; + vec propagatedVars; + void addBin(const Lit& lit1, const Lit& lit2); + void fillImplies(const Lit& lit); + BitArray myimplies; + vec myImpliesSet; + uint64_t hyperbinProps; + vector litDegrees; + const bool orderLits(); + uint64_t maxHyperBinProps; + uint64_t binClauseAdded; + + //Remove useless binaries + template + const bool fillBinImpliesMinusLast(const Lit& origLit, const Lit& lit, vec& wrong); + template + const bool removeUselessBinaries(const Lit& lit); + void removeBin(const Lit& lit1, const Lit& lit2); + vec toDeleteSet; + vec oneHopAway; + vec wrong; + + //Temporaries + vec tmpPs; + + //State for this run + uint32_t toReplaceBefore; + uint32_t origTrailSize; + uint64_t origProps; + uint32_t numFailed; + uint32_t goodBothSame; + + //State between runs + bool finishedLastTimeVar; + uint32_t lastTimeWentUntilVar; + bool finishedLastTimeBin; + uint32_t lastTimeWentUntilBin; + + double numPropsMultiplier; + uint32_t lastTimeFoundTruths; + + uint32_t numCalls; +}; + + +#endif //FAILEDVARSEARCHER_H + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/FindUndef.cpp b/packages/bee/cryptominisat-2.5.1/Solver/FindUndef.cpp new file mode 100755 index 000000000..032314484 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/FindUndef.cpp @@ -0,0 +1,172 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "FindUndef.h" + +#include "Solver.h" +#include "VarReplacer.h" +#include + +FindUndef::FindUndef(Solver& _solver) : + solver(_solver) + , isPotentialSum(0) +{ +} + +void FindUndef::fillPotential() +{ + int trail = solver.decisionLevel()-1; + + while(trail > 0) { + assert(trail < (int)solver.trail_lim.size()); + uint at = solver.trail_lim[trail]; + + assert(at > 0); + Var v = solver.trail[at].var(); + if (solver.assigns[v] != l_Undef) { + isPotential[v] = true; + isPotentialSum++; + } + + trail--; + } + + for (XorClause** it = solver.xorclauses.getData(), **end = it + solver.xorclauses.size(); it != end; it++) { + XorClause& c = **it; + for (Lit *l = c.getData(), *end = l + c.size(); l != end; l++) { + if (isPotential[l->var()]) { + isPotential[l->var()] = false; + isPotentialSum--; + } + assert(!solver.value(*l).isUndef()); + } + } + + vector replacingVars = solver.varReplacer->getReplacingVars(); + for (Var *it = &replacingVars[0], *end = it + replacingVars.size(); it != end; it++) { + if (isPotential[*it]) { + isPotential[*it] = false; + isPotentialSum--; + } + } +} + +void FindUndef::unboundIsPotentials() +{ + for (uint i = 0; i < isPotential.size(); i++) + if (isPotential[i]) + solver.assigns[i] = l_Undef; +} + +void FindUndef::moveBinToNormal() +{ + binPosition = solver.clauses.size(); + for (uint i = 0; i != solver.binaryClauses.size(); i++) + solver.clauses.push(solver.binaryClauses[i]); + solver.binaryClauses.clear(); +} + +void FindUndef::moveBinFromNormal() +{ + for (uint i = binPosition; i != solver.clauses.size(); i++) + solver.binaryClauses.push(solver.clauses[i]); + solver.clauses.shrink(solver.clauses.size() - binPosition); +} + +const uint FindUndef::unRoll() +{ + if (solver.decisionLevel() == 0) return 0; + + moveBinToNormal(); + + dontLookAtClause.resize(solver.clauses.size(), false); + isPotential.resize(solver.nVars(), false); + fillPotential(); + satisfies.resize(solver.nVars(), 0); + + while(!updateTables()) { + assert(isPotentialSum > 0); + + uint32_t maximum = 0; + Var v = var_Undef; + for (uint i = 0; i < isPotential.size(); i++) { + if (isPotential[i] && satisfies[i] >= maximum) { + maximum = satisfies[i]; + v = i; + } + } + assert(v != var_Undef); + + isPotential[v] = false; + isPotentialSum--; + + std::fill(satisfies.begin(), satisfies.end(), 0); + } + + unboundIsPotentials(); + moveBinFromNormal(); + + return isPotentialSum; +} + +bool FindUndef::updateTables() +{ + bool allSat = true; + + uint i = 0; + for (Clause** it = solver.clauses.getData(), **end = it + solver.clauses.size(); it != end; it++, i++) { + if (dontLookAtClause[i]) + continue; + + Clause& c = **it; + bool definitelyOK = false; + Var v = var_Undef; + uint numTrue = 0; + for (Lit *l = c.getData(), *end = l + c.size(); l != end; l++) { + if (solver.value(*l) == l_True) { + if (!isPotential[l->var()]) { + dontLookAtClause[i] = true; + definitelyOK = true; + break; + } else { + numTrue ++; + v = l->var(); + } + } + } + if (definitelyOK) + continue; + + if (numTrue == 1) { + assert(v != var_Undef); + isPotential[v] = false; + isPotentialSum--; + dontLookAtClause[i] = true; + continue; + } + + //numTrue > 1 + allSat = false; + for (Lit *l = c.getData(), *end = l + c.size(); l != end; l++) { + if (solver.value(*l) == l_True) + satisfies[l->var()]++; + } + } + + return allSat; +} + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/FindUndef.h b/packages/bee/cryptominisat-2.5.1/Solver/FindUndef.h new file mode 100755 index 000000000..c752c2c1b --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/FindUndef.h @@ -0,0 +1,54 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef FINDUNDEF_H +#define FINDUNDEF_H + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER +#include +using std::vector; + +#include "Solver.h" + +class FindUndef { + public: + FindUndef(Solver& _solver); + const uint unRoll(); + + private: + Solver& solver; + + void moveBinToNormal(); + void moveBinFromNormal(); + bool updateTables(); + void fillPotential(); + void unboundIsPotentials(); + + vector dontLookAtClause; //If set to TRUE, then that clause already has only 1 lit that is true, so it can be skipped during updateFixNeed() + vector satisfies; + vector isPotential; + uint32_t isPotentialSum; + uint32_t binPosition; + +}; + +#endif // + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Gaussian.cpp b/packages/bee/cryptominisat-2.5.1/Solver/Gaussian.cpp new file mode 100755 index 000000000..aa1ae5a17 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Gaussian.cpp @@ -0,0 +1,1161 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "constants.h" +#ifdef USE_GAUSS + +#include "Gaussian.h" + +#include +#include +#include "Clause.h" +#include +#include "ClauseCleaner.h" + +using std::ostream; +using std::cout; +using std::endl; + +#ifdef VERBOSE_DEBUG +#include +#endif + +static const uint16_t unassigned_col = std::numeric_limits::max(); +static const Var unassigned_var = std::numeric_limits::max(); + +ostream& operator << (ostream& os, const vec& v) +{ + for (uint32_t i = 0; i != v.size(); i++) { + if (v[i].sign()) os << "-"; + os << v[i].var()+1 << " "; + } + + return os; +} + +Gaussian::Gaussian(Solver& _solver, const GaussianConfig& _config, const uint _matrix_no, const vector& _xorclauses) : + solver(_solver) + , config(_config) + , matrix_no(_matrix_no) + , xorclauses(_xorclauses) + , messed_matrix_vars_since_reversal(true) + , gauss_last_level(0) + , disabled(false) + , useful_prop(0) + , useful_confl(0) + , called(0) + , unit_truths(0) +{ +} + +Gaussian::~Gaussian() +{ + for (uint i = 0; i < clauses_toclear.size(); i++) + clauseFree(clauses_toclear[i].first); +} + +inline void Gaussian::set_matrixset_to_cur() +{ + uint level = solver.decisionLevel() / config.only_nth_gauss_save; + assert(level <= matrix_sets.size()); + + if (level == matrix_sets.size()) + matrix_sets.push_back(cur_matrixset); + else + matrix_sets[level] = cur_matrixset; +} + +const bool Gaussian::full_init() +{ + assert(solver.ok); + + if (!should_init()) return true; + reset_stats(); + uint32_t last_trail_size = solver.trail.size(); + + bool do_again_gauss = true; + while (do_again_gauss) { + do_again_gauss = false; + solver.clauseCleaner->cleanClauses(solver.xorclauses, ClauseCleaner::xorclauses); + if (!solver.ok) return false; + init(); + Clause* confl; + gaussian_ret g = gaussian(confl); + switch (g) { + case unit_conflict: + case conflict: + solver.ok = false; + return false; + case unit_propagation: + case propagation: + unit_truths += last_trail_size - solver.trail.size(); + do_again_gauss = true; + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) return false; + break; + case nothing: + break; + } + } + + return true; +} + +void Gaussian::init() +{ + assert(solver.decisionLevel() == 0); + + fill_matrix(cur_matrixset); + if (!cur_matrixset.num_rows || !cur_matrixset.num_cols) { + disabled = true; + badlevel = 0; + return; + } + + matrix_sets.clear(); + matrix_sets.push_back(cur_matrixset); + gauss_last_level = solver.trail.size(); + messed_matrix_vars_since_reversal = false; + badlevel = UINT_MAX; + + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Gaussian init finished." << endl; + #endif +} + +uint Gaussian::select_columnorder(vector& var_to_col, matrixset& origMat) +{ + var_to_col.resize(solver.nVars(), unassigned_col); + + uint num_xorclauses = 0; + for (uint32_t i = 0; i != xorclauses.size(); i++) { + XorClause& c = *xorclauses[i]; + if (c.removed()) continue; + num_xorclauses++; + + for (uint i2 = 0; i2 < c.size(); i2++) { + assert(solver.assigns[c[i2].var()].isUndef()); + var_to_col[c[i2].var()] = unassigned_col - 1; + } + } + + uint largest_used_var = 0; + for (uint i = 0; i < var_to_col.size(); i++) + if (var_to_col[i] != unassigned_col) + largest_used_var = i; + var_to_col.resize(largest_used_var + 1); + + var_is_in.resize(var_to_col.size(), 0); + origMat.var_is_set.resize(var_to_col.size(), 0); + + origMat.col_to_var.clear(); + vector vars(solver.nVars()); + if (!config.orderCols) { + for (uint32_t i = 0; i < solver.nVars(); i++) { + vars.push_back(i); + } + std::random_shuffle(vars.begin(), vars.end()); + } + + Heap order_heap(solver.order_heap); + uint32_t iterReduceIt = 0; + while ((config.orderCols && !order_heap.empty()) || (!config.orderCols && iterReduceIt < vars.size())) + { + Var v; + if (config.orderCols) v = order_heap.removeMin(); + else v = vars[iterReduceIt++]; + if (var_to_col[v] == 1) { + #ifdef DEBUG_GAUSS + vector::iterator it = + std::find(origMat.col_to_var.begin(), origMat.col_to_var.end(), v); + assert(it == origMat.col_to_var.end()); + #endif + + origMat.col_to_var.push_back(v); + var_to_col[v] = origMat.col_to_var.size()-1; + var_is_in.setBit(v); + } + } + + //for the ones that were not in the order_heap, but are marked in var_to_col + for (uint v = 0; v != var_to_col.size(); v++) { + if (var_to_col[v] == unassigned_col - 1) { + origMat.col_to_var.push_back(v); + var_to_col[v] = origMat.col_to_var.size() -1; + var_is_in.setBit(v); + } + } + + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")col_to_var:"; + std::copy(origMat.col_to_var.begin(), origMat.col_to_var.end(), std::ostream_iterator(cout, ",")); + cout << endl; + #endif + + return num_xorclauses; +} + +void Gaussian::fill_matrix(matrixset& origMat) +{ + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Filling matrix" << endl; + #endif + + vector var_to_col; + origMat.num_rows = select_columnorder(var_to_col, origMat); + origMat.num_cols = origMat.col_to_var.size(); + col_to_var_original = origMat.col_to_var; + changed_rows.resize(origMat.num_rows); + memset(&changed_rows[0], 0, sizeof(char)*changed_rows.size()); + + origMat.last_one_in_col.resize(origMat.num_cols); + std::fill(origMat.last_one_in_col.begin(), origMat.last_one_in_col.end(), origMat.num_rows); + origMat.first_one_in_row.resize(origMat.num_rows); + + origMat.removeable_cols = 0; + origMat.least_column_changed = -1; + origMat.matrix.resize(origMat.num_rows, origMat.num_cols); + + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")matrix size:" << origMat.num_rows << "," << origMat.num_cols << endl; + #endif + + uint matrix_row = 0; + for (uint32_t i = 0; i != xorclauses.size(); i++) { + const XorClause& c = *xorclauses[i]; + if (c.removed()) continue; + + origMat.matrix.getVarsetAt(matrix_row).set(c, var_to_col, origMat.num_cols); + origMat.matrix.getMatrixAt(matrix_row).set(c, var_to_col, origMat.num_cols); + matrix_row++; + } + assert(origMat.num_rows == matrix_row); +} + +void Gaussian::update_matrix_col(matrixset& m, const Var var, const uint col) +{ + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Updating matrix var " << var+1 << " (col " << col << ", m.last_one_in_col[col]: " << m.last_one_in_col[col] << ")" << endl; + cout << "m.num_rows:" << m.num_rows << endl; + #endif + + #ifdef DEBUG_GAUSS + assert(col < m.num_cols); + #endif + + m.least_column_changed = std::min(m.least_column_changed, (int)col); + PackedMatrix::iterator this_row = m.matrix.beginMatrix(); + uint row_num = 0; + + if (solver.assigns[var].getBool()) { + for (uint end = m.last_one_in_col[col]; row_num != end; ++this_row, row_num++) { + if ((*this_row)[col]) { + changed_rows[row_num] = true; + (*this_row).invert_is_true(); + (*this_row).clearBit(col); + } + } + } else { + for (uint end = m.last_one_in_col[col]; row_num != end; ++this_row, row_num++) { + if ((*this_row)[col]) { + changed_rows[row_num] = true; + (*this_row).clearBit(col); + } + } + } + + #ifdef DEBUG_GAUSS + bool c = false; + for(PackedMatrix::iterator r = m.matrix.beginMatrix(), end = r + m.matrix.getSize(); r != end; ++r) + c |= (*r)[col]; + assert(!c); + #endif + + m.removeable_cols++; + m.col_to_var[col] = unassigned_var; + m.var_is_set.setBit(var); +} + +void Gaussian::update_matrix_by_col_all(matrixset& m) +{ + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Updating matrix." << endl; + print_matrix(m); + uint num_updated = 0; + #endif + + #ifdef DEBUG_GAUSS + assert(nothing_to_propagate(cur_matrixset)); + assert(solver.decisionLevel() == 0 || check_last_one_in_cols(m)); + #endif + + memset(&changed_rows[0], 0, sizeof(char)*changed_rows.size()); + + uint last = 0; + uint col = 0; + for (const Var *it = &m.col_to_var[0], *end = it + m.num_cols; it != end; col++, it++) { + if (*it != unassigned_var && solver.assigns[*it].isDef()) { + update_matrix_col(m, *it, col); + last++; + #ifdef VERBOSE_DEBUG + num_updated++; + #endif + } else + last = 0; + } + m.num_cols -= last; + + #ifdef DEBUG_GAUSS + check_matrix_against_varset(m.matrix, m); + #endif + + #ifdef VERBOSE_DEBUG + cout << "Matrix update finished, updated " << num_updated << " cols" << endl; + print_matrix(m); + #endif + + /*cout << "num_rows:" << m.num_rows; + cout << " num_rows diff:" << origMat.num_rows - m.num_rows << endl; + cout << "num_cols:" << col_to_var_original.size(); + cout << " num_cols diff:" << col_to_var_original.size() - m.col_to_var.size() << endl; + cout << "removeable cols:" << m.removeable_cols << endl;*/ +} + +inline void Gaussian::update_last_one_in_col(matrixset& m) +{ + for (uint16_t* i = &m.last_one_in_col[0]+m.last_one_in_col.size()-1, *end = &m.last_one_in_col[0]-1; i != end && *i >= m.num_rows; i--) + *i = m.num_rows; +} + +Gaussian::gaussian_ret Gaussian::gaussian(Clause*& confl) +{ + if (solver.decisionLevel() >= badlevel) + return nothing; + + if (messed_matrix_vars_since_reversal) { + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")matrix needs copy before update" << endl; + #endif + + const uint level = solver.decisionLevel() / config.only_nth_gauss_save; + assert(level < matrix_sets.size()); + cur_matrixset = matrix_sets[level]; + } + update_last_one_in_col(cur_matrixset); + update_matrix_by_col_all(cur_matrixset); + + messed_matrix_vars_since_reversal = false; + gauss_last_level = solver.trail.size(); + badlevel = UINT_MAX; + + propagatable_rows.clear(); + uint conflict_row = UINT_MAX; + uint last_row = eliminate(cur_matrixset, conflict_row); + #ifdef DEBUG_GAUSS + check_matrix_against_varset(cur_matrixset.matrix, cur_matrixset); + #endif + + gaussian_ret ret; + //There is no early abort, so this is unneeded + /*if (conflict_row != UINT_MAX) { + uint maxlevel = UINT_MAX; + uint size = UINT_MAX; + uint best_row = UINT_MAX; + analyse_confl(cur_matrixset, conflict_row, maxlevel, size, best_row); + ret = handle_matrix_confl(confl, cur_matrixset, size, maxlevel, best_row); + } else {*/ + ret = handle_matrix_prop_and_confl(cur_matrixset, last_row, confl); + //} + #ifdef DEBUG_GAUSS + assert(ret == conflict || nothing_to_propagate(cur_matrixset)); + #endif + + if (!cur_matrixset.num_cols || !cur_matrixset.num_rows) { + badlevel = solver.decisionLevel(); + return nothing; + } + + if (ret == nothing && + solver.decisionLevel() % config.only_nth_gauss_save == 0) + set_matrixset_to_cur(); + + #ifdef VERBOSE_DEBUG + if (ret == nothing) + cout << "(" << matrix_no << ")Useless. "; + else + cout << "(" << matrix_no << ")Useful. "; + cout << "(" << matrix_no << ")Useful prop in " << ((double)useful_prop/(double)called)*100.0 << "%" << endl; + cout << "(" << matrix_no << ")Useful confl in " << ((double)useful_confl/(double)called)*100.0 << "%" << endl; + #endif + + return ret; +} + +uint Gaussian::eliminate(matrixset& m, uint& conflict_row) +{ + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")"; + cout << "Starting elimination" << endl; + cout << "m.least_column_changed:" << m.least_column_changed << endl; + print_last_one_in_cols(m); + + uint number_of_row_additions = 0; + uint no_exchanged = 0; + #endif + + if (m.least_column_changed == INT_MAX) { + #ifdef VERBOSE_DEBUG + cout << "Nothing to eliminate" << endl; + #endif + + return m.num_rows; + } + + + #ifdef DEBUG_GAUSS + assert(solver.decisionLevel() == 0 || check_last_one_in_cols(m)); + #endif + + uint i = 0; + uint j = (config.iterativeReduce) ? m.least_column_changed + 1 : 0; + PackedMatrix::iterator beginIt = m.matrix.beginMatrix(); + PackedMatrix::iterator rowIt = m.matrix.beginMatrix(); + + #ifdef DEBUG_GAUSS + check_first_one_in_row(m, j); + #endif + + if (j) { + uint16_t until = std::min(m.last_one_in_col[m.least_column_changed] - 1, (int)m.num_rows); + if (j-1 > m.first_one_in_row[m.num_rows-1]) + until = m.num_rows; + for (;i != until; i++, ++rowIt) if (changed_rows[i] && (*rowIt).popcnt_is_one(m.first_one_in_row[i])) + propagatable_rows.push(i); + } + + #ifdef VERBOSE_DEBUG + cout << "At while() start: i,j = " << i << ", " << j << endl; + cout << "num_rows:" << m.num_rows << " num_cols:" << m.num_cols << endl; + #endif + + if (j > m.num_cols) { + #ifdef VERBOSE_DEBUG + cout << "Going straight to finish" << endl; + #endif + goto finish; + } + + #ifdef DEBUG_GAUSS + assert(i <= m.num_rows && j <= m.num_cols); + #endif + + while (i != m.num_rows && j != m.num_cols) { + //Find pivot in column j, starting in row i: + + if (m.col_to_var[j] == unassigned_var) { + j++; + continue; + } + + PackedMatrix::iterator this_matrix_row = rowIt; + PackedMatrix::iterator end = beginIt + m.last_one_in_col[j]; + for (; this_matrix_row != end; ++this_matrix_row) { + if ((*this_matrix_row)[j]) + break; + } + + if (this_matrix_row != end) { + + //swap rows i and maxi, but do not change the value of i; + if (this_matrix_row != rowIt) { + #ifdef VERBOSE_DEBUG + no_exchanged++; + #endif + + //Would early abort, but would not find the best conflict (and would be expensive) + //if (matrix_row_i.is_true() && matrix_row_i.isZero()) { + // conflict_row = i; + // return 0; + //} + (*rowIt).swapBoth(*this_matrix_row); + } + #ifdef DEBUG_GAUSS + assert(m.matrix.getMatrixAt(i).popcnt(j) == m.matrix.getMatrixAt(i).popcnt()); + assert(m.matrix.getMatrixAt(i)[j]); + #endif + + if ((*rowIt).popcnt_is_one(j)) + propagatable_rows.push(i); + + //Now A[i,j] will contain the old value of A[maxi,j]; + ++this_matrix_row; + for (; this_matrix_row != end; ++this_matrix_row) if ((*this_matrix_row)[j]) { + //subtract row i from row u; + //Now A[u,j] will be 0, since A[u,j] - A[i,j] = A[u,j] -1 = 0. + #ifdef VERBOSE_DEBUG + number_of_row_additions++; + #endif + + (*this_matrix_row).xorBoth(*rowIt); + //Would early abort, but would not find the best conflict (and would be expensive) + //if (it->is_true() &&it->isZero()) { + // conflict_row = i2; + // return 0; + //} + } + m.first_one_in_row[i] = j; + i++; + ++rowIt; + m.last_one_in_col[j] = i; + } else { + m.first_one_in_row[i] = j; + m.last_one_in_col[j] = i + 1; + } + j++; + } + + finish: + + m.least_column_changed = INT_MAX; + + #ifdef VERBOSE_DEBUG + cout << "Finished elimination" << endl; + cout << "Returning with i,j:" << i << ", " << j << "(" << m.num_rows << ", " << m.num_cols << ")" << endl; + print_matrix(m); + print_last_one_in_cols(m); + cout << "(" << matrix_no << ")Exchanged:" << no_exchanged << " row additions:" << number_of_row_additions << endl; + #endif + + #ifdef DEBUG_GAUSS + assert(check_last_one_in_cols(m)); + uint row = 0; + uint col = 0; + for (; col < m.num_cols && row < m.num_rows && row < i ; col++) { + assert(m.matrix.getMatrixAt(row).popcnt() == m.matrix.getMatrixAt(row).popcnt(col)); + assert(!(m.col_to_var[col] == unassigned_var && m.matrix.getMatrixAt(row)[col])); + if (m.col_to_var[col] == unassigned_var || !m.matrix.getMatrixAt(row)[col]) { + #ifdef VERBOSE_DEBUG + cout << "row:" << row << " col:" << col << " m.last_one_in_col[col]-1: " << m.last_one_in_col[col]-1 << endl; + #endif + assert(m.col_to_var[col] == unassigned_var || std::min((uint16_t)(m.last_one_in_col[col]-1), m.num_rows) == row); + continue; + } + row++; + } + #endif + + return i; +} + +Gaussian::gaussian_ret Gaussian::handle_matrix_confl(Clause*& confl, const matrixset& m, const uint size, const uint maxlevel, const uint best_row) +{ + assert(best_row != UINT_MAX); + + m.matrix.getVarsetAt(best_row).fill(tmp_clause, solver.assigns, col_to_var_original); + confl = (Clause*)XorClause_new(tmp_clause, false, solver.learnt_clause_group++); + Clause& cla = *confl; + #ifdef STATS_NEEDED + if (solver.dynamic_behaviour_analysis) + solver.logger.set_group_name(confl->getGroup(), "learnt gauss clause"); + #endif + + if (cla.size() <= 1) { + solver.ok = false; + return unit_conflict; + } + + assert(cla.size() >= 2); + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Found conflict:"; + cla.plainPrint(); + #endif + + if (maxlevel != solver.decisionLevel()) { + #ifdef STATS_NEEDED + if (solver.dynamic_behaviour_analysis) + solver.logger.conflict(Logger::gauss_confl_type, maxlevel, confl->getGroup(), *confl); + #endif + solver.cancelUntil(maxlevel); + } + const uint curr_dec_level = solver.decisionLevel(); + assert(maxlevel == curr_dec_level); + + uint maxsublevel = 0; + uint maxsublevel_at = UINT_MAX; + for (uint i = 0, size = cla.size(); i != size; i++) if (solver.level[cla[i].var()] == (int32_t)curr_dec_level) { + uint tmp = find_sublevel(cla[i].var()); + if (tmp >= maxsublevel) { + maxsublevel = tmp; + maxsublevel_at = i; + } + } + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ") || Sublevel of confl: " << maxsublevel << " (due to var:" << cla[maxsublevel_at].var()-1 << ")" << endl; + #endif + + Lit tmp(cla[maxsublevel_at]); + cla[maxsublevel_at] = cla[1]; + cla[1] = tmp; + + cancel_until_sublevel(maxsublevel+1); + messed_matrix_vars_since_reversal = true; + return conflict; +} + +Gaussian::gaussian_ret Gaussian::handle_matrix_prop_and_confl(matrixset& m, uint last_row, Clause*& confl) +{ + int32_t maxlevel = std::numeric_limits::max(); + uint size = UINT_MAX; + uint best_row = UINT_MAX; + + for (uint row = last_row; row != m.num_rows; row++) { + #ifdef DEBUG_GAUSS + assert(m.matrix.getMatrixAt(row).isZero()); + #endif + if (m.matrix.getMatrixAt(row).is_true()) + analyse_confl(m, row, maxlevel, size, best_row); + } + + if (maxlevel != std::numeric_limits::max()) + return handle_matrix_confl(confl, m, size, maxlevel, best_row); + + #ifdef DEBUG_GAUSS + assert(check_no_conflict(m)); + assert(last_row == 0 || !m.matrix.getMatrixAt(last_row-1).isZero()); + #endif + + #ifdef VERBOSE_DEBUG + cout << "Resizing matrix to num_rows = " << last_row << endl; + #endif + m.num_rows = last_row; + m.matrix.resizeNumRows(m.num_rows); + + gaussian_ret ret = nothing; + + uint num_props = 0; + for (const uint* prop_row = propagatable_rows.getData(), *end = prop_row + propagatable_rows.size(); prop_row != end; prop_row++ ) { + //this is a "000..1..0000000X" row. I.e. it indicates a propagation + ret = handle_matrix_prop(m, *prop_row); + num_props++; + if (ret == unit_propagation) { + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Unit prop! Breaking from prop examination" << endl; + #endif + return unit_propagation; + } + } + #ifdef VERBOSE_DEBUG + if (num_props > 0) cout << "(" << matrix_no << ")Number of props during gauss:" << num_props << endl; + #endif + + return ret; +} + +uint Gaussian::find_sublevel(const Var v) const +{ + for (int i = solver.trail.size()-1; i >= 0; i --) + if (solver.trail[i].var() == v) return i; + + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Oooops! Var " << v+1 << " does not have a sublevel!! (so it must be undefined)" << endl; + #endif + + assert(false); + return 0; +} + +void Gaussian::cancel_until_sublevel(const uint until_sublevel) +{ + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Canceling until sublevel " << until_sublevel << endl; + #endif + + for (vector::iterator gauss = solver.gauss_matrixes.begin(), end= solver.gauss_matrixes.end(); gauss != end; gauss++) + if (*gauss != this) (*gauss)->canceling(until_sublevel); + + for (int sublevel = solver.trail.size()-1; sublevel >= (int)until_sublevel; sublevel--) { + Var var = solver.trail[sublevel].var(); + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Canceling var " << var+1 << endl; + #endif + + #ifdef USE_OLD_POLARITIES + solver.polarity[var] = solver.oldPolarity[var]; + #endif //USE_OLD_POLARITIES + solver.assigns[var] = l_Undef; + solver.insertVarOrder(var); + } + solver.trail.shrink(solver.trail.size() - until_sublevel); + + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Canceling sublevel finished." << endl; + #endif +} + +void Gaussian::analyse_confl(const matrixset& m, const uint row, int32_t& maxlevel, uint& size, uint& best_row) const +{ + assert(row < m.num_rows); + + //this is a "000...00000001" row. I.e. it indicates we are on the wrong branch + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")matrix conflict found!" << endl; + cout << "(" << matrix_no << ")conflict clause's vars: "; + print_matrix_row_with_assigns(m.matrix.getVarsetAt(row)); + cout << endl; + + cout << "(" << matrix_no << ")corresponding matrix's row (should be empty): "; + print_matrix_row(m.matrix.getMatrixAt(row)); + cout << endl; + #endif + + int32_t this_maxlevel = 0; + unsigned long int var = 0; + uint this_size = 0; + while (true) { + var = m.matrix.getVarsetAt(row).scan(var); + if (var == ULONG_MAX) break; + + const Var real_var = col_to_var_original[var]; + assert(real_var < solver.nVars()); + + if (solver.level[real_var] > this_maxlevel) + this_maxlevel = solver.level[real_var]; + var++; + this_size++; + } + + //the maximum of all lit's level must be lower than the max. level of the current best clause (or this clause must be either empty or unit clause) + if (!( + (this_maxlevel < maxlevel) + || (this_maxlevel == maxlevel && this_size < size) + || (this_size <= 1) + )) { + assert(maxlevel != std::numeric_limits::max()); + + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")Other found conflict just as good or better."; + cout << "(" << matrix_no << ") || Old maxlevel:" << maxlevel << " new maxlevel:" << this_maxlevel; + cout << "(" << matrix_no << ") || Old size:" << size << " new size:" << this_size << endl; + //assert(!(maxlevel != UINT_MAX && maxlevel != this_maxlevel)); //NOTE: only holds if gauss is executed at each level + #endif + + return; + } + + + #ifdef VERBOSE_DEBUG + if (maxlevel != std::numeric_limits::max()) + cout << "(" << matrix_no << ")Better conflict found."; + else + cout << "(" << matrix_no << ")Found a possible conflict."; + + cout << "(" << matrix_no << ") || Old maxlevel:" << maxlevel << " new maxlevel:" << this_maxlevel; + cout << "(" << matrix_no << ") || Old size:" << size << " new size:" << this_size << endl; + #endif + + maxlevel = this_maxlevel; + size = this_size; + best_row = row; +} + +Gaussian::gaussian_ret Gaussian::handle_matrix_prop(matrixset& m, const uint row) +{ + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")matrix prop found!" << endl; + cout << m.matrix.getMatrixAt(row) << endl; + cout << "(" << matrix_no << ")matrix row:"; + print_matrix_row(m.matrix.getMatrixAt(row)); + cout << endl; + #endif + + m.matrix.getVarsetAt(row).fill(tmp_clause, solver.assigns, col_to_var_original); + Clause& cla = *(Clause*)XorClause_new(tmp_clause, false, solver.learnt_clause_group++); + #ifdef VERBOSE_DEBUG + cout << "(" << matrix_no << ")matrix prop clause: "; + cla.plainPrint(); + cout << endl; + #endif + + assert(m.matrix.getMatrixAt(row).is_true() == !cla[0].sign()); + assert(solver.assigns[cla[0].var()].isUndef()); + if (cla.size() == 1) { + solver.cancelUntil(0); + solver.uncheckedEnqueue(cla[0]); + clauseFree(&cla); + return unit_propagation; + } + + clauses_toclear.push_back(std::make_pair(&cla, solver.trail.size()-1)); + #ifdef STATS_NEEDED + if (solver.dynamic_behaviour_analysis) + solver.logger.set_group_name(cla.getGroup(), "gauss prop clause"); + #endif + solver.uncheckedEnqueue(cla[0], &cla); + + return propagation; +} + +void Gaussian::disable_if_necessary() +{ + if (//nof_conflicts >= 0 + //&& conflictC >= nof_conflicts/8 + !config.dontDisable + && called > 50 + && useful_confl*2+useful_prop < (uint)((double)called*0.05) ) + disabled = true; +} + +llbool Gaussian::find_truths(vec& learnt_clause, int& conflictC) +{ + Clause* confl; + + disable_if_necessary(); + if (should_check_gauss(solver.decisionLevel(), solver.starts)) { + called++; + gaussian_ret g = gaussian(confl); + + switch (g) { + case conflict: { + useful_confl++; + llbool ret = solver.handle_conflict(learnt_clause, confl, conflictC, true); + clauseFree(confl); + + if (ret != l_Nothing) return ret; + return l_Continue; + } + case unit_propagation: + unit_truths++; + case propagation: + useful_prop++; + return l_Continue; + case unit_conflict: { + unit_truths++; + useful_confl++; + if (confl->size() == 0) { + clauseFree(confl); + return l_False; + } + + Lit lit = (*confl)[0]; + #ifdef STATS_NEEDED + if (solver.dynamic_behaviour_analysis) + solver.logger.conflict(Logger::gauss_confl_type, 0, confl->getGroup(), *confl); + #endif + + solver.cancelUntil(0); + + if (solver.assigns[lit.var()].isDef()) { + clauseFree(confl); + return l_False; + } + + solver.uncheckedEnqueue(lit); + + clauseFree(confl); + return l_Continue; + } + case nothing: + break; + } + } + + return l_Nothing; +} + +template +void Gaussian::print_matrix_row(const T& row) const +{ + unsigned long int var = 0; + while (true) { + var = row.scan(var); + if (var == ULONG_MAX) break; + + else cout << col_to_var_original[var]+1 << ", "; + var++; + } + cout << "final:" << row.is_true() << endl;; +} + +template +void Gaussian::print_matrix_row_with_assigns(const T& row) const +{ + unsigned long int col = 0; + while (true) { + col = row.scan(col); + if (col == ULONG_MAX) break; + + else { + Var var = col_to_var_original[col]; + cout << (var+1) << "(" << lbool_to_string(solver.assigns[var]) << ")"; + cout << ", "; + } + col++; + } + if (!row.is_true()) cout << "xor_clause_inverted"; +} + +const string Gaussian::lbool_to_string(const lbool toprint) +{ + if (toprint == l_True) + return "true"; + if (toprint == l_False) + return "false"; + if (toprint == l_Undef) + return "undef"; + + assert(false); + return ""; +} + + +void Gaussian::print_stats() const +{ + if (called > 0) { + cout.setf(std::ios::fixed); + std::cout << " Gauss(" << matrix_no << ") useful"; + cout << " prop: " << std::setprecision(2) << std::setw(5) << ((double)useful_prop/(double)called)*100.0 << "% "; + cout << " confl: " << std::setprecision(2) << std::setw(5) << ((double)useful_confl/(double)called)*100.0 << "% "; + if (disabled) std::cout << "disabled"; + } else + std::cout << " Gauss(" << matrix_no << ") not called."; +} + +void Gaussian::print_matrix_stats() const +{ + cout << "matrix size: " << cur_matrixset.num_rows << " x " << cur_matrixset.num_cols << endl; +} + + +void Gaussian::reset_stats() +{ + useful_prop = 0; + useful_confl = 0; + called = 0; + disabled = false; +} + +bool Gaussian::check_no_conflict(matrixset& m) const +{ + uint row = 0; + for(PackedMatrix::iterator r = m.matrix.beginMatrix(), end = m.matrix.endMatrix(); r != end; ++r, ++row) { + if ((*r).is_true() && (*r).isZero()) { + cout << "Conflict at row " << row << endl; + return false; + } + } + return true; +} + +void Gaussian::print_matrix(matrixset& m) const +{ + uint row = 0; + for (PackedMatrix::iterator it = m.matrix.beginMatrix(); it != m.matrix.endMatrix(); ++it, row++) { + cout << *it << " -- row:" << row; + if (row >= m.num_rows) + cout << " (considered past the end)"; + cout << endl; + } +} + +void Gaussian::print_last_one_in_cols(matrixset& m) const +{ + for (uint i = 0; i < m.num_cols; i++) { + cout << "last_one_in_col[" << i << "]-1 = " << m.last_one_in_col[i]-1 << endl; + } +} + +const bool Gaussian::nothing_to_propagate(matrixset& m) const +{ + for(PackedMatrix::iterator r = m.matrix.beginMatrix(), end = m.matrix.endMatrix(); r != end; ++r) { + if ((*r).popcnt_is_one() + && solver.assigns[m.col_to_var[(*r).scan(0)]].isUndef()) + return false; + } + for(PackedMatrix::iterator r = m.matrix.beginMatrix(), end = m.matrix.endMatrix(); r != end; ++r) { + if ((*r).isZero() && (*r).is_true()) + return false; + } + return true; +} + +const bool Gaussian::check_last_one_in_cols(matrixset& m) const +{ + for(uint i = 0; i < m.num_cols; i++) { + const uint last = std::min(m.last_one_in_col[i] - 1, (int)m.num_rows); + uint real_last = 0; + uint i2 = 0; + for (PackedMatrix::iterator it = m.matrix.beginMatrix(); it != m.matrix.endMatrix(); ++it, i2++) { + if ((*it)[i]) + real_last = i2; + } + if (real_last > last) + return false; + } + + return true; +} + +void Gaussian::check_matrix_against_varset(PackedMatrix& matrix, const matrixset& m) const +{ + for (uint i = 0; i < matrix.getSize(); i++) { + const PackedRow mat_row = matrix.getMatrixAt(i); + const PackedRow var_row = matrix.getVarsetAt(i); + + unsigned long int col = 0; + bool final = false; + while (true) { + col = var_row.scan(col); + if (col == ULONG_MAX) break; + + const Var var = col_to_var_original[col]; + assert(var < solver.nVars()); + + if (solver.assigns[var] == l_True) { + assert(!mat_row[col]); + assert(m.col_to_var[col] == unassigned_var); + assert(m.var_is_set[var]); + final = !final; + } else if (solver.assigns[var] == l_False) { + assert(!mat_row[col]); + assert(m.col_to_var[col] == unassigned_var); + assert(m.var_is_set[var]); + } else if (solver.assigns[var] == l_Undef) { + assert(m.col_to_var[col] != unassigned_var); + assert(!m.var_is_set[var]); + assert(mat_row[col]); + } else assert(false); + + col++; + } + if ((final^!mat_row.is_true()) != !var_row.is_true()) { + cout << "problem with row:"; print_matrix_row_with_assigns(var_row); cout << endl; + assert(false); + } + } +} + +const void Gaussian::check_first_one_in_row(matrixset& m, const uint j) +{ + if (j) { + uint16_t until2 = std::min(m.last_one_in_col[m.least_column_changed] - 1, (int)m.num_rows); + if (j-1 > m.first_one_in_row[m.num_rows-1]) { + until2 = m.num_rows; + #ifdef VERBOSE_DEBUG + cout << "j-1 > m.first_one_in_row[m.num_rows-1]" << "j:" << j << " m.first_one_in_row[m.num_rows-1]:" << m.first_one_in_row[m.num_rows-1] << endl; + #endif + } + for (uint i2 = 0; i2 != until2; i2++) { + #ifdef VERBOSE_DEBUG + cout << endl << "row " << i2 << " (num rows:" << m.num_rows << ")" << endl; + cout << m.matrix.getMatrixAt(i2) << endl; + cout << " m.first_one_in_row[m.num_rows-1]:" << m.first_one_in_row[m.num_rows-1] << endl; + cout << "first_one_in_row:" << m.first_one_in_row[i2] << endl; + cout << "num_cols:" << m.num_cols << endl; + cout << "popcnt:" << m.matrix.getMatrixAt(i2).popcnt() << endl; + cout << "popcnt_is_one():" << m.matrix.getMatrixAt(i2).popcnt_is_one() << endl; + cout << "popcnt_is_one("<< m.first_one_in_row[i2] <<"): " << m.matrix.getMatrixAt(i2).popcnt_is_one(m.first_one_in_row[i2]) << endl; + #endif + + for (uint i3 = 0; i3 < m.first_one_in_row[i2]; i3++) { + assert(m.matrix.getMatrixAt(i2)[i3] == 0); + } + assert(m.matrix.getMatrixAt(i2)[m.first_one_in_row[i2]]); + assert(m.matrix.getMatrixAt(i2).popcnt_is_one() == + m.matrix.getMatrixAt(i2).popcnt_is_one(m.first_one_in_row[i2])); + } + } +} + +//old functions + +/*void Gaussian::update_matrix_by_row(matrixset& m) const +{ +#ifdef VERBOSE_DEBUG + cout << "Updating matrix." << endl; + uint num_updated = 0; +#endif +#ifdef DEBUG_GAUSS + assert(nothing_to_propagate(cur_matrixset)); +#endif + + mpz_class toclear, tocount; + uint last_col = 0; + + for (uint col = 0; col < m.num_cols; col ++) { + Var var = m.col_to_var[col]; + + if (var != UINT_MAX && !solver.assigns[var].isUndef()) { + toclear.setBit(col); + if (solver.assigns[var].getBool()) tocount.setBit(col); + +#ifdef DEBUG_GAUSS + assert(m.var_to_col[var] < UINT_MAX-1); +#endif + last_col = col; + m.least_column_changed = std::min(m.least_column_changed, (int)col); + + m.removeable_cols++; + m.col_to_var[col] = UINT_MAX; + m.var_to_col[var] = UINT_MAX-1; +#ifdef VERBOSE_DEBUG + num_updated++; +#endif + } + } + + toclear.invert(); + mpz_class tmp; + mpz_class* this_row = &m.matrix[0]; + for(uint i = 0, until = std::min(m.num_rows, m.last_one_in_col[last_col]+1); i < until; i++, this_row++) { + mpz_class& r = *this_row; + mpz_and(tmp.get_mp(), tocount.get_mp(), r.get_mp()); + r.invert_is_true(tmp.popcnt() % 2); + r &= toclear; +} + +#ifdef VERBOSE_DEBUG + cout << "Updated " << num_updated << " matrix cols. Could remove " << m.removeable_cols << " cols " <= last_level; level--){ + Var var = solver.trail[level].var(); + const uint col = m.var_to_col[var]; + if ( col < UINT_MAX-1) { + update_matrix_col(m, var, col); +#ifdef VERBOSE_DEBUG + num_updated++; +#endif + } + } + +#ifdef VERBOSE_DEBUG + cout << "Updated " << num_updated << " matrix cols. Could remove " << m.removeable_cols << " cols (out of " << m.num_cols << " )" <. +**************************************************************************************************/ + +#ifndef GAUSSIAN_H +#define GAUSSIAN_H + +#include +#include +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "SolverTypes.h" +#include "Solver.h" +#include "GaussianConfig.h" +#include "PackedMatrix.h" +#include "BitArray.h" + +#ifdef VERBOSE_DEBUG +using std::vector; +using std::cout; +using std::endl; +#endif + +using std::pair; +using std::string; + +class Clause; + +class Gaussian +{ +public: + Gaussian(Solver& solver, const GaussianConfig& config, const uint matrix_no, const vector& xorclauses); + ~Gaussian(); + + const bool full_init(); + llbool find_truths(vec& learnt_clause, int& conflictC); + + //statistics + void print_stats() const; + void print_matrix_stats() const; + const uint get_called() const; + const uint get_useful_prop() const; + const uint get_useful_confl() const; + const bool get_disabled() const; + const uint32_t get_unit_truths() const; + void set_disabled(const bool toset); + + //functions used throughout the Solver + void canceling(const uint sublevel); + +protected: + Solver& solver; + + //Gauss high-level configuration + const GaussianConfig& config; + const uint matrix_no; + vector xorclauses; + + enum gaussian_ret {conflict, unit_conflict, propagation, unit_propagation, nothing}; + gaussian_ret gaussian(Clause*& confl); + + vector col_to_var_original; //Matches columns to variables + BitArray var_is_in; //variable is part of the the matrix. var_is_in's size is _minimal_ so you should check whether var_is_in.getSize() < var before issuing var_is_in[var] + uint badlevel; + + class matrixset + { + public: + PackedMatrix matrix; // The matrix, updated to reflect variable assignements + BitArray var_is_set; + vector col_to_var; // col_to_var[COL] tells which variable is at a given column in the matrix. Gives unassigned_var if the COL has been zeroed (i.e. the variable assigned) + uint16_t num_rows; // number of active rows in the matrix. Unactive rows are rows that contain only zeros (and if they are conflicting, then the conflict has been treated) + uint num_cols; // number of active columns in the matrix. The columns at the end that have all be zeroed are no longer active + int least_column_changed; // when updating the matrix, this value contains the smallest column number that has been updated (Gauss elim. can start from here instead of from column 0) + vector last_one_in_col; //last_one_in_col[COL] tells the last row+1 that has a '1' in that column. Used to reduce the burden of Gauss elim. (it only needs to look until that row) + vector first_one_in_row; + uint removeable_cols; // the number of columns that have been zeroed out (i.e. assigned) + }; + + //Saved states + vector matrix_sets; // The matrixsets for depths 'decision_from' + 0, 'decision_from' + only_nth_gaussian_save, 'decision_from' + 2*only_nth_gaussian_save, ... 'decision_from' + 'decision_until'. + matrixset cur_matrixset; // The current matrixset, i.e. the one we are working on, or the last one we worked on + + //Varibales to keep Gauss state + bool messed_matrix_vars_since_reversal; + int gauss_last_level; + vector > clauses_toclear; + bool disabled; // Gauss is disabled + + //State of current elimnation + vec propagatable_rows; //used to store which rows were deemed propagatable during elimination + vector changed_rows; //used to store which rows were deemed propagatable during elimination + + //Statistics + uint useful_prop; //how many times Gauss gave propagation as a result + uint useful_confl; //how many times Gauss gave conflict as a result + uint called; //how many times called the Gauss + uint32_t unit_truths; //how many unitary (i.e. decisionLevel 0) truths have been found + + //gauss init functions + void init(); // Initalise gauss state + void fill_matrix(matrixset& origMat); // Fills the origMat matrix + uint select_columnorder(vector& var_to_col, matrixset& origMat); // Fills var_to_col and col_to_var of the origMat matrix. + + //Main function + uint eliminate(matrixset& matrix, uint& conflict_row); //does the actual gaussian elimination + + //matrix update functions + void update_matrix_col(matrixset& matrix, const Var x, const uint col); // Update one matrix column + void update_matrix_by_col_all(matrixset& m); // Update all columns, column-by-column (and not row-by-row) + void set_matrixset_to_cur(); // Save the current matrixset, the cur_matrixset to matrix_sets + //void update_matrix_by_row(matrixset& matrix) const; + //void update_matrix_by_col(matrixset& matrix, const uint last_level) const; + + //conflict&propagation handling + gaussian_ret handle_matrix_prop_and_confl(matrixset& m, uint row, Clause*& confl); + void analyse_confl(const matrixset& m, const uint row, int32_t& maxlevel, uint& size, uint& best_row) const; // analyse conflcit to find the best conflict. Gets & returns the best one in 'maxlevel', 'size' and 'best row' (these are all UINT_MAX when calling this function first, i.e. when there is no other possible conflict to compare to the new in 'row') + gaussian_ret handle_matrix_confl(Clause*& confl, const matrixset& m, const uint size, const uint maxlevel, const uint best_row); + gaussian_ret handle_matrix_prop(matrixset& m, const uint row); // Handle matrix propagation at row 'row' + vec tmp_clause; + + //propagation&conflict handling + void cancel_until_sublevel(const uint until_sublevel); // cancels until sublevel 'until_sublevel'. The var 'until_sublevel' must NOT go over the current level. I.e. this function is ONLY for moving inside the current level + uint find_sublevel(const Var v) const; // find the sublevel (i.e. trail[X]) of a given variable + + //helper functions + bool at_first_init() const; + bool should_init() const; + bool should_check_gauss(const uint decisionlevel, const uint starts) const; + void disable_if_necessary(); + void reset_stats(); + void update_last_one_in_col(matrixset& m); + +private: + + //debug functions + bool check_no_conflict(matrixset& m) const; // Are there any conflicts that the matrixset 'm' causes? + const bool nothing_to_propagate(matrixset& m) const; // Are there any conflicts of propagations that matrixset 'm' clauses? + template + void print_matrix_row(const T& row) const; // Print matrix row 'row' + template + void print_matrix_row_with_assigns(const T& row) const; + void check_matrix_against_varset(PackedMatrix& matrix,const matrixset& m) const; + const bool check_last_one_in_cols(matrixset& m) const; + const void check_first_one_in_row(matrixset& m, const uint j); + void print_matrix(matrixset& m) const; + void print_last_one_in_cols(matrixset& m) const; + static const string lbool_to_string(const lbool toprint); +}; + +inline bool Gaussian::should_init() const +{ + return (config.decision_until > 0); +} + +inline bool Gaussian::should_check_gauss(const uint decisionlevel, const uint starts) const +{ + return (!disabled + && decisionlevel < config.decision_until); +} + +inline void Gaussian::canceling(const uint sublevel) +{ + if (disabled) + return; + uint a = 0; + for (int i = clauses_toclear.size()-1; i >= 0 && clauses_toclear[i].second > sublevel; i--) { + clauseFree(clauses_toclear[i].first); + a++; + } + clauses_toclear.resize(clauses_toclear.size()-a); + + if (messed_matrix_vars_since_reversal) + return; + int c = std::min((int)gauss_last_level, (int)(solver.trail.size())-1); + for (; c >= (int)sublevel; c--) { + Var var = solver.trail[c].var(); + if (var < var_is_in.getSize() + && var_is_in[var] + && cur_matrixset.var_is_set[var]) { + messed_matrix_vars_since_reversal = true; + return; + } + } +} + +inline const uint32_t Gaussian::get_unit_truths() const +{ + return unit_truths; +} + +inline const uint Gaussian::get_called() const +{ + return called; +} + +inline const uint Gaussian::get_useful_prop() const +{ + return useful_prop; +} + +inline const uint Gaussian::get_useful_confl() const +{ + return useful_confl; +} + +inline const bool Gaussian::get_disabled() const +{ + return disabled; +} + +inline void Gaussian::set_disabled(const bool toset) +{ + disabled = toset; +} + +std::ostream& operator << (std::ostream& os, const vec& v); + +#endif //GAUSSIAN_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/GaussianConfig.h b/packages/bee/cryptominisat-2.5.1/Solver/GaussianConfig.h new file mode 100755 index 000000000..c9871627b --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/GaussianConfig.h @@ -0,0 +1,56 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef GAUSSIANCONFIG_H +#define GAUSSIANCONFIG_H + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "PackedRow.h" + +class GaussianConfig +{ + public: + + GaussianConfig() : + only_nth_gauss_save(2) + , decision_until(0) + , dontDisable(false) + , noMatrixFind(false) + , orderCols(true) + , iterativeReduce(true) + , maxMatrixRows(1000) + , minMatrixRows(20) + { + } + + //tuneable gauss parameters + uint only_nth_gauss_save; //save only every n-th gauss matrix + uint decision_until; //do Gauss until this level + bool dontDisable; //If activated, gauss elimination is never disabled + bool noMatrixFind; //Put all xor-s into one matrix, don't find matrixes + bool orderCols; //Order columns according to activity + bool iterativeReduce; //Don't minimise matrix work + uint32_t maxMatrixRows; //The maximum matrix size -- no. of rows + uint32_t minMatrixRows; //The minimum matrix size -- no. of rows +}; + +#endif //GAUSSIANCONFIG_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Logger.cpp b/packages/bee/cryptominisat-2.5.1/Solver/Logger.cpp new file mode 100755 index 000000000..f1ac52e22 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Logger.cpp @@ -0,0 +1,907 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +using std::cout; +using std::endl; +using std::ofstream; + +#include "Logger.h" +#include "SolverTypes.h" +#include "Solver.h" + +#ifdef USE_GAUSS +#include "Gaussian.h" +#endif //USE_GAUSS + +#define FST_WIDTH 10 +#define SND_WIDTH 35 +#define TRD_WIDTH 10 + +Logger::Logger(int& _verbosity) : + proof_graph_on(false) + , mini_proof(false) + , statistics_on(false) + + , max_print_lines(20) + , uniqueid(1) + + , proof(NULL) + + , sum_conflict_depths(0) + , no_conflicts(0) + , no_decisions(0) + , no_propagations(0) + , sum_decisions_on_branches(0) + , sum_propagations_on_branches(0) + + , verbosity(_verbosity) + , begin_called(false) + , proofStarts(0) +{ + runid /= 10; + runid = time(NULL) % 10000; + if (verbosity >= 1) printf("c RunID is: #%d\n",runid); +} + +void Logger::setSolver(const Solver* _s) +{ + S = _s; +} + +// Adds a new variable to the knowledge of the logger +void Logger::new_var(const Var var) +{ + if (!statistics_on && !proof_graph_on) + return; + + if (varnames.size() <= var) { + varnames.resize(var+1, "Noname"); + times_var_propagated.resize(var+1, 0); + times_var_guessed.resize(var+1, 0); + depths_of_assigns_for_var.resize(var+1); + depths_of_assigns_unit.resize(var+1, false); + } +} + +// Resizes the groupnames and other, related vectors to accomodate for a new group +void Logger::new_group(const uint group) +{ + if (groupnames.size() <= group) { + groupnames.resize(group+1, "Noname"); + times_group_caused_conflict.resize(group+1, 0); + times_group_caused_propagation.resize(group+1, 0); + depths_of_propagations_for_group.resize(group+1); + depths_of_propagations_unit.resize(group+1, false); + depths_of_conflicts_for_group.resize(group+1); + } +} + +string Logger::cut_name_to_size(const string& name) const +{ + string ret = name; + uint len = name.length(); + while(len > 0 && (name[len-1] == ' ' || name[len-1] == 0x0A || name[len-1] == 0x0D)) { + ret.resize(len-1); + len--; + } + + if (len > SND_WIDTH-3) { + ret[SND_WIDTH-3] = '\0'; + ret[SND_WIDTH-4] = '.'; + ret[SND_WIDTH-5] = '.'; + } + + return ret; +} + +// Adds the new clause group's name to the information stored +void Logger::set_group_name(const uint group, const char* name_tmp) +{ + if (!statistics_on && !proof_graph_on) + return; + + string name; + if (name_tmp == NULL) return; + else name = name_tmp; + + set_group_name(group, name); +} + +void Logger::set_group_name(const uint group, string& name) +{ + new_group(group); + + if (name == "Noname") return; + + if (groupnames[group] == "Noname") { + groupnames[group] = name; + } else if (groupnames[group] != name) { + std::cout << "Error! Group no. " << group << "has been named twice. First, as '" << groupnames[group] << "', then second as '" << name << "'. Name the same group the same always, or don't give a name to the second iteration of the same group (i.e just write 'c g groupnumber' on the line" << std::endl; + exit(-1); + } +} + +string Logger::get_group_name(const uint group) const +{ + assert(group < groupnames.size()); + return groupnames[group]; +} + +string Logger::get_var_name(const Var var) const +{ + if (var >= varnames.size()) return "unknown"; + return varnames[var]; +} + +// sets the variable's name +void Logger::set_variable_name(const uint var, char* name_tmp) +{ + if (!statistics_on && !proof_graph_on) + return; + + new_var(var); + + string name; + if (name_tmp == NULL) + name = ""; + else + name = name_tmp; + + if (varnames[var] == "Noname") { + varnames[var] = name; + } else if (varnames[var] != name) { + printf("Error! Variable no. %d has been named twice. First, as '%s', then second as '%s'. Name the same group the same always, or don't give a name to the second iteration of the same group (i.e just write 'c g groupnumber' on the line\n", var+1, varnames[var].c_str(), name.c_str()); + exit(-1); + } +} + +void Logger::first_begin() +{ + if (begin_called) + return; + + begin(); +} + +void Logger::begin() +{ + begin_called = true; + if (proof_graph_on) { + std::stringstream filename; + filename << "proofs/" << runid << "-proof" << proofStarts++ << "-" << S->starts << ".dot"; + + if (S->starts == 0) + history.push_back(uniqueid); + else { + if (mini_proof) + history.resize(S->decisionLevel()+1); + else + history.resize(S->trail.size()+1); + } + + proof = fopen(filename.str().c_str(),"w"); + if (!proof) printf("Couldn't open proof file '%s' for writing\n", filename.str().c_str()), exit(-1); + fprintf(proof, "digraph G {\n"); + fprintf(proof,"node%d [shape=circle, label=\"BEGIN\", root];\n", history[history.size()-1]); + } + + if (statistics_on) + reset_statistics(); +} + +// For noting conflicts. Updates the proof graph and the statistics. +template +void Logger::conflict(const confl_type type, const uint goback_level, const uint group, const T& learnt_clause) +{ + first_begin(); + assert(!(proof == NULL && proof_graph_on)); + + const uint goback_sublevel = S->trail_lim[goback_level]; + + if (proof_graph_on) { + uniqueid++; + fprintf(proof,"node%d [shape=polygon,sides=5,label=\"",uniqueid); + + if (!mini_proof) { + for (uint32_t i = 0; i != learnt_clause.size(); i++) { + if (learnt_clause[i].sign()) fprintf(proof,"-"); + int myvar = learnt_clause[i].var(); + if (varnames[myvar] != "Noname") + fprintf(proof,"%s\\n",varnames[myvar].c_str()); + else + fprintf(proof,"Var: %d\\n",myvar); + } + } + fprintf(proof,"\"];\n"); + + fprintf(proof,"node%d -> node%d [label=\"",history[history.size()-1],uniqueid); + if (type == gauss_confl_type) + fprintf(proof,"Gauss\",style=bold"); + else + fprintf(proof,"%s\"", groupnames[group].c_str()); + fprintf(proof,"];\n"); + + if (!mini_proof) + history.resize(goback_sublevel+1); + else + history.resize(goback_level+1); + fprintf(proof,"node%d -> node%d [style=dotted];\n",uniqueid,history[history.size()-1]); + } + + if (statistics_on) { + times_group_caused_conflict[group]++; + depths_of_conflicts_for_group[group].sum += S->decisionLevel(); + depths_of_conflicts_for_group[group].num ++; + + no_conflicts++; + sum_conflict_depths += S->trail.size() - S->trail_lim[0]; + sum_decisions_on_branches += S->decisionLevel(); + sum_propagations_on_branches += S->trail.size() - S->trail_lim[0] - S->decisionLevel(); + + if (branch_depth_distrib.size() <= S->decisionLevel()) + branch_depth_distrib.resize(S->decisionLevel()+1, 0); + branch_depth_distrib[S->decisionLevel()]++; + } +} + +template void Logger::conflict(const confl_type type, const uint goback_level, const uint group, const Clause& learnt_clause); + +template void Logger::conflict(const confl_type type, const uint goback_level, const uint group, const vec& learnt_clause); + +// Propagating a literal. Type of literal and the (learned clause's)/(propagating clause's)/(etc) group must be given. Updates the proof graph and the statistics. note: the meaning of the variable 'group' depends on the type +void Logger::propagation(const Lit lit, Clause* c) +{ + first_begin(); + assert(!(proof == NULL && proof_graph_on)); + + uint group; + prop_type type; + if (c == NULL) { + if (S->decisionLevel() == 0) + type = add_clause_type; + else + type = guess_type; + group = std::numeric_limits::max(); + } else { + type = simple_propagation_type; + group = c->getGroup(); + } + + //graph + if (proof_graph_on && (!mini_proof || type == guess_type)) { + uniqueid++; + + fprintf(proof,"node%d [shape=box, label=\"",uniqueid);; + if (lit.sign()) + fprintf(proof,"-"); + if (varnames[lit.var()] != "Noname") + fprintf(proof,"%s\"];\n",varnames[lit.var()].c_str()); + else + fprintf(proof,"Var: %d\"];\n",lit.var()); + + fprintf(proof,"node%d -> node%d [label=\"",history[history.size()-1],uniqueid); + + switch (type) { + case simple_propagation_type: + fprintf(proof,"%s\"];\n", groupnames[group].c_str()); + break; + + case add_clause_type: + fprintf(proof,"red. from clause\"];\n"); + break; + + case guess_type: + fprintf(proof,"guess\",style=bold];\n"); + break; + } + history.push_back(uniqueid); + } + + if (statistics_on) { + switch (type) { + case simple_propagation_type: + depths_of_propagations_for_group[group].sum += S->decisionLevel(); + depths_of_propagations_for_group[group].num ++; + if (S->decisionLevel() == 0) depths_of_propagations_unit[group] = true; + times_group_caused_propagation[group]++; + case add_clause_type: + no_propagations++; + times_var_propagated[lit.var()]++; + depths_of_assigns_for_var[lit.var()].sum += S->decisionLevel(); + depths_of_assigns_for_var[lit.var()].num ++; + if (S->decisionLevel() == 0) depths_of_assigns_unit[lit.var()] = true; + break; + case guess_type: + no_decisions++; + times_var_guessed[lit.var()]++; + + depths_of_assigns_for_var[lit.var()].sum += S->decisionLevel(); + depths_of_assigns_for_var[lit.var()].num ++; + break; + } + } +} + +// Ending of a restart iteration +void Logger::end(const finish_type finish) +{ + first_begin(); + assert(!(proof == NULL && proof_graph_on)); + + if (proof_graph_on) { + uniqueid++; + switch (finish) { + case model_found: + fprintf(proof,"node%d [shape=doublecircle, label=\"MODEL\"];\n",uniqueid); + break; + case unsat_model_found: + fprintf(proof,"node%d [shape=doublecircle, label=\"UNSAT\"];\n",uniqueid); + break; + case restarting: + fprintf(proof,"node%d [shape=doublecircle, label=\"Re-starting\\nsearch\"];\n",uniqueid); + break; + } + + fprintf(proof,"node%d -> node%d;\n",history[history.size()-1],uniqueid); + fprintf(proof,"}\n"); + history.push_back(uniqueid); + + proof = (FILE*)fclose(proof); + assert(proof == NULL); + } + + if (statistics_on) { + printstats(); + if (finish == restarting) + reset_statistics(); + } + + if (model_found || unsat_model_found) + begin_called = false; +} + +void Logger::print_footer() const +{ + cout << "+" << std::setfill('-') << std::setw(FST_WIDTH+SND_WIDTH+TRD_WIDTH+4) << "-" << std::setfill(' ') << "+" << endl; +} + +void Logger::print_assign_var_order() const +{ + vector > prop_ordered; + for (uint i = 0; i < depths_of_assigns_for_var.size(); i++) { + double avg = (double)depths_of_assigns_for_var[i].sum + /(double)depths_of_assigns_for_var[i].num; + if (depths_of_assigns_for_var[i].num > 0 && !depths_of_assigns_unit[i]) + prop_ordered.push_back(std::make_pair(avg, i)); + } + + if (!prop_ordered.empty()) { + print_footer(); + print_simple_line(" Variables are assigned in the following order"); + print_simple_line(" (unitary clauses not shown)"); + print_header("var", "var name", "avg order"); + std::sort(prop_ordered.begin(), prop_ordered.end()); + print_vars(prop_ordered); + } +} + +void Logger::print_prop_order() const +{ + vector > prop_ordered; + for (uint i = 0; i < depths_of_propagations_for_group.size(); i++) { + double avg = (double)depths_of_propagations_for_group[i].sum + /(double)depths_of_propagations_for_group[i].num; + if (depths_of_propagations_for_group[i].num > 0 && !depths_of_propagations_unit[i]) + prop_ordered.push_back(std::make_pair(avg, i)); + } + + if (!prop_ordered.empty()) { + print_footer(); + print_simple_line(" Propagation depth order of clause groups"); + print_simple_line(" (unitary clauses not shown)"); + print_header("group", "group name", "avg order"); + std::sort(prop_ordered.begin(), prop_ordered.end()); + print_groups(prop_ordered); + } +} + +void Logger::print_confl_order() const +{ + vector > confl_ordered; + for (uint i = 0; i < depths_of_conflicts_for_group.size(); i++) { + double avg = (double)depths_of_conflicts_for_group[i].sum + /(double)depths_of_conflicts_for_group[i].num; + if (depths_of_conflicts_for_group[i].num > 0) + confl_ordered.push_back(std::make_pair(avg, i)); + } + + if (!confl_ordered.empty()) { + print_footer(); + print_simple_line(" Avg. conflict depth order of clause groups"); + print_header("groupno", "group name", "avg. depth"); + std::sort(confl_ordered.begin(), confl_ordered.end()); + print_groups(confl_ordered); + } +} + + +void Logger::print_times_var_guessed() const +{ + vector > times_var_ordered; + for (uint32_t i = 0; i != varnames.size(); i++) if (times_var_guessed[i] > 0) + times_var_ordered.push_back(std::make_pair(times_var_guessed[i], i)); + + if (!times_var_ordered.empty()) { + print_footer(); + print_simple_line(" No. times variable branched on"); + print_header("var", "var name", "no. times"); + std::sort(times_var_ordered.rbegin(), times_var_ordered.rend()); + print_vars(times_var_ordered); + } +} + +void Logger::print_times_group_caused_propagation() const +{ + vector > props_group_ordered; + for (uint i = 0; i < times_group_caused_propagation.size(); i++) + if (times_group_caused_propagation[i] > 0) + props_group_ordered.push_back(std::make_pair(times_group_caused_propagation[i], i)); + + if (!props_group_ordered.empty()) { + print_footer(); + print_simple_line(" No. propagations made by clause groups"); + print_header("group", "group name", "no. props"); + std::sort(props_group_ordered.rbegin(),props_group_ordered.rend()); + print_groups(props_group_ordered); + } +} + +void Logger::print_times_group_caused_conflict() const +{ + vector > confls_group_ordered; + for (uint i = 0; i < times_group_caused_conflict.size(); i++) + if (times_group_caused_conflict[i] > 0) + confls_group_ordered.push_back(std::make_pair(times_group_caused_conflict[i], i)); + + if (!confls_group_ordered.empty()) { + print_footer(); + print_simple_line(" No. conflicts made by clause groups"); + print_header("group", "group name", "no. confl"); + std::sort(confls_group_ordered.rbegin(), confls_group_ordered.rend()); + print_groups(confls_group_ordered); + } +} + +template +void Logger::print_line(const uint& number, const string& name, const T& value) const +{ + cout << "|" << std::setw(FST_WIDTH) << number << " " << std::setw(SND_WIDTH) << name << " " << std::setw(TRD_WIDTH) << value << "|" << endl; +} + +void Logger::print_header(const string& first, const string& second, const string& third) const +{ + cout << "|" << std::setw(FST_WIDTH) << first << " " << std::setw(SND_WIDTH) << second << " " << std::setw(TRD_WIDTH) << third << "|" << endl; + print_footer(); +} + +void Logger::print_groups(const vector >& to_print) const +{ + uint i = 0; + typedef vector >::const_iterator myiterator; + for (myiterator it = to_print.begin(); it != to_print.end() && i < max_print_lines; it++, i++) { + print_line(it->second+1, cut_name_to_size(groupnames[it->second]), it->first); + } + print_footer(); +} + +void Logger::print_groups(const vector >& to_print) const +{ + uint i = 0; + typedef vector >::const_iterator myiterator; + for (myiterator it = to_print.begin(); it != to_print.end() && i < max_print_lines; it++, i++) { + print_line(it->second+1, cut_name_to_size(groupnames[it->second]), it->first); + } + print_footer(); +} + +void Logger::print_vars(const vector >& to_print) const +{ + uint i = 0; + for (vector >::const_iterator it = to_print.begin(); it != to_print.end() && i < max_print_lines; it++, i++) + print_line(it->second+1, cut_name_to_size(varnames[it->second]), it->first); + + print_footer(); +} + +void Logger::print_vars(const vector >& to_print) const +{ + uint i = 0; + for (vector >::const_iterator it = to_print.begin(); it != to_print.end() && i < max_print_lines; it++, i++) { + print_line(it->second+1, cut_name_to_size(varnames[it->second]), it->first); + } + + print_footer(); +} + +template +void Logger::print_line(const string& str, const T& num) const +{ + cout << "|" << std::setw(FST_WIDTH+SND_WIDTH+4) << str << std::setw(TRD_WIDTH) << num << "|" << endl; +} + +void Logger::print_simple_line(const string& str) const +{ + cout << "|" << std::setw(FST_WIDTH+SND_WIDTH+TRD_WIDTH+4) << str << "|" << endl; +} + +void Logger::print_center_line(const string& str) const +{ + uint middle = (FST_WIDTH+SND_WIDTH+TRD_WIDTH+4-str.size())/2; + int rest = FST_WIDTH+SND_WIDTH+TRD_WIDTH+4-middle*2-str.size(); + cout << "|" << std::setw(middle) << " " << str << std::setw(middle + rest) << " " << "|" << endl; +} + +void Logger::print_branch_depth_distrib() const +{ + //cout << "--- Branch depth stats ---" << endl; + + const uint range = 20; + map range_stat; + + uint i = 0; + for (vector::const_iterator it = branch_depth_distrib.begin(); it != branch_depth_distrib.end(); it++, i++) { + range_stat[i/range] += *it; + } + + print_footer(); + print_simple_line(" No. search branches with branch depth between"); + print_line("Branch depth between", "no. br.-s"); + print_footer(); + + std::stringstream ss; + ss << "branch_depths/branch_depth_file" << runid << "-" << S->starts << ".txt"; + ofstream branch_depth_file; + branch_depth_file.open(ss.str().c_str()); + i = 0; + + for (map::iterator it = range_stat.begin(); it != range_stat.end(); it++, i++) { + std::stringstream ss2; + ss2 << it->first*range << " - " << it->first*range + range-1; + print_line(ss2.str(), it->second); + + if (branch_depth_file.is_open()) { + branch_depth_file << i << "\t" << it->second << "\t"; + if (i % 5 == 0) + branch_depth_file << "\"" << it->first*range << "\""; + else + branch_depth_file << "\"\""; + branch_depth_file << endl; + } + } + if (branch_depth_file.is_open()) + branch_depth_file.close(); + print_footer(); + +} + +void Logger::print_learnt_clause_distrib() const +{ + map learnt_sizes; + const vec& learnts = S->get_learnts(); + + uint maximum = 0; + + for (uint i = 0; i < learnts.size(); i++) + { + uint size = learnts[i]->size(); + maximum = std::max(maximum, size); + + map::iterator it = learnt_sizes.find(size); + if (it == learnt_sizes.end()) + learnt_sizes[size] = 1; + else + it->second++; + } + + learnt_sizes[0] = S->get_unitary_learnts_num(); + + uint slice = (maximum+1)/max_print_lines + (bool)((maximum+1)%max_print_lines); + + print_footer(); + print_simple_line(" Learnt clause length distribution"); + print_line("Length between", "no. cl."); + print_footer(); + + uint until = slice; + uint from = 0; + while(until < maximum+1) { + std::stringstream ss2; + ss2 << from << " - " << until-1; + + uint sum = 0; + for (; from < until; from++) { + map::const_iterator it = learnt_sizes.find(from); + if (it != learnt_sizes.end()) + sum += it->second; + } + + print_line(ss2.str(), sum); + + until += slice; + } + + print_footer(); + + print_leearnt_clause_graph_distrib(maximum, learnt_sizes); +} + +void Logger::print_leearnt_clause_graph_distrib(const uint maximum, const map& learnt_sizes) const +{ + uint no_slices = FST_WIDTH + SND_WIDTH + TRD_WIDTH + 4-3; + uint slice = (maximum+1)/no_slices + (bool)((maximum+1)%no_slices); + uint until = slice; + uint from = 0; + vector slices; + uint hmax = 0; + while(until < maximum+1) { + uint sum = 0; + for (; from < until; from++) { + map::const_iterator it = learnt_sizes.find(from); + if (it != learnt_sizes.end()) + sum += it->second; + } + slices.push_back(sum); + until += slice; + hmax = std::max(hmax, sum); + } + slices.resize(no_slices, 0); + + uint height = max_print_lines; + uint hslice = (hmax+1)/height + (bool)((hmax+1)%height); + if (hslice == 0) return; + + print_simple_line(" Learnt clause distribution in graph form"); + print_footer(); + string yaxis = "Number"; + uint middle = (height-yaxis.size())/2; + + for (int i = height-1; i > 0; i--) { + cout << "| "; + if (height-1-i >= middle && height-1-i-middle < yaxis.size()) + cout << yaxis[height-1-i-middle] << " "; + else + cout << " "; + for (uint i2 = 0; i2 != no_slices; i2++) { + if (slices[i2]/hslice >= (uint)i) cout << "+"; + else cout << " "; + } + cout << "|" << endl; + } + print_center_line(" Learnt clause size"); + print_footer(); +} + +void Logger::print_general_stats() const +{ + print_footer(); + print_simple_line(" Standard MiniSat stats -- for all restarts until now"); + print_footer(); + print_line("Restart number", S->starts); + print_line("Number of conflicts", S->conflicts); + print_line("Number of decisions", S->decisions); + print_line("Number of variables", S->order_heap.size()); + print_line("Number of clauses", S->nClauses()); + print_line("Number of literals in clauses",S->clauses_literals); + print_line("Avg. literals per learnt clause",(double)S->learnts_literals/(double)S->nLearnts()); + print_line("Progress estimate (%):", S->progress_estimate*100.0); + print_line("All unitary learnts until now", S->get_unitary_learnts_num()); + print_footer(); +} + +void Logger::print_learnt_unitaries(const uint from, const string display) const +{ + print_footer(); + print_simple_line(display); + print_header("var", "name", "value"); + uint32_t until; + if (S->decisionLevel() > 0) + until = S->trail_lim[0]; + else + until = S->trail.size(); + for (uint i = from; i < until; i++) { + Var var = S->trail[i].var(); + bool value = !(S->trail[i].sign()); + print_line(var+1, cut_name_to_size(varnames[var]), value); + } + print_footer(); +} + + +// Prints statistics on the console +void Logger::printstats() const +{ + assert(statistics_on); + assert(varnames.size() == times_var_guessed.size()); + assert(varnames.size() == times_var_propagated.size()); + + const uint fullwidth = FST_WIDTH+SND_WIDTH+TRD_WIDTH+4; + cout << endl; + cout << "+" << std::setfill('=') << std::setw(fullwidth) << "=" << "+" << endl; + std::stringstream tmp; + tmp << " STATS FOR RESTART NO. " << std::setw(3) << S->starts << " BEGIN "; + uint len = (fullwidth-2)/2-tmp.str().length()/2; + uint len2 = len + tmp.str().length()%2 + (fullwidth-2)%2; + cout << "||" << std::setfill('*') << std::setw(len) << "*" << tmp.str() << std::setw(len2) << "*" << "||" << endl; + cout << "+" << std::setfill('=') << std::setw(fullwidth) << "=" << std::setfill(' ') << "+" << endl; + + cout.setf(std::ios_base::left); + cout.precision(2); + print_statistics_note(); + print_times_var_guessed(); + print_times_group_caused_propagation(); + print_times_group_caused_conflict(); + print_prop_order(); + print_confl_order(); + print_assign_var_order(); + print_branch_depth_distrib(); + print_learnt_clause_distrib(); + #ifdef USE_GAUSS + print_matrix_stats(); + #endif //USE_GAUSS + print_learnt_unitaries(0," Unitary clauses learnt until now"); + print_learnt_unitaries(last_unitary_learnt_clauses, " Unitary clauses during this restart"); + print_advanced_stats(); + print_general_stats(); +} + +#ifdef USE_GAUSS +void Logger::print_matrix_stats() const +{ + print_footer(); + print_simple_line(" Matrix statistics"); + print_footer(); + + uint i = 0; + for (vector::const_iterator it = S->gauss_matrixes.begin(), end = S->gauss_matrixes.end(); it != end; it++, i++) { + std::stringstream s; + s << "Matrix " << i << " enabled"; + std::stringstream tmp; + tmp << std::boolalpha << !(*it)->get_disabled(); + print_line(s.str(), tmp.str()); + + s.str(""); + s << "Matrix " << i << " called"; + print_line(s.str(), (*it)->get_called()); + + s.str(""); + s << "Matrix " << i << " propagations"; + print_line(s.str(), (*it)->get_useful_prop()); + + s.str(""); + s << "Matrix " << i << " conflicts"; + print_line(s.str(), (*it)->get_useful_confl()); + } + + print_footer(); +} +#endif //USE_GAUSS + +void Logger::print_advanced_stats() const +{ + print_footer(); + print_simple_line(" Advanced statistics - for only this restart"); + print_footer(); + print_line("Unitary learnts", S->get_unitary_learnts_num() - last_unitary_learnt_clauses); + print_line("No. branches visited", no_conflicts); + print_line("Avg. branch depth", (double)sum_conflict_depths/(double)no_conflicts); + print_line("No. decisions", no_decisions); + print_line("No. propagations",no_propagations); + + //printf("no progatations/no decisions (i.e. one decision gives how many propagations on average *for the whole search graph*): %f\n", (double)no_propagations/(double)no_decisions); + //printf("no propagations/sum decisions on branches (if you look at one specific branch, what is the average number of propagations you will find?): %f\n", (double)no_propagations/(double)sum_decisions_on_branches); + + print_simple_line("sum decisions on branches/no. branches"); + print_simple_line(" (in a given branch, what is the avg."); + print_line(" no. of decisions?)",(double)sum_decisions_on_branches/(double)no_conflicts); + + print_simple_line("sum propagations on branches/no. branches"); + print_simple_line(" (in a given branch, what is the"); + print_line(" avg. no. of propagations?)",(double)sum_propagations_on_branches/(double)no_conflicts); + + print_footer(); +} + +void Logger::print_statistics_note() const +{ + print_footer(); + print_simple_line("Statistics note: If you used CryptoMiniSat as"); + print_simple_line("a library then vars are all shifted by 1 here"); + print_simple_line("and in every printed output of the solver."); + print_simple_line("This does not apply when you use CryptoMiniSat"); + print_simple_line("as a stand-alone program."); + print_footer(); +} + +// resets all stored statistics. Might be useful, to generate statistics for each restart and not for the whole search in general +void Logger::reset_statistics() +{ + assert(S->decisionLevel() == 0); + assert(times_var_guessed.size() == times_var_propagated.size()); + assert(times_group_caused_conflict.size() == times_group_caused_propagation.size()); + + typedef vector::iterator vecit; + for (vecit it = times_var_guessed.begin(); it != times_var_guessed.end(); it++) + *it = 0; + + for (vecit it = times_var_propagated.begin(); it != times_var_propagated.end(); it++) + *it = 0; + + for (vecit it = times_group_caused_conflict.begin(); it != times_group_caused_conflict.end(); it++) + *it = 0; + + for (vecit it = times_group_caused_propagation.begin(); it != times_group_caused_propagation.end(); it++) + *it = 0; + + for (vecit it = confls_by_group.begin(); it != confls_by_group.end(); it++) + *it = 0; + + for (vecit it = props_by_group.begin(); it != props_by_group.end(); it++) + *it = 0; + + typedef vector::iterator avgIt; + + for (avgIt it = depths_of_propagations_for_group.begin(); it != depths_of_propagations_for_group.end(); it++) { + it->sum = 0; + it->num = 0; + } + + for (avgIt it = depths_of_conflicts_for_group.begin(); it != depths_of_conflicts_for_group.end(); it++) { + it->sum = 0; + it->num = 0; + } + + for (avgIt it = depths_of_assigns_for_var.begin(); it != depths_of_assigns_for_var.end(); it++) { + it->sum = 0; + it->num = 0; + } + for (uint i = 0; i < depths_of_assigns_unit.size(); i++) + depths_of_assigns_unit[i] = false; + + for (uint i = 0; i < depths_of_propagations_unit.size(); i++) + depths_of_propagations_unit[i] = false; + + sum_conflict_depths = 0; + no_conflicts = 0; + no_decisions = 0; + no_propagations = 0; + sum_decisions_on_branches = 0; + sum_propagations_on_branches = 0; + branch_depth_distrib.clear(); + last_unitary_learnt_clauses = S->get_unitary_learnts_num(); +} + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Logger.h b/packages/bee/cryptominisat-2.5.1/Solver/Logger.h new file mode 100755 index 000000000..a7c4dc372 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Logger.h @@ -0,0 +1,184 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef LOGGER_H +#define LOGGER_H + +#include +#include +#include +#include +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "Vec.h" +#include "Heap.h" +#include "Alg.h" +#include "SolverTypes.h" +#include "limits.h" +#include "Clause.h" + +using std::vector; +using std::pair; +using std::string; +using std::map; + +class Solver; + +class MyAvg { +public: + MyAvg() : + sum(0) + , num(0) + {} + + uint sum; + uint num; +}; + +class Logger +{ +public: + Logger(int& vebosity); + void setSolver(const Solver* S); + + //types of props, confl, and finish + enum prop_type { add_clause_type, guess_type, simple_propagation_type}; + enum confl_type { simple_confl_type, gauss_confl_type }; + enum finish_type { model_found, unsat_model_found, restarting}; + + //Conflict and propagation(guess is also a proapgation...) + template + void conflict(const confl_type type, const uint goback_level, const uint group, const T& learnt_clause); + void propagation(const Lit lit, Clause* c); + + //functions to add/name variables + void new_var(const Var var); + void set_variable_name(const uint var, char* name_tmp); + + //function to name clause groups + void set_group_name(const uint group, const char* name_tmp); + void set_group_name(const uint group, string& name); + string get_group_name(const uint group) const; + string get_var_name(const Var var) const; + + void begin(); + void end(const finish_type finish); + + void newclause(const vec& ps, const bool xor_clause, const uint group); + + bool proof_graph_on; + bool mini_proof; + bool statistics_on; + +private: + void new_group(const uint group); + string cut_name_to_size(const string& name) const; + + void print_groups(const vector >& to_print) const; + void print_groups(const vector >& to_print) const; + void print_vars(const vector >& to_print) const; + void print_vars(const vector >& to_print) const; + void print_times_var_guessed() const; + void print_times_group_caused_propagation() const; + void print_times_group_caused_conflict() const; + void print_branch_depth_distrib() const; + void print_learnt_clause_distrib() const; + void print_leearnt_clause_graph_distrib(const uint maximum, const map& learnt_sizes) const; + void print_advanced_stats() const; + void print_statistics_note() const; + void print_matrix_stats() const; + void print_general_stats() const; + void print_learnt_unitaries(const uint from, const string display) const; + + uint max_print_lines; + template + void print_line(const uint& number, const string& name, const T& value) const; + void print_header(const string& first, const string& second, const string& third) const; + void print_footer() const; + template + void print_line(const string& str, const T& num) const; + void print_simple_line(const string& str) const; + void print_center_line(const string& str) const; + + void print_confl_order() const; + void print_prop_order() const; + void print_assign_var_order() const; + void printstats() const; + void reset_statistics(); + + //internal data structures + uint uniqueid; //used to store the last unique ID given to a node + vector history; //stores the node uniqueIDs + + //graph drawing + FILE* proof; //The file to store the proof + uint runid; + + //--------------------- + //statistics collection + //--------------------- + + //group and var names + vector groupnames; + vector varnames; + + //confls and props grouped by clause groups + vector confls_by_group; + vector props_by_group; + + //props and guesses grouped by vars + vector times_var_guessed; + vector times_var_propagated; + + vector times_group_caused_conflict; + vector times_group_caused_propagation; + + vector depths_of_propagations_for_group; + vector depths_of_propagations_unit; + vector depths_of_conflicts_for_group; + vector depths_of_assigns_for_var; + vector depths_of_assigns_unit; + + //the distribution of branch depths. first = depth, second = number of occurances + vector branch_depth_distrib; + + uint64_t sum_conflict_depths; + uint64_t no_conflicts; + uint64_t no_decisions; + uint64_t no_propagations; + uint64_t sum_decisions_on_branches; + uint64_t sum_propagations_on_branches; + uint64_t last_unitary_learnt_clauses; + + //message display properties + const int& verbosity; + + const Solver* S; + + void first_begin(); + bool begin_called; + uint proofStarts; +}; + +#endif //LOGGER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Main.C b/packages/bee/cryptominisat-2.5.1/Solver/Main.C new file mode 100755 index 000000000..b3d5356d2 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Main.C @@ -0,0 +1,878 @@ +/******************************************************************************************[Main.C] +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include + +#ifndef DISABLE_ZLIB +#include +#endif // DISABLE_ZLIB + +#include "Logger.h" +#include "Solver.h" +#include "time_mem.h" +#include "constants.h" + +using std::cout; +using std::endl; + +/*************************************************************************************/ +#if defined(__linux__) +#include +#endif + +static bool grouping = false; +static bool debugLib = false; +static bool debugNewVar = false; +static char learnts_filename[500]; +static bool dumpLearnts = false; +static uint32_t maxLearntsSize = std::numeric_limits::max(); +static bool printResult = true; + +//================================================================================================= +// DIMACS Parser: + +#define CHUNK_LIMIT 1048576 +#define MAX_NAMES_SIZE 1000 + +class StreamBuffer +{ +#ifdef DISABLE_ZLIB + FILE * in; +#else + gzFile in; +#endif // DISABLE_ZLIB + char buf[CHUNK_LIMIT]; + int pos; + int size; + + void assureLookahead() { + if (pos >= size) { + pos = 0; +#ifdef DISABLE_ZLIB + #ifdef VERBOSE_DEBUG + printf("buf = %08X\n", buf); + printf("sizeof(buf) = %u\n", sizeof(buf)); + #endif //VERBOSE_DEBUG + size = fread(buf, 1, sizeof(buf), in); +#else + size = gzread(in, buf, sizeof(buf)); +#endif // DISABLE_ZLIB + } + } + +public: +#ifdef DISABLE_ZLIB + StreamBuffer(FILE * i) : in(i), pos(0), size(0) { +#else + StreamBuffer(gzFile i) : in(i), pos(0), size(0) { +#endif // DISABLE_ZLIB + assureLookahead(); + } + + int operator * () { + return (pos >= size) ? EOF : buf[pos]; + } + void operator ++ () { + pos++; + assureLookahead(); + } +}; + +//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +template +static void skipWhitespace(B& in) +{ + while ((*in >= 9 && *in <= 13) || *in == 32) + ++in; +} + +template +static void skipLine(B& in) +{ + for (;;) { + if (*in == EOF || *in == '\0') return; + if (*in == '\n') { + ++in; + return; + } + ++in; + } +} + +template +static void untilEnd(B& in, char* ret) +{ + uint32_t sizeRead = 0; + for (;sizeRead < MAX_NAMES_SIZE-1; sizeRead++) { + if (*in == EOF || *in == '\0') return; + if (*in == '\n') { + return; + } + *ret = *in; + ret++; + *ret = '\0'; + ++in; + } +} + + +template +static int parseInt(B& in) +{ + int val = 0; + bool neg = false; + skipWhitespace(in); + if (*in == '-') neg = true, ++in; + else if (*in == '+') ++in; + if (*in < '0' || *in > '9') printf("PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + while (*in >= '0' && *in <= '9') + val = val*10 + (*in - '0'), + ++in; + return neg ? -val : val; +} + +inline std::string stringify(uint x) +{ + std::ostringstream o; + o << x; + return o.str(); +} + +template +static void parseString(B& in, std::string& str) +{ + str.clear(); + skipWhitespace(in); + while (*in != ' ' && *in != '\n') { + str += *in; + ++in; + } +} + +template +static void readClause(B& in, Solver& S, vec& lits) +{ + int parsed_lit; + Var var; + lits.clear(); + for (;;) { + parsed_lit = parseInt(in); + if (parsed_lit == 0) break; + var = abs(parsed_lit)-1; + if (!debugNewVar) { + while (var >= S.nVars()) S.newVar(); + } + lits.push( (parsed_lit > 0) ? Lit(var, false) : Lit(var, true) ); + } +} + +template +static bool match(B& in, const char* str) +{ + for (; *str != 0; ++str, ++in) + if (*str != *in) + return false; + return true; +} + + +template +static void parse_DIMACS_main(B& in, Solver& S) +{ + vec lits; + int group = 0; + string str; + uint debugLibPart = 1; + char name[MAX_NAMES_SIZE]; + + + for (;;) { + skipWhitespace(in); + switch (*in) { + case EOF: + return; + case 'p': + if (match(in, "p cnf")) { + int vars = parseInt(in); + int clauses = parseInt(in); + if (S.verbosity >= 1) { + printf("c | Number of variables: %-12d |\n", vars); + printf("c | Number of clauses: %-12d |\n", clauses); + } + } else { + printf("PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + } + break; + case 'c': + ++in; + parseString(in, str); + if (str == "v" || str == "var") { + int var = parseInt(in); + skipWhitespace(in); + if (var <= 0) cout << "PARSE ERROR! Var number must be a positive integer" << endl, exit(3); + name[0] = '\0'; + untilEnd(in, name); + S.setVariableName(var-1, name); + } else if (debugLib && str == "Solver::solve()") { + lbool ret = S.solve(); + std::string s = "debugLibPart" + stringify(debugLibPart) +".output"; + FILE* res = fopen(s.c_str(), "w"); + if (ret == l_True) { + fprintf(res, "SAT\n"); + for (Var i = 0; i != S.nVars(); i++) + if (S.model[i] != l_Undef) + fprintf(res, "%s%s%d", (i==0)?"":" ", (S.model[i]==l_True)?"":"-", i+1); + fprintf(res, " 0\n"); + } else if (ret == l_False) { + fprintf(res, "UNSAT\n"); + } else if (ret == l_Undef) { + assert(false); + } else { + assert(false); + } + fclose(res); + debugLibPart++; + } else if (debugNewVar && str == "Solver::newVar()") { + S.newVar(); + } else { + //printf("didn't understand in CNF file: 'c %s'\n", str.c_str()); + skipLine(in); + } + break; + default: + bool xor_clause = false; + if ( *in == 'x') xor_clause = true, ++in; + readClause(in, S, lits); + skipLine(in); + + name[0] = '\0'; + + if (!grouping) group++; + else { + if (*in != 'c') { + cout << "PARSE ERROR! Group must be present after earch clause ('c' missing after clause line)" << endl; + exit(3); + } + ++in; + + parseString(in, str); + if (str != "g" && str != "group") { + cout << "PARSE ERROR! Group must be present after each clause('group' missing)!" << endl; + cout << "Instead of 'group' there was:" << str << endl; + exit(3); + } + + group = parseInt(in); + if (group <= 0) printf("PARSE ERROR! Group number must be a positive integer\n"), exit(3); + + skipWhitespace(in); + untilEnd(in, name); + } + + if (xor_clause) { + bool xor_clause_inverted = false; + for (uint32_t i = 0; i < lits.size(); i++) { + xor_clause_inverted ^= lits[i].sign(); + } + S.addXorClause(lits, xor_clause_inverted, group, name); + } else + S.addClause(lits, group, name); + break; + } + } +} + +// Inserts problem into solver. +// +#ifdef DISABLE_ZLIB +static void parse_DIMACS(FILE * input_stream, Solver& S) +#else +static void parse_DIMACS(gzFile input_stream, Solver& S) +#endif // DISABLE_ZLIB +{ + StreamBuffer in(input_stream); + parse_DIMACS_main(in, S); +} + + +//================================================================================================= + +template +inline void printStatsLine(string left, T value, T2 value2, string extra) +{ + cout << std::fixed << std::left << std::setw(24) << left << ": " << std::setw(11) << std::setprecision(2) << value << " (" << std::left << std::setw(9) << std::setprecision(2) << value2 << " " << extra << ")" << std::endl; +} + +template +inline void printStatsLine(string left, T value, string extra = "") +{ + cout << std::fixed << std::left << std::setw(24) << left << ": " << std::setw(11) << std::setprecision(2) << value << extra << std::endl; +} + + +void printStats(Solver& solver) +{ + double cpu_time = cpuTime(); + uint64_t mem_used = memUsed(); + + //Restarts stats + printStatsLine("c restarts", solver.starts); + printStatsLine("c dynamic restarts", solver.dynStarts); + printStatsLine("c static restarts", solver.staticStarts); + printStatsLine("c full restarts", solver.fullStarts); + + //Learnts stats + printStatsLine("c learnts DL2", solver.nbDL2); + printStatsLine("c learnts size 2", solver.nbBin); + printStatsLine("c learnts size 1", solver.get_unitary_learnts_num(), (double)solver.get_unitary_learnts_num()/(double)solver.nVars()*100.0, "% of vars"); + + //Subsumer stats + printStatsLine("c v-elim SatELite", solver.getNumElimSubsume(), (double)solver.getNumElimSubsume()/(double)solver.nVars()*100.0, "% vars"); + printStatsLine("c SatELite time", solver.getTotalTimeSubsumer(), solver.getTotalTimeSubsumer()/cpu_time*100.0, "% time"); + + //XorSubsumer stats + printStatsLine("c v-elim xor", solver.getNumElimXorSubsume(), (double)solver.getNumElimXorSubsume()/(double)solver.nVars()*100.0, "% vars"); + printStatsLine("c xor elim time", solver.getTotalTimeXorSubsumer(), solver.getTotalTimeXorSubsumer()/cpu_time*100.0, "% time"); + + //VarReplacer stats + printStatsLine("c num binary xor trees", solver.getNumXorTrees()); + printStatsLine("c binxor trees' crown", solver.getNumXorTreesCrownSize(), (double)solver.getNumXorTreesCrownSize()/(double)solver.getNumXorTrees(), "leafs/tree"); + + //OTF clause improvement stats + printStatsLine("c OTF clause improved", solver.improvedClauseNo, (double)solver.improvedClauseNo/(double)solver.conflicts, "clauses/conflict"); + printStatsLine("c OTF impr. size diff", solver.improvedClauseSize, (double)solver.improvedClauseSize/(double)solver.improvedClauseNo, " lits/clause"); + + #ifdef USE_GAUSS + if (solver.gaussconfig.decision_until > 0) { + std::cout << "c " << std::endl; + printStatsLine("c gauss unit truths ", solver.get_sum_gauss_unit_truths()); + printStatsLine("c gauss called", solver.get_sum_gauss_called()); + printStatsLine("c gauss conflicts ", solver.get_sum_gauss_confl(), (double)solver.get_sum_gauss_confl() / (double)solver.get_sum_gauss_called() * 100.0, " %"); + printStatsLine("c gauss propagations ", solver.get_sum_gauss_prop(), (double)solver.get_sum_gauss_prop() / (double)solver.get_sum_gauss_called() * 100.0, " %"); + printStatsLine("c gauss useful", ((double)solver.get_sum_gauss_prop() + (double)solver.get_sum_gauss_confl())/ (double)solver.get_sum_gauss_called() * 100.0, " %"); + std::cout << "c " << std::endl; + } + #endif + + //Search stats + printStatsLine("c conflicts", solver.conflicts, (double)solver.conflicts/cpu_time, "/ sec"); + printStatsLine("c decisions", solver.decisions, (double)solver.rnd_decisions*100.0/(double)solver.decisions, "% random"); + printStatsLine("c propagations", solver.propagations, (double)solver.propagations/cpu_time, "/ sec"); + printStatsLine("c conflict literals", solver.tot_literals, (double)(solver.max_literals - solver.tot_literals)*100.0/ (double)solver.max_literals, "% deleted"); + + //General stats + printStatsLine("c Memory used", (double)mem_used / 1048576.0, " MB"); + printStatsLine("c CPU time", cpu_time, " s"); +} + +Solver* solver; +static void SIGINT_handler(int signum) +{ + printf("\n"); + printf("*** INTERRUPTED ***\n"); + printStats(*solver); + if (dumpLearnts) { + solver->dumpSortedLearnts(learnts_filename, maxLearntsSize); + cout << "c Sorted learnt clauses dumped to file '" << learnts_filename << "'" << endl; + } + printf("\n"); + printf("*** INTERRUPTED ***\n"); + exit(1); +} + + +//================================================================================================= +// Main: + +void printUsage(char** argv, Solver& S) +{ +#ifdef DISABLE_ZLIB + printf("USAGE: %s [options] \n\n where input is plain DIMACS.\n\n", argv[0]); +#else + printf("USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n\n", argv[0]); +#endif // DISABLE_ZLIB + printf("OPTIONS:\n\n"); + printf(" --polarity-mode = {true,false,rnd,auto} [default: auto]. Selects the default\n"); + printf(" polarity mode. Auto is the Jeroslow&Wang method\n"); + //printf(" -decay = [ 0 - 1 ]\n"); + printf(" --rnd-freq = [ 0 - 1 ]\n"); + printf(" --verbosity = {0,1,2}\n"); + #ifdef STATS_NEEDED + printf(" --proof-log = Logs the proof into files 'proofN.dot', where N is the\n"); + printf(" restart number. The log can then be visualized using\n"); + printf(" the 'dot' program from the graphviz package\n"); + printf(" --grouping = Lets you group clauses, and customize the groups' names.\n"); + printf(" This helps when printing statistics\n"); + printf(" --stats = Computes and prints statistics during the search\n"); + #endif + printf(" --randomize = [0 - 2^32-1] Sets random seed, used for picking\n"); + printf(" decision variables (default = 0)\n"); + printf(" --restrict = [1 - varnum] when picking random variables to branch\n"); + printf(" on, pick one that in the 'num' most active vars useful\n"); + printf(" for cryptographic problems, where the question is the key,\n"); + printf(" which is usually small (e.g. 80 bits)\n"); + printf(" --restarts = [1 - 2^32-1] No more than the given number of\n"); + printf(" restarts will be performed during search\n"); + printf(" --nonormxorfind = Don't find and collect >2-long xor-clauses from\n"); + printf(" regular clauses\n"); + printf(" --nobinxorfind = Don't find and collect 2-long xor-clauses from\n"); + printf(" regular clauses\n"); + printf(" --noregbxorfind = Don't regularly find and collect 2-long xor-clauses\n"); + printf(" from regular clauses\n"); + printf(" --noconglomerate = Don't conglomerate 2 xor clauses when one var is dependent\n"); + printf(" --nosimplify = Don't do regular simplification rounds\n"); + printf(" --greedyunbound = Greedily unbound variables that are not needed for SAT\n"); + printf(" --debuglib = Solve at specific 'c Solver::solve()' points in the CNF\n"); + printf(" file. Used to debug file generated by Solver's\n"); + printf(" needLibraryCNFFile() function\n"); + printf(" --debugnewvar = Add new vars at specific 'c Solver::newVar()' points in \n"); + printf(" the CNF file. Used to debug file generated by Solver's\n"); + printf(" needLibraryCNFFile() function.\n"); + printf(" --novarreplace = Don't perform variable replacement. Needed for programmable\n"); + printf(" solver feature\n"); + printf(" --restart = {auto, static, dynamic} Which kind of restart strategy to\n"); + printf(" follow. Default is auto\n"); + printf(" --dumplearnts = If interrupted or reached restart limit, dump\n"); + printf(" the learnt clauses to the specified file. Maximum size of\n"); + printf(" dumped clauses can be specified with next option.\n"); + printf(" --maxdumplearnts = [0 - 2^32-1] When dumping the learnts to file, what\n"); + printf(" should be maximum length of the clause dumped. Useful\n"); + printf(" to make the resulting file smaller. Default is 2^32-1\n"); + printf(" note: 2-long XOR-s are always dumped.\n"); + printf(" --maxsolutions = Search for given amount of solutions\n"); + printf(" --nofailedvar = Don't search for failed vars, and don't search for vars\n"); + printf(" doubly propagated to the same value\n"); + printf(" --noheuleprocess = Don't try to minimise XORs by XOR-ing them together.\n"); + printf(" Algo. as per global/local substitution in Heule's thesis\n"); + printf(" --nosatelite = Don't do clause subsumption, clause strengthening and\n"); + printf(" variable elimination (implies -novarelim and -nosubsume1).\n"); + printf(" --noxorsubs = Don't try to subsume xor-clauses.\n"); + printf(" --nohyperbinres = Don't carry out hyper-binary resolution\n"); + printf(" --nosolprint = Don't print the satisfying assignment if the solution\n"); + printf(" is SAT\n"); + printf(" --novarelim = Don't perform variable elimination as per Een and Biere\n"); + printf(" --nosubsume1 = Don't perform clause contraction through resolution\n"); + printf(" --noparthander = Don't find and solve subroblems with subsolvers\n"); + #ifdef USE_GAUSS + printf(" --gaussuntil = Depth until which Gaussian elimination is active.\n"); + printf(" Giving 0 switches off Gaussian elimination\n"); + printf(" --nomatrixfind = Don't find distinct matrixes. Put all xors into one\n"); + printf(" big matrix\n"); + printf(" --noiterreduce = Don't reduce iteratively the matrix that is updated\n"); + printf(" --noordercol = Don't order variables in the columns of Gaussian\n"); + printf(" elimination. Effectively disables iterative reduction\n"); + printf(" of the matrix\n"); + printf(" --maxmatrixrows = [0 - 2^32-1] Set maximum no. of rows for gaussian matrix.\n"); + printf(" Too large matrixes should bee discarded for\n"); + printf(" reasons of efficiency. Default: %d\n", S.gaussconfig.maxMatrixRows); + printf(" --minmatrixrows = [0 - 2^32-1] Set minimum no. of rows for gaussian matrix.\n"); + printf(" Normally, too small matrixes are discarded for\n"); + printf(" reasons of efficiency. Default: %d\n", S.gaussconfig.minMatrixRows); + printf(" --savematrix = [0 - 2^32-1] Save matrix every Nth decision level.\n"); + printf(" Default: %d\n", S.gaussconfig.only_nth_gauss_save); + #endif //USE_GAUSS + //printf(" --addoldlearnts = Readd old learnts for failed variable searching.\n"); + //printf(" These learnts are usually deleted, but may help\n"); + printf(" --noextrabins = Don't add binary clauses when doing failed lit probing.\n"); + printf(" --noremovebins = Don't remove useless binary clauses\n"); + printf(" --noregremovebins= Don't remove useless binary clauses regularly\n"); + printf(" --nosubswithbins = Don't subsume with non-existent bins\n"); + printf(" --norsubswithbins= Don't subsume regularly with non-existent bins\n"); + printf("\n"); +} + + +const char* hasPrefix(const char* str, const char* prefix) +{ + int len = strlen(prefix); + if (strncmp(str, prefix, len) == 0) + return str + len; + else + return NULL; +} + + +int main(int argc, char** argv) +{ + Solver S; + S.verbosity = 2; + + const char* value; + int j = 0; + unsigned long max_nr_of_solutions = 1; + unsigned long current_nr_of_solutions = 1; + + for (int i = 0; i < argc; i++) { + if ((value = hasPrefix(argv[i], "--polarity-mode="))) { + if (strcmp(value, "true") == 0) + S.polarity_mode = Solver::polarity_true; + else if (strcmp(value, "false") == 0) + S.polarity_mode = Solver::polarity_false; + else if (strcmp(value, "rnd") == 0) + S.polarity_mode = Solver::polarity_rnd; + else if (strcmp(value, "auto") == 0) + S.polarity_mode = Solver::polarity_auto; + else { + printf("ERROR! unknown polarity-mode %s\n", value); + exit(0); + } + + } else if ((value = hasPrefix(argv[i], "--rnd-freq="))) { + double rnd; + if (sscanf(value, "%lf", &rnd) <= 0 || rnd < 0 || rnd > 1) { + printf("ERROR! illegal rnd-freq constant %s\n", value); + exit(0); + } + S.random_var_freq = rnd; + + /*} else if ((value = hasPrefix(argv[i], "--decay="))) { + double decay; + if (sscanf(value, "%lf", &decay) <= 0 || decay <= 0 || decay > 1) { + printf("ERROR! illegal decay constant %s\n", value); + exit(0); + } + S.var_decay = 1 / decay;*/ + + } else if ((value = hasPrefix(argv[i], "--verbosity="))) { + int verbosity = (int)strtol(value, NULL, 10); + if (verbosity == EINVAL || verbosity == ERANGE) { + printf("ERROR! illegal verbosity level %s\n", value); + exit(0); + } + S.verbosity = verbosity; + #ifdef STATS_NEEDED + } else if ((value = hasPrefix(argv[i], "--grouping"))) { + grouping = true; + } else if ((value = hasPrefix(argv[i], "--proof-log"))) { + S.needProofGraph(); + + } else if ((value = hasPrefix(argv[i], "--stats"))) { + S.needStats(); + #endif //STATS_NEEDED + + } else if ((value = hasPrefix(argv[i], "--randomize="))) { + uint32_t seed; + if (sscanf(value, "%d", &seed) < 0) { + printf("ERROR! illegal seed %s\n", value); + exit(0); + } + cout << "c seed:" << seed << endl; + S.setSeed(seed); + } else if ((value = hasPrefix(argv[i], "--restrict="))) { + uint branchTo; + if (sscanf(value, "%d", &branchTo) < 0 || branchTo < 1) { + printf("ERROR! illegal restricted pick branch number %d\n", branchTo); + exit(0); + } + S.restrictedPickBranch = branchTo; + + } else if ((value = hasPrefix(argv[i], "--restarts="))) { + uint maxrest; + if (sscanf(value, "%d", &maxrest) < 0 || maxrest == 0) { + printf("ERROR! illegal maximum restart number %d\n", maxrest); + exit(0); + } + S.setMaxRestarts(maxrest); + } else if ((value = hasPrefix(argv[i], "--dumplearnts="))) { + if (sscanf(value, "%400s", learnts_filename) < 0 || strlen(learnts_filename) == 0) { + printf("ERROR! wrong filename '%s'\n", learnts_filename); + exit(0); + } + dumpLearnts = true; + } else if ((value = hasPrefix(argv[i], "--maxdumplearnts="))) { + if (!dumpLearnts) { + printf("ERROR! -dumplearnts= must be first activated before issuing -maxdumplearnts=\n"); + exit(0); + } + int tmp; + if (sscanf(value, "%d", &tmp) < 0 || tmp < 0) { + cout << "ERROR! wrong maximum dumped learnt clause size is illegal: " << tmp << endl; + exit(0); + } + maxLearntsSize = (uint32_t)tmp; + } else if ((value = hasPrefix(argv[i], "--maxsolutions="))) { + int tmp; + if (sscanf(value, "%d", &tmp) < 0 || tmp < 0) { + cout << "ERROR! wrong maximum number of solutions is illegal: " << tmp << endl; + exit(0); + } + max_nr_of_solutions = (uint32_t)tmp; + #ifdef USE_GAUSS + } else if ((value = hasPrefix(argv[i], "--gaussuntil="))) { + uint32_t until; + if (sscanf(value, "%d", &until) < 0) { + printf("ERROR! until %s\n", value); + exit(0); + } + S.gaussconfig.decision_until = until; + } else if ((value = hasPrefix(argv[i], "--nodisablegauss"))) { + S.gaussconfig.dontDisable = true; + } else if ((value = hasPrefix(argv[i], "--nomatrixfind"))) { + S.gaussconfig.noMatrixFind = true; + } else if ((value = hasPrefix(argv[i], "--noiterreduce"))) { + S.gaussconfig.iterativeReduce = false; + } else if ((value = hasPrefix(argv[i], "--noordercol"))) { + S.gaussconfig.orderCols = false; + } else if ((value = hasPrefix(argv[i], "--maxmatrixrows"))) { + uint32_t rows; + if (sscanf(value, "%d", &rows) < 0) { + printf("ERROR! maxmatrixrows: %s\n", value); + exit(0); + } + S.gaussconfig.maxMatrixRows = rows; + } else if ((value = hasPrefix(argv[i], "--minmatrixrows"))) { + uint32_t rows; + if (sscanf(value, "%d", &rows) < 0) { + printf("ERROR! minmatrixrows: %s\n", value); + exit(0); + } + S.gaussconfig.minMatrixRows = rows; + } else if ((value = hasPrefix(argv[i], "--savematrix"))) { + uint32_t every; + if (sscanf(value, "%d", &every) < 0) { + printf("ERROR! savematrix: %s\n", value); + exit(0); + } + cout << "c Matrix saved every " << every << " decision levels" << endl; + S.gaussconfig.only_nth_gauss_save = every; + #endif //USE_GAUSS + } else if ((value = hasPrefix(argv[i], "--greedyunbound"))) { + S.greedyUnbound = true; + } else if ((value = hasPrefix(argv[i], "--nonormxorfind"))) { + S.findNormalXors = false; + } else if ((value = hasPrefix(argv[i], "--nobinxorfind"))) { + S.findBinaryXors = false; + } else if ((value = hasPrefix(argv[i], "--noregbxorfind"))) { + S.regularlyFindBinaryXors = false; + } else if ((value = hasPrefix(argv[i], "--noconglomerate"))) { + S.conglomerateXors = false; + } else if ((value = hasPrefix(argv[i], "--nosimplify"))) { + S.schedSimplification = false; + } else if ((value = hasPrefix(argv[i], "--debuglib"))) { + debugLib = true; + } else if ((value = hasPrefix(argv[i], "--debugnewvar"))) { + debugNewVar = true; + } else if ((value = hasPrefix(argv[i], "--novarreplace"))) { + S.performReplace = false; + } else if ((value = hasPrefix(argv[i], "--nofailedvar"))) { + S.failedVarSearch = false; + } else if ((value = hasPrefix(argv[i], "--noheuleprocess"))) { + S.heuleProcess = false; + } else if ((value = hasPrefix(argv[i], "--nosatelite"))) { + S.doSubsumption = false; + } else if ((value = hasPrefix(argv[i], "--noparthandler"))) { + S.doPartHandler = false; + } else if ((value = hasPrefix(argv[i], "--noxorsubs"))) { + S.doXorSubsumption = false; + } else if ((value = hasPrefix(argv[i], "--nohyperbinres"))) { + S.doHyperBinRes = false; + } else if ((value = hasPrefix(argv[i], "--noblockedclause"))) { + S.doBlockedClause = false; + } else if ((value = hasPrefix(argv[i], "--novarelim"))) { + S.doVarElim = false; + } else if ((value = hasPrefix(argv[i], "--nosubsume1"))) { + S.doSubsume1 = false; + } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0) { + printUsage(argv, S); + exit(0); + } else if ((value = hasPrefix(argv[i], "--restart="))) { + if (strcmp(value, "auto") == 0) + S.fixRestartType = auto_restart; + else if (strcmp(value, "static") == 0) + S.fixRestartType = static_restart; + else if (strcmp(value, "dynamic") == 0) + S.fixRestartType = dynamic_restart; + else { + printf("ERROR! unknown restart type %s\n", value); + exit(0); + } + } else if ((value = hasPrefix(argv[i], "--nosolprint"))) { + printResult = false; + //} else if ((value = hasPrefix(argv[i], "--addoldlearnts"))) { + // S.readdOldLearnts = true; + } else if ((value = hasPrefix(argv[i], "--noextrabins"))) { + S.addExtraBins = false; + } else if ((value = hasPrefix(argv[i], "--noremovebins"))) { + S.removeUselessBins = false; + } else if ((value = hasPrefix(argv[i], "--noregremovebins"))) { + S.regularRemoveUselessBins = false; + } else if ((value = hasPrefix(argv[i], "--nosubswithbins"))) { + S.subsumeWithNonExistBinaries = false; + } else if ((value = hasPrefix(argv[i], "--norsubswithbins"))) { + S.regularSubsumeWithNonExistBinaries = false; + } else if (strncmp(argv[i], "-", 1) == 0 || strncmp(argv[i], "--", 2) == 0) { + printf("ERROR! unknown flag %s\n", argv[i]); + exit(0); + } else + argv[j++] = argv[i]; + } + argc = j; + if (!debugLib) S.libraryUsage = false; + + if (S.verbosity >= 1) + printf("c This is CryptoMiniSat %s\n", VERSION); +#if defined(__linux__) + fpu_control_t oldcw, newcw; + _FPU_GETCW(oldcw); + newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; + _FPU_SETCW(newcw); + if (S.verbosity >= 1) printf("c WARNING: for repeatability, setting FPU to use double precision\n"); +#endif + double cpu_time = cpuTime(); + + solver = &S; + signal(SIGINT,SIGINT_handler); + //signal(SIGHUP,SIGINT_handler); + + if (argc == 1) + printf("c Reading from standard input... Use '-h' or '--help' for help.\n"); + +#ifdef DISABLE_ZLIB + FILE * in = (argc == 1) ? fopen(0, "rb") : fopen(argv[1], "rb"); +#else + gzFile in = (argc == 1) ? gzdopen(0, "rb") : gzopen(argv[1], "rb"); +#endif // DISABLE_ZLIB + if (in == NULL) { + printf("ERROR! Could not open file: %s\n", argc == 1 ? "" : argv[1]); + exit(1); + } + + if (S.verbosity >= 1) { + printf("c =================================[ Problem Statistics ]==================================\n"); + printf("c | |\n"); + } + + parse_DIMACS(in, S); + +#ifdef DISABLE_ZLIB + fclose(in); +#else + gzclose(in); +#endif // DISABLE_ZLIB + if (argc >= 3) + printf("c Outputting solution to file: %s\n" , argv[2]); + + double parse_time = cpuTime() - cpu_time; + if (S.verbosity >= 1) + printf("c | Parsing time: %-12.2f s |\n", parse_time); + + lbool ret; + + while(1) + { + ret = S.solve(); + if ( ret != l_True ) break; + + std::cout << "c " << std::setw(8) << current_nr_of_solutions++ << " solution(s) found" << std::endl; + + if (current_nr_of_solutions > max_nr_of_solutions) break; + printf("c Prepare for next run...\n"); + + vec lits; + if (printResult) printf("v "); + for (Var var = 0; var != S.nVars(); var++) { + if (S.model[var] != l_Undef) { + lits.push( Lit(var, (S.model[var] == l_True)? true : false) ); + if (printResult) printf("%s%d ", (S.model[var] == l_True)? "" : "-", var+1); + } + } + if (printResult) printf("\n"); + + S.addClause(lits); + } + + printStats(S); + printf("c \n"); + if (dumpLearnts) { + S.dumpSortedLearnts(learnts_filename, maxLearntsSize); + cout << "c Sorted learnt clauses dumped to file '" << learnts_filename << "'" << endl; + } + if (ret == l_Undef) + printf("c Not finished running -- maximum restart reached\n"); + + FILE* res = NULL; + if (argc >= 3) { + res = fopen(argv[2], "wb"); + if (res == NULL) { + int backup_errno = errno; + printf("Cannot open %s for writing. Problem: %s", argv[2], strerror(backup_errno)); + exit(1); + } + } + + if (res != NULL) { + if (ret == l_True) { + printf("c SAT\n"); + fprintf(res, "SAT\n"); + if (printResult) { + for (Var var = 0; var != S.nVars(); var++) + if (S.model[var] != l_Undef) + fprintf(res, "%s%d ", (S.model[var] == l_True)? "" : "-", var+1); + fprintf(res, "0\n"); + } + } else if (ret == l_False) { + printf("c UNSAT\n"); + fprintf(res, "UNSAT\n"); + } else { + printf("c INCONCLUSIVE\n"); + fprintf(res, "INCONCLUSIVE\n"); + } + fclose(res); + } else { + if (ret == l_True) + printf("s SATISFIABLE\n"); + else if (ret == l_False) + printf("s UNSATISFIABLE\n"); + + if(ret == l_True && printResult) { + printf("v "); + for (Var var = 0; var != S.nVars(); var++) + if (S.model[var] != l_Undef) + printf("%s%d ", (S.model[var] == l_True)? "" : "-", var+1); + printf("0\n"); + } + } + +#ifdef NDEBUG + exit(ret == l_True ? 10 : 20); // (faster than "return", which will invoke the destructor for 'Solver') +#endif + + if (ret == l_True) return 10; + if (ret == l_False) return 20; + if (ret == l_Undef) return 15; + assert(false); + + return 0; +} diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Makefile.am b/packages/bee/cryptominisat-2.5.1/Solver/Makefile.am new file mode 100755 index 000000000..10f4b8c53 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Makefile.am @@ -0,0 +1,16 @@ +noinst_LTLIBRARIES = libcryptominisat.la + +AM_CXXFLAGS = -Wall $(all_includes) -I$(srcdir) -I$(srcdir)/../MTRand -I$(srcdir)/../mtl + +libcryptominisat_la_SOURCES = \ + ClauseCleaner.cpp FailedVarSearcher.cpp Logger.cpp \ + PartFinder.cpp SmallPtr.cpp VarReplacer.cpp \ + Clause.cpp FindUndef.cpp MatrixFinder.cpp \ + PartHandler.cpp Solver.cpp XorFinder.cpp \ + PackedRow.cpp Gaussian.cpp StateSaver.cpp \ + RestartTypeChooser.cpp Subsumer.cpp XorSubsumer.cpp + +bin_PROGRAMS = cryptominisat +cryptominisat_LDADD = libcryptominisat.la +cryptominisat_LDFLAGS = -lz +cryptominisat_SOURCES = Main.C diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Makefile.in b/packages/bee/cryptominisat-2.5.1/Solver/Makefile.in new file mode 100755 index 000000000..3bf0d5402 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Makefile.in @@ -0,0 +1,588 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = cryptominisat$(EXEEXT) +subdir = Solver +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4-extra/boost.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libcryptominisat_la_LIBADD = +am_libcryptominisat_la_OBJECTS = ClauseCleaner.lo FailedVarSearcher.lo \ + Logger.lo PartFinder.lo SmallPtr.lo VarReplacer.lo Clause.lo \ + FindUndef.lo MatrixFinder.lo PartHandler.lo Solver.lo \ + XorFinder.lo PackedRow.lo Gaussian.lo StateSaver.lo \ + RestartTypeChooser.lo Subsumer.lo XorSubsumer.lo +libcryptominisat_la_OBJECTS = $(am_libcryptominisat_la_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_cryptominisat_OBJECTS = Main.$(OBJEXT) +cryptominisat_OBJECTS = $(am_cryptominisat_OBJECTS) +cryptominisat_DEPENDENCIES = libcryptominisat.la +cryptominisat_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(cryptominisat_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libcryptominisat_la_SOURCES) $(cryptominisat_SOURCES) +DIST_SOURCES = $(libcryptominisat_la_SOURCES) $(cryptominisat_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ +BOOST_ROOT = @BOOST_ROOT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libcryptominisat.la +AM_CXXFLAGS = -Wall $(all_includes) -I$(srcdir) -I$(srcdir)/../MTRand -I$(srcdir)/../mtl +libcryptominisat_la_SOURCES = \ + ClauseCleaner.cpp FailedVarSearcher.cpp Logger.cpp \ + PartFinder.cpp SmallPtr.cpp VarReplacer.cpp \ + Clause.cpp FindUndef.cpp MatrixFinder.cpp \ + PartHandler.cpp Solver.cpp XorFinder.cpp \ + PackedRow.cpp Gaussian.cpp StateSaver.cpp \ + RestartTypeChooser.cpp Subsumer.cpp XorSubsumer.cpp + +cryptominisat_LDADD = libcryptominisat.la +cryptominisat_LDFLAGS = -lz +cryptominisat_SOURCES = Main.C +all: all-am + +.SUFFIXES: +.SUFFIXES: .C .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Solver/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Solver/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libcryptominisat.la: $(libcryptominisat_la_OBJECTS) $(libcryptominisat_la_DEPENDENCIES) + $(CXXLINK) $(libcryptominisat_la_OBJECTS) $(libcryptominisat_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +cryptominisat$(EXEEXT): $(cryptominisat_OBJECTS) $(cryptominisat_DEPENDENCIES) + @rm -f cryptominisat$(EXEEXT) + $(cryptominisat_LINK) $(cryptominisat_OBJECTS) $(cryptominisat_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Clause.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ClauseCleaner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FailedVarSearcher.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FindUndef.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Gaussian.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Logger.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MatrixFinder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PackedRow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PartFinder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PartHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RestartTypeChooser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SmallPtr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Solver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StateSaver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Subsumer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VarReplacer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XorFinder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XorSubsumer.Plo@am__quote@ + +.C.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.C.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.C.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstLTLIBRARIES ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/packages/bee/cryptominisat-2.5.1/Solver/MatrixFinder.cpp b/packages/bee/cryptominisat-2.5.1/Solver/MatrixFinder.cpp new file mode 100755 index 000000000..9ab2b296f --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/MatrixFinder.cpp @@ -0,0 +1,247 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ +#include "constants.h" +#ifdef USE_GAUSS + +#include "MatrixFinder.h" + +#include "Solver.h" +#include "Gaussian.h" +#include "GaussianConfig.h" +#include "ClauseCleaner.h" +#include "time_mem.h" + +#include +#include +#include +#include +using std::set; +using std::map; + +//#define VERBOSE_DEBUG + +using std::cout; +using std::endl; + +//#define PART_FINDING + +MatrixFinder::MatrixFinder(Solver& _solver) : + solver(_solver) +{ +} + +inline const Var MatrixFinder::fingerprint(const XorClause& c) const +{ + Var fingerprint = 0; + + for (const Lit* a = &c[0], *end = a + c.size(); a != end; a++) + fingerprint |= a->var(); + + return fingerprint; +} + +inline const bool MatrixFinder::firstPartOfSecond(const XorClause& c1, const XorClause& c2) const +{ + uint i1, i2; + for (i1 = 0, i2 = 0; i1 < c1.size() && i2 < c2.size();) { + if (c1[i1].var() != c2[i2].var()) + i2++; + else { + i1++; + i2++; + } + } + + return (i1 == c1.size()); +} + +const bool MatrixFinder::findMatrixes() +{ + table.clear(); + table.resize(solver.nVars(), var_Undef); + reverseTable.clear(); + matrix_no = 0; + double myTime = cpuTime(); + + if (solver.xorclauses.size() < MIN_GAUSS_XOR_CLAUSES || + solver.gaussconfig.decision_until <= 0 || + solver.xorclauses.size() > MAX_GAUSS_XOR_CLAUSES + ) + return true; + + solver.clauseCleaner->cleanClauses(solver.xorclauses, ClauseCleaner::xorclauses); + if (!solver.ok) return false; + + if (solver.gaussconfig.noMatrixFind) { + if (solver.verbosity >=1) + cout << "c | Matrix finding disabled through switch. Putting all xors into matrix." << endl; + vector xorclauses; + xorclauses.reserve(solver.xorclauses.size()); + for (uint32_t i = 0; i < solver.xorclauses.size(); i++) + xorclauses.push_back(solver.xorclauses[i]); + solver.gauss_matrixes.push_back(new Gaussian(solver, solver.gaussconfig, 0, xorclauses)); + return true; + } + + for (XorClause** c = solver.xorclauses.getData(), **end = c + solver.xorclauses.size(); c != end; c++) { + set tomerge; + vector newSet; + for (Lit *l = &(**c)[0], *end2 = l + (**c).size(); l != end2; l++) { + if (table[l->var()] != var_Undef) + tomerge.insert(table[l->var()]); + else + newSet.push_back(l->var()); + } + if (tomerge.size() == 1) { + const uint into = *tomerge.begin(); + map >::iterator intoReverse = reverseTable.find(into); + for (uint i = 0; i < newSet.size(); i++) { + intoReverse->second.push_back(newSet[i]); + table[newSet[i]] = into; + } + continue; + } + + for (set::iterator it = tomerge.begin(); it != tomerge.end(); it++) { + newSet.insert(newSet.end(), reverseTable[*it].begin(), reverseTable[*it].end()); + reverseTable.erase(*it); + } + for (uint i = 0; i < newSet.size(); i++) + table[newSet[i]] = matrix_no; + reverseTable[matrix_no] = newSet; + matrix_no++; + } + + #ifdef VERBOSE_DEBUG + for (map >::iterator it = reverseTable.begin(), end = reverseTable.end(); it != end; it++) { + cout << "-- set begin --" << endl; + for (vector::iterator it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; it2++) { + cout << *it2 << ", "; + } + cout << "-------" << endl; + } + #endif + + uint32_t numMatrixes = setMatrixes(); + + if (solver.verbosity >=1) + std::cout << "c | Finding matrixes : " << cpuTime() - myTime << " s (found " << numMatrixes << ") |" << endl; + + for (vector::iterator gauss = solver.gauss_matrixes.begin(), end = solver.gauss_matrixes.end(); gauss != end; gauss++) { + if (!(*gauss)->full_init()) return false; + } + + return true; +} + +const uint MatrixFinder::setMatrixes() +{ + vector > numXorInMatrix; + for (uint i = 0; i < matrix_no; i++) + numXorInMatrix.push_back(std::make_pair(i, 0)); + + vector sumXorSizeInMatrix(matrix_no, 0); + vector > xorSizesInMatrix(matrix_no); + vector > xorsInMatrix(matrix_no); + + #ifdef PART_FINDING + vector > xorFingerprintInMatrix(matrix_no); + #endif + + for (XorClause** c = solver.xorclauses.getData(), **end = c + solver.xorclauses.size(); c != end; c++) { + XorClause& x = **c; + const uint matrix = table[x[0].var()]; + assert(matrix < matrix_no); + + //for stats + numXorInMatrix[matrix].second++; + sumXorSizeInMatrix[matrix] += x.size(); + xorSizesInMatrix[matrix].push_back(x.size()); + xorsInMatrix[matrix].push_back(&x); + + #ifdef PART_FINDING + xorFingerprintInMatrix[matrix].push_back(fingerprint(x)); + #endif //PART_FINDING + } + + std::sort(numXorInMatrix.begin(), numXorInMatrix.end(), mysorter()); + + #ifdef PART_FINDING + for (uint i = 0; i < matrix_no; i++) + findParts(xorFingerprintInMatrix[i], xorsInMatrix[i]); + #endif //PART_FINDING + + uint realMatrixNum = 0; + for (int a = matrix_no-1; a != -1; a--) { + uint i = numXorInMatrix[a].first; + + if (numXorInMatrix[a].second < 3) + continue; + + const uint totalSize = reverseTable[i].size()*numXorInMatrix[a].second; + const double density = (double)sumXorSizeInMatrix[i]/(double)totalSize*100.0; + double avg = (double)sumXorSizeInMatrix[i]/(double)numXorInMatrix[a].second; + double variance = 0.0; + for (uint i2 = 0; i2 < xorSizesInMatrix[i].size(); i2++) + variance += pow((double)xorSizesInMatrix[i][i2]-avg, 2); + variance /= (double)xorSizesInMatrix.size(); + const double stdDeviation = sqrt(variance); + + if (numXorInMatrix[a].second >= solver.gaussconfig.minMatrixRows + && numXorInMatrix[a].second <= solver.gaussconfig.maxMatrixRows + && realMatrixNum < 3) + { + if (solver.verbosity >=1) + cout << "c | Matrix no " << std::setw(2) << realMatrixNum; + solver.gauss_matrixes.push_back(new Gaussian(solver, solver.gaussconfig, realMatrixNum, xorsInMatrix[i])); + realMatrixNum++; + + } else { + if (solver.verbosity >=1 /*&& numXorInMatrix[a].second >= 20*/) + cout << "c | Unused Matrix "; + } + if (solver.verbosity >=1 /*&& numXorInMatrix[a].second >= 20*/) { + cout << std::setw(7) << numXorInMatrix[a].second << " x" << std::setw(5) << reverseTable[i].size(); + cout << " density:" << std::setw(5) << std::fixed << std::setprecision(1) << density << "%"; + cout << " xorlen avg:" << std::setw(5) << std::fixed << std::setprecision(2) << avg; + cout << " stdev:" << std::setw(6) << std::fixed << std::setprecision(2) << stdDeviation << " |" << endl; + } + } + + return realMatrixNum; +} + +void MatrixFinder::findParts(vector& xorFingerprintInMatrix, vector& xorsInMatrix) +{ + uint ai = 0; + for (XorClause **a = &xorsInMatrix[0], **end = a + xorsInMatrix.size(); a != end; a++, ai++) { + const Var fingerprint = xorFingerprintInMatrix[ai]; + uint ai2 = 0; + for (XorClause **a2 = &xorsInMatrix[0]; a2 != end; a2++, ai2++) { + if (ai == ai2) continue; + const Var fingerprint2 = xorFingerprintInMatrix[ai2]; + if (((fingerprint & fingerprint2) == fingerprint) && firstPartOfSecond(**a, **a2)) { + cout << "First part of second:" << endl; + (*a)->plainPrint(); + (*a2)->plainPrint(); + cout << "END" << endl; + } + } + } +} + +#endif //USE_GAUSS diff --git a/packages/bee/cryptominisat-2.5.1/Solver/MatrixFinder.h b/packages/bee/cryptominisat-2.5.1/Solver/MatrixFinder.h new file mode 100755 index 000000000..8ba487caa --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/MatrixFinder.h @@ -0,0 +1,67 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef MATRIXFINDER_H +#define MATRIXFINDER_H + +#include +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "Clause.h" +#include "Solver.h" + +class Solver; + +using std::map; +using std::vector; +using std::pair; + +class MatrixFinder { + + public: + MatrixFinder(Solver& solver); + const bool findMatrixes(); + + private: + const uint setMatrixes(); + + struct mysorter + { + bool operator () (const pair& left, const pair& right) + { + return left.second < right.second; + } + }; + + void findParts(vector& xorFingerprintInMatrix, vector& xorsInMatrix); + inline const Var fingerprint(const XorClause& c) const; + inline const bool firstPartOfSecond(const XorClause& c1, const XorClause& c2) const; + + map > reverseTable; //matrix -> vars + vector table; //var -> matrix + uint matrix_no; + + Solver& solver; +}; + + +#endif //MATRIXFINDER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/PackedMatrix.h b/packages/bee/cryptominisat-2.5.1/Solver/PackedMatrix.h new file mode 100755 index 000000000..ad83f817b --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/PackedMatrix.h @@ -0,0 +1,218 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef PACKEDMATRIX_H +#define PACKEDMATRIX_H + +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "PackedRow.h" + +//#define DEBUG_MATRIX + +class PackedMatrix +{ +public: + PackedMatrix() : + mp(NULL) + , numRows(0) + , numCols(0) + { + } + + PackedMatrix(const PackedMatrix& b) : + numRows(b.numRows) + , numCols(b.numCols) + { + #ifdef DEBUG_MATRIX + assert(b.numRows > 0 && b.numCols > 0); + #endif + + mp = new uint64_t[numRows*2*(numCols+1)]; + memcpy(mp, b.mp, sizeof(uint64_t)*numRows*2*(numCols+1)); + } + + ~PackedMatrix() + { + delete[] mp; + } + + void resize(const uint num_rows, uint num_cols) + { + num_cols = num_cols / 64 + (bool)(num_cols % 64); + if (numRows*2*(numCols+1) < num_rows*2*(num_cols+1)) { + delete[] mp; + mp = new uint64_t[num_rows*2*(num_cols+1)]; + } + numRows = num_rows; + numCols = num_cols; + } + + void resizeNumRows(const uint num_rows) + { + #ifdef DEBUG_MATRIX + assert(num_rows <= numRows); + #endif + + numRows = num_rows; + } + + PackedMatrix& operator=(const PackedMatrix& b) + { + #ifdef DEBUG_MATRIX + //assert(b.numRows > 0 && b.numCols > 0); + #endif + + if (numRows*2*(numCols+1) < b.numRows*2*(b.numCols+1)) { + delete[] mp; + mp = new uint64_t[b.numRows*2*(b.numCols+1)]; + } + + numRows = b.numRows; + numCols = b.numCols; + memcpy(mp, b.mp, sizeof(uint64_t)*numRows*2*(numCols+1)); + + return *this; + } + + inline PackedRow getMatrixAt(const uint i) + { + #ifdef DEBUG_MATRIX + assert(i <= numRows); + #endif + + return PackedRow(numCols, mp+i*2*(numCols+1)); + } + inline PackedRow getVarsetAt(const uint i) + { + #ifdef DEBUG_MATRIX + assert(i <= numRows); + #endif + + return PackedRow(numCols, mp+i*2*(numCols+1)+(numCols+1)); + } + + inline const PackedRow getMatrixAt(const uint i) const + { + #ifdef DEBUG_MATRIX + assert(i <= numRows); + #endif + + return PackedRow(numCols, mp+i*2*(numCols+1)); + } + + inline const PackedRow getVarsetAt(const uint i) const + { + #ifdef DEBUG_MATRIX + assert(i <= numRows); + #endif + + return PackedRow(numCols, mp+i*2*(numCols+1)+(numCols+1)); + } + + class iterator + { + public: + PackedRow operator*() + { + return PackedRow(numCols, mp); + } + + iterator& operator++() + { + mp += 2*(numCols+1); + return *this; + } + + iterator operator+(const uint num) const + { + iterator ret(*this); + ret.mp += 2*(numCols+1)*num; + return ret; + } + + const uint operator-(const iterator& b) const + { + return (mp - b.mp)/(2*(numCols+1)); + } + + void operator+=(const uint num) + { + mp += 2*(numCols+1)*num; + } + + const bool operator!=(const iterator& it) const + { + return mp != it.mp; + } + + const bool operator==(const iterator& it) const + { + return mp == it.mp; + } + + private: + friend class PackedMatrix; + + iterator(uint64_t* _mp, const uint _numCols) : + mp(_mp) + , numCols(_numCols) + {} + + uint64_t* mp; + const uint numCols; + }; + + inline iterator beginMatrix() + { + return iterator(mp, numCols); + } + + inline iterator endMatrix() + { + return iterator(mp+numRows*2*(numCols+1), numCols); + } + + inline iterator beginVarset() + { + return iterator(mp+(numCols+1), numCols); + } + + inline iterator endVarset() + { + return iterator(mp+(numCols+1)+numRows*2*(numCols+1), numCols); + } + + inline const uint getSize() const + { + return numRows; + } + +private: + + uint64_t* mp; + uint numRows; + uint numCols; +}; + +#endif //PACKEDMATRIX_H + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/PackedRow.cpp b/packages/bee/cryptominisat-2.5.1/Solver/PackedRow.cpp new file mode 100755 index 000000000..56c373f41 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/PackedRow.cpp @@ -0,0 +1,115 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "PackedRow.h" + +std::ostream& operator << (std::ostream& os, const PackedRow& m) +{ + for(uint32_t i = 0; i < m.size*64; i++) { + os << m[i]; + } + os << " -- xor: " << m.is_true(); + return os; +} + +bool PackedRow::operator ==(const PackedRow& b) const +{ + #ifdef DEBUG_ROW + assert(size > 0); + assert(b.size > 0); + assert(size == b.size); + #endif + + return (std::equal(b.mp-1, b.mp+size, mp-1)); +} + +bool PackedRow::operator !=(const PackedRow& b) const +{ + #ifdef DEBUG_ROW + assert(size > 0); + assert(b.size > 0); + assert(size == b.size); + #endif + + return (!std::equal(b.mp-1, b.mp+size, mp-1)); +} + +uint32_t PackedRow::popcnt() const +{ + uint32_t popcnt = 0; + for (uint32_t i = 0; i < size; i++) if (mp[i]) { + uint64_t tmp = mp[i]; + for (uint i2 = 0; i2 < 64; i2++) { + popcnt += (tmp & 1); + tmp >>= 1; + } + } + return popcnt; +} + +uint32_t PackedRow::popcnt(const uint32_t from) const +{ + uint32_t popcnt = 0; + for (uint32_t i = from/64; i != size; i++) if (mp[i]) { + uint64_t tmp = mp[i]; + uint32_t i2; + if (i == from/64) { + i2 = from%64; + tmp >>= i2; + } else + i2 = 0; + for (; i2 < 64; i2++) { + popcnt += (tmp & 1); + tmp >>= 1; + } + } + return popcnt; +} + +void PackedRow::fill(vec& tmp_clause, const vec& assigns, const vector& col_to_var_original) const +{ + bool final = !is_true_internal; + + tmp_clause.clear(); + uint32_t col = 0; + bool wasundef = false; + for (uint32_t i = 0; i < size; i++) for (uint32_t i2 = 0; i2 < 64; i2++) { + if ((mp[i] >> i2) &1) { + const Var& var = col_to_var_original[col]; + assert(var != std::numeric_limits::max()); + + const lbool& val = assigns[var]; + const bool val_bool = val.getBool(); + tmp_clause.push(Lit(var, val_bool)); + final ^= val_bool; + if (val.isUndef()) { + assert(!wasundef); + Lit tmp(tmp_clause[0]); + tmp_clause[0] = tmp_clause.last(); + tmp_clause.last() = tmp; + wasundef = true; + } + } + col++; + } + if (wasundef) { + tmp_clause[0] ^= final; + //assert(ps != ps_first+1); + } else + assert(!final); +} + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/PackedRow.h b/packages/bee/cryptominisat-2.5.1/Solver/PackedRow.h new file mode 100755 index 000000000..a464cecb7 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/PackedRow.h @@ -0,0 +1,234 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef PACKEDROW_H +#define PACKEDROW_H + +//#define DEBUG_ROW + +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "SolverTypes.h" +#include "Vec.h" +#include +#include +#include +#include +#ifndef uint +#define uint unsigned int +#endif + +using std::vector; + + +class PackedMatrix; + +class PackedRow +{ +public: + bool operator ==(const PackedRow& b) const; + bool operator !=(const PackedRow& b) const; + + PackedRow& operator=(const PackedRow& b) + { + #ifdef DEBUG_ROW + assert(size > 0); + assert(b.size > 0); + assert(size == b.size); + #endif + + memcpy(mp-1, b.mp-1, size+1); + return *this; + } + + PackedRow& operator^=(const PackedRow& b) + { + #ifdef DEBUG_ROW + assert(size > 0); + assert(b.size > 0); + assert(b.size == size); + #endif + + for (uint32_t i = 0; i != size; i++) { + *(mp + i) ^= *(b.mp + i); + } + + is_true_internal ^= b.is_true_internal; + return *this; + } + + void xorBoth(const PackedRow& b) + { + #ifdef DEBUG_ROW + assert(size > 0); + assert(b.size > 0); + assert(b.size == size); + #endif + + for (uint32_t i = 0; i != 2*size+1; i++) { + *(mp + i) ^= *(b.mp + i); + } + + is_true_internal ^= b.is_true_internal; + } + + + uint32_t popcnt() const; + uint32_t popcnt(uint32_t from) const; + + bool popcnt_is_one() const + { + char popcount = 0; + for (uint32_t i = 0; i != size; i++) { + uint64_t tmp = mp[i]; + while(tmp) { + popcount += tmp & 1; + tmp >>= 1; + } + } + return popcount == 1; + } + + bool popcnt_is_one(uint32_t from) const + { + from++; + + uint64_t tmp = mp[from/64]; + tmp >>= from%64; + if (tmp) return false; + + for (uint32_t i = from/64+1; i != size; i++) + if (mp[i]) return false; + return true; + } + + inline const uint64_t& is_true() const + { + return is_true_internal; + } + + inline const bool isZero() const + { + for (uint32_t i = 0; i != size; i++) { + if (mp[i]) return false; + } + return true; + } + + inline void setZero() + { + memset(mp, 0, sizeof(uint64_t)*size); + } + + inline void clearBit(const uint32_t i) + { + mp[i/64] &= ~((uint64_t)1 << (i%64)); + } + + inline void invert_is_true(const bool b = true) + { + is_true_internal ^= (uint64_t)b; + } + + inline void setBit(const uint32_t i) + { + mp[i/64] |= ((uint64_t)1 << (i%64)); + } + + void swapBoth(PackedRow b) + { + #ifdef DEBUG_ROW + assert(size > 0); + assert(b.size > 0); + assert(b.size == size); + #endif + + uint64_t * __restrict mp1 = mp-1; + uint64_t * __restrict mp2 = b.mp-1; + + uint32_t i = 2*(size+1); + + while(i != 0) { + std::swap(*mp1, *mp2); + mp1++; + mp2++; + i--; + } + } + + inline const bool operator[](const uint32_t& i) const + { + #ifdef DEBUG_ROW + assert(size*64 > i); + #endif + + return (mp[i/64] >> (i%64)) & 1; + } + + template + void set(const T& v, const vector& var_to_col, const uint32_t matrix_size) + { + assert(size == (matrix_size/64) + ((bool)(matrix_size % 64))); + //mp = new uint64_t[size]; + setZero(); + for (uint32_t i = 0; i != v.size(); i++) { + const uint32_t toset_var = var_to_col[v[i].var()]; + assert(toset_var != std::numeric_limits::max()); + + setBit(toset_var); + } + + is_true_internal = !v.xor_clause_inverted(); + } + + void fill(vec& tmp_clause, const vec& assigns, const vector& col_to_var_original) const; + + inline unsigned long int scan(const unsigned long int var) const + { + #ifdef DEBUG_ROW + assert(size > 0); + #endif + + for(uint32_t i = var; i != size*64; i++) + if (this->operator[](i)) return i; + return std::numeric_limits::max(); + } + + friend std::ostream& operator << (std::ostream& os, const PackedRow& m); + +private: + friend class PackedMatrix; + PackedRow(const uint32_t _size, uint64_t* const _mp) : + mp(_mp+1) + , is_true_internal(*_mp) + , size(_size) + {} + + uint64_t* __restrict const mp; + uint64_t& is_true_internal; + const uint32_t size; +}; + +std::ostream& operator << (std::ostream& os, const PackedRow& m); + +#endif //PACKEDROW_H + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/PartFinder.cpp b/packages/bee/cryptominisat-2.5.1/Solver/PartFinder.cpp new file mode 100755 index 000000000..9fe217347 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/PartFinder.cpp @@ -0,0 +1,179 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "PartFinder.h" + +#include "Solver.h" +#include "ClauseCleaner.h" +#include "time_mem.h" +#include "VarReplacer.h" + +#include +#include +#include +#include +#include "FailedVarSearcher.h" +using std::set; +using std::map; + +//#define VERBOSE_DEBUG + +using std::cout; +using std::endl; + +//#define PART_FINDING + +PartFinder::PartFinder(Solver& _solver) : + solver(_solver) +{ +} + +const bool PartFinder::findParts() +{ + assert(solver.performReplace); + + double time = cpuTime(); + + table.clear(); + table.resize(solver.nVars(), std::numeric_limits::max()); + reverseTable.clear(); + part_no = 0; + + solver.clauseCleaner->removeAndCleanAll(true); + if (!solver.ok) return false; + while (solver.varReplacer->getNewToReplaceVars() > 0) { + if (solver.performReplace && !solver.varReplacer->performReplace(true)) + return false; + solver.clauseCleaner->removeAndCleanAll(true); + if (!solver.ok) return false; + } + assert(solver.varReplacer->getClauses().size() == 0); + + addToPart(solver.clauses); + addToPart(solver.binaryClauses); + addToPart(solver.xorclauses); + + const uint parts = setParts(); + + #ifndef NDEBUG + for (map >::const_iterator it = reverseTable.begin(); it != reverseTable.end(); it++) { + for (uint i2 = 0; i2 < it->second.size(); i2++) { + assert(table[(it->second)[i2]] == it->first); + } + } + #endif + + if (solver.verbosity >= 2 || (solver.verbosity >=1 && parts > 1)) { + std::cout << "c | Found parts: " << std::setw(10) << parts + << " time: " << std::setprecision(2) << std::setw(4) << cpuTime() - time + << " s" << std::setw(51) << " |" << std::endl; + } + + return true; +} + +template +void PartFinder::addToPart(const vec& cs) +{ + set tomerge; + vector newSet; + for (T* const* c = cs.getData(), * const*end = c + cs.size(); c != end; c++) { + if ((*c)->learnt()) continue; + tomerge.clear(); + newSet.clear(); + for (const Lit *l = (*c)->getData(), *end2 = l + (*c)->size(); l != end2; l++) { + if (table[l->var()] != std::numeric_limits::max()) + tomerge.insert(table[l->var()]); + else + newSet.push_back(l->var()); + } + if (tomerge.size() == 1) { + //no trees to merge, only merge the clause into one tree + + const uint into = *tomerge.begin(); + map >::iterator intoReverse = reverseTable.find(into); + for (uint i = 0; i < newSet.size(); i++) { + intoReverse->second.push_back(newSet[i]); + table[newSet[i]] = into; + } + continue; + } + + for (set::iterator it = tomerge.begin(); it != tomerge.end(); it++) { + newSet.insert(newSet.end(), reverseTable[*it].begin(), reverseTable[*it].end()); + reverseTable.erase(*it); + } + + for (uint i = 0; i < newSet.size(); i++) + table[newSet[i]] = part_no; + reverseTable[part_no] = newSet; + part_no++; + } +} + +const uint PartFinder::setParts() +{ + vector numClauseInPart(part_no, 0); + vector sumLitsInPart(part_no, 0); + + calcIn(solver.clauses, numClauseInPart, sumLitsInPart); + calcIn(solver.binaryClauses, numClauseInPart, sumLitsInPart); + calcIn(solver.xorclauses, numClauseInPart, sumLitsInPart); + + uint parts = 0; + for (uint i = 0; i < numClauseInPart.size(); i++) { + if (sumLitsInPart[i] == 0) continue; + if (solver.verbosity >= 2 || ( solver.verbosity >= 1 && reverseTable.size() > 1) ) { + std::cout << "c | Found part " << std::setw(8) << i + << " vars: " << std::setw(10) << reverseTable[i].size() + << " clauses:" << std::setw(10) << numClauseInPart[i] + << " lits size:" << std::setw(10) << sumLitsInPart[i] + << std::setw(12) << " | " << std::endl; + } + parts++; + } + + if (parts > 1) { + #ifdef VERBOSE_DEBUG + for (map >::iterator it = reverseTable.begin(), end = reverseTable.end(); it != end; it++) { + cout << "-- set begin --" << endl; + for (vector::iterator it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; it2++) { + cout << *it2 << ", "; + } + cout << "-------" << endl; + } + #endif + } + + return parts; +} + +template +void PartFinder::calcIn(const vec& cs, vector& numClauseInPart, vector& sumLitsInPart) +{ + for (T*const* c = cs.getData(), *const*end = c + cs.size(); c != end; c++) { + if ((*c)->learnt()) continue; + T& x = **c; + const uint part = table[x[0].var()]; + assert(part < part_no); + + //for stats + numClauseInPart[part]++; + sumLitsInPart[part] += x.size(); + } +} + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/PartFinder.h b/packages/bee/cryptominisat-2.5.1/Solver/PartFinder.h new file mode 100755 index 000000000..a618fbe2b --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/PartFinder.h @@ -0,0 +1,92 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef PARTFINDER_H +#define PARTFINDER_H + +#include +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "Clause.h" + +class Solver; + +using std::map; +using std::vector; +using std::pair; + +class PartFinder { + + public: + PartFinder(Solver& solver); + const bool findParts(); + + const map >& getReverseTable() const; // part->var + const uint32_t getVarPart(const Var var) const; + const vector& getTable() const; //var -> part + const vector& getPartVars(const uint32_t part); + + private: + const uint setParts(); + template + void addToPart(const vec& cs); + + struct mysorter + { + bool operator () (const pair& left, const pair& right) + { + return left.second < right.second; + } + }; + + //const bool findParts(vector& xorFingerprintInMatrix, vector& xorsInMatrix); + template + void calcIn(const vec& cs, vector& numClauseInPart, vector& sumLitsInPart); + + map > reverseTable; //part -> vars + vector table; //var -> part + uint32_t part_no; + + Solver& solver; +}; + +inline const map >& PartFinder::getReverseTable() const +{ + return reverseTable; +} + +inline const vector& PartFinder::getTable() const +{ + return table; +} + +inline const uint32_t PartFinder::getVarPart(const Var var) const +{ + return table[var]; +} + +inline const vector& PartFinder::getPartVars(const uint32_t part) +{ + return reverseTable[part]; +} + +#endif //PARTFINDER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/PartHandler.cpp b/packages/bee/cryptominisat-2.5.1/Solver/PartHandler.cpp new file mode 100755 index 000000000..702bb71f3 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/PartHandler.cpp @@ -0,0 +1,330 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "PartHandler.h" +#include "VarReplacer.h" +#include +#include +#include + +//#define VERBOSE_DEBUG + +PartHandler::PartHandler(Solver& s) : + solver(s) +{ +} + + +const bool PartHandler::handle() +{ + if (solver.performReplace == false) + return true; + + PartFinder partFinder(solver); + if (!partFinder.findParts()) { + #ifdef VERBOSE_DEBUG + std::cout << "c findParts() found UNSAT. Whole problem is unsat." << std::endl; + #endif //VERBOSE_DEBUG + return false; + } + + uint32_t num_parts = partFinder.getReverseTable().size(); + if (num_parts == 1) + return true; + + map > reverseTable = partFinder.getReverseTable(); + assert(num_parts == partFinder.getReverseTable().size()); + + vector > sizes; + for (map >::iterator it = reverseTable.begin(); it != reverseTable.end(); it++) + sizes.push_back(std::make_pair(it->first, (uint32_t)it->second.size())); + + std::sort(sizes.begin(), sizes.end(), sort_pred()); + assert(sizes.size() > 1); + + for (uint32_t it = 0; it < sizes.size()-1; it++) { + uint32_t part = sizes[it].first; + vector vars = reverseTable[part]; + if (solver.verbosity >= 1) + std::cout << "c Solving part " << part << std::endl; + + Solver newSolver; + newSolver.mtrand.seed(solver.mtrand.randInt()); + newSolver.random_var_freq = solver.random_var_freq; + newSolver.verbosity = solver.verbosity; + newSolver.restrictedPickBranch = solver.restrictedPickBranch; + newSolver.greedyUnbound = solver.greedyUnbound; + newSolver.findNormalXors = solver.findNormalXors; + newSolver.findBinaryXors = solver.findBinaryXors; + newSolver.regularlyFindBinaryXors = solver.regularlyFindBinaryXors; + newSolver.conglomerateXors = solver.conglomerateXors; + newSolver.schedSimplification = solver.schedSimplification; + newSolver.performReplace = solver.performReplace; + newSolver.failedVarSearch = solver.failedVarSearch; + #ifdef USE_GAUSS + newSolver.gaussconfig.dontDisable = solver.gaussconfig.dontDisable; + #endif //USE_GAUSS + newSolver.heuleProcess = solver.heuleProcess; + newSolver.doSubsumption = solver.doSubsumption; + newSolver.doPartHandler = solver.doPartHandler; + newSolver.fixRestartType = solver.fixRestartType; + newSolver.var_inc = solver.var_inc; + newSolver.polarity_mode = solver.polarity_mode; + std::sort(vars.begin(), vars.end()); + uint32_t i2 = 0; + for (Var var = 0; var < solver.nVars(); var++) { + if (i2 < vars.size() && vars[i2] == var) { + #ifdef VERBOSE_DEBUG + if (!solver.decision_var[var]) { + std::cout << "var " << var + 1 << " is non-decision, but in part... strange." << std::endl; + } + #endif //VERBOSE_DEBUG + newSolver.newVar(solver.decision_var[var]); + newSolver.activity[var] = solver.activity[var]; + newSolver.order_heap.update(var); + assert(partFinder.getVarPart(var) == part); + if (solver.decision_var[var]) { + solver.setDecisionVar(var, false); + decisionVarRemoved.push(var); + } + i2++; + } else { + assert(partFinder.getVarPart(var) != part); + newSolver.newVar(false); + } + } + solver.order_heap.filter(Solver::VarFilter(solver)); + + assert(solver.varReplacer->getClauses().size() == 0); + moveClauses(solver.clauses, newSolver, part, partFinder); + moveClauses(solver.binaryClauses, newSolver, part, partFinder); + moveClauses(solver.xorclauses, newSolver, part, partFinder); + moveLearntClauses(solver.binaryClauses, newSolver, part, partFinder); + moveLearntClauses(solver.learnts, newSolver, part, partFinder); + assert(checkClauseMovement(newSolver, part, partFinder)); + + lbool status = newSolver.solve(); + if (status == l_False) { + #ifdef VERBOSE_DEBUG + std::cout << "c One of the sub-problems was UNSAT. Whole problem is unsat." << std::endl; + #endif //VERBOSE_DEBUG + return false; + } + assert(status != l_Undef); + + for (Var var = 0; var < newSolver.nVars(); var++) { + if (newSolver.model[var] != l_Undef) { + assert(solver.assigns[var] == l_Undef); + } + } + + assert(newSolver.decisionLevel() == 0); + for (uint32_t i = 0; i < newSolver.trail.size(); i++) { + solver.uncheckedEnqueue(newSolver.trail[i]); + } + solver.ok = (solver.propagate() == NULL); + assert(solver.ok); + + for (Var var = 0; var < newSolver.nVars(); var++) { + if (newSolver.model[var] != l_Undef) { + //Must have been decision var in the old solver!?? + //assert(std::find(decisionVarRemoved.getData(), decisionVarRemoved.getDataEnd(), var) != decisionVarRemoved.getDataEnd()); + assert(savedState[var] == l_Undef); + assert(partFinder.getVarPart(var) == part); + if (newSolver.assigns[var] == l_Undef) { + savedState[var] = newSolver.model[var]; + } + } + } + + if (solver.verbosity >= 1) + std::cout << "c Solved part" << std::endl; + } + if (solver.verbosity >= 1) + std::cout << "c Coming back to original instance" + << std::setw(57) << " |" << std::endl; + + solver.order_heap.filter(Solver::VarFilter(solver)); + + //Checking that all variables that are not in the remaining part are all non-decision vars, and none have been set + for (Var var = 0; var < solver.nVars(); var++) { + if (savedState[var] != l_Undef) { + assert(solver.decision_var[var] == false); + assert(solver.assigns[var] == l_Undef || solver.level[var] == 0); + } + } + + //Checking that all remaining clauses contain only variables that are in the remaining part + assert(checkClauseMovement(solver, sizes[sizes.size()-1].first, partFinder)); + + return true; +} + +const bool PartHandler::checkClauseMovement(const Solver& thisSolver, const uint32_t part, const PartFinder& partFinder) const +{ + if (!checkOnlyThisPart(thisSolver.clauses, part, partFinder)) + return false; + if (!checkOnlyThisPart(thisSolver.learnts, part, partFinder)) + return false; + if (!checkOnlyThisPart(thisSolver.binaryClauses, part, partFinder)) + return false; + if (!checkOnlyThisPart(thisSolver.xorclauses, part, partFinder)) + return false; + + return true; +} + +template +const bool PartHandler::checkOnlyThisPart(const vec& cs, const uint32_t part, const PartFinder& partFinder) const +{ + for(T * const*it = cs.getData(), * const*end = it + cs.size(); it != end; it++) { + const T& c = **it; + for(const Lit *l = c.getData(), *end2 = l + c.size(); l != end2; l++) { + if (partFinder.getVarPart(l->var()) != part) return false; + } + } + + return true; +} + +void PartHandler::moveClauses(vec& cs, Solver& newSolver, const uint32_t part, PartFinder& partFinder) +{ + Clause **i, **j, **end; + for (i = j = cs.getData(), j = i , end = i + cs.size(); i != end; i++) { + if ((**i).learnt() || partFinder.getVarPart((**i)[0].var()) != part) { + *j++ = *i; + continue; + } + solver.detachClause(**i); + #ifdef VERBOSE_DEBUG + std::cout << "clause in this part:"; (**i).plainPrint(); + #endif + + Clause& c = **i; + vec tmp(c.size()); + std::copy(c.getData(), c.getDataEnd(), tmp.getData()); + newSolver.addClause(tmp, c.getGroup()); + //NOTE: we need the CS because otherwise, the addClause could have changed **i, which we need to re-add later! + clausesRemoved.push(*i); + } + cs.shrink(i-j); +} + +void PartHandler::moveClauses(vec& cs, Solver& newSolver, const uint32_t part, PartFinder& partFinder) +{ + XorClause **i, **j, **end; + for (i = j = cs.getData(), end = i + cs.size(); i != end; i++) { + if (partFinder.getVarPart((**i)[0].var()) != part) { + *j++ = *i; + continue; + } + solver.detachClause(**i); + #ifdef VERBOSE_DEBUG + std::cout << "xor clause in this part:"; (**i).plainPrint(); + #endif + + XorClause& c = **i; + vec tmp(c.size()); + std::copy(c.getData(), c.getDataEnd(), tmp.getData()); + newSolver.addXorClause(tmp, c.xor_clause_inverted(), c.getGroup()); + //NOTE: we need the CS because otherwise, the addXorClause could have changed **i, which we need to re-add later! + xorClausesRemoved.push(*i); + } + cs.shrink(i-j); +} + +void PartHandler::moveLearntClauses(vec& cs, Solver& newSolver, const uint32_t part, PartFinder& partFinder) +{ + Clause **i, **j, **end; + for (i = j = cs.getData(), end = i + cs.size() ; i != end; i++) { + if (!(**i).learnt()) { + *j++ = *i; + continue; + } + + Clause& c = **i; + assert(c.size() > 0); + uint32_t clause_part = partFinder.getVarPart(c[0].var()); + bool removed = false; + for (const Lit* l = c.getData(), *end = l + c.size(); l != end; l++) { + if (partFinder.getVarPart(l->var()) != clause_part) { + #ifdef VERBOSE_DEBUG + std::cout << "Learnt clause in both parts:"; c.plainPrint(); + #endif + + removed = true; + solver.removeClause(c); + break; + } + } + if (removed) continue; + if (clause_part == part) { + #ifdef VERBOSE_DEBUG + //std::cout << "Learnt clause in this part:"; c.plainPrint(); + #endif + + solver.detachClause(c); + newSolver.addLearntClause(c, c.getGroup(), c.activity()); + clauseFree(&c); + } else { + #ifdef VERBOSE_DEBUG + std::cout << "Learnt clause in other part:"; c.plainPrint(); + #endif + + *j++ = *i; + } + } + cs.shrink(i-j); +} + +void PartHandler::addSavedState() +{ + //Don't add these (non-0-decison-level!) solutions to the 0th decision level + solver.newDecisionLevel(); + for (Var var = 0; var < savedState.size(); var++) { + if (savedState[var] != l_Undef) { + assert(solver.assigns[var] == l_Undef); + solver.uncheckedEnqueue(Lit(var, savedState[var] == l_False)); + assert(solver.assigns[var] == savedState[var]); + savedState[var] = l_Undef; + solver.polarity[var] = (solver.assigns[var] == l_False); + } + } + + for (uint32_t i = 0; i < decisionVarRemoved.size(); i++) + solver.setDecisionVar(decisionVarRemoved[i], true); + decisionVarRemoved.clear(); +} + +void PartHandler::readdRemovedClauses() +{ + FILE* backup_libraryCNFfile = solver.libraryCNFFile; + solver.libraryCNFFile = NULL; + for (Clause **it = clausesRemoved.getData(), **end = clausesRemoved.getDataEnd(); it != end; it++) { + solver.addClause(**it, (*it)->getGroup()); + assert(solver.ok); + } + clausesRemoved.clear(); + + for (XorClause **it = xorClausesRemoved.getData(), **end = xorClausesRemoved.getDataEnd(); it != end; it++) { + solver.addXorClause(**it, (**it).xor_clause_inverted(), (*it)->getGroup()); + assert(solver.ok); + } + xorClausesRemoved.clear(); + solver.libraryCNFFile = backup_libraryCNFfile; +} + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/PartHandler.h b/packages/bee/cryptominisat-2.5.1/Solver/PartHandler.h new file mode 100755 index 000000000..7f535316a --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/PartHandler.h @@ -0,0 +1,78 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef PARTHANDLER_H +#define PARTHANDLER_H + +#include "Solver.h" +#include "PartFinder.h" +#include "Vec.h" +#include "SolverTypes.h" + +#include +#include +using std::map; +using std::vector; +using std::pair; + +class PartHandler +{ + public: + PartHandler(Solver& solver); + const bool handle(); + const vec& getSavedState(); + void newVar(); + void addSavedState(); + void readdRemovedClauses(); + + private: + struct sort_pred { + bool operator()(const std::pair &left, const std::pair &right) { + return left.second < right.second; + } + }; + + //For moving clauses + void moveClauses(vec& cs, Solver& newSolver, const uint32_t part, PartFinder& partFinder); + void moveClauses(vec& cs, Solver& newSolver, const uint32_t part, PartFinder& partFinder); + void moveLearntClauses(vec& cs, Solver& newSolver, const uint32_t part, PartFinder& partFinder); + + //Checking moved clauses + const bool checkClauseMovement(const Solver& thisSolver, const uint32_t part, const PartFinder& partFinder) const; + template + const bool checkOnlyThisPart(const vec& cs, const uint32_t part, const PartFinder& partFinder) const; + + Solver& solver; + vec savedState; + vec decisionVarRemoved; //variables whose decision-ness has been removed + vec clausesRemoved; + vec xorClausesRemoved; +}; + +inline const vec& PartHandler::getSavedState() +{ + return savedState; +} + +inline void PartHandler::newVar() +{ + savedState.push(l_Undef); +} + + + +#endif //PARTHANDLER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/RestartTypeChooser.cpp b/packages/bee/cryptominisat-2.5.1/Solver/RestartTypeChooser.cpp new file mode 100755 index 000000000..93273af42 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/RestartTypeChooser.cpp @@ -0,0 +1,146 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "RestartTypeChooser.h" +#include "Solver.h" + +//#define VERBOSE_DEBUG +//#define PRINT_VARS + +RestartTypeChooser::RestartTypeChooser(const Solver& s) : + solver(s) + , topX(100) + , limit(40) +{ +} + +void RestartTypeChooser::addInfo() +{ + firstVarsOld = firstVars; + calcHeap(); + uint sameIn = 0; + if (!firstVarsOld.empty()) { + uint thisTopX = std::min(firstVarsOld.size(), (size_t)topX); + for (uint i = 0; i != thisTopX; i++) { + if (std::find(firstVars.begin(), firstVars.end(), firstVarsOld[i]) != firstVars.end()) + sameIn++; + } + #ifdef VERBOSE_DEBUG + std::cout << " Same vars in first&second first 100: " << sameIn << std::endl; + #endif + sameIns.push_back(sameIn); + } + + #ifdef VERBOSE_DEBUG + std::cout << "Avg same vars in first&second first 100: " << avg() << " standard Deviation:" << stdDeviation(sameIns) < mypair = countVarsDegreeStDev(); + if ((mypair.second < 80 && + (avg() > (double)limit || ((avg() > (double)(limit*0.9) && stdDeviation(sameIns) < 5)))) + || + (mypair.second < 80 && (double)solver.xorclauses.size() > (double)solver.nClauses()*0.1)) + return static_restart; + else + return dynamic_restart; +} + +const double RestartTypeChooser::avg() const +{ + double sum = 0.0; + for (uint i = 0; i != sameIns.size(); i++) + sum += sameIns[i]; + return (sum/(double)sameIns.size()); +} + +const double RestartTypeChooser::stdDeviation(vector& measure) const +{ + double average = avg(); + double variance = 0.0; + for (uint i = 0; i != measure.size(); i++) + variance += pow((double)measure[i]-average, 2); + variance /= (double)measure.size(); + + return sqrt(variance); +} + +void RestartTypeChooser::calcHeap() +{ + firstVars.clear(); + firstVars.reserve(topX); + #ifdef PRINT_VARS + std::cout << "First vars:" << std::endl; + #endif + Heap tmp(solver.order_heap); + uint32_t thisTopX = std::min(tmp.size(), topX); + for (uint32_t i = 0; i != thisTopX; i++) { + #ifdef PRINT_VARS + std::cout << tmp.removeMin()+1 << ", "; + #endif + firstVars.push_back(tmp.removeMin()); + } + #ifdef PRINT_VARS + std::cout << std::endl; + #endif +} + +const std::pair RestartTypeChooser::countVarsDegreeStDev() const +{ + vector degrees; + degrees.resize(solver.nVars(), 0); + addDegrees(solver.clauses, degrees); + addDegrees(solver.binaryClauses, degrees); + addDegrees(solver.xorclauses, degrees); + uint32_t sum = 0; + uint32_t *i = °rees[0], *j = i; + for (uint32_t *end = i + degrees.size(); i != end; i++) { + if (*i != 0) { + sum += *i; + *j++ = *i; + } + } + degrees.resize(degrees.size() - (i-j)); + + double avg = (double)sum/(double)degrees.size(); + double stdDev = stdDeviation(degrees); + + #ifdef VERBOSE_DEBUG + std::cout << "varsDegree avg:" << avg << " stdDev:" << stdDev << std::endl; + #endif + + return std::make_pair(avg, stdDev); +} + +template +void RestartTypeChooser::addDegrees(const vec& cs, vector& degrees) const +{ + for (T * const*c = cs.getData(), * const*end = c + cs.size(); c != end; c++) { + T& cl = **c; + if (cl.learnt()) continue; + + for (const Lit *l = cl.getData(), *end2 = l + cl.size(); l != end2; l++) { + degrees[l->var()]++; + } + } +} + +template void RestartTypeChooser::addDegrees(const vec& cs, vector& degrees) const; +template void RestartTypeChooser::addDegrees(const vec& cs, vector& degrees) const; + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/RestartTypeChooser.h b/packages/bee/cryptominisat-2.5.1/Solver/RestartTypeChooser.h new file mode 100755 index 000000000..6940573b2 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/RestartTypeChooser.h @@ -0,0 +1,65 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef RESTARTTYPECHOOSER_H +#define RESTARTTYPECHOOSER_H + +#include "Solver.h" +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "SolverTypes.h" + +using std::vector; + +class Solver; + +class RestartTypeChooser +{ + public: + RestartTypeChooser(const Solver& s); + void addInfo(); + const RestartType choose(); + void reset(); + + private: + void calcHeap(); + const double avg() const; + const std::pair countVarsDegreeStDev() const; + const double stdDeviation(vector& measure) const; + + template + void addDegrees(const vec& cs, vector& degrees) const; + + const Solver& solver; + const uint32_t topX; + const uint32_t limit; + vector sameIns; + + vector firstVars, firstVarsOld; +}; + +inline void RestartTypeChooser::reset() +{ + sameIns.clear(); +} + +#endif //RESTARTTYPECHOOSER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/SmallPtr.cpp b/packages/bee/cryptominisat-2.5.1/Solver/SmallPtr.cpp new file mode 100755 index 000000000..ce4dcee36 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/SmallPtr.cpp @@ -0,0 +1,12 @@ +/* +Please see LICENSE-CPOL.html in the root directory for the licencing of this file. +Originally by: cppnow +Link: http://www.codeproject.com/KB/cpp/smallptr.aspx +*/ + +#include "SmallPtr.h" + +uintptr_t sptr_base::_segs = 1; +//boost::mutex sptr_base::_m; +uintptr_t sptr_base::_seg_map[sptr_base::ALIGNMENT] = { 0 }; + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/SmallPtr.h b/packages/bee/cryptominisat-2.5.1/Solver/SmallPtr.h new file mode 100755 index 000000000..c00a85111 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/SmallPtr.h @@ -0,0 +1,272 @@ +/* +Please see LICENSE-CPOL.html in the root directory for the licencing of this file. +Originally by: cppnow +Link: http://www.codeproject.com/KB/cpp/smallptr.aspx +*/ + +#ifndef __SMALL_PTR_H__ +#define __SMALL_PTR_H__ + +//#include + +#include +#include +#include "singleton.hpp" +//#include +//#include + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#define is_n_aligned(T, N) ((sizeof(T) % (N)) == 0) + +#ifdef WIN32 +# ifdef WIN64 +# define USE64 +# else +# define USE32 +# endif +#endif + +#ifdef __GNUG__ +# if defined(__amd64__) || defined(__x86_64__) +# define USE64 +# elif defined(__i386__) +# define USE32 +# endif +#endif + +#include + +class bad_alignment : public std::exception +{ +public: + bad_alignment(const char *const& w) {} +}; +class bad_segment : public std::exception +{ +public: + bad_segment(const char *const& w) {} +}; + +class sptr_base +{ +protected: + static const uint32_t ALIGNMENT_BITS = 2; + static const uint32_t ALIGNMENT = (1< lock(_m); + for (i = 0; i < s; ++i) + if (_seg_map[i] == p) + return i; + + i = _segs++; + if (_segs > ALIGNMENT) { + //throw bad_segment("Segment out of range"); + exit(-1); + } + + _seg_map[i] = p; + return i; + } + +}; + +template +class sptr : public sptr_base +{ +public: + typedef TYPE type; + typedef TYPE* native_pointer_type; + typedef const TYPE* const_native_pointer_type; + + sptr() throw() + : _ptr(0) + {} + + // Copy constructor + sptr(const sptr& o) throw() + : _ptr(o._ptr) + { + } + + // Copy from a related pointer type + // Although just copying _ptr would be more efficient - it may + // also be wrong - e.g. multiple inheritence + template + sptr(const sptr& o) + : _ptr(encode(static_cast(o.get()))) + { + } + + template + sptr(const O* p) + : _ptr(encode(static_cast(p))) + { + } + + sptr& operator=(const sptr& o) throw() + { + _ptr = o._ptr; + return *this; + } + + template + sptr& operator=(const sptr& o) + { + _ptr = encode(static_cast(o.get())); + return *this; + } + +private: + inline uint32_t encode(const_native_pointer_type ptr) const + { +#ifdef USE64 + + uintptr_t p = reinterpret_cast(ptr); + + if ((p & ALIGNMENT_MASK) != 0) { + //throw bad_alignment("Pointer is not aligned"); + exit(-1); + } + + return (uint32_t)(ptr2seg(p) + p); + +#else // 32 bit machine + return reinterpret_cast(ptr); +#endif + } + + inline native_pointer_type decode(uint32_t e) const + { +#ifdef USE64 + uintptr_t el = e; + uintptr_t ptr = (_seg_map[el & ALIGNMENT_MASK] + el) & ~ALIGNMENT_MASK; + + return reinterpret_cast(ptr); +#else + return reinterpret_cast(e); +#endif + } + + void check_alignment() const + { + //BOOST_STATIC_ASSERT(is_n_aligned(TYPE, ALIGNMENT)); + } + + void inc_sptr(uint32_t& e, uintptr_t offset = 1) + { + check_alignment(); +#ifdef USE64 + uintptr_t el = e; + uintptr_t seg = el & ALIGNMENT_MASK; + el += offset*ALIGNMENT; + + // check for overflow + if (el > 0xFFFFFFFFULL) + return encode(decode(e)+1); + e = (uint32_t)el; +#else + e+= (uint32_t)offset; +#endif + } + + void dec_sptr(uint32_t& e, size_t offset = 1) + { + check_alignment(); +#ifdef USE64 + uintptr_t el = e; +// uintptr_t seg = el & ALIGNMENT_MASK; + e-= offset*ALIGNMENT; + + // check for underflow + if (el > 0xFFFFFFFFULL) + return encode(decode(e)-1); + e = (uint32_t)el; +#else + e -= (uint32_t)offset; +#endif + } +public: + + TYPE* get() const throw() { return decode(_ptr); } + + // Pointer operators + + TYPE& operator*() { return *decode(_ptr); } + const TYPE& operator*() const { return *decode(_ptr); } + + TYPE* operator->() { return decode(_ptr); } + const TYPE* operator->() const { return decode(_ptr); } + + template + bool operator==(const sptr& o) const + { + return o._ptr == this->_ptr; + } + + operator TYPE*() const { return get(); } + + sptr& operator++( ) + { + inc_sptr(_ptr); + return *this; + } + + sptr operator++( int ) + { + sptr p = *this; + inc_sptr(_ptr); + return p; + } + + sptr& operator--( ) + { + dec_sptr(_ptr); + return *this; + } + sptr operator--( int ) + { + sptr p = *this; + dec_sptr(_ptr); + return p; + } + + sptr& operator+=(size_t offset) + { + inc_sptr(_ptr, offset); + return *this; + } + + sptr& operator-=(size_t offset) + { + dec_sptr(_ptr, offset); + return *this; + } + +private: + uint32_t _ptr; +}; + + +#endif + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Solver.cpp b/packages/bee/cryptominisat-2.5.1/Solver/Solver.cpp new file mode 100755 index 000000000..2016b3d2e --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Solver.cpp @@ -0,0 +1,2700 @@ +/****************************************************************************************[Solver.C] +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +CryptoMiniSat -- Copyright (c) 2009 Mate Soos +glucose -- Gilles Audemard, Laurent Simon (2008) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include "Solver.h" +#include +#include +#include +#include +#include +#include + +#include "Clause.h" +#include "time_mem.h" + +#include "VarReplacer.h" +#include "FindUndef.h" +#include "XorFinder.h" +#include "ClauseCleaner.h" +#include "RestartTypeChooser.h" +#include "FailedVarSearcher.h" +#include "Subsumer.h" +#include "PartHandler.h" +#include "XorSubsumer.h" +#include "StateSaver.h" + +#ifdef USE_GAUSS +#include "Gaussian.h" +#include "MatrixFinder.h" +#endif //USE_GAUSS + +#ifdef _MSC_VER +#define __builtin_prefetch(a,b,c) +//#define __builtin_prefetch(a,b) +#endif //_MSC_VER + +//#define DEBUG_UNCHECKEDENQUEUE_LEVEL0 +//#define VERBOSE_DEBUG_POLARITIES +//#define DEBUG_DYNAMIC_RESTART + +//================================================================================================= +// Constructor/Destructor: + + +Solver::Solver() : + // Parameters: (formerly in 'SearchParams') + random_var_freq(0.02) + , clause_decay (1 / 0.999) + , restart_first(100), restart_inc(1.5), learntsize_factor((double)1/(double)3), learntsize_inc(1) + + // More parameters: + // + , expensive_ccmin (true) + , polarity_mode (polarity_auto) + , verbosity (0) + , restrictedPickBranch(0) + , findNormalXors (true) + , findBinaryXors (true) + , regularlyFindBinaryXors(true) + , performReplace (true) + , conglomerateXors (true) + , heuleProcess (true) + , schedSimplification(true) + , doSubsumption (true) + , doXorSubsumption (true) + , doPartHandler (true) + , doHyperBinRes (true) + , doBlockedClause (true) + , doVarElim (true) + , doSubsume1 (true) + , failedVarSearch (true) + , readdOldLearnts (false) + , addExtraBins (true) + , removeUselessBins(true) + , regularRemoveUselessBins(true) + , subsumeWithNonExistBinaries(true) + , regularSubsumeWithNonExistBinaries(true) + , libraryUsage (true) + , greedyUnbound (false) + , fixRestartType (auto_restart) + + // Statistics: (formerly in 'SolverStats') + // + , starts(0), dynStarts(0), staticStarts(0), fullStarts(0), decisions(0), rnd_decisions(0), propagations(0), conflicts(0) + , clauses_literals(0), learnts_literals(0), max_literals(0), tot_literals(0) + , nbDL2(0), nbBin(0), lastNbBin(0), becameBinary(0), lastSearchForBinaryXor(0), nbReduceDB(0) + , improvedClauseNo(0), improvedClauseSize(0) + + #ifdef USE_GAUSS + , sum_gauss_called (0) + , sum_gauss_confl (0) + , sum_gauss_prop (0) + , sum_gauss_unit_truths (0) + #endif //USE_GAUSS + , ok (true) + , var_inc (128) + , cla_inc (1) + + , curRestart (1) + , nbclausesbeforereduce (NBCLAUSESBEFOREREDUCE) + , nbCompensateSubsumer (0) + + , qhead (0) + , simpDB_assigns (-1) + , simpDB_props (0) + , order_heap (VarOrderLt(activity)) + , progress_estimate(0) + , remove_satisfied (true) + , mtrand((unsigned long int)0) + , restartType (static_restart) + , lastSelectedRestartType (static_restart) + #ifdef STATS_NEEDED + , logger(verbosity) + , dynamic_behaviour_analysis(false) //do not document the proof as default + #endif + , maxRestarts(UINT_MAX) + , MYFLAG (0) + , learnt_clause_group(0) + , libraryCNFFile (NULL) + , simplifying (false) +{ + varReplacer = new VarReplacer(*this); + clauseCleaner = new ClauseCleaner(*this); + failedVarSearcher = new FailedVarSearcher(*this); + partHandler = new PartHandler(*this); + subsumer = new Subsumer(*this); + xorSubsumer = new XorSubsumer(*this); + restartTypeChooser = new RestartTypeChooser(*this); + #ifdef USE_GAUSS + matrixFinder = new MatrixFinder(*this); + #endif //USE_GAUSS + + #ifdef STATS_NEEDED + logger.setSolver(this); + #endif +} + +Solver::~Solver() +{ + for (uint32_t i = 0; i != learnts.size(); i++) clauseFree(learnts[i]); + for (uint32_t i = 0; i != clauses.size(); i++) clauseFree(clauses[i]); + for (uint32_t i = 0; i != binaryClauses.size(); i++) clauseFree(binaryClauses[i]); + for (uint32_t i = 0; i != xorclauses.size(); i++) clauseFree(xorclauses[i]); + for (uint32_t i = 0; i != removedLearnts.size(); i++) clauseFree(removedLearnts[i]); + #ifdef USE_GAUSS + clearGaussMatrixes(); + delete matrixFinder; + #endif + for (uint32_t i = 0; i != freeLater.size(); i++) clauseFree(freeLater[i]); + + delete varReplacer; + delete clauseCleaner; + delete failedVarSearcher; + delete partHandler; + delete subsumer; + delete xorSubsumer; + delete restartTypeChooser; + + if (libraryCNFFile) + fclose(libraryCNFFile); +} + +//================================================================================================= +// Minor methods: + + +// Creates a new SAT variable in the solver. If 'decision_var' is cleared, variable will not be +// used as a decision variable (NOTE! This has effects on the meaning of a SATISFIABLE result). +Var Solver::newVar(bool dvar) +{ + Var v = nVars(); + watches .push(); // (list for positive literal) + watches .push(); // (list for negative literal) + binwatches.push(); // (list for positive literal) + binwatches.push(); // (list for negative literal) + xorwatches.push(); // (list for variables in xors) + reason .push((Clause*)NULL); + assigns .push(l_Undef); + level .push(-1); + activity .push(0); + seen .push_back(0); + seen .push_back(0); + permDiff .push(0); + + polarity .push_back(defaultPolarity()); + #ifdef USE_OLD_POLARITIES + oldPolarity.push_back(defaultPolarity()); + #endif //USE_OLD_POLARITIES + + decision_var.push_back(dvar); + insertVarOrder(v); + + varReplacer->newVar(); + partHandler->newVar(); + subsumer->newVar(); + xorSubsumer->newVar(); + + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + logger.new_var(v); + #endif + + if (libraryCNFFile) + fprintf(libraryCNFFile, "c Solver::newVar() called\n"); + + return v; +} + +template +XorClause* Solver::addXorClauseInt(T& ps, bool xor_clause_inverted, const uint32_t group) +{ + assert(qhead == trail.size()); + assert(decisionLevel() == 0); + + if (ps.size() > (0x01UL << 18)) { + std::cout << "Too long clause!" << std::endl; + exit(-1); + } + std::sort(ps.getData(), ps.getDataEnd()); + Lit p; + uint32_t i, j; + for (i = j = 0, p = lit_Undef; i != ps.size(); i++) { + if (ps[i].var() == p.var()) { + //added, but easily removed + j--; + p = lit_Undef; + if (!assigns[ps[i].var()].isUndef()) + xor_clause_inverted ^= assigns[ps[i].var()].getBool(); + } else if (assigns[ps[i].var()].isUndef()) //just add + ps[j++] = p = ps[i]; + else //modify xor_clause_inverted instead of adding + xor_clause_inverted ^= (assigns[ps[i].var()].getBool()); + } + ps.shrink(i - j); + + switch(ps.size()) { + case 0: { + if (!xor_clause_inverted) ok = false; + return NULL; + } + case 1: { + uncheckedEnqueue(Lit(ps[0].var(), xor_clause_inverted)); + ok = (propagate() == NULL); + return NULL; + } + case 2: { + #ifdef VERBOSE_DEBUG + cout << "--> xor is 2-long, replacing var " << ps[0].var()+1 << " with " << (!xor_clause_inverted ? "-" : "") << ps[1].var()+1 << endl; + #endif + + learnt_clause_group = std::max(group+1, learnt_clause_group); + ps[0] = ps[0].unsign(); + ps[1] = ps[1].unsign(); + varReplacer->replace(ps, xor_clause_inverted, group); + return NULL; + } + default: { + learnt_clause_group = std::max(group+1, learnt_clause_group); + XorClause* c = XorClause_new(ps, xor_clause_inverted, group); + attachClause(*c); + return c; + } + } +} + +template XorClause* Solver::addXorClauseInt(vec& ps, bool xor_clause_inverted, const uint32_t group); +template XorClause* Solver::addXorClauseInt(XorClause& ps, bool xor_clause_inverted, const uint32_t group); + +template +bool Solver::addXorClause(T& ps, bool xor_clause_inverted, const uint group, char* group_name) +{ + assert(decisionLevel() == 0); + if (ps.size() > (0x01UL << 18)) { + std::cout << "Too long clause!" << std::endl; + exit(-1); + } + + if (libraryCNFFile) { + fprintf(libraryCNFFile, "x"); + for (uint32_t i = 0; i < ps.size(); i++) ps[i].print(libraryCNFFile); + fprintf(libraryCNFFile, "0\n"); + } + + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + logger.set_group_name(group, group_name); + #endif + + if (!ok) + return false; + assert(qhead == trail.size()); + + // Check if clause is satisfied and remove false/duplicate literals: + if (varReplacer->getNumLastReplacedVars() || subsumer->getNumElimed() || xorSubsumer->getNumElimed()) { + for (uint32_t i = 0; i != ps.size(); i++) { + if (subsumer->getVarElimed()[ps[i].var()] && !subsumer->unEliminate(ps[i].var())) + return false; + else if (xorSubsumer->getVarElimed()[ps[i].var()] && !xorSubsumer->unEliminate(ps[i].var())) + return false; + else { + Lit otherLit = varReplacer->getReplaceTable()[ps[i].var()]; + if (otherLit.var() != ps[i].var()) { + ps[i] = Lit(otherLit.var(), false); + xor_clause_inverted ^= otherLit.sign(); + } + } + } + } + + XorClause* c = addXorClauseInt(ps, xor_clause_inverted, group); + if (c != NULL) xorclauses.push(c); + + return ok; +} + +template bool Solver::addXorClause(vec& ps, bool xor_clause_inverted, const uint group, char* group_name); +template bool Solver::addXorClause(XorClause& ps, bool xor_clause_inverted, const uint group, char* group_name); + + +template +bool Solver::addLearntClause(T& ps, const uint group, const uint32_t activity) +{ + Clause* c = addClauseInt(ps, group); + if (c == NULL) return ok; + + //compensate for addClauseInt's attachClause, which doesn't know + //that this is a learnt clause. + clauses_literals -= c->size(); + learnts_literals += c->size(); + + c->makeLearnt(activity); + if (c->size() > 2) learnts.push(c); + else { + nbBin++; + binaryClauses.push(c); + } + return ok; +} +template bool Solver::addLearntClause(Clause& ps, const uint group, const uint32_t activity); +template bool Solver::addLearntClause(vec& ps, const uint group, const uint32_t activity); + +template +Clause* Solver::addClauseInt(T& ps, uint group) +{ + assert(ok); + + std::sort(ps.getData(), ps.getDataEnd()); + Lit p = lit_Undef; + uint32_t i, j; + for (i = j = 0; i != ps.size(); i++) { + if (value(ps[i]).getBool() || ps[i] == ~p) + return NULL; + else if (value(ps[i]) != l_False && ps[i] != p) + ps[j++] = p = ps[i]; + } + ps.shrink(i - j); + + if (ps.size() == 0) { + ok = false; + return NULL; + } else if (ps.size() == 1) { + uncheckedEnqueue(ps[0]); + ok = (propagate() == NULL); + return NULL; + } + + learnt_clause_group = std::max(group+1, learnt_clause_group); + Clause* c = Clause_new(ps, group); + attachClause(*c); + + return c; +} + +template Clause* Solver::addClauseInt(Clause& ps, const uint group); +template Clause* Solver::addClauseInt(vec& ps, const uint group); + +template +bool Solver::addClause(T& ps, const uint group, char* group_name) +{ + assert(decisionLevel() == 0); + if (ps.size() > (0x01UL << 18)) { + std::cout << "Too long clause!" << std::endl; + exit(-1); + } + + if (libraryCNFFile) { + for (uint32_t i = 0; i != ps.size(); i++) ps[i].print(libraryCNFFile); + fprintf(libraryCNFFile, "0\n"); + } + + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + logger.set_group_name(group, group_name); + #endif + + if (!ok) + return false; + assert(qhead == trail.size()); + + // Check if clause is satisfied and remove false/duplicate literals: + if (varReplacer->getNumLastReplacedVars() || subsumer->getNumElimed() || xorSubsumer->getNumElimed()) { + for (uint32_t i = 0; i != ps.size(); i++) { + ps[i] = varReplacer->getReplaceTable()[ps[i].var()] ^ ps[i].sign(); + if (subsumer->getVarElimed()[ps[i].var()] && !subsumer->unEliminate(ps[i].var())) + return false; + if (xorSubsumer->getVarElimed()[ps[i].var()] && !xorSubsumer->unEliminate(ps[i].var())) + return false; + } + } + + Clause* c = addClauseInt(ps, group); + if (c != NULL) { + if (c->size() > 2) + clauses.push(c); + else + binaryClauses.push(c); + } + + return ok; +} + +template bool Solver::addClause(vec& ps, const uint group, char* group_name); +template bool Solver::addClause(Clause& ps, const uint group, char* group_name); + +void Solver::attachClause(XorClause& c) +{ + assert(c.size() > 2); + #ifdef DEBUG_ATTACH + assert(assigns[c[0].var()] == l_Undef); + assert(assigns[c[1].var()] == l_Undef); + #endif //DEBUG_ATTACH + + xorwatches[c[0].var()].push(&c); + xorwatches[c[1].var()].push(&c); + + clauses_literals += c.size(); +} + +void Solver::attachClause(Clause& c) +{ + assert(c.size() > 1); + int index0 = (~c[0]).toInt(); + int index1 = (~c[1]).toInt(); + + if (c.size() == 2) { + binwatches[index0].push(WatchedBin(&c, c[1])); + binwatches[index1].push(WatchedBin(&c, c[0])); + } else { + watches[index0].push(Watched(&c, c[c.size()/2])); + watches[index1].push(Watched(&c, c[c.size()/2])); + } + + if (c.learnt()) learnts_literals += c.size(); + else clauses_literals += c.size(); +} + + +void Solver::detachClause(const XorClause& c) +{ + assert(c.size() > 1); + assert(find(xorwatches[c[0].var()], &c)); + assert(find(xorwatches[c[1].var()], &c)); + remove(xorwatches[c[0].var()], &c); + remove(xorwatches[c[1].var()], &c); + + clauses_literals -= c.size(); +} + +void Solver::detachClause(const Clause& c) +{ + assert(c.size() > 1); + if (c.size() == 2) { + assert(findWatchedBinCl(binwatches[(~c[0]).toInt()], &c)); + assert(findWatchedBinCl(binwatches[(~c[1]).toInt()], &c)); + + removeWatchedBinCl(binwatches[(~c[0]).toInt()], &c); + removeWatchedBinCl(binwatches[(~c[1]).toInt()], &c); + } else { + assert(findWatchedCl(watches[(~c[0]).toInt()], &c)); + assert(findWatchedCl(watches[(~c[1]).toInt()], &c)); + + removeWatchedCl(watches[(~c[0]).toInt()], &c); + removeWatchedCl(watches[(~c[1]).toInt()], &c); + } + + if (c.learnt()) learnts_literals -= c.size(); + else clauses_literals -= c.size(); +} + +void Solver::detachModifiedClause(const Lit lit1, const Lit lit2, const uint origSize, const Clause* address) +{ + assert(origSize > 1); + + if (origSize == 2) { + assert(findWatchedBinCl(binwatches[(~lit1).toInt()], address)); + assert(findWatchedBinCl(binwatches[(~lit2).toInt()], address)); + removeWatchedBinCl(binwatches[(~lit1).toInt()], address); + removeWatchedBinCl(binwatches[(~lit2).toInt()], address); + } else { + assert(findW(watches[(~lit1).toInt()], address)); + assert(findW(watches[(~lit2).toInt()], address)); + removeW(watches[(~lit1).toInt()], address); + removeW(watches[(~lit2).toInt()], address); + } + if (address->learnt()) learnts_literals -= origSize; + else clauses_literals -= origSize; +} + +void Solver::detachModifiedClause(const Var var1, const Var var2, const uint origSize, const XorClause* address) +{ + assert(origSize > 2); + + assert(find(xorwatches[var1], address)); + assert(find(xorwatches[var2], address)); + remove(xorwatches[var1], address); + remove(xorwatches[var2], address); + + clauses_literals -= origSize; +} + +// Revert to the state at given level (keeping all assignment at 'level' but not beyond). +// +void Solver::cancelUntil(int level) +{ + #ifdef VERBOSE_DEBUG + cout << "Canceling until level " << level; + if (level > 0) cout << " sublevel: " << trail_lim[level]; + cout << endl; + #endif + + if ((int)decisionLevel() > level) { + + #ifdef USE_GAUSS + for (vector::iterator gauss = gauss_matrixes.begin(), end= gauss_matrixes.end(); gauss != end; gauss++) + (*gauss)->canceling(trail_lim[level]); + #endif //USE_GAUSS + + for (int sublevel = trail.size()-1; sublevel >= (int)trail_lim[level]; sublevel--) { + Var var = trail[sublevel].var(); + #ifdef VERBOSE_DEBUG + cout << "Canceling var " << var+1 << " sublevel: " << sublevel << endl; + #endif + #ifdef USE_OLD_POLARITIES + polarity[var] = oldPolarity[var]; + #endif //USE_OLD_POLARITIES + assigns[var] = l_Undef; + insertVarOrder(var); + } + qhead = trail_lim[level]; + trail.shrink_(trail.size() - trail_lim[level]); + trail_lim.shrink_(trail_lim.size() - level); + } + + #ifdef VERBOSE_DEBUG + cout << "Canceling finished. (now at level: " << decisionLevel() << " sublevel: " << trail.size()-1 << ")" << endl; + #endif +} + +void Solver::printLit(const Lit l) const +{ + printf("%s%d:%c", l.sign() ? "-" : "", l.var()+1, value(l) == l_True ? '1' : (value(l) == l_False ? '0' : 'X')); +} + +void Solver::needLibraryCNFFile(const char* fileName) +{ + libraryCNFFile = fopen(fileName, "w"); + assert(libraryCNFFile != NULL); +} + +#ifdef USE_GAUSS +void Solver::clearGaussMatrixes() +{ + for (uint i = 0; i < gauss_matrixes.size(); i++) + delete gauss_matrixes[i]; + gauss_matrixes.clear(); +} +#endif //USE_GAUSS + +inline bool Solver::defaultPolarity() +{ + switch(polarity_mode) { + case polarity_false: + return true; + case polarity_true: + return false; + case polarity_rnd: + return mtrand.randInt(1); + case polarity_auto: + return true; + default: + assert(false); + } + + return true; +} + +void Solver::tallyVotes(const vec& cs, vector& votes) const +{ + for (const Clause * const*it = cs.getData(), * const*end = it + cs.size(); it != end; it++) { + const Clause& c = **it; + if (c.learnt()) continue; + + double divider; + if (c.size() > 63) divider = 0.0; + else divider = 1.0/(double)((uint64_t)1<<(c.size()-1)); + + for (const Lit *it2 = &c[0], *end2 = it2 + c.size(); it2 != end2; it2++) { + if (it2->sign()) votes[it2->var()] += divider; + else votes[it2->var()] -= divider; + } + } +} + +void Solver::tallyVotes(const vec& cs, vector& votes) const +{ + for (const XorClause * const*it = cs.getData(), * const*end = it + cs.size(); it != end; it++) { + const XorClause& c = **it; + double divider; + if (c.size() > 63) divider = 0.0; + else divider = 1.0/(double)((uint64_t)1<<(c.size()-1)); + + for (const Lit *it2 = &c[0], *end2 = it2 + c.size(); it2 != end2; it2++) + votes[it2->var()] += divider; + } +} + +void Solver::calculateDefaultPolarities() +{ + #ifdef VERBOSE_DEBUG_POLARITIES + std::cout << "Default polarities: " << std::endl; + #endif + + assert(decisionLevel() == 0); + if (polarity_mode == polarity_auto) { + double time = cpuTime(); + + vector votes; + votes.resize(nVars(), 0.0); + + tallyVotes(clauses, votes); + tallyVotes(binaryClauses, votes); + tallyVotes(varReplacer->getClauses(), votes); + tallyVotes(xorclauses, votes); + + Var i = 0; + uint32_t posPolars = 0; + uint32_t undecidedPolars = 0; + for (vector::const_iterator it = votes.begin(), end = votes.end(); it != end; it++, i++) { + polarity[i] = (*it >= 0.0); + posPolars += (*it < 0.0); + undecidedPolars += (*it == 0.0); + #ifdef VERBOSE_DEBUG_POLARITIES + std::cout << !defaultPolarities[i] << ", "; + #endif //VERBOSE_DEBUG_POLARITIES + } + + if (verbosity >= 2) { + std::cout << "c | Calc default polars - " + << " time: " << std::fixed << std::setw(6) << std::setprecision(2) << cpuTime()-time << " s" + << " pos: " << std::setw(7) << posPolars + << " undec: " << std::setw(7) << undecidedPolars + << " neg: " << std::setw(7) << nVars()- undecidedPolars - posPolars + << std::setw(8) << " |" << std:: endl; + } + } else { + std::fill(polarity.begin(), polarity.end(), defaultPolarity()); + } + + #ifdef VERBOSE_DEBUG_POLARITIES + std::cout << std::endl; + #endif //VERBOSE_DEBUG_POLARITIES +} + +//================================================================================================= +// Major methods: + + +Lit Solver::pickBranchLit() +{ + #ifdef VERBOSE_DEBUG + cout << "decision level: " << decisionLevel() << " "; + #endif + + Var next = var_Undef; + + bool random = mtrand.randDblExc() < random_var_freq; + + // Random decision: + if (random && !order_heap.empty()) { + if (restrictedPickBranch == 0) + next = order_heap[mtrand.randInt(order_heap.size()-1)]; + else + next = order_heap[mtrand.randInt(std::min((uint32_t)order_heap.size()-1, restrictedPickBranch))]; + + if (assigns[next] == l_Undef && decision_var[next]) + rnd_decisions++; + } + + // Activity based decision: + while (next == var_Undef || assigns[next] != l_Undef || !decision_var[next]) + if (order_heap.empty()) { + #ifdef VERBOSE_DEBUG + cout << "SAT!" << endl; + #endif + return lit_Undef; + } else { + next = order_heap.removeMin(); + } + + bool sign; + if (simplifying && random) + sign = mtrand.randInt(1); + #ifdef RANDOM_LOOKAROUND_SEARCHSPACE + else if (avgBranchDepth.isvalid()) + sign = polarity[next] ^ (mtrand.randInt(avgBranchDepth.getavg() * ((lastSelectedRestartType == static_restart) ? 2 : 1) ) == 1); + #endif + else + sign = polarity[next]; + + Lit lit(next,sign); + #ifdef VERBOSE_DEBUG + assert(decision_var[lit.var()]); + cout << "decided on: " << lit.var()+1 << " to set:" << !lit.sign() << endl; + #endif + return lit; +} + +// Assumes 'seen' is cleared (will leave it cleared) +template +bool subset(const T1& A, const T2& B, vector& seen) +{ + for (uint i = 0; i != B.size(); i++) + seen[B[i].toInt()] = 1; + for (uint i = 0; i != A.size(); i++) { + if (!seen[A[i].toInt()]) { + for (uint i = 0; i != B.size(); i++) + seen[B[i].toInt()] = 0; + return false; + } + } + for (uint i = 0; i != B.size(); i++) + seen[B[i].toInt()] = 0; + return true; +} + + +/*_________________________________________________________________________________________________ +| +| analyze : (confl : Clause*) (out_learnt : vec&) (out_btlevel : int&) -> [void] +| +| Description: +| Analyze conflict and produce a reason clause. +| +| Pre-conditions: +| * 'out_learnt' is assumed to be cleared. +| * Current decision level must be greater than root level. +| +| Post-conditions: +| * 'out_learnt[0]' is the asserting literal at level 'out_btlevel'. +| +| Effect: +| Will undo part of the trail, upto but not beyond the assumption of the current decision level. +|________________________________________________________________________________________________@*/ +Clause* Solver::analyze(Clause* confl, vec& out_learnt, int& out_btlevel, uint32_t &nbLevels, const bool update) +{ + int pathC = 0; + Lit p = lit_Undef; + Clause* oldConfl = NULL; + + // Generate conflict clause: + // + out_learnt.push(); // (leave room for the asserting literal) + int index = trail.size() - 1; + out_btlevel = 0; + + do { + assert(confl != NULL); // (otherwise should be UIP) + Clause& c = *confl; + if (p != lit_Undef) + reverse_binary_clause(c); + + if (update && restartType == static_restart && c.learnt()) + claBumpActivity(c); + + for (uint j = (p == lit_Undef) ? 0 : 1; j != c.size(); j++) { + const Lit& q = c[j]; + const Var my_var = q.var(); + + if (!seen[my_var] && level[my_var] > 0) { + varBumpActivity(my_var); + seen[my_var] = 1; + if (level[my_var] >= (int)decisionLevel()) { + pathC++; + #ifdef UPDATEVARACTIVITY + if (lastSelectedRestartType == dynamic_restart && reason[q.var()] != NULL && reason[q.var()]->learnt()) + lastDecisionLevel.push(q.var()); + #endif + } else { + out_learnt.push(q); + if (level[my_var] > out_btlevel) + out_btlevel = level[my_var]; + } + } + } + + // Select next clause to look at: + while (!seen[trail[index--].var()]); + p = trail[index+1]; + oldConfl = confl; + confl = reason[p.var()]; + __builtin_prefetch(confl, 1, 0); + seen[p.var()] = 0; + pathC--; + + } while (pathC > 0); + out_learnt[0] = ~p; + + // Simplify conflict clause: + // + uint32_t i, j; + if (expensive_ccmin) { + uint32_t abstract_level = 0; + for (i = 1; i < out_learnt.size(); i++) + abstract_level |= abstractLevel(out_learnt[i].var()); // (maintain an abstraction of levels involved in conflict) + + out_learnt.copyTo(analyze_toclear); + for (i = j = 1; i < out_learnt.size(); i++) + if (reason[out_learnt[i].var()] == NULL || !litRedundant(out_learnt[i], abstract_level)) + out_learnt[j++] = out_learnt[i]; + } else { + out_learnt.copyTo(analyze_toclear); + for (i = j = 1; i < out_learnt.size(); i++) { + Clause& c = *reason[out_learnt[i].var()]; + reverse_binary_clause(c); + + for (uint k = 1; k < c.size(); k++) + if (!seen[c[k].var()] && level[c[k].var()] > 0) { + out_learnt[j++] = out_learnt[i]; + break; + } + } + } + max_literals += out_learnt.size(); + out_learnt.shrink(i - j); + tot_literals += out_learnt.size(); + + // Find correct backtrack level: + // + if (out_learnt.size() == 1) + out_btlevel = 0; + else { + uint32_t max_i = 1; + for (uint32_t i = 2; i < out_learnt.size(); i++) + if (level[out_learnt[i].var()] > level[out_learnt[max_i].var()]) + max_i = i; + Lit p = out_learnt[max_i]; + out_learnt[max_i] = out_learnt[1]; + out_learnt[1] = p; + out_btlevel = level[p.var()]; + } + + if (lastSelectedRestartType == dynamic_restart) { + nbLevels = calcNBLevels(out_learnt); + #ifdef UPDATEVARACTIVITY + for(uint32_t i = 0; i != lastDecisionLevel.size(); i++) { + if (reason[lastDecisionLevel[i]]->activity() < nbLevels) + varBumpActivity(lastDecisionLevel[i]); + } + lastDecisionLevel.clear(); + #endif + } else { + nbLevels = 1000; + } + + for (uint32_t j = 0; j != analyze_toclear.size(); j++) + seen[analyze_toclear[j].var()] = 0; // ('seen[]' is now cleared) + + if (out_learnt.size() == 1) + return NULL; + + if (!oldConfl->isXor() && out_learnt.size() < oldConfl->size()) { + if (!subset(out_learnt, *oldConfl, seen)) return NULL; + improvedClauseNo++; + improvedClauseSize += oldConfl->size() - out_learnt.size(); + return oldConfl; + } + + return NULL; +} + + +// Check if 'p' can be removed. 'abstract_levels' is used to abort early if the algorithm is +// visiting literals at levels that cannot be removed later. +bool Solver::litRedundant(Lit p, uint32_t abstract_levels) +{ + analyze_stack.clear(); + analyze_stack.push(p); + int top = analyze_toclear.size(); + while (analyze_stack.size() > 0) { + assert(reason[analyze_stack.last().var()] != NULL); + Clause& c = *reason[analyze_stack.last().var()]; + reverse_binary_clause(c); + + analyze_stack.pop(); + + for (uint i = 1; i < c.size(); i++) { + Lit p = c[i]; + if (!seen[p.var()] && level[p.var()] > 0) { + if (reason[p.var()] != NULL && (abstractLevel(p.var()) & abstract_levels) != 0) { + seen[p.var()] = 1; + analyze_stack.push(p); + analyze_toclear.push(p); + } else { + for (uint32_t j = top; j != analyze_toclear.size(); j++) + seen[analyze_toclear[j].var()] = 0; + analyze_toclear.shrink(analyze_toclear.size() - top); + return false; + } + } + } + } + + return true; +} + + +/*_________________________________________________________________________________________________ +| +| analyzeFinal : (p : Lit) -> [void] +| +| Description: +| Specialized analysis procedure to express the final conflict in terms of assumptions. +| Calculates the (possibly empty) set of assumptions that led to the assignment of 'p', and +| stores the result in 'out_conflict'. +|________________________________________________________________________________________________@*/ +void Solver::analyzeFinal(Lit p, vec& out_conflict) +{ + out_conflict.clear(); + out_conflict.push(p); + + if (decisionLevel() == 0) + return; + + seen[p.var()] = 1; + + for (int32_t i = (int32_t)trail.size()-1; i >= (int32_t)trail_lim[0]; i--) { + Var x = trail[i].var(); + if (seen[x]) { + if (reason[x] == NULL) { + assert(level[x] > 0); + out_conflict.push(~trail[i]); + } else { + const Clause& c = *reason[x]; + for (uint j = 1; j < c.size(); j++) + if (level[c[j].var()] > 0) + seen[c[j].var()] = 1; + } + seen[x] = 0; + } + } + + seen[p.var()] = 0; +} + + +void Solver::uncheckedEnqueue(Lit p, ClausePtr from) +{ + + #ifdef DEBUG_UNCHECKEDENQUEUE_LEVEL0 + #ifndef VERBOSE_DEBUG + if (decisionLevel() == 0) + #endif //VERBOSE_DEBUG + std::cout << "uncheckedEnqueue var " << p.var()+1 << " to " << !p.sign() << " level: " << decisionLevel() << " sublevel: " << trail.size() << std::endl; + #endif //DEBUG_UNCHECKEDENQUEUE_LEVEL0 + + //assert(decisionLevel() == 0 || !subsumer->getVarElimed()[p.var()]); + + assert(assigns[p.var()].isUndef()); + const Var v = p.var(); + assigns [v] = boolToLBool(!p.sign());//lbool(!sign(p)); // <<== abstract but not uttermost effecient + level [v] = decisionLevel(); + reason [v] = from; + #ifdef USE_OLD_POLARITIES + oldPolarity[p.var()] = polarity[p.var()]; + #endif //USE_OLD_POLARITIES + polarity[p.var()] = p.sign(); + trail.push(p); + + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + logger.propagation(p, from); + #endif +} + +/*_________________________________________________________________________________________________ +| +| propagate : [void] -> [Clause*] +| +| Description: +| Propagates all enqueued facts. If a conflict arises, the conflicting clause is returned, +| otherwise NULL. +| +| Post-conditions: +| * the propagation queue is empty, even if there was a conflict. +|________________________________________________________________________________________________@*/ +Clause* Solver::propagate(const bool update) +{ + Clause* confl = NULL; + uint32_t num_props = 0; + + #ifdef VERBOSE_DEBUG + cout << "Propagation started" << endl; + #endif + uint32_t qheadBin = qhead; + + while (qhead < trail.size()) { + + //First propagate binary clauses + while (qheadBin < trail.size()) { + Lit p = trail[qheadBin++]; + vec & wbin = binwatches[p.toInt()]; + num_props += wbin.size()/2; + for(WatchedBin *k = wbin.getData(), *end = wbin.getDataEnd(); k != end; k++) { + lbool val = value(k->impliedLit); + if (val.isUndef()) { + uncheckedEnqueue(k->impliedLit, k->clause); + } else if (val == l_False) { + confl = k->clause; + //goto EndPropagate; + } + } + } + if (confl != NULL) + goto EndPropagate; + + //Next, propagate normal clauses + Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate. + vec& ws = watches[p.toInt()]; + Watched *i, *j, *end; + num_props += ws.size(); + + #ifdef VERBOSE_DEBUG + cout << "Propagating lit " << (p.sign() ? '-' : ' ') << p.var()+1 << endl; + #endif + + for (i = j = ws.getData(), end = ws.getDataEnd(); i != end;) { + if (i+1 != end) + __builtin_prefetch((i+1)->clause, 1, 0); + + if(value(i->blockedLit).getBool()) { // Clause is sat + *j++ = *i++; + continue; + } + Lit bl = i->blockedLit; + Clause& c = *(i->clause); + i++; + + // Make sure the false literal is data[1]: + const Lit false_lit(~p); + if (c[0] == false_lit) + c[0] = c[1], c[1] = false_lit; + + assert(c[1] == false_lit); + + // If 0th watch is true, then clause is already satisfied. + const Lit& first = c[0]; + if (value(first).getBool()) { + j->clause = &c; + j->blockedLit = first; + j++; + } else { + // Look for new watch: + for (Lit *k = &c[2], *end2 = c.getDataEnd(); k != end2; k++) { + if (value(*k) != l_False) { + c[1] = *k; + *k = false_lit; + watches[(~c[1]).toInt()].push(Watched(&c, c[0])); + goto FoundWatch; + } + } + + // Did not find watch -- clause is unit under assignment: + j->clause = &c; + j->blockedLit = bl; + j++; + if (value(first) == l_False) { + confl = &c; + qhead = trail.size(); + // Copy the remaining watches: + while (i < end) + *j++ = *i++; + } else { + uncheckedEnqueue(first, &c); + #ifdef DYNAMICNBLEVEL + if (update && c.learnt() && c.activity() > 2) { // GA + uint32_t nbLevels = calcNBLevels(c); + if (nbLevels+1 < c.activity()) + c.setActivity(nbLevels); + } + #endif + } + } +FoundWatch: + ; + } + ws.shrink_(i - j); + + //Finally, propagate XOR-clauses + if (xorclauses.size() > 0 && !confl) confl = propagate_xors(p); + } +EndPropagate: + propagations += num_props; + simpDB_props -= num_props; + + #ifdef VERBOSE_DEBUG + cout << "Propagation ended." << endl; + #endif + + return confl; +} + +Clause* Solver::propagateLight() +{ + Clause* confl = NULL; + uint32_t num_props = 0; + uint32_t qheadBin = qhead; + + while (qhead < trail.size()) { + + //First propagate binary clauses + while (qheadBin < trail.size()) { + Lit p = trail[qheadBin++]; + vec & wbin = binwatches[p.toInt()]; + num_props += wbin.size()/2; + for(WatchedBin *k = wbin.getData(), *end = wbin.getDataEnd(); k != end; k++) { + lbool val = value(k->impliedLit); + if (val.isUndef()) { + uncheckedEnqueueLight(k->impliedLit); + } else if (val == l_False) { + confl = k->clause; + goto EndPropagate; + } + } + } + + //Next, propagate normal clauses + Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate. + vec& ws = watches[p.toInt()]; + Watched *i, *j, *end; + num_props += ws.size(); + + for (i = j = ws.getData(), end = ws.getDataEnd(); i != end;) { + if (i+1 != end) + __builtin_prefetch((i+1)->clause, 1, 0); + + if(value(i->blockedLit).getBool()) { // Clause is sat + *j++ = *i++; + continue; + } + Lit bl = i->blockedLit; + Clause& c = *(i->clause); + i++; + + // Make sure the false literal is data[1]: + const Lit false_lit(~p); + if (c[0] == false_lit) + c[0] = c[1], c[1] = false_lit; + + assert(c[1] == false_lit); + + // If 0th watch is true, then clause is already satisfied. + const Lit& first = c[0]; + if (value(first).getBool()) { + j->clause = &c; + j->blockedLit = first; + j++; + } else { + // Look for new watch: + for (Lit *k = &c[2], *end2 = c.getDataEnd(); k != end2; k++) { + if (value(*k) != l_False) { + c[1] = *k; + *k = false_lit; + watches[(~c[1]).toInt()].push(Watched(&c, c[0])); + goto FoundWatch; + } + } + + // Did not find watch -- clause is unit under assignment: + j->clause = &c; + j->blockedLit = bl; + j++; + if (value(first) == l_False) { + confl = &c; + qhead = trail.size(); + // Copy the remaining watches: + while (i < end) + *j++ = *i++; + } else { + uncheckedEnqueueLight(first); + } + } + FoundWatch: + ; + } + ws.shrink_(i - j); + + //Finally, propagate XOR-clauses + if (xorclauses.size() > 0 && !confl) confl = propagate_xors(p); + } + EndPropagate: + propagations += num_props; + simpDB_props -= num_props; + + return confl; +} + +Clause* Solver::propagateBin() +{ + while (qhead < trail.size()) { + Lit p = trail[qhead++]; + vec & wbin = binwatches[p.toInt()]; + propagations += wbin.size()/2; + for(WatchedBin *k = wbin.getData(), *end = wbin.getDataEnd(); k != end; k++) { + lbool val = value(k->impliedLit); + if (val.isUndef()) { + //uncheckedEnqueue(k->impliedLit, k->clause); + uncheckedEnqueueLight(k->impliedLit); + } else if (val == l_False) { + return k->clause; + } + } + } + + return NULL; +} + +Clause* Solver::propagateBinNoLearnts() +{ + while (qhead < trail.size()) { + Lit p = trail[qhead++]; + vec & wbin = binwatches[p.toInt()]; + propagations += wbin.size()/2; + for(WatchedBin *k = wbin.getData(), *end = wbin.getDataEnd(); k != end; k++) { + if (k->clause->learnt()) continue; + lbool val = value(k->impliedLit); + if (val.isUndef()) { + //uncheckedEnqueue(k->impliedLit, k->clause); + uncheckedEnqueueLight(k->impliedLit); + } else if (val == l_False) { + return k->clause; + } + } + } + + return NULL; +} + +template +Clause* Solver::propagateBinExcept(const Lit& exceptLit) +{ + while (qhead < trail.size()) { + Lit p = trail[qhead++]; + vec & wbin = binwatches[p.toInt()]; + propagations += wbin.size()/2; + for(WatchedBin *k = wbin.getData(), *end = wbin.getDataEnd(); k != end; k++) { + if (!dontCareLearnt && k->clause->learnt()) continue; + lbool val = value(k->impliedLit); + if (val.isUndef() && k->impliedLit != exceptLit) { + //uncheckedEnqueue(k->impliedLit, k->clause); + uncheckedEnqueueLight(k->impliedLit); + } else if (val == l_False) { + return k->clause; + } + } + } + + return NULL; +} + +template Clause* Solver::propagateBinExcept (const Lit& exceptLit); +template Clause* Solver::propagateBinExcept (const Lit& exceptLit); + +template +Clause* Solver::propagateBinOneLevel() +{ + Lit p = trail[qhead]; + vec & wbin = binwatches[p.toInt()]; + propagations += wbin.size()/2; + for(WatchedBin *k = wbin.getData(), *end = wbin.getDataEnd(); k != end; k++) { + if (!dontCareLearnt && k->clause->learnt()) continue; + lbool val = value(k->impliedLit); + if (val.isUndef()) { + //uncheckedEnqueue(k->impliedLit, k->clause); + uncheckedEnqueueLight(k->impliedLit); + } else if (val == l_False) { + return k->clause; + } + } + + return NULL; +} + +template Clause* Solver::propagateBinOneLevel (); +template Clause* Solver::propagateBinOneLevel (); + +template +inline const uint32_t Solver::calcNBLevels(const T& ps) +{ + MYFLAG++; + uint32_t nbLevels = 0; + for(const Lit *l = ps.getData(), *end = ps.getDataEnd(); l != end; l++) { + int32_t lev = level[l->var()]; + if (permDiff[lev] != MYFLAG) { + permDiff[lev] = MYFLAG; + nbLevels++; + } + } + return nbLevels; +} + +Clause* Solver::propagate_xors(const Lit& p) +{ + #ifdef VERBOSE_DEBUG_XOR + cout << "Xor-Propagating variable " << p.var()+1 << endl; + #endif + + Clause* confl = NULL; + + vec& ws = xorwatches[p.var()]; + XorClausePtr *i, *j, *end; + for (i = j = ws.getData(), end = i + ws.size(); i != end;) { + XorClause& c = **i++; + if (i != end) + __builtin_prefetch(*i, 1, 0); + + // Make sure the false literal is data[1]: + if (c[0].var() == p.var()) { + Lit tmp(c[0]); + c[0] = c[1]; + c[1] = tmp; + } + assert(c[1].var() == p.var()); + + #ifdef VERBOSE_DEBUG_XOR + cout << "--> xor thing -- " << endl; + printClause(c); + cout << endl; + #endif + bool final = c.xor_clause_inverted(); + for (uint32_t k = 0, size = c.size(); k != size; k++ ) { + const lbool& val = assigns[c[k].var()]; + if (val.isUndef() && k >= 2) { + Lit tmp(c[1]); + c[1] = c[k]; + c[k] = tmp; + #ifdef VERBOSE_DEBUG_XOR + cout << "new watch set" << endl << endl; + #endif + xorwatches[c[1].var()].push(&c); + goto FoundWatch; + } + + c[k] = c[k].unsign() ^ val.getBool(); + final ^= val.getBool(); + } + + + { + // Did not find watch -- clause is unit under assignment: + *j++ = &c; + + #ifdef VERBOSE_DEBUG_XOR + cout << "final: " << std::boolalpha << final << " - "; + #endif + if (assigns[c[0].var()].isUndef()) { + c[0] = c[0].unsign()^final; + + #ifdef VERBOSE_DEBUG_XOR + cout << "propagating "; + printLit(c[0]); + cout << endl; + cout << "propagation clause -- "; + printClause(*(Clause*)&c); + cout << endl << endl; + #endif + + uncheckedEnqueue(c[0], (Clause*)&c); + } else if (!final) { + + #ifdef VERBOSE_DEBUG_XOR + printf("conflict clause -- "); + printClause(*(Clause*)&c); + cout << endl << endl; + #endif + + confl = (Clause*)&c; + qhead = trail.size(); + // Copy the remaining watches: + while (i < end) + *j++ = *i++; + } else { + #ifdef VERBOSE_DEBUG_XOR + printf("xor satisfied\n"); + #endif + + Lit tmp(c[0]); + c[0] = c[1]; + c[1] = tmp; + } + } +FoundWatch: + ; + } + ws.shrink_(i - j); + + return confl; +} + + +/*_________________________________________________________________________________________________ +| +| reduceDB : () -> [void] +| +| Description: +| Remove half of the learnt clauses, minus the clauses locked by the current assignment. Locked +| clauses are clauses that are reason to some assignment. Binary clauses are never removed. +|________________________________________________________________________________________________@*/ +bool reduceDB_ltMiniSat::operator () (const Clause* x, const Clause* y) { + const uint xsize = x->size(); + const uint ysize = y->size(); + + // First criteria + if (xsize > 2 && ysize == 2) return 1; + if (ysize > 2 && xsize == 2) return 0; + + if (x->oldActivity() == y->oldActivity()) + return xsize > ysize; + else return x->oldActivity() < y->oldActivity(); +} + +bool reduceDB_ltGlucose::operator () (const Clause* x, const Clause* y) { + const uint xsize = x->size(); + const uint ysize = y->size(); + + // First criteria + if (xsize > 2 && ysize == 2) return 1; + if (ysize > 2 && xsize == 2) return 0; + + if (x->activity() > y->activity()) return 1; + if (x->activity() < y->activity()) return 0; + return xsize > ysize; +} + +void Solver::reduceDB() +{ + uint32_t i, j; + + nbReduceDB++; + if (lastSelectedRestartType == dynamic_restart) + std::sort(learnts.getData(), learnts.getData()+learnts.size(), reduceDB_ltGlucose()); + else + std::sort(learnts.getData(), learnts.getData()+learnts.size(), reduceDB_ltMiniSat()); + + #ifdef VERBOSE_DEBUG + std::cout << "Cleaning clauses" << std::endl; + for (uint i = 0; i != learnts.size(); i++) { + std::cout << "activity:" << learnts[i]->activity() + << " \toldActivity:" << learnts[i]->oldActivity() + << " \tsize:" << learnts[i]->size() << std::endl; + } + #endif + + + const uint removeNum = (double)learnts.size() / (double)RATIOREMOVECLAUSES; + for (i = j = 0; i != removeNum; i++){ + //NOTE: The next instruciton only works if removeNum < learnts.size() (strictly smaller!!) + __builtin_prefetch(learnts[i+1], 0, 0); + if (learnts[i]->size() > 2 && !locked(*learnts[i]) && learnts[i]->activity() > 2) { + if (readdOldLearnts) { + detachClause(*learnts[i]); + removedLearnts.push(learnts[i]); + } else { + removeClause(*learnts[i]); + } + } else + learnts[j++] = learnts[i]; + } + for (; i < learnts.size(); i++) { + learnts[j++] = learnts[i]; + } + learnts.shrink(i - j); +} + +const vec& Solver::get_learnts() const +{ + return learnts; +} + +const vec& Solver::get_sorted_learnts() +{ + if (lastSelectedRestartType == dynamic_restart) + std::sort(learnts.getData(), learnts.getData()+learnts.size(), reduceDB_ltGlucose()); + else + std::sort(learnts.getData(), learnts.getData()+learnts.size(), reduceDB_ltMiniSat()); + return learnts; +} + +const vector Solver::get_unitary_learnts() const +{ + vector unitaries; + if (decisionLevel() > 0) { + for (uint32_t i = 0; i != trail_lim[0]; i++) { + unitaries.push_back(trail[i]); + } + } + + return unitaries; +} + +void Solver::dumpSortedLearnts(const char* file, const uint32_t maxSize) +{ + FILE* outfile = fopen(file, "w"); + if (!outfile) { + printf("Error: Cannot open file '%s' to write learnt clauses!\n", file); + exit(-1); + } + + fprintf(outfile, "c \nc ---------\n"); + fprintf(outfile, "c unitaries\n"); + fprintf(outfile, "c ---------\n"); + for (uint32_t i = 0, end = (trail_lim.size() > 0) ? trail_lim[0] : trail.size() ; i < end; i++) { + trail[i].printFull(outfile); + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + fprintf(outfile, "c name of var: %s\n", logger.get_var_name(trail[i].var()).c_str()); + #endif //STATS_NEEDED + } + + fprintf(outfile, "c conflicts %lu\n", (long unsigned int)conflicts); + + fprintf(outfile, "c \nc ---------------------------------\n"); + fprintf(outfile, "c learnt clauses from binaryClauses\n"); + fprintf(outfile, "c ---------------------------------\n"); + if (maxSize >= 2) { + for (uint i = 0; i != binaryClauses.size(); i++) { + if (binaryClauses[i]->learnt()) { + binaryClauses[i]->print(outfile); + } + } + } + + fprintf(outfile, "c \nc ---------------------------------------\n"); + fprintf(outfile, "c clauses representing 2-long XOR clauses\n"); + fprintf(outfile, "c ---------------------------------------\n"); + const vector& table = varReplacer->getReplaceTable(); + for (Var var = 0; var != table.size(); var++) { + Lit lit = table[var]; + if (lit.var() == var) + continue; + + fprintf(outfile, "%s%d %d 0\n", (!lit.sign() ? "-" : ""), lit.var()+1, var+1); + fprintf(outfile, "%s%d -%d 0\n", (lit.sign() ? "-" : ""), lit.var()+1, var+1); + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + fprintf(outfile, "c name of two vars that are anti/equivalent: '%s' and '%s'\n", logger.get_var_name(lit.var()).c_str(), logger.get_var_name(var).c_str()); + #endif //STATS_NEEDED + } + + fprintf(outfile, "c \nc --------------------n"); + fprintf(outfile, "c clauses from learnts\n"); + fprintf(outfile, "c --------------------n"); + if (lastSelectedRestartType == dynamic_restart) + std::sort(learnts.getData(), learnts.getData()+learnts.size(), reduceDB_ltGlucose()); + else + std::sort(learnts.getData(), learnts.getData()+learnts.size(), reduceDB_ltMiniSat()); + for (int i = learnts.size()-1; i >= 0 ; i--) { + if (learnts[i]->size() <= maxSize) { + learnts[i]->print(outfile); + } + } + + fclose(outfile); +} + +const uint32_t Solver::getNumElimSubsume() const +{ + return subsumer->getNumElimed(); +} + +const uint32_t Solver::getNumElimXorSubsume() const +{ + return xorSubsumer->getNumElimed(); +} + +const uint32_t Solver::getNumXorTrees() const +{ + return varReplacer->getNumTrees(); +} + +const uint32_t Solver::getNumXorTreesCrownSize() const +{ + return varReplacer->getNumReplacedVars(); +} + +const double Solver::getTotalTimeSubsumer() const +{ + return subsumer->getTotalTime(); +} + +const double Solver::getTotalTimeXorSubsumer() const +{ + return xorSubsumer->getTotalTime(); +} + + +void Solver::setMaxRestarts(const uint num) +{ + maxRestarts = num; +} + +inline int64_t abs64(int64_t a) +{ + if (a < 0) return -a; + return a; +} + +/*_________________________________________________________________________________________________ +| +| simplify : [void] -> [bool] +| +| Description: +| Simplify the clause database according to the current top-level assigment. Currently, the only +| thing done here is the removal of satisfied clauses, but more things can be put here. +|________________________________________________________________________________________________@*/ +const bool Solver::simplify() +{ + testAllClauseAttach(); + assert(decisionLevel() == 0); + + if (!ok || propagate() != NULL) { + ok = false; + return false; + } + + if (simpDB_props > 0) { + return true; + } + + double slowdown = (100000.0/(double)binaryClauses.size()); + slowdown = std::min(3.5, slowdown); + slowdown = std::max(0.2, slowdown); + + double speedup = 50000000.0/(double)(propagations-lastSearchForBinaryXor); + speedup = std::min(3.5, speedup); + speedup = std::max(0.2, speedup); + + /*std::cout << "new:" << nbBin - lastNbBin + becameBinary << std::endl; + std::cout << "left:" << ((double)(nbBin - lastNbBin + becameBinary)/BINARY_TO_XOR_APPROX) * slowdown << std::endl; + std::cout << "right:" << (double)order_heap.size() * PERCENTAGEPERFORMREPLACE * speedup << std::endl;*/ + + if (findBinaryXors && regularlyFindBinaryXors && + (((double)abs64((int64_t)nbBin - (int64_t)lastNbBin + (int64_t)becameBinary)/BINARY_TO_XOR_APPROX) * slowdown) > + ((double)order_heap.size() * PERCENTAGEPERFORMREPLACE * speedup)) { + lastSearchForBinaryXor = propagations; + + clauseCleaner->cleanClauses(clauses, ClauseCleaner::clauses); + clauseCleaner->cleanClauses(learnts, ClauseCleaner::learnts); + clauseCleaner->removeSatisfied(binaryClauses, ClauseCleaner::binaryClauses); + if (!ok) return false; + testAllClauseAttach(); + + XorFinder xorFinder(*this, binaryClauses, ClauseCleaner::binaryClauses); + if (!xorFinder.doNoPart(2, 2)) return false; + testAllClauseAttach(); + + lastNbBin = nbBin; + becameBinary = 0; + } + + // Remove satisfied clauses: + clauseCleaner->removeAndCleanAll(); + testAllClauseAttach(); + if (!ok) return false; + + if (performReplace && !varReplacer->performReplace()) + return false; + + // Remove fixed variables from the variable heap: + order_heap.filter(VarFilter(*this)); + + #ifdef USE_GAUSS + for (vector::iterator gauss = gauss_matrixes.begin(), end = gauss_matrixes.end(); gauss != end; gauss++) { + if (!(*gauss)->full_init()) return false; + } + #endif //USE_GAUSS + + simpDB_assigns = nAssigns(); + simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now) + + testAllClauseAttach(); + return true; +} + + +/*_________________________________________________________________________________________________ +| +| search : (nof_conflicts : int) (nof_learnts : int) (params : const SearchParams&) -> [lbool] +| +| Description: +| Search for a model the specified number of conflicts, keeping the number of learnt clauses +| below the provided limit. NOTE! Use negative value for 'nof_conflicts' or 'nof_learnts' to +| indicate infinity. +| +| Output: +| 'l_True' if a partial assigment that is consistent with respect to the clauseset is found. If +| all variables are decision variables, this means that the clause set is satisfiable. 'l_False' +| if the clause set is unsatisfiable. 'l_Undef' if the bound on number of conflicts is reached. +|________________________________________________________________________________________________@*/ +lbool Solver::search(int nof_conflicts, int nof_conflicts_fullrestart, const bool update) +{ + assert(ok); + int conflictC = 0; + vec learnt_clause; + llbool ret; + + starts++; + if (restartType == static_restart) + staticStarts++; + else + dynStarts++; + + #ifdef USE_GAUSS + for (vector::iterator gauss = gauss_matrixes.begin(), end = gauss_matrixes.end(); gauss != end; gauss++) { + if (!(*gauss)->full_init()) + return l_False; + } + #endif //USE_GAUSS + + testAllClauseAttach(); + findAllAttach(); + for (;;) { + Clause* confl = propagate(update); + + if (confl != NULL) { + ret = handle_conflict(learnt_clause, confl, conflictC, update); + if (ret != l_Nothing) return ret; + } else { + #ifdef USE_GAUSS + bool at_least_one_continue = false; + for (vector::iterator gauss = gauss_matrixes.begin(), end= gauss_matrixes.end(); gauss != end; gauss++) { + ret = (*gauss)->find_truths(learnt_clause, conflictC); + if (ret == l_Continue) at_least_one_continue = true; + else if (ret != l_Nothing) return ret; + } + if (at_least_one_continue) continue; + #endif //USE_GAUSS + ret = new_decision(nof_conflicts, nof_conflicts_fullrestart, conflictC); + if (ret != l_Nothing) return ret; + } + } +} + +llbool Solver::new_decision(const int& nof_conflicts, const int& nof_conflicts_fullrestart, int& conflictC) +{ + + // Reached bound on number of conflicts? + switch (restartType) { + case dynamic_restart: + if (nbDecisionLevelHistory.isvalid() && + ((nbDecisionLevelHistory.getavg()) > (totalSumOfDecisionLevel / (double)(conflicts - conflictsAtLastSolve)))) { + + #ifdef DEBUG_DYNAMIC_RESTART + if (nbDecisionLevelHistory.isvalid()) { + std::cout << "nbDecisionLevelHistory.getavg():" << nbDecisionLevelHistory.getavg() <= 0 && conflictC >= nof_conflicts) { + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + progress_estimate = progressEstimate(); + #endif + cancelUntil(0); + return l_Undef; + } + break; + case auto_restart: + assert(false); + break; + } + if (nof_conflicts_fullrestart >= 0 && (int)conflicts >= nof_conflicts_fullrestart) { + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + progress_estimate = progressEstimate(); + #endif + cancelUntil(0); + return l_Undef; + } + + // Simplify the set of problem clauses: + if (decisionLevel() == 0 && !simplify()) { + return l_False; + } + + // Reduce the set of learnt clauses: + if (conflicts >= curRestart * nbclausesbeforereduce + nbCompensateSubsumer) { + curRestart ++; + reduceDB(); + nbclausesbeforereduce += 500; + } + + Lit next = lit_Undef; + while (decisionLevel() < assumptions.size()) { + // Perform user provided assumption: + Lit p = assumptions[decisionLevel()]; + if (value(p) == l_True) { + // Dummy decision level: + newDecisionLevel(); + } else if (value(p) == l_False) { + analyzeFinal(~p, conflict); + return l_False; + } else { + next = p; + break; + } + } + + if (next == lit_Undef) { + // New variable decision: + decisions++; + next = pickBranchLit(); + + if (next == lit_Undef) + return l_True; + } + + // Increase decision level and enqueue 'next' + assert(value(next) == l_Undef); + newDecisionLevel(); + uncheckedEnqueue(next); + + return l_Nothing; +} + +llbool Solver::handle_conflict(vec& learnt_clause, Clause* confl, int& conflictC, const bool update) +{ + #ifdef VERBOSE_DEBUG + cout << "Handling conflict: "; + for (uint i = 0; i < learnt_clause.size(); i++) + cout << learnt_clause[i].var()+1 << ","; + cout << endl; + #endif + + int backtrack_level; + uint32_t nbLevels; + + conflicts++; + conflictC++; + if (decisionLevel() == 0) + return l_False; + learnt_clause.clear(); + Clause* c = analyze(confl, learnt_clause, backtrack_level, nbLevels, update); + if (update) { + #ifdef RANDOM_LOOKAROUND_SEARCHSPACE + avgBranchDepth.push(decisionLevel()); + #endif //RANDOM_LOOKAROUND_SEARCHSPACE + if (restartType == dynamic_restart) + nbDecisionLevelHistory.push(nbLevels); + + totalSumOfDecisionLevel += nbLevels; + } else { + conflictsAtLastSolve++; + } + + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + logger.conflict(Logger::simple_confl_type, backtrack_level, confl->getGroup(), learnt_clause); + #endif + cancelUntil(backtrack_level); + + #ifdef VERBOSE_DEBUG + cout << "Learning:"; + for (uint i = 0; i < learnt_clause.size(); i++) printLit(learnt_clause[i]), cout << " "; + cout << endl; + cout << "reverting var " << learnt_clause[0].var()+1 << " to " << !learnt_clause[0].sign() << endl; + #endif + + assert(value(learnt_clause[0]) == l_Undef); + //Unitary learnt + if (learnt_clause.size() == 1) { + uncheckedEnqueue(learnt_clause[0]); + assert(backtrack_level == 0 && "Unit clause learnt, so must cancel until level 0, right?"); + + #ifdef VERBOSE_DEBUG + cout << "Unit clause learnt." << endl; + #endif + //Normal learnt + } else { + if (c) { + detachClause(*c); + for (uint32_t i = 0; i != learnt_clause.size(); i++) + (*c)[i] = learnt_clause[i]; + c->resize(learnt_clause.size()); + if (c->learnt()) { + if (c->activity() > nbLevels) + c->setActivity(nbLevels); // LS + if (c->size() == 2) + nbBin++; + } + c->setStrenghtened(); + } else { + c = Clause_new(learnt_clause, learnt_clause_group++, true); + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) + logger.set_group_name(c->getGroup(), "learnt clause"); + #endif + if (c->size() > 2) { + learnts.push(c); + c->setActivity(nbLevels); // LS + } else { + binaryClauses.push(c); + nbBin++; + } + } + if (nbLevels <= 2) nbDL2++; + attachClause(*c); + uncheckedEnqueue(learnt_clause[0], c); + } + + varDecayActivity(); + if (update && restartType == static_restart) claDecayActivity(); + + return l_Nothing; +} + +double Solver::progressEstimate() const +{ + double progress = 0; + double F = 1.0 / nVars(); + + for (uint32_t i = 0; i <= decisionLevel(); i++) { + int beg = i == 0 ? 0 : trail_lim[i - 1]; + int end = i == decisionLevel() ? trail.size() : trail_lim[i]; + progress += pow(F, (int)i) * (end - beg); + } + + return progress / nVars(); +} + +#ifdef USE_GAUSS +void Solver::print_gauss_sum_stats() +{ + if (gauss_matrixes.size() == 0 && verbosity >= 2) { + printf(" no matrixes found |\n"); + return; + } + + uint called = 0; + uint useful_prop = 0; + uint useful_confl = 0; + uint disabled = 0; + for (vector::const_iterator gauss = gauss_matrixes.begin(), end= gauss_matrixes.end(); gauss != end; gauss++) { + disabled += (*gauss)->get_disabled(); + called += (*gauss)->get_called(); + useful_prop += (*gauss)->get_useful_prop(); + useful_confl += (*gauss)->get_useful_confl(); + sum_gauss_unit_truths += (*gauss)->get_unit_truths(); + //gauss->print_stats(); + //gauss->print_matrix_stats(); + } + sum_gauss_called += called; + sum_gauss_confl += useful_confl; + sum_gauss_prop += useful_prop; + + if (verbosity >= 2) { + if (called == 0) { + printf(" disabled |\n"); + } else { + printf(" %3.0lf%% |", (double)useful_prop/(double)called*100.0); + printf(" %3.0lf%% |", (double)useful_confl/(double)called*100.0); + printf(" %3.0lf%% |\n", 100.0-(double)disabled/(double)gauss_matrixes.size()*100.0); + } + } +} +#endif //USE_GAUSS + +const bool Solver::chooseRestartType(const uint& lastFullRestart) +{ + uint relativeStart = starts - lastFullRestart; + + if (relativeStart > RESTART_TYPE_DECIDER_FROM && relativeStart < RESTART_TYPE_DECIDER_UNTIL) { + if (fixRestartType == auto_restart) + restartTypeChooser->addInfo(); + + if (relativeStart == (RESTART_TYPE_DECIDER_UNTIL-1)) { + RestartType tmp; + if (fixRestartType == auto_restart) + tmp = restartTypeChooser->choose(); + else + tmp = fixRestartType; + + if (tmp == dynamic_restart) { + nbDecisionLevelHistory.fastclear(); + nbDecisionLevelHistory.initSize(100); + if (verbosity >= 2) + printf("c | Decided on dynamic restart strategy |\n"); + } else { + if (verbosity >= 2) + printf("c | Decided on static restart strategy |\n"); + + #ifdef USE_GAUSS + if (!matrixFinder->findMatrixes()) return false; + #endif //USE_GAUSS + } + lastSelectedRestartType = tmp; + restartType = tmp; + restartTypeChooser->reset(); + } + } + + return true; +} + +inline void Solver::setDefaultRestartType() +{ + if (fixRestartType != auto_restart) restartType = fixRestartType; + else restartType = static_restart; + + if (restartType == dynamic_restart) { + nbDecisionLevelHistory.fastclear(); + nbDecisionLevelHistory.initSize(100); + } + + lastSelectedRestartType = restartType; +} + +const lbool Solver::simplifyProblem(const uint32_t numConfls) +{ + testAllClauseAttach(); + #ifdef USE_GAUSS + bool gauss_was_cleared = (gauss_matrixes.size() == 0); + clearGaussMatrixes(); + #endif //USE_GAUSS + + StateSaver savedState(*this);; + + #ifdef BURST_SEARCH + if (verbosity >= 2) + std::cout << "c | " << std::setw(24) << " " + << "Simplifying problem for " << std::setw(8) << numConfls << " confls" + << std::setw(24) << " |" << std::endl; + random_var_freq = 1; + simplifying = true; + uint64_t origConflicts = conflicts; + #endif //BURST_SEARCH + + lbool status = l_Undef; + + #ifdef BURST_SEARCH + restartType = static_restart; + + while(status == l_Undef && conflicts-origConflicts < numConfls) { + printRestartStat(); + status = search(100, -1, false); + starts--; + } + if (status != l_Undef) + goto end; + printRestartStat(); + #endif //BURST_SEARCH + + if (doXorSubsumption && !xorSubsumer->simplifyBySubsumption()) { + status = l_False; + goto end; + } + testAllClauseAttach(); + + if (failedVarSearch && !failedVarSearcher->search((nClauses() < 500000 && order_heap.size() < 50000) ? 9000000 : 3000000)) { + status = l_False; + goto end; + } + testAllClauseAttach(); + + if (regularRemoveUselessBins + && !failedVarSearcher->removeUslessBinFull()) { + status = l_False; + goto end; + } + + if (regularSubsumeWithNonExistBinaries + && !subsumer->subsumeWithBinaries(false)) { + status = l_False; + goto end; + } + + if (doSubsumption && !subsumer->simplifyBySubsumption()) { + status = l_False; + goto end; + } + testAllClauseAttach(); + + /*if (findNormalXors && xorclauses.size() > 200 && clauses.size() < MAX_CLAUSENUM_XORFIND/8) { + XorFinder xorFinder(*this, clauses, ClauseCleaner::clauses); + if (!xorFinder.doNoPart(3, 7)) { + status = l_False; + goto end; + } + } else*/ if (xorclauses.size() <= 200 && xorclauses.size() > 0 && nClauses() > 10000) { + XorFinder x(*this, clauses, ClauseCleaner::clauses); + x.addAllXorAsNorm(); + } + +end: + #ifdef BURST_SEARCH + if (verbosity >= 2) + printf("c Simplifying finished |\n"); + #endif //#ifdef BURST_SEARCH + + + savedState.restore(); + simplifying = false; + + #ifdef USE_GAUSS + if (status == l_Undef && !gauss_was_cleared && !matrixFinder->findMatrixes()) + status = l_False; + #endif //USE_GAUSS + + testAllClauseAttach(); + return status; +} + +const bool Solver::checkFullRestart(int& nof_conflicts, int& nof_conflicts_fullrestart, uint& lastFullRestart) +{ + if (nof_conflicts_fullrestart > 0 && (int)conflicts >= nof_conflicts_fullrestart) { + #ifdef USE_GAUSS + clearGaussMatrixes(); + #endif //USE_GAUSS + if (verbosity >= 2) + printf("c | Fully restarting |\n"); + nof_conflicts = restart_first + (double)restart_first*restart_inc; + nof_conflicts_fullrestart = (double)nof_conflicts_fullrestart * FULLRESTART_MULTIPLIER_MULTIPLIER; + restartType = static_restart; + lastFullRestart = starts; + + /*if (findNormalXors && clauses.size() < MAX_CLAUSENUM_XORFIND) { + XorFinder xorFinder(this, clauses, ClauseCleaner::clauses); + if (!xorFinder.doNoPart(3, 10)) + return false; + }*/ + + if (doPartHandler && !partHandler->handle()) + return false; + + //calculateDefaultPolarities(); + + fullStarts++; + } + + return true; +} + +inline void Solver::performStepsBeforeSolve() +{ + assert(qhead == trail.size()); + testAllClauseAttach(); + + if (performReplace && !varReplacer->performReplace()) return; + + if (conflicts == 0 && learnts.size() == 0 + && noLearntBinaries()) { + if (subsumeWithNonExistBinaries && !subsumer->subsumeWithBinaries(true)) return; + if (removeUselessBins && !failedVarSearcher->removeUslessBinFull()) return; + } + + if(!ok) return; + + testAllClauseAttach(); + if (doSubsumption + && !libraryUsage + && clauses.size() + binaryClauses.size() + learnts.size() < 4800000 + && !subsumer->simplifyBySubsumption()) + return; + + if (conflicts == 0 && learnts.size() == 0 + && noLearntBinaries()) { + if (subsumeWithNonExistBinaries && !subsumer->subsumeWithBinaries(true)) return; + if (removeUselessBins && !failedVarSearcher->removeUslessBinFull()) return; + } + + if(!ok) return; + + testAllClauseAttach(); + if (findBinaryXors && binaryClauses.size() < MAX_CLAUSENUM_XORFIND) { + XorFinder xorFinder(*this, binaryClauses, ClauseCleaner::binaryClauses); + if (!xorFinder.doNoPart(2, 2)) return; + if (performReplace && !varReplacer->performReplace(true)) return; + } + + testAllClauseAttach(); + if (findNormalXors && clauses.size() < MAX_CLAUSENUM_XORFIND) { + XorFinder xorFinder(*this, clauses, ClauseCleaner::clauses); + if (!xorFinder.doNoPart(3, 7)) return; + } + + if (xorclauses.size() > 1) { + testAllClauseAttach(); + if (doXorSubsumption && !xorSubsumer->simplifyBySubsumption()) + return; + + testAllClauseAttach(); + if (performReplace && !varReplacer->performReplace()) + return; + } +} + +void Solver::checkSolution() +{ + // Extend & check: + model.growTo(nVars()); + for (Var var = 0; var != nVars(); var++) model[var] = value(var); + verifyModel(); + model.clear(); +} + +lbool Solver::solve(const vec& assumps) +{ +#ifdef VERBOSE_DEBUG + std::cout << "Solver::solve() called" << std::endl; +#endif + if (!ok) return l_False; + assert(qhead == trail.size()); + + if (libraryCNFFile) + fprintf(libraryCNFFile, "c Solver::solve() called\n"); + + model.clear(); + conflict.clear(); + #ifdef USE_GAUSS + clearGaussMatrixes(); + #endif //USE_GAUSS + setDefaultRestartType(); + totalSumOfDecisionLevel = 0; + conflictsAtLastSolve = conflicts; + #ifdef RANDOM_LOOKAROUND_SEARCHSPACE + avgBranchDepth.fastclear(); + avgBranchDepth.initSize(500); + #endif //RANDOM_LOOKAROUND_SEARCHSPACE + starts = 0; + + assumps.copyTo(assumptions); + if(assumptions.size()>0 && varReplacer->getNumLastReplacedVars()) + for (uint32_t i = 0; i != assumptions.size(); i++) + assumptions[i] = varReplacer->getReplaceTable()[assumptions[i].var()] ^ assumptions[i].sign(); + + int nof_conflicts = restart_first; + int nof_conflicts_fullrestart = restart_first * FULLRESTART_MULTIPLIER + conflicts; + //nof_conflicts_fullrestart = -1; + uint lastFullRestart = starts; + lbool status = l_Undef; + uint64_t nextSimplify = restart_first * SIMPLIFY_MULTIPLIER + conflicts; + + if (nClauses() * learntsize_factor < nbclausesbeforereduce) { + if (nClauses() * learntsize_factor < nbclausesbeforereduce/2) + nbclausesbeforereduce = nbclausesbeforereduce/4; + else + nbclausesbeforereduce = (nClauses() * learntsize_factor)/2; + } + testAllClauseAttach(); + findAllAttach(); + + if (conflicts == 0) { + performStepsBeforeSolve(); + if (!ok) return l_False; + + printStatHeader(); + } + + if(assumptions.size()>0 && + (varReplacer->getNumLastReplacedVars() || subsumer->getNumElimed() || xorSubsumer->getNumElimed())) { + for (uint32_t i = 0; i != assumptions.size(); i++) { + assumptions[i] = varReplacer->getReplaceTable()[assumptions[i].var()] ^ assumptions[i].sign(); + if (subsumer->getVarElimed()[assumptions[i].var()] && !subsumer->unEliminate(assumptions[i].var())) { + ok = false; + return l_False; + } + if (xorSubsumer->getVarElimed()[assumptions[i].var()] && !xorSubsumer->unEliminate(assumptions[i].var())) { + ok = false; + return l_False; + } + } + } + + calculateDefaultPolarities(); + + // Search: + while (status == l_Undef && starts < maxRestarts) { + #ifdef DEBUG_VARELIM + assert(subsumer->checkElimedUnassigned()); + assert(xorSubsumer->checkElimedUnassigned()); + #endif //DEBUG_VARELIM + + if (schedSimplification && conflicts >= nextSimplify) { + status = simplifyProblem(500); + nextSimplify = conflicts * 1.5; + if (status != l_Undef) break; + } + + printRestartStat(); + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) { + logger.end(Logger::restarting); + logger.begin(); + } + #endif + + status = search(nof_conflicts, nof_conflicts_fullrestart); + nof_conflicts = (double)nof_conflicts * restart_inc; + if (status != l_Undef) break; + if (!checkFullRestart(nof_conflicts, nof_conflicts_fullrestart, lastFullRestart)) + return l_False; + if (!chooseRestartType(lastFullRestart)) + return l_False; + #ifdef RANDOM_LOOKAROUND_SEARCHSPACE + //if (avgBranchDepth.isvalid()) + // std::cout << "avg branch depth:" << avgBranchDepth.getavg() << std::endl; + #endif //RANDOM_LOOKAROUND_SEARCHSPACE + } + printEndSearchStat(); + + #ifdef USE_GAUSS + for (uint i = 0; i < gauss_matrixes.size(); i++) + delete gauss_matrixes[i]; + gauss_matrixes.clear(); + #endif //USE_GAUSS + +#ifdef VERBOSE_DEBUG + if (status == l_True) + std::cout << "Solution is SAT" << std::endl; + else if (status == l_False) + std::cout << "Solution is UNSAT" << std::endl; + else + std::cout << "Solutions is UNKNOWN" << std::endl; +#endif //VERBOSE_DEBUG + + if (status == l_True) { + if (greedyUnbound) { + double time = cpuTime(); + FindUndef finder(*this); + const uint unbounded = finder.unRoll(); + if (verbosity >= 1) + printf("c Greedy unbounding :%5.2lf s, unbounded: %7d vars\n", cpuTime()-time, unbounded); + } + + partHandler->addSavedState(); + varReplacer->extendModelPossible(); +#ifndef NDEBUG + checkSolution(); +#endif + + if (subsumer->getNumElimed() || xorSubsumer->getNumElimed()) { +#ifdef VERBOSE_DEBUG + std::cout << "Solution needs extension. Extending." << std::endl; +#endif //VERBOSE_DEBUG + Solver s; + s.doSubsumption = false; + s.performReplace = false; + s.findBinaryXors = false; + s.findNormalXors = false; + s.failedVarSearch = false; + s.conglomerateXors = false; + s.greedyUnbound = greedyUnbound; + for (Var var = 0; var < nVars(); var++) { + s.newVar(decision_var[var] || subsumer->getVarElimed()[var] || varReplacer->varHasBeenReplaced(var) || xorSubsumer->getVarElimed()[var]); + + //assert(!(xorSubsumer->getVarElimed()[var] && (decision_var[var] || subsumer->getVarElimed()[var] || varReplacer->varHasBeenReplaced(var)))); + + if (value(var) != l_Undef) { + vec tmp; + tmp.push(Lit(var, value(var) == l_False)); + s.addClause(tmp); + } + } + varReplacer->extendModelImpossible(s); + subsumer->extendModel(s); + xorSubsumer->extendModel(s); + + status = s.solve(); + if (status != l_True) { + printf("c ERROR! Extension of model failed!\n"); + assert(status == l_True); + exit(-1); + } +#ifdef VERBOSE_DEBUG + std::cout << "Solution extending finished." << std::endl; +#endif + for (Var var = 0; var < nVars(); var++) { + if (assigns[var] == l_Undef && s.model[var] != l_Undef) uncheckedEnqueue(Lit(var, s.model[var] == l_False)); + } + ok = (propagate() == NULL); + if (!ok) { + printf("c ERROR! Extension of model failed!\n"); + assert(ok); + exit(-1); + } + } +#ifndef NDEBUG + checkSolution(); +#endif + //Copy model: + model.growTo(nVars()); + for (Var var = 0; var != nVars(); var++) model[var] = value(var); + } + + if (status == l_False) { + if (conflict.size() == 0) + ok = false; + } + + #ifdef STATS_NEEDED + if (dynamic_behaviour_analysis) { + if (status == l_True) + logger.end(Logger::model_found); + else if (status == l_False) + logger.end(Logger::unsat_model_found); + else if (status == l_Undef) + logger.end(Logger::restarting); + } + #endif + + #ifdef LS_STATS_NBBUMP + for(int i=0;isize(),learnts[i]->activity(), + (uint)learnts[i]->nbBump()); + #endif + + cancelUntil(0); + if (doPartHandler && status != l_False) partHandler->readdRemovedClauses(); + restartTypeChooser->reset(); + +#ifdef VERBOSE_DEBUG + std::cout << "Solver::solve() finished" << std::endl; +#endif + return status; +} + +//================================================================================================= +// Debug methods: + +bool Solver::verifyXorClauses(const vec& cs) const +{ + #ifdef VERBOSE_DEBUG + cout << "Checking xor-clauses whether they have been properly satisfied." << endl;; + #endif + + bool failed = false; + + for (uint32_t i = 0; i != xorclauses.size(); i++) { + XorClause& c = *xorclauses[i]; + bool final = c.xor_clause_inverted(); + + #ifdef VERBOSE_DEBUG + XorClause* c2 = XorClause_new(c, c.xor_clause_inverted(), c.getGroup()); + std::sort(c2->getData(), c2->getData()+ c2->size()); + c2->plainPrint(); + clauseFree(c2); + #endif + + for (uint j = 0; j < c.size(); j++) { + assert(modelValue(c[j].unsign()) != l_Undef); + final ^= (modelValue(c[j].unsign()) == l_True); + } + if (!final) { + printf("unsatisfied clause: "); + xorclauses[i]->plainPrint(); + failed = true; + } + } + + return failed; +} + +bool Solver::verifyClauses(const vec& cs) const +{ + #ifdef VERBOSE_DEBUG + cout << "Checking clauses whether they have been properly satisfied." << endl;; + #endif + + bool failed = false; + + for (uint32_t i = 0; i != cs.size(); i++) { + Clause& c = *cs[i]; + for (uint j = 0; j < c.size(); j++) + if (modelValue(c[j]) == l_True) + goto next; + + printf("unsatisfied clause: "); + cs[i]->plainPrint(); + failed = true; + next: + ; + } + + return failed; +} + +void Solver::verifyModel() +{ + assert(!verifyClauses(clauses)); + assert(!verifyClauses(binaryClauses)); + assert(!verifyXorClauses(xorclauses)); + + if (verbosity >=1) + printf("c Verified %d clauses.\n", clauses.size() + xorclauses.size()); +} + + +void Solver::checkLiteralCount() +{ + // Check that sizes are calculated correctly: + int cnt = 0; + for (uint32_t i = 0; i != clauses.size(); i++) + cnt += clauses[i]->size(); + + for (uint32_t i = 0; i != xorclauses.size(); i++) + cnt += xorclauses[i]->size(); + + if ((int)clauses_literals != cnt) { + fprintf(stderr, "literal count: %d, real value = %d\n", (int)clauses_literals, cnt); + assert((int)clauses_literals == cnt); + } +} + +void Solver::printStatHeader() const +{ + #ifdef STATS_NEEDED + if (verbosity >= 1 && !(dynamic_behaviour_analysis && logger.statistics_on)) { + #else + if (verbosity >= 1) { + #endif + printf("c ============================[ Search Statistics ]========================================\n"); + printf("c | Conflicts | ORIGINAL | LEARNT | GAUSS |\n"); + printf("c | | Vars Clauses Literals | Limit Clauses Lit/Cl | Prop Confl On |\n"); + printf("c =========================================================================================\n"); + } +} + +void Solver::printRestartStat() +{ + if (verbosity >= 2) { + printf("c | %9d | %7d %8d %8d | %8d %8d %6.0f |", (int)conflicts, (int)order_heap.size(), (int)(nClauses()-nbBin), (int)clauses_literals, (int)(nbclausesbeforereduce*curRestart+nbCompensateSubsumer), (int)(nLearnts()+nbBin), (double)learnts_literals/(double)(nLearnts()+nbBin)); + } + + #ifdef USE_GAUSS + print_gauss_sum_stats(); + #else //USE_GAUSS + if (verbosity >= 2) { + printf(" |\n"); + } + #endif //USE_GAUSS +} + +void Solver::printEndSearchStat() +{ + #ifdef STATS_NEEDED + if (verbosity >= 1 && !(dynamic_behaviour_analysis && logger.statistics_on)) { + #else + if (verbosity >= 1) { + #endif //STATS_NEEDED + printf("c ===================================================================="); + #ifdef USE_GAUSS + print_gauss_sum_stats(); + if (verbosity == 1) printf("=====================\n"); + #else //USE_GAUSS + printf("\n"); + #endif //USE_GAUSS + } +} + +#ifdef DEBUG_ATTACH +void Solver::testAllClauseAttach() const +{ + for (Clause *const*it = clauses.getData(), *const*end = clauses.getDataEnd(); it != end; it++) { + const Clause& c = **it; + if (c.size() > 2) { + assert(findWatchedCl(watches[(~c[0]).toInt()], &c)); + assert(findWatchedCl(watches[(~c[1]).toInt()], &c)); + } else { + assert(findWatchedBinCl(binwatches[(~c[0]).toInt()], &c)); + assert(findWatchedBinCl(binwatches[(~c[1]).toInt()], &c)); + } + } + + for (Clause *const*it = binaryClauses.getData(), *const*end = binaryClauses.getDataEnd(); it != end; it++) { + const Clause& c = **it; + assert(c.size() == 2); + assert(findWatchedBinCl(binwatches[(~c[0]).toInt()], &c)); + assert(findWatchedBinCl(binwatches[(~c[1]).toInt()], &c)); + } + + for (XorClause *const*it = xorclauses.getData(), *const*end = xorclauses.getDataEnd(); it != end; it++) { + const XorClause& c = **it; + assert(find(xorwatches[c[0].var()], &c)); + assert(find(xorwatches[c[1].var()], &c)); + if (assigns[c[0].var()]!=l_Undef || assigns[c[1].var()]!=l_Undef) { + for (uint i = 0; i < c.size();i++) { + assert(assigns[c[i].var()] != l_Undef); + } + } + } +} + +void Solver::findAllAttach() const +{ + for (uint32_t i = 0; i < binwatches.size(); i++) { + for (uint32_t i2 = 0; i2 < binwatches[i].size(); i2++) { + assert(findClause(binwatches[i][i2].clause)); + } + } + for (uint32_t i = 0; i < watches.size(); i++) { + for (uint32_t i2 = 0; i2 < watches[i].size(); i2++) { + assert(findClause(watches[i][i2].clause)); + } + } + + for (uint32_t i = 0; i < xorwatches.size(); i++) { + for (uint32_t i2 = 0; i2 < xorwatches[i].size(); i2++) { + assert(findClause(xorwatches[i][i2])); + } + } +} + +const bool Solver::findClause(XorClause* c) const +{ + for (uint32_t i = 0; i < xorclauses.size(); i++) { + if (xorclauses[i] == c) return true; + } + return false; +} + +const bool Solver::findClause(Clause* c) const +{ + for (uint32_t i = 0; i < binaryClauses.size(); i++) { + if (binaryClauses[i] == c) return true; + } + for (uint32_t i = 0; i < clauses.size(); i++) { + if (clauses[i] == c) return true; + } + for (uint32_t i = 0; i < learnts.size(); i++) { + if (learnts[i] == c) return true; + } + vec cs = varReplacer->getClauses(); + for (uint32_t i = 0; i < cs.size(); i++) { + if (cs[i] == c) return true; + } + + return false; +} +#endif //DEBUG_ATTACH + +const bool Solver::noLearntBinaries() const +{ + for (uint32_t i = 0; i < binaryClauses.size(); i++) { + if (binaryClauses[i]->learnt()) return false; + } + + return true; +} diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Solver.h b/packages/bee/cryptominisat-2.5.1/Solver/Solver.h new file mode 100755 index 000000000..114d28c4a --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Solver.h @@ -0,0 +1,740 @@ +/****************************************************************************************[Solver.h] +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +CryptoMiniSat -- Copyright (c) 2009 Mate Soos +glucose -- Gilles Audemard, Laurent Simon (2008) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef SOLVER_H +#define SOLVER_H + +#include +#include +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "Vec.h" +#include "Heap.h" +#include "Alg.h" +#include "MersenneTwister.h" +#include "SolverTypes.h" +#include "Clause.h" +#include "constants.h" +#include "BoundedQueue.h" + +#ifdef STATS_NEEDED +#include "Logger.h" +#endif //STATS_NEEDED + +#ifdef USE_GAUSS +#include "GaussianConfig.h" +#endif //USE_GAUSS + +#ifdef USE_GAUSS +class Gaussian; +class MatrixFinder; +#endif //USE_GAUSS +class Conglomerate; +class VarReplacer; +class XorFinder; +class FindUndef; +class ClauseCleaner; +class FailedVarSearcher; +class Subsumer; +class XorSubsumer; +class PartHandler; +class RestartTypeChooser; +class StateSaver; + +#ifdef VERBOSE_DEBUG +#define DEBUG_UNCHECKEDENQUEUE_LEVEL0 +using std::cout; +using std::endl; +#endif + +//================================================================================================= +// Solver -- the main class: + +struct reduceDB_ltMiniSat +{ + bool operator () (const Clause* x, const Clause* y); +}; + +struct reduceDB_ltGlucose +{ + bool operator () (const Clause* x, const Clause* y); +}; + + +class Solver +{ +public: + + // Constructor/Destructor: + // + Solver(); + ~Solver(); + + // Problem specification: + // + Var newVar (bool dvar = true); // Add a new variable with parameters specifying variable mode. + template + bool addClause (T& ps, const uint group = 0, char* group_name = NULL); // Add a clause to the solver. NOTE! 'ps' may be shrunk by this method! + template + bool addXorClause (T& ps, bool xor_clause_inverted, const uint group = 0, char* group_name = NULL); // Add a xor-clause to the solver. NOTE! 'ps' may be shrunk by this method! + + // Solving: + // + lbool solve (const vec& assumps); // Search for a model that respects a given set of assumptions. + lbool solve (); // Search without assumptions. + bool okay () const; // FALSE means solver is in a conflicting state + + // Variable mode: + // + void setPolarity (Var v, bool b); // Declare which polarity the decision heuristic should use for a variable. Requires mode 'polarity_user'. + void setDecisionVar (Var v, bool b); // Declare if a variable should be eligible for selection in the decision heuristic. + void setSeed (const uint32_t seed); // Sets the seed to be the given number + void setMaxRestarts(const uint num); //sets the maximum number of restarts to given value + + // Read state: + // + lbool value (const Var& x) const; // The current value of a variable. + lbool value (const Lit& p) const; // The current value of a literal. + lbool modelValue (const Lit& p) const; // The value of a literal in the last model. The last call to solve must have been satisfiable. + uint32_t nAssigns () const; // The current number of assigned literals. + uint32_t nClauses () const; // The current number of original clauses. + uint32_t nLiterals () const; // The current number of total literals. + uint32_t nLearnts () const; // The current number of learnt clauses. + uint32_t nVars () const; // The current number of variables. + + // Extra results: (read-only member variable) + // + vec model; // If problem is satisfiable, this vector contains the model (if any). + vec conflict; // If problem is unsatisfiable (possibly under assumptions), + // this vector represent the final conflict clause expressed in the assumptions. + + // Mode of operation: + // + double random_var_freq; // The frequency with which the decision heuristic tries to choose a random variable. (default 0.02) + double clause_decay; // Inverse of the clause activity decay factor. (1 / 0.999) + int restart_first; // The initial restart limit. (default 100) + double restart_inc; // The factor with which the restart limit is multiplied in each restart. (default 1.5) + double learntsize_factor; // The intitial limit for learnt clauses is a factor of the original clauses. (default 1 / 3) + double learntsize_inc; // The limit for learnt clauses is multiplied with this factor each restart. (default 1.1) + bool expensive_ccmin; // Controls conflict clause minimization. (default TRUE) + int polarity_mode; // Controls which polarity the decision heuristic chooses. See enum below for allowed modes. (default polarity_false) + int verbosity; // Verbosity level. 0=silent, 1=some progress report (default 0) + Var restrictedPickBranch; // Pick variables to branch on preferentally from the highest [0, restrictedPickBranch]. If set to 0, preferentiality is turned off (i.e. picked randomly between [0, all]) + bool findNormalXors; // Automatically find non-binary xor-clauses and convert them + bool findBinaryXors; // Automatically find binary xor-clauses and convert them + bool regularlyFindBinaryXors; // Regularly find binary xor-clauses and convert them + bool performReplace; // Should var-replacing be performed? + bool conglomerateXors; // Conglomerate XORs + bool heuleProcess; // Process XORs according to Heule + bool schedSimplification;// Schedule simplification + bool doSubsumption; // Should try to subsume clauses + bool doXorSubsumption; // Should try to subsume xor clauses + bool doPartHandler; // Should try to subsume clauses + bool doHyperBinRes; // Should try carry out hyper-binary resolution + bool doBlockedClause; // Should try to remove blocked clauses + bool doVarElim; // Perform variable elimination + bool doSubsume1; // Perform clause contraction through resolution + bool failedVarSearch; // Should search for failed vars and doulbly propagated vars + bool readdOldLearnts; // Should re-add old learnts for failed variable searching + bool addExtraBins; // Should add extra binaries in failed literal probing + bool removeUselessBins; // Should try to remove useless binary clauses + bool regularRemoveUselessBins; // Should try to remove useless binary clauses regularly + bool subsumeWithNonExistBinaries; + bool regularSubsumeWithNonExistBinaries; + bool libraryUsage; // Set true if not used as a library + friend class FindUndef; + bool greedyUnbound; //If set, then variables will be greedily unbounded (set to l_Undef) + RestartType fixRestartType; // If set, the solver will always choose the given restart strategy + #ifdef USE_GAUSS + GaussianConfig gaussconfig; + #endif //USE_GAUSS + + + enum { polarity_true = 0, polarity_false = 1, polarity_rnd = 3, polarity_auto = 4}; + + // Statistics: (read-only member variable) + // + uint64_t starts, dynStarts, staticStarts, fullStarts, decisions, rnd_decisions, propagations, conflicts; + uint64_t clauses_literals, learnts_literals, max_literals, tot_literals; + uint64_t nbDL2, nbBin, lastNbBin, becameBinary, lastSearchForBinaryXor, nbReduceDB; + uint64_t improvedClauseNo, improvedClauseSize; + + //Logging + void needStats(); // Prepares the solver to output statistics + void needProofGraph(); // Prepares the solver to output proof graphs during solving + void setVariableName(Var var, char* name); // Sets the name of the variable 'var' to 'name'. Useful for statistics and proof logs (i.e. used by 'logger') + const vec& get_sorted_learnts(); //return the set of learned clauses, sorted according to the logic used in MiniSat to distinguish between 'good' and 'bad' clauses + const vec& get_learnts() const; //Get all learnt clauses that are >1 long + const vector get_unitary_learnts() const; //return the set of unitary learnt clauses + const uint get_unitary_learnts_num() const; //return the number of unitary learnt clauses + void dumpSortedLearnts(const char* file, const uint32_t maxSize); // Dumps all learnt clauses (including unitary ones) into the file + void needLibraryCNFFile(const char* fileName); //creates file in current directory with the filename indicated, and puts all calls from the library into the file. + + #ifdef USE_GAUSS + const uint32_t get_sum_gauss_called() const; + const uint32_t get_sum_gauss_confl() const; + const uint32_t get_sum_gauss_prop() const; + const uint32_t get_sum_gauss_unit_truths() const; + #endif //USE_GAUSS + + //Printing statistics + const uint32_t getNumElimSubsume() const; // Get variable elimination stats from Subsumer + const uint32_t getNumElimXorSubsume() const; // Get variable elimination stats from XorSubsumer + const uint32_t getNumXorTrees() const; // Get the number of trees built from 2-long XOR-s. This is effectively the number of variables that replace other variables + const uint32_t getNumXorTreesCrownSize() const; // Get the number of variables being replaced by other variables + const double getTotalTimeSubsumer() const; + const double getTotalTimeXorSubsumer() const; + +protected: + #ifdef USE_GAUSS + void print_gauss_sum_stats(); + void clearGaussMatrixes(); + vector gauss_matrixes; + + //stats + uint32_t sum_gauss_called; + uint32_t sum_gauss_confl; + uint32_t sum_gauss_prop; + uint32_t sum_gauss_unit_truths; + friend class Gaussian; + #endif //USE_GAUSS + + template + Clause* addClauseInt(T& ps, uint group); + template + XorClause* addXorClauseInt(T& ps, bool xor_clause_inverted, const uint32_t group); + template + bool addLearntClause(T& ps, const uint group, const uint32_t activity); + template + void removeWatchedCl(vec &ws, const Clause *c); + template + bool findWatchedCl(const vec& ws, const Clause *c) const; + template + void removeWatchedBinCl(vec &ws, const Clause *c); + template + bool findWatchedBinCl(const vec& ws, const Clause *c) const; + + // Helper structures: + // + struct VarOrderLt { + const vec& activity; + bool operator () (Var x, Var y) const { + return activity[x] > activity[y]; + } + VarOrderLt(const vec& act) : activity(act) { } + }; + + friend class VarFilter; + struct VarFilter { + const Solver& s; + VarFilter(const Solver& _s) : s(_s) {} + bool operator()(Var v) const { + return s.assigns[v].isUndef() && s.decision_var[v]; + } + }; + + // Solver state: + // + bool ok; // If FALSE, the constraints are already unsatisfiable. No part of the solver state may be used! + vec clauses; // List of problem clauses. + vec binaryClauses; // Binary clauses are regularly moved here + vec xorclauses; // List of problem xor-clauses. Will be freed + vec learnts; // List of learnt clauses. + vec removedLearnts; // Clauses that have been learnt, then removed + vec freeLater; // xor clauses that need to be freed later due to Gauss + vec activity; // A heuristic measurement of the activity of a variable. + uint32_t var_inc; // Amount to bump next variable with. + double cla_inc; // Amount to bump learnt clause oldActivity with + vec > watches; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true). + vec > xorwatches; // 'xorwatches[var]' is a list of constraints watching var in XOR clauses. + vec > binwatches; + vec assigns; // The current assignments + vector polarity; // The preferred polarity of each variable. + #ifdef USE_OLD_POLARITIES + vector oldPolarity; // The polarity before the last setting. Good for unsetting polairties that have been changed since the last conflict + #endif //USE_OLD_POLARITIES + vector decision_var; // Declares if a variable is eligible for selection in the decision heuristic. + vec trail; // Assignment stack; stores all assigments made in the order they were made. + vec trail_lim; // Separator indices for different decision levels in 'trail'. + vec reason; // 'reason[var]' is the clause that implied the variables current value, or 'NULL' if none. + vec level; // 'level[var]' contains the level at which the assignment was made. + uint64_t curRestart; + uint32_t nbclausesbeforereduce; + uint32_t nbCompensateSubsumer; // Number of learnt clauses that subsumed normal clauses last time subs. was executed + uint32_t qhead; // Head of queue (as index into the trail -- no more explicit propagation queue in MiniSat). + uint32_t simpDB_assigns; // Number of top-level assignments since last execution of 'simplify()'. + int64_t simpDB_props; // Remaining number of propagations that must be made before next execution of 'simplify()'. + vec assumptions; // Current set of assumptions provided to solve by the user. + Heap order_heap; // A priority queue of variables ordered with respect to the variable activity. + double progress_estimate;// Set by 'search()'. + bool remove_satisfied; // Indicates whether possibly inefficient linear scan for satisfied clauses should be performed in 'simplify'. + bqueue nbDecisionLevelHistory; // Set of last decision level in conflict clauses + double totalSumOfDecisionLevel; + uint64_t conflictsAtLastSolve; + #ifdef RANDOM_LOOKAROUND_SEARCHSPACE + bqueue avgBranchDepth; // Avg branch depth + #endif //RANDOM_LOOKAROUND_SEARCHSPACE + MTRand mtrand; // random number generaton + RestartType restartType; // Used internally to determine which restart strategy to choose + RestartType lastSelectedRestartType; //the last selected restart type + friend class Logger; + #ifdef STATS_NEEDED + Logger logger; // dynamic logging, statistics + bool dynamic_behaviour_analysis; // Is logger running? + #endif + uint maxRestarts; // More than this number of restarts will not be performed + + // Temporaries (to reduce allocation overhead). Each variable is prefixed by the method in which it is + // used, exept 'seen' wich is used in several places. + // + vector seen; + vec analyze_stack; + vec analyze_toclear; + vec add_tmp; + + + uint64_t MYFLAG; + template + const uint32_t calcNBLevels(const T& ps); + vec permDiff; // LS: permDiff[var] contains the current conflict number... Used to count the number of different decision level variables in learnt clause + #ifdef UPDATEVARACTIVITY + vec lastDecisionLevel; + #endif + + //Logging + uint learnt_clause_group; //the group number of learnt clauses. Incremented at each added learnt clause + FILE *libraryCNFFile; //The file that all calls from the library are logged + + // Main internal methods: + // + const bool simplify (); // Removes already satisfied clauses. + //int nbPropagated (int level); + void insertVarOrder (Var x); // Insert a variable in the decision order priority queue. + Lit pickBranchLit (); // Return the next decision variable. + void newDecisionLevel (); // Begins a new decision level. + void uncheckedEnqueue (Lit p, ClausePtr from = (Clause*)NULL); // Enqueue a literal. Assumes value of literal is undefined. + void uncheckedEnqueueLight (const Lit p); + bool enqueue (Lit p, Clause* from = NULL); // Test if fact 'p' contradicts current state, enqueue otherwise. + Clause* propagate (const bool update = true); // Perform unit propagation. Returns possibly conflicting clause. + Clause* propagateLight(); + Clause* propagateBin(); + Clause* propagateBinNoLearnts(); + template + Clause* propagateBinExcept(const Lit& exceptLit); + template + Clause* propagateBinOneLevel(); + Clause* propagate_xors (const Lit& p); + void cancelUntil (int level); // Backtrack until a certain level. + Clause* analyze (Clause* confl, vec& out_learnt, int& out_btlevel, uint32_t &nblevels, const bool update); // (bt = backtrack) + void analyzeFinal (Lit p, vec& out_conflict); // COULD THIS BE IMPLEMENTED BY THE ORDINARIY "analyze" BY SOME REASONABLE GENERALIZATION? + bool litRedundant (Lit p, uint32_t abstract_levels); // (helper method for 'analyze()') + lbool search (int nof_conflicts, int nof_conflicts_fullrestart, const bool update = true); // Search for a given number of conflicts. + void reduceDB (); // Reduce the set of learnt clauses. + llbool handle_conflict (vec& learnt_clause, Clause* confl, int& conflictC, const bool update);// Handles the conflict clause + llbool new_decision (const int& nof_conflicts, const int& nof_conflicts_fullrestart, int& conflictC); // Handles the case when all propagations have been made, and now a decision must be made + + // Maintaining Variable/Clause activity: + // + void claBumpActivity (Clause& c); + void varDecayActivity (); // Decay all variables with the specified factor. Implemented by increasing the 'bump' value instead. + void varBumpActivity (Var v); // Increase a variable with the current 'bump' value. + void claDecayActivity (); // Decay all clauses with the specified factor. Implemented by increasing the 'bump' value instead. + + // Operations on clauses: + // + void attachClause (XorClause& c); + void attachClause (Clause& c); // Attach a clause to watcher lists. + void detachClause (const XorClause& c); + void detachClause (const Clause& c); // Detach a clause to watcher lists. + void detachModifiedClause(const Lit lit1, const Lit lit2, const uint size, const Clause* address); + void detachModifiedClause(const Var var1, const Var var2, const uint origSize, const XorClause* address); + template + void removeClause(T& c); // Detach and free a clause. + bool locked (const Clause& c) const; // Returns TRUE if a clause is a reason for some implication in the current state. + void reverse_binary_clause(Clause& c) const; // Binary clauses --- the first Lit has to be true + void testAllClauseAttach() const; + void findAllAttach() const; + const bool findClause(XorClause* c) const; + const bool findClause(Clause* c) const; + + // Misc: + // + uint32_t decisionLevel () const; // Gives the current decisionlevel. + uint32_t abstractLevel (const Var& x) const; // Used to represent an abstraction of sets of decision levels. + + //Xor-finding related stuff + friend class XorFinder; + friend class Conglomerate; + friend class MatrixFinder; + friend class PartFinder; + friend class VarReplacer; + friend class ClauseCleaner; + friend class RestartTypeChooser; + friend class FailedVarSearcher; + friend class Subsumer; + friend class XorSubsumer; + friend class PartHandler; + friend class StateSaver; + Conglomerate* conglomerate; + VarReplacer* varReplacer; + ClauseCleaner* clauseCleaner; + FailedVarSearcher* failedVarSearcher; + PartHandler* partHandler; + Subsumer* subsumer; + XorSubsumer* xorSubsumer; + RestartTypeChooser* restartTypeChooser; + MatrixFinder* matrixFinder; + const bool chooseRestartType(const uint& lastFullRestart); + void setDefaultRestartType(); + const bool checkFullRestart(int& nof_conflicts, int& nof_conflicts_fullrestart, uint& lastFullRestart); + void performStepsBeforeSolve(); + const lbool simplifyProblem(const uint32_t numConfls); + bool simplifying; + + // Debug & etc: + void printLit (const Lit l) const; + void verifyModel (); + bool verifyClauses (const vec& cs) const; + bool verifyXorClauses (const vec& cs) const; + void checkSolution(); + void checkLiteralCount(); + void printStatHeader () const; + void printRestartStat (); + void printEndSearchStat(); + double progressEstimate () const; // DELETE THIS ?? IT'S NOT VERY USEFUL ... + const bool noLearntBinaries() const; + + // Polarity chooser + void calculateDefaultPolarities(); //Calculates the default polarity for each var, and fills defaultPolarities[] with it + bool defaultPolarity(); //if polarity_mode is not polarity_auto, this returns the default polarity of the variable + void tallyVotes(const vec& cs, vector& votes) const; + void tallyVotes(const vec& cs, vector& votes) const; +}; + + +//================================================================================================= +// Implementation of inline methods: + + +inline void Solver::insertVarOrder(Var x) +{ + if (!order_heap.inHeap(x) && decision_var[x]) order_heap.insert(x); +} + +inline void Solver::varDecayActivity() +{ + var_inc *= 11; + var_inc /= 10; +} +inline void Solver::varBumpActivity(Var v) +{ + if ( (activity[v] += var_inc) > (0x1U) << 24 ) { + //printf("RESCALE!!!!!!\n"); + //std::cout << "var_inc: " << var_inc << std::endl; + // Rescale: + for (Var var = 0; var != nVars(); var++) { + activity[var] >>= 14; + } + var_inc >>= 14; + //var_inc = 1; + //std::cout << "var_inc: " << var_inc << std::endl; + + /*Heap copy_order_heap2(order_heap); + while(!copy_order_heap2.empty()) { + Var v = copy_order_heap2.getmin(); + if (decision_var[v]) + std::cout << "var_" << v+1 << " act: " << activity[v] << std::endl; + }*/ + } + + // Update order_heap with respect to new activity: + if (order_heap.inHeap(v)) + order_heap.decrease(v); +} + +inline void Solver::claBumpActivity (Clause& c) +{ + if ( (c.oldActivity() += cla_inc) > 1e20 ) { + // Rescale: + for (uint32_t i = 0; i < learnts.size(); i++) + learnts[i]->oldActivity() *= 1e-17; + cla_inc *= 1e-20; + } +} + +inline void Solver::claDecayActivity() +{ + //cla_inc *= clause_decay; +} + +inline bool Solver::enqueue (Lit p, Clause* from) +{ + return value(p) != l_Undef ? value(p) != l_False : (uncheckedEnqueue(p, from), true); +} +inline bool Solver::locked (const Clause& c) const +{ + return reason[c[0].var()] == &c && value(c[0]) == l_True; +} +inline void Solver::newDecisionLevel() +{ + trail_lim.push(trail.size()); + #ifdef VERBOSE_DEBUG + cout << "New decision level: " << trail_lim.size() << endl; + #endif +} +/*inline int Solver::nbPropagated(int level) { + if (level == decisionLevel()) + return trail.size() - trail_lim[level-1] - 1; + return trail_lim[level] - trail_lim[level-1] - 1; +}*/ +inline uint32_t Solver::decisionLevel () const +{ + return trail_lim.size(); +} +inline uint32_t Solver::abstractLevel (const Var& x) const +{ + return 1 << (level[x] & 31); +} +inline lbool Solver::value (const Var& x) const +{ + return assigns[x]; +} +inline lbool Solver::value (const Lit& p) const +{ + return assigns[p.var()] ^ p.sign(); +} +inline lbool Solver::modelValue (const Lit& p) const +{ + return model[p.var()] ^ p.sign(); +} +inline uint32_t Solver::nAssigns () const +{ + return trail.size(); +} +inline uint32_t Solver::nClauses () const +{ + return clauses.size() + xorclauses.size()+binaryClauses.size(); +} +inline uint32_t Solver::nLiterals () const +{ + return clauses_literals + learnts_literals; +} +inline uint32_t Solver::nLearnts () const +{ + return learnts.size(); +} +inline uint32_t Solver::nVars () const +{ + return assigns.size(); +} +inline void Solver::setPolarity (Var v, bool b) +{ + polarity [v] = (char)b; +} +inline void Solver::setDecisionVar(Var v, bool b) +{ + decision_var[v] = b; + if (b) { + insertVarOrder(v); + } +} +inline lbool Solver::solve () +{ + vec tmp; + return solve(tmp); +} +inline bool Solver::okay () const +{ + return ok; +} +inline void Solver::setSeed (const uint32_t seed) +{ + mtrand.seed(seed); // Set seed of the variable-selection and clause-permutation(if applicable) +} +#ifdef STATS_NEEDED +inline void Solver::needStats() +{ + dynamic_behaviour_analysis = true; // Sets the solver and the logger up to generate statistics + logger.statistics_on = true; +} +inline void Solver::needProofGraph() +{ + dynamic_behaviour_analysis = true; // Sets the solver and the logger up to generate proof graphs during solving + logger.proof_graph_on = true; +} +inline void Solver::setVariableName(Var var, char* name) +{ + while (var >= nVars()) newVar(); + if (dynamic_behaviour_analysis) + logger.set_variable_name(var, name); +} // Sets the varible 'var'-s name to 'name' in the logger +#else +inline void Solver::setVariableName(Var var, char* name) +{} +#endif + +#ifdef USE_GAUSS +inline const uint32_t Solver::get_sum_gauss_unit_truths() const +{ + return sum_gauss_unit_truths; +} + +inline const uint32_t Solver::get_sum_gauss_called() const +{ + return sum_gauss_called; +} + +inline const uint32_t Solver::get_sum_gauss_confl() const +{ + return sum_gauss_confl; +} + +inline const uint32_t Solver::get_sum_gauss_prop() const +{ + return sum_gauss_prop; +} +#endif + +inline const uint Solver::get_unitary_learnts_num() const +{ + if (decisionLevel() > 0) + return trail_lim[0]; + else + return trail.size(); +} +template +inline void Solver::removeWatchedCl(vec &ws, const Clause *c) { + uint32_t j = 0; + for (; j < ws.size() && ws[j].clause != c; j++); + assert(j < ws.size()); + for (; j < ws.size()-1; j++) ws[j] = ws[j+1]; + ws.pop(); +} +template +inline void Solver::removeWatchedBinCl(vec &ws, const Clause *c) { + uint32_t j = 0; + for (; j < ws.size() && ws[j].clause != c; j++); + assert(j < ws.size()); + for (; j < ws.size()-1; j++) ws[j] = ws[j+1]; + ws.pop(); +} +template +inline bool Solver::findWatchedCl(const vec& ws, const Clause *c) const +{ + uint32_t j = 0; + for (; j < ws.size() && ws[j].clause != c; j++); + return j < ws.size(); +} +template +inline bool Solver::findWatchedBinCl(const vec& ws, const Clause *c) const +{ + uint32_t j = 0; + for (; j < ws.size() && ws[j].clause != c; j++); + return j < ws.size(); +} +inline void Solver::reverse_binary_clause(Clause& c) const { + if (c.size() == 2 && value(c[0]) == l_False) { + assert(value(c[1]) == l_True); + std::swap(c[0], c[1]); + } +} +/*inline void Solver::calculate_xor_clause(Clause& c2) const { + if (c2.isXor() && ((XorClause*)&c2)->updateNeeded()) { + XorClause& c = *((XorClause*)&c2); + bool final = c.xor_clause_inverted(); + for (int k = 0, size = c.size(); k != size; k++ ) { + const lbool& val = assigns[c[k].var()]; + assert(val != l_Undef); + + c[k] = c[k].unsign() ^ val.getBool(); + final ^= val.getBool(); + } + if (final) + c[0] = c[0].unsign() ^ !assigns[c[0].var()].getBool(); + + c.setUpdateNeeded(false); + } +}*/ + +template +inline void Solver::removeClause(T& c) +{ + detachClause(c); + clauseFree(&c); +} + +//================================================================================================= +// Debug + etc: + +static inline void logLit(FILE* f, Lit l) +{ + fprintf(f, "%sx%d", l.sign() ? "~" : "", l.var()+1); +} + +static inline void logLits(FILE* f, const vec& ls) +{ + fprintf(f, "[ "); + if (ls.size() > 0) { + logLit(f, ls[0]); + for (uint32_t i = 1; i < ls.size(); i++) { + fprintf(f, ", "); + logLit(f, ls[i]); + } + } + fprintf(f, "] "); +} + +static inline const char* showBool(bool b) +{ + return b ? "true" : "false"; +} + + +// Just like 'assert()' but expression will be evaluated in the release version as well. +static inline void check(bool expr) +{ + assert(expr); +} + +#ifndef DEBUG_ATTACH +inline void Solver::testAllClauseAttach() const +{ + return; +} +inline void Solver::findAllAttach() const +{ + return; +} +#endif //DEBUG_ATTACH + +inline void Solver::uncheckedEnqueueLight(const Lit p) +{ + assigns [p.var()] = boolToLBool(!p.sign());//lbool(!sign(p)); // <<== abstract but not uttermost effecient + trail.push(p); +} + +//================================================================================================= +#endif //SOLVER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/SolverTypes.h b/packages/bee/cryptominisat-2.5.1/Solver/SolverTypes.h new file mode 100755 index 000000000..88e91339f --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/SolverTypes.h @@ -0,0 +1,179 @@ +/***********************************************************************************[SolverTypes.h] +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef SOLVERTYPES_H +#define SOLVERTYPES_H + +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include "Alg.h" +#include + +//================================================================================================= +// Variables, literals, lifted booleans, clauses: + + +// NOTE! Variables are just integers. No abstraction here. They should be chosen from 0..N, +// so that they can be used as array indices. + +typedef uint32_t Var; +#define var_Undef (0xffffffffU >>1) +enum RestartType {dynamic_restart, static_restart, auto_restart}; + +class Lit +{ + uint32_t x; + explicit Lit(uint32_t i) : x(i) { }; +public: + Lit() : x(2*var_Undef) {} // (lit_Undef) + explicit Lit(Var var, bool sign) : x((var+var) + (int)sign) { } + + const uint32_t& toInt() const { // Guarantees small, positive integers suitable for array indexing. + return x; + } + Lit operator~() const { + return Lit(x ^ 1); + } + Lit operator^(const bool b) const { + return Lit(x ^ (uint32_t)b); + } + Lit& operator^=(const bool b) { + x ^= (uint32_t)b; + return *this; + } + bool sign() const { + return x & 1; + } + Var var() const { + return x >> 1; + } + Lit unsign() const { + return Lit(x & ~1); + } + bool operator==(const Lit& p) const { + return x == p.x; + } + bool operator!= (const Lit& p) const { + return x != p.x; + } + bool operator < (const Lit& p) const { + return x < p.x; // '<' guarantees that p, ~p are adjacent in the ordering. + } + inline void print(FILE* outfile = stdout) const + { + fprintf(outfile,"%s%d", sign() ? "-" : "", var()+1); + } + inline void printFull(FILE* outfile = stdout) const + { + fprintf(outfile,"%s%d 0\n", sign() ? "-" : "", var()+1); + } +}; + +const Lit lit_Undef(var_Undef, false); // Useful special constants. +const Lit lit_Error(var_Undef, true ); // + +//================================================================================================= +// Lifted booleans: + +class llbool; + +class lbool +{ + char value; + explicit lbool(char v) : value(v) { } + +public: + lbool() : value(0) { }; + inline char getchar() const { + return value; + } + inline lbool(llbool b); + + inline const bool isUndef() const { + return !value; + } + inline const bool isDef() const { + return value; + } + inline const bool getBool() const { + return value == 1; + } + inline const bool operator==(lbool b) const { + return value == b.value; + } + inline const bool operator!=(lbool b) const { + return value != b.value; + } + lbool operator^(const bool b) const { + return b ? lbool(-value) : lbool(value); + } + //lbool operator ^ (const bool b) const { return b ? lbool(-value) : lbool(value); } + + friend lbool toLbool(const char v); + friend lbool boolToLBool(const bool b); + friend class llbool; +}; +inline lbool toLbool(const char v) +{ + return lbool(v); +} +inline lbool boolToLBool(const bool b) +{ + return lbool(2*b-1); +} + +const lbool l_True = toLbool( 1); +const lbool l_False = toLbool(-1); +const lbool l_Undef = toLbool( 0); + + +class llbool +{ + char value; + +public: + llbool(): value(0) {}; + llbool(lbool v) : + value(v.value) {}; + llbool(char a) : + value(a) {} + + inline const bool operator!=(const llbool& v) const { + return (v.value != value); + } + + inline const bool operator==(const llbool& v) const { + return (v.value == value); + } + + friend class lbool; +}; +const llbool l_Nothing = toLbool(2); +const llbool l_Continue = toLbool(3); + +lbool::lbool(llbool b) : value(b.value) {}; + +#endif //SOLVERTYPES_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/StateSaver.cpp b/packages/bee/cryptominisat-2.5.1/Solver/StateSaver.cpp new file mode 100755 index 000000000..eb2229f20 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/StateSaver.cpp @@ -0,0 +1,48 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "StateSaver.h" + +StateSaver::StateSaver(Solver& _solver) : + solver(_solver) + , backup_order_heap(Solver::VarOrderLt(solver.activity)) +{ + //Saving Solver state + backup_var_inc = solver.var_inc; + backup_activity.growTo(solver.activity.size()); + std::copy(solver.activity.getData(), solver.activity.getDataEnd(), backup_activity.getData()); + backup_order_heap = solver.order_heap; + backup_polarities = solver.polarity; + backup_restartType = solver.restartType; + backup_random_var_freq = solver.random_var_freq; + backup_propagations = solver.propagations; +} + +void StateSaver::restore() +{ + //Restore Solver state + solver.var_inc = backup_var_inc; + std::copy(backup_activity.getData(), backup_activity.getDataEnd(), solver.activity.getData()); + solver.order_heap = backup_order_heap; + solver.polarity = backup_polarities; + solver.restartType = backup_restartType; + solver.random_var_freq = backup_random_var_freq; + + //Finally, clear the order_heap from variables set/non-decisionned + solver.order_heap.filter(Solver::VarFilter(solver)); + solver.propagations = backup_propagations; +} diff --git a/packages/bee/cryptominisat-2.5.1/Solver/StateSaver.h b/packages/bee/cryptominisat-2.5.1/Solver/StateSaver.h new file mode 100755 index 000000000..120388a96 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/StateSaver.h @@ -0,0 +1,40 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef STATESAVER__H +#define STATESAVER__H + +#include "Solver.h" + +class StateSaver +{ + public: + StateSaver(Solver& _solver); + void restore(); + + private: + Solver& solver; + Heap backup_order_heap; + vector backup_polarities; + vec backup_activity; + uint32_t backup_var_inc; + RestartType backup_restartType; + uint32_t backup_random_var_freq; + uint64_t backup_propagations; +}; + +#endif //STATESAVER__H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Subsumer.cpp b/packages/bee/cryptominisat-2.5.1/Solver/Subsumer.cpp new file mode 100755 index 000000000..890a17187 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Subsumer.cpp @@ -0,0 +1,2221 @@ +/************************************************************************************************** +Originally From: Solver.C -- (C) Niklas Een, Niklas Sorensson, 2004 +Substantially modified by: Mate Soos (2010) +**************************************************************************************************/ + +#include "Solver.h" +#include "Subsumer.h" +#include "ClauseCleaner.h" +#include "time_mem.h" +#include "assert.h" +#include +#include +#include +#include "VarReplacer.h" +#include "XorFinder.h" + +#ifdef _MSC_VER +#define __builtin_prefetch(a,b,c) +#endif //_MSC_VER + +//#define VERBOSE_DEBUG +#ifdef VERBOSE_DEBUG +#define BIT_MORE_VERBOSITY +#endif + +//#define BIT_MORE_VERBOSITY +//#define HYPER_DEBUG +//#define HYPER_DEBUG2 +//#define TOUCH_LESS + +#ifdef VERBOSE_DEBUG +using std::cout; +using std::endl; +#endif //VERBOSE_DEBUG + +Subsumer::Subsumer(Solver& s): + solver(s) + , totalTime(0.0) + , numElimed(0) + , numCalls(0) +{ +}; + +Subsumer::~Subsumer() +{ +} + +void Subsumer::extendModel(Solver& solver2) +{ + assert(checkElimedUnassigned()); + vec tmp; + typedef map > elimType; + for (elimType::iterator it = elimedOutVar.begin(), end = elimedOutVar.end(); it != end; it++) { + #ifndef NDEBUG + Var var = it->first; + #ifdef VERBOSE_DEBUG + std::cout << "Reinserting elimed var: " << var+1 << std::endl; + #endif + assert(!solver.decision_var[var]); + assert(solver.assigns[var] == l_Undef); + assert(!solver.order_heap.inHeap(var)); + #endif + + for (vector::iterator it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; it2++) { + Clause& c = **it2; + tmp.clear(); + tmp.growTo(c.size()); + std::copy(c.getData(), c.getDataEnd(), tmp.getData()); + + #ifdef VERBOSE_DEBUG + std::cout << "Reinserting Clause: "; + c.plainPrint(); + #endif + + solver2.addClause(tmp); + assert(solver2.ok); + } + } +} + +const bool Subsumer::unEliminate(const Var var) +{ + assert(var_elimed[var]); + vec tmp; + typedef map > elimType; + elimType::iterator it = elimedOutVar.find(var); + + //it MUST have been decision var, otherwise we would + //never have removed it + solver.setDecisionVar(var, true); + var_elimed[var] = false; + numElimed--; + + //If the variable was removed because of + //pure literal removal (by blocked clause + //elimination, there are no clauses to re-insert + if (it == elimedOutVar.end()) return solver.ok; + + FILE* backup_libraryCNFfile = solver.libraryCNFFile; + solver.libraryCNFFile = NULL; + for (vector::iterator it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; it2++) { + solver.addClause(**it2); + clauseFree(*it2); + } + solver.libraryCNFFile = backup_libraryCNFfile; + elimedOutVar.erase(it); + + return solver.ok; +} + +bool selfSubset(uint32_t A, uint32_t B) +{ + uint32_t B_tmp = B | ((B & 0xAAAAAAAALL) >> 1) | ((B & 0x55555555LL) << 1); + if ((A & ~B_tmp) == 0){ + uint32_t C = A & ~B; + return (C & (C-1)) == 0; + }else + return false; +} + +// Assumes 'seen' is cleared (will leave it cleared) +bool selfSubset(Clause& A, Clause& B, vec& seen) +{ + for (uint32_t i = 0; i < B.size(); i++) + seen[B[i].toInt()] = 1; + + bool flip = false; + for (uint32_t i = 0; i < A.size(); i++) { + if (!seen[A[i].toInt()]) { + if (flip == true || !seen[(~A[i]).toInt()]) { + for (uint32_t i = 0; i < B.size(); i++) seen[B[i].toInt()] = 0; + return false; + } + flip = true; + } + } + for (uint32_t i = 0; i < B.size(); i++) + seen[B[i].toInt()] = 0; + return flip; +} + +template <> +inline uint32_t Subsumer::subsume0(Clause& ps, uint32_t abs) +{ + ps.subsume0Finished(); + ps.unsetVarChanged(); + #ifdef VERBOSE_DEBUG + cout << "subsume0 orig clause: "; + ps.plainPrint(); + #endif + return subsume0Orig(ps, abs); +} + +template +inline uint32_t Subsumer::subsume0(T& ps, uint32_t abs) +{ + #ifdef VERBOSE_DEBUG + cout << "subsume0 orig vec: "; + ps[0].print(); std::cout << " "; + ps[1].printFull(); + #endif + return subsume0Orig(ps, abs); +} + +// Will put NULL in 'cs' if clause removed. +template +uint32_t Subsumer::subsume0Orig(const T& ps, uint32_t abs) +{ + uint32_t retIndex = std::numeric_limits::max(); + vec subs; + findSubsumed(ps, abs, subs); + for (uint32_t i = 0; i < subs.size(); i++){ + clauses_subsumed++; + #ifdef VERBOSE_DEBUG + cout << "-> subsume0 removing:"; + subs[i].clause->plainPrint(); + #endif + + Clause* tmp = subs[i].clause; + retIndex = subs[i].index; + unlinkClause(subs[i]); + clauseFree(tmp); + } + + return retIndex; +} + +void Subsumer::subsume0BIN(const Lit lit1, const vec& lits) +{ + vec subs; + vec subs2; + vec subs2Lit; + + vec& cs = occur[lit1.toInt()]; + for (ClauseSimp *it = cs.getData(), *end = it + cs.size(); it != end; it++){ + if (it+1 != end) + __builtin_prefetch((it+1)->clause, 0, 1); + if (it->clause == NULL) continue; + Clause& c = *it->clause; + bool removed = false; + for (uint32_t i = 0; i < c.size(); i++) { + if (lits[c[i].toInt()]) { + subs.push(*it); + removed = true; + break; + } + } + if (!removed) { + for (uint32_t i = 0; i < c.size(); i++) { + if (lits[(~c[i]).toInt()]) { + subs2.push(*it); + subs2Lit.push(c[i]); + break; + } + } + } + } + + for (uint32_t i = 0; i < subs.size(); i++){ + clauses_subsumed++; + #ifdef VERBOSE_DEBUG + cout << "-> subsume0 removing:"; + subs[i].clause->plainPrint(); + #endif + + Clause* tmp = subs[i].clause; + unlinkClause(subs[i]); + clauseFree(tmp); + } + + if (subs2.size() == 0) return; + registerIteration(subs2); + for (uint32_t j = 0; j < subs2.size(); j++){ + if (subs2[j].clause == NULL) continue; + ClauseSimp c = subs2[j]; + Clause& cl = *c.clause; + #ifdef VERBOSE_DEBUG + cout << "-> Strenghtening clause :"; + cl.plainPrint(); + #endif + unlinkClause(c); + + literals_removed++; + cl.strengthen(subs2Lit[j]); + Lit *a, *b, *end; + for (a = b = cl.getData(), end = a + cl.size(); a != end; a++) { + lbool val = solver.value(*a); + if (val == l_Undef) + *b++ = *a; + + if (val == l_True) { + #ifdef VERBOSE_DEBUG + std::cout << "--> Clause was satisfied." << std::endl; + #endif + clauseFree(&cl); + goto endS; + } + } + cl.shrink(a-b); + cl.setStrenghtened(); + + #ifdef VERBOSE_DEBUG + cout << "--> Strenghtened clause:"; + cl.plainPrint(); + #endif + + if (cl.size() == 0) { + solver.ok = false; + unregisterIteration(subs2); + clauseFree(&cl); + return; + } + if (cl.size() > 2) { + cl.calcAbstraction(); + linkInAlreadyClause(c); + clauses[c.index] = c; + solver.attachClause(cl); + updateClause(c); + } else if (cl.size() == 2) { + cl.calcAbstraction(); + solver.attachClause(cl); + solver.becameBinary++; + addBinaryClauses.push(&cl); + //updateClause(c); + } else { + assert(cl.size() == 1); + solver.uncheckedEnqueue(cl[0]); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) { + unregisterIteration(subs2); + return; + } + #ifdef VERBOSE_DEBUG + cout << "--> Found that var " << cl[0].var()+1 << " must be " << std::boolalpha << !cl[0].sign() << endl; + #endif + clauseFree(&cl); + } + endS:; + } + unregisterIteration(subs2); +} + +void Subsumer::unlinkClause(ClauseSimp c, Var elim) +{ + Clause& cl = *c.clause; + + if (elim != var_Undef) { + assert(!cl.learnt()); + #ifdef VERBOSE_DEBUG + std::cout << "Eliminating clause: "; c.clause->plainPrint(); + std::cout << "On variable: " << elim+1 << std::endl; + #endif //VERBOSE_DEBUG + elimedOutVar[elim].push_back(c.clause); + } + + for (uint32_t i = 0; i < cl.size(); i++) { + maybeRemove(occur[cl[i].toInt()], &cl); + #ifndef TOUCH_LESS + touch(cl[i]); + #endif + } + + solver.detachClause(cl); + + // Remove from iterator vectors/sets: + for (uint32_t i = 0; i < iter_vecs.size(); i++) { + vec& cs = *iter_vecs[i]; + for (uint32_t j = 0; j < cs.size(); j++) + if (cs[j].clause == &cl) + cs[j].clause = NULL; + } + for (uint32_t i = 0; i < iter_sets.size(); i++) { + CSet& cs = *iter_sets[i]; + cs.exclude(c); + } + + // Remove clause from clause touched set: + cl_touched.exclude(c); + cl_added.exclude(c); + + clauses[c.index].clause = NULL; +} + +void Subsumer::unlinkModifiedClause(vec& origClause, ClauseSimp c) +{ + for (uint32_t i = 0; i < origClause.size(); i++) { + maybeRemove(occur[origClause[i].toInt()], c.clause); + #ifndef TOUCH_LESS + touch(origClause[i]); + #endif + } + + solver.detachModifiedClause(origClause[0], origClause[1], origClause.size(), c.clause); + + // Remove from iterator vectors/sets: + for (uint32_t i = 0; i < iter_vecs.size(); i++){ + vec& cs = *iter_vecs[i]; + for (uint32_t j = 0; j < cs.size(); j++) + if (cs[j].clause == c.clause) + cs[j].clause = NULL; + } + for (uint32_t i = 0; i < iter_sets.size(); i++){ + CSet& cs = *iter_sets[i]; + cs.exclude(c); + } + + // Remove clause from clause touched set: + cl_touched.exclude(c); + cl_added.exclude(c); + + clauses[c.index].clause = NULL; +} + +void Subsumer::unlinkModifiedClauseNoDetachNoNULL(vec& origClause, ClauseSimp c) +{ + for (uint32_t i = 0; i < origClause.size(); i++) { + maybeRemove(occur[origClause[i].toInt()], c.clause); + #ifndef TOUCH_LESS + touch(origClause[i]); + #endif + } + + // Remove from iterator vectors/sets: + for (uint32_t i = 0; i < iter_vecs.size(); i++){ + vec& cs = *iter_vecs[i]; + for (uint32_t j = 0; j < cs.size(); j++) + if (cs[j].clause == c.clause) + cs[j].clause = NULL; + } + for (uint32_t i = 0; i < iter_sets.size(); i++){ + CSet& cs = *iter_sets[i]; + cs.exclude(c); + } + + // Remove clause from clause touched set: + cl_touched.exclude(c); + cl_added.exclude(c); +} + +void Subsumer::subsume1(ClauseSimp& ps) +{ + vec Q; + vec subs; + vec qs; + uint32_t q; + + ps.clause->unsetStrenghtened(); + registerIteration(Q); + registerIteration(subs); + + Q.push(ps); + q = 0; + while (q < Q.size()){ + if (Q[q].clause == NULL) { q++; continue; } + #ifdef VERBOSE_DEBUG + cout << "subsume1 with clause:"; + Q[q].clause->plainPrint(); + #endif + + qs.clear(); + for (uint32_t i = 0; i < Q[q].clause->size(); i++) + qs.push((*Q[q].clause)[i]); + + for (uint32_t i = 0; i < qs.size(); i++){ + qs[i] = ~qs[i]; + + uint32_t abst = calcAbstraction(qs); + + findSubsumed(qs, abst, subs); + for (uint32_t j = 0; j < subs.size(); j++){ + /*#ifndef NDEBUG + if (&counter != NULL && counter == -1){ + dump(*subs[j].clause); + qs[i] = ~qs[i]; + dump(qs); + printf(L_LIT"\n", L_lit(qs[i])); + exit(0); + } + #endif*/ + if (subs[j].clause == NULL) continue; + ClauseSimp c = subs[j]; + Clause& cl = *c.clause; + #ifdef VERBOSE_DEBUG + cout << "-> Strenghtening clause :"; + cl.plainPrint(); + #endif + unlinkClause(c); + + literals_removed++; + cl.strengthen(qs[i]); + Lit *a, *b, *end; + for (a = b = cl.getData(), end = a + cl.size(); a != end; a++) { + lbool val = solver.value(*a); + if (val == l_Undef) + *b++ = *a; + + if (val == l_True) { + #ifdef VERBOSE_DEBUG + std::cout << "--> Clause was satisfied." << std::endl; + #endif + clauseFree(&cl); + goto endS; + } + } + cl.shrink(a-b); + cl.setStrenghtened(); + + #ifdef VERBOSE_DEBUG + cout << "--> Strenghtened clause:"; + cl.plainPrint(); + #endif + + if (cl.size() == 0) { + solver.ok = false; + unregisterIteration(Q); + unregisterIteration(subs); + clauseFree(&cl); + return; + } + if (cl.size() > 1) { + cl.calcAbstraction(); + linkInAlreadyClause(c); + clauses[c.index] = c; + solver.attachClause(cl); + if (cl.size() == 2) solver.becameBinary++; + updateClause(c); + Q.push(c); + } else { + assert(cl.size() == 1); + solver.uncheckedEnqueue(cl[0]); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) { + unregisterIteration(Q); + unregisterIteration(subs); + return; + } + #ifdef VERBOSE_DEBUG + cout << "--> Found that var " << cl[0].var()+1 << " must be " << std::boolalpha << !cl[0].sign() << endl; + #endif + clauseFree(&cl); + } + endS:; + } + + qs[i] = ~qs[i]; + subs.clear(); + } + q++; + } + + unregisterIteration(Q); + unregisterIteration(subs); +} + +template +void Subsumer::subsume1Partial(const T& ps) +{ + assert(solver.decisionLevel() == 0); + registerIteration(subsume1PartialSubs); + + #ifdef VERBOSE_DEBUG + cout << "-> Strenghtening using clause :"; + ps[0].print(); std::cout << " "; + ps[1].printFull(); + #endif + + assert(ps.size() == 2); + subsume1PartialQs.clear(); + for (uint8_t i = 0; i < 2; i++) + subsume1PartialQs.push(ps[i]); + + for (uint8_t i = 0; i < 2; i++){ + subsume1PartialQs[i] = ~subsume1PartialQs[i]; + + uint32_t abst = calcAbstraction(subsume1PartialQs); + + findSubsumed(subsume1PartialQs, abst, subsume1PartialSubs); + for (uint32_t j = 0; j < subsume1PartialSubs.size(); j++){ + if (subsume1PartialSubs[j].clause == NULL) continue; + ClauseSimp c = subsume1PartialSubs[j]; + Clause& cl = *c.clause; + #ifdef VERBOSE_DEBUG + cout << "-> Strenghtening clause :"; + cl.plainPrint(); + #endif + unlinkClause(subsume1PartialSubs[j]); + + literals_removed++; + cl.strengthen(subsume1PartialQs[i]); + Lit *a, *b, *end; + for (a = b = cl.getData(), end = a + cl.size(); a != end; a++) { + lbool val = solver.value(*a); + if (val == l_Undef) + *b++ = *a; + + if (val == l_True) { + #ifdef VERBOSE_DEBUG + std::cout << "--> Clause was satisfied." << std::endl; + #endif + clauseFree(&cl); + goto endS; + } + } + cl.shrink(a-b); + cl.setStrenghtened(); + + #ifdef VERBOSE_DEBUG + cout << "--> Strenghtened clause:"; + cl.plainPrint(); + #endif + + if (cl.size() == 0) { + solver.ok = false; + unregisterIteration(subsume1PartialSubs); + clauseFree(&cl); + return; + } + if (cl.size() > 2) { + cl.calcAbstraction(); + linkInAlreadyClause(c); + clauses[c.index] = c; + solver.attachClause(cl); + updateClause(c); + } else if (cl.size() == 2) { + cl.calcAbstraction(); + solver.attachClause(cl); + solver.becameBinary++; + addBinaryClauses.push(&cl); + //updateClause(c); + } else { + assert(cl.size() == 1); + solver.uncheckedEnqueue(cl[0]); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) { + unregisterIteration(subsume1PartialSubs); + return; + } + #ifdef VERBOSE_DEBUG + cout << "--> Found that var " << cl[0].var()+1 << " must be " << std::boolalpha << !cl[0].sign() << endl; + #endif + clauseFree(&cl); + } + endS:; + } + + subsume1PartialQs[i] = ~subsume1PartialQs[i]; + subsume1PartialSubs.clear(); + } + unregisterIteration(subsume1PartialSubs); +} + +void Subsumer::updateClause(ClauseSimp c) +{ + if (!c.clause->learnt()) subsume0(*c.clause, c.clause->getAbst()); + + cl_touched.add(c); +} + +void Subsumer::almost_all_database() +{ + #ifdef BIT_MORE_VERBOSITY + std::cout << "c Larger database" << std::endl; + #endif + // Optimized variant when virtually whole database is involved: + cl_added .clear(); + cl_touched.clear(); + + for (uint32_t i = 0; i < clauses.size(); i++) { + if (numMaxSubsume1 == 0) break; + if (clauses[i].clause != NULL) { + subsume1(clauses[i]); + numMaxSubsume1--; + if (!solver.ok) return; + } + } + + assert(solver.ok); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) { + std::cout << "c (contradiction during subsumption)" << std::endl; + return; + } + solver.clauseCleaner->cleanClausesBewareNULL(clauses, ClauseCleaner::simpClauses, *this); + + #ifdef VERBOSE_DEBUG + cout << "subsume1 part 1 finished" << endl; + #endif + + CSet s1; + registerIteration(s1); + while (cl_touched.size() > 0 && numMaxSubsume1 > 0){ + #ifdef VERBOSE_DEBUG + std::cout << "c cl_touched was > 0, new iteration" << std::endl; + #endif + for (CSet::iterator it = cl_touched.begin(), end = cl_touched.end(); it != end; ++it) { + if (it->clause != NULL) + s1.add(*it); + } + cl_touched.clear(); + + for (CSet::iterator it = s1.begin(), end = s1.end(); it != end; ++it) { + if (numMaxSubsume1 == 0) break; + if (it->clause != NULL) { + subsume1(*it); + numMaxSubsume1--; + if (!solver.ok) return; + } + } + s1.clear(); + + if (!solver.ok) return; + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) { + printf("c (contradiction during subsumption)\n"); + unregisterIteration(s1); + return; + } + solver.clauseCleaner->cleanClausesBewareNULL(clauses, ClauseCleaner::simpClauses, *this); + } + unregisterIteration(s1); +} + +void Subsumer::smaller_database() +{ + #ifdef BIT_MORE_VERBOSITY + std::cout << "c Smaller database" << std::endl; + #endif + // Set used in 1-subs: + // (1) clauses containing a negated literal of an added clause. + // (2) all added or strengthened ("touched") clauses. + // + // Set used in 0-subs: + // (1) clauses containing a (non-negated) literal of an added clause, including the added clause itself. + // (2) all strenghtened clauses -- REMOVED!! We turned on eager backward subsumption which supersedes this. + + #ifdef BIT_MORE_VERBOSITY + printf(" PREPARING\n"); + #endif + + CSet s0, s1; // 's0' is used for 0-subsumption, 's1' for 1-subsumption + vec ol_seen(solver.nVars()*2, 0); + for (CSet::iterator it = cl_added.begin(), end = cl_added.end(); it != end; ++it) { + if (it->clause == NULL) continue; + ClauseSimp& c = *it; + Clause& cl = *it->clause; + + s1.add(c); + for (uint32_t j = 0; j < cl.size(); j++){ + if (ol_seen[cl[j].toInt()]) continue; + ol_seen[cl[j].toInt()] = 1; + + vec& n_occs = occur[(~cl[j]).toInt()]; + for (uint32_t k = 0; k < n_occs.size(); k++) + if (n_occs[k].clause != c.clause && n_occs[k].clause->size() <= cl.size() && selfSubset(n_occs[k].clause->getAbst(), c.clause->getAbst()) && selfSubset(*n_occs[k].clause, cl, seen_tmp)) + s1.add(n_occs[k]); + + vec& p_occs = occur[cl[j].toInt()]; + for (uint32_t k = 0; k < p_occs.size(); k++) + if (subsetAbst(p_occs[k].clause->getAbst(), c.clause->getAbst())) + s0.add(p_occs[k]); + } + } + cl_added.clear(); + + registerIteration(s0); + registerIteration(s1); + + #ifdef BIT_MORE_VERBOSITY + printf("c FIXED-POINT\n"); + #endif + + // Fixed-point for 1-subsumption: + while (s1.size() > 0 || cl_touched.size() > 0){ + for (CSet::iterator it = cl_touched.begin(), end = cl_touched.end(); it != end; ++it) { + if (it->clause != NULL) { + s1.add(*it); + s0.add(*it); + } + } + + cl_touched.clear(); + assert(solver.qhead == solver.trail.size()); + + #ifdef BIT_MORE_VERBOSITY + printf("c s1.size()=%d cl_touched.size()=%d\n", s1.size(), cl_touched.size()); + #endif + + for (CSet::iterator it = s1.begin(), end = s1.end(); it != end; ++it) { + if (numMaxSubsume1 == 0) break; + if (it->clause != NULL) { + subsume1(*it); + numMaxSubsume1--; + if (!solver.ok) return; + } + } + s1.clear(); + + if (!solver.ok) return; + solver.ok = (solver.propagate() == NULL); + if (!solver.ok){ + printf("c (contradiction during subsumption)\n"); + unregisterIteration(s1); + unregisterIteration(s0); + return; + } + solver.clauseCleaner->cleanClausesBewareNULL(clauses, ClauseCleaner::simpClauses, *this); + } + unregisterIteration(s1); + + // Iteration pass for 0-subsumption: + for (CSet::iterator it = s0.begin(), end = s0.end(); it != end; ++it) { + if (it->clause != NULL) + subsume0(*it->clause, it->clause->getAbst()); + } + s0.clear(); + unregisterIteration(s0); +} + +ClauseSimp Subsumer::linkInClause(Clause& cl) +{ + ClauseSimp c(&cl, clauseID++); + clauses.push(c); + for (uint32_t i = 0; i < cl.size(); i++) { + occur[cl[i].toInt()].push(c); + touch(cl[i].var()); + } + cl_added.add(c); + + return c; +} + +void Subsumer::linkInAlreadyClause(ClauseSimp& c) +{ + Clause& cl = *c.clause; + for (uint32_t i = 0; i < cl.size(); i++) { + occur[cl[i].toInt()].push(c); + touch(cl[i].var()); + } +} + +template +void Subsumer::addFromSolver(vec& cs, bool alsoLearnt) +{ + Clause **i = cs.getData(); + Clause **j = i; + for (Clause **end = i + cs.size(); i != end; i++) { + if (i+1 != end) + __builtin_prefetch(*(i+1), 1, 1); + + if (!alsoLearnt && (*i)->learnt()) { + *j++ = *i; + (*i)->setUnsorted(); + continue; + } + + if (!UseCL && (*i)->size() == 2) { + //don't add binary clauses in this case + *j++ = *i; + (*i)->setUnsorted(); + continue; + } + + ClauseSimp c(*i, clauseID++); + clauses.push(c); + Clause& cl = *c.clause; + for (uint32_t i = 0; i < cl.size(); i++) { + occur[cl[i].toInt()].push(c); + touch(cl[i].var()); + } + if (UseCL) { + if (fullSubsume || cl.getVarChanged()) cl_added.add(c); + else if (cl.getStrenghtened()) cl_touched.add(c); + } + + if (cl.getVarChanged() || cl.getStrenghtened()) + cl.calcAbstraction(); + } + cs.shrink(i-j); +} + +void Subsumer::addBackToSolver() +{ + #ifdef HYPER_DEBUG2 + uint32_t binaryLearntAdded = 0; + #endif + + for (uint32_t i = 0; i < clauses.size(); i++) { + if (clauses[i].clause != NULL) { + assert(clauses[i].clause->size() > 1); + if (clauses[i].clause->size() == 2) { + #ifdef HYPER_DEBUG2 + if (clauses[i].clause->learnt()) + binaryLearntAdded++; + #endif + solver.binaryClauses.push(clauses[i].clause); + } else { + if (clauses[i].clause->learnt()) + solver.learnts.push(clauses[i].clause); + else + solver.clauses.push(clauses[i].clause); + } + } + } + + #ifdef HYPER_DEBUG2 + std::cout << "Binary learnt added:" << binaryLearntAdded << std::endl; + #endif +} + +void Subsumer::removeWrong(vec& cs) +{ + Clause **i = cs.getData(); + Clause **j = i; + for (Clause **end = i + cs.size(); i != end; i++) { + Clause& c = **i; + if (!c.learnt()) { + *j++ = *i; + continue; + } + bool remove = false; + for (Lit *l = c.getData(), *end2 = l+c.size(); l != end2; l++) { + if (var_elimed[l->var()]) { + remove = true; + solver.detachClause(c); + clauseFree(&c); + break; + } + } + if (!remove) + *j++ = *i; + } + cs.shrink(i-j); +} + +void Subsumer::fillCannotEliminate() +{ + std::fill(cannot_eliminate.getData(), cannot_eliminate.getDataEnd(), false); + for (uint32_t i = 0; i < solver.xorclauses.size(); i++) { + const XorClause& c = *solver.xorclauses[i]; + for (uint32_t i2 = 0; i2 < c.size(); i2++) + cannot_eliminate[c[i2].var()] = true; + } + + const vec& tmp = solver.varReplacer->getClauses(); + for (uint32_t i = 0; i < tmp.size(); i++) { + const Clause& c = *tmp[i]; + for (uint32_t i2 = 0; i2 < c.size(); i2++) + cannot_eliminate[c[i2].var()] = true; + } + + for (uint32_t i = 0; i < solver.assumptions.size(); i++) + cannot_eliminate[solver.assumptions[i].var()] = true; + + #ifdef VERBOSE_DEBUG + uint32_t tmpNum = 0; + for (uint32_t i = 0; i < cannot_eliminate.size(); i++) + if (cannot_eliminate[i]) + tmpNum++; + std::cout << "Cannot eliminate num:" << tmpNum << std::endl; + #endif +} + +void Subsumer::subsume0LearntSet(vec& cs) +{ + Clause** a = cs.getData(); + Clause** b = a; + for (Clause** end = a + cs.size(); a != end; a++) { + if (numMaxSubsume0 > 0 && !(*a)->subsume0IsFinished()) { + numMaxSubsume0--; + uint32_t index = subsume0(**a, calcAbstraction(**a)); + if (index != std::numeric_limits::max()) { + (*a)->makeNonLearnt(); + //solver.nbBin--; + clauses[index].clause = *a; + linkInAlreadyClause(clauses[index]); + solver.learnts_literals -= (*a)->size(); + solver.clauses_literals += (*a)->size(); + cl_added.add(clauses[index]); + continue; + } + if (numMaxSubsume1 > 0 && + (((*a)->size() == 2 && clauses.size() < 3500000) || + ((*a)->size() <= 3 && clauses.size() < 300000) || + ((*a)->size() <= 4 && clauses.size() < 60000))) { + ClauseSimp c(*a, clauseID++); + //(*a)->calcAbstraction(); + //clauses.push(c); + subsume1(c); + numMaxSubsume1--; + if (!solver.ok) { + for (; a != end; a++) + *b++ = *a; + cs.shrink(a-b); + return; + } + //assert(clauses[c.index].clause != NULL); + //clauses.pop(); + clauseID--; + } + } + *b++ = *a; + } + cs.shrink(a-b); +} + +const bool Subsumer::treatLearnts() +{ + subsume0LearntSet(solver.learnts); + if (!solver.ok) return false; + subsume0LearntSet(solver.binaryClauses); + if (!solver.ok) return false; + solver.ok = (solver.propagate() == NULL); + if (!solver.ok){ + printf("c (contradiction during subsumption)\n"); + return false; + } + solver.clauseCleaner->cleanClausesBewareNULL(clauses, ClauseCleaner::simpClauses, *this); + return true; +} + +const bool Subsumer::subsumeWithBinaries(const bool startUp) +{ + clearAll(); + clauseID = 0; + fullSubsume = true; + addBinaryClauses.clear(); + + //Clearing stats + subsNonExistentumFailed = 0; + clauses_subsumed = 0; + literals_removed = 0; + double myTime = cpuTime(); + uint32_t origTrailSize = solver.trail.size(); + + clauses.reserve(solver.clauses.size()); + solver.clauseCleaner->cleanClauses(solver.clauses, ClauseCleaner::clauses); + addFromSolver(solver.clauses); + #ifdef DEBUG_BINARIES + for (uint32_t i = 0; i < clauses.size(); i++) { + assert(clauses[i].clause->size() != 2); + } + #endif //DEBUG_BINARIES + + for (uint32_t i = 0; i < solver.binaryClauses.size(); i++) { + if (startUp || !solver.binaryClauses[i]->learnt()) { + Clause& c = *solver.binaryClauses[i]; + subsume0(c, c.getAbst()); + } + } + for (uint32_t i = 0; i < solver.binaryClauses.size(); i++) { + Clause& c = *solver.binaryClauses[i]; + subsume1Partial(c); + if (!solver.ok) return false; + } + if (solver.verbosity >= 1) { + std::cout << "c subs with bin: " << std::setw(8) << clauses_subsumed + << " lits-rem: " << std::setw(9) << literals_removed + << " v-fix: " << std::setw(4) <size() != 2); + } + #endif //DEBUG_BINARIES + addBackToSolver(); + for (uint32_t i = 0; i < addBinaryClauses.size(); i++) { + solver.binaryClauses.push(addBinaryClauses[i]); + } + addBinaryClauses.clear(); + + if (solver.verbosity >= 1) { + std::cout << "c Subs w/ non-existent bins: " << std::setw(6) << subsNonExistentNum + << " l-rem: " << std::setw(6) << subsNonExistentLitsRemoved + << " v-fix: " << std::setw(5) << subsNonExistentumFailed + << " done: " << std::setw(6) << doneNum + << " time: " << std::fixed << std::setprecision(2) << std::setw(5) << subsNonExistentTime << " s" + << std::setw(2) << " |" << std::endl; + } + totalTime += cpuTime() - myTime; + solver.order_heap.filter(Solver::VarFilter(solver)); + + return true; +} + +#define MAX_BINARY_PROP 40000000 + +const bool Subsumer::subsWNonExistBinsFull(const bool startUp) +{ + uint32_t oldClausesSubusmed = clauses_subsumed; + uint32_t oldLitsRemoved = literals_removed; + double myTime = cpuTime(); + uint64_t oldProps = solver.propagations; + uint32_t oldTrailSize = solver.trail.size(); + uint64_t maxProp = MAX_BINARY_PROP; + if (!startUp) maxProp /= 3; + ps2.clear(); + ps2.growTo(2); + toVisitAll.growTo(solver.nVars()*2, false); + + doneNum = 0; + uint32_t startFrom = solver.mtrand.randInt(solver.order_heap.size()); + for (uint32_t i = 0; i < solver.order_heap.size(); i++) { + Var var = solver.order_heap[(i+startFrom)%solver.order_heap.size()]; + if (solver.propagations - oldProps > maxProp) break; + if (solver.assigns[var] != l_Undef || !solver.decision_var[var]) continue; + doneNum++; + + Lit lit(var, true); + if (!subsWNonExistBins(lit, startUp)) { + if (!solver.ok) return false; + solver.cancelUntil(0); + solver.uncheckedEnqueue(~lit); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) return false; + continue; + } + + //in the meantime it could have got assigned + if (solver.assigns[var] != l_Undef) continue; + lit = ~lit; + if (!subsWNonExistBins(lit, startUp)) { + if (!solver.ok) return false; + solver.cancelUntil(0); + solver.uncheckedEnqueue(~lit); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) return false; + continue; + } + } + subsNonExistentNum = clauses_subsumed - oldClausesSubusmed; + subsNonExistentTime = cpuTime() - myTime; + subsNonExistentumFailed = solver.trail.size() - oldTrailSize; + subsNonExistentLitsRemoved = literals_removed - oldLitsRemoved; + + return true; +} + +const bool Subsumer::subsWNonExistBins(const Lit& lit, const bool startUp) +{ + #ifdef VERBOSE_DEBUG + std::cout << "subsWNonExistBins called with lit "; lit.print(); + std::cout << " startUp: " << startUp << std::endl; + #endif //VERBOSE_DEBUG + toVisit.clear(); + solver.newDecisionLevel(); + solver.uncheckedEnqueueLight(lit); + bool failed; + if (startUp) { + failed = (solver.propagateBin() != NULL); + } else { + failed = (solver.propagateBinNoLearnts() != NULL); + } + if (failed) return false; + + assert(solver.decisionLevel() > 0); + for (int c = solver.trail.size()-1; c > (int)solver.trail_lim[0]; c--) { + Lit x = solver.trail[c]; + toVisit.push(x); + toVisitAll[x.toInt()] = true; + } + solver.cancelUntil(0); + + if (toVisit.size() <= 1) { + ps2[0] = ~lit; + for (Lit *l = toVisit.getData(), *end = toVisit.getDataEnd(); l != end; l++) { + ps2[1] = *l; + assert(ps2[0] != ps2[1]); + #ifdef VERBOSE_DEBUG + std::cout << "Non-existent bin. lit1: "; ps2[0].print(); + std::cout << " lit2: "; ps2[1].print(); std::cout << std::endl; + #endif //VERBOSE_DEBUG + subsume0(ps2, calcAbstraction(ps2)); + subsume1Partial(ps2); + } + } else { + subsume0BIN(~lit, toVisitAll); + } + for (uint32_t i = 0; i < toVisit.size(); i++) + toVisitAll[toVisit[i].toInt()] = false; + + return solver.ok; +} + +void Subsumer::clearAll() +{ + touched_list.clear(); + touched.clear(); + touched.growTo(solver.nVars(), false); + for (Var var = 0; var < solver.nVars(); var++) { + if (solver.decision_var[var] && solver.assigns[var] == l_Undef) touch(var); + occur[2*var].clear(); + occur[2*var+1].clear(); + } + clauses.clear(); + cl_added.clear(); + cl_touched.clear(); +} + +const bool Subsumer::simplifyBySubsumption() +{ + if (solver.nClauses() > 20000000) return true; + + double myTime = cpuTime(); + uint32_t origTrailSize = solver.trail.size(); + clauses_subsumed = 0; + literals_removed = 0; + numblockedClauseRemoved = 0; + numCalls++; + clauseID = 0; + numVarsElimed = 0; + blockTime = 0.0; + clearAll(); + + //if (solver.xorclauses.size() < 30000 && solver.clauses.size() < MAX_CLAUSENUM_XORFIND/10) addAllXorAsNorm(); + + solver.testAllClauseAttach(); + if (solver.performReplace && !solver.varReplacer->performReplace(true)) + return false; + fillCannotEliminate(); + solver.testAllClauseAttach(); + + clauses.reserve(solver.clauses.size() + solver.binaryClauses.size()); + cl_added.reserve(solver.clauses.size() + solver.binaryClauses.size()); + cl_touched.reserve(solver.clauses.size() + solver.binaryClauses.size()); + + if (clauses.size() < 200000) + fullSubsume = true; + else + fullSubsume = false; + + solver.clauseCleaner->cleanClauses(solver.clauses, ClauseCleaner::clauses); + addFromSolver(solver.clauses); + solver.clauseCleaner->removeSatisfied(solver.binaryClauses, ClauseCleaner::binaryClauses); + addFromSolver(solver.binaryClauses); + + //Limits + if (clauses.size() > 3500000) { + numMaxSubsume0 = 900000 * (1+numCalls/2); + numMaxElim = (uint32_t)((double)solver.order_heap.size() / 5.0 * (0.8+(double)(numCalls)/4.0)); + numMaxSubsume1 = 100000 * (1+numCalls/2); + numMaxBlockToVisit = (int64_t)(30000.0 * (0.8+(double)(numCalls)/3.0)); + } + if (clauses.size() <= 3500000 && clauses.size() > 1500000) { + numMaxSubsume0 = 2000000 * (1+numCalls/2); + numMaxElim = (uint32_t)((double)solver.order_heap.size() / 2.0 * (0.8+(double)(numCalls)/4.0)); + numMaxSubsume1 = 300000 * (1+numCalls/2); + numMaxBlockToVisit = (int64_t)(50000.0 * (0.8+(double)(numCalls)/3.0)); + } + if (clauses.size() <= 1500000) { + numMaxSubsume0 = 4000000 * (1+numCalls/2); + numMaxElim = (uint32_t)((double)solver.order_heap.size() / 2.0 * (0.8+(double)(numCalls)/2.0)); + numMaxSubsume1 = 400000 * (1+numCalls/2); + numMaxBlockToVisit = (int64_t)(80000.0 * (0.8+(double)(numCalls)/3.0)); + } + if (numCalls == 1) numMaxSubsume1 = 0; + + if (!solver.doSubsume1) numMaxSubsume1 = 0; + + + if (solver.order_heap.size() > 200000) + numMaxBlockVars = (uint32_t)((double)solver.order_heap.size() / 3.5 * (0.8+(double)(numCalls)/4.0)); + else + numMaxBlockVars = (uint32_t)((double)solver.order_heap.size() / 1.5 * (0.8+(double)(numCalls)/4.0)); + + //For debugging + //numMaxBlockToVisit = std::numeric_limits::max(); + //numMaxElim = std::numeric_limits::max(); + //numMaxSubsume0 = std::numeric_limits::max(); + //numMaxSubsume1 = std::numeric_limits::max(); + //numMaxBlockVars = std::numeric_limits::max(); + + #ifdef BIT_MORE_VERBOSITY + std::cout << "c num clauses:" << clauses.size() << std::endl; + std::cout << "c time to link in:" << cpuTime()-myTime << std::endl; + #endif + + for (uint32_t i = 0; i < clauses.size(); i++) { + if (numMaxSubsume0 == 0) break; + if (clauses[i].clause != NULL && + (fullSubsume + || !clauses[i].clause->subsume0IsFinished()) + ) { + subsume0(*clauses[i].clause, clauses[i].clause->getAbst()); + numMaxSubsume0--; + } + } + + origNClauses = clauses.size(); + uint32_t origNLearnts = solver.learnts.size(); + + if (!treatLearnts()) return false; + + #ifdef BIT_MORE_VERBOSITY + std::cout << "c time until pre-subsume0 clauses and subsume1 2-learnts:" << cpuTime()-myTime << std::endl; + #endif + + if (!solver.ok) return false; + #ifdef VERBOSE_DEBUG + std::cout << "c pre-subsumed:" << clauses_subsumed << std::endl; + std::cout << "c cl_added:" << cl_added.size() << std::endl; + std::cout << "c cl_touched:" << cl_touched.size() << std::endl; + std::cout << "c clauses:" << clauses.size() << std::endl; + std::cout << "c origNClauses:" << origNClauses << std::endl; + #endif + + if (clauses.size() > 10000000) goto endSimplifyBySubsumption; + if (solver.doBlockedClause && numCalls % 3 == 1) blockedClauseRemoval(); + do{ + #ifdef BIT_MORE_VERBOSITY + std::cout << "c time before the start of almost_all/smaller: " << cpuTime() - myTime << std::endl; + #endif + if (numMaxSubsume0 > 0) { + if (cl_added.size() > origNClauses / 2) { + almost_all_database(); + if (!solver.ok) return false; + } else { + smaller_database(); + if (!solver.ok) return false; + } + } + cl_added.clear(); + assert(cl_added.size() == 0); + assert(solver.ok); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) { + printf("c (contradiction during subsumption)\n"); + return false; + } + solver.clauseCleaner->cleanClausesBewareNULL(clauses, ClauseCleaner::simpClauses, *this); + + #ifdef BIT_MORE_VERBOSITY + std::cout << "c time until the end of almost_all/smaller: " << cpuTime() - myTime << std::endl; + #endif + + if (!solver.doVarElim) break; + + #ifdef BIT_MORE_VERBOSITY + printf("c VARIABLE ELIMINIATION\n"); + std::cout << "c toucheds list size:" << touched_list.size() << std::endl; + #endif + vec init_order; + orderVarsForElim(init_order); // (will untouch all variables) + + for (bool first = true; numMaxElim > 0; first = false){ + uint32_t vars_elimed = 0; + vec order; + + if (first) { + //init_order.copyTo(order); + for (uint32_t i = 0; i < init_order.size(); i++) { + const Var var = init_order[i]; + if (!cannot_eliminate[var] && solver.decision_var[var]) + order.push(var); + } + } else { + for (uint32_t i = 0; i < touched_list.size(); i++) { + const Var var = touched_list[i]; + if (!cannot_eliminate[var] && solver.decision_var[var]) + order.push(var); + touched[var] = false; + } + touched_list.clear(); + } + #ifdef VERBOSE_DEBUG + std::cout << "Order size:" << order.size() << std::endl; + #endif + + assert(solver.qhead == solver.trail.size()); + for (uint32_t i = 0; i < order.size() && numMaxElim > 0; i++, numMaxElim--) { + if (maybeEliminate(order[i])) { + if (!solver.ok) { + printf("c (contradiction during subsumption)\n"); + return false; + } + vars_elimed++; + } + } + assert(solver.qhead == solver.trail.size()); + + if (vars_elimed == 0) break; + + numVarsElimed += vars_elimed; + #ifdef BIT_MORE_VERBOSITY + printf("c #var-elim: %d\n", vars_elimed); + std::cout << "c time until the end of varelim: " << cpuTime() - myTime << std::endl; + #endif + } + }while (cl_added.size() > 100 && numMaxElim > 0); + endSimplifyBySubsumption: + + if (!solver.ok) return false; + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) { + printf("c (contradiction during subsumption)\n"); + return false; + } + + #ifndef NDEBUG + verifyIntegrity(); + #endif + + //vector var_merged = merge(); + removeWrong(solver.learnts); + removeWrong(solver.binaryClauses); + removeAssignedVarsFromEliminated(); + + /*solver.clauseCleaner->cleanClausesBewareNULL(clauses, ClauseCleaner::simpClauses, *this); + addFromSolver(solver.learnts, true); + addFromSolver(solver.binaryClauses, true); + if (solver.doHyperBinRes && clauses.size() < 1000000 && numCalls > 1 && !hyperBinRes()) + return false;*/ + solver.order_heap.filter(Solver::VarFilter(solver)); + + addBackToSolver(); + solver.nbCompensateSubsumer += origNLearnts-solver.learnts.size(); + + if (solver.verbosity >= 1) { + std::cout << "c | lits-rem: " << std::setw(9) << literals_removed + << " cl-subs: " << std::setw(8) << clauses_subsumed + << " v-elim: " << std::setw(6) << numVarsElimed + << " v-fix: " << std::setw(4) < 0 || blockTime > 0.0) { + std::cout + << "c | Blocked clauses removed: " << std::setw(8) << numblockedClauseRemoved + << " Time: " << std::fixed << std::setprecision(2) << std::setw(4) << blockTime << " s" + << " |" << std::endl; + } + } + totalTime += cpuTime() - myTime; + + solver.testAllClauseAttach(); + return true; +} + +void Subsumer::removeAssignedVarsFromEliminated() +{ + for (Var var = 0; var < var_elimed.size(); var++) { + if (var_elimed[var] && solver.assigns[var] != l_Undef) { + var_elimed[var] = false; + solver.setDecisionVar(var, true); + numElimed--; + map >::iterator it = elimedOutVar.find(var); + if (it != elimedOutVar.end()) { + //TODO memory loss here + elimedOutVar.erase(it); + } + } + } +} + +template +void Subsumer::findSubsumed(const T& ps, uint32_t abs, vec& out_subsumed) +{ + #ifdef VERBOSE_DEBUG + cout << "findSubsumed: "; + for (uint32_t i = 0; i < ps.size(); i++) { + if (ps[i].sign()) printf("-"); + printf("%d ", ps[i].var() + 1); + } + printf("0\n"); + #endif + + uint32_t min_i = 0; + for (uint32_t i = 1; i < ps.size(); i++){ + if (occur[ps[i].toInt()].size() < occur[ps[min_i].toInt()].size()) + min_i = i; + } + + vec& cs = occur[ps[min_i].toInt()]; + for (ClauseSimp *it = cs.getData(), *end = it + cs.size(); it != end; it++){ + if (it+1 != end) + __builtin_prefetch((it+1)->clause, 1, 1); + + if (it->clause != (Clause*)&ps && subsetAbst(abs, it->clause->getAbst()) && ps.size() <= it->clause->size() && subset(ps, *it->clause)) { + out_subsumed.push(*it); + #ifdef VERBOSE_DEBUG + cout << "subsumed: "; + it->clause->plainPrint(); + #endif + } + } +} + +void inline Subsumer::MigrateToPsNs(vec& poss, vec& negs, vec& ps, vec& ns, const Var x) +{ + poss.moveTo(ps); + negs.moveTo(ns); + + for (uint32_t i = 0; i < ps.size(); i++) + unlinkClause(ps[i], x); + for (uint32_t i = 0; i < ns.size(); i++) + unlinkClause(ns[i], x); +} + +void inline Subsumer::DeallocPsNs(vec& ps, vec& ns) +{ + for (uint32_t i = 0; i < ps.size(); i++) { + //clauses[ps[i].index].clause = NULL; + //clauseFree(ps[i].clause); + } + for (uint32_t i = 0; i < ns.size(); i++) { + //clauses[ns[i].index].clause = NULL; + //clauseFree(ns[i].clause); + } +} + +// Returns TRUE if variable was eliminated. +bool Subsumer::maybeEliminate(const Var x) +{ + assert(solver.qhead == solver.trail.size()); + assert(!var_elimed[x]); + assert(!cannot_eliminate[x]); + assert(solver.decision_var[x]); + if (solver.value(x) != l_Undef) return false; + if (occur[Lit(x, false).toInt()].size() == 0 && occur[Lit(x, true).toInt()].size() == 0) + return false; + + vec& poss = occur[Lit(x, false).toInt()]; + vec& negs = occur[Lit(x, true).toInt()]; + + // Heuristic CUT OFF: + if (poss.size() >= 10 && negs.size() >= 10) + return false; + + // Count clauses/literals before elimination: + int before_clauses = poss.size() + negs.size(); + uint32_t before_literals = 0; + for (uint32_t i = 0; i < poss.size(); i++) before_literals += poss[i].clause->size(); + for (uint32_t i = 0; i < negs.size(); i++) before_literals += negs[i].clause->size(); + + // Heuristic CUT OFF2: + if ((poss.size() >= 3 && negs.size() >= 3 && before_literals > 300) + && clauses.size() > 1500000) + return false; + if ((poss.size() >= 5 && negs.size() >= 5 && before_literals > 400) + && clauses.size() <= 1500000 && clauses.size() > 200000) + return false; + if ((poss.size() >= 8 && negs.size() >= 8 && before_literals > 700) + && clauses.size() <= 200000) + return false; + + // Count clauses/literals after elimination: + int after_clauses = 0; + vec dummy; + for (uint32_t i = 0; i < poss.size(); i++) for (uint32_t j = 0; j < negs.size(); j++){ + // Merge clauses. If 'y' and '~y' exist, clause will not be created. + dummy.clear(); + bool ok = merge(*poss[i].clause, *negs[j].clause, Lit(x, false), Lit(x, true), dummy); + if (ok){ + after_clauses++; + if (after_clauses > before_clauses) goto Abort; + } + } + Abort:; + + //Eliminate: + if (after_clauses <= before_clauses) { + vec ps, ns; + MigrateToPsNs(poss, negs, ps, ns, x); + for (uint32_t i = 0; i < ps.size(); i++) for (uint32_t j = 0; j < ns.size(); j++){ + dummy.clear(); + bool ok = merge(*ps[i].clause, *ns[j].clause, Lit(x, false), Lit(x, true), dummy); + if (ok){ + uint32_t group_num = 0; + #ifdef STATS_NEEDED + group_num = solver.learnt_clause_group++; + if (solver.dynamic_behaviour_analysis) { + string name = solver.logger.get_group_name(ps[i].clause->getGroup()) + " " + solver.logger.get_group_name(ns[j].clause->getGroup()); + solver.logger.set_group_name(group_num, name); + } + #endif + Clause* cl = solver.addClauseInt(dummy, group_num); + if (cl != NULL) { + ClauseSimp c = linkInClause(*cl); + subsume0(*cl, cl->getAbst()); + } + if (!solver.ok) return true; + } + } + DeallocPsNs(ps, ns); + goto Eliminated; + } + + return false; + + Eliminated: + assert(occur[Lit(x, false).toInt()].size() + occur[Lit(x, true).toInt()].size() == 0); + var_elimed[x] = true; + numElimed++; + solver.setDecisionVar(x, false); + return true; +} + +// Returns FALSE if clause is always satisfied ('out_clause' should not be used). 'seen' is assumed to be cleared. +bool Subsumer::merge(const Clause& ps, const Clause& qs, const Lit without_p, const Lit without_q, vec& out_clause) +{ + for (uint32_t i = 0; i < ps.size(); i++){ + if (ps[i] != without_p){ + seen_tmp[ps[i].toInt()] = 1; + out_clause.push(ps[i]); + } + } + + for (uint32_t i = 0; i < qs.size(); i++){ + if (qs[i] != without_q){ + if (seen_tmp[(~qs[i]).toInt()]){ + for (uint32_t i = 0; i < ps.size(); i++) + seen_tmp[ps[i].toInt()] = 0; + return false; + } + if (!seen_tmp[qs[i].toInt()]) + out_clause.push(qs[i]); + } + } + + for (uint32_t i = 0; i < ps.size(); i++) + seen_tmp[ps[i].toInt()] = 0; + + return true; +} + +struct myComp { + bool operator () (const pair& x, const pair& y) { + return x.first < y.first || + (!(y.first < x.first) && x.second < y.second); + } +}; + +// Side-effect: Will untouch all variables. +void Subsumer::orderVarsForElim(vec& order) +{ + order.clear(); + vec > cost_var; + for (uint32_t i = 0; i < touched_list.size(); i++){ + Var x = touched_list[i]; + touched[x] = 0; + cost_var.push(std::make_pair( occur[Lit(x, false).toInt()].size() * occur[Lit(x, true).toInt()].size() , x )); + } + + touched_list.clear(); + std::sort(cost_var.getData(), cost_var.getData()+cost_var.size(), myComp()); + + for (uint32_t x = 0; x < cost_var.size(); x++) { + if (cost_var[x].first != 0) + order.push(cost_var[x].second); + } +} + +const bool Subsumer::hyperUtility(vec& iter, const Lit lit, BitArray& inside, vec& addToClauses) +{ + for (ClauseSimp *it = iter.getData(), *end = it + iter.size() ; it != end; it++) { + if (it->clause == NULL) continue; + uint32_t notIn = 0; + Lit notInLit = lit_Undef; + + Clause& cl = *it->clause; + for (uint32_t i = 0; i < cl.size(); i++) { + if (cl[i].var() == lit.var() || cl.size() == 2) { + goto next; + } + if (!inside[cl[i].toInt()]) { + notIn++; + if (notIn > 1) goto next; + notInLit = cl[i]; + } + } + + if (notIn == 0) { + vec lits(1); + lits[0] = lit; + solver.addClauseInt(lits, cl.getGroup()); + if (!solver.ok) return false; + } + + if (notIn == 1 && !inside[(~notInLit).toInt()]) { + vec cs(2); + cs[0] = lit; + cs[1] = notInLit; + //uint32_t index = subsume0(cs, calcAbstraction(cs)); + /*if (index != std::numeric_limits::max()) { + Clause *cl3 = Clause_new(cs, cl.getGroup()); + ClauseSimp c(cl3, index); + addToClauses.push(c); + inside.setBit((~notInLit).toInt()); + #ifdef HYPER_DEBUG + std::cout << "HyperBinRes adding clause: "; + cl3->plainPrint(); + #endif + } else {*/ + Clause *cl3 = Clause_new(cs, cl.getGroup()); + addToClauses.push(cl3); + inside.setBit((~notInLit).toInt()); + //} + } + next:; + } + + return true; +} + +const bool Subsumer::hyperBinRes() +{ + double myTime = cpuTime(); + + BitArray inside; + inside.resize(solver.nVars()*2, 0); + uint32_t hyperBinAdded = 0; + uint32_t oldTrailSize = solver.trail.size(); + vec addToClauses; + vec addedToInside; + uint64_t totalClausesChecked = 0; + + vec varsToCheck; + + if (clauses.size() > 500000 || solver.order_heap.size() > 50000) { + Heap tmp(solver.order_heap); + uint32_t thisTopX = std::min(tmp.size(), 5000U); + for (uint32_t i = 0; i != thisTopX; i++) + varsToCheck.push(tmp.removeMin()); + } else { + for (Var i = 0; i < solver.nVars(); i++) + varsToCheck.push(i); + } + + for (uint32_t test = 0; test < 2*varsToCheck.size(); test++) if (solver.assigns[test/2] == l_Undef && solver.decision_var[test/2]) { + if (totalClausesChecked > 1000000) + break; + + inside.setZero(); + addToClauses.clear(); + addedToInside.clear(); + + Lit lit(varsToCheck[test/2], test&1); + #ifdef HYPER_DEBUG + std::cout << "Resolving with literal:" << (lit.sign() ? "-" : "") << lit.var()+1 << std::endl; + #endif + + //fill inside with binary clauses' literals that this lit is in + //addedToInside now contains the list + vec& set = occur[lit.toInt()]; + totalClausesChecked += occur.size(); + for (ClauseSimp *it = set.getData(), *end = it + set.size() ; it != end; it++) { + if (it->clause == NULL) continue; + Clause& cl2 = *it->clause; + if (cl2.size() > 2) continue; + assert(cl2[0] == lit || cl2[1] == lit); + if (cl2[0] == lit) { + if (!inside[(~cl2[1]).toInt()]) { + inside.setBit((~cl2[1]).toInt()); + addedToInside.push(~cl2[1]); + } + } else { + if (!inside[(~cl2[0]).toInt()]) { + inside.setBit((~cl2[0]).toInt()); + addedToInside.push(~cl2[0]); + } + } + } + + uint32_t sum = 0; + for (uint32_t add = 0; add < addedToInside.size(); add++) { + sum += occur[addedToInside[add].toInt()].size(); + } + + if (sum < clauses.size()) { + totalClausesChecked += sum; + for (uint32_t add = 0; add < addedToInside.size(); add++) { + vec& iter = occur[addedToInside[add].toInt()]; + if (!hyperUtility(iter, lit, inside, addToClauses)) + return false; + } + } else { + totalClausesChecked += clauses.size(); + if (!hyperUtility(clauses, lit, inside, addToClauses)) + return false; + } + + hyperBinAdded += addToClauses.size(); + for (uint32_t i = 0; i < addToClauses.size(); i++) { + Clause *c = solver.addClauseInt(*addToClauses[i], addToClauses[i]->getGroup()); + clauseFree(addToClauses[i]); + if (c != NULL) { + ClauseSimp cc = linkInClause(*c); + subsume1(cc); + } + if (!solver.ok) return false; + } + } + + if (solver.verbosity >= 1) { + std::cout << "c | Hyper-binary res binary added: " << std::setw(5) << hyperBinAdded + << " unitaries: " << std::setw(5) << solver.trail.size() - oldTrailSize + << " time: " << std::setprecision(2) << std::setw(5)<< cpuTime() - myTime << " s" + << " |" << std::endl; + } + + return true; +} + +class varDataStruct +{ + public: + varDataStruct() : + numPosClauses (0) + , numNegClauses (0) + , sumPosClauseSize (0) + , sumNegClauseSize (0) + , posHash(0) + , negHash(0) + {} + const bool operator < (const varDataStruct& other) const + { + if (numPosClauses < other.numPosClauses) return true; + if (numPosClauses > other.numPosClauses) return false; + + if (numNegClauses < other.numNegClauses) return true; + if (numNegClauses > other.numNegClauses) return false; + + if (sumPosClauseSize < other.sumPosClauseSize) return true; + if (sumPosClauseSize > other.sumPosClauseSize) return false; + + if (sumNegClauseSize < other.sumNegClauseSize) return true; + if (sumNegClauseSize > other.sumNegClauseSize) return false; + + if (posHash < other.posHash) return true; + if (posHash > other.posHash) return false; + + if (negHash < other.negHash) return true; + if (negHash > other.negHash) return false; + + return false; + } + + const bool operator == (const varDataStruct& other) const + { + if (numPosClauses == other.numPosClauses && + numNegClauses == other.numNegClauses && + sumPosClauseSize == other.sumPosClauseSize && + sumNegClauseSize == other.sumNegClauseSize && + posHash == other.posHash && + negHash == other.negHash) + return true; + + return false; + } + + void reversePolarity() + { + std::swap(numPosClauses, numNegClauses); + std::swap(sumPosClauseSize, sumNegClauseSize); + std::swap(posHash, negHash); + } + + uint32_t numPosClauses; + uint32_t numNegClauses; + uint32_t sumPosClauseSize; + uint32_t sumNegClauseSize; + int posHash; + int negHash; +}; + +void Subsumer::verifyIntegrity() +{ + vector occurNum(solver.nVars()*2, 0); + + for (uint32_t i = 0; i < clauses.size(); i++) { + if (clauses[i].clause == NULL) continue; + Clause& c = *clauses[i].clause; + for (uint32_t i2 = 0; i2 < c.size(); i2++) + occurNum[c[i2].toInt()]++; + } + + for (uint32_t i = 0; i < occurNum.size(); i++) { + assert(occurNum[i] == occur[i].size()); + } +} + +const bool Subsumer::allTautology(const vec& ps, const Lit lit) +{ + #ifdef VERBOSE_DEBUG + cout << "allTautology: "; + for (uint32_t i = 0; i < ps.size(); i++) { + if (ps[i].sign()) printf("-"); + printf("%d ", ps[i].var() + 1); + } + printf("0\n"); + #endif + + vec& cs = occur[lit.toInt()]; + if (cs.size() == 0) return true; + + for (const Lit *l = ps.getData(), *end = ps.getDataEnd(); l != end; l++) { + seen_tmp[l->toInt()] = true; + } + + bool allIsTautology = true; + for (ClauseSimp *it = cs.getData(), *end = cs.getDataEnd(); it != end; it++){ + if (it+1 != end) + __builtin_prefetch((it+1)->clause, 1, 1); + + Clause& c = *it->clause; + for (Lit *l = c.getData(), *end2 = l + c.size(); l != end2; l++) { + if (*l != lit && seen_tmp[(~(*l)).toInt()]) { + goto next; + } + } + allIsTautology = false; + break; + + next:; + } + + for (const Lit *l = ps.getData(), *end = ps.getDataEnd(); l != end; l++) { + seen_tmp[l->toInt()] = false; + } + + return allIsTautology; +} + +void Subsumer::blockedClauseRemoval() +{ + if (numMaxBlockToVisit < 0) return; + if (solver.order_heap.size() < 1) return; + double myTime = cpuTime(); + vec toRemove; + + touchedBlockedVars = priority_queue, MyComp>(); + touchedBlockedVarsBool.clear(); + touchedBlockedVarsBool.growTo(solver.nVars(), false); + for (uint32_t i = 0; i < solver.order_heap.size() && i < numMaxBlockVars; i++) { + touchBlockedVar(solver.order_heap[solver.mtrand.randInt(solver.order_heap.size()-1)]); + } + + while (touchedBlockedVars.size() > 100 && numMaxBlockToVisit > 0) { + VarOcc vo = touchedBlockedVars.top(); + touchedBlockedVars.pop(); + + if (solver.assigns[vo.var] != l_Undef || !solver.decision_var[vo.var] || cannot_eliminate[vo.var]) + continue; + touchedBlockedVarsBool[vo.var] = false; + Lit lit = Lit(vo.var, false); + Lit negLit = Lit(vo.var, true); + + numMaxBlockToVisit -= (int64_t)occur[lit.toInt()].size(); + numMaxBlockToVisit -= (int64_t)occur[negLit.toInt()].size(); + //if (!tryOneSetting(lit, negLit)) { + tryOneSetting(negLit, lit); + // } + } + blockTime += cpuTime() - myTime; + + #ifdef BIT_MORE_VERBOSITY + std::cout << "c Total fime for block until now: " << blockTime << std::endl; + #endif +} + +const bool Subsumer::tryOneSetting(const Lit lit, const Lit negLit) +{ + uint32_t toRemove = 0; + bool returnVal = false; + vec cl; + + for(ClauseSimp *it = occur[lit.toInt()].getData(), *end = occur[lit.toInt()].getDataEnd(); it != end; it++) { + cl.clear(); + cl.growTo(it->clause->size()-1); + for (uint32_t i = 0, i2 = 0; i < it->clause->size(); i++) { + if ((*it->clause)[i] != lit) { + cl[i2] = (*it->clause)[i]; + i2++; + } + } + + if (allTautology(cl, negLit)) { + toRemove++; + } else { + break; + } + } + + if (toRemove == occur[lit.toInt()].size()) { + var_elimed[lit.var()] = true; + solver.setDecisionVar(lit.var(), false); + vec toRemove(occur[lit.toInt()]); + for (ClauseSimp *it = toRemove.getData(), *end = toRemove.getDataEnd(); it != end; it++) { + #ifdef VERBOSE_DEBUG + std::cout << "Next varelim because of block clause elim" << std::endl; + #endif //VERBOSE_DEBUG + unlinkClause(*it, lit.var()); + numblockedClauseRemoved++; + } + + vec toRemove2(occur[negLit.toInt()]); + for (ClauseSimp *it = toRemove2.getData(), *end = toRemove2.getDataEnd(); it != end; it++) { + #ifdef VERBOSE_DEBUG + std::cout << "Next varelim because of block clause elim" << std::endl; + #endif //VERBOSE_DEBUG + unlinkClause(*it, lit.var()); + numblockedClauseRemoved++; + } + returnVal = true; + } + + return returnVal; +} + +const bool Subsumer::checkElimedUnassigned() const +{ + for (uint32_t i = 0; i < var_elimed.size(); i++) { + if (var_elimed[i]) { + assert(solver.assigns[i] == l_Undef); + if (solver.assigns[i] != l_Undef) return false; + } + } + + return true; +} + +/* +int hash32shift(int key) +{ + key = ~key + (key << 15); // key = (key << 15) - key - 1; + key = key ^ (key >> 12); + key = key + (key << 2); + key = key ^ (key >> 4); + key = key * 2057; // key = (key + (key << 3)) + (key << 11); + key = key ^ (key >> 16); + return key; +} + +vector Subsumer::merge() +{ + vector var_merged(solver.nVars(), false); + double myTime = cpuTime(); + + vector varData(solver.nVars()); + + for (Var var = 0; var < solver.nVars(); var++) if (solver.decision_var[var] && solver.assigns[var] == l_Undef && !cannot_eliminate[var]) { + varDataStruct thisVar; + + vec& toCountPos = occur[Lit(var, false).toInt()]; + thisVar.numPosClauses = toCountPos.size(); + for (uint32_t i2 = 0; i2 < toCountPos.size(); i2++) { + thisVar.sumPosClauseSize += toCountPos[i2].clause->size(); + for (Lit *l = toCountPos[i2].clause->getData(), *end = l + toCountPos[i2].clause->size(); l != end; l++) { + if (l->var() != var) thisVar.posHash ^= hash32shift(l->toInt()); + } + } + + vec& toCountNeg = occur[Lit(var, true).toInt()]; + thisVar.numNegClauses = toCountNeg.size(); + for (uint32_t i2 = 0; i2 < toCountNeg.size(); i2++) { + thisVar.sumNegClauseSize += toCountNeg[i2].clause->size(); + for (Lit *l = toCountNeg[i2].clause->getData(), *end = l + toCountNeg[i2].clause->size(); l != end; l++) { + if (l->var() != var) thisVar.negHash ^= hash32shift(l->toInt()); + } + } + + varData[var] = thisVar; + } + + map > dataToVar; + for (Var var = 0; var < solver.nVars(); var++) if (solver.decision_var[var] && solver.assigns[var] == l_Undef) { + dataToVar[varData[var]].push_back(var); + assert(dataToVar[varData[var]].size() > 0); + } + + for (map >::iterator it = dataToVar.begin(); it != dataToVar.end(); it++) { + //std::cout << "size: " << it->second.size() << std::endl; + for (uint i = 0; i < it->second.size()-1; i++) { + assert(it->second.size() > i+1); + assert(varData[it->second[i]] == varData[it->second[i+1]]); + } + } + + uint64_t checked = 0; + uint64_t replaced = 0; + for (Var var = 0; var < solver.nVars(); var++) if (solver.decision_var[var] && solver.assigns[var] == l_Undef && !cannot_eliminate[var]) { + varDataStruct tmp = varData[var]; + assert(dataToVar[tmp].size() > 0); + + if (dataToVar[tmp].size() > 0) { + map >::iterator it = dataToVar.find(tmp); + for (uint i = 0; i < it->second.size(); i++) if (it->second[i] != var) { + checked ++; + if (checkIfSame(Lit(var, false), Lit(it->second[i], false)) && + (checkIfSame(Lit(var, true), Lit(it->second[i], true)))) + { + vec ps(2); + ps[0] = Lit(var, false); + ps[1] = Lit(it->second[i], false); + solver.varReplacer->replace(ps, true, 0); + replaced++; + goto next; + + } + } + } + + tmp.reversePolarity(); + if (dataToVar[tmp].size() > 0) { + map >::iterator it = dataToVar.find(tmp); + for (uint i = 0; i < it->second.size(); i++) if (it->second[i] != var) { + checked ++; + if (checkIfSame(Lit(var, true), Lit(it->second[i], false)) && + (checkIfSame(Lit(var, false), Lit(it->second[i], true)))) + { + vec ps(2); + ps[0] = Lit(var, false); + ps[1] = Lit(it->second[i], false); + solver.varReplacer->replace(ps, false, 0); + replaced++; + goto next; + } + } + } + + next:; + } + + std::cout << "c | Merging vars in same clauses. checked: " << std::setw(5) << checked << " replaced: " << std::setw(5) << replaced << " time: " << std::setprecision(2) << std::setw(5) << cpuTime()-myTime << std::endl; + + return var_merged; +}*/ + +/*const bool Subsumer::checkIfSame(const Lit lit1, const Lit lit2) +{ + assert(lit1.var() != lit2.var()); + #ifdef VERBOSE_DEBUG + std::cout << "checking : " << lit1.var()+1 << " , " << lit2.var()+1 << std::endl; + #endif + + vec& occSet1 = occur[lit1.toInt()]; + vec& occSet2 = occur[lit2.toInt()]; + vec tmp; + + for (ClauseSimp *it = occSet1.getData(), *end = it + occSet1.size(); it != end; it++) { + bool found = false; + tmp.clear(); + uint32_t clauseSize = it->clause->size(); + + for (Lit *l = it->clause->getData(), *end2 = l + it->clause->size(); l != end2; l++) { + if (l->var() != lit1.var()) { + tmp.push(*l); + seen_tmp[l->toInt()] = true; + } + } + #ifdef VERBOSE_DEBUG + std::cout << "orig: "; + it->clause->plainPrint(); + #endif + + for (ClauseSimp *it2 = occSet2.getData(), *end2 = it2 + occSet2.size(); (it2 != end2 && !found); it2++) { + if (it2->clause->size() != clauseSize) continue; + + for (Lit *l = it2->clause->getData(), *end3 = l + tmp.size(); l != end3; l++) if (l->var() != lit1.var()) { + if (!seen_tmp[l->toInt()]) goto next; + } + found = true; + + #ifdef VERBOSE_DEBUG + std::cout << "OK: "; + it2->clause->plainPrint(); + #endif + next:; + } + + for (Lit *l = tmp.getData(), *end2 = l + tmp.size(); l != end2; l++) { + seen_tmp[l->toInt()] = false; + } + + if (!found) return false; + } + #ifdef VERBOSE_DEBUG + std::cout << "OK" << std::endl; + #endif + + return true; +}*/ + +/*void Subsumer::pureLiteralRemoval() +{ + for (Var var = 0; var < solver.nVars(); var++) if (solver.decision_var[var] && solver.assigns[var] == l_Undef && !cannot_eliminate[var] && !var_elimed[var] && !solver.varReplacer->varHasBeenReplaced(var)) { + uint32_t numPosClauses = occur[Lit(var, false).toInt()].size(); + uint32_t numNegClauses = occur[Lit(var, true).toInt()].size(); + if (numNegClauses > 0 && numPosClauses > 0) continue; + + if (numNegClauses == 0 && numPosClauses == 0) { + if (solver.decision_var[var]) madeVarNonDecision.push(var); + solver.setDecisionVar(var, false); + pureLitRemoved[var] = true; + pureLitsRemovedNum++; + continue; + } + + if (numPosClauses == 0 && numNegClauses > 0) { + if (solver.decision_var[var]) madeVarNonDecision.push(var); + solver.setDecisionVar(var, false); + pureLitRemoved[var] = true; + assignVar.push(Lit(var, true)); + vec occ(occur[Lit(var, true).toInt()]); + for (ClauseSimp *it = occ.getData(), *end = occ.getDataEnd(); it != end; it++) { + unlinkClause(*it); + pureLitClauseRemoved.push(it->clause); + } + pureLitsRemovedNum++; + continue; + } + + if (numNegClauses == 0 && numPosClauses > 0) { + if (solver.decision_var[var]) madeVarNonDecision.push(var); + solver.setDecisionVar(var, false); + pureLitRemoved[var] = true; + assignVar.push(Lit(var, false)); + vec occ(occur[Lit(var, false).toInt()]); + for (ClauseSimp *it = occ.getData(), *end = occ.getDataEnd(); it != end; it++) { + unlinkClause(*it); + pureLitClauseRemoved.push(it->clause); + } + pureLitsRemovedNum++; + continue; + } + } +}*/ + +/*void Subsumer::undoPureLitRemoval() +{ + assert(solver.ok); + for (uint32_t i = 0; i < madeVarNonDecision.size(); i++) { + assert(!solver.decision_var[madeVarNonDecision[i]]); + assert(solver.assigns[madeVarNonDecision[i]] == l_Undef); + solver.setDecisionVar(madeVarNonDecision[i], true); + pureLitRemoved[madeVarNonDecision[i]] = false; + } + madeVarNonDecision.clear(); + + for (Lit *l = assignVar.getData(), *end = assignVar.getDataEnd(); l != end; l++) { + solver.uncheckedEnqueue(*l); + solver.ok = (solver.propagate() == NULL); + assert(solver.ok); + } + assignVar.clear(); +} + +void Subsumer::reAddPureLitClauses() +{ + for (Clause **it = pureLitClauseRemoved.getData(), **end = pureLitClauseRemoved.getDataEnd(); it != end; it++) { + solver.addClause(**it, (*it)->getGroup()); + clauseFree(*it); + assert(solver.ok); + } + pureLitClauseRemoved.clear(); +}*/ diff --git a/packages/bee/cryptominisat-2.5.1/Solver/Subsumer.h b/packages/bee/cryptominisat-2.5.1/Solver/Subsumer.h new file mode 100755 index 000000000..0597a5418 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/Subsumer.h @@ -0,0 +1,275 @@ +/************************************************************************************************** +Originally From: Solver.C -- (C) Niklas Een, Niklas Sorensson, 2004 +Substantially modified by: Mate Soos (2010) +**************************************************************************************************/ + +#ifndef SIMPLIFIER_H +#define SIMPLIFIER_H + +#include "Solver.h" +#include "Queue.h" +#include "CSet.h" +#include "BitArray.h" +#include +#include +#include +using std::vector; +using std::map; +using std::priority_queue; + +class ClauseCleaner; + +class Subsumer +{ +public: + + //Construct-destruct + Subsumer(Solver& S2); + ~Subsumer(); + + //Called from main + const bool simplifyBySubsumption(); + const bool subsumeWithBinaries(const bool startUp); + void newVar(); + + //Used by cleaner + void unlinkModifiedClause(vec& origClause, ClauseSimp c); + void unlinkModifiedClauseNoDetachNoNULL(vec& origClause, ClauseSimp c); + void unlinkClause(ClauseSimp cc, Var elim = var_Undef); + ClauseSimp linkInClause(Clause& cl); + void linkInAlreadyClause(ClauseSimp& c); + void updateClause(ClauseSimp c); + + + //UnElimination + void extendModel(Solver& solver2); + const bool unEliminate(const Var var); + + + //Get-functions + const vec& getVarElimed() const; + const uint32_t getNumElimed() const; + const bool checkElimedUnassigned() const; + const double getTotalTime() const; + +private: + + friend class ClauseCleaner; + + //Main + vec clauses; + CSet learntClauses; + vec touched; // Is set to true when a variable is part of a removed clause. Also true initially (upon variable creation). + vec touched_list; // A list of the true elements in 'touched'. + CSet cl_touched; // Clauses strengthened. + CSet cl_added; // Clauses created. + vec > occur; // 'occur[index(lit)]' is a list of constraints containing 'lit'. + vec* > iter_vecs; // Vectors currently used for iterations. Removed clauses will be looked up and replaced by 'Clause_NULL'. + vec iter_sets; // Sets currently used for iterations. + vec cannot_eliminate;// + + //Global stats + Solver& solver; + vec var_elimed; //TRUE if var has been eliminated + double totalTime; + uint32_t numElimed; + map > elimedOutVar; + + // Temporaries (to reduce allocation overhead): + // + vec seen_tmp; // (used in various places) + + + //Limits + uint32_t numVarsElimed; + uint32_t numMaxSubsume1; + uint32_t numMaxSubsume0; + uint32_t numMaxElim; + int64_t numMaxBlockToVisit; + uint32_t numMaxBlockVars; + + //Start-up + template + void addFromSolver(vec& cs, bool alsoLearnt = false); + void addBackToSolver(); + void removeWrong(vec& cs); + void removeAssignedVarsFromEliminated(); + void fillCannotEliminate(); + const bool treatLearnts(); + void clearAll(); + + //Iterations + void registerIteration (CSet& iter_set) { iter_sets.push(&iter_set); } + void unregisterIteration(CSet& iter_set) { remove(iter_sets, &iter_set); } + void registerIteration (vec& iter_vec) { iter_vecs.push(&iter_vec); } + void unregisterIteration(vec& iter_vec) { remove(iter_vecs, &iter_vec); } + + // Subsumption: + void touch(const Var x); + void touch(const Lit p); + template + void findSubsumed(const T& ps, const uint32_t abst, vec& out_subsumed); + bool isSubsumed(Clause& ps); + template + uint32_t subsume0(T& ps, uint32_t abs); + template + uint32_t subsume0Orig(const T& ps, uint32_t abs); + void subsume0BIN(const Lit lit, const vec& lits); + void subsume0LearntSet(vec& cs); + void subsume1(ClauseSimp& ps); + void smaller_database(); + void almost_all_database(); + template + bool subset(const T1& A, const T2& B); + bool subsetAbst(uint32_t A, uint32_t B); + + void orderVarsForElim(vec& order); + int substitute(Lit x, Clause& def, vec& poss, vec& negs, vec& new_clauses); + bool maybeEliminate(Var x); + void MigrateToPsNs(vec& poss, vec& negs, vec& ps, vec& ns, const Var x); + void DeallocPsNs(vec& ps, vec& ns); + bool merge(const Clause& ps, const Clause& qs, const Lit without_p, const Lit without_q, vec& out_clause); + + //Subsume with Nonexistent Bins + const bool subsWNonExistBinsFull(const bool startUp); + const bool subsWNonExistBins(const Lit& lit, const bool startUp); + template + void subsume1Partial(const T& ps); + uint32_t subsNonExistentNum; + uint32_t subsNonExistentumFailed; + bool subsNonExistentFinish; + double subsNonExistentTime; + uint32_t subsNonExistentLitsRemoved; + vec addBinaryClauses; + uint32_t doneNum; + vec subsume1PartialSubs; + vec subsume1PartialQs; + vec toVisit; + vec toVisitAll; + vec ps2; + + //hyperBinRes + void addFromSolverAll(vec& cs); + const bool hyperBinRes(); + const bool hyperUtility(vec& iter, const Lit lit, BitArray& inside, vec& addToClauses); + + //merging + //vector merge(); + //const bool checkIfSame(const Lit var1, const Lit var2); + + class VarOcc { + public: + VarOcc(const Var& v, const uint32_t num) : + var(v) + , occurnum(num) + {} + Var var; + uint32_t occurnum; + }; + + struct MyComp { + const bool operator() (const VarOcc& l1, const VarOcc& l2) const { + return l1.occurnum > l2.occurnum; + } + }; + + void blockedClauseRemoval(); + const bool allTautology(const vec& ps, const Lit lit); + uint32_t numblockedClauseRemoved; + const bool tryOneSetting(const Lit lit, const Lit negLit); + priority_queue, MyComp> touchedBlockedVars; + vec touchedBlockedVarsBool; + void touchBlockedVar(const Var x); + double blockTime; + + + //validity checking + void verifyIntegrity(); + + uint32_t clauses_subsumed; + uint32_t literals_removed; + uint32_t origNClauses; + uint32_t numCalls; + bool fullSubsume; + uint32_t clauseID; +}; + +template +void maybeRemove(vec& ws, const T2& elem) +{ + if (ws.size() > 0) + removeW(ws, elem); +} + +inline void Subsumer::touch(const Var x) +{ + if (!touched[x]) { + touched[x] = 1; + touched_list.push(x); + } +} + +inline void Subsumer::touchBlockedVar(const Var x) +{ + if (!touchedBlockedVarsBool[x]) { + touchedBlockedVars.push(VarOcc(x, occur[Lit(x, false).toInt()].size()*occur[Lit(x, true).toInt()].size())); + touchedBlockedVarsBool[x] = 1; + } +} + +inline void Subsumer::touch(const Lit p) +{ + touch(p.var()); +} + +inline bool Subsumer::subsetAbst(uint32_t A, uint32_t B) +{ + return !(A & ~B); +} + +// Assumes 'seen' is cleared (will leave it cleared) +template +bool Subsumer::subset(const T1& A, const T2& B) +{ + for (uint32_t i = 0; i != B.size(); i++) + seen_tmp[B[i].toInt()] = 1; + for (uint32_t i = 0; i != A.size(); i++) { + if (!seen_tmp[A[i].toInt()]) { + for (uint32_t i = 0; i != B.size(); i++) + seen_tmp[B[i].toInt()] = 0; + return false; + } + } + for (uint32_t i = 0; i != B.size(); i++) + seen_tmp[B[i].toInt()] = 0; + return true; +} + +inline void Subsumer::newVar() +{ + occur .push(); + occur .push(); + seen_tmp .push(0); // (one for each polarity) + seen_tmp .push(0); + touched .push(1); + var_elimed .push(0); + touchedBlockedVarsBool.push(0); + cannot_eliminate.push(0); +} + +inline const vec& Subsumer::getVarElimed() const +{ + return var_elimed; +} + +inline const uint32_t Subsumer::getNumElimed() const +{ + return numElimed; +} + +inline const double Subsumer::getTotalTime() const +{ + return totalTime; +} + +#endif //SIMPLIFIER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/VarReplacer.cpp b/packages/bee/cryptominisat-2.5.1/Solver/VarReplacer.cpp new file mode 100755 index 000000000..6ed6ba79d --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/VarReplacer.cpp @@ -0,0 +1,521 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "VarReplacer.h" +#include +#include + +#include "ClauseCleaner.h" +#include "PartHandler.h" +#include "time_mem.h" + +//#define VERBOSE_DEBUG +//#define DEBUG_REPLACER +//#define REPLACE_STATISTICS + +#ifdef VERBOSE_DEBUG +#include +using std::cout; +using std::endl; +#endif + +VarReplacer::VarReplacer(Solver& _solver) : + replacedLits(0) + , replacedVars(0) + , lastReplacedVars(0) + , solver(_solver) +{ +} + +VarReplacer::~VarReplacer() +{ + for (uint i = 0; i != clauses.size(); i++) + clauseFree(clauses[i]); +} + +const bool VarReplacer::performReplaceInternal() +{ + #ifdef VERBOSE_DEBUG + cout << "Replacer started." << endl; + #endif + double time = cpuTime(); + + #ifdef REPLACE_STATISTICS + uint numRedir = 0; + for (uint i = 0; i < table.size(); i++) { + if (table[i].var() != i) + numRedir++; + } + std::cout << "Number of trees:" << reverseTable.size() << std::endl; + std::cout << "Number of redirected nodes:" << numRedir << std::endl; + /*map >::iterator it = reverseTable.begin(); + map >::iterator end = reverseTable.end(); + for (;it != end; it++) { + std::cout << "Tree size: " << it->second.size() << std::endl; + }*/ + #endif //REPLACE_STATISTICS + + solver.clauseCleaner->removeAndCleanAll(true); + if (!solver.ok) return false; + solver.testAllClauseAttach(); + + #ifdef VERBOSE_DEBUG + { + uint i = 0; + for (vector::const_iterator it = table.begin(); it != table.end(); it++, i++) { + if (it->var() == i) continue; + cout << "Replacing var " << i+1 << " with Lit " << (it->sign() ? "-" : "") << it->var()+1 << endl; + } + } + #endif + + Var var = 0; + const vec& removedVars = solver.xorSubsumer->getVarElimed(); + const vec& removedVars2 = solver.partHandler->getSavedState(); + const vec& removedVars3 = solver.subsumer->getVarElimed(); + for (vector::const_iterator it = table.begin(); it != table.end(); it++, var++) { + if (it->var() == var || removedVars[it->var()] || removedVars2[it->var()] != l_Undef || removedVars3[it->var()]) continue; + #ifdef VERBOSE_DEBUG + cout << "Setting var " << var+1 << " to a non-decision var" << endl; + #endif + bool wasDecisionVar = solver.decision_var[var]; + solver.setDecisionVar(var, false); + solver.setDecisionVar(it->var(), true); + + uint32_t& activity1 = solver.activity[var]; + uint32_t& activity2 = solver.activity[it->var()]; + if (wasDecisionVar && activity1 > activity2) { + activity2 = activity1; + solver.order_heap.update(it->var()); + solver.polarity[it->var()] = solver.polarity[var]^it->sign(); + } + + activity1 = 0; + solver.order_heap.update(var); + } + assert(solver.order_heap.heapProperty()); + + if (solver.verbosity >= 2) + std::cout << "c | Replacing " << std::setw(8) << replacedVars-lastReplacedVars << " vars" << std::flush; + + lastReplacedVars = replacedVars; + + solver.testAllClauseAttach(); + if (!replace_set(solver.binaryClauses, true)) goto end; + if (!replace_set(solver.clauses, false)) goto end; + if (!replace_set(solver.learnts, false)) goto end; + if (!replace_set(solver.xorclauses)) goto end; + solver.testAllClauseAttach(); + +end: + for (uint i = 0; i != clauses.size(); i++) + solver.removeClause(*clauses[i]); + clauses.clear(); + + if (solver.verbosity >= 2) { + std::cout << " Replaced " << std::setw(8) << replacedLits<< " lits" + << " Time: " << std::setw(8) << std::fixed << std::setprecision(2) << cpuTime()-time << " s " + << std::setw(10) << " |" << std::endl; + } + + replacedLits = 0; + + solver.order_heap.filter(Solver::VarFilter(solver)); + + return solver.ok; +} + +const bool VarReplacer::replace_set(vec& cs) +{ + XorClause **a = cs.getData(); + XorClause **r = a; + for (XorClause **end = a + cs.size(); r != end; r++) { + XorClause& c = **r; + + bool changed = false; + Var origVar1 = c[0].var(); + Var origVar2 = c[1].var(); + + for (Lit *l = &c[0], *end2 = l + c.size(); l != end2; l++) { + Lit newlit = table[l->var()]; + if (newlit.var() != l->var()) { + changed = true; + *l = Lit(newlit.var(), false); + c.invert(newlit.sign()); + c.setVarChanged(); + replacedLits++; + } + } + + if (changed && handleUpdatedClause(c, origVar1, origVar2)) { + if (!solver.ok) { + for(;r != end; r++) clauseFree(*r); + cs.shrink(r-a); + return false; + } + c.setRemoved(); + solver.freeLater.push(&c); + } else { + *a++ = *r; + } + } + cs.shrink(r-a); + + return solver.ok; +} + +const bool VarReplacer::handleUpdatedClause(XorClause& c, const Var origVar1, const Var origVar2) +{ + uint origSize = c.size(); + std::sort(c.getData(), c.getDataEnd()); + Lit p; + uint32_t i, j; + for (i = j = 0, p = lit_Undef; i != c.size(); i++) { + if (c[i].var() == p.var()) { + //added, but easily removed + j--; + p = lit_Undef; + if (!solver.assigns[c[i].var()].isUndef()) + c.invert(solver.assigns[c[i].var()].getBool()); + } else if (solver.assigns[c[i].var()].isUndef()) //just add + c[j++] = p = c[i]; + else c.invert(solver.assigns[c[i].var()].getBool()); //modify xor_clause_inverted instead of adding + } + c.shrink(i - j); + + #ifdef VERBOSE_DEBUG + cout << "xor-clause after replacing: "; + c.plainPrint(); + #endif + + switch (c.size()) { + case 0: + solver.detachModifiedClause(origVar1, origVar2, origSize, &c); + if (!c.xor_clause_inverted()) + solver.ok = false; + return true; + case 1: + solver.detachModifiedClause(origVar1, origVar2, origSize, &c); + solver.uncheckedEnqueue(Lit(c[0].var(), c.xor_clause_inverted())); + solver.ok = (solver.propagate() == NULL); + return true; + case 2: { + solver.detachModifiedClause(origVar1, origVar2, origSize, &c); + c[0] = c[0].unsign(); + c[1] = c[1].unsign(); + addBinaryXorClause(c, c.xor_clause_inverted(), c.getGroup(), true); + return true; + } + default: + solver.detachModifiedClause(origVar1, origVar2, origSize, &c); + solver.attachClause(c); + return false; + } + + assert(false); + return false; +} + +const bool VarReplacer::replace_set(vec& cs, const bool binClauses) +{ + Clause **a = cs.getData(); + Clause **r = a; + for (Clause **end = a + cs.size(); r != end; r++) { + Clause& c = **r; + bool changed = false; + Lit origLit1 = c[0]; + Lit origLit2 = c[1]; + for (Lit *l = c.getData(), *end2 = l + c.size(); l != end2; l++) { + if (table[l->var()].var() != l->var()) { + changed = true; + *l = table[l->var()] ^ l->sign(); + c.setVarChanged(); + replacedLits++; + } + } + + if (changed && handleUpdatedClause(c, origLit1, origLit2)) { + if (!solver.ok) { + for(;r != end; r++) clauseFree(*r); + cs.shrink(r-a); + return false; + } + } else { + if (!binClauses && c.size() == 2) { + solver.becameBinary++; + solver.binaryClauses.push(&c); + } else + *a++ = *r; + } + } + cs.shrink(r-a); + + return solver.ok; +} + +const bool VarReplacer::handleUpdatedClause(Clause& c, const Lit origLit1, const Lit origLit2) +{ + bool satisfied = false; + std::sort(c.getData(), c.getData() + c.size()); + Lit p; + uint32_t i, j; + const uint origSize = c.size(); + for (i = j = 0, p = lit_Undef; i != origSize; i++) { + if (solver.value(c[i]) == l_True || c[i] == ~p) { + satisfied = true; + break; + } + else if (solver.value(c[i]) != l_False && c[i] != p) + c[j++] = p = c[i]; + } + c.shrink(i - j); + + if (satisfied) { + solver.detachModifiedClause(origLit1, origLit2, origSize, &c); + return true; + } + + switch(c.size()) { + case 0: + solver.detachModifiedClause(origLit1, origLit2, origSize, &c); + solver.ok = false; + return true; + case 1 : + solver.detachModifiedClause(origLit1, origLit2, origSize, &c); + solver.uncheckedEnqueue(c[0]); + solver.ok = (solver.propagate() == NULL); + return true; + default: + solver.detachModifiedClause(origLit1, origLit2, origSize, &c); + solver.attachClause(c); + + return false; + } + + assert(false); + return false; +} + +const vector VarReplacer::getReplacingVars() const +{ + vector replacingVars; + + for(map >::const_iterator it = reverseTable.begin(), end = reverseTable.end(); it != end; it++) { + replacingVars.push_back(it->first); + } + + return replacingVars; +} + +void VarReplacer::extendModelPossible() const +{ + #ifdef VERBOSE_DEBUG + std::cout << "extendModelPossible() called" << std::endl; + #endif //VERBOSE_DEBUG + uint i = 0; + for (vector::const_iterator it = table.begin(); it != table.end(); it++, i++) { + if (it->var() == i) continue; + + #ifdef VERBOSE_DEBUG + cout << "Extending model: var "; solver.printLit(Lit(i, false)); + cout << " to "; solver.printLit(*it); + cout << endl; + #endif + + if (solver.assigns[it->var()] != l_Undef) { + if (solver.assigns[i] == l_Undef) { + bool val = (solver.assigns[it->var()] == l_False); + solver.uncheckedEnqueue(Lit(i, val ^ it->sign())); + } else { + assert(solver.assigns[i].getBool() == (solver.assigns[it->var()].getBool() ^ it->sign())); + } + } + solver.ok = (solver.propagate() == NULL); + assert(solver.ok); + } +} + +void VarReplacer::extendModelImpossible(Solver& solver2) const +{ + + #ifdef VERBOSE_DEBUG + std::cout << "extendModelImpossible() called" << std::endl; + #endif //VERBOSE_DEBUG + + vec tmpClause; + uint i = 0; + for (vector::const_iterator it = table.begin(); it != table.end(); it++, i++) { + if (it->var() == i) continue; + if (solver.assigns[it->var()] == l_Undef) { + assert(solver.assigns[it->var()] == l_Undef); + assert(solver.assigns[i] == l_Undef); + + tmpClause.clear(); + tmpClause.push(Lit(it->var(), true)); + tmpClause.push(Lit(i, it->sign())); + solver2.addClause(tmpClause); + assert(solver2.ok); + + tmpClause.clear(); + tmpClause.push(Lit(it->var(), false)); + tmpClause.push(Lit(i, it->sign()^true)); + solver2.addClause(tmpClause); + assert(solver2.ok); + } + } +} + +template +const bool VarReplacer::replace(T& ps, const bool xor_clause_inverted, const uint group) +{ + // replace ps[0] with ps[1] (or -ps[1]) when xor_clause_inverted==true (or false) + #ifdef VERBOSE_DEBUG + std::cout << "replace() called with var " << ps[0].var()+1 << " and var " << ps[1].var()+1 << " with xor_clause_inverted " << xor_clause_inverted << std::endl; + #endif + + assert(ps.size() == 2); + assert(!ps[0].sign()); + assert(!ps[1].sign()); + #ifdef DEBUG_REPLACER + assert(solver.assigns[ps[0].var()].isUndef()); + assert(solver.assigns[ps[1].var()].isUndef()); + #endif + + Lit lit1 = table[ps[0].var()]; // lit1=ps[0] or to a' where already know that ps[0] == a' + Lit lit2 = table[ps[1].var()]; + + if(lit1.var() == lit2.var()) { // cycle + if(lit1.sign() ^ lit2.sign() == xor_clause_inverted) { + #ifdef VERBOSE_DEBUG + cout << "Inverted cycle in var-replacement -> UNSAT" << endl; + #endif + return (solver.ok = false); + } + return solver.ok; + } + + if(lit1.sign() ^ !xor_clause_inverted) { + lit2 = ~lit2; + } + + setAllThatPointsHereTo(lit1.var(), lit2); + replacedVars++; + addBinaryXorClause(ps, xor_clause_inverted, group); + + return true; +} + +template const bool VarReplacer::replace(vec& ps, const bool xor_clause_inverted, const uint group); +template const bool VarReplacer::replace(XorClause& ps, const bool xor_clause_inverted, const uint group); + +template +void VarReplacer::addBinaryXorClause(T& ps, const bool xor_clause_inverted, const uint group, const bool internal) +{ + assert(internal || (replacedVars > lastReplacedVars)); + #ifdef DEBUG_REPLACER + assert(!ps[0].sign()); + assert(!ps[1].sign()); + #endif + + Clause* c; + ps[0] ^= xor_clause_inverted; + + c = Clause_new(ps, group, false); + if (internal) { + solver.binaryClauses.push(c); + solver.becameBinary++; + } else + clauses.push(c); + solver.attachClause(*c); + + ps[0] ^= true; + ps[1] ^= true; + c = Clause_new(ps, group, false); + if (internal) { + solver.binaryClauses.push(c); + solver.becameBinary++; + } else + clauses.push(c); + solver.attachClause(*c); +} + +template void VarReplacer::addBinaryXorClause(vec& ps, const bool xor_clause_inverted, const uint group, const bool internal); +template void VarReplacer::addBinaryXorClause(XorClause& ps, const bool xor_clause_inverted, const uint group, const bool internal); +/* +bool VarReplacer::alreadyIn(const Var var, const Lit lit) +{ + Lit lit2 = table[var]; + if (lit2.var() == lit.var()) { + if (lit2.sign() != lit.sign()) { + #ifdef VERBOSE_DEBUG + cout << "Inverted cycle in var-replacement -> UNSAT" << endl; + #endif + solver.ok = false; + } + return true; + } + + lit2 = table[lit.var()]; + if (lit2.var() == var) { + if (lit2.sign() != lit.sign()) { + #ifdef VERBOSE_DEBUG + cout << "Inverted cycle in var-replacement -> UNSAT" << endl; + #endif + solver.ok = false; + } + return true; + } + + return false; +} +*/ + +void VarReplacer::setAllThatPointsHereTo(const Var var, const Lit lit) +{ + map >::iterator it = reverseTable.find(var); + if (it != reverseTable.end()) { + for(vector::const_iterator it2 = it->second.begin(), end = it->second.end(); it2 != end; it2++) { + assert(table[*it2].var() == var); + if (lit.var() != *it2) { + table[*it2] = lit ^ table[*it2].sign(); + reverseTable[lit.var()].push_back(*it2); + } + } + reverseTable.erase(it); + } + table[var] = lit; + reverseTable[lit.var()].push_back(var); +} + +void VarReplacer::newVar() +{ + table.push_back(Lit(table.size(), false)); +} + +void VarReplacer::reattachInternalClauses() +{ + Clause **i = clauses.getData(); + Clause **j = i; + for (Clause **end = clauses.getDataEnd(); i != end; i++) { + if (solver.value((**i)[0]) == l_Undef && + solver.value((**i)[1]) == l_Undef) { + solver.attachClause(**i); + *j++ = *i; + } + } + clauses.shrink(i-j); +} diff --git a/packages/bee/cryptominisat-2.5.1/Solver/VarReplacer.h b/packages/bee/cryptominisat-2.5.1/Solver/VarReplacer.h new file mode 100755 index 000000000..cd3e0d32b --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/VarReplacer.h @@ -0,0 +1,147 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef VARREPLACER_H +#define VARREPLACER_H + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#include +#include +using std::map; +using std::vector; + +#include "Solver.h" +#include "SolverTypes.h" +#include "Clause.h" +#include "Vec.h" + +class VarReplacer +{ + public: + VarReplacer(Solver& solver); + ~VarReplacer(); + const bool performReplace(const bool always = false); + const bool needsReplace(); + template + const bool replace(T& ps, const bool xor_clause_inverted, const uint group); + + void extendModelPossible() const; + void extendModelImpossible(Solver& solver2) const; + void reattachInternalClauses(); + + const uint getNumReplacedLits() const; + const uint getNumReplacedVars() const; + const uint getNumLastReplacedVars() const; + const uint getNewToReplaceVars() const; + const uint32_t getNumTrees() const; + const vector getReplacingVars() const; + const vector& getReplaceTable() const; + const vec& getClauses() const; + const bool varHasBeenReplaced(const Var var) const; + const bool replacingVar(const Var var) const; + void newVar(); + + private: + const bool performReplaceInternal(); + + const bool replace_set(vec& cs, const bool binClauses); + const bool replace_set(vec& cs); + const bool handleUpdatedClause(Clause& c, const Lit origLit1, const Lit origLit2); + const bool handleUpdatedClause(XorClause& c, const Var origVar1, const Var origVar2); + template + void addBinaryXorClause(T& ps, const bool xor_clause_inverted, const uint group, const bool internal = false); + + void setAllThatPointsHereTo(const Var var, const Lit lit); +// bool alreadyIn(const Var var, const Lit lit); + + vector table; + map > reverseTable; + vec clauses; + + uint replacedLits; + uint replacedVars; + uint lastReplacedVars; + Solver& solver; +}; + +inline const bool VarReplacer::performReplace(const bool always) +{ + //uint32_t limit = std::min((uint32_t)((double)solver.order_heap.size()*PERCENTAGEPERFORMREPLACE), FIXCLEANREPLACE); + uint32_t limit = (uint32_t)((double)solver.order_heap.size()*PERCENTAGEPERFORMREPLACE); + if ((always && getNewToReplaceVars() > 0) || getNewToReplaceVars() > limit) + return performReplaceInternal(); + + return true; +} + +inline const bool VarReplacer::needsReplace() +{ + uint32_t limit = (uint32_t)((double)solver.order_heap.size()*PERCENTAGEPERFORMREPLACE); + return (getNewToReplaceVars() > limit); +} + +inline const uint VarReplacer::getNumReplacedLits() const +{ + return replacedLits; +} + +inline const uint VarReplacer::getNumReplacedVars() const +{ + return replacedVars; +} + +inline const uint VarReplacer::getNumLastReplacedVars() const +{ + return lastReplacedVars; +} + +inline const uint VarReplacer::getNewToReplaceVars() const +{ + return replacedVars-lastReplacedVars; +} + +inline const vector& VarReplacer::getReplaceTable() const +{ + return table; +} + +inline const vec& VarReplacer::getClauses() const +{ + return clauses; +} + +inline const bool VarReplacer::varHasBeenReplaced(const Var var) const +{ + return table[var].var() != var; +} + +inline const bool VarReplacer::replacingVar(const Var var) const +{ + return (reverseTable.find(var) != reverseTable.end()); +} + +inline const uint32_t VarReplacer::getNumTrees() const +{ + return reverseTable.size(); +} + +#endif //VARREPLACER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/XSet.h b/packages/bee/cryptominisat-2.5.1/Solver/XSet.h new file mode 100755 index 000000000..b898aa4b0 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/XSet.h @@ -0,0 +1,131 @@ +/************************************************************************************************** +From: Solver.C -- (C) Niklas Een, Niklas Sorensson, 2004 +**************************************************************************************************/ + +#ifndef XSET_H +#define XSET_H + +#include "Vec.h" +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +class XorClause; + +template +uint32_t calcXorAbstraction(const T& ps) { + uint32_t abstraction = 0; + for (uint32_t i = 0; i != ps.size(); i++) + abstraction |= 1 << (ps[i].var() & 31); + return abstraction; +} + +//#pragma pack(push) +//#pragma pack(1) +class XorClauseSimp +{ + public: + XorClauseSimp(XorClause* c, const uint32_t _index) : + clause(c) + , index(_index) + {} + + XorClause* clause; + uint32_t index; +}; +//#pragma pack(pop) + +class XSet { + vec where; // Map clause ID to position in 'which'. + vec which; // List of clauses (for fast iteration). May contain 'Clause_NULL'. + vec free; // List of positions holding 'Clause_NULL'. + + public: + //XorClauseSimp& operator [] (uint32_t index) { return which[index]; } + void reserve(uint32_t size) { where.reserve(size);} + uint32_t size(void) const { return which.size(); } + uint32_t nElems(void) const { return which.size() - free.size(); } + + bool add(const XorClauseSimp& c) { + assert(c.clause != NULL); + where.growTo(c.index+1, std::numeric_limits::max()); + if (where[c.index] != std::numeric_limits::max()) { + return true; + } + if (free.size() > 0){ + where[c.index] = free.last(); + which[free.last()] = c; + free.pop(); + }else{ + where[c.index] = which.size(); + which.push(c); + } + return false; + } + + bool exclude(const XorClauseSimp& c) { + assert(c.clause != NULL); + if (c.index >= where.size() || where[c.index] == std::numeric_limits::max()) { + //not inside + return false; + } + free.push(where[c.index]); + which[where[c.index]].clause = NULL; + where[c.index] = std::numeric_limits::max(); + return true; + } + + void clear(void) { + for (uint32_t i = 0; i < which.size(); i++) { + if (which[i].clause != NULL) { + where[which[i].index] = std::numeric_limits::max(); + } + } + which.clear(); + free.clear(); + } + + class iterator + { + public: + iterator(XorClauseSimp* _it) : + it(_it) + {} + + void operator++() + { + it++; + } + + const bool operator!=(const iterator& iter) const + { + return (it != iter.it);; + } + + XorClauseSimp& operator*() { + return *it; + } + + XorClauseSimp*& operator->() { + return it; + } + private: + XorClauseSimp* it; + }; + + iterator begin() + { + return iterator(which.getData()); + } + + iterator end() + { + return iterator(which.getData() + which.size()); + } +}; + +#endif //XSET_H + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/XorFinder.cpp b/packages/bee/cryptominisat-2.5.1/Solver/XorFinder.cpp new file mode 100755 index 000000000..c8150b2c3 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/XorFinder.cpp @@ -0,0 +1,491 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#include "XorFinder.h" + +#include +#include +#include +#include "Solver.h" +#include "VarReplacer.h" +#include "ClauseCleaner.h" +#include "time_mem.h" + +//#define VERBOSE_DEBUG +#ifdef _MSC_VER +#define __builtin_prefetch(a,b) +#endif //_MSC_VER + +#ifdef VERBOSE_DEBUG +#include +using std::cout; +using std::endl; +#endif + +using std::make_pair; + +XorFinder::XorFinder(Solver& _solver, vec& _cls, ClauseCleaner::ClauseSetType _type) : + cls(_cls) + , type(_type) + , solver(_solver) +{ +} + +const bool XorFinder::doNoPart(const uint minSize, const uint maxSize) +{ + uint sumLengths = 0; + double time = cpuTime(); + foundXors = 0; + solver.clauseCleaner->cleanClauses(solver.clauses, ClauseCleaner::clauses); + if (type == ClauseCleaner::binaryClauses) { + solver.clauseCleaner->cleanClauses(solver.binaryClauses, ClauseCleaner::binaryClauses); + } + if (!solver.ok) return false; + + toRemove.clear(); + toRemove.resize(cls.size(), false); + toLeaveInPlace.clear(); + toLeaveInPlace.resize(cls.size(), false); + + table.clear(); + table.reserve(cls.size()); + + ClauseTable unsortedTable; + unsortedTable.reserve(cls.size()); + ClauseTable sortedTable; + sortedTable.reserve(cls.size()); + + for (Clause **it = cls.getData(), **end = it + cls.size(); it != end; it ++) { + if (it+1 != end) + __builtin_prefetch(*(it+1), 0); + //if ((**it)[0].toInt() < (**it)[1].toInt()) + // std::swap((**it)[0], (**it)[1]); + Clause& c = (**it); + if ((*it)->size() != 2) { + bool sorted = true; + for (uint i = 0, size = c.size(); i+1 < size ; i++) { + sorted = (c[i].var() <= c[i+1].var()); + if (!sorted) break; + } + if (!sorted) { + solver.detachClause(c); + std::sort(c.getData(), c.getDataEnd()); + solver.attachClause(c); + } + } else { + std::sort(c.getData(), c.getData()+c.size()); + } + } + + uint i = 0; + for (Clause **it = cls.getData(), **end = it + cls.size(); it != end; it++, i++) { + const uint size = (*it)->size(); + if ( size > maxSize || size < minSize) { + toLeaveInPlace[i] = true; + continue; + } + if ((*it)->getSorted()) sortedTable.push_back(make_pair(*it, i)); + else unsortedTable.push_back(make_pair(*it, i)); + } + + clause_sorter_primary sorter; + + std::sort(unsortedTable.begin(), unsortedTable.end(), clause_sorter_primary()); + //std::sort(sortedTable.begin(), sortedTable.end(), clause_sorter_primary()); + #ifdef DEBUG_XORFIND + for (uint i = 0; i+1 < unsortedTable.size(); i++) { + assert(!sorter(unsortedTable[i+1], unsortedTable[i])); + } + for (uint i = 0; i+1 < sortedTable.size(); i++) { + assert(!sorter(sortedTable[i+1], sortedTable[i])); + } + #endif //DEBUG_XORFIND + + for (uint i = 0, j = 0; i < unsortedTable.size() || j < sortedTable.size();) { + if (j == sortedTable.size()) { + table.push_back(unsortedTable[i++]); + continue; + } + if (i == unsortedTable.size()) { + table.push_back(sortedTable[j++]); + continue; + } + if (sorter(unsortedTable[i], sortedTable[j])) { + table.push_back(unsortedTable[i++]); + } else { + table.push_back(sortedTable[j++]); + } + } + #ifdef DEBUG_XORFIND + for (uint i = 0; i+1 < table.size(); i++) { + assert(!sorter(table[i+1], table[i])); + //table[i].first->plainPrint(); + } + #endif //DEBUG_XORFIND + + if (findXors(sumLengths) == false) goto end; + solver.ok = (solver.propagate() == NULL); + +end: + if (minSize == maxSize && minSize == 2) { + if (solver.verbosity >= 2 || (solver.conflicts == 0 && solver.verbosity >= 1)) { + printf("c | Finding binary XORs: %5.2lf s (found: %7d, avg size: %3.1lf) |\n", cpuTime()-time, foundXors, (double)sumLengths/(double)foundXors); + } + } else { + if (solver.verbosity >= 2 || (solver.verbosity >= 1 && foundXors > 0)) { + printf("c | Finding non-binary XORs: %5.2lf s (found: %7d, avg size: %3.1lf) |\n", cpuTime()-time, foundXors, (double)sumLengths/(double)foundXors); + } + } + + i = 0; + uint32_t j = 0; + uint32_t toSkip = 0; + for (uint end = cls.size(); i != end; i++) { + if (toLeaveInPlace[i]) { + cls[j] = cls[i]; + j++; + toSkip++; + continue; + } + if (!toRemove[table[i-toSkip].second]) { + table[i-toSkip].first->setSorted(); + cls[j] = table[i-toSkip].first; + j++; + } + } + cls.shrink(i-j); + + return solver.ok; +} + +const bool XorFinder::findXors(uint& sumLengths) +{ + #ifdef VERBOSE_DEBUG + cout << "Finding Xors started" << endl; + #endif + + sumLengths = 0; + + ClauseTable::iterator begin = table.begin(); + ClauseTable::iterator end = table.begin(); + vec lits; + bool impair; + while (getNextXor(begin, end, impair)) { + const Clause& c = *(begin->first); + lits.clear(); + for (const Lit *it = &c[0], *cend = it+c.size() ; it != cend; it++) { + lits.push(Lit(it->var(), false)); + } + uint old_group = c.getGroup(); + + #ifdef VERBOSE_DEBUG + cout << "- Found clauses:" << endl; + #endif + + for (ClauseTable::iterator it = begin; it != end; it++) + if (impairSigns(*it->first) == impair){ + #ifdef VERBOSE_DEBUG + it->first->plainPrint(); + #endif + toRemove[it->second] = true; + solver.removeClause(*it->first); + } + + switch(lits.size()) { + case 2: { + solver.varReplacer->replace(lits, impair, old_group); + + #ifdef VERBOSE_DEBUG + XorClause* x = XorClause_new(lits, impair, old_group); + cout << "- Final 2-long xor-clause: "; + x->plainPrint(); + clauseFree(x); + #endif + break; + } + default: { + XorClause* x = XorClause_new(lits, impair, old_group); + solver.xorclauses.push(x); + solver.attachClause(*x); + + #ifdef VERBOSE_DEBUG + cout << "- Final xor-clause: "; + x->plainPrint(); + #endif + } + } + + foundXors++; + sumLengths += lits.size(); + } + + return solver.ok; +} + +void XorFinder::clearToRemove() +{ + assert(toRemove.size() == cls.size()); + + Clause **a = cls.getData(); + Clause **r = cls.getData(); + Clause **cend = cls.getData() + cls.size(); + for (uint i = 0; r != cend; i++) { + if (!toRemove[i]) + *a++ = *r++; + else + r++; + } + cls.shrink(r-a); +} + +bool XorFinder::getNextXor(ClauseTable::iterator& begin, ClauseTable::iterator& end, bool& impair) +{ + ClauseTable::iterator tableEnd = table.end(); + + while(begin != tableEnd && end != tableEnd) { + begin = end; + end++; + uint32_t size = (end == tableEnd ? 0:1); + while(end != tableEnd && clause_vareq(begin->first, end->first)) { + size++; + end++; + } + if (size > 0 && isXor(size, begin, end, impair)) + return true; + } + + return false; +} + +bool XorFinder::clauseEqual(const Clause& c1, const Clause& c2) const +{ + assert(c1.size() == c2.size()); + for (uint i = 0, size = c1.size(); i < size; i++) + if (c1[i].sign() != c2[i].sign()) return false; + + return true; +} + +bool XorFinder::impairSigns(const Clause& c) const +{ + uint num = 0; + for (const Lit *it = &c[0], *end = it + c.size(); it != end; it++) + num += it->sign(); + + return num % 2; +} + +bool XorFinder::isXor(const uint32_t size, const ClauseTable::iterator& begin, const ClauseTable::iterator& end, bool& impair) +{ + const uint requiredSize = 1 << (begin->first->size()-1); + + if (size < requiredSize) + return false; + + #ifdef DEBUG_XORFIND2 + { + vec vars; + Clause& c = *begin->first; + for (uint i = 0; i < c.size(); i++) + vars.push(c[i].var()); + for (ClauseTable::iterator it = begin; it != end; it++) { + Clause& c = *it->first; + for (uint i = 0; i < c.size(); i++) + assert(vars[i] == c[i].var()); + } + clause_sorter_primary sorter; + + for (ClauseTable::iterator it = begin; it != end; it++) { + ClauseTable::iterator it2 = it; + it2++; + if (it2 == end) break; + assert(!sorter(*it2, *it)); + } + } + #endif //DEBUG_XORFIND + + std::sort(begin, end, clause_sorter_secondary()); + + uint numPair = 0; + uint numImpair = 0; + countImpairs(begin, end, numImpair, numPair); + + if (numImpair == requiredSize) { + impair = true; + + return true; + } + + if (numPair == requiredSize) { + impair = false; + + return true; + } + + return false; +} + +void XorFinder::countImpairs(const ClauseTable::iterator& begin, const ClauseTable::iterator& end, uint& numImpair, uint& numPair) const +{ + numImpair = 0; + numPair = 0; + + ClauseTable::const_iterator it = begin; + ClauseTable::const_iterator it2 = begin; + it2++; + + bool impair = impairSigns(*it->first); + numImpair += impair; + numPair += !impair; + + for (; it2 != end;) { + if (!clauseEqual(*it->first, *it2->first)) { + bool impair = impairSigns(*it2->first); + numImpair += impair; + numPair += !impair; + } + it++; + it2++; + } +} + +void XorFinder::addAllXorAsNorm() +{ + uint32_t added = 0; + XorClause **i = solver.xorclauses.getData(), **j = i; + for (XorClause **end = solver.xorclauses.getDataEnd(); i != end; i++) { + if ((*i)->size() > 3) { + *j++ = *i; + continue; + } + added++; + if ((*i)->size() == 3) addXorAsNormal3(**i); + //if ((*i)->size() == 4) addXorAsNormal4(**i); + solver.removeClause(**i); + } + solver.xorclauses.shrink(i-j); + if (solver.verbosity >= 1) { + std::cout << "c | Added XOR as norm:" << added << std::endl; + } +} + +void XorFinder::addXorAsNormal3(XorClause& c) +{ + assert(c.size() == 3); + Clause *tmp; + vec vars; + vec vars2(c.size()); + const bool inverted = c.xor_clause_inverted(); + + for (uint32_t i = 0; i < c.size(); i++) { + vars.push(c[i].var()); + } + + vars2[0] = Lit(vars[0], false ^ inverted); + vars2[1] = Lit(vars[1], false ^ inverted); + vars2[2] = Lit(vars[2], false ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], true ^ inverted); + vars2[1] = Lit(vars[1], true ^ inverted); + vars2[2] = Lit(vars[2], false ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], true ^ inverted); + vars2[1] = Lit(vars[1], false ^ inverted); + vars2[2] = Lit(vars[2], true ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], false ^ inverted); + vars2[1] = Lit(vars[1], true ^ inverted); + vars2[2] = Lit(vars[2], true ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); +} + +void XorFinder::addXorAsNormal4(XorClause& c) +{ + assert(c.size() == 4); + Clause *tmp; + vec vars; + vec vars2(c.size()); + const bool inverted = !c.xor_clause_inverted(); + + for (uint32_t i = 0; i < c.size(); i++) { + vars.push(c[i].var()); + } + + vars2[0] = Lit(vars[0], false ^ inverted); + vars2[1] = Lit(vars[1], false ^ inverted); + vars2[2] = Lit(vars[2], false ^ inverted); + vars2[3] = Lit(vars[3], true ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], false ^ inverted); + vars2[1] = Lit(vars[1], true ^ inverted); + vars2[2] = Lit(vars[2], false ^ inverted); + vars2[3] = Lit(vars[3], false ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], false ^ inverted); + vars2[1] = Lit(vars[1], false ^ inverted); + vars2[2] = Lit(vars[2], true ^ inverted); + vars2[3] = Lit(vars[3], false ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], false ^ inverted); + vars2[1] = Lit(vars[1], false ^ inverted); + vars2[2] = Lit(vars[2], false ^ inverted); + vars2[3] = Lit(vars[3], true ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], false ^ inverted); + vars2[1] = Lit(vars[1], true ^ inverted); + vars2[2] = Lit(vars[2], true ^ inverted); + vars2[3] = Lit(vars[3], true ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], true ^ inverted); + vars2[1] = Lit(vars[1], false ^ inverted); + vars2[2] = Lit(vars[2], true ^ inverted); + vars2[3] = Lit(vars[3], true ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], true ^ inverted); + vars2[1] = Lit(vars[1], true ^ inverted); + vars2[2] = Lit(vars[2], false ^ inverted); + vars2[3] = Lit(vars[3], true ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); + + vars2[0] = Lit(vars[0], true ^ inverted); + vars2[1] = Lit(vars[1], true ^ inverted); + vars2[2] = Lit(vars[2], true ^ inverted); + vars2[3] = Lit(vars[3], false ^ inverted); + tmp = solver.addClauseInt(vars2, c.getGroup()); + if (tmp) solver.clauses.push(tmp); +} + diff --git a/packages/bee/cryptominisat-2.5.1/Solver/XorFinder.h b/packages/bee/cryptominisat-2.5.1/Solver/XorFinder.h new file mode 100755 index 000000000..7f4312582 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/XorFinder.h @@ -0,0 +1,141 @@ +/*********************************************************************************** +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +**************************************************************************************************/ + +#ifndef XORFINDER_H +#define XORFINDER_H + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#define DEBUG_XORFIND +//#define DEBUG_XORFIND2 + +#include "Clause.h" +#include "VarReplacer.h" +#include "ClauseCleaner.h" + +class Solver; + +using std::pair; + +class XorFinder +{ + public: + + XorFinder(Solver& _solver, vec& cls, ClauseCleaner::ClauseSetType _type); + const bool doNoPart(const uint minSize, const uint maxSize); + void addAllXorAsNorm(); + + private: + typedef vector > ClauseTable; + + const bool findXors(uint& sumLengths); + bool getNextXor(ClauseTable::iterator& begin, ClauseTable::iterator& end, bool& impair); + + struct clause_hasher { + size_t operator()(const Clause* c) const + { + size_t hash = 5381; + hash = ((hash << 5) + hash) ^ c->size(); + for (uint i = 0, size = c->size(); i < size; i++) + hash = ((hash << 5) + hash) ^ (*c)[i].var(); + + return hash; + } + }; + + struct clause_sorter_primary { + bool operator()(const pair& c11, const pair& c22) + { + if (c11.first->size() != c22.first->size()) + return (c11.first->size() < c22.first->size()); + + #ifdef DEBUG_XORFIND2 + Clause& c1 = *c11.first; + for (uint i = 0; i+1 < c1.size(); i++) + assert(c1[i].var() <= c1[i+1].var()); + + Clause& c2 = *c22.first; + for (uint i = 0; i+1 < c2.size(); i++) + assert(c2[i].var() <= c2[i+1].var()); + #endif //DEBUG_XORFIND2 + + for (a = c11.first->getData(), b = c22.first->getData(), end = a + c11.first->size(); a != end; a++, b++) { + if (a->var() != b->var()) + return (a->var() > b->var()); + } + + return false; + } + + Lit const *a; + Lit const *b; + Lit const *end; + }; + + struct clause_sorter_secondary { + bool operator()(const pair& c11, const pair& c22) const + { + const Clause& c1 = *(c11.first); + const Clause& c2 = *(c22.first); + + for (uint i = 0, size = c1.size(); i < size; i++) { + if (c1[i].sign() != c2[i].sign()) + return c1[i].sign(); + } + + return false; + } + }; + + bool clause_vareq(const Clause* c1, const Clause* c2) const + { + if (c1->size() != c2->size()) + return false; + + for (uint i = 0, size = c1->size(); i < size; i++) + if ((*c1)[i].var() != (*c2)[i].var()) + return false; + + return true; + } + + ClauseTable table; + vector toRemove; + vector toLeaveInPlace; + void clearToRemove(); + uint32_t foundXors; + + //For adding xor as norm + void addXorAsNormal3(XorClause& c); + void addXorAsNormal4(XorClause& c); + + vec& cls; + ClauseCleaner::ClauseSetType type; + + bool clauseEqual(const Clause& c1, const Clause& c2) const; + bool impairSigns(const Clause& c) const; + void countImpairs(const ClauseTable::iterator& begin, const ClauseTable::iterator& end, uint& numImpair, uint& numPair) const; + bool isXor(const uint32_t size, const ClauseTable::iterator& begin, const ClauseTable::iterator& end, bool& impair); + + Solver& solver; +}; + +#endif //XORFINDER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/XorSubsumer.cpp b/packages/bee/cryptominisat-2.5.1/Solver/XorSubsumer.cpp new file mode 100755 index 000000000..7ae84e60f --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/XorSubsumer.cpp @@ -0,0 +1,600 @@ +/************************************************************************************************** +Originally From: Solver.C -- (C) Niklas Een, Niklas Sorensson, 2004 +Substantially modified by: Mate Soos (2010) +**************************************************************************************************/ + +#include "Solver.h" +#include "XorSubsumer.h" +#include "ClauseCleaner.h" +#include "time_mem.h" +#include "assert.h" +#include +#include "VarReplacer.h" + +#ifdef _MSC_VER +#define __builtin_prefetch(a,b,c) +#endif //_MSC_VER + +//#define VERBOSE_DEBUG +#ifdef VERBOSE_DEBUG +#define VERBOSE_DEBUGSUBSUME0 +#define BIT_MORE_VERBOSITY +#endif + +#ifdef VERBOSE_DEBUG +using std::cout; +using std::endl; +#endif //VERBOSE_DEBUG + +XorSubsumer::XorSubsumer(Solver& s): + solver(s) + , totalTime(0.0) + , numElimed(0) + , localSubstituteUseful(0) +{ +}; + +// Will put NULL in 'cs' if clause removed. +void XorSubsumer::subsume0(XorClauseSimp& ps) +{ + #ifdef VERBOSE_DEBUGSUBSUME0 + cout << "subsume0 orig clause:"; + ps.clause->plainPrint(); + #endif + + vec origClause(ps.clause->size()); + std::copy(ps.clause->getData(), ps.clause->getDataEnd(), origClause.getData()); + const bool origClauseInverted = ps.clause->xor_clause_inverted(); + + vec unmatchedPart; + bool needUnlinkPS = false; + + vec subs; + findSubsumed(*ps.clause, subs); + for (uint32_t i = 0; i < subs.size(); i++){ + XorClause* tmp = subs[i].clause; + findUnMatched(origClause, *tmp, unmatchedPart); + if (unmatchedPart.size() == 0) { + #ifdef VERBOSE_DEBUGSUBSUME0 + cout << "subsume0 removing:"; + subs[i].clause->plainPrint(); + #endif + clauses_subsumed++; + assert(tmp->size() == origClause.size()); + if (origClauseInverted == tmp->xor_clause_inverted()) { + unlinkClause(subs[i]); + clauseFree(tmp); + } else { + solver.ok = false; + return; + } + } else { + assert(unmatchedPart.size() > 0); + clauses_cut++; + #ifdef VERBOSE_DEBUG + std::cout << "Cutting xor-clause:"; + subs[i].clause->plainPrint(); + #endif //VERBOSE_DEBUG + XorClause *c = solver.addXorClauseInt(unmatchedPart, tmp->xor_clause_inverted() ^ !origClauseInverted, tmp->getGroup()); + if (c != NULL) { + linkInClause(*c); + needUnlinkPS = true; + } + if (!solver.ok) return; + } + unmatchedPart.clear(); + } + + if (needUnlinkPS) { + XorClause* tmp = ps.clause; + unlinkClause(ps); + clauseFree(tmp); + } +} + +void XorSubsumer::findUnMatched(vec& A, XorClause& B, vec& unmatchedPart) +{ + for (uint32_t i = 0; i != B.size(); i++) + seen_tmp[B[i].var()] = 1; + for (uint32_t i = 0; i != A.size(); i++) + seen_tmp[A[i].var()] = 0; + for (uint32_t i = 0; i != B.size(); i++) { + if (seen_tmp[B[i].var()] == 1) { + unmatchedPart.push(Lit(B[i].var(), false)); + seen_tmp[B[i].var()] = 0; + } + } +} + +void XorSubsumer::unlinkClause(XorClauseSimp c, const Var elim) +{ + XorClause& cl = *c.clause; + + for (uint32_t i = 0; i < cl.size(); i++) { + maybeRemove(occur[cl[i].var()], &cl); + } + + if (elim != var_Undef) + elimedOutVar[elim].push_back(c.clause); + + solver.detachClause(cl); + + clauses[c.index].clause = NULL; +} + +void XorSubsumer::unlinkModifiedClause(vec& origClause, XorClauseSimp c) +{ + for (uint32_t i = 0; i < origClause.size(); i++) { + maybeRemove(occur[origClause[i].var()], c.clause); + } + + solver.detachModifiedClause(origClause[0].var(), origClause[1].var(), origClause.size(), c.clause); + + clauses[c.index].clause = NULL; +} + +void XorSubsumer::unlinkModifiedClauseNoDetachNoNULL(vec& origClause, XorClauseSimp c) +{ + for (uint32_t i = 0; i < origClause.size(); i++) { + maybeRemove(occur[origClause[i].var()], c.clause); + } +} + +XorClauseSimp XorSubsumer::linkInClause(XorClause& cl) +{ + XorClauseSimp c(&cl, clauseID++); + clauses.push(c); + for (uint32_t i = 0; i < cl.size(); i++) { + occur[cl[i].var()].push(c); + } + + return c; +} + +void XorSubsumer::linkInAlreadyClause(XorClauseSimp& c) +{ + XorClause& cl = *c.clause; + + for (uint32_t i = 0; i < c.clause->size(); i++) { + occur[cl[i].var()].push(c); + } +} + +void XorSubsumer::addFromSolver(vec& cs) +{ + clauseID = 0; + clauses.clear(); + XorClause **i = cs.getData(); + for (XorClause **end = i + cs.size(); i != end; i++) { + if (i+1 != end) + __builtin_prefetch(*(i+1), 1, 1); + + linkInClause(**i); + if ((*i)->getVarChanged() || (*i)->getStrenghtened()) + (*i)->calcXorAbstraction(); + } + cs.clear(); + cs.push(NULL); //HACK --to force xor-propagation +} + +void XorSubsumer::addBackToSolver() +{ + solver.xorclauses.pop(); //HACK --to force xor-propagation + for (uint32_t i = 0; i < clauses.size(); i++) { + if (clauses[i].clause != NULL) { + solver.xorclauses.push(clauses[i].clause); + clauses[i].clause->unsetStrenghtened(); + clauses[i].clause->unsetVarChanged(); + } + } + for (Var var = 0; var < solver.nVars(); var++) { + occur[var].clear(); + } + clauses.clear(); + clauseID = 0; +} + +void XorSubsumer::fillCannotEliminate() +{ + std::fill(cannot_eliminate.getData(), cannot_eliminate.getDataEnd(), false); + for (uint32_t i = 0; i < solver.clauses.size(); i++) + addToCannotEliminate(solver.clauses[i]); + + for (uint32_t i = 0; i < solver.binaryClauses.size(); i++) + if (!(*solver.binaryClauses[i]).learnt()) addToCannotEliminate(solver.binaryClauses[i]); + + const vec& tmp = solver.varReplacer->getClauses(); + for (uint32_t i = 0; i < tmp.size(); i++) + addToCannotEliminate(tmp[i]); + + for (uint32_t i = 0; i < solver.assumptions.size(); i++) + cannot_eliminate[solver.assumptions[i].var()] = true; + + #ifdef VERBOSE_DEBUG + uint32_t tmpNum = 0; + for (uint32_t i = 0; i < cannot_eliminate.size(); i++) + if (cannot_eliminate[i]) + tmpNum++; + std::cout << "Cannot eliminate num:" << tmpNum << std::endl; + #endif +} + +void XorSubsumer::extendModel(Solver& solver2) +{ + assert(checkElimedUnassigned()); + vec tmp; + typedef map > elimType; + for (elimType::iterator it = elimedOutVar.begin(), end = elimedOutVar.end(); it != end; it++) { + #ifdef VERBOSE_DEBUG + Var var = it->first; + std::cout << "Reinserting elimed var: " << var+1 << std::endl; + #endif + + for (vector::iterator it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; it2++) { + XorClause& c = **it2; + #ifdef VERBOSE_DEBUG + std::cout << "Reinserting Clause: "; + c.plainPrint(); + #endif + tmp.clear(); + tmp.growTo(c.size()); + std::copy(c.getData(), c.getDataEnd(), tmp.getData()); + bool inverted = c.xor_clause_inverted(); + solver2.addXorClause(tmp, inverted); + assert(solver2.ok); + } + } +} + +const bool XorSubsumer::localSubstitute() +{ + vec tmp; + for (Var var = 0; var < occur.size(); var++) { + vec& occ = occur[var]; + + if (occ.size() <= 1) continue; + for (uint32_t i = 0; i < occ.size(); i++) { + XorClause& c1 = *occ[i].clause; + for (uint32_t i2 = i+1; i2 < occ.size(); i2++) { + XorClause& c2 = *occ[i2].clause; + tmp.clear(); + tmp.growTo(c1.size() + c2.size()); + std::copy(c1.getData(), c1.getDataEnd(), tmp.getData()); + std::copy(c2.getData(), c2.getDataEnd(), tmp.getData() + c1.size()); + clearDouble(tmp); + if (tmp.size() <= 2) { + #ifdef VERBOSE_DEBUG + std::cout << "Local substiuting. Clause1:"; c1.plainPrint(); + std::cout << "Clause 2:"; c2.plainPrint(); + #endif //VERBOSE_DEBUG + localSubstituteUseful++; + uint32_t lastSize = solver.varReplacer->getClauses().size(); + solver.addXorClauseInt(tmp, c1.xor_clause_inverted() ^ !c2.xor_clause_inverted(), c1.getGroup()); + for (uint32_t i = lastSize; i < solver.varReplacer->getClauses().size(); i++) + addToCannotEliminate(solver.varReplacer->getClauses()[i]); + if (!solver.ok) { + #ifdef VERBOSE_DEBUG + std::cout << "solver.ok is false after local substitution" << std::endl; + #endif //VERBOSE_DEBUG + return false; + } + } + } + } + } + + return true; +} + +void XorSubsumer::clearDouble(vec& ps) const +{ + std::sort(ps.getData(), ps.getDataEnd()); + Lit p; + uint32_t i, j; + for (i = j = 0, p = lit_Undef; i != ps.size(); i++) { + if (ps[i].var() == p.var()) { + //added, but easily removed + j--; + p = lit_Undef; + } else + ps[j++] = p = ps[i]; + } + ps.shrink(i - j); +} + +void XorSubsumer::removeWrong(vec& cs) +{ + Clause **i = cs.getData(); + Clause **j = i; + for (Clause **end = i + cs.size(); i != end; i++) { + Clause& c = **i; + if (!c.learnt()) { + *j++ = *i; + continue; + } + bool remove = false; + for (Lit *l = c.getData(), *end2 = l+c.size(); l != end2; l++) { + if (var_elimed[l->var()]) { + remove = true; + solver.detachClause(c); + clauseFree(&c); + break; + } + } + if (!remove) + *j++ = *i; + } + cs.shrink(i-j); +} + + +const bool XorSubsumer::removeDependent() +{ + for (Var var = 0; var < occur.size(); var++) { + if (cannot_eliminate[var] || !solver.decision_var[var] || solver.assigns[var] != l_Undef) continue; + vec& occ = occur[var]; + + if (occ.size() == 1) { + #ifdef VERBOSE_DEBUG + std::cout << "Eliminating dependent var " << var + 1 << std::endl; + std::cout << "-> Removing dependent clause "; occ[0].clause->plainPrint(); + #endif //VERBOSE_DEBUG + unlinkClause(occ[0], var); + solver.setDecisionVar(var, false); + var_elimed[var] = true; + numElimed++; + } else if (occ.size() == 2) { + vec lits; + XorClause& c1 = *(occ[0].clause); + lits.growTo(c1.size()); + std::copy(c1.getData(), c1.getDataEnd(), lits.getData()); + bool inverted = c1.xor_clause_inverted(); + + XorClause& c2 = *(occ[1].clause); + lits.growTo(lits.size() + c2.size()); + std::copy(c2.getData(), c2.getDataEnd(), lits.getData() + c1.size()); + inverted ^= !c2.xor_clause_inverted(); + uint32_t group = c2.getGroup(); + + #ifdef VERBOSE_DEBUG + std::cout << "Eliminating var " << var + 1 << " present in 2 xor-clauses" << std::endl; + std::cout << "-> Removing xor clause "; occ[0].clause->plainPrint(); + std::cout << "-> Removing xor clause "; occ[1].clause->plainPrint(); + #endif //VERBOSE_DEBUG + XorClauseSimp toUnlink0 = occ[0]; + XorClauseSimp toUnlink1 = occ[1]; + unlinkClause(toUnlink0); + clauseFree(toUnlink0.clause); + unlinkClause(toUnlink1, var); + solver.setDecisionVar(var, false); + var_elimed[var] = true; + numElimed++; + + uint32_t lastSize = solver.varReplacer->getClauses().size(); + XorClause* c = solver.addXorClauseInt(lits, inverted, group); + #ifdef VERBOSE_DEBUG + if (c != NULL) { + std::cout << "-> Added combined xor clause:"; c->plainPrint(); + } else + std::cout << "-> Combined xor clause is NULL" << std::endl; + #endif + if (c != NULL) linkInClause(*c); + for (uint32_t i = lastSize; i < solver.varReplacer->getClauses().size(); i++) + addToCannotEliminate(solver.varReplacer->getClauses()[i]); + if (!solver.ok) { + #ifdef VERBOSE_DEBUG + std::cout << "solver.ok is false after var-elim through xor" << std::endl; + #endif //VERBOSE_DEBUG + return false; + } + } + } + + return true; +} + +inline void XorSubsumer::addToCannotEliminate(Clause* it) +{ + const Clause& c = *it; + for (uint32_t i2 = 0; i2 < c.size(); i2++) + cannot_eliminate[c[i2].var()] = true; +} + +const bool XorSubsumer::unEliminate(const Var var) +{ + assert(var_elimed[var]); + typedef map > elimType; + elimType::iterator it = elimedOutVar.find(var); + + //MUST set to decision, since it would never have been eliminated + //had it not been decision var + solver.setDecisionVar(var, true); + var_elimed[var] = false; + numElimed--; + assert(it != elimedOutVar.end()); + + FILE* backup_libraryCNFfile = solver.libraryCNFFile; + solver.libraryCNFFile = NULL; + for (vector::iterator it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; it2++) { + XorClause& c = **it2; + solver.addXorClause(c, c.xor_clause_inverted()); + clauseFree(&c); + } + solver.libraryCNFFile = backup_libraryCNFfile; + elimedOutVar.erase(it); + + return solver.ok; +} + + +const bool XorSubsumer::simplifyBySubsumption(const bool doFullSubsume) +{ + double myTime = cpuTime(); + uint32_t origTrailSize = solver.trail.size(); + clauses_subsumed = 0; + clauses_cut = 0; + clauseID = 0; + uint32_t lastNumElimed = numElimed; + localSubstituteUseful = 0; + while (solver.performReplace && solver.varReplacer->needsReplace()) { + if (!solver.varReplacer->performReplace()) + return false; + } + + for (Var var = 0; var < solver.nVars(); var++) { + occur[var].clear(); + } + solver.findAllAttach(); + + solver.clauseCleaner->cleanClauses(solver.xorclauses, ClauseCleaner::xorclauses); + if (!solver.ok) return false; + solver.testAllClauseAttach(); + + clauses.clear(); + clauses.reserve(solver.xorclauses.size()); + addFromSolver(solver.xorclauses); + #ifdef BIT_MORE_VERBOSITY + std::cout << "c time to link in:" << cpuTime()-myTime << std::endl; + #endif + + origNClauses = clauses.size(); + + if (!solver.ok) return false; + #ifdef VERBOSE_DEBUG + std::cout << "c clauses:" << clauses.size() << std::endl; + #endif + + bool replaced = true; + bool propagated = false; + while (replaced || propagated) { + replaced = propagated = false; + for (uint32_t i = 0; i < clauses.size(); i++) { + if (clauses[i].clause != NULL) { + subsume0(clauses[i]); + if (!solver.ok) { + addBackToSolver(); + return false; + } + } + } + + propagated = (solver.qhead != solver.trail.size()); + solver.ok = (solver.propagate() == NULL); + if (!solver.ok) { + std::cout << "c (contradiction during subsumption)" << std::endl; + return false; + } + solver.clauseCleaner->cleanXorClausesBewareNULL(clauses, ClauseCleaner::xorSimpClauses, *this); + if (!solver.ok) return false; + testAllClauseAttach(); + + fillCannotEliminate(); + if (solver.conglomerateXors && !removeDependent()) { + addBackToSolver(); + return false; + } + testAllClauseAttach(); + + if (solver.heuleProcess && !localSubstitute()) { + addBackToSolver(); + return false; + } + testAllClauseAttach(); + + /*if (solver.performReplace && solver.varReplacer->needsReplace()) { + addBackToSolver(); + while (solver.performReplace && solver.varReplacer->needsReplace()) { + replaced = true; + if (!solver.varReplacer->performReplace()) + return false; + } + addFromSolver(solver.xorclauses); + }*/ + } + + solver.order_heap.filter(Solver::VarFilter(solver)); + + removeWrong(solver.learnts); + removeWrong(solver.binaryClauses); + addBackToSolver(); + + if (solver.verbosity >= 1) { + std::cout << "c | x-sub: " << std::setw(5) << clauses_subsumed + << " x-cut: " << std::setw(6) << clauses_cut + << " vfix: " << std::setw(6) <clause == NULL) continue; + const XorClause& c = *it->clause; + assert(find(solver.xorwatches[c[0].var()], &c)); + assert(find(solver.xorwatches[c[1].var()], &c)); + if (solver.assigns[c[0].var()]!=l_Undef || solver.assigns[c[1].var()]!=l_Undef) { + for (uint i = 0; i < c.size();i++) { + assert(solver.assigns[c[i].var()] != l_Undef); + } + } + } +} +#else +inline void XorSubsumer::testAllClauseAttach() const +{ + return; +} +#endif //DEBUG_ATTACH + +void XorSubsumer::findSubsumed(XorClause& ps, vec& out_subsumed) +{ + #ifdef VERBOSE_DEBUGSUBSUME0 + cout << "findSubsumed: "; + for (uint32_t i = 0; i < ps.size(); i++) { + if (ps[i].sign()) printf("-"); + printf("%d ", ps[i].var() + 1); + } + printf("0\n"); + #endif + + uint32_t min_i = 0; + for (uint32_t i = 1; i < ps.size(); i++){ + if (occur[ps[i].var()].size() < occur[ps[min_i].var()].size()) + min_i = i; + } + + vec& cs = occur[ps[min_i].var()]; + for (XorClauseSimp *it = cs.getData(), *end = it + cs.size(); it != end; it++){ + if (it+1 != end) + __builtin_prefetch((it+1)->clause, 1, 1); + + if (it->clause != &ps && subsetAbst(ps.getAbst(), it->clause->getAbst()) && ps.size() <= it->clause->size() && subset(ps, *it->clause)) { + out_subsumed.push(*it); + #ifdef VERBOSE_DEBUGSUBSUME0 + cout << "subsumed: "; + it->clause->plainPrint(); + #endif + } + } +} + +const bool XorSubsumer::checkElimedUnassigned() const +{ + for (uint32_t i = 0; i < var_elimed.size(); i++) { + if (var_elimed[i]) { + assert(solver.assigns[i] == l_Undef); + if (solver.assigns[i] != l_Undef) return false; + } + } + + return true; +} diff --git a/packages/bee/cryptominisat-2.5.1/Solver/XorSubsumer.h b/packages/bee/cryptominisat-2.5.1/Solver/XorSubsumer.h new file mode 100755 index 000000000..f49bc19af --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/XorSubsumer.h @@ -0,0 +1,140 @@ +/************************************************************************************************** +Originally From: Solver.C -- (C) Niklas Een, Niklas Sorensson, 2004 +Substantially modified by: Mate Soos (2010) +**************************************************************************************************/ + +#ifndef XORSIMPLIFIER_H +#define XORSIMPLIFIER_H + +#include "Solver.h" +#include "Vec.h" +#include "XSet.h" +#include +#include + +using std::vector; +using std::map; + + +class ClauseCleaner; + +class XorSubsumer +{ +public: + + XorSubsumer(Solver& S2); + const bool simplifyBySubsumption(const bool doFullSubsume = false); + void unlinkModifiedClause(vec& origClause, XorClauseSimp c); + void unlinkModifiedClauseNoDetachNoNULL(vec& origClause, XorClauseSimp c); + void unlinkClause(XorClauseSimp cc, Var elim = var_Undef); + XorClauseSimp linkInClause(XorClause& cl); + void linkInAlreadyClause(XorClauseSimp& c); + void newVar(); + void extendModel(Solver& solver2); + const uint32_t getNumElimed() const; + const vec& getVarElimed() const; + const bool unEliminate(const Var var); + const bool checkElimedUnassigned() const; + const double getTotalTime() const; + +private: + + friend class ClauseCleaner; + + //Main + vec clauses; + vec > occur; // 'occur[index(lit)]' is a list of constraints containing 'lit'. + Solver& solver; // The Solver + + // Temporaries (to reduce allocation overhead): + // + vec seen_tmp; // (used in various places) + + //Start-up + void addFromSolver(vec& cs); + void addBackToSolver(); + + // Subsumption: + void findSubsumed(XorClause& ps, vec& out_subsumed); + bool isSubsumed(XorClause& ps); + void subsume0(XorClauseSimp& ps); + template + bool subset(const T1& A, const T2& B); + bool subsetAbst(uint32_t A, uint32_t B); + void findUnMatched(vec& A, XorClause& B, vec& unmatchedPart); + + //helper + void testAllClauseAttach() const; + + //dependent removal + const bool removeDependent(); + void fillCannotEliminate(); + vec cannot_eliminate; + void addToCannotEliminate(Clause* it); + void removeWrong(vec& cs); + + //Global stats + double totalTime; + map > elimedOutVar; + vec var_elimed; + uint32_t numElimed; + + //Heule-process + void clearDouble(vec& ps) const; + const bool localSubstitute(); + uint32_t localSubstituteUseful; + + uint32_t clauses_subsumed; + uint32_t clauses_cut; + uint32_t origNClauses; + uint32_t clauseID; +}; + +inline bool XorSubsumer::subsetAbst(uint32_t A, uint32_t B) +{ + return !(A & ~B); +} + +// Assumes 'seen' is cleared (will leave it cleared) +template +bool XorSubsumer::subset(const T1& A, const T2& B) +{ + for (uint32_t i = 0; i != B.size(); i++) + seen_tmp[B[i].var()] = 1; + for (uint32_t i = 0; i != A.size(); i++) { + if (!seen_tmp[A[i].var()]) { + for (uint32_t i = 0; i != B.size(); i++) + seen_tmp[B[i].var()] = 0; + return false; + } + } + for (uint32_t i = 0; i != B.size(); i++) + seen_tmp[B[i].var()] = 0; + return true; +} + +inline void XorSubsumer::newVar() +{ + occur .push(); + seen_tmp .push(0); + cannot_eliminate.push(0); + var_elimed.push(0); +} + +inline const vec& XorSubsumer::getVarElimed() const +{ + return var_elimed; +} + +inline const uint32_t XorSubsumer::getNumElimed() const +{ + return numElimed; +} + +inline const double XorSubsumer::getTotalTime() const +{ + return totalTime; +} + + +#endif //XORSIMPLIFIER_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/constants.h b/packages/bee/cryptominisat-2.5.1/Solver/constants.h new file mode 100755 index 000000000..42a454f7f --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/constants.h @@ -0,0 +1,50 @@ +/****************************************************************************************[Solver.h] +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +glucose -- Gilles Audemard, Laurent Simon (2008) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#define RATIOREMOVECLAUSES 3 +#define NBCLAUSESBEFOREREDUCE 20000 +#define DYNAMICNBLEVEL +#define UPDATEVARACTIVITY +#define FIXCLEANREPLACE 30U +#define PERCENTAGEPERFORMREPLACE 0.01 +#define PERCENTAGECLEANCLAUSES 0.01 +#define MAX_CLAUSENUM_XORFIND 5000000 +#define BINARY_TO_XOR_APPROX 4.0 +#define FULLRESTART_MULTIPLIER 250 +#define SIMPLIFY_MULTIPLIER 300 +#define FULLRESTART_MULTIPLIER_MULTIPLIER 3.5 +#define RESTART_TYPE_DECIDER_FROM 2 +#define RESTART_TYPE_DECIDER_UNTIL 7 +//#define VERBOSE_DEBUG_XOR +//#define VERBOSE_DEBUG +//#define USE_GAUSS // enable Gaussian elimination +//#define DEBUG_GAUSS +#define MIN_GAUSS_XOR_CLAUSES 5 +#define MAX_GAUSS_XOR_CLAUSES 30000 +#define MAX_OLD_LEARNTS 2000000 +//#define DEBUG_ATTACH +#define RANDOM_LOOKAROUND_SEARCHSPACE +//#define USE_OLD_POLARITIES +//#define DEBUG_VARELIM +#define BURST_SEARCH + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif //HAVE_CONFIG_H diff --git a/packages/bee/cryptominisat-2.5.1/Solver/msvc/stdint.h b/packages/bee/cryptominisat-2.5.1/Solver/msvc/stdint.h new file mode 100755 index 000000000..fee624db1 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/msvc/stdint.h @@ -0,0 +1,250 @@ +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2008 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we should wrap include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#ifdef __cplusplus +extern "C" { +#endif +# include +#ifdef __cplusplus +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS ] + +#ifndef uint +#define uint unsigned int +#endif + +#endif // _MSC_STDINT_H_ ] diff --git a/packages/bee/cryptominisat-2.5.1/Solver/singleton.hpp b/packages/bee/cryptominisat-2.5.1/Solver/singleton.hpp new file mode 100755 index 000000000..db7ca676b --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/singleton.hpp @@ -0,0 +1,107 @@ +// Copyright (C) 2000 Stephen Cleary +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org for updates, documentation, and revision history. + +#ifndef BOOST_POOL_SINGLETON_HPP +#define BOOST_POOL_SINGLETON_HPP + +// The following code might be put into some Boost.Config header in a later revision +#ifdef __BORLANDC__ +# pragma option push -w-inl +#endif + +// +// The following helper classes are placeholders for a generic "singleton" +// class. The classes below support usage of singletons, including use in +// program startup/shutdown code, AS LONG AS there is only one thread +// running before main() begins, and only one thread running after main() +// exits. +// +// This class is also limited in that it can only provide singleton usage for +// classes with default constructors. +// + +// The design of this class is somewhat twisted, but can be followed by the +// calling inheritance. Let us assume that there is some user code that +// calls "singleton_default::instance()". The following (convoluted) +// sequence ensures that the same function will be called before main(): +// instance() contains a call to create_object.do_nothing() +// Thus, object_creator is implicitly instantiated, and create_object +// must exist. +// Since create_object is a static member, its constructor must be +// called before main(). +// The constructor contains a call to instance(), thus ensuring that +// instance() will be called before main(). +// The first time instance() is called (i.e., before main()) is the +// latest point in program execution where the object of type T +// can be created. +// Thus, any call to instance() will auto-magically result in a call to +// instance() before main(), unless already present. +// Furthermore, since the instance() function contains the object, instead +// of the singleton_default class containing a static instance of the +// object, that object is guaranteed to be constructed (at the latest) in +// the first call to instance(). This permits calls to instance() from +// static code, even if that code is called before the file-scope objects +// in this file have been initialized. + +namespace boost { + +namespace details { +namespace pool { + +// T must be: no-throw default constructible and no-throw destructible +template +struct singleton_default +{ + private: + struct object_creator + { + // This constructor does nothing more than ensure that instance() + // is called before main() begins, thus creating the static + // T object before multithreading race issues can come up. + object_creator() { singleton_default::instance(); } + inline void do_nothing() const { } + }; + static object_creator create_object; + + singleton_default(); + + public: + typedef T object_type; + + // If, at any point (in user code), singleton_default::instance() + // is called, then the following function is instantiated. + static object_type & instance() + { + // This is the object that we return a reference to. + // It is guaranteed to be created before main() begins because of + // the next line. + static object_type obj; + + // The following line does nothing else than force the instantiation + // of singleton_default::create_object, whose constructor is + // called before main() begins. + create_object.do_nothing(); + + return obj; + } +}; +template +typename singleton_default::object_creator +singleton_default::create_object; + +} // namespace pool +} // namespace details + +} // namespace boost + +// The following code might be put into some Boost.Config header in a later revision +#ifdef __BORLANDC__ +# pragma option pop +#endif + +#endif diff --git a/packages/bee/cryptominisat-2.5.1/Solver/time_mem.h b/packages/bee/cryptominisat-2.5.1/Solver/time_mem.h new file mode 100755 index 000000000..c76b445f1 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/Solver/time_mem.h @@ -0,0 +1,96 @@ +/****************************************************************************************[Solver.h] +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +CryptoMiniSat -- Copyright (c) 2009 Mate Soos + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef TIME_MEM_H +#define TIME_MEM_H + +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +#ifdef _MSC_VER +#include + +static inline double cpuTime(void) +{ + return (double)clock() / CLOCKS_PER_SEC; +} +#else //_MSC_VER +#ifdef CROSS_COMPILE +#include + +static inline double cpuTime(void) +{ + return (double)clock() / CLOCKS_PER_SEC; +} +#else //CROSS_COMPILE +#include +#include +#include + +static inline double cpuTime(void) +{ + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + return (double)ru.ru_utime.tv_sec + (double)ru.ru_utime.tv_usec / 1000000; +} +#endif //CROSS_COMPILE +#endif //_MSC_VER + + +#if defined(__linux__) +static inline int memReadStat(int field) +{ + char name[256]; + pid_t pid = getpid(); + sprintf(name, "/proc/%d/statm", pid); + FILE* in = fopen(name, "rb"); + if (in == NULL) return 0; + int value; + for (; field >= 0; field--) + fscanf(in, "%d", &value); + fclose(in); + return value; +} +static inline uint64_t memUsed() +{ + return (uint64_t)memReadStat(0) * (uint64_t)getpagesize(); +} + + +#elif defined(__FreeBSD__) +static inline uint64_t memUsed(void) +{ + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + return ru.ru_maxrss*1024; +} + + +#else +static inline uint64_t memUsed() +{ + return 0; +} +#endif + +#endif //TIME_MEM_H diff --git a/packages/bee/cryptominisat-2.5.1/TODO b/packages/bee/cryptominisat-2.5.1/TODO new file mode 100755 index 000000000..7c976fa3a --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/TODO @@ -0,0 +1,3 @@ +* Report all bugs, please using Gforge: https://gforge.inria.fr/tracker/?group_id=1992 +* Make it more C++. There are plenty of areas where this would help +* Get rid of Vec.h and other STL-like classes diff --git a/packages/bee/cryptominisat-2.5.1/aclocal.m4 b/packages/bee/cryptominisat-2.5.1/aclocal.m4 new file mode 100755 index 000000000..73c18229d --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/aclocal.m4 @@ -0,0 +1,956 @@ +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, +[m4_warning([this file was generated for autoconf 2.65. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 10 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) diff --git a/packages/bee/cryptominisat-2.5.1/config.guess b/packages/bee/cryptominisat-2.5.1/config.guess new file mode 100755 index 000000000..e3a2116a7 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/config.guess @@ -0,0 +1,1533 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Free Software Foundation, Inc. + +timestamp='2009-06-10' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd | genuineintel) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/packages/bee/cryptominisat-2.5.1/config.h.in b/packages/bee/cryptominisat-2.5.1/config.h.in new file mode 100755 index 000000000..c6cf94d5e --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/config.h.in @@ -0,0 +1,90 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Defined if the requested minimum BOOST version is satisfied */ +#undef HAVE_BOOST + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_IOSTREAM + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* Enable statistics generation code (Define to 1 if needed) */ +#undef STATS_NEEDED + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Use memory pools to store packed clauses */ +#undef USE_POOLS + +/* Version number of package */ +#undef VERSION + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc diff --git a/packages/bee/cryptominisat-2.5.1/config.status b/packages/bee/cryptominisat-2.5.1/config.status new file mode 100755 index 000000000..cc91e5041 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/config.status @@ -0,0 +1,2263 @@ +#! /bin/bash +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=${CONFIG_SHELL-/bin/bash} +export SHELL +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with status $?, using 1 if that was 0. +as_fn_error () +{ + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + fi + $as_echo "$as_me: error: $1" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by cryptominisat $as_me 2.5.1a, which was +generated by GNU Autoconf 2.65. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +# Files that config.status was made for. +config_files=" Makefile Solver/Makefile" +config_headers=" config.h" +config_commands=" libtool depfiles" + +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +ac_cs_config="" +ac_cs_version="\ +cryptominisat config.status 2.5.1a +configured by ./configure, generated by GNU Autoconf 2.65, + with options \"$ac_cs_config\" + +Copyright (C) 2009 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/home/saam007/Desktop/SAT/cryptominisat-2.5.1' +srcdir='.' +INSTALL='/usr/bin/install -c' +MKDIR_P='/bin/mkdir -p' +AWK='gawk' +test -n "$AWK" || AWK=awk +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + set X '/bin/bash' './configure' $ac_configure_extra_args --no-create --no-recursion + shift + $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6 + CONFIG_SHELL='/bin/bash' + export CONFIG_SHELL + exec "$@" +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +# +# INIT-COMMANDS +# + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +double_quote_subst='s/\(["`\\]\)/\\\1/g' +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' +macro_version='2.2.6b' +macro_revision='1.3017' +enable_shared='yes' +enable_static='yes' +pic_mode='default' +enable_fast_install='yes' +host_alias='' +host='i686-pc-linux-gnu' +host_os='linux-gnu' +build_alias='' +build='i686-pc-linux-gnu' +build_os='linux-gnu' +SED='/bin/sed' +Xsed='/bin/sed -e 1s/^X//' +GREP='/bin/grep' +EGREP='/bin/grep -E' +FGREP='/bin/grep -F' +LD='/usr/bin/ld' +NM='/usr/bin/nm -B' +LN_S='ln -s' +max_cmd_len='1572864' +ac_objext='o' +exeext='' +lt_unset='unset' +lt_SP2NL='tr \040 \012' +lt_NL2SP='tr \015\012 \040\040' +reload_flag=' -r' +reload_cmds='$LD$reload_flag -o $output$reload_objs' +OBJDUMP='objdump' +deplibs_check_method='pass_all' +file_magic_cmd='$MAGIC_CMD' +AR='ar' +AR_FLAGS='cru' +STRIP='strip' +RANLIB='ranlib' +old_postinstall_cmds='chmod 644 $oldlib~$RANLIB $oldlib' +old_postuninstall_cmds='' +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs~$RANLIB $oldlib' +CC='gcc' +CFLAGS='-g -O2' +compiler='g++' +GCC='yes' +lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\''' +lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\''' +lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/ {"\2", (void *) \&\2},/p'\''' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \(lib[^ ]*\)$/ {"\2", (void *) \&\2},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/ {"lib\2", (void *) \&\2},/p'\''' +objdir='.libs' +SHELL='/bin/bash' +ECHO='echo' +MAGIC_CMD='file' +lt_prog_compiler_no_builtin_flag=' -fno-builtin' +lt_prog_compiler_wl='-Wl,' +lt_prog_compiler_pic=' -fPIC -DPIC' +lt_prog_compiler_static='-static' +lt_cv_prog_compiler_c_o='yes' +need_locks='no' +DSYMUTIL='' +NMEDIT='' +LIPO='' +OTOOL='' +OTOOL64='' +libext='a' +shrext_cmds='.so' +extract_expsyms_cmds='' +archive_cmds_need_lc='no' +enable_shared_with_static_runtimes='no' +export_dynamic_flag_spec='${wl}--export-dynamic' +whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' +compiler_needs_object='no' +old_archive_from_new_cmds='' +old_archive_from_expsyms_cmds='' +archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' +archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' +module_cmds='' +module_expsym_cmds='' +with_gnu_ld='yes' +allow_undefined_flag='' +no_undefined_flag='' +hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' +hardcode_libdir_flag_spec_ld='' +hardcode_libdir_separator='' +hardcode_direct='no' +hardcode_direct_absolute='no' +hardcode_minus_L='no' +hardcode_shlibpath_var='unsupported' +hardcode_automatic='no' +inherit_rpath='no' +link_all_deplibs='no' +fix_srcfile_path='' +always_export_symbols='no' +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' +exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' +include_expsyms='' +prelink_cmds='' +file_list_spec='' +variables_saved_for_relink='PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH' +need_lib_prefix='no' +need_version='no' +version_type='linux' +runpath_var='LD_RUN_PATH' +shlibpath_var='LD_LIBRARY_PATH' +shlibpath_overrides_runpath='no' +libname_spec='lib$name' +library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' +soname_spec='${libname}${release}${shared_ext}$major' +postinstall_cmds='' +postuninstall_cmds='' +finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' +finish_eval='' +hardcode_into_libs='yes' +sys_lib_search_path_spec='/usr/lib/gcc/i486-linux-gnu/4.4.3 /usr/lib /lib /usr/lib/i486-linux-gnu' +sys_lib_dlsearch_path_spec='/lib /usr/lib /usr/lib/mesa /lib/i486-linux-gnu /usr/lib/i486-linux-gnu /usr/lib/alsa-lib /usr/local/lib /usr/lib/vmware-tools/lib32/libvmGuestLib.so /usr/lib/vmware-tools/lib64/libvmGuestLib.so /usr/lib/vmware-tools/lib32/libvmGuestLibJava.so /usr/lib/vmware-tools/lib64/libvmGuestLibJava.so /usr/lib/vmware-tools/lib32/libDeployPkg.so /usr/lib/vmware-tools/lib64/libDeployPkg.so ' +hardcode_action='immediate' +enable_dlopen='unknown' +enable_dlopen_self='unknown' +enable_dlopen_self_static='unknown' +old_striplib='strip --strip-debug' +striplib='strip --strip-unneeded' +compiler_lib_search_dirs='' +predep_objects='' +postdep_objects='' +predeps='' +postdeps='' +compiler_lib_search_path='' +LD_CXX='/usr/bin/ld' +old_archive_cmds_CXX='$AR $AR_FLAGS $oldlib$oldobjs~$RANLIB $oldlib' +compiler_CXX='g++' +GCC_CXX='yes' +lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +lt_prog_compiler_wl_CXX='-Wl,' +lt_prog_compiler_pic_CXX=' -fPIC -DPIC' +lt_prog_compiler_static_CXX='-static' +lt_cv_prog_compiler_c_o_CXX='yes' +archive_cmds_need_lc_CXX='no' +enable_shared_with_static_runtimes_CXX='no' +export_dynamic_flag_spec_CXX='${wl}--export-dynamic' +whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' +compiler_needs_object_CXX='no' +old_archive_from_new_cmds_CXX='' +old_archive_from_expsyms_cmds_CXX='' +archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' +archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' +module_cmds_CXX='' +module_expsym_cmds_CXX='' +with_gnu_ld_CXX='yes' +allow_undefined_flag_CXX='' +no_undefined_flag_CXX='' +hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' +hardcode_libdir_flag_spec_ld_CXX='' +hardcode_libdir_separator_CXX='' +hardcode_direct_CXX='no' +hardcode_direct_absolute_CXX='no' +hardcode_minus_L_CXX='no' +hardcode_shlibpath_var_CXX='unsupported' +hardcode_automatic_CXX='no' +inherit_rpath_CXX='no' +link_all_deplibs_CXX='no' +fix_srcfile_path_CXX='' +always_export_symbols_CXX='no' +export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' +exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' +include_expsyms_CXX='' +prelink_cmds_CXX='' +file_list_spec_CXX='' +hardcode_action_CXX='immediate' +compiler_lib_search_dirs_CXX='/usr/lib/gcc/i486-linux-gnu/4.4.3 /usr/lib/gcc/i486-linux-gnu/4.4.3 /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib /lib/../lib /usr/lib/../lib /usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. /usr/lib/i486-linux-gnu' +predep_objects_CXX='/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.4.3/crtbeginS.o' +postdep_objects_CXX='/usr/lib/gcc/i486-linux-gnu/4.4.3/crtendS.o /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crtn.o' +predeps_CXX='' +postdeps_CXX='-lstdc++ -lm -lgcc_s -lc -lgcc_s' +compiler_lib_search_path_CXX='-L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. -L/usr/lib/i486-linux-gnu' + +LTCC='gcc' +LTCFLAGS='-g -O2' +compiler='gcc' + +# Quote evaled strings. +for var in SED GREP EGREP FGREP LD NM LN_S lt_SP2NL lt_NL2SP reload_flag OBJDUMP deplibs_check_method file_magic_cmd AR AR_FLAGS STRIP RANLIB CC CFLAGS compiler lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl lt_cv_sys_global_symbol_to_c_name_address lt_cv_sys_global_symbol_to_c_name_address_lib_prefix SHELL ECHO lt_prog_compiler_no_builtin_flag lt_prog_compiler_wl lt_prog_compiler_pic lt_prog_compiler_static lt_cv_prog_compiler_c_o need_locks DSYMUTIL NMEDIT LIPO OTOOL OTOOL64 shrext_cmds export_dynamic_flag_spec whole_archive_flag_spec compiler_needs_object with_gnu_ld allow_undefined_flag no_undefined_flag hardcode_libdir_flag_spec hardcode_libdir_flag_spec_ld hardcode_libdir_separator fix_srcfile_path exclude_expsyms include_expsyms file_list_spec variables_saved_for_relink libname_spec library_names_spec soname_spec finish_eval old_striplib striplib compiler_lib_search_dirs predep_objects postdep_objects predeps postdeps compiler_lib_search_path LD_CXX compiler_CXX lt_prog_compiler_no_builtin_flag_CXX lt_prog_compiler_wl_CXX lt_prog_compiler_pic_CXX lt_prog_compiler_static_CXX lt_cv_prog_compiler_c_o_CXX export_dynamic_flag_spec_CXX whole_archive_flag_spec_CXX compiler_needs_object_CXX with_gnu_ld_CXX allow_undefined_flag_CXX no_undefined_flag_CXX hardcode_libdir_flag_spec_CXX hardcode_libdir_flag_spec_ld_CXX hardcode_libdir_separator_CXX fix_srcfile_path_CXX exclude_expsyms_CXX include_expsyms_CXX file_list_spec_CXX compiler_lib_search_dirs_CXX predep_objects_CXX postdep_objects_CXX predeps_CXX postdeps_CXX compiler_lib_search_path_CXX; do + case `eval \\$ECHO "X\\$$var"` in + *[\\\`\"\$]*) + eval "lt_$var=\\\"\`\$ECHO \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\$$var\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds old_postinstall_cmds old_postuninstall_cmds old_archive_cmds extract_expsyms_cmds old_archive_from_new_cmds old_archive_from_expsyms_cmds archive_cmds archive_expsym_cmds module_cmds module_expsym_cmds export_symbols_cmds prelink_cmds postinstall_cmds postuninstall_cmds finish_cmds sys_lib_search_path_spec sys_lib_dlsearch_path_spec old_archive_cmds_CXX old_archive_from_new_cmds_CXX old_archive_from_expsyms_cmds_CXX archive_cmds_CXX archive_expsym_cmds_CXX module_cmds_CXX module_expsym_cmds_CXX export_symbols_cmds_CXX prelink_cmds_CXX; do + case `eval \\$ECHO "X\\$$var"` in + *[\\\`\"\$]*) + eval "lt_$var=\\\"\`\$ECHO \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\$$var\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case $lt_ECHO in +*'\$0 --fallback-echo"') lt_ECHO=`$ECHO "X$lt_ECHO" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; +esac + +ac_aux_dir='.' +xsi_shell='yes' +lt_shell_append='yes' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='cryptominisat' + VERSION='2.5.1a' + TIMESTAMP='' + RM='rm -f' + ofile='libtool' + + + + + +AMDEP_TRUE="" ac_aux_dir="." + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "Solver/Makefile") CONFIG_FILES="$CONFIG_FILES Solver/Makefile" ;; + + *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +cat >>"$tmp/subs1.awk" <<\_ACAWK && +S["am__EXEEXT_FALSE"]="" +S["am__EXEEXT_TRUE"]="#" +S["LTLIBOBJS"]="" +S["BOOST_CPPFLAGS"]="" +S["DISTCHECK_CONFIGURE_FLAGS"]=" '--with-boost='" +S["BOOST_ROOT"]="" +S["LIBOBJS"]="" +S["am__fastdepCXX_FALSE"]="#" +S["am__fastdepCXX_TRUE"]="" +S["CXXDEPMODE"]="depmode=gcc3" +S["am__fastdepCC_FALSE"]="#" +S["am__fastdepCC_TRUE"]="" +S["CCDEPMODE"]="depmode=gcc3" +S["AMDEPBACKSLASH"]="\\" +S["AMDEP_FALSE"]="#" +S["AMDEP_TRUE"]="" +S["am__quote"]="" +S["am__include"]="include" +S["DEPDIR"]=".deps" +S["am__untar"]="${AMTAR} xf -" +S["am__tar"]="${AMTAR} chof - \"$$tardir\"" +S["AMTAR"]="${SHELL} /home/saam007/Desktop/SAT/cryptominisat-2.5.1/missing --run tar" +S["am__leading_dot"]="." +S["SET_MAKE"]="" +S["AWK"]="gawk" +S["mkdir_p"]="/bin/mkdir -p" +S["MKDIR_P"]="/bin/mkdir -p" +S["INSTALL_STRIP_PROGRAM"]="$(install_sh) -c -s" +S["install_sh"]="${SHELL} /home/saam007/Desktop/SAT/cryptominisat-2.5.1/install-sh" +S["MAKEINFO"]="${SHELL} /home/saam007/Desktop/SAT/cryptominisat-2.5.1/missing --run makeinfo" +S["AUTOHEADER"]="${SHELL} /home/saam007/Desktop/SAT/cryptominisat-2.5.1/missing --run autoheader" +S["AUTOMAKE"]="${SHELL} /home/saam007/Desktop/SAT/cryptominisat-2.5.1/missing --run automake-1.11" +S["AUTOCONF"]="${SHELL} /home/saam007/Desktop/SAT/cryptominisat-2.5.1/missing --run autoconf" +S["ACLOCAL"]="${SHELL} /home/saam007/Desktop/SAT/cryptominisat-2.5.1/missing --run aclocal-1.11" +S["VERSION"]="2.5.1a" +S["PACKAGE"]="cryptominisat" +S["CYGPATH_W"]="echo" +S["am__isrc"]="" +S["INSTALL_DATA"]="${INSTALL} -m 644" +S["INSTALL_SCRIPT"]="${INSTALL}" +S["INSTALL_PROGRAM"]="${INSTALL}" +S["CXXCPP"]="g++ -E" +S["ac_ct_CXX"]="g++" +S["CXXFLAGS"]="-g -O2" +S["CXX"]="g++" +S["CPP"]="gcc -E" +S["OTOOL64"]="" +S["OTOOL"]="" +S["LIPO"]="" +S["NMEDIT"]="" +S["DSYMUTIL"]="" +S["lt_ECHO"]="echo" +S["RANLIB"]="ranlib" +S["STRIP"]="strip" +S["AR"]="ar" +S["OBJDUMP"]="objdump" +S["LN_S"]="ln -s" +S["NM"]="/usr/bin/nm -B" +S["ac_ct_DUMPBIN"]="" +S["DUMPBIN"]="" +S["LD"]="/usr/bin/ld" +S["FGREP"]="/bin/grep -F" +S["EGREP"]="/bin/grep -E" +S["GREP"]="/bin/grep" +S["SED"]="/bin/sed" +S["OBJEXT"]="o" +S["EXEEXT"]="" +S["ac_ct_CC"]="gcc" +S["CPPFLAGS"]="" +S["LDFLAGS"]="" +S["CFLAGS"]="-g -O2" +S["CC"]="gcc" +S["host_os"]="linux-gnu" +S["host_vendor"]="pc" +S["host_cpu"]="i686" +S["host"]="i686-pc-linux-gnu" +S["build_os"]="linux-gnu" +S["build_vendor"]="pc" +S["build_cpu"]="i686" +S["build"]="i686-pc-linux-gnu" +S["LIBTOOL"]="$(SHELL) $(top_builddir)/libtool" +S["target_alias"]="" +S["host_alias"]="" +S["build_alias"]="" +S["LIBS"]="" +S["ECHO_T"]="" +S["ECHO_N"]="-n" +S["ECHO_C"]="" +S["DEFS"]="-DHAVE_CONFIG_H" +S["mandir"]="${datarootdir}/man" +S["localedir"]="${datarootdir}/locale" +S["libdir"]="${exec_prefix}/lib" +S["psdir"]="${docdir}" +S["pdfdir"]="${docdir}" +S["dvidir"]="${docdir}" +S["htmldir"]="${docdir}" +S["infodir"]="${datarootdir}/info" +S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}" +S["oldincludedir"]="/usr/include" +S["includedir"]="${prefix}/include" +S["localstatedir"]="${prefix}/var" +S["sharedstatedir"]="${prefix}/com" +S["sysconfdir"]="${prefix}/etc" +S["datadir"]="${datarootdir}" +S["datarootdir"]="${prefix}/share" +S["libexecdir"]="${exec_prefix}/libexec" +S["sbindir"]="${exec_prefix}/sbin" +S["bindir"]="${exec_prefix}/bin" +S["program_transform_name"]="s,x,x," +S["prefix"]="/usr/local" +S["exec_prefix"]="${prefix}" +S["PACKAGE_URL"]="" +S["PACKAGE_BUGREPORT"]="" +S["PACKAGE_STRING"]="cryptominisat 2.5.1a" +S["PACKAGE_VERSION"]="2.5.1a" +S["PACKAGE_TARNAME"]="cryptominisat" +S["PACKAGE_NAME"]="cryptominisat" +S["PATH_SEPARATOR"]=":" +S["SHELL"]="/bin/bash" +_ACAWK +cat >>"$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +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" \ + || as_fn_error "could not setup config files machinery" "$LINENO" 5 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# 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 || +BEGIN { +D["PACKAGE_NAME"]=" \"cryptominisat\"" +D["PACKAGE_TARNAME"]=" \"cryptominisat\"" +D["PACKAGE_VERSION"]=" \"2.5.1a\"" +D["PACKAGE_STRING"]=" \"cryptominisat 2.5.1a\"" +D["PACKAGE_BUGREPORT"]=" \"\"" +D["PACKAGE_URL"]=" \"\"" +D["STDC_HEADERS"]=" 1" +D["HAVE_SYS_TYPES_H"]=" 1" +D["HAVE_SYS_STAT_H"]=" 1" +D["HAVE_STDLIB_H"]=" 1" +D["HAVE_STRING_H"]=" 1" +D["HAVE_MEMORY_H"]=" 1" +D["HAVE_STRINGS_H"]=" 1" +D["HAVE_INTTYPES_H"]=" 1" +D["HAVE_STDINT_H"]=" 1" +D["HAVE_UNISTD_H"]=" 1" +D["HAVE_DLFCN_H"]=" 1" +D["LT_OBJDIR"]=" \".libs/\"" +D["PACKAGE"]=" \"cryptominisat\"" +D["VERSION"]=" \"2.5.1a\"" +D["HAVE_IOSTREAM"]=" 1" +D["SIZEOF_INT"]=" 4" +D["SIZEOF_LONG"]=" 4" +D["SIZEOF_SIZE_T"]=" 4" +D["HAVE_STDLIB_H"]=" 1" +D["HAVE_MALLOC"]=" 1" + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*([\t (]|$)/ { + line = $ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK + as_fn_error "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$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 `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error "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'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac +ac_sed_extra="/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;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 + +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"; } && + { $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" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$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 + { $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" \ + || 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" \ + || as_fn_error "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="CXX " + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$@"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} + +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + ;; + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 diff --git a/packages/bee/cryptominisat-2.5.1/config.sub b/packages/bee/cryptominisat-2.5.1/config.sub new file mode 100755 index 000000000..eb0389a69 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/config.sub @@ -0,0 +1,1693 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Free Software Foundation, Inc. + +timestamp='2009-06-11' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/packages/bee/cryptominisat-2.5.1/configure.in b/packages/bee/cryptominisat-2.5.1/configure.in new file mode 100755 index 000000000..b05fd5c02 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/configure.in @@ -0,0 +1,39 @@ +AC_INIT(cryptominisat, 2.5.1a) + +dnl use libtool +AC_PROG_LIBTOOL + +dnl we are C++ +AC_LANG_CPLUSPLUS +AC_PROG_CXX +AC_LANG(C++) + +dnl AC_CONFIG_AUX_DIR([m4-extra]) +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE + +AC_CONFIG_HEADERS(config.h) +AC_CHECK_HEADERS(iostream) + +# checks for compiler characteristics +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([long]) +AC_CHECK_SIZEOF([size_t]) + +# checks for library functions +AC_FUNC_MALLOC +AC_FUNC_MEMCMP + +#statistics generation needed +AH_TEMPLATE([STATS_NEEDED],[Enable statistics generation code (Define to 1 if needed)]) +#AC_DEFINE([STATS_NEEDED]) + +#search for pools +AH_TEMPLATE([USE_POOLS], [Use memory pools to store packed clauses]) +m4_include(m4-extra/boost.m4) +BOOST_REQUIRE(1.40, AC_MSG_WARN([Cannot find boost library -- clauses will not be packed(slowdown)])) +if test "${HAVE_BOOST}" == "1" ; then + BOOST_FIND_HEADER(boost/pool/pool.hpp, AC_MSG_WARN([Cannot find boost pool library -- clauses will not be packed]), AC_DEFINE([USE_POOLS])) +fi + +AC_OUTPUT(Makefile Solver/Makefile) diff --git a/packages/bee/cryptominisat-2.5.1/depcomp b/packages/bee/cryptominisat-2.5.1/depcomp new file mode 100755 index 000000000..df8eea7e4 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/depcomp @@ -0,0 +1,630 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free +# Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u="sed s,\\\\\\\\,/,g" + depmode=msvisualcpp +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/packages/bee/cryptominisat-2.5.1/install-sh b/packages/bee/cryptominisat-2.5.1/install-sh new file mode 100755 index 000000000..6781b987b --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/install-sh @@ -0,0 +1,520 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2009-04-28.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/packages/bee/cryptominisat-2.5.1/libtool b/packages/bee/cryptominisat-2.5.1/libtool new file mode 100755 index 000000000..6c23b3fa4 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/libtool @@ -0,0 +1,9063 @@ +#! /bin/bash + +# libtool - Provide generalized library-building support services. +# Generated automatically by config.status (cryptominisat) 2.5.1a +# Libtool was configured on host ubuntu: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="CXX " + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=2.2.6b +macro_revision=1.3017 + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# What type of objects to build. +pic_mode=default + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias= +host=i686-pc-linux-gnu +host_os=linux-gnu + +# The build system. +build_alias= +build=i686-pc-linux-gnu +build_os=linux-gnu + +# A sed program that does not truncate output. +SED="/bin/sed" + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP="/bin/grep" + +# An ERE matcher. +EGREP="/bin/grep -E" + +# A literal string matcher. +FGREP="/bin/grep -F" + +# A BSD- or MS-compatible name lister. +NM="/usr/bin/nm -B" + +# Whether we need soft or hard links. +LN_S="ln -s" + +# What is the maximum length of a command? +max_cmd_len=1572864 + +# Object file suffix (normally "o"). +objext=o + +# Executable file suffix (normally ""). +exeext= + +# whether the shell understands "unset". +lt_unset=unset + +# turn spaces into newlines. +SP2NL="tr \\040 \\012" + +# turn newlines into spaces. +NL2SP="tr \\015\\012 \\040\\040" + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# An object symbol dumper. +OBJDUMP="objdump" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == "file_magic". +file_magic_cmd="\$MAGIC_CMD" + +# The archiver. +AR="ar" +AR_FLAGS="cru" + +# A symbol stripping program. +STRIP="strip" + +# Commands used to install an old-style archive. +RANLIB="ranlib" +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" +old_postuninstall_cmds="" + +# A C compiler. +LTCC="gcc" + +# LTCC compiler flags. +LTCFLAGS="-g -O2" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'" + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'" + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'" + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# Shell to use when invoking shell scripts. +SHELL="/bin/bash" + +# An echo program that does not interpret backslashes. +ECHO="echo" + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=file + +# Must we lock files when doing compilation? +need_locks="no" + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL="" + +# Tool to change global to local symbols on Mac OS X. +NMEDIT="" + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO="" + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL="" + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64="" + +# Old archive suffix (normally "a"). +libext=a + +# Shared library suffix (normally ".so"). +shrext_cmds=".so" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Do we need the "lib" prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Library versioning type. +version_type=linux + +# Shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# Shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# Format of library name prefix. +libname_spec="lib\$name" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}\${shared_ext}\$major" + +# Command to use after installation of a shared archive. +postinstall_cmds="" + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval="" + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=yes + +# Compile-time system search path for libraries. +sys_lib_search_path_spec="/usr/lib/gcc/i486-linux-gnu/4.4.3 /usr/lib /lib /usr/lib/i486-linux-gnu" + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/mesa /lib/i486-linux-gnu /usr/lib/i486-linux-gnu /usr/lib/alsa-lib /usr/local/lib /usr/lib/vmware-tools/lib32/libvmGuestLib.so /usr/lib/vmware-tools/lib64/libvmGuestLib.so /usr/lib/vmware-tools/lib32/libvmGuestLibJava.so /usr/lib/vmware-tools/lib64/libvmGuestLibJava.so /usr/lib/vmware-tools/lib32/libDeployPkg.so /usr/lib/vmware-tools/lib64/libDeployPkg.so " + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Commands to strip libraries. +old_striplib="strip --strip-debug" +striplib="strip --strip-unneeded" + + +# The linker used to build libraries. +LD="/usr/bin/ld" + +# Commands used to build an old-style archive. +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" + +# A language specific compiler. +CC="gcc" + +# Is the compiler the GNU compiler? +with_gcc=yes + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC -DPIC" + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=no + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object="no" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build a shared archive. +archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ + cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ + echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ + \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds="" +module_expsym_cmds="" + +# Whether we are building with GNU ld or not. +with_gnu_ld="yes" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that enforces no undefined symbols. +no_undefined_flag="" + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist +hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir" + +# If ld is used when linking, flag to hardcode $libdir into a binary +# during linking. This must work even if $libdir does not exist. +hardcode_libdir_flag_spec_ld="" + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator="" + +# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=no + +# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting ${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=no + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=no + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=unsupported + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=no + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=no + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=no + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to "yes" if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" + +# Symbols that must always be exported. +include_expsyms="" + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds="" + +# Specify filename containing input files. +file_list_spec="" + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs="" + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects="" +postdep_objects="" +predeps="" +postdeps="" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="" + +# ### END LIBTOOL CONFIG + +# Generated from ltmain.m4sh. + +# ltmain.sh (GNU libtool) 2.2.6b +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print informational messages (default) +# --version print version information +# -h, --help print short or long help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="2.2.6b Debian-2.2.6b-2" +TIMESTAMP="" +package_revision=1.3017 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# NLS nuisances: We save the old values to restore during execute mode. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done + +$lt_unset CDPATH + + + + + +: ${CP="cp -f"} +: ${ECHO="echo"} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +# Generated shell functions inserted here. + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +# Generated shell functions inserted here. + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +# In the unlikely event $progname began with a '-', it would play havoc with +# func_echo (imagine progname=-n), so we prepend ./ in that case: +func_dirname_and_basename "$progpath" +progname=$func_basename_result +case $progname in + -*) progname=./$progname ;; +esac + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname${mode+: }$mode: $*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + done + my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "X$my_tmpdir" | $Xsed +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "X$1" | $Xsed \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + + + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $SED -n '/^# Usage:/,/# -h/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + $ECHO + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help +# Echo long help message to standard output and exit. +func_help () +{ + $SED -n '/^# Usage:/,/# Report bugs to/ { + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + }' < "$progpath" + exit $? +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + func_error "missing argument for $1" + exit_cmd=exit +} + +exit_cmd=: + + + + + +# Check that we have a working $ECHO. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell, and then maybe $ECHO will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# Parse options once, thoroughly. This comes as soon as possible in +# the script to make things like `libtool --version' happen quickly. +{ + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Parse non-mode specific arguments: + while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --config) func_config ;; + + --debug) preserve_args="$preserve_args $opt" + func_echo "enabling shell trace mode" + opt_debug='set -x' + $opt_debug + ;; + + -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break + execute_dlfiles="$execute_dlfiles $1" + shift + ;; + + --dry-run | -n) opt_dry_run=: ;; + --features) func_features ;; + --finish) mode="finish" ;; + + --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break + case $1 in + # Valid mode arguments: + clean) ;; + compile) ;; + execute) ;; + finish) ;; + install) ;; + link) ;; + relink) ;; + uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; + esac + + mode="$1" + shift + ;; + + --preserve-dup-deps) + opt_duplicate_deps=: ;; + + --quiet|--silent) preserve_args="$preserve_args $opt" + opt_silent=: + ;; + + --verbose| -v) preserve_args="$preserve_args $opt" + opt_silent=false + ;; + + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break + preserve_args="$preserve_args $opt $1" + func_enable_tag "$1" # tagname is set here + shift + ;; + + # Separate optargs to long options: + -dlopen=*|--mode=*|--tag=*) + func_opt_split "$opt" + set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} + shift + ;; + + -\?|-h) func_usage ;; + --help) opt_help=: ;; + --version) func_version ;; + + -*) func_fatal_help "unrecognized option \`$opt'" ;; + + *) nonopt="$opt" + break + ;; + esac + done + + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_duplicate_deps + ;; + esac + + # Having warned about all mis-specified options, bail out if + # anything was wrong. + $exit_cmd $EXIT_FAILURE +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +## ----------- ## +## Main. ## +## ----------- ## + +$opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + test -z "$mode" && func_fatal_error "error: you must specify a MODE." + + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$mode' for more information." +} + + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_ltwrapper_scriptname_result="" + if func_ltwrapper_executable_p "$1"; then + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + fi +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case "$@ " in + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T <?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + removelist="$removelist $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + removelist="$removelist $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + command="$command -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { +test "$mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$mode'" + ;; + esac + + $ECHO + $ECHO "Try \`$progname --help' for more information about other modes." + + exit $? +} + + # Now that we've collected a possible --mode arg, show help if necessary + $opt_help && func_mode_help + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_quote_for_eval "$file" + args="$args $func_quote_for_eval_result" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + $ECHO "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + $ECHO "X----------------------------------------------------------------------" | $Xsed + $ECHO "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + $ECHO + $ECHO "If you ever happen to want to link against installed libraries" + $ECHO "in a given directory, LIBDIR, you must either use libtool, and" + $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" + $ECHO "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" + $ECHO " during execution" + fi + if test -n "$runpath_var"; then + $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" + $ECHO " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $ECHO + + $ECHO "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" + $ECHO "pages." + ;; + *) + $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + $ECHO "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS +} + +test "$mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $ECHO "X$nonopt" | $GREP shtool >/dev/null; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + install_prog="$install_prog$func_quote_for_eval_result" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + install_prog="$install_prog $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_verbose "extracting global C symbols from \`$progfile'" + $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + $ECHO >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +" + case $host in + *cygwin* | *mingw* | *cegcc* ) + $ECHO >> "$output_objdir/$my_dlsyms" "\ +/* DATA imports from DLLs on WIN32 con't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs. */" + lt_dlsym_const= ;; + *osf5*) + echo >> "$output_objdir/$my_dlsyms" "\ +/* This system does not cope well with relocations in const data */" + lt_dlsym_const= ;; + *) + lt_dlsym_const=const ;; + esac + + $ECHO >> "$output_objdir/$my_dlsyms" "\ +extern $lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +$lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + $ECHO >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) symtab_cflags="$symtab_cflags $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + + +# func_emit_wrapper_part1 [arg=no] +# +# Emit the first part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part1 () +{ + func_emit_wrapper_part1_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part1_arg1=$1 + fi + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + ECHO=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$ECHO works! + : + else + # Restart under the correct shell, and then maybe \$ECHO will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $ECHO "\ + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done +" +} +# end: func_emit_wrapper_part1 + +# func_emit_wrapper_part2 [arg=no] +# +# Emit the second part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part2 () +{ + func_emit_wrapper_part2_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part2_arg1=$1 + fi + + $ECHO "\ + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} +# end: func_emit_wrapper_part2 + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=no + if test -n "$1" ; then + func_emit_wrapper_arg1=$1 + fi + + # split this up so that func_emit_cwrapperexe_src + # can call each part independently. + func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" + func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" +} + + +# func_to_host_path arg +# +# Convert paths to host format when used with build tools. +# Intended for use with "native" mingw (where libtool itself +# is running under the msys shell), or in the following cross- +# build environments: +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# where wine is equipped with the `winepath' executable. +# In the native mingw case, the (msys) shell automatically +# converts paths for any non-msys applications it launches, +# but that facility isn't available from inside the cwrapper. +# Similar accommodations are necessary for $host mingw and +# $build cygwin. Calling this function does no harm for other +# $host/$build combinations not listed above. +# +# ARG is the path (on $build) that should be converted to +# the proper representation for $host. The result is stored +# in $func_to_host_path_result. +func_to_host_path () +{ + func_to_host_path_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + case $build in + *mingw* ) # actually, msys + # awkward: cmd appends spaces to result + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_path_tmp1=`( cmd //c echo "$1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_path_tmp1=`cygpath -w "$1"` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # Unfortunately, winepath does not exit with a non-zero + # error code, so we are forced to check the contents of + # stdout. On the other hand, if the command is not + # found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both + # error code of zero AND non-empty stdout, which explains + # the odd construction: + func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + else + # Allow warning below. + func_to_host_path_result="" + fi + ;; + esac + if test -z "$func_to_host_path_result" ; then + func_error "Could not determine host path corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_path_result="$1" + fi + ;; + esac + fi +} +# end: func_to_host_path + +# func_to_host_pathlist arg +# +# Convert pathlists to host format when used with build tools. +# See func_to_host_path(), above. This function supports the +# following $build/$host combinations (but does no harm for +# combinations not listed here): +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# +# Path separators are also converted from $build format to +# $host format. If ARG begins or ends with a path separator +# character, it is preserved (but converted to $host format) +# on output. +# +# ARG is a pathlist (on $build) that should be converted to +# the proper representation on $host. The result is stored +# in $func_to_host_pathlist_result. +func_to_host_pathlist () +{ + func_to_host_pathlist_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_to_host_pathlist_tmp2="$1" + # Once set for this call, this variable should not be + # reassigned. It is used in tha fallback case. + func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e 's|^:*||' -e 's|:*$||'` + case $build in + *mingw* ) # Actually, msys. + # Awkward: cmd appends spaces to result. + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # unfortunately, winepath doesn't convert pathlists + func_to_host_pathlist_result="" + func_to_host_pathlist_oldIFS=$IFS + IFS=: + for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do + IFS=$func_to_host_pathlist_oldIFS + if test -n "$func_to_host_pathlist_f" ; then + func_to_host_path "$func_to_host_pathlist_f" + if test -n "$func_to_host_path_result" ; then + if test -z "$func_to_host_pathlist_result" ; then + func_to_host_pathlist_result="$func_to_host_path_result" + else + func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" + fi + fi + fi + IFS=: + done + IFS=$func_to_host_pathlist_oldIFS + ;; + esac + if test -z "$func_to_host_pathlist_result" ; then + func_error "Could not determine the host path(s) corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This may break if $1 contains DOS-style drive + # specifications. The fix is not to complicate the expression + # below, but for the user to provide a working wine installation + # with winepath so that path translation in the cross-to-mingw + # case works properly. + lt_replace_pathsep_nix_to_dos="s|:|;|g" + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_replace_pathsep_nix_to_dos"` + fi + # Now, add the leading and trailing path separators back + case "$1" in + :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" + ;; + esac + case "$1" in + *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" + ;; + esac + ;; + esac + fi +} +# end: func_to_host_pathlist + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +# define setmode _setmode +#else +# include +# include +# ifdef __CYGWIN__ +# include +# define HAVE_SETENV +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +#ifdef _MSC_VER +# define S_IXUSR _S_IEXEC +# define stat _stat +# ifndef _INTPTR_T_DEFINED +# define intptr_t int +# endif +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifdef __CYGWIN__ +# define FOPEN_WB "wb" +#endif + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#undef LTWRAPPER_DEBUGPRINTF +#if defined DEBUGWRAPPER +# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args +static void +ltwrapper_debugprintf (const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); +} +#else +# define LTWRAPPER_DEBUGPRINTF(args) +#endif + +const char *program_name = NULL; + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_fatal (const char *message, ...); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_opt_process_env_set (const char *arg); +void lt_opt_process_env_prepend (const char *arg); +void lt_opt_process_env_append (const char *arg); +int lt_split_name_value (const char *arg, char** name, char** value); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); + +static const char *script_text_part1 = +EOF + + func_emit_wrapper_part1 yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ "/' -e 's/$/\\n"/' + echo ";" + cat <"))); + for (i = 0; i < newargc; i++) + { + LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + } + +EOF + + case $host_os in + mingw*) + cat <<"EOF" + /* execv doesn't actually work on mingw as expected on unix */ + rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); + if (rval == -1) + { + /* failed to start process */ + LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + return 127; + } + return rval; +EOF + ;; + *) + cat <<"EOF" + execv (lt_argv_zero, newargz); + return rval; /* =127, but avoids unused variable warning */ +EOF + ;; + esac + + cat <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void *p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), + string) : NULL; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char) name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable (const char *path) +{ + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", + wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", + tmp_pathspec)); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + char *errstr = strerror (errno); + lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal ("Could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} + +void +lt_setenv (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", + (name ? name : ""), + (value ? value : ""))); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +int +lt_split_name_value (const char *arg, char** name, char** value) +{ + const char *p; + int len; + if (!arg || !*arg) + return 1; + + p = strchr (arg, (int)'='); + + if (!p) + return 1; + + *value = xstrdup (++p); + + len = strlen (arg) - strlen (*value); + *name = XMALLOC (char, len); + strncpy (*name, arg, len-1); + (*name)[len - 1] = '\0'; + + return 0; +} + +void +lt_opt_process_env_set (const char *arg) +{ + char *name = NULL; + char *value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); + } + + lt_setenv (name, value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_prepend (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_append (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 1); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + + +EOF +} +# end: func_emit_cwrapperexe_src + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + weak_libs="$weak_libs $arg" + prev= + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname '-L' '' "$arg" + dir=$func_stripname_result + if test -z "$dir"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" + linker_flags="$linker_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_duplicate_deps ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + case $lib in + *.la) func_source "$lib" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + case " $weak_libs " in + *" $deplib_base "*) ;; + *) deplibs="$deplibs $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + dir=$func_stripname_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $ECHO + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because the file extensions .$libext of this argument makes me believe" + $ECHO "*** that it is just a static archive that I should not use here." + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) temp_rpath="$temp_rpath$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + notinst_deplibs="$notinst_deplibs $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + $ECHO + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $ECHO + $ECHO "*** And there doesn't seem to be a static archive available" + $ECHO "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $ECHO + $ECHO "*** Warning: This system can not link to static lib archive $lib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $ECHO "*** But as you try to build a module library, libtool will still create " + $ECHO "*** a static module, that should work as long as the dlopening application" + $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_dirname "$deplib" "" "." + dir="$func_dirname_result" + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + *) + func_fatal_configuration "$modename: unknown library version type \`$version_type'" + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + libobjs="$libobjs $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` + # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` + # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ + -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + done + fi + if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | + $GREP . >/dev/null; then + $ECHO + if test "X$deplibs_check_method" = "Xnone"; then + $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + else + $ECHO "*** Warning: inter-library dependencies are not known to be supported." + fi + $ECHO "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $ECHO + $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + $ECHO "*** a static module, that should work as long as the dlopening" + $ECHO "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $ECHO "*** The inter-library dependencies that have been dropped here will be" + $ECHO "*** automatically added whenever a program is linked with this library" + $ECHO "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $ECHO + $ECHO "*** Since this library must not contain undefined symbols," + $ECHO "*** because either the platform does not support them or" + $ECHO "*** it was explicitly requested with -no-undefined," + $ECHO "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + delfiles="$delfiles $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + func_len " $cmd" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + $ECHO 'INPUT (' > $output + for obj in $save_libobjs + do + $ECHO "$obj" >> $output + done + $ECHO ')' >> $output + delfiles="$delfiles $output" + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + $ECHO "$obj" >> $output + done + delfiles="$delfiles $output" + output=$firstobj\"$file_list_spec$output\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + delfiles="$delfiles $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *cegcc) + # Disable wrappers for cegcc, we are cross compiling anyway. + wrappers_required=no + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $ECHO for shipping. + if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + oldobjs="$oldobjs $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $ECHO "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlfiles="$newdlfiles $libdir/$name" + ;; + *) newdlfiles="$newdlfiles $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlprefiles="$newdlprefiles $libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$mode" = link || test "$mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) RM="$RM $arg"; rmforce=yes ;; + -*) RM="$RM $arg" ;; + *) files="$files $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$mode" = uninstall || test "$mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD="/usr/bin/ld" + +# Commands used to build an old-style archive. +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib" + +# A language specific compiler. +CC="g++" + +# Is the compiler the GNU compiler? +with_gcc=yes + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC -DPIC" + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=no + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object="no" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build a shared archive. +archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib" + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds="" +module_expsym_cmds="" + +# Whether we are building with GNU ld or not. +with_gnu_ld="yes" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that enforces no undefined symbols. +no_undefined_flag="" + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist +hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir" + +# If ld is used when linking, flag to hardcode $libdir into a binary +# during linking. This must work even if $libdir does not exist. +hardcode_libdir_flag_spec_ld="" + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator="" + +# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=no + +# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting ${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=no + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=no + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=unsupported + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=no + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=no + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=no + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to "yes" if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" + +# Symbols that must always be exported. +include_expsyms="" + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds="" + +# Specify filename containing input files. +file_list_spec="" + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs="/usr/lib/gcc/i486-linux-gnu/4.4.3 /usr/lib/gcc/i486-linux-gnu/4.4.3 /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib /lib/../lib /usr/lib/../lib /usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. /usr/lib/i486-linux-gnu" + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects="/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.4.3/crtbeginS.o" +postdep_objects="/usr/lib/gcc/i486-linux-gnu/4.4.3/crtendS.o /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crtn.o" +predeps="" +postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="-L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. -L/usr/lib/i486-linux-gnu" + +# ### END LIBTOOL TAG CONFIG: CXX diff --git a/packages/bee/cryptominisat-2.5.1/ltmain.sh b/packages/bee/cryptominisat-2.5.1/ltmain.sh new file mode 100755 index 000000000..d88da2c26 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/ltmain.sh @@ -0,0 +1,8413 @@ +# Generated from ltmain.m4sh. + +# ltmain.sh (GNU libtool) 2.2.6b +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print informational messages (default) +# --version print version information +# -h, --help print short or long help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="2.2.6b Debian-2.2.6b-2" +TIMESTAMP="" +package_revision=1.3017 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# NLS nuisances: We save the old values to restore during execute mode. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done + +$lt_unset CDPATH + + + + + +: ${CP="cp -f"} +: ${ECHO="echo"} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +# Generated shell functions inserted here. + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +# In the unlikely event $progname began with a '-', it would play havoc with +# func_echo (imagine progname=-n), so we prepend ./ in that case: +func_dirname_and_basename "$progpath" +progname=$func_basename_result +case $progname in + -*) progname=./$progname ;; +esac + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname${mode+: }$mode: $*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + done + my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "X$my_tmpdir" | $Xsed +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "X$1" | $Xsed \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + + + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $SED -n '/^# Usage:/,/# -h/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + $ECHO + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help +# Echo long help message to standard output and exit. +func_help () +{ + $SED -n '/^# Usage:/,/# Report bugs to/ { + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + }' < "$progpath" + exit $? +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + func_error "missing argument for $1" + exit_cmd=exit +} + +exit_cmd=: + + + + + +# Check that we have a working $ECHO. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell, and then maybe $ECHO will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# Parse options once, thoroughly. This comes as soon as possible in +# the script to make things like `libtool --version' happen quickly. +{ + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Parse non-mode specific arguments: + while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --config) func_config ;; + + --debug) preserve_args="$preserve_args $opt" + func_echo "enabling shell trace mode" + opt_debug='set -x' + $opt_debug + ;; + + -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break + execute_dlfiles="$execute_dlfiles $1" + shift + ;; + + --dry-run | -n) opt_dry_run=: ;; + --features) func_features ;; + --finish) mode="finish" ;; + + --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break + case $1 in + # Valid mode arguments: + clean) ;; + compile) ;; + execute) ;; + finish) ;; + install) ;; + link) ;; + relink) ;; + uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; + esac + + mode="$1" + shift + ;; + + --preserve-dup-deps) + opt_duplicate_deps=: ;; + + --quiet|--silent) preserve_args="$preserve_args $opt" + opt_silent=: + ;; + + --verbose| -v) preserve_args="$preserve_args $opt" + opt_silent=false + ;; + + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break + preserve_args="$preserve_args $opt $1" + func_enable_tag "$1" # tagname is set here + shift + ;; + + # Separate optargs to long options: + -dlopen=*|--mode=*|--tag=*) + func_opt_split "$opt" + set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} + shift + ;; + + -\?|-h) func_usage ;; + --help) opt_help=: ;; + --version) func_version ;; + + -*) func_fatal_help "unrecognized option \`$opt'" ;; + + *) nonopt="$opt" + break + ;; + esac + done + + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_duplicate_deps + ;; + esac + + # Having warned about all mis-specified options, bail out if + # anything was wrong. + $exit_cmd $EXIT_FAILURE +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +## ----------- ## +## Main. ## +## ----------- ## + +$opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + test -z "$mode" && func_fatal_error "error: you must specify a MODE." + + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$mode' for more information." +} + + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_ltwrapper_scriptname_result="" + if func_ltwrapper_executable_p "$1"; then + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + fi +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case "$@ " in + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T <?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + removelist="$removelist $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + removelist="$removelist $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + command="$command -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { +test "$mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$mode'" + ;; + esac + + $ECHO + $ECHO "Try \`$progname --help' for more information about other modes." + + exit $? +} + + # Now that we've collected a possible --mode arg, show help if necessary + $opt_help && func_mode_help + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_quote_for_eval "$file" + args="$args $func_quote_for_eval_result" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + $ECHO "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + $ECHO "X----------------------------------------------------------------------" | $Xsed + $ECHO "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + $ECHO + $ECHO "If you ever happen to want to link against installed libraries" + $ECHO "in a given directory, LIBDIR, you must either use libtool, and" + $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" + $ECHO "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" + $ECHO " during execution" + fi + if test -n "$runpath_var"; then + $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" + $ECHO " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $ECHO + + $ECHO "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" + $ECHO "pages." + ;; + *) + $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + $ECHO "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS +} + +test "$mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $ECHO "X$nonopt" | $GREP shtool >/dev/null; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + install_prog="$install_prog$func_quote_for_eval_result" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + install_prog="$install_prog $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_verbose "extracting global C symbols from \`$progfile'" + $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + $ECHO >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +" + case $host in + *cygwin* | *mingw* | *cegcc* ) + $ECHO >> "$output_objdir/$my_dlsyms" "\ +/* DATA imports from DLLs on WIN32 con't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs. */" + lt_dlsym_const= ;; + *osf5*) + echo >> "$output_objdir/$my_dlsyms" "\ +/* This system does not cope well with relocations in const data */" + lt_dlsym_const= ;; + *) + lt_dlsym_const=const ;; + esac + + $ECHO >> "$output_objdir/$my_dlsyms" "\ +extern $lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +$lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + $ECHO >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) symtab_cflags="$symtab_cflags $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + + +# func_emit_wrapper_part1 [arg=no] +# +# Emit the first part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part1 () +{ + func_emit_wrapper_part1_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part1_arg1=$1 + fi + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + ECHO=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$ECHO works! + : + else + # Restart under the correct shell, and then maybe \$ECHO will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $ECHO "\ + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done +" +} +# end: func_emit_wrapper_part1 + +# func_emit_wrapper_part2 [arg=no] +# +# Emit the second part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part2 () +{ + func_emit_wrapper_part2_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part2_arg1=$1 + fi + + $ECHO "\ + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} +# end: func_emit_wrapper_part2 + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=no + if test -n "$1" ; then + func_emit_wrapper_arg1=$1 + fi + + # split this up so that func_emit_cwrapperexe_src + # can call each part independently. + func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" + func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" +} + + +# func_to_host_path arg +# +# Convert paths to host format when used with build tools. +# Intended for use with "native" mingw (where libtool itself +# is running under the msys shell), or in the following cross- +# build environments: +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# where wine is equipped with the `winepath' executable. +# In the native mingw case, the (msys) shell automatically +# converts paths for any non-msys applications it launches, +# but that facility isn't available from inside the cwrapper. +# Similar accommodations are necessary for $host mingw and +# $build cygwin. Calling this function does no harm for other +# $host/$build combinations not listed above. +# +# ARG is the path (on $build) that should be converted to +# the proper representation for $host. The result is stored +# in $func_to_host_path_result. +func_to_host_path () +{ + func_to_host_path_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + case $build in + *mingw* ) # actually, msys + # awkward: cmd appends spaces to result + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_path_tmp1=`( cmd //c echo "$1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_path_tmp1=`cygpath -w "$1"` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # Unfortunately, winepath does not exit with a non-zero + # error code, so we are forced to check the contents of + # stdout. On the other hand, if the command is not + # found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both + # error code of zero AND non-empty stdout, which explains + # the odd construction: + func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + else + # Allow warning below. + func_to_host_path_result="" + fi + ;; + esac + if test -z "$func_to_host_path_result" ; then + func_error "Could not determine host path corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_path_result="$1" + fi + ;; + esac + fi +} +# end: func_to_host_path + +# func_to_host_pathlist arg +# +# Convert pathlists to host format when used with build tools. +# See func_to_host_path(), above. This function supports the +# following $build/$host combinations (but does no harm for +# combinations not listed here): +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# +# Path separators are also converted from $build format to +# $host format. If ARG begins or ends with a path separator +# character, it is preserved (but converted to $host format) +# on output. +# +# ARG is a pathlist (on $build) that should be converted to +# the proper representation on $host. The result is stored +# in $func_to_host_pathlist_result. +func_to_host_pathlist () +{ + func_to_host_pathlist_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_to_host_pathlist_tmp2="$1" + # Once set for this call, this variable should not be + # reassigned. It is used in tha fallback case. + func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e 's|^:*||' -e 's|:*$||'` + case $build in + *mingw* ) # Actually, msys. + # Awkward: cmd appends spaces to result. + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # unfortunately, winepath doesn't convert pathlists + func_to_host_pathlist_result="" + func_to_host_pathlist_oldIFS=$IFS + IFS=: + for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do + IFS=$func_to_host_pathlist_oldIFS + if test -n "$func_to_host_pathlist_f" ; then + func_to_host_path "$func_to_host_pathlist_f" + if test -n "$func_to_host_path_result" ; then + if test -z "$func_to_host_pathlist_result" ; then + func_to_host_pathlist_result="$func_to_host_path_result" + else + func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" + fi + fi + fi + IFS=: + done + IFS=$func_to_host_pathlist_oldIFS + ;; + esac + if test -z "$func_to_host_pathlist_result" ; then + func_error "Could not determine the host path(s) corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This may break if $1 contains DOS-style drive + # specifications. The fix is not to complicate the expression + # below, but for the user to provide a working wine installation + # with winepath so that path translation in the cross-to-mingw + # case works properly. + lt_replace_pathsep_nix_to_dos="s|:|;|g" + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_replace_pathsep_nix_to_dos"` + fi + # Now, add the leading and trailing path separators back + case "$1" in + :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" + ;; + esac + case "$1" in + *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" + ;; + esac + ;; + esac + fi +} +# end: func_to_host_pathlist + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +# define setmode _setmode +#else +# include +# include +# ifdef __CYGWIN__ +# include +# define HAVE_SETENV +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +#ifdef _MSC_VER +# define S_IXUSR _S_IEXEC +# define stat _stat +# ifndef _INTPTR_T_DEFINED +# define intptr_t int +# endif +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifdef __CYGWIN__ +# define FOPEN_WB "wb" +#endif + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#undef LTWRAPPER_DEBUGPRINTF +#if defined DEBUGWRAPPER +# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args +static void +ltwrapper_debugprintf (const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); +} +#else +# define LTWRAPPER_DEBUGPRINTF(args) +#endif + +const char *program_name = NULL; + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_fatal (const char *message, ...); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_opt_process_env_set (const char *arg); +void lt_opt_process_env_prepend (const char *arg); +void lt_opt_process_env_append (const char *arg); +int lt_split_name_value (const char *arg, char** name, char** value); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); + +static const char *script_text_part1 = +EOF + + func_emit_wrapper_part1 yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ "/' -e 's/$/\\n"/' + echo ";" + cat <"))); + for (i = 0; i < newargc; i++) + { + LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + } + +EOF + + case $host_os in + mingw*) + cat <<"EOF" + /* execv doesn't actually work on mingw as expected on unix */ + rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); + if (rval == -1) + { + /* failed to start process */ + LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + return 127; + } + return rval; +EOF + ;; + *) + cat <<"EOF" + execv (lt_argv_zero, newargz); + return rval; /* =127, but avoids unused variable warning */ +EOF + ;; + esac + + cat <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void *p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), + string) : NULL; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char) name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable (const char *path) +{ + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", + wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", + tmp_pathspec)); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + char *errstr = strerror (errno); + lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal ("Could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} + +void +lt_setenv (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", + (name ? name : ""), + (value ? value : ""))); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +int +lt_split_name_value (const char *arg, char** name, char** value) +{ + const char *p; + int len; + if (!arg || !*arg) + return 1; + + p = strchr (arg, (int)'='); + + if (!p) + return 1; + + *value = xstrdup (++p); + + len = strlen (arg) - strlen (*value); + *name = XMALLOC (char, len); + strncpy (*name, arg, len-1); + (*name)[len - 1] = '\0'; + + return 0; +} + +void +lt_opt_process_env_set (const char *arg) +{ + char *name = NULL; + char *value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); + } + + lt_setenv (name, value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_prepend (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_append (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 1); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + + +EOF +} +# end: func_emit_cwrapperexe_src + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + weak_libs="$weak_libs $arg" + prev= + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname '-L' '' "$arg" + dir=$func_stripname_result + if test -z "$dir"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" + linker_flags="$linker_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_duplicate_deps ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + case $lib in + *.la) func_source "$lib" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + case " $weak_libs " in + *" $deplib_base "*) ;; + *) deplibs="$deplibs $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + dir=$func_stripname_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $ECHO + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because the file extensions .$libext of this argument makes me believe" + $ECHO "*** that it is just a static archive that I should not use here." + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) temp_rpath="$temp_rpath$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + notinst_deplibs="$notinst_deplibs $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + $ECHO + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $ECHO + $ECHO "*** And there doesn't seem to be a static archive available" + $ECHO "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $ECHO + $ECHO "*** Warning: This system can not link to static lib archive $lib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $ECHO "*** But as you try to build a module library, libtool will still create " + $ECHO "*** a static module, that should work as long as the dlopening application" + $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_dirname "$deplib" "" "." + dir="$func_dirname_result" + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + *) + func_fatal_configuration "$modename: unknown library version type \`$version_type'" + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + libobjs="$libobjs $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` + # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` + # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ + -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + done + fi + if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | + $GREP . >/dev/null; then + $ECHO + if test "X$deplibs_check_method" = "Xnone"; then + $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + else + $ECHO "*** Warning: inter-library dependencies are not known to be supported." + fi + $ECHO "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $ECHO + $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + $ECHO "*** a static module, that should work as long as the dlopening" + $ECHO "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $ECHO "*** The inter-library dependencies that have been dropped here will be" + $ECHO "*** automatically added whenever a program is linked with this library" + $ECHO "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $ECHO + $ECHO "*** Since this library must not contain undefined symbols," + $ECHO "*** because either the platform does not support them or" + $ECHO "*** it was explicitly requested with -no-undefined," + $ECHO "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + delfiles="$delfiles $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + func_len " $cmd" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + $ECHO 'INPUT (' > $output + for obj in $save_libobjs + do + $ECHO "$obj" >> $output + done + $ECHO ')' >> $output + delfiles="$delfiles $output" + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + $ECHO "$obj" >> $output + done + delfiles="$delfiles $output" + output=$firstobj\"$file_list_spec$output\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + delfiles="$delfiles $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *cegcc) + # Disable wrappers for cegcc, we are cross compiling anyway. + wrappers_required=no + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $ECHO for shipping. + if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + oldobjs="$oldobjs $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $ECHO "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlfiles="$newdlfiles $libdir/$name" + ;; + *) newdlfiles="$newdlfiles $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlprefiles="$newdlprefiles $libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$mode" = link || test "$mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) RM="$RM $arg"; rmforce=yes ;; + -*) RM="$RM $arg" ;; + *) files="$files $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$mode" = uninstall || test "$mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/packages/bee/cryptominisat-2.5.1/m4-extra/boost.m4 b/packages/bee/cryptominisat-2.5.1/m4-extra/boost.m4 new file mode 100755 index 000000000..ee3013f14 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/m4-extra/boost.m4 @@ -0,0 +1,1038 @@ +# boost.m4: Locate Boost headers and libraries for autoconf-based projects. +# Copyright (C) 2007, 2008, 2009 Benoit Sigoure +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Additional permission under section 7 of the GNU General Public +# License, version 3 ("GPLv3"): +# +# If you convey this file as part of a work that contains a +# configuration script generated by Autoconf, you may do so under +# terms of your choice. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +m4_define([_BOOST_SERIAL], [m4_translit([ +# serial 12 +], [# +], [])]) + +# Original sources can be found at http://github.com/tsuna/boost.m4 +# You can fetch the latest version of the script by doing: +# wget http://github.com/tsuna/boost.m4/raw/master/build-aux/boost.m4 + +# ------ # +# README # +# ------ # + +# This file provides several macros to use the various Boost libraries. +# The first macro is BOOST_REQUIRE. It will simply check if it's possible to +# find the Boost headers of a given (optional) minimum version and it will +# define BOOST_CPPFLAGS accordingly. It will add an option --with-boost to +# your configure so that users can specify non standard locations. +# If the user's environment contains BOOST_ROOT and --with-boost was not +# specified, --with-boost=$BOOST_ROOT is implicitly used. +# For more README and documentation, go to http://github.com/tsuna/boost.m4 +# Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL. If you don't, don't worry, +# simply read the README, it will show you what to do step by step. + +m4_pattern_forbid([^_?BOOST_]) + + +# _BOOST_SED_CPP(SED-PROGRAM, PROGRAM, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# -------------------------------------------------------- +# Same as AC_EGREP_CPP, but leave the result in conftest.i. +# PATTERN is *not* overquoted, as in AC_EGREP_CPP. It could be useful +# to turn this into a macro which extracts the value of any macro. +m4_define([_BOOST_SED_CPP], +[AC_LANG_PREPROC_REQUIRE()dnl +AC_REQUIRE([AC_PROG_SED])dnl +AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])]) +AS_IF([dnl eval is necessary to expand ac_cpp. +dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. +dnl Beware of Windows end-of-lines, for instance if we are running +dnl some Windows programs under Wine. In that case, boost/version.hpp +dnl is certainly using "\r\n", but the regular Unix shell will only +dnl strip `\n' with backquotes, not the `\r'. This results in +dnl boost_cv_lib_version='1_37\r' for instance, which breaks +dnl everything else. +dnl Cannot use 'dnl' after [$4] because a trailing dnl may break AC_CACHE_CHECK +(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + tr -d '\r' | + $SED -n -e "$1" >conftest.i 2>&1], + [$3], + [$4]) +rm -rf conftest* +])# AC_EGREP_CPP + + + +# BOOST_REQUIRE([VERSION], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------- +# Look for Boost. If version is given, it must either be a literal of the form +# "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a +# variable "$var". +# Defines the value BOOST_CPPFLAGS. This macro only checks for headers with +# the required version, it does not check for any of the Boost libraries. +# On # success, defines HAVE_BOOST. On failure, calls the optional +# ACTION-IF-NOT-FOUND action if one was supplied. +# Otherwise aborts with an error message. +AC_DEFUN([BOOST_REQUIRE], +[AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_GREP])dnl +echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD +boost_save_IFS=$IFS +boost_version_req=$1 +IFS=. +set x $boost_version_req 0 0 0 +IFS=$boost_save_IFS +shift +boost_version_req=`expr "$[1]" '*' 100000 + "$[2]" '*' 100 + "$[3]"` +AC_ARG_WITH([boost], + [AS_HELP_STRING([--with-boost=DIR], + [prefix of Boost $1 @<:@guess@:>@])])dnl +AC_ARG_VAR([BOOST_ROOT],[Location of Boost installation])dnl +# If BOOST_ROOT is set and the user has not provided a value to +# --with-boost, then treat BOOST_ROOT as if it the user supplied it. +if test x"$BOOST_ROOT" != x; then + if test x"$with_boost" = x; then + AC_MSG_NOTICE([Detected BOOST_ROOT; continuing with --with-boost=$BOOST_ROOT]) + with_boost=$BOOST_ROOT + else + AC_MSG_NOTICE([Detected BOOST_ROOT=$BOOST_ROOT, but overridden by --with-boost=$with_boost]) + fi +fi +AC_SUBST([DISTCHECK_CONFIGURE_FLAGS], + ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"]) +boost_save_CPPFLAGS=$CPPFLAGS + AC_CACHE_CHECK([for Boost headers version >= $boost_version_req], + [boost_cv_inc_path], + [boost_cv_inc_path=no +AC_LANG_PUSH([C++])dnl +m4_pattern_allow([^BOOST_VERSION$])dnl + AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include +#if !defined BOOST_VERSION +# error BOOST_VERSION is not defined +#elif BOOST_VERSION < $boost_version_req +# error Boost headers version < $boost_version_req +#endif +]])]) + # If the user provided a value to --with-boost, use it and only it. + case $with_boost in #( + ''|yes) set x '' /opt/local/include /usr/local/include /opt/include \ + /usr/include C:/Boost/include;; #( + *) set x "$with_boost/include" "$with_boost";; + esac + shift + for boost_dir + do + # Without --layout=system, Boost (or at least some versions) installs + # itself in /include/boost-. This inner loop helps to + # find headers in such directories. + # + # Any ${boost_dir}/boost-x_xx directories are searched in reverse version + # order followed by ${boost_dir}. The final '.' is a sentinel for + # searching $boost_dir" itself. Entries are whitespace separated. + # + # I didn't indent this loop on purpose (to avoid over-indented code) + boost_layout_system_search_list=`cd "$boost_dir" 2>/dev/null \ + && ls -1 | "${GREP}" '^boost-' | sort -rn -t- -k2 \ + && echo .` + for boost_inc in $boost_layout_system_search_list + do + if test x"$boost_inc" != x.; then + boost_inc="$boost_dir/$boost_inc" + else + boost_inc="$boost_dir" # Uses sentinel in boost_layout_system_search_list + fi + if test x"$boost_inc" != x; then + # We are going to check whether the version of Boost installed + # in $boost_inc is usable by running a compilation that + # #includes it. But if we pass a -I/some/path in which Boost + # is not installed, the compiler will just skip this -I and + # use other locations (either from CPPFLAGS, or from its list + # of system include directories). As a result we would use + # header installed on the machine instead of the /some/path + # specified by the user. So in that precise case (trying + # $boost_inc), make sure the version.hpp exists. + # + # Use test -e as there can be symlinks. + test -e "$boost_inc/boost/version.hpp" || continue + CPPFLAGS="$CPPFLAGS -I$boost_inc" + fi + AC_COMPILE_IFELSE([], [boost_cv_inc_path=yes], [boost_cv_version=no]) + if test x"$boost_cv_inc_path" = xyes; then + if test x"$boost_inc" != x; then + boost_cv_inc_path=$boost_inc + fi + break 2 + fi + done + done +AC_LANG_POP([C++])dnl + ]) + case $boost_cv_inc_path in #( + no) + boost_errmsg="cannot find Boost headers version >= $boost_version_req" + m4_if([$2], [], [AC_MSG_ERROR([$boost_errmsg])], + [AC_MSG_NOTICE([$boost_errmsg])]) + $2 + ;;#( + yes) + BOOST_CPPFLAGS= + ;;#( + *) + AC_SUBST([BOOST_CPPFLAGS], ["-I$boost_cv_inc_path"]) + ;; + esac + if test x"$boost_cv_inc_path" != xno; then + AC_DEFINE([HAVE_BOOST], [1], + [Defined if the requested minimum BOOST version is satisfied]) + AC_CACHE_CHECK([for Boost's header version], + [boost_cv_lib_version], + [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl + _BOOST_SED_CPP([/^boost-lib-version = /{s///;s/\"//g;p;g;}], + [#include +boost-lib-version = BOOST_LIB_VERSION], + [boost_cv_lib_version=`cat conftest.i`])]) + # e.g. "134" for 1_34_1 or "135" for 1_35 + boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'` + case $boost_major_version in #( + '' | *[[!0-9]]*) + AC_MSG_ERROR([invalid value: boost_major_version=$boost_major_version]) + ;; + esac +fi +CPPFLAGS=$boost_save_CPPFLAGS +])# BOOST_REQUIRE + +# BOOST_STATIC() +# -------------- +# Add the "--enable-static-boost" configure argument. If this argument is given +# on the command line, static versions of the libraries will be looked up. +AC_DEFUN([BOOST_STATIC], + [AC_ARG_ENABLE([static-boost], + [AC_HELP_STRING([--enable-static-boost], + [Prefer the static boost libraries over the shared ones [no]])], + [enable_static_boost=yes], + [enable_static_boost=no])])# BOOST_STATIC + +# BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND]) +# -------------------------------------------------------------------------- +# Wrapper around AC_CHECK_HEADER for Boost headers. Useful to check for +# some parts of the Boost library which are only made of headers and don't +# require linking (such as Boost.Foreach). +# +# Default ACTION-IF-NOT-FOUND: Fail with a fatal error unless Boost couldn't be +# found in the first place, in which case by default a notice is issued to the +# user. Presumably if we haven't died already it's because it's OK to not have +# Boost, which is why only a notice is issued instead of a hard error. +# +# Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_ in +# case of success # (where HEADER-NAME is written LIKE_THIS, e.g., +# HAVE_BOOST_FOREACH_HPP). +AC_DEFUN([BOOST_FIND_HEADER], +[AC_REQUIRE([BOOST_REQUIRE])dnl +if test x"$boost_cv_inc_path" = xno; then + m4_default([$2], [AC_MSG_NOTICE([Boost not available, not searching for $1])]) +else +AC_LANG_PUSH([C++])dnl +boost_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +AC_CHECK_HEADER([$1], + [m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1], + [Define to 1 if you have <$1>])])], + [m4_default([$2], [AC_MSG_ERROR([cannot find $1])])]) +CPPFLAGS=$boost_save_CPPFLAGS +AC_LANG_POP([C++])dnl +fi +])# BOOST_FIND_HEADER + + +# BOOST_FIND_LIB([LIB-NAME], [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST], +# [CXX-PROLOGUE]) +# ------------------------------------------------------------------------- +# Look for the Boost library LIB-NAME (e.g., LIB-NAME = `thread', for +# libboost_thread). Check that HEADER-NAME works and check that +# libboost_LIB-NAME can link with the code CXX-TEST. The optional argument +# CXX-PROLOGUE can be used to include some C++ code before the `main' +# function. +# +# Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above). +# +# Boost libraries typically come compiled with several flavors (with different +# runtime options) so PREFERRED-RT-OPT is the preferred suffix. A suffix is one +# or more of the following letters: sgdpn (in that order). s = static +# runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build, +# n = (unsure) STLPort build without iostreams from STLPort (it looks like `n' +# must always be used along with `p'). Additionally, PREFERRED-RT-OPT can +# start with `mt-' to indicate that there is a preference for multi-thread +# builds. Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp +# ... If you want to make sure you have a specific version of Boost +# (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro. +AC_DEFUN([BOOST_FIND_LIB], +[AC_REQUIRE([BOOST_REQUIRE])dnl +AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl +AC_REQUIRE([BOOST_STATIC])dnl +AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl +if test x"$boost_cv_inc_path" = xno; then + AC_MSG_NOTICE([Boost not available, not searching for the Boost $1 library]) +else +dnl The else branch is huge and wasn't intended on purpose. +AC_LANG_PUSH([C++])dnl +AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl +AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl +AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl +BOOST_FIND_HEADER([$3]) +boost_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" +# Now let's try to find the library. The algorithm is as follows: first look +# for a given library name according to the user's PREFERRED-RT-OPT. For each +# library name, we prefer to use the ones that carry the tag (toolset name). +# Each library is searched through the various standard paths were Boost is +# usually installed. If we can't find the standard variants, we try to +# enforce -mt (for instance on MacOSX, libboost_threads.dylib doesn't exist +# but there's -obviously- libboost_threads-mt.dylib). +AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib], + [Boost_lib=no + case "$2" in #( + mt | mt-) boost_mt=-mt; boost_rtopt=;; #( + mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$2" : 'Xmt-*\(.*\)'`;; #( + *) boost_mt=; boost_rtopt=$2;; + esac + if test $enable_static_boost = yes; then + boost_rtopt="s$boost_rtopt" + fi + # Find the proper debug variant depending on what we've been asked to find. + case $boost_rtopt in #( + *d*) boost_rt_d=$boost_rtopt;; #( + *[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn') + boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #( + *) boost_rt_d='-d';; + esac + # If the PREFERRED-RT-OPT are not empty, prepend a `-'. + test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt" + $boost_guess_use_mt && boost_mt=-mt + # Look for the abs path the static archive. + # $libext is computed by Libtool but let's make sure it's non empty. + test -z "$libext" && + AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?]) + boost_save_ac_objext=$ac_objext + # Generate the test file. + AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$3> +$5], [$4])]) +dnl Optimization hacks: compiling C++ is slow, especially with Boost. What +dnl we're trying to do here is guess the right combination of link flags +dnl (LIBS / LDFLAGS) to use a given library. This can take several +dnl iterations before it succeeds and is thus *very* slow. So what we do +dnl instead is that we compile the code first (and thus get an object file, +dnl typically conftest.o). Then we try various combinations of link flags +dnl until we succeed to link conftest.o in an executable. The problem is +dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always +dnl remove all the temporary files including conftest.o. So the trick here +dnl is to temporarily change the value of ac_objext so that conftest.o is +dnl preserved accross tests. This is obviously fragile and I will burn in +dnl hell for not respecting Autoconf's documented interfaces, but in the +dnl mean time, it optimizes the macro by a factor of 5 to 30. +dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left +dnl empty because the test file is generated only once above (before we +dnl start the for loops). + AC_COMPILE_IFELSE([], + [ac_objext=do_not_rm_me_plz], + [AC_MSG_ERROR([cannot compile a test that uses Boost $1])]) + ac_objext=$boost_save_ac_objext + boost_failed_libs= +# Don't bother to ident the 6 nested for loops, only the 2 innermost ones +# matter. +for boost_tag_ in -$boost_cv_lib_tag ''; do +for boost_ver_ in -$boost_cv_lib_version ''; do +for boost_mt_ in $boost_mt -mt ''; do +for boost_rtopt_ in $boost_rtopt '' -d; do + for boost_lib in \ + boost_$1$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \ + boost_$1$boost_tag_$boost_rtopt_$boost_ver_ \ + boost_$1$boost_tag_$boost_mt_$boost_ver_ \ + boost_$1$boost_tag_$boost_ver_ + do + # Avoid testing twice the same lib + case $boost_failed_libs in #( + *@$boost_lib@*) continue;; + esac + # If with_boost is empty, we'll search in /lib first, which is not quite + # right so instead we'll try to a location based on where the headers are. + boost_tmp_lib=$with_boost + test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include} + for boost_ldpath in "$boost_tmp_lib/lib" '' \ + /opt/local/lib /usr/local/lib /opt/lib /usr/lib \ + "$with_boost" C:/Boost/lib /lib /usr/lib64 /lib64 + do + test -e "$boost_ldpath" || continue + boost_save_LDFLAGS=$LDFLAGS + # Are we looking for a static library? + case $boost_ldpath:$boost_rtopt_ in #( + *?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt) + Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext" + test -e "$Boost_lib_LIBS" || continue;; #( + *) # No: use -lboost_foo to find the shared library. + Boost_lib_LIBS="-l$boost_lib";; + esac + boost_save_LIBS=$LIBS + LIBS="$Boost_lib_LIBS $LIBS" + test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath" +dnl First argument of AC_LINK_IFELSE left empty because the test file is +dnl generated only once above (before we start the for loops). + _BOOST_AC_LINK_IFELSE([], + [Boost_lib=yes], [Boost_lib=no]) + ac_objext=$boost_save_ac_objext + LDFLAGS=$boost_save_LDFLAGS + LIBS=$boost_save_LIBS + if test x"$Boost_lib" = xyes; then + Boost_lib_LDFLAGS="-L$boost_ldpath -R$boost_ldpath" + break 6 + else + boost_failed_libs="$boost_failed_libs@$boost_lib@" + fi + done + done +done +done +done +done +rm -f conftest.$ac_objext +]) +case $Boost_lib in #( + no) _AC_MSG_LOG_CONFTEST + AC_MSG_ERROR([cannot not find the flags to link with Boost $1]) + ;; +esac +AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS]) +AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS]) +CPPFLAGS=$boost_save_CPPFLAGS +AS_VAR_POPDEF([Boost_lib])dnl +AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl +AS_VAR_POPDEF([Boost_lib_LIBS])dnl +AC_LANG_POP([C++])dnl +fi +])# BOOST_FIND_LIB + + +# --------------------------------------- # +# Checks for the various Boost libraries. # +# --------------------------------------- # + +# List of boost libraries: http://www.boost.org/libs/libraries.htm +# The page http://beta.boost.org/doc/libs is useful: it gives the first release +# version of each library (among other things). + +# BOOST_ARRAY() +# ------------- +# Look for Boost.Array +AC_DEFUN([BOOST_ARRAY], +[BOOST_FIND_HEADER([boost/array.hpp])]) + + +# BOOST_ASIO() +# ------------ +# Look for Boost.Asio (new in Boost 1.35). +AC_DEFUN([BOOST_ASIO], +[AC_REQUIRE([BOOST_SYSTEM])dnl +BOOST_FIND_HEADER([boost/asio.hpp])]) + + +# BOOST_BIND() +# ------------ +# Look for Boost.Bind +AC_DEFUN([BOOST_BIND], +[BOOST_FIND_HEADER([boost/bind.hpp])]) + + +# BOOST_CONVERSION() +# ------------------ +# Look for Boost.Conversion (cast / lexical_cast) +AC_DEFUN([BOOST_CONVERSION], +[BOOST_FIND_HEADER([boost/cast.hpp]) +BOOST_FIND_HEADER([boost/lexical_cast.hpp]) +])# BOOST_CONVERSION + + +# BOOST_DATE_TIME([PREFERRED-RT-OPT]) +# ----------------------------------- +# Look for Boost.Date_Time. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +AC_DEFUN([BOOST_DATE_TIME], +[BOOST_FIND_LIB([date_time], [$1], + [boost/date_time/posix_time/posix_time.hpp], + [boost::posix_time::ptime t;]) +])# BOOST_DATE_TIME + + +# BOOST_FILESYSTEM([PREFERRED-RT-OPT]) +# ------------------------------------ +# Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see +# the documentation of BOOST_FIND_LIB above. +# Do not check for boost/filesystem.hpp because this file was introduced in +# 1.34. +AC_DEFUN([BOOST_FILESYSTEM], +[# Do we have to check for Boost.System? This link-time dependency was +# added as of 1.35.0. If we have a version <1.35, we must not attempt to +# find Boost.System as it didn't exist by then. +if test $boost_major_version -ge 135; then +BOOST_SYSTEM([$1]) +fi # end of the Boost.System check. +boost_filesystem_save_LIBS=$LIBS +boost_filesystem_save_LDFLAGS=$LDFLAGS +m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl +LIBS="$LIBS $BOOST_SYSTEM_LIBS" +LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" +BOOST_FIND_LIB([filesystem], [$1], + [boost/filesystem/path.hpp], [boost::filesystem::path p;]) +LIBS=$boost_filesystem_save_LIBS +LDFLAGS=$boost_filesystem_save_LDFLAGS +])# BOOST_FILESYSTEM + + +# BOOST_FOREACH() +# --------------- +# Look for Boost.Foreach +AC_DEFUN([BOOST_FOREACH], +[BOOST_FIND_HEADER([boost/foreach.hpp])]) + + +# BOOST_FORMAT() +# -------------- +# Look for Boost.Format +# Note: we can't check for boost/format/format_fwd.hpp because the header isn't +# standalone. It can't be compiled because it triggers the following error: +# boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std' +# does not name a type +AC_DEFUN([BOOST_FORMAT], +[BOOST_FIND_HEADER([boost/format.hpp])]) + + +# BOOST_FUNCTION() +# ---------------- +# Look for Boost.Function +AC_DEFUN([BOOST_FUNCTION], +[BOOST_FIND_HEADER([boost/function.hpp])]) + + +# BOOST_GRAPH([PREFERRED-RT-OPT]) +# ------------------------------- +# Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +AC_DEFUN([BOOST_GRAPH], +[BOOST_FIND_LIB([graph], [$1], + [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;]) +])# BOOST_GRAPH + + +# BOOST_IOSTREAMS([PREFERRED-RT-OPT]) +# ------------------------------- +# Look for Boost.IOStreams. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +AC_DEFUN([BOOST_IOSTREAMS], +[BOOST_FIND_LIB([iostreams], [$1], + [boost/iostreams/device/file_descriptor.hpp], + [boost::iostreams::file_descriptor fd(0); fd.close();]) +])# BOOST_IOSTREAMS + + +# BOOST_HASH() +# ------------ +# Look for Boost.Functional/Hash +AC_DEFUN([BOOST_HASH], +[BOOST_FIND_HEADER([boost/functional/hash.hpp])]) + + +# BOOST_LAMBDA() +# -------------- +# Look for Boost.Lambda +AC_DEFUN([BOOST_LAMBDA], +[BOOST_FIND_HEADER([boost/lambda/lambda.hpp])]) + + +# BOOST_MATH() +# ------------ +# Look for Boost.Math +# TODO: This library isn't header-only but it comes in multiple different +# flavors that don't play well with BOOST_FIND_LIB (e.g, libboost_math_c99, +# libboost_math_c99f, libboost_math_c99l, libboost_math_tr1, +# libboost_math_tr1f, libboost_math_tr1l). This macro must be fixed to do the +# right thing anyway. +AC_DEFUN([BOOST_MATH], +[BOOST_FIND_HEADER([boost/math/special_functions.hpp])]) + + +# BOOST_MULTIARRAY() +# ------------------ +# Look for Boost.MultiArray +AC_DEFUN([BOOST_MULTIARRAY], +[BOOST_FIND_HEADER([boost/multi_array.hpp])]) + + +# BOOST_NUMERIC_CONVERSION() +# -------------------------- +# Look for Boost.NumericConversion (policy-based numeric conversion) +AC_DEFUN([BOOST_NUMERIC_CONVERSION], +[BOOST_FIND_HEADER([boost/numeric/conversion/converter.hpp]) +])# BOOST_NUMERIC_CONVERSION + + +# BOOST_OPTIONAL() +# ---------------- +# Look for Boost.Optional +AC_DEFUN([BOOST_OPTIONAL], +[BOOST_FIND_HEADER([boost/optional.hpp])]) + + +# BOOST_PREPROCESSOR() +# -------------------- +# Look for Boost.Preprocessor +AC_DEFUN([BOOST_PREPROCESSOR], +[BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])]) + + +# BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT]) +# ----------------------------------------- +# Look for Boost.Program_options. For the documentation of PREFERRED-RT-OPT, see +# the documentation of BOOST_FIND_LIB above. +AC_DEFUN([BOOST_PROGRAM_OPTIONS], +[BOOST_FIND_LIB([program_options], [$1], + [boost/program_options.hpp], + [boost::program_options::options_description d("test");]) +])# BOOST_PROGRAM_OPTIONS + + +# BOOST_REF() +# ----------- +# Look for Boost.Ref +AC_DEFUN([BOOST_REF], +[BOOST_FIND_HEADER([boost/ref.hpp])]) + + +# BOOST_REGEX([PREFERRED-RT-OPT]) +# ------------------------------- +# Look for Boost.Regex. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +AC_DEFUN([BOOST_REGEX], +[BOOST_FIND_LIB([regex], [$1], + [boost/regex.hpp], + [boost::regex exp("*"); boost::regex_match("foo", exp);]) +])# BOOST_REGEX + + +# BOOST_SERIALIZATION([PREFERRED-RT-OPT]) +# --------------------------------------- +# Look for Boost.Serialization. For the documentation of PREFERRED-RT-OPT, see +# the documentation of BOOST_FIND_LIB above. +AC_DEFUN([BOOST_SERIALIZATION], +[BOOST_FIND_LIB([serialization], [$1], + [boost/archive/text_oarchive.hpp], + [std::ostream* o = 0; // Cheap way to get an ostream... + boost::archive::text_oarchive t(*o);]) +])# BOOST_SIGNALS + + +# BOOST_SIGNALS([PREFERRED-RT-OPT]) +# --------------------------------- +# Look for Boost.Signals. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +AC_DEFUN([BOOST_SIGNALS], +[BOOST_FIND_LIB([signals], [$1], + [boost/signal.hpp], + [boost::signal s;]) +])# BOOST_SIGNALS + + +# BOOST_SMART_PTR() +# ----------------- +# Look for Boost.SmartPtr +AC_DEFUN([BOOST_SMART_PTR], +[BOOST_FIND_HEADER([boost/scoped_ptr.hpp]) +BOOST_FIND_HEADER([boost/shared_ptr.hpp]) +]) + + +# BOOST_STATICASSERT() +# -------------------- +# Look for Boost.StaticAssert +AC_DEFUN([BOOST_STATICASSERT], +[BOOST_FIND_HEADER([boost/static_assert.hpp])]) + + +# BOOST_STRING_ALGO() +# ------------------- +# Look for Boost.StringAlgo +AC_DEFUN([BOOST_STRING_ALGO], +[BOOST_FIND_HEADER([boost/algorithm/string.hpp]) +]) + + +# BOOST_SYSTEM([PREFERRED-RT-OPT]) +# -------------------------------- +# Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. This library was introduced in Boost +# 1.35.0. +AC_DEFUN([BOOST_SYSTEM], +[BOOST_FIND_LIB([system], [$1], + [boost/system/error_code.hpp], + [boost::system::error_code e; e.clear();]) +])# BOOST_SYSTEM + + +# BOOST_TEST([PREFERRED-RT-OPT]) +# ------------------------------ +# Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +AC_DEFUN([BOOST_TEST], +[m4_pattern_allow([^BOOST_CHECK$])dnl +BOOST_FIND_LIB([unit_test_framework], [$1], + [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);], + [using boost::unit_test::test_suite; + test_suite* init_unit_test_suite(int argc, char ** argv) + { return NULL; }]) +])# BOOST_TEST + + +# BOOST_THREADS([PREFERRED-RT-OPT]) +# --------------------------------- +# Look for Boost.Thread. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +# FIXME: Provide an alias "BOOST_THREAD". +AC_DEFUN([BOOST_THREADS], +[dnl Having the pthread flag is required at least on GCC3 where +dnl boost/thread.hpp would complain if we try to compile without +dnl -pthread on GNU/Linux. +AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl +boost_threads_save_LIBS=$LIBS +boost_threads_save_CPPFLAGS=$CPPFLAGS +LIBS="$LIBS $boost_cv_pthread_flag" +# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3, +# boost/thread.hpp will trigger a #error if -pthread isn't used: +# boost/config/requires_threads.hpp:47:5: #error "Compiler threading support +# is not turned on. Please set the correct command line options for +# threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" +CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag" +BOOST_FIND_LIB([thread], [$1], + [boost/thread.hpp], [boost::thread t; boost::mutex m;]) +BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $boost_cv_pthread_flag" +BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag" +LIBS=$boost_threads_save_LIBS +CPPFLAGS=$boost_threads_save_CPPFLAGS +])# BOOST_THREADS + + +# BOOST_TOKENIZER() +# ----------------- +# Look for Boost.Tokenizer +AC_DEFUN([BOOST_TOKENIZER], +[BOOST_FIND_HEADER([boost/tokenizer.hpp])]) + + +# BOOST_TRIBOOL() +# --------------- +# Look for Boost.Tribool +AC_DEFUN([BOOST_TRIBOOL], +[BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp]) +BOOST_FIND_HEADER([boost/logic/tribool.hpp]) +]) + + +# BOOST_TUPLE() +# ------------- +# Look for Boost.Tuple +AC_DEFUN([BOOST_TUPLE], +[BOOST_FIND_HEADER([boost/tuple/tuple.hpp])]) + + +# BOOST_TYPETRAITS() +# -------------------- +# Look for Boost.TypeTraits +AC_DEFUN([BOOST_TYPETRAITS], +[BOOST_FIND_HEADER([boost/type_traits.hpp])]) + + +# BOOST_UTILITY() +# --------------- +# Look for Boost.Utility (noncopyable, result_of, base-from-member idiom, +# etc.) +AC_DEFUN([BOOST_UTILITY], +[BOOST_FIND_HEADER([boost/utility.hpp])]) + + +# BOOST_VARIANT() +# --------------- +# Look for Boost.Variant. +AC_DEFUN([BOOST_VARIANT], +[BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp]) +BOOST_FIND_HEADER([boost/variant.hpp])]) + + +# BOOST_WAVE([PREFERRED-RT-OPT]) +# ------------------------------ +# NOTE: If you intend to use Wave/Spirit with thread support, make sure you +# call BOOST_THREADS first. +# Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. +AC_DEFUN([BOOST_WAVE], +[AC_REQUIRE([BOOST_FILESYSTEM])dnl +AC_REQUIRE([BOOST_DATE_TIME])dnl +boost_wave_save_LIBS=$LIBS +boost_wave_save_LDFLAGS=$LDFLAGS +m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl +LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS\ +$BOOST_THREAD_LIBS" +LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS\ +$BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS" +BOOST_FIND_LIB([wave], [$1], + [boost/wave.hpp], + [boost::wave::token_id id; get_token_name(id);]) +LIBS=$boost_wave_save_LIBS +LDFLAGS=$boost_wave_save_LDFLAGS +])# BOOST_WAVE + + +# BOOST_XPRESSIVE() +# ----------------- +# Look for Boost.Xpressive (new since 1.36.0). +AC_DEFUN([BOOST_XPRESSIVE], +[BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])]) + + +# ----------------- # +# Internal helpers. # +# ----------------- # + + +# _BOOST_PTHREAD_FLAG() +# --------------------- +# Internal helper for BOOST_THREADS. Based on ACX_PTHREAD: +# http://autoconf-archive.cryp.to/acx_pthread.html +AC_DEFUN([_BOOST_PTHREAD_FLAG], +[AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_LANG_PUSH([C++])dnl +AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag], +[ boost_cv_pthread_flag= + # The ordering *is* (sometimes) important. Some notes on the + # individual items follow: + # (none): in case threads are in libc; should be tried before -Kthread and + # other compiler flags to prevent continual compiler warnings + # -lpthreads: AIX (must check this before -lpthread) + # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads) + # -pthreads: Solaris/GCC + # -mthreads: MinGW32/GCC, Lynx/GCC + # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it + # doesn't hurt to check since this sometimes defines pthreads too; + # also defines -D_REENTRANT) + # ... -mt is also the pthreads flag for HP/aCC + # -lpthread: GNU Linux, etc. + # --thread-safe: KAI C++ + case $host_os in #( + *solaris*) + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #( + *) + boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \ + -pthreads -mthreads -lpthread --thread-safe -mt";; + esac + # Generate the test file. + AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include ], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0);])]) + for boost_pthread_flag in '' $boost_pthread_flags; do + boost_pthread_ok=false +dnl Re-use the test file already generated. + boost_pthreads__save_LIBS=$LIBS + LIBS="$LIBS $boost_pthread_flag" + AC_LINK_IFELSE([], + [if grep ".*$boost_pthread_flag" conftest.err; then + echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD + else + boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag + fi]) + LIBS=$boost_pthreads__save_LIBS + $boost_pthread_ok && break + done +]) +AC_LANG_POP([C++])dnl +])# _BOOST_PTHREAD_FLAG + + +# _BOOST_gcc_test(MAJOR, MINOR) +# ----------------------------- +# Internal helper for _BOOST_FIND_COMPILER_TAG. +m4_define([_BOOST_gcc_test], +["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl + + +# _BOOST_FIND_COMPILER_TAG() +# -------------------------- +# Internal. When Boost is installed without --layout=system, each library +# filename will hold a suffix that encodes the compiler used during the +# build. The Boost build system seems to call this a `tag'. +AC_DEFUN([_BOOST_FIND_COMPILER_TAG], +[AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag], +[boost_cv_lib_tag=unknown +if test x$boost_cv_inc_path != xno; then + AC_LANG_PUSH([C++])dnl + # The following tests are mostly inspired by boost/config/auto_link.hpp + # The list is sorted to most recent/common to oldest compiler (in order + # to increase the likelihood of finding the right compiler with the + # least number of compilation attempt). + # Beware that some tests are sensible to the order (for instance, we must + # look for MinGW before looking for GCC3). + # I used one compilation test per compiler with a #error to recognize + # each compiler so that it works even when cross-compiling (let me know + # if you know a better approach). + # Known missing tags (known from Boost's tools/build/v2/tools/common.jam): + # como, edg, kcc, bck, mp, sw, tru, xlc + # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines + # the same defines as GCC's). + # TODO: Move the test on GCC 4.4 up once it's released. + for i in \ + _BOOST_gcc_test(4, 3) \ + _BOOST_gcc_test(4, 2) \ + _BOOST_gcc_test(4, 1) \ + _BOOST_gcc_test(4, 0) \ + "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \ + && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \ + || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \ + _BOOST_gcc_test(3, 4) \ + _BOOST_gcc_test(3, 3) \ + "defined _MSC_VER && _MSC_VER >= 1500 @ vc90" \ + "defined _MSC_VER && _MSC_VER == 1400 @ vc80" \ + _BOOST_gcc_test(3, 2) \ + "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \ + _BOOST_gcc_test(3, 1) \ + _BOOST_gcc_test(3, 0) \ + "defined __BORLANDC__ @ bcb" \ + "defined __ICC && (defined __unix || defined __unix__) @ il" \ + "defined __ICL @ iw" \ + "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \ + _BOOST_gcc_test(4, 4) \ + _BOOST_gcc_test(2, 95) \ + "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \ + "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \ + "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \ + "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8" + do + boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '` + boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'` + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if $boost_tag_test +/* OK */ +#else +# error $boost_tag_test +#endif +]])], [boost_cv_lib_tag=$boost_tag; break], []) + done +AC_LANG_POP([C++])dnl + case $boost_cv_lib_tag in #( + # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed + # to "gcc41" for instance. + *-gcc | *'-gcc ') :;; #( Don't re-add -gcc: it's already in there. + gcc*) + boost_tag_x= + case $host_os in #( + darwin*) + if test $boost_major_version -ge 136; then + # The `x' added in r46793 of Boost. + boost_tag_x=x + fi;; + esac + # We can specify multiple tags in this variable because it's used by + # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ... + boost_cv_lib_tag="$boost_tag_x$boost_cv_lib_tag -${boost_tag_x}gcc" + ;; #( + unknown) + AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]]) + boost_cv_lib_tag= + ;; + esac +fi])dnl end of AC_CACHE_CHECK +])# _BOOST_FIND_COMPILER_TAG + + +# _BOOST_GUESS_WHETHER_TO_USE_MT() +# -------------------------------- +# Compile a small test to try to guess whether we should favor MT (Multi +# Thread) flavors of Boost. Sets boost_guess_use_mt accordingly. +AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT], +[# Check whether we do better use `mt' even though we weren't ask to. +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if defined _REENTRANT || defined _MT || defined __MT__ +/* use -mt */ +#else +# error MT not needed +#endif +]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false]) +]) + +# _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ------------------------------------------------------------------- +# Fork of _AC_LINK_IFELSE that preserves conftest.o across calls. Fragile, +# will break when Autoconf changes its internals. Requires that you manually +# rm -f conftest.$ac_objext in between to really different tests, otherwise +# you will try to link a conftest.o left behind by a previous test. +# Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this +# macro). +# +# Don't use "break" in the actions, as it would short-circuit some code +# this macro runs after the actions. +m4_define([_BOOST_AC_LINK_IFELSE], +[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl +rm -f conftest$ac_exeext +boost_save_ac_ext=$ac_ext +boost_use_source=: +# If we already have a .o, re-use it. We change $ac_ext so that $ac_link +# tries to link the existing object file instead of compiling from source. +test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false && + _AS_ECHO_LOG([re-using the existing conftest.$ac_objext]) +AS_IF([_AC_DO_STDERR($ac_link) && { + test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_executable_p conftest$ac_exeext +dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough. + }], + [$2], + [if $boost_use_source; then + _AC_MSG_LOG_CONFTEST + fi + $3]) +ac_objext=$boost_save_ac_objext +ac_ext=$boost_save_ac_ext +dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization) +dnl information created by the PGI compiler (conftest_ipa8_conftest.oo), +dnl as it would interfere with the next link command. +rm -f core conftest.err conftest_ipa8_conftest.oo \ + conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl +])# _BOOST_AC_LINK_IFELSE + +# Local Variables: +# mode: autoconf +# End: diff --git a/packages/bee/cryptominisat-2.5.1/m4/libtool.m4 b/packages/bee/cryptominisat-2.5.1/m4/libtool.m4 new file mode 100755 index 000000000..a3fee5360 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/m4/libtool.m4 @@ -0,0 +1,7377 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 56 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl +_LT_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\[$]0 --fallback-echo"')dnl " + lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` + ;; +esac + +_LT_OUTPUT_LIBTOOL_INIT +]) + + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +cat >"$CONFIG_LT" <<_LTEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate a libtool stub with the current configuration. + +lt_cl_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AS_SHELL_SANITIZE +_AS_PREPARE + +exec AS_MESSAGE_FD>&1 +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2008 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +if test "$no_create" != yes; then + lt_cl_success=: + test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" + exec AS_MESSAGE_LOG_FD>/dev/null + $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false + exec AS_MESSAGE_LOG_FD>>config.log + $lt_cl_success || AS_EXIT(1) +fi +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_XSI_SHELLFNS + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES +# -------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=echo + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX +# ----------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_SHELL_INIT + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[_LT_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +[$]* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(lt_ECHO) +]) +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], + [An echo program that does not interpret backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[AC_CHECK_TOOL(AR, ar, false) +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1]) + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[[3-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method == "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC*) + # IBM XL 8.0 on PPC + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac +AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + ;; + linux* | k*bsd*-gnu) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag= + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + _LT_TAGVAR(link_all_deplibs, $1)=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE(int foo(void) {}, + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + ) + LDFLAGS="$save_LDFLAGS" + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], + [[If ld is used when linking, flag to hardcode $libdir into a binary + during linking. This must work even if $libdir does not exist]]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [fix_srcfile_path], [1], + [Fix the shell variable $srcfile for the compiler]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_PROG_CXX +# ------------ +# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ +# compiler, we have our own version here. +m4_defun([_LT_PROG_CXX], +[ +pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) +AC_PROG_CXX +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_CXX + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_CXX], []) + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[AC_REQUIRE([_LT_PROG_CXX])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 will use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + xl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=echo + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +]) +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_PROG_F77 +# ------------ +# Since AC_PROG_F77 is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_F77], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) +AC_PROG_F77 +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_F77 + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_F77], []) + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_REQUIRE([_LT_PROG_F77])dnl +AC_LANG_PUSH(Fortran 77) + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + CC=${F77-"f77"} + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_PROG_FC +# ----------- +# Since AC_PROG_FC is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_FC], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) +AC_PROG_FC +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_FC + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_FC], []) + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_REQUIRE([_LT_PROG_FC])dnl +AC_LANG_PUSH(Fortran) + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + CC=${FC-"f95"} + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC="$lt_save_CC" +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC="$lt_save_CC" +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_XSI_SHELLFNS +# --------------------- +# Bourne and XSI compatible variants of some useful shell functions. +m4_defun([_LT_PROG_XSI_SHELLFNS], +[case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $[*] )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +dnl func_dirname_and_basename +dnl A portable version of this function is already defined in general.m4sh +dnl so there is no need for it here. + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[[^=]]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$[@]"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]+=\$[2]" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]=\$$[1]\$[2]" +} + +_LT_EOF + ;; + esac +]) diff --git a/packages/bee/cryptominisat-2.5.1/m4/ltoptions.m4 b/packages/bee/cryptominisat-2.5.1/m4/ltoptions.m4 new file mode 100755 index 000000000..34151a3ba --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/m4/ltoptions.m4 @@ -0,0 +1,368 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [0], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/packages/bee/cryptominisat-2.5.1/m4/ltsugar.m4 b/packages/bee/cryptominisat-2.5.1/m4/ltsugar.m4 new file mode 100755 index 000000000..9000a057d --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/m4/ltsugar.m4 @@ -0,0 +1,123 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/packages/bee/cryptominisat-2.5.1/m4/ltversion.m4 b/packages/bee/cryptominisat-2.5.1/m4/ltversion.m4 new file mode 100755 index 000000000..f3c530980 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# Generated from ltversion.in. + +# serial 3017 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.2.6b]) +m4_define([LT_PACKAGE_REVISION], [1.3017]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.2.6b' +macro_revision='1.3017' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/packages/bee/cryptominisat-2.5.1/m4/lt~obsolete.m4 b/packages/bee/cryptominisat-2.5.1/m4/lt~obsolete.m4 new file mode 100755 index 000000000..637bb2066 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/m4/lt~obsolete.m4 @@ -0,0 +1,92 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 4 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) diff --git a/packages/bee/cryptominisat-2.5.1/missing b/packages/bee/cryptominisat-2.5.1/missing new file mode 100755 index 000000000..28055d2ae --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/missing @@ -0,0 +1,376 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + tar*) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar*) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/packages/swi-minisat2/C/Alg.h b/packages/bee/cryptominisat-2.5.1/mtl/Alg.h old mode 100644 new mode 100755 similarity index 80% rename from packages/swi-minisat2/C/Alg.h rename to packages/bee/cryptominisat-2.5.1/mtl/Alg.h index 240962dfc..df2e0c4c3 --- a/packages/swi-minisat2/C/Alg.h +++ b/packages/bee/cryptominisat-2.5.1/mtl/Alg.h @@ -20,38 +20,50 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA #ifndef Alg_h #define Alg_h +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + //================================================================================================= // Useful functions on vectors -#if 1 template static inline void remove(V& ts, const T& t) { - int j = 0; + uint32_t j = 0; for (; j < ts.size() && ts[j] != t; j++); assert(j < ts.size()); for (; j < ts.size()-1; j++) ts[j] = ts[j+1]; ts.pop(); } -#else + template -static inline void remove(V& ts, const T& t) +static inline void removeW(V& ts, const T& t) { - int j = 0; - for (; j < ts.size() && ts[j] != t; j++); + uint32_t j = 0; + for (; j < ts.size() && ts[j].clause != t; j++); assert(j < ts.size()); - ts[j] = ts.last(); + for (; j < ts.size()-1; j++) ts[j] = ts[j+1]; ts.pop(); } -#endif template static inline bool find(V& ts, const T& t) { - int j = 0; + uint32_t j = 0; for (; j < ts.size() && ts[j] != t; j++); return j < ts.size(); } +template +static inline bool findW(V& ts, const T& t) +{ + uint32_t j = 0; + for (; j < ts.size() && ts[j].clause != t; j++); + return j < ts.size(); +} + #endif diff --git a/packages/swi-minisat2/C/BasicHeap.h b/packages/bee/cryptominisat-2.5.1/mtl/BasicHeap.h old mode 100644 new mode 100755 similarity index 97% rename from packages/swi-minisat2/C/BasicHeap.h rename to packages/bee/cryptominisat-2.5.1/mtl/BasicHeap.h index 556d98f84..85775e85d --- a/packages/swi-minisat2/C/BasicHeap.h +++ b/packages/bee/cryptominisat-2.5.1/mtl/BasicHeap.h @@ -20,6 +20,12 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA #ifndef BasicHeap_h #define BasicHeap_h +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VERs + #include "Vec.h" //================================================================================================= diff --git a/packages/swi-minisat2/C/BoxedVec.h b/packages/bee/cryptominisat-2.5.1/mtl/BoxedVec.h old mode 100644 new mode 100755 similarity index 100% rename from packages/swi-minisat2/C/BoxedVec.h rename to packages/bee/cryptominisat-2.5.1/mtl/BoxedVec.h diff --git a/packages/bee/cryptominisat-2.5.1/mtl/Heap.h b/packages/bee/cryptominisat-2.5.1/mtl/Heap.h new file mode 100755 index 000000000..8a9c004d2 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/mtl/Heap.h @@ -0,0 +1,199 @@ +/******************************************************************************************[Heap.h] +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Heap_h +#define Heap_h + +#include "Vec.h" +#include + +#include "string.h" +#include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER + +//================================================================================================= +// A heap implementation with support for decrease/increase key. + + +template +class Heap { + Comp lt; + vec heap; // heap of ints + vec indices; // int -> index in heap + + // Index "traversal" functions + static inline uint32_t left (uint32_t i) { return i*2+1; } + static inline uint32_t right (uint32_t i) { return (i+1)*2; } + static inline uint32_t parent(uint32_t i) { return (i-1) >> 1; } + + + inline void percolateUp(uint32_t i) + { + uint32_t x = heap[i]; + while (i != 0 && lt(x, heap[parent(i)])){ + heap[i] = heap[parent(i)]; + indices[heap[i]] = i; + i = parent(i); + } + heap [i] = x; + indices[x] = i; + } + + + inline void percolateDown(uint32_t i) + { + uint32_t x = heap[i]; + while (left(i) < heap.size()){ + uint32_t child = right(i) < heap.size() && lt(heap[right(i)], heap[left(i)]) ? right(i) : left(i); + if (!lt(heap[child], x)) break; + heap[i] = heap[child]; + indices[heap[i]] = i; + i = child; + } + heap [i] = x; + indices[x] = i; + } + + + bool heapProperty (uint32_t i) const { + return i >= heap.size() + || ((i == 0 || !lt(heap[i], heap[parent(i)])) && heapProperty(left(i)) && heapProperty(right(i))); } + + + public: + Heap(const Comp& c) : lt(c) { } + Heap(const Heap& other) : lt(other.lt) { + heap.growTo(other.heap.size()); + std::copy(other.heap.getData(), other.heap.getDataEnd(), heap.getData()); + indices.growTo(other.indices.size()); + std::copy(other.indices.getData(), other.indices.getDataEnd(), indices.getData()); + } + + void operator=(const Heap& other) + { + if (other.heap.size() > heap.size()) + heap.growTo(other.heap.size()); + else + heap.shrink(heap.size()-other.heap.size()); + std::copy(other.heap.getData(), other.heap.getDataEnd(), heap.getData()); + + if (other.indices.size() > indices.size()) + indices.growTo(other.indices.size()); + else + indices.shrink(indices.size() - other.indices.size()); + std::copy(other.indices.getData(), other.indices.getDataEnd(), indices.getData()); + } + + uint32_t size () const { return heap.size(); } + bool empty () const { return heap.size() == 0; } + bool inHeap (uint32_t n) const { return n < indices.size() && indices[n] != std::numeric_limits::max(); } + uint32_t operator[](uint32_t index) const { assert(index < heap.size()); return heap[index]; } + + void decrease (uint32_t n) { assert(inHeap(n)); percolateUp(indices[n]); } + + // RENAME WHEN THE DEPRECATED INCREASE IS REMOVED. + void increase_ (uint32_t n) { assert(inHeap(n)); percolateDown(indices[n]); } + + + void insert(uint32_t n) + { + indices.growTo(n+1, std::numeric_limits::max()); + assert(!inHeap(n)); + + indices[n] = heap.size(); + heap.push(n); + percolateUp(indices[n]); + } + + + uint32_t removeMin() + { + uint32_t x = heap[0]; + heap[0] = heap.last(); + indices[heap[0]] = 0; + indices[x] = std::numeric_limits::max(); + heap.pop(); + if (heap.size() > 1) percolateDown(0); + return x; + } + + + void clear(bool dealloc = false) + { + for (uint32_t i = 0; i != heap.size(); i++) + indices[heap[i]] = std::numeric_limits::max(); +#ifndef NDEBUG + for (uint32_t i = 0; i != indices.size(); i++) + assert(indices[i] == std::numeric_limits::max()); +#endif + heap.clear(dealloc); + } + + + // Fool proof variant of insert/decrease/increase + void update (uint32_t n) + { + if (!inHeap(n)) + insert(n); + else { + percolateUp(indices[n]); + percolateDown(indices[n]); + } + } + + + // Delete elements from the heap using a given filter function (-object). + // *** this could probaly be replaced with a more general "buildHeap(vec&)" method *** + template + void filter(const F& filt) { + uint32_t i,j; + for (i = j = 0; i != heap.size(); i++) + if (filt(heap[i])){ + heap[j] = heap[i]; + indices[heap[i]] = j++; + }else + indices[heap[i]] = std::numeric_limits::max(); + + heap.shrink(i - j); + for (int i = ((int)heap.size()) / 2 - 1; i >= 0; i--) + percolateDown(i); + + assert(heapProperty()); + } + + + // DEBUG: consistency checking + bool heapProperty() const { + return heapProperty(1); } + + + // COMPAT: should be removed + void setBounds (uint32_t n) { } + void increase (uint32_t n) { decrease(n); } + uint32_t getmin () { return removeMin(); } + +}; + + +//================================================================================================= +#endif diff --git a/packages/swi-minisat2/C/Map.h b/packages/bee/cryptominisat-2.5.1/mtl/Map.h old mode 100644 new mode 100755 similarity index 98% rename from packages/swi-minisat2/C/Map.h rename to packages/bee/cryptominisat-2.5.1/mtl/Map.h index b6d76a31c..b855c3b55 --- a/packages/swi-minisat2/C/Map.h +++ b/packages/bee/cryptominisat-2.5.1/mtl/Map.h @@ -20,7 +20,11 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA #ifndef Map_h #define Map_h +#ifdef _MSC_VER +#include +#else #include +#endif //_MSC_VER #include "Vec.h" diff --git a/packages/swi-minisat2/C/Queue.h b/packages/bee/cryptominisat-2.5.1/mtl/Queue.h old mode 100644 new mode 100755 similarity index 100% rename from packages/swi-minisat2/C/Queue.h rename to packages/bee/cryptominisat-2.5.1/mtl/Queue.h diff --git a/packages/swi-minisat2/C/Vec.h b/packages/bee/cryptominisat-2.5.1/mtl/Vec.h old mode 100644 new mode 100755 similarity index 55% rename from packages/swi-minisat2/C/Vec.h rename to packages/bee/cryptominisat-2.5.1/mtl/Vec.h index 14e00adbc..1185ec9d4 --- a/packages/swi-minisat2/C/Vec.h +++ b/packages/bee/cryptominisat-2.5.1/mtl/Vec.h @@ -23,111 +23,119 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA #include #include #include +#ifdef _MSC_VER +#include +#else +#include +#endif //_MSC_VER //================================================================================================= // Automatically resizable arrays // -// NOTE! Don't use this vector on datatypes that cannot be re-located in memory (with std::realloc) +// NOTE! Don't use this vector on datatypes that cannot be re-located in memory (with realloc) template class vec { T* data; - int sz; - int cap; + uint32_t sz; + uint32_t cap; - void init(int size, const T& pad); - void grow(int min_cap); + void init(uint32_t size, const T& pad); + void grow(uint32_t min_cap); // Don't allow copying (error prone): vec& operator = (vec& other) { assert(0); return *this; } - vec (vec& other) { assert(0); } + //vec (vec& other) { assert(0); } - static inline int imin(int x, int y) { - int mask = (x-y) >> (sizeof(int)*8-1); - return (x&mask) + (y&(~mask)); } - - static inline int imax(int x, int y) { + static inline uint32_t imax(int x, int y) { int mask = (y-x) >> (sizeof(int)*8-1); return (x&mask) + (y&(~mask)); } + + void myCopy (const vec& other); public: // Types: - typedef int Key; + typedef uint32_t Key; typedef T Datum; // Constructors: - vec(void) : data(NULL) , sz(0) , cap(0) { } - vec(int size) : data(NULL) , sz(0) , cap(0) { growTo(size); } - vec(int size, const T& pad) : data(NULL) , sz(0) , cap(0) { growTo(size, pad); } - vec(T* array, int size) : data(array), sz(size), cap(size) { } // (takes ownership of array -- will be deallocated with 'free()') + vec(void) : data(NULL) , sz(0) , cap(0) { } + vec(uint32_t size) : data(NULL) , sz(0) , cap(0) { growTo(size); } + vec(uint32_t size, const T& pad) : data(NULL) , sz(0) , cap(0) { growTo(size, pad); } + vec(T* array, uint32_t size) : data(array), sz(size), cap(size) { } // (takes ownership of array -- will be deallocated with 'free()') + vec(const vec& other) : data(NULL) , sz(0) , cap(0) { myCopy(other); } ~vec(void) { clear(true); } // Ownership of underlying array: T* release (void) { T* ret = data; data = NULL; sz = 0; cap = 0; return ret; } - operator T* (void) { return data; } // (unsafe but convenient) - operator const T* (void) const { return data; } + const T* getData() const {return data; } + const T* getDataEnd() const {return data + size(); } + T* getData() {return data; } + T* getDataEnd() {return data + size(); } // Size operations: - int size (void) const { return sz; } - void shrink (int nelems) { assert(nelems <= sz); for (int i = 0; i < nelems; i++) sz--, data[sz].~T(); } - void shrink_(int nelems) { assert(nelems <= sz); sz -= nelems; } + uint32_t size (void) const { return sz; } + void shrink (uint32_t nelems) { assert(nelems <= sz); for (uint32_t i = 0; i != nelems; i++) sz--, data[sz].~T(); } + void shrink_(uint32_t nelems) { assert(nelems <= sz); sz -= nelems; } void pop (void) { sz--, data[sz].~T(); } - void growTo (int size); - void growTo (int size, const T& pad); + void growTo (uint32_t size); + void growTo (uint32_t size, const T& pad); void clear (bool dealloc = false); - void capacity (int size) { grow(size); } + void capacity (uint32_t size) { grow(size); } // Stack interface: -#if 1 - void push (void) { if (sz == cap) { cap = imax(2, (cap*3+1)>>1); data = (T*)std::realloc(data, cap * sizeof(T)); } new (&data[sz]) T(); sz++; } - //void push (const T& elem) { if (sz == cap) { cap = imax(2, (cap*3+1)>>1); data = (T*)std::realloc(data, cap * sizeof(T)); } new (&data[sz]) T(elem); sz++; } - void push (const T& elem) { if (sz == cap) { cap = imax(2, (cap*3+1)>>1); data = (T*)std::realloc(data, cap * sizeof(T)); } data[sz++] = elem; } + void reserve(uint32_t res) { if (cap < res) {cap = res; data = (T*)realloc(data, cap * sizeof(T));}} + void push (void) { if (sz == cap) { cap = imax(2, (cap*3+1)>>1); data = (T*)realloc(data, cap * sizeof(T)); } new (&data[sz]) T(); sz++; } + void push (const T& elem) { if (sz == cap) { cap = imax(2, (cap*3+1)>>1); data = (T*)realloc(data, cap * sizeof(T)); } data[sz++] = elem; } void push_ (const T& elem) { assert(sz < cap); data[sz++] = elem; } -#else - void push (void) { if (sz == cap) grow(sz+1); new (&data[sz]) T() ; sz++; } - void push (const T& elem) { if (sz == cap) grow(sz+1); new (&data[sz]) T(elem); sz++; } -#endif const T& last (void) const { return data[sz-1]; } T& last (void) { return data[sz-1]; } // Vector interface: - const T& operator [] (int index) const { return data[index]; } - T& operator [] (int index) { return data[index]; } + const T& operator [] (uint32_t index) const { return data[index]; } + T& operator [] (uint32_t index) { return data[index]; } // Duplicatation (preferred instead): - void copyTo(vec& copy) const { copy.clear(); copy.growTo(sz); for (int i = 0; i < sz; i++) new (©[i]) T(data[i]); } + void copyTo(vec& copy) const { copy.clear(); copy.growTo(sz); for (uint32_t i = 0; i != sz; i++) new (©[i]) T(data[i]); } void moveTo(vec& dest) { dest.clear(true); dest.data = data; dest.sz = sz; dest.cap = cap; data = NULL; sz = 0; cap = 0; } }; template -void vec::grow(int min_cap) { +void vec::grow(uint32_t min_cap) { if (min_cap <= cap) return; if (cap == 0) cap = (min_cap >= 2) ? min_cap : 2; else do cap = (cap*3+1) >> 1; while (cap < min_cap); - data = (T*)std::realloc(data, cap * sizeof(T)); } + data = (T*)realloc(data, cap * sizeof(T)); } template -void vec::growTo(int size, const T& pad) { +void vec::growTo(uint32_t size, const T& pad) { if (sz >= size) return; grow(size); - for (int i = sz; i < size; i++) new (&data[i]) T(pad); + for (uint32_t i = sz; i != size; i++) new (&data[i]) T(pad); sz = size; } template -void vec::growTo(int size) { +void vec::growTo(uint32_t size) { if (sz >= size) return; grow(size); - for (int i = sz; i < size; i++) new (&data[i]) T(); + for (uint32_t i = sz; i != size; i++) new (&data[i]) T(); sz = size; } + +template +void vec::myCopy(const vec& other) { + assert(sz == 0); + grow(other.size()); + for (uint32_t i = sz; i != other.size(); i++) new (&data[i]) T(other[i]); + sz = other.size(); } template void vec::clear(bool dealloc) { if (data != NULL){ - for (int i = 0; i < sz; i++) data[i].~T(); + for (uint32_t i = 0; i != sz; i++) data[i].~T(); sz = 0; - if (dealloc) std::free(data), data = NULL, cap = 0; } } + if (dealloc) free(data), data = NULL, cap = 0; } } #endif diff --git a/packages/bee/cryptominisat-2.5.1/stamp-h1 b/packages/bee/cryptominisat-2.5.1/stamp-h1 new file mode 100755 index 000000000..4547fe1b5 --- /dev/null +++ b/packages/bee/cryptominisat-2.5.1/stamp-h1 @@ -0,0 +1 @@ +timestamp for config.h diff --git a/packages/bee/glucose-2.2/core/BoundedQueue.h b/packages/bee/glucose-2.2/core/BoundedQueue.h new file mode 100755 index 000000000..b17354fb0 --- /dev/null +++ b/packages/bee/glucose-2.2/core/BoundedQueue.h @@ -0,0 +1,110 @@ +/***********************************************************************************[BoundedQueue.h] + Glucose -- Copyright (c) 2009, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef BoundedQueue_h +#define BoundedQueue_h + +#include "mtl/Vec.h" + +//================================================================================================= + +namespace Glucose { + +template +class bqueue { + vec elems; + int first; + int last; + unsigned long long sumofqueue; + int maxsize; + int queuesize; // Number of current elements (must be < maxsize !) + bool expComputed; + double exp,value; +public: + bqueue(void) : first(0), last(0), sumofqueue(0), maxsize(0), queuesize(0),expComputed(false) { } + + void initSize(int size) {growTo(size);exp = 2.0/(size+1);} // Init size of bounded size queue + + void push(T x) { + expComputed = false; + if (queuesize==maxsize) { + assert(last==first); // The queue is full, next value to enter will replace oldest one + sumofqueue -= elems[last]; + if ((++last) == maxsize) last = 0; + } else + queuesize++; + sumofqueue += x; + elems[first] = x; + if ((++first) == maxsize) {first = 0;last = 0;} + } + + T peek() { assert(queuesize>0); return elems[last]; } + void pop() {sumofqueue-=elems[last]; queuesize--; if ((++last) == maxsize) last = 0;} + + unsigned long long getsum() const {return sumofqueue;} + unsigned int getavg() const {return (unsigned int)(sumofqueue/((unsigned long long)queuesize));} + int maxSize() const {return maxsize;} + double getavgDouble() const { + double tmp = 0; + for(int i=0;i + +#include "utils/ParseUtils.h" +#include "core/SolverTypes.h" + +namespace Glucose { + +//================================================================================================= +// DIMACS Parser: + +template +static void readClause(B& in, Solver& S, vec& lits) { + int parsed_lit, var; + lits.clear(); + for (;;){ + parsed_lit = parseInt(in); + if (parsed_lit == 0) break; + var = abs(parsed_lit)-1; + while (var >= S.nVars()) S.newVar(); + lits.push( (parsed_lit > 0) ? mkLit(var) : ~mkLit(var) ); + } +} + +template +static void parse_DIMACS_main(B& in, Solver& S) { + vec lits; + int vars = 0; + int clauses = 0; + int cnt = 0; + for (;;){ + skipWhitespace(in); + if (*in == EOF) break; + else if (*in == 'p'){ + if (eagerMatch(in, "p cnf")){ + vars = parseInt(in); + clauses = parseInt(in); + // SATRACE'06 hack + // if (clauses > 4000000) + // S.eliminate(true); + }else{ + printf("PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + } + } else if (*in == 'c' || *in == 'p') + skipLine(in); + else{ + cnt++; + readClause(in, S, lits); + S.addClause_(lits); } + } + if (vars != S.nVars()) + fprintf(stderr, "WARNING! DIMACS header mismatch: wrong number of variables.\n"); + if (cnt != clauses) + fprintf(stderr, "WARNING! DIMACS header mismatch: wrong number of clauses.\n"); +} + +// Inserts problem into solver. +// +template +static void parse_DIMACS(gzFile input_stream, Solver& S) { + StreamBuffer in(input_stream); + parse_DIMACS_main(in, S); } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/core/Main.cc b/packages/bee/glucose-2.2/core/Main.cc new file mode 100755 index 000000000..abbd2d570 --- /dev/null +++ b/packages/bee/glucose-2.2/core/Main.cc @@ -0,0 +1,221 @@ +/*****************************************************************************************[Main.cc] + Glucose -- Copyright (c) 2009, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose are exactly the same as Minisat on which it is based on. (see below). + +--------------- + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include + +#include +#include + +#include "utils/System.h" +#include "utils/ParseUtils.h" +#include "utils/Options.h" +#include "core/Dimacs.h" +#include "core/Solver.h" + +using namespace Glucose; + +//================================================================================================= + + +void printStats(Solver& solver) +{ + double cpu_time = cpuTime(); + double mem_used = 0;//memUsedPeak(); + printf("c restarts : %"PRIu64" (%"PRIu64" conflicts in avg)\n", solver.starts,(solver.starts>0 ?solver.conflicts/solver.starts : 0)); + printf("c blocked restarts : %"PRIu64" (multiple: %"PRIu64") \n", solver.nbstopsrestarts,solver.nbstopsrestartssame); + printf("c last block at restart : %"PRIu64"\n",solver.lastblockatrestart); + printf("c nb ReduceDB : %lld\n", solver.nbReduceDB); + printf("c nb removed Clauses : %lld\n",solver.nbRemovedClauses); + printf("c nb learnts DL2 : %lld\n", solver.nbDL2); + printf("c nb learnts size 2 : %lld\n", solver.nbBin); + printf("c nb learnts size 1 : %lld\n", solver.nbUn); + + printf("c conflicts : %-12"PRIu64" (%.0f /sec)\n", solver.conflicts , solver.conflicts /cpu_time); + printf("c decisions : %-12"PRIu64" (%4.2f %% random) (%.0f /sec)\n", solver.decisions, (float)solver.rnd_decisions*100 / (float)solver.decisions, solver.decisions /cpu_time); + printf("c propagations : %-12"PRIu64" (%.0f /sec)\n", solver.propagations, solver.propagations/cpu_time); + printf("c conflict literals : %-12"PRIu64" (%4.2f %% deleted)\n", solver.tot_literals, (solver.max_literals - solver.tot_literals)*100 / (double)solver.max_literals); + printf("c nb reduced Clauses : %lld\n",solver.nbReducedClauses); + + if (mem_used != 0) printf("Memory used : %.2f MB\n", mem_used); + printf("c CPU time : %g s\n", cpu_time); +} + + +static Solver* solver; +// Terminate by notifying the solver and back out gracefully. This is mainly to have a test-case +// for this feature of the Solver as it may take longer than an immediate call to '_exit()'. +static void SIGINT_interrupt(int signum) { solver->interrupt(); } + +// Note that '_exit()' rather than 'exit()' has to be used. The reason is that 'exit()' calls +// destructors and may cause deadlocks if a malloc/free function happens to be running (these +// functions are guarded by locks for multithreaded use). +static void SIGINT_exit(int signum) { + printf("\n"); printf("*** INTERRUPTED ***\n"); + if (solver->verbosity > 0){ + printStats(*solver); + printf("\n"); printf("*** INTERRUPTED ***\n"); } + _exit(1); } + + +//================================================================================================= +// Main: + + +int main(int argc, char** argv) +{ + printf("c\nc This is glucose 2.1 -- based on MiniSAT (Many thanks to MiniSAT team)\nc\n"); + try { + setUsageHelp("c USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); + // printf("This is MiniSat 2.0 beta\n"); + +#if defined(__linux__) + fpu_control_t oldcw, newcw; + _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); + printf("c WARNING: for repeatability, setting FPU to use double precision\n"); +#endif + // Extra options: + // + IntOption verb ("MAIN", "verb", "Verbosity level (0=silent, 1=some, 2=more).", 1, IntRange(0, 2)); + IntOption vv ("MAIN", "vv", "Verbosity every vv conflicts", 10000, IntRange(1,INT32_MAX)); + IntOption cpu_lim("MAIN", "cpu-lim","Limit on CPU time allowed in seconds.\n", INT32_MAX, IntRange(0, INT32_MAX)); + IntOption mem_lim("MAIN", "mem-lim","Limit on memory usage in megabytes.\n", INT32_MAX, IntRange(0, INT32_MAX)); + + parseOptions(argc, argv, true); + + Solver S; + double initial_time = cpuTime(); + + S.verbosity = verb; + S.verbEveryConflicts = vv; + solver = &S; + // Use signal handlers that forcibly quit until the solver will be able to respond to + // interrupts: + // signal(SIGINT, SIGINT_exit); + //signal(SIGXCPU,SIGINT_exit); + + // Set limit on CPU-time: + if (cpu_lim != INT32_MAX){ + rlimit rl; + getrlimit(RLIMIT_CPU, &rl); + if (rl.rlim_max == RLIM_INFINITY || (rlim_t)cpu_lim < rl.rlim_max){ + rl.rlim_cur = cpu_lim; + if (setrlimit(RLIMIT_CPU, &rl) == -1) + printf("c WARNING! Could not set resource limit: CPU-time.\n"); + } } + + // Set limit on virtual memory: + if (mem_lim != INT32_MAX){ + rlim_t new_mem_lim = (rlim_t)mem_lim * 1024*1024; + rlimit rl; + getrlimit(RLIMIT_AS, &rl); + if (rl.rlim_max == RLIM_INFINITY || new_mem_lim < rl.rlim_max){ + rl.rlim_cur = new_mem_lim; + if (setrlimit(RLIMIT_AS, &rl) == -1) + printf("c WARNING! Could not set resource limit: Virtual memory.\n"); + } } + + if (argc == 1) + printf("c Reading from standard input... Use '--help' for help.\n"); + + gzFile in = (argc == 1) ? gzdopen(0, "rb") : gzopen(argv[1], "rb"); + if (in == NULL) + printf("c ERROR! Could not open file: %s\n", argc == 1 ? "" : argv[1]), exit(1); + + if (S.verbosity > 0){ + printf("c ========================================[ Problem Statistics ]===========================================\n"); + printf("c | |\n"); } + + parse_DIMACS(in, S); + gzclose(in); + FILE* res = (argc >= 3) ? fopen(argv[2], "wb") : NULL; + + if (S.verbosity > 0){ + printf("c | Number of variables: %12d |\n", S.nVars()); + printf("c | Number of clauses: %12d |\n", S.nClauses()); } + + double parsed_time = cpuTime(); + if (S.verbosity > 0){ + printf("c | Parse time: %12.2f s |\n", parsed_time - initial_time); + printf("c | |\n"); } + + // Change to signal-handlers that will only notify the solver and allow it to terminate + // voluntarily: + //signal(SIGINT, SIGINT_interrupt); + //signal(SIGXCPU,SIGINT_interrupt); + + if (!S.simplify()){ + if (res != NULL) fprintf(res, "UNSAT\n"), fclose(res); + if (S.verbosity > 0){ + printf("c =========================================================================================================\n"); + printf("Solved by unit propagation\n"); + printStats(S); + printf("\n"); } + printf("s UNSATISFIABLE\n"); + exit(20); + } + + vec dummy; + lbool ret = S.solveLimited(dummy); + if (S.verbosity > 0){ + printStats(S); + printf("\n"); } + if (res != NULL){ + if (ret == l_True){ + fprintf(res, "SAT\n"); + for (int i = 0; i < S.nVars(); i++) + if (S.model[i] != l_Undef) + fprintf(res, "%s%s%d", (i==0)?"":" ", (S.model[i]==l_True)?"":"-", i+1); + fprintf(res, " 0\n"); + }else if (ret == l_False) + fprintf(res, "UNSAT\n"); + else + fprintf(res, "INDET\n"); + fclose(res); + } else { + printf(ret == l_True ? "s SATISFIABLE\n" : ret == l_False ? "s UNSATISFIABLE\n" : "s INDETERMINATE\n"); + if(ret==l_True) { + printf("v "); + for (int i = 0; i < S.nVars(); i++) + if (S.model[i] != l_Undef) + printf("%s%s%d", (i==0)?"":" ", (S.model[i]==l_True)?"":"-", i+1); + printf(" 0\n"); + } + } + +#ifdef NDEBUG + exit(ret == l_True ? 10 : ret == l_False ? 20 : 0); // (faster than "return", which will invoke the destructor for 'Solver') +#else + return (ret == l_True ? 10 : ret == l_False ? 20 : 0); +#endif + } catch (OutOfMemoryException&){ + printf("c ===================================================================================================\n"); + printf("INDETERMINATE\n"); + exit(0); + } +} diff --git a/packages/bee/glucose-2.2/core/Solver.cc b/packages/bee/glucose-2.2/core/Solver.cc new file mode 100755 index 000000000..7765219ad --- /dev/null +++ b/packages/bee/glucose-2.2/core/Solver.cc @@ -0,0 +1,1197 @@ +/***************************************************************************************[Solver.cc] + Glucose -- Copyright (c) 2009, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose are exactly the same as Minisat on which it is based on. (see below). + +--------------- + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include + +#include "mtl/Sort.h" +#include "core/Solver.h" +#include "core/Constants.h" + +using namespace Glucose; + +//================================================================================================= +// Options: + +static const char* _cat = "CORE"; +static const char* _cr = "CORE -- RESTART"; +static const char* _cred = "CORE -- REDUCE"; +static const char* _cm = "CORE -- MINIMIZE"; + + + +static DoubleOption opt_K (_cr, "K", "The constant used to force restart", 0.8, DoubleRange(0, false, 1, false)); +static DoubleOption opt_R (_cr, "R", "The constant used to block restart", 1.4, DoubleRange(1, false, 5, false)); +static IntOption opt_size_lbd_queue (_cr, "szLBDQueue", "The size of moving average for LBD (restarts)", 50, IntRange(10, INT32_MAX)); +static IntOption opt_size_trail_queue (_cr, "szTrailQueue", "The size of moving average for trail (block restarts)", 5000, IntRange(10, INT32_MAX)); + +static IntOption opt_first_reduce_db (_cred, "firstReduceDB", "The number of conflicts before the first reduce DB", 4000, IntRange(0, INT32_MAX)); +static IntOption opt_inc_reduce_db (_cred, "incReduceDB", "Increment for reduce DB", 300, IntRange(0, INT32_MAX)); +static IntOption opt_spec_inc_reduce_db (_cred, "specialIncReduceDB", "Special increment for reduce DB", 1000, IntRange(0, INT32_MAX)); +static IntOption opt_lb_lbd_frozen_clause (_cred, "minLBDFrozenClause", "Protect clauses if their LBD decrease and is lower than (for one turn)", 30, IntRange(0, INT32_MAX)); + +static IntOption opt_lb_size_minimzing_clause (_cm, "minSizeMinimizingClause", "The min size required to minimize clause", 30, IntRange(3, INT32_MAX)); +static IntOption opt_lb_lbd_minimzing_clause (_cm, "minLBDMinimizingClause", "The min LBD required to minimize clause", 6, IntRange(3, INT32_MAX)); + + +static DoubleOption opt_var_decay (_cat, "var-decay", "The variable activity decay factor", 0.95, DoubleRange(0, false, 1, false)); +static DoubleOption opt_clause_decay (_cat, "cla-decay", "The clause activity decay factor", 0.999, DoubleRange(0, false, 1, false)); +static DoubleOption opt_random_var_freq (_cat, "rnd-freq", "The frequency with which the decision heuristic tries to choose a random variable", 0, DoubleRange(0, true, 1, true)); +static DoubleOption opt_random_seed (_cat, "rnd-seed", "Used by the random variable selection", 91648253, DoubleRange(0, false, HUGE_VAL, false)); +static IntOption opt_ccmin_mode (_cat, "ccmin-mode", "Controls conflict clause minimization (0=none, 1=basic, 2=deep)", 2, IntRange(0, 2)); +static IntOption opt_phase_saving (_cat, "phase-saving", "Controls the level of phase saving (0=none, 1=limited, 2=full)", 2, IntRange(0, 2)); +static BoolOption opt_rnd_init_act (_cat, "rnd-init", "Randomize the initial activity", false); +/* +static IntOption opt_restart_first (_cat, "rfirst", "The base restart interval", 100, IntRange(1, INT32_MAX)); +static DoubleOption opt_restart_inc (_cat, "rinc", "Restart interval increase factor", 2, DoubleRange(1, false, HUGE_VAL, false)); +*/ +static DoubleOption opt_garbage_frac (_cat, "gc-frac", "The fraction of wasted memory allowed before a garbage collection is triggered", 0.20, DoubleRange(0, false, HUGE_VAL, false)); + + +//================================================================================================= +// Constructor/Destructor: + + +Solver::Solver() : + + // Parameters (user settable): + // + verbosity (0) + , K (opt_K) + , R (opt_R) + , sizeLBDQueue (opt_size_lbd_queue) + , sizeTrailQueue (opt_size_trail_queue) + , firstReduceDB (opt_first_reduce_db) + , incReduceDB (opt_inc_reduce_db) + , specialIncReduceDB (opt_spec_inc_reduce_db) + , lbLBDFrozenClause (opt_lb_lbd_frozen_clause) + , lbSizeMinimizingClause (opt_lb_size_minimzing_clause) + , lbLBDMinimizingClause (opt_lb_lbd_minimzing_clause) + , var_decay (opt_var_decay) + , clause_decay (opt_clause_decay) + , random_var_freq (opt_random_var_freq) + , random_seed (opt_random_seed) + , ccmin_mode (opt_ccmin_mode) + , phase_saving (opt_phase_saving) + , rnd_pol (false) + , rnd_init_act (opt_rnd_init_act) + , garbage_frac (opt_garbage_frac) + + + // Statistics: (formerly in 'SolverStats') + // + , nbRemovedClauses(0),nbReducedClauses(0), nbDL2(0),nbBin(0),nbUn(0) , nbReduceDB(0) + , solves(0), starts(0), decisions(0), rnd_decisions(0), propagations(0), conflicts(0),nbstopsrestarts(0),nbstopsrestartssame(0),lastblockatrestart(0) + , dec_vars(0), clauses_literals(0), learnts_literals(0), max_literals(0), tot_literals(0) + , curRestart(1) + + , ok (true) + , cla_inc (1) + , var_inc (1) + , watches (WatcherDeleted(ca)) + , watchesBin (WatcherDeleted(ca)) + , qhead (0) + , simpDB_assigns (-1) + , simpDB_props (0) + , order_heap (VarOrderLt(activity)) + , progress_estimate (0) + , remove_satisfied (true) + + // Resource constraints: + // + , conflict_budget (-1) + , propagation_budget (-1) + , asynch_interrupt (false) +{MYFLAG=0;} + + +Solver::~Solver() +{ +} + + +//================================================================================================= +// Minor methods: + + +// Creates a new SAT variable in the solver. If 'decision' is cleared, variable will not be +// used as a decision variable (NOTE! This has effects on the meaning of a SATISFIABLE result). +// +Var Solver::newVar(bool sign, bool dvar) +{ + int v = nVars(); + watches .init(mkLit(v, false)); + watches .init(mkLit(v, true )); + watchesBin .init(mkLit(v, false)); + watchesBin .init(mkLit(v, true )); + assigns .push(l_Undef); + vardata .push(mkVarData(CRef_Undef, 0)); + //activity .push(0); + activity .push(rnd_init_act ? drand(random_seed) * 0.00001 : 0); + seen .push(0); + permDiff .push(0); + polarity .push(sign); + decision .push(); + trail .capacity(v+1); + setDecisionVar(v, dvar); + return v; +} + + +bool Solver::addClause_(vec& ps) +{ + assert(decisionLevel() == 0); + if (!ok) return false; + + // Check if clause is satisfied and remove false/duplicate literals: + sort(ps); + Lit p; int i, j; + for (i = j = 0, p = lit_Undef; i < ps.size(); i++) + if (value(ps[i]) == l_True || ps[i] == ~p) + return true; + else if (value(ps[i]) != l_False && ps[i] != p) + ps[j++] = p = ps[i]; + ps.shrink(i - j); + + if (ps.size() == 0) + return ok = false; + else if (ps.size() == 1){ + uncheckedEnqueue(ps[0]); + return ok = (propagate() == CRef_Undef); + }else{ + CRef cr = ca.alloc(ps, false); + clauses.push(cr); + attachClause(cr); + } + + return true; +} + + +void Solver::attachClause(CRef cr) { + const Clause& c = ca[cr]; + assert(c.size() > 1); + if(c.size()==2) { + watchesBin[~c[0]].push(Watcher(cr, c[1])); + watchesBin[~c[1]].push(Watcher(cr, c[0])); + } else { + watches[~c[0]].push(Watcher(cr, c[1])); + watches[~c[1]].push(Watcher(cr, c[0])); + } + if (c.learnt()) learnts_literals += c.size(); + else clauses_literals += c.size(); } + + + + +void Solver::detachClause(CRef cr, bool strict) { + const Clause& c = ca[cr]; + + assert(c.size() > 1); + if(c.size()==2) { + if (strict){ + remove(watchesBin[~c[0]], Watcher(cr, c[1])); + remove(watchesBin[~c[1]], Watcher(cr, c[0])); + }else{ + // Lazy detaching: (NOTE! Must clean all watcher lists before garbage collecting this clause) + watchesBin.smudge(~c[0]); + watchesBin.smudge(~c[1]); + } + } else { + if (strict){ + remove(watches[~c[0]], Watcher(cr, c[1])); + remove(watches[~c[1]], Watcher(cr, c[0])); + }else{ + // Lazy detaching: (NOTE! Must clean all watcher lists before garbage collecting this clause) + watches.smudge(~c[0]); + watches.smudge(~c[1]); + } + } + if (c.learnt()) learnts_literals -= c.size(); + else clauses_literals -= c.size(); } + + +void Solver::removeClause(CRef cr) { + + Clause& c = ca[cr]; + detachClause(cr); + // Don't leave pointers to free'd memory! + if (locked(c)) vardata[var(c[0])].reason = CRef_Undef; + c.mark(1); + ca.free(cr); +} + + +bool Solver::satisfied(const Clause& c) const { + for (int i = 0; i < c.size(); i++) + if (value(c[i]) == l_True) + return true; + return false; } + + +// Revert to the state at given level (keeping all assignment at 'level' but not beyond). +// +void Solver::cancelUntil(int level) { + if (decisionLevel() > level){ + for (int c = trail.size()-1; c >= trail_lim[level]; c--){ + Var x = var(trail[c]); + assigns [x] = l_Undef; + if (phase_saving > 1 || (phase_saving == 1) && c > trail_lim.last()) + polarity[x] = sign(trail[c]); + insertVarOrder(x); } + qhead = trail_lim[level]; + trail.shrink(trail.size() - trail_lim[level]); + trail_lim.shrink(trail_lim.size() - level); + } } + + +//================================================================================================= +// Major methods: + + +Lit Solver::pickBranchLit() +{ + Var next = var_Undef; + + // Random decision: + if (drand(random_seed) < random_var_freq && !order_heap.empty()){ + next = order_heap[irand(random_seed,order_heap.size())]; + if (value(next) == l_Undef && decision[next]) + rnd_decisions++; } + + // Activity based decision: + while (next == var_Undef || value(next) != l_Undef || !decision[next]) + if (order_heap.empty()){ + next = var_Undef; + break; + }else + next = order_heap.removeMin(); + + return next == var_Undef ? lit_Undef : mkLit(next, rnd_pol ? drand(random_seed) < 0.5 : polarity[next]); +} + + +/*_________________________________________________________________________________________________ +| +| analyze : (confl : Clause*) (out_learnt : vec&) (out_btlevel : int&) -> [void] +| +| Description: +| Analyze conflict and produce a reason clause. +| +| Pre-conditions: +| * 'out_learnt' is assumed to be cleared. +| * Current decision level must be greater than root level. +| +| Post-conditions: +| * 'out_learnt[0]' is the asserting literal at level 'out_btlevel'. +| * If out_learnt.size() > 1 then 'out_learnt[1]' has the greatest decision level of the +| rest of literals. There may be others from the same level though. +| +|________________________________________________________________________________________________@*/ +void Solver::analyze(CRef confl, vec& out_learnt, int& out_btlevel,unsigned int &lbd) +{ + int pathC = 0; + Lit p = lit_Undef; + + // Generate conflict clause: + // + out_learnt.push(); // (leave room for the asserting literal) + int index = trail.size() - 1; + + do{ + assert(confl != CRef_Undef); // (otherwise should be UIP) + Clause& c = ca[confl]; + + // Special case for binary clauses + // The first one has to be SAT + if( p != lit_Undef && c.size()==2 && value(c[0])==l_False) { + + assert(value(c[1])==l_True); + Lit tmp = c[0]; + c[0] = c[1], c[1] = tmp; + } + + if (c.learnt()) + claBumpActivity(c); + + for (int j = (p == lit_Undef) ? 0 : 1; j < c.size(); j++){ + Lit q = c[j]; + + if (!seen[var(q)] && level(var(q)) > 0){ + varBumpActivity(var(q)); + seen[var(q)] = 1; + if (level(var(q)) >= decisionLevel()) { + pathC++; +#ifdef UPDATEVARACTIVITY + // UPDATEVARACTIVITY trick (see competition'09 companion paper) + if((reason(var(q))!= CRef_Undef) && ca[reason(var(q))].learnt()) + lastDecisionLevel.push(q); +#endif + + } else { + out_learnt.push(q); + } + } + } + + // Select next clause to look at: + while (!seen[var(trail[index--])]); + p = trail[index+1]; + confl = reason(var(p)); + seen[var(p)] = 0; + pathC--; + + }while (pathC > 0); + out_learnt[0] = ~p; + + // Simplify conflict clause: + // + int i, j; + out_learnt.copyTo(analyze_toclear); + if (ccmin_mode == 2){ + uint32_t abstract_level = 0; + for (i = 1; i < out_learnt.size(); i++) + abstract_level |= abstractLevel(var(out_learnt[i])); // (maintain an abstraction of levels involved in conflict) + + for (i = j = 1; i < out_learnt.size(); i++) + if (reason(var(out_learnt[i])) == CRef_Undef || !litRedundant(out_learnt[i], abstract_level)) + out_learnt[j++] = out_learnt[i]; + + }else if (ccmin_mode == 1){ + for (i = j = 1; i < out_learnt.size(); i++){ + Var x = var(out_learnt[i]); + + if (reason(x) == CRef_Undef) + out_learnt[j++] = out_learnt[i]; + else{ + Clause& c = ca[reason(var(out_learnt[i]))]; + for (int k = 1; k < c.size(); k++) + if (!seen[var(c[k])] && level(var(c[k])) > 0){ + out_learnt[j++] = out_learnt[i]; + break; } + } + } + }else + i = j = out_learnt.size(); + + max_literals += out_learnt.size(); + out_learnt.shrink(i - j); + tot_literals += out_learnt.size(); + + + /* *************************************** + Minimisation with binary clauses of the asserting clause + First of all : we look for small clauses + Then, we reduce clauses with small LBD. + Otherwise, this can be useless + */ + if(out_learnt.size()<=lbSizeMinimizingClause) { + // Find the LBD measure + lbd = 0; + MYFLAG++; + for(int i=0;i& wbin = watchesBin[p]; + int nb = 0; + for(int k = 0;k0) { + nbReducedClauses++; + for(int i = 1;i level(var(out_learnt[max_i]))) + max_i = i; + // Swap-in this literal at index 1: + Lit p = out_learnt[max_i]; + out_learnt[max_i] = out_learnt[1]; + out_learnt[1] = p; + out_btlevel = level(var(p)); + } + + + // Find the LBD measure + lbd = 0; + MYFLAG++; + for(int i=0;i0) { + for(int i = 0;i 0){ + assert(reason(var(analyze_stack.last())) != CRef_Undef); + Clause& c = ca[reason(var(analyze_stack.last()))]; analyze_stack.pop(); + if(c.size()==2 && value(c[0])==l_False) { + assert(value(c[1])==l_True); + Lit tmp = c[0]; + c[0] = c[1], c[1] = tmp; + } + + for (int i = 1; i < c.size(); i++){ + Lit p = c[i]; + if (!seen[var(p)] && level(var(p)) > 0){ + if (reason(var(p)) != CRef_Undef && (abstractLevel(var(p)) & abstract_levels) != 0){ + seen[var(p)] = 1; + analyze_stack.push(p); + analyze_toclear.push(p); + }else{ + for (int j = top; j < analyze_toclear.size(); j++) + seen[var(analyze_toclear[j])] = 0; + analyze_toclear.shrink(analyze_toclear.size() - top); + return false; + } + } + } + } + + return true; +} + + +/*_________________________________________________________________________________________________ +| +| analyzeFinal : (p : Lit) -> [void] +| +| Description: +| Specialized analysis procedure to express the final conflict in terms of assumptions. +| Calculates the (possibly empty) set of assumptions that led to the assignment of 'p', and +| stores the result in 'out_conflict'. +|________________________________________________________________________________________________@*/ +void Solver::analyzeFinal(Lit p, vec& out_conflict) +{ + out_conflict.clear(); + out_conflict.push(p); + + if (decisionLevel() == 0) + return; + + seen[var(p)] = 1; + + for (int i = trail.size()-1; i >= trail_lim[0]; i--){ + Var x = var(trail[i]); + if (seen[x]){ + if (reason(x) == CRef_Undef){ + assert(level(x) > 0); + out_conflict.push(~trail[i]); + }else{ + Clause& c = ca[reason(x)]; + // for (int j = 1; j < c.size(); j++) Minisat (glucose 2.0) loop + // Bug in case of assumptions due to special data structures for Binary. + // Many thanks to Sam Bayless (sbayless@cs.ubc.ca) for discover this bug. + for (int j = ((c.size()==2) ? 0:1); j < c.size(); j++) + if (level(var(c[j])) > 0) + seen[var(c[j])] = 1; + } + + seen[x] = 0; + } + } + + seen[var(p)] = 0; +} + + +void Solver::uncheckedEnqueue(Lit p, CRef from) +{ + assert(value(p) == l_Undef); + assigns[var(p)] = lbool(!sign(p)); + vardata[var(p)] = mkVarData(from, decisionLevel()); + trail.push_(p); +} + + +/*_________________________________________________________________________________________________ +| +| propagate : [void] -> [Clause*] +| +| Description: +| Propagates all enqueued facts. If a conflict arises, the conflicting clause is returned, +| otherwise CRef_Undef. +| +| Post-conditions: +| * the propagation queue is empty, even if there was a conflict. +|________________________________________________________________________________________________@*/ +CRef Solver::propagate() +{ + CRef confl = CRef_Undef; + int num_props = 0; + watches.cleanAll(); + watchesBin.cleanAll(); + while (qhead < trail.size()){ + Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate. + vec& ws = watches[p]; + Watcher *i, *j, *end; + num_props++; + + + // First, Propagate binary clauses + vec& wbin = watchesBin[p]; + + for(int k = 0;k ");printLit(imp);printf("\n"); + uncheckedEnqueue(imp,wbin[k].cref); + } + } + + + + for (i = j = (Watcher*)ws, end = i + ws.size(); i != end;){ + // Try to avoid inspecting the clause: + Lit blocker = i->blocker; + if (value(blocker) == l_True){ + *j++ = *i++; continue; } + + // Make sure the false literal is data[1]: + CRef cr = i->cref; + Clause& c = ca[cr]; + Lit false_lit = ~p; + if (c[0] == false_lit) + c[0] = c[1], c[1] = false_lit; + assert(c[1] == false_lit); + i++; + + // If 0th watch is true, then clause is already satisfied. + Lit first = c[0]; + Watcher w = Watcher(cr, first); + if (first != blocker && value(first) == l_True){ + + *j++ = w; continue; } + + // Look for new watch: + for (int k = 2; k < c.size(); k++) + if (value(c[k]) != l_False){ + c[1] = c[k]; c[k] = false_lit; + watches[~c[1]].push(w); + goto NextClause; } + + // Did not find watch -- clause is unit under assignment: + *j++ = w; + if (value(first) == l_False){ + confl = cr; + qhead = trail.size(); + // Copy the remaining watches: + while (i < end) + *j++ = *i++; + }else { + uncheckedEnqueue(first, cr); + +#ifdef DYNAMICNBLEVEL + // DYNAMIC NBLEVEL trick (see competition'09 companion paper) + if(c.learnt() && c.lbd()>2) { + MYFLAG++; + unsigned int nblevels =0; + for(int i=0;i [void] +| +| Description: +| Remove half of the learnt clauses, minus the clauses locked by the current assignment. Locked +| clauses are clauses that are reason to some assignment. Binary clauses are never removed. +|________________________________________________________________________________________________@*/ +struct reduceDB_lt { + ClauseAllocator& ca; + reduceDB_lt(ClauseAllocator& ca_) : ca(ca_) {} + bool operator () (CRef x, CRef y) { + + // Main criteria... Like in MiniSat we keep all binary clauses + if(ca[x].size()> 2 && ca[y].size()==2) return 1; + + if(ca[y].size()>2 && ca[x].size()==2) return 0; + if(ca[x].size()==2 && ca[y].size()==2) return 0; + + // Second one based on literal block distance + if(ca[x].lbd()> ca[y].lbd()) return 1; + if(ca[x].lbd()< ca[y].lbd()) return 0; + + + // Finally we can use old activity or size, we choose the last one + return ca[x].activity() < ca[y].activity(); + //return x->size() < y->size(); + + //return ca[x].size() > 2 && (ca[y].size() == 2 || ca[x].activity() < ca[y].activity()); } + } +}; + +void Solver::reduceDB() +{ + + int i, j; + nbReduceDB++; + sort(learnts, reduceDB_lt(ca)); + + // We have a lot of "good" clauses, it is difficult to compare them. Keep more ! + if(ca[learnts[learnts.size() / RATIOREMOVECLAUSES]].lbd()<=3) nbclausesbeforereduce +=specialIncReduceDB; + // Useless :-) + if(ca[learnts.last()].lbd()<=5) nbclausesbeforereduce +=specialIncReduceDB; + + + // Don't delete binary or locked clauses. From the rest, delete clauses from the first half + // Keep clauses which seem to be usefull (their lbd was reduce during this sequence) + + int limit = learnts.size() / 2; + + for (i = j = 0; i < learnts.size(); i++){ + Clause& c = ca[learnts[i]]; + if (c.lbd()>2 && c.size() > 2 && c.canBeDel() && !locked(c) && (i < limit)) { + removeClause(learnts[i]); + nbRemovedClauses++; + } + else { + if(!c.canBeDel()) limit++; //we keep c, so we can delete an other clause + c.setCanBeDel(true); // At the next step, c can be delete + learnts[j++] = learnts[i]; + } + } + learnts.shrink(i - j); + checkGarbage(); +} + + +void Solver::removeSatisfied(vec& cs) +{ + + int i, j; + for (i = j = 0; i < cs.size(); i++){ + Clause& c = ca[cs[i]]; + + + if (c.size()>=2 && satisfied(c)) // A bug if we remove size ==2, We need to correct it, but later. + removeClause(cs[i]); + else + cs[j++] = cs[i]; + } + cs.shrink(i - j); +} + + +void Solver::rebuildOrderHeap() +{ + vec vs; + for (Var v = 0; v < nVars(); v++) + if (decision[v] && value(v) == l_Undef) + vs.push(v); + order_heap.build(vs); +} + + +/*_________________________________________________________________________________________________ +| +| simplify : [void] -> [bool] +| +| Description: +| Simplify the clause database according to the current top-level assigment. Currently, the only +| thing done here is the removal of satisfied clauses, but more things can be put here. +|________________________________________________________________________________________________@*/ +bool Solver::simplify() +{ + assert(decisionLevel() == 0); + + if (!ok || propagate() != CRef_Undef) + return ok = false; + + if (nAssigns() == simpDB_assigns || (simpDB_props > 0)) + return true; + + // Remove satisfied clauses: + removeSatisfied(learnts); + if (remove_satisfied) // Can be turned off. + removeSatisfied(clauses); + checkGarbage(); + rebuildOrderHeap(); + + simpDB_assigns = nAssigns(); + simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now) + + return true; +} + + +/*_________________________________________________________________________________________________ +| +| search : (nof_conflicts : int) (params : const SearchParams&) -> [lbool] +| +| Description: +| Search for a model the specified number of conflicts. +| NOTE! Use negative value for 'nof_conflicts' indicate infinity. +| +| Output: +| 'l_True' if a partial assigment that is consistent with respect to the clauseset is found. If +| all variables are decision variables, this means that the clause set is satisfiable. 'l_False' +| if the clause set is unsatisfiable. 'l_Undef' if the bound on number of conflicts is reached. +|________________________________________________________________________________________________@*/ +lbool Solver::search(int nof_conflicts) +{ + assert(ok); + int backtrack_level; + int conflictC = 0; + vec learnt_clause; + unsigned int nblevels; + bool blocked=false; + starts++; + for (;;){ + CRef confl = propagate(); + if (confl != CRef_Undef){ + // CONFLICT + conflicts++; conflictC++; + + if (verbosity >= 1 && conflicts%verbEveryConflicts==0){ + printf("c | %8d %7d %5d | %7d %8d %8d | %5d %8d %6d %8d | %6.3f %% |\n", + (int)starts,(int)nbstopsrestarts, (int)(conflicts/starts), + (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]), nClauses(), (int)clauses_literals, + (int)nbReduceDB, nLearnts(), (int)nbDL2,(int)nbRemovedClauses, progressEstimate()*100); + } + if (decisionLevel() == 0) { + return l_False; + + } + + trailQueue.push(trail.size()); + if( conflicts>LOWER_BOUND_FOR_BLOCKING_RESTART && lbdQueue.isvalid() && trail.size()>R*trailQueue.getavg()) { + lbdQueue.fastclear(); + nbstopsrestarts++; + if(!blocked) {lastblockatrestart=starts;nbstopsrestartssame++;blocked=true;} + } + + learnt_clause.clear(); + analyze(confl, learnt_clause, backtrack_level,nblevels); + + lbdQueue.push(nblevels); + sumLBD += nblevels; + + + cancelUntil(backtrack_level); + + if (learnt_clause.size() == 1){ + uncheckedEnqueue(learnt_clause[0]);nbUn++; + }else{ + CRef cr = ca.alloc(learnt_clause, true); + ca[cr].setLBD(nblevels); + if(nblevels<=2) nbDL2++; // stats + if(ca[cr].size()==2) nbBin++; // stats + learnts.push(cr); + attachClause(cr); + + claBumpActivity(ca[cr]); + uncheckedEnqueue(learnt_clause[0], cr); + } + varDecayActivity(); + claDecayActivity(); + + + }else{ + // Our dynamic restart, see the SAT09 competition compagnion paper + if ( + ( lbdQueue.isvalid() && ((lbdQueue.getavg()*K) > (sumLBD / conflicts)))) { + lbdQueue.fastclear(); + progress_estimate = progressEstimate(); + cancelUntil(0); + return l_Undef; } + + + // Simplify the set of problem clauses: + if (decisionLevel() == 0 && !simplify()) { + if (verbosity >= 1) + printf("c last restart ## conflicts : %d %d \n",conflictC,decisionLevel()); + return l_False; + } + // Perform clause database reduction ! + if(conflicts>=curRestart* nbclausesbeforereduce) + { + + assert(learnts.size()>0); + curRestart = (conflicts/ nbclausesbeforereduce)+1; + reduceDB(); + nbclausesbeforereduce += incReduceDB; + } + + Lit next = lit_Undef; + while (decisionLevel() < assumptions.size()){ + // Perform user provided assumption: + Lit p = assumptions[decisionLevel()]; + if (value(p) == l_True){ + // Dummy decision level: + newDecisionLevel(); + }else if (value(p) == l_False){ + analyzeFinal(~p, conflict); + return l_False; + }else{ + next = p; + break; + } + } + + if (next == lit_Undef){ + // New variable decision: + decisions++; + next = pickBranchLit(); + + if (next == lit_Undef) { + if (verbosity >= 1) + printf("c last restart ## conflicts : %d %d \n",conflictC,decisionLevel()); + // Model found: + return l_True; + } + } + + // Increase decision level and enqueue 'next' + newDecisionLevel(); + uncheckedEnqueue(next); + } + } +} + + +double Solver::progressEstimate() const +{ + double progress = 0; + double F = 1.0 / nVars(); + + for (int i = 0; i <= decisionLevel(); i++){ + int beg = i == 0 ? 0 : trail_lim[i - 1]; + int end = i == decisionLevel() ? trail.size() : trail_lim[i]; + progress += pow(F, i) * (end - beg); + } + + return progress / nVars(); +} + + +// NOTE: assumptions passed in member-variable 'assumptions'. +lbool Solver::solve_() +{ + model.clear(); + conflict.clear(); + if (!ok) return l_False; + + lbdQueue.initSize(sizeLBDQueue); + + trailQueue.initSize(sizeTrailQueue); + sumLBD = 0; + + solves++; + + + lbool status = l_Undef; + nbclausesbeforereduce = firstReduceDB; + if(verbosity>=1) { + printf("c ========================================[ MAGIC CONSTANTS ]==============================================\n"); + printf("c | Constants are supposed to work well together :-) |\n"); + printf("c | however, if you find better choices, please let us known... |\n"); + printf("c |-------------------------------------------------------------------------------------------------------|\n"); + printf("c | | | |\n"); + printf("c | - Restarts: | - Reduce Clause DB: | - Minimize Asserting: |\n"); + printf("c | * LBD Queue : %6d | * First : %6d | * size < %3d |\n",lbdQueue.maxSize(),firstReduceDB,lbSizeMinimizingClause); + printf("c | * Trail Queue : %6d | * Inc : %6d | * lbd < %3d |\n",trailQueue.maxSize(),incReduceDB,lbLBDMinimizingClause); + printf("c | * K : %6.2f | * Special : %6d | |\n",K,specialIncReduceDB); + printf("c | * R : %6.2f | * Protected : (lbd)< %2d | |\n",R,lbLBDFrozenClause); + printf("c | | | |\n"); +printf("c ==================================[ Search Statistics (every %6d conflicts) ]=========================\n",verbEveryConflicts); + printf("c | |\n"); + + printf("c | RESTARTS | ORIGINAL | LEARNT | Progress |\n"); + printf("c | NB Blocked Avg Cfc | Vars Clauses Literals | Red Learnts LBD2 Removed | |\n"); + printf("c =========================================================================================================\n"); + } + + // Search: + int curr_restarts = 0; + while (status == l_Undef){ + status = search(0); // the parameter is useless in glucose, kept to allow modifications + + if (!withinBudget()) break; + curr_restarts++; + } + + if (verbosity >= 1) + printf("c =========================================================================================================\n"); + + + if (status == l_True){ + // Extend & copy model: + model.growTo(nVars()); + for (int i = 0; i < nVars(); i++) model[i] = value(i); + }else if (status == l_False && conflict.size() == 0) + ok = false; + + cancelUntil(0); + return status; +} + +//================================================================================================= +// Writing CNF to DIMACS: +// +// FIXME: this needs to be rewritten completely. + +static Var mapVar(Var x, vec& map, Var& max) +{ + if (map.size() <= x || map[x] == -1){ + map.growTo(x+1, -1); + map[x] = max++; + } + return map[x]; +} + + +void Solver::toDimacs(FILE* f, Clause& c, vec& map, Var& max) +{ + if (satisfied(c)) return; + + for (int i = 0; i < c.size(); i++) + if (value(c[i]) != l_False) + fprintf(f, "%s%d ", sign(c[i]) ? "-" : "", mapVar(var(c[i]), map, max)+1); + fprintf(f, "0\n"); +} + + +void Solver::toDimacs(const char *file, const vec& assumps) +{ + FILE* f = fopen(file, "wr"); + if (f == NULL) + fprintf(stderr, "could not open file %s\n", file), exit(1); + toDimacs(f, assumps); + fclose(f); +} + + +void Solver::toDimacs(FILE* f, const vec& assumps) +{ + // Handle case when solver is in contradictory state: + if (!ok){ + fprintf(f, "p cnf 1 2\n1 0\n-1 0\n"); + return; } + + vec map; Var max = 0; + + // Cannot use removeClauses here because it is not safe + // to deallocate them at this point. Could be improved. + int cnt = 0; + for (int i = 0; i < clauses.size(); i++) + if (!satisfied(ca[clauses[i]])) + cnt++; + + for (int i = 0; i < clauses.size(); i++) + if (!satisfied(ca[clauses[i]])){ + Clause& c = ca[clauses[i]]; + for (int j = 0; j < c.size(); j++) + if (value(c[j]) != l_False) + mapVar(var(c[j]), map, max); + } + + // Assumptions are added as unit clauses: + cnt += assumptions.size(); + + fprintf(f, "p cnf %d %d\n", max, cnt); + + for (int i = 0; i < assumptions.size(); i++){ + assert(value(assumptions[i]) != l_False); + fprintf(f, "%s%d 0\n", sign(assumptions[i]) ? "-" : "", mapVar(var(assumptions[i]), map, max)+1); + } + + for (int i = 0; i < clauses.size(); i++) + toDimacs(f, ca[clauses[i]], map, max); + + if (verbosity > 0) + printf("Wrote %d clauses with %d variables.\n", cnt, max); +} + + +//================================================================================================= +// Garbage Collection methods: + +void Solver::relocAll(ClauseAllocator& to) +{ + // All watchers: + // + // for (int i = 0; i < watches.size(); i++) + watches.cleanAll(); + watchesBin.cleanAll(); + for (int v = 0; v < nVars(); v++) + for (int s = 0; s < 2; s++){ + Lit p = mkLit(v, s); + // printf(" >>> RELOCING: %s%d\n", sign(p)?"-":"", var(p)+1); + vec& ws = watches[p]; + for (int j = 0; j < ws.size(); j++) + ca.reloc(ws[j].cref, to); + vec& ws2 = watchesBin[p]; + for (int j = 0; j < ws2.size(); j++) + ca.reloc(ws2[j].cref, to); + } + + // All reasons: + // + for (int i = 0; i < trail.size(); i++){ + Var v = var(trail[i]); + + if (reason(v) != CRef_Undef && (ca[reason(v)].reloced() || locked(ca[reason(v)]))) + ca.reloc(vardata[v].reason, to); + } + + // All learnt: + // + for (int i = 0; i < learnts.size(); i++) + ca.reloc(learnts[i], to); + + // All original: + // + for (int i = 0; i < clauses.size(); i++) + ca.reloc(clauses[i], to); +} + + +void Solver::garbageCollect() +{ + // Initialize the next region to a size corresponding to the estimated utilization degree. This + // is not precise but should avoid some unnecessary reallocations for the new region: + ClauseAllocator to(ca.size() - ca.wasted()); + + relocAll(to); + if (verbosity >= 2) + printf("| Garbage collection: %12d bytes => %12d bytes |\n", + ca.size()*ClauseAllocator::Unit_Size, to.size()*ClauseAllocator::Unit_Size); + to.moveTo(ca); +} diff --git a/packages/bee/glucose-2.2/core/Solver.h b/packages/bee/glucose-2.2/core/Solver.h new file mode 100755 index 000000000..57563f04f --- /dev/null +++ b/packages/bee/glucose-2.2/core/Solver.h @@ -0,0 +1,436 @@ +/****************************************************************************************[Solver.h] + Glucose -- Copyright (c) 2009, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose are exactly the same as Minisat on which it is based on. (see below). + +--------------- +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Solver_h +#define Glucose_Solver_h + +#include "mtl/Vec.h" +#include "mtl/Heap.h" +#include "mtl/Alg.h" +#include "utils/Options.h" +#include "core/SolverTypes.h" +#include "core/BoundedQueue.h" +#include "core/Constants.h" + + +namespace Glucose { + +//================================================================================================= +// Solver -- the main class: + +class Solver { +public: + + // Constructor/Destructor: + // + Solver(); + virtual ~Solver(); + + // Problem specification: + // + Var newVar (bool polarity = true, bool dvar = true); // Add a new variable with parameters specifying variable mode. + + bool addClause (const vec& ps); // Add a clause to the solver. + bool addEmptyClause(); // Add the empty clause, making the solver contradictory. + bool addClause (Lit p); // Add a unit clause to the solver. + bool addClause (Lit p, Lit q); // Add a binary clause to the solver. + bool addClause (Lit p, Lit q, Lit r); // Add a ternary clause to the solver. + bool addClause_( vec& ps); // Add a clause to the solver without making superflous internal copy. Will + // change the passed vector 'ps'. + + // Solving: + // + bool simplify (); // Removes already satisfied clauses. + bool solve (const vec& assumps); // Search for a model that respects a given set of assumptions. + lbool solveLimited (const vec& assumps); // Search for a model that respects a given set of assumptions (With resource constraints). + bool solve (); // Search without assumptions. + bool solve (Lit p); // Search for a model that respects a single assumption. + bool solve (Lit p, Lit q); // Search for a model that respects two assumptions. + bool solve (Lit p, Lit q, Lit r); // Search for a model that respects three assumptions. + bool okay () const; // FALSE means solver is in a conflicting state + + void toDimacs (FILE* f, const vec& assumps); // Write CNF to file in DIMACS-format. + void toDimacs (const char *file, const vec& assumps); + void toDimacs (FILE* f, Clause& c, vec& map, Var& max); + void printLit(Lit l); + void printClause(CRef c); + // Convenience versions of 'toDimacs()': + void toDimacs (const char* file); + void toDimacs (const char* file, Lit p); + void toDimacs (const char* file, Lit p, Lit q); + void toDimacs (const char* file, Lit p, Lit q, Lit r); + + // Variable mode: + // + void setPolarity (Var v, bool b); // Declare which polarity the decision heuristic should use for a variable. Requires mode 'polarity_user'. + void setDecisionVar (Var v, bool b); // Declare if a variable should be eligible for selection in the decision heuristic. + + // Read state: + // + lbool value (Var x) const; // The current value of a variable. + lbool value (Lit p) const; // The current value of a literal. + lbool modelValue (Var x) const; // The value of a variable in the last model. The last call to solve must have been satisfiable. + lbool modelValue (Lit p) const; // The value of a literal in the last model. The last call to solve must have been satisfiable. + int nAssigns () const; // The current number of assigned literals. + int nClauses () const; // The current number of original clauses. + int nLearnts () const; // The current number of learnt clauses. + int nVars () const; // The current number of variables. + int nFreeVars () const; + + // Resource contraints: + // + void setConfBudget(int64_t x); + void setPropBudget(int64_t x); + void budgetOff(); + void interrupt(); // Trigger a (potentially asynchronous) interruption of the solver. + void clearInterrupt(); // Clear interrupt indicator flag. + + // Memory managment: + // + virtual void garbageCollect(); + void checkGarbage(double gf); + void checkGarbage(); + + // Extra results: (read-only member variable) + // + vec model; // If problem is satisfiable, this vector contains the model (if any). + vec conflict; // If problem is unsatisfiable (possibly under assumptions), + // this vector represent the final conflict clause expressed in the assumptions. + + // Mode of operation: + // + int verbosity; + int verbEveryConflicts; + // Constants For restarts + double K; + double R; + double sizeLBDQueue; + double sizeTrailQueue; + + // Constants for reduce DB + int firstReduceDB; + int incReduceDB; + int specialIncReduceDB; + unsigned int lbLBDFrozenClause; + + // Constant for reducing clause + int lbSizeMinimizingClause; + unsigned int lbLBDMinimizingClause; + + double var_decay; + double clause_decay; + double random_var_freq; + double random_seed; + int ccmin_mode; // Controls conflict clause minimization (0=none, 1=basic, 2=deep). + int phase_saving; // Controls the level of phase saving (0=none, 1=limited, 2=full). + bool rnd_pol; // Use random polarities for branching heuristics. + bool rnd_init_act; // Initialize variable activities with a small random value. + double garbage_frac; // The fraction of wasted memory allowed before a garbage collection is triggered. + + + + // Statistics: (read-only member variable) + // + uint64_t nbRemovedClauses,nbReducedClauses,nbDL2,nbBin,nbUn,nbReduceDB,solves, starts, decisions, rnd_decisions, propagations, conflicts,nbstopsrestarts,nbstopsrestartssame,lastblockatrestart; + uint64_t dec_vars, clauses_literals, learnts_literals, max_literals, tot_literals; + +protected: + long curRestart; + // Helper structures: + // + struct VarData { CRef reason; int level; }; + static inline VarData mkVarData(CRef cr, int l){ VarData d = {cr, l}; return d; } + + struct Watcher { + CRef cref; + Lit blocker; + Watcher(CRef cr, Lit p) : cref(cr), blocker(p) {} + bool operator==(const Watcher& w) const { return cref == w.cref; } + bool operator!=(const Watcher& w) const { return cref != w.cref; } + }; + + struct WatcherDeleted + { + const ClauseAllocator& ca; + WatcherDeleted(const ClauseAllocator& _ca) : ca(_ca) {} + bool operator()(const Watcher& w) const { return ca[w.cref].mark() == 1; } + }; + + struct VarOrderLt { + const vec& activity; + bool operator () (Var x, Var y) const { return activity[x] > activity[y]; } + VarOrderLt(const vec& act) : activity(act) { } + }; + + + // Solver state: + // + int lastIndexRed; + bool ok; // If FALSE, the constraints are already unsatisfiable. No part of the solver state may be used! + double cla_inc; // Amount to bump next clause with. + vec activity; // A heuristic measurement of the activity of a variable. + double var_inc; // Amount to bump next variable with. + OccLists, WatcherDeleted> + watches; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true). + OccLists, WatcherDeleted> + watchesBin; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true). + vec clauses; // List of problem clauses. + vec learnts; // List of learnt clauses. + + vec assigns; // The current assignments. + vec polarity; // The preferred polarity of each variable. + vec decision; // Declares if a variable is eligible for selection in the decision heuristic. + vec trail; // Assignment stack; stores all assigments made in the order they were made. + vec nbpos; + vec trail_lim; // Separator indices for different decision levels in 'trail'. + vec vardata; // Stores reason and level for each variable. + int qhead; // Head of queue (as index into the trail -- no more explicit propagation queue in MiniSat). + int simpDB_assigns; // Number of top-level assignments since last execution of 'simplify()'. + int64_t simpDB_props; // Remaining number of propagations that must be made before next execution of 'simplify()'. + vec assumptions; // Current set of assumptions provided to solve by the user. + Heap order_heap; // A priority queue of variables ordered with respect to the variable activity. + double progress_estimate;// Set by 'search()'. + bool remove_satisfied; // Indicates whether possibly inefficient linear scan for satisfied clauses should be performed in 'simplify'. + vec permDiff; // permDiff[var] contains the current conflict number... Used to count the number of LBD + +#ifdef UPDATEVARACTIVITY + // UPDATEVARACTIVITY trick (see competition'09 companion paper) + vec lastDecisionLevel; +#endif + + ClauseAllocator ca; + + int nbclausesbeforereduce; // To know when it is time to reduce clause database + + bqueue trailQueue,lbdQueue; // Bounded queues for restarts. + float sumLBD; // used to compute the global average of LBD. Restarts... + + + // Temporaries (to reduce allocation overhead). Each variable is prefixed by the method in which it is + // used, exept 'seen' wich is used in several places. + // + vec seen; + vec analyze_stack; + vec analyze_toclear; + vec add_tmp; + unsigned long MYFLAG; + + + double max_learnts; + double learntsize_adjust_confl; + int learntsize_adjust_cnt; + + // Resource contraints: + // + int64_t conflict_budget; // -1 means no budget. + int64_t propagation_budget; // -1 means no budget. + bool asynch_interrupt; + + // Main internal methods: + // + void insertVarOrder (Var x); // Insert a variable in the decision order priority queue. + Lit pickBranchLit (); // Return the next decision variable. + void newDecisionLevel (); // Begins a new decision level. + void uncheckedEnqueue (Lit p, CRef from = CRef_Undef); // Enqueue a literal. Assumes value of literal is undefined. + bool enqueue (Lit p, CRef from = CRef_Undef); // Test if fact 'p' contradicts current state, enqueue otherwise. + CRef propagate (); // Perform unit propagation. Returns possibly conflicting clause. + void cancelUntil (int level); // Backtrack until a certain level. + void analyze (CRef confl, vec& out_learnt, int& out_btlevel,unsigned int &nblevels); // (bt = backtrack) + void analyzeFinal (Lit p, vec& out_conflict); // COULD THIS BE IMPLEMENTED BY THE ORDINARIY "analyze" BY SOME REASONABLE GENERALIZATION? + bool litRedundant (Lit p, uint32_t abstract_levels); // (helper method for 'analyze()') + lbool search (int nof_conflicts); // Search for a given number of conflicts. + lbool solve_ (); // Main solve method (assumptions given in 'assumptions'). + void reduceDB (); // Reduce the set of learnt clauses. + void removeSatisfied (vec& cs); // Shrink 'cs' to contain only non-satisfied clauses. + void rebuildOrderHeap (); + + // Maintaining Variable/Clause activity: + // + void varDecayActivity (); // Decay all variables with the specified factor. Implemented by increasing the 'bump' value instead. + void varBumpActivity (Var v, double inc); // Increase a variable with the current 'bump' value. + void varBumpActivity (Var v); // Increase a variable with the current 'bump' value. + void claDecayActivity (); // Decay all clauses with the specified factor. Implemented by increasing the 'bump' value instead. + void claBumpActivity (Clause& c); // Increase a clause with the current 'bump' value. + + // Operations on clauses: + // + void attachClause (CRef cr); // Attach a clause to watcher lists. + void detachClause (CRef cr, bool strict = false); // Detach a clause to watcher lists. + void removeClause (CRef cr); // Detach and free a clause. + bool locked (const Clause& c) const; // Returns TRUE if a clause is a reason for some implication in the current state. + bool satisfied (const Clause& c) const; // Returns TRUE if a clause is satisfied in the current state. + + void relocAll (ClauseAllocator& to); + + // Misc: + // + int decisionLevel () const; // Gives the current decisionlevel. + uint32_t abstractLevel (Var x) const; // Used to represent an abstraction of sets of decision levels. + CRef reason (Var x) const; + int level (Var x) const; + double progressEstimate () const; // DELETE THIS ?? IT'S NOT VERY USEFUL ... + bool withinBudget () const; + + // Static helpers: + // + + // Returns a random float 0 <= x < 1. Seed must never be 0. + static inline double drand(double& seed) { + seed *= 1389796; + int q = (int)(seed / 2147483647); + seed -= (double)q * 2147483647; + return seed / 2147483647; } + + // Returns a random integer 0 <= x < size. Seed must never be 0. + static inline int irand(double& seed, int size) { + return (int)(drand(seed) * size); } +}; + + +//================================================================================================= +// Implementation of inline methods: + +inline CRef Solver::reason(Var x) const { return vardata[x].reason; } +inline int Solver::level (Var x) const { return vardata[x].level; } + +inline void Solver::insertVarOrder(Var x) { + if (!order_heap.inHeap(x) && decision[x]) order_heap.insert(x); } + +inline void Solver::varDecayActivity() { var_inc *= (1 / var_decay); } +inline void Solver::varBumpActivity(Var v) { varBumpActivity(v, var_inc); } +inline void Solver::varBumpActivity(Var v, double inc) { + if ( (activity[v] += inc) > 1e100 ) { + // Rescale: + for (int i = 0; i < nVars(); i++) + activity[i] *= 1e-100; + var_inc *= 1e-100; } + + // Update order_heap with respect to new activity: + if (order_heap.inHeap(v)) + order_heap.decrease(v); } + +inline void Solver::claDecayActivity() { cla_inc *= (1 / clause_decay); } +inline void Solver::claBumpActivity (Clause& c) { + if ( (c.activity() += cla_inc) > 1e20 ) { + // Rescale: + for (int i = 0; i < learnts.size(); i++) + ca[learnts[i]].activity() *= 1e-20; + cla_inc *= 1e-20; } } + +inline void Solver::checkGarbage(void){ return checkGarbage(garbage_frac); } +inline void Solver::checkGarbage(double gf){ + if (ca.wasted() > ca.size() * gf) + garbageCollect(); } + +// NOTE: enqueue does not set the ok flag! (only public methods do) +inline bool Solver::enqueue (Lit p, CRef from) { return value(p) != l_Undef ? value(p) != l_False : (uncheckedEnqueue(p, from), true); } +inline bool Solver::addClause (const vec& ps) { ps.copyTo(add_tmp); return addClause_(add_tmp); } +inline bool Solver::addEmptyClause () { add_tmp.clear(); return addClause_(add_tmp); } +inline bool Solver::addClause (Lit p) { add_tmp.clear(); add_tmp.push(p); return addClause_(add_tmp); } +inline bool Solver::addClause (Lit p, Lit q) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); } +inline bool Solver::addClause (Lit p, Lit q, Lit r) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); } + inline bool Solver::locked (const Clause& c) const { + if(c.size()>2) + return value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c; + return + (value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c) + || + (value(c[1]) == l_True && reason(var(c[1])) != CRef_Undef && ca.lea(reason(var(c[1]))) == &c); + } +inline void Solver::newDecisionLevel() { trail_lim.push(trail.size()); } + +inline int Solver::decisionLevel () const { return trail_lim.size(); } +inline uint32_t Solver::abstractLevel (Var x) const { return 1 << (level(x) & 31); } +inline lbool Solver::value (Var x) const { return assigns[x]; } +inline lbool Solver::value (Lit p) const { return assigns[var(p)] ^ sign(p); } +inline lbool Solver::modelValue (Var x) const { return model[x]; } +inline lbool Solver::modelValue (Lit p) const { return model[var(p)] ^ sign(p); } +inline int Solver::nAssigns () const { return trail.size(); } +inline int Solver::nClauses () const { return clauses.size(); } +inline int Solver::nLearnts () const { return learnts.size(); } +inline int Solver::nVars () const { return vardata.size(); } +inline int Solver::nFreeVars () const { return (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]); } +inline void Solver::setPolarity (Var v, bool b) { polarity[v] = b; } +inline void Solver::setDecisionVar(Var v, bool b) +{ + if ( b && !decision[v]) dec_vars++; + else if (!b && decision[v]) dec_vars--; + + decision[v] = b; + insertVarOrder(v); +} +inline void Solver::setConfBudget(int64_t x){ conflict_budget = conflicts + x; } +inline void Solver::setPropBudget(int64_t x){ propagation_budget = propagations + x; } +inline void Solver::interrupt(){ asynch_interrupt = true; } +inline void Solver::clearInterrupt(){ asynch_interrupt = false; } +inline void Solver::budgetOff(){ conflict_budget = propagation_budget = -1; } +inline bool Solver::withinBudget() const { + return !asynch_interrupt && + (conflict_budget < 0 || conflicts < (uint64_t)conflict_budget) && + (propagation_budget < 0 || propagations < (uint64_t)propagation_budget); } + +// FIXME: after the introduction of asynchronous interrruptions the solve-versions that return a +// pure bool do not give a safe interface. Either interrupts must be possible to turn off here, or +// all calls to solve must return an 'lbool'. I'm not yet sure which I prefer. +inline bool Solver::solve () { budgetOff(); assumptions.clear(); return solve_() == l_True; } +inline bool Solver::solve (Lit p) { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_() == l_True; } +inline bool Solver::solve (Lit p, Lit q) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_() == l_True; } +inline bool Solver::solve (Lit p, Lit q, Lit r) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_() == l_True; } +inline bool Solver::solve (const vec& assumps){ budgetOff(); assumps.copyTo(assumptions); return solve_() == l_True; } +inline lbool Solver::solveLimited (const vec& assumps){ assumps.copyTo(assumptions); return solve_(); } +inline bool Solver::okay () const { return ok; } + +inline void Solver::toDimacs (const char* file){ vec as; toDimacs(file, as); } +inline void Solver::toDimacs (const char* file, Lit p){ vec as; as.push(p); toDimacs(file, as); } +inline void Solver::toDimacs (const char* file, Lit p, Lit q){ vec as; as.push(p); as.push(q); toDimacs(file, as); } +inline void Solver::toDimacs (const char* file, Lit p, Lit q, Lit r){ vec as; as.push(p); as.push(q); as.push(r); toDimacs(file, as); } + + +//================================================================================================= +// Debug etc: + + +inline void Solver::printLit(Lit l) +{ + printf("%s%d:%c", sign(l) ? "-" : "", var(l)+1, value(l) == l_True ? '1' : (value(l) == l_False ? '0' : 'X')); +} + + +inline void Solver::printClause(CRef cr) +{ + Clause &c = ca[cr]; + for (int i = 0; i < c.size(); i++){ + printLit(c[i]); + printf(" "); + } +} + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/core/SolverTypes.h b/packages/bee/glucose-2.2/core/SolverTypes.h new file mode 100755 index 000000000..9e989df22 --- /dev/null +++ b/packages/bee/glucose-2.2/core/SolverTypes.h @@ -0,0 +1,429 @@ +/***********************************************************************************[SolverTypes.h] + Glucose -- Copyright (c) 2009, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose are exactly the same as Minisat on which it is based on. (see below). + +--------------- +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef Glucose_SolverTypes_h +#define Glucose_SolverTypes_h + +#include + +#include "mtl/IntTypes.h" +#include "mtl/Alg.h" +#include "mtl/Vec.h" +#include "mtl/Map.h" +#include "mtl/Alloc.h" + +namespace Glucose { + +//================================================================================================= +// Variables, literals, lifted booleans, clauses: + + +// NOTE! Variables are just integers. No abstraction here. They should be chosen from 0..N, +// so that they can be used as array indices. + +typedef int Var; +#define var_Undef (-1) + + +struct Lit { + int x; + + // Use this as a constructor: + friend Lit mkLit(Var var, bool sign); + + bool operator == (Lit p) const { return x == p.x; } + bool operator != (Lit p) const { return x != p.x; } + bool operator < (Lit p) const { return x < p.x; } // '<' makes p, ~p adjacent in the ordering. +}; + + +inline Lit mkLit (Var var, bool sign=false) { Lit p; p.x = var + var + (int)sign; return p; } +inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; } +inline Lit operator ^(Lit p, bool b) { Lit q; q.x = p.x ^ (unsigned int)b; return q; } +inline bool sign (Lit p) { return p.x & 1; } +inline int var (Lit p) { return p.x >> 1; } + +// Mapping Literals to and from compact integers suitable for array indexing: +inline int toInt (Var v) { return v; } +inline int toInt (Lit p) { return p.x; } +inline Lit toLit (int i) { Lit p; p.x = i; return p; } + +//const Lit lit_Undef = mkLit(var_Undef, false); // }- Useful special constants. +//const Lit lit_Error = mkLit(var_Undef, true ); // } + +const Lit lit_Undef = { -2 }; // }- Useful special constants. +const Lit lit_Error = { -1 }; // } + + +//================================================================================================= +// Lifted booleans: +// +// NOTE: this implementation is optimized for the case when comparisons between values are mostly +// between one variable and one constant. Some care had to be taken to make sure that gcc +// does enough constant propagation to produce sensible code, and this appears to be somewhat +// fragile unfortunately. + +#define l_True (lbool((uint8_t)0)) // gcc does not do constant propagation if these are real constants. +#define l_False (lbool((uint8_t)1)) +#define l_Undef (lbool((uint8_t)2)) + +class lbool { + uint8_t value; + +public: + explicit lbool(uint8_t v) : value(v) { } + + lbool() : value(0) { } + explicit lbool(bool x) : value(!x) { } + + bool operator == (lbool b) const { return ((b.value&2) & (value&2)) | (!(b.value&2)&(value == b.value)); } + bool operator != (lbool b) const { return !(*this == b); } + lbool operator ^ (bool b) const { return lbool((uint8_t)(value^(uint8_t)b)); } + + lbool operator && (lbool b) const { + uint8_t sel = (this->value << 1) | (b.value << 3); + uint8_t v = (0xF7F755F4 >> sel) & 3; + return lbool(v); } + + lbool operator || (lbool b) const { + uint8_t sel = (this->value << 1) | (b.value << 3); + uint8_t v = (0xFCFCF400 >> sel) & 3; + return lbool(v); } + + friend int toInt (lbool l); + friend lbool toLbool(int v); +}; +inline int toInt (lbool l) { return l.value; } +inline lbool toLbool(int v) { return lbool((uint8_t)v); } + +//================================================================================================= +// Clause -- a simple class for representing a clause: + +class Clause; +typedef RegionAllocator::Ref CRef; + +class Clause { + struct { + unsigned mark : 2; + unsigned learnt : 1; + unsigned has_extra : 1; + unsigned reloced : 1; + unsigned lbd : 26; + unsigned canbedel : 1; + unsigned size : 32; + } header; + union { Lit lit; float act; uint32_t abs; CRef rel; } data[0]; + + friend class ClauseAllocator; + + // NOTE: This constructor cannot be used directly (doesn't allocate enough memory). + template + Clause(const V& ps, bool use_extra, bool learnt) { + header.mark = 0; + header.learnt = learnt; + header.has_extra = use_extra; + header.reloced = 0; + header.size = ps.size(); + header.lbd = 0; + header.canbedel = 1; + for (int i = 0; i < ps.size(); i++) + data[i].lit = ps[i]; + + if (header.has_extra){ + if (header.learnt) + data[header.size].act = 0; + else + calcAbstraction(); } + } + +public: + void calcAbstraction() { + assert(header.has_extra); + uint32_t abstraction = 0; + for (int i = 0; i < size(); i++) + abstraction |= 1 << (var(data[i].lit) & 31); + data[header.size].abs = abstraction; } + + + int size () const { return header.size; } + void shrink (int i) { assert(i <= size()); if (header.has_extra) data[header.size-i] = data[header.size]; header.size -= i; } + void pop () { shrink(1); } + bool learnt () const { return header.learnt; } + bool has_extra () const { return header.has_extra; } + uint32_t mark () const { return header.mark; } + void mark (uint32_t m) { header.mark = m; } + const Lit& last () const { return data[header.size-1].lit; } + + bool reloced () const { return header.reloced; } + CRef relocation () const { return data[0].rel; } + void relocate (CRef c) { header.reloced = 1; data[0].rel = c; } + + // NOTE: somewhat unsafe to change the clause in-place! Must manually call 'calcAbstraction' afterwards for + // subsumption operations to behave correctly. + Lit& operator [] (int i) { return data[i].lit; } + Lit operator [] (int i) const { return data[i].lit; } + operator const Lit* (void) const { return (Lit*)data; } + + float& activity () { assert(header.has_extra); return data[header.size].act; } + uint32_t abstraction () const { assert(header.has_extra); return data[header.size].abs; } + + Lit subsumes (const Clause& other) const; + void strengthen (Lit p); + void setLBD(int i) {header.lbd = i;} + // unsigned int& lbd () { return header.lbd; } + unsigned int lbd () const { return header.lbd; } + void setCanBeDel(bool b) {header.canbedel = b;} + bool canBeDel() {return header.canbedel;} +}; + + +//================================================================================================= +// ClauseAllocator -- a simple class for allocating memory for clauses: + + +const CRef CRef_Undef = RegionAllocator::Ref_Undef; +class ClauseAllocator : public RegionAllocator +{ + static int clauseWord32Size(int size, bool has_extra){ + return (sizeof(Clause) + (sizeof(Lit) * (size + (int)has_extra))) / sizeof(uint32_t); } + public: + bool extra_clause_field; + + ClauseAllocator(uint32_t start_cap) : RegionAllocator(start_cap), extra_clause_field(false){} + ClauseAllocator() : extra_clause_field(false){} + + void moveTo(ClauseAllocator& to){ + to.extra_clause_field = extra_clause_field; + RegionAllocator::moveTo(to); } + + template + CRef alloc(const Lits& ps, bool learnt = false) + { + assert(sizeof(Lit) == sizeof(uint32_t)); + assert(sizeof(float) == sizeof(uint32_t)); + bool use_extra = learnt | extra_clause_field; + + CRef cid = RegionAllocator::alloc(clauseWord32Size(ps.size(), use_extra)); + new (lea(cid)) Clause(ps, use_extra, learnt); + + return cid; + } + + // Deref, Load Effective Address (LEA), Inverse of LEA (AEL): + Clause& operator[](Ref r) { return (Clause&)RegionAllocator::operator[](r); } + const Clause& operator[](Ref r) const { return (Clause&)RegionAllocator::operator[](r); } + Clause* lea (Ref r) { return (Clause*)RegionAllocator::lea(r); } + const Clause* lea (Ref r) const { return (Clause*)RegionAllocator::lea(r); } + Ref ael (const Clause* t){ return RegionAllocator::ael((uint32_t*)t); } + + void free(CRef cid) + { + Clause& c = operator[](cid); + RegionAllocator::free(clauseWord32Size(c.size(), c.has_extra())); + } + + void reloc(CRef& cr, ClauseAllocator& to) + { + Clause& c = operator[](cr); + + if (c.reloced()) { cr = c.relocation(); return; } + + cr = to.alloc(c, c.learnt()); + c.relocate(cr); + + // Copy extra data-fields: + // (This could be cleaned-up. Generalize Clause-constructor to be applicable here instead?) + to[cr].mark(c.mark()); + if (to[cr].learnt()) { + to[cr].activity() = c.activity(); + to[cr].setLBD(c.lbd()); + to[cr].setCanBeDel(c.canBeDel()); + } + else if (to[cr].has_extra()) to[cr].calcAbstraction(); + } +}; + + +//================================================================================================= +// OccLists -- a class for maintaining occurence lists with lazy deletion: + +template +class OccLists +{ + vec occs; + vec dirty; + vec dirties; + Deleted deleted; + + public: + OccLists(const Deleted& d) : deleted(d) {} + + void init (const Idx& idx){ occs.growTo(toInt(idx)+1); dirty.growTo(toInt(idx)+1, 0); } + // Vec& operator[](const Idx& idx){ return occs[toInt(idx)]; } + Vec& operator[](const Idx& idx){ return occs[toInt(idx)]; } + Vec& lookup (const Idx& idx){ if (dirty[toInt(idx)]) clean(idx); return occs[toInt(idx)]; } + + void cleanAll (); + void clean (const Idx& idx); + void smudge (const Idx& idx){ + if (dirty[toInt(idx)] == 0){ + dirty[toInt(idx)] = 1; + dirties.push(idx); + } + } + + void clear(bool free = true){ + occs .clear(free); + dirty .clear(free); + dirties.clear(free); + } +}; + + +template +void OccLists::cleanAll() +{ + for (int i = 0; i < dirties.size(); i++) + // Dirties may contain duplicates so check here if a variable is already cleaned: + if (dirty[toInt(dirties[i])]) + clean(dirties[i]); + dirties.clear(); +} + + +template +void OccLists::clean(const Idx& idx) +{ + Vec& vec = occs[toInt(idx)]; + int i, j; + for (i = j = 0; i < vec.size(); i++) + if (!deleted(vec[i])) + vec[j++] = vec[i]; + vec.shrink(i - j); + dirty[toInt(idx)] = 0; +} + + +//================================================================================================= +// CMap -- a class for mapping clauses to values: + + +template +class CMap +{ + struct CRefHash { + uint32_t operator()(CRef cr) const { return (uint32_t)cr; } }; + + typedef Map HashTable; + HashTable map; + + public: + // Size-operations: + void clear () { map.clear(); } + int size () const { return map.elems(); } + + + // Insert/Remove/Test mapping: + void insert (CRef cr, const T& t){ map.insert(cr, t); } + void growTo (CRef cr, const T& t){ map.insert(cr, t); } // NOTE: for compatibility + void remove (CRef cr) { map.remove(cr); } + bool has (CRef cr, T& t) { return map.peek(cr, t); } + + // Vector interface (the clause 'c' must already exist): + const T& operator [] (CRef cr) const { return map[cr]; } + T& operator [] (CRef cr) { return map[cr]; } + + // Iteration (not transparent at all at the moment): + int bucket_count() const { return map.bucket_count(); } + const vec& bucket(int i) const { return map.bucket(i); } + + // Move contents to other map: + void moveTo(CMap& other){ map.moveTo(other.map); } + + // TMP debug: + void debug(){ + printf(" --- size = %d, bucket_count = %d\n", size(), map.bucket_count()); } +}; + + +/*_________________________________________________________________________________________________ +| +| subsumes : (other : const Clause&) -> Lit +| +| Description: +| Checks if clause subsumes 'other', and at the same time, if it can be used to simplify 'other' +| by subsumption resolution. +| +| Result: +| lit_Error - No subsumption or simplification +| lit_Undef - Clause subsumes 'other' +| p - The literal p can be deleted from 'other' +|________________________________________________________________________________________________@*/ +inline Lit Clause::subsumes(const Clause& other) const +{ + //if (other.size() < size() || (extra.abst & ~other.extra.abst) != 0) + //if (other.size() < size() || (!learnt() && !other.learnt() && (extra.abst & ~other.extra.abst) != 0)) + assert(!header.learnt); assert(!other.header.learnt); + assert(header.has_extra); assert(other.header.has_extra); + if (other.header.size < header.size || (data[header.size].abs & ~other.data[other.header.size].abs) != 0) + return lit_Error; + + Lit ret = lit_Undef; + const Lit* c = (const Lit*)(*this); + const Lit* d = (const Lit*)other; + + for (unsigned i = 0; i < header.size; i++) { + // search for c[i] or ~c[i] + for (unsigned j = 0; j < other.header.size; j++) + if (c[i] == d[j]) + goto ok; + else if (ret == lit_Undef && c[i] == ~d[j]){ + ret = c[i]; + goto ok; + } + + // did not find it + return lit_Error; + ok:; + } + + return ret; +} + +inline void Clause::strengthen(Lit p) +{ + remove(*this, p); + calcAbstraction(); +} + +//================================================================================================= +} + + +#endif diff --git a/packages/bee/glucose-2.2/mtl/Alg.h b/packages/bee/glucose-2.2/mtl/Alg.h new file mode 100755 index 000000000..9afb4552b --- /dev/null +++ b/packages/bee/glucose-2.2/mtl/Alg.h @@ -0,0 +1,84 @@ +/*******************************************************************************************[Alg.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Alg_h +#define Glucose_Alg_h + +#include "mtl/Vec.h" + +namespace Glucose { + +//================================================================================================= +// Useful functions on vector-like types: + +//================================================================================================= +// Removing and searching for elements: +// + +template +static inline void remove(V& ts, const T& t) +{ + int j = 0; + for (; j < ts.size() && ts[j] != t; j++); + assert(j < ts.size()); + for (; j < ts.size()-1; j++) ts[j] = ts[j+1]; + ts.pop(); +} + + +template +static inline bool find(V& ts, const T& t) +{ + int j = 0; + for (; j < ts.size() && ts[j] != t; j++); + return j < ts.size(); +} + + +//================================================================================================= +// Copying vectors with support for nested vector types: +// + +// Base case: +template +static inline void copy(const T& from, T& to) +{ + to = from; +} + +// Recursive case: +template +static inline void copy(const vec& from, vec& to, bool append = false) +{ + if (!append) + to.clear(); + for (int i = 0; i < from.size(); i++){ + to.push(); + copy(from[i], to.last()); + } +} + +template +static inline void append(const vec& from, vec& to){ copy(from, to, true); } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/mtl/Alloc.h b/packages/bee/glucose-2.2/mtl/Alloc.h new file mode 100755 index 000000000..61264a2d9 --- /dev/null +++ b/packages/bee/glucose-2.2/mtl/Alloc.h @@ -0,0 +1,131 @@ +/*****************************************************************************************[Alloc.h] +Copyright (c) 2008-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef Glucose_Alloc_h +#define Glucose_Alloc_h + +#include "mtl/XAlloc.h" +#include "mtl/Vec.h" + +namespace Glucose { + +//================================================================================================= +// Simple Region-based memory allocator: + +template +class RegionAllocator +{ + T* memory; + uint32_t sz; + uint32_t cap; + uint32_t wasted_; + + void capacity(uint32_t min_cap); + + public: + // TODO: make this a class for better type-checking? + typedef uint32_t Ref; + enum { Ref_Undef = UINT32_MAX }; + enum { Unit_Size = sizeof(uint32_t) }; + + explicit RegionAllocator(uint32_t start_cap = 1024*1024) : memory(NULL), sz(0), cap(0), wasted_(0){ capacity(start_cap); } + ~RegionAllocator() + { + if (memory != NULL) + ::free(memory); + } + + + uint32_t size () const { return sz; } + uint32_t wasted () const { return wasted_; } + + Ref alloc (int size); + void free (int size) { wasted_ += size; } + + // Deref, Load Effective Address (LEA), Inverse of LEA (AEL): + T& operator[](Ref r) { assert(r >= 0 && r < sz); return memory[r]; } + const T& operator[](Ref r) const { assert(r >= 0 && r < sz); return memory[r]; } + + T* lea (Ref r) { assert(r >= 0 && r < sz); return &memory[r]; } + const T* lea (Ref r) const { assert(r >= 0 && r < sz); return &memory[r]; } + Ref ael (const T* t) { assert((void*)t >= (void*)&memory[0] && (void*)t < (void*)&memory[sz-1]); + return (Ref)(t - &memory[0]); } + + void moveTo(RegionAllocator& to) { + if (to.memory != NULL) ::free(to.memory); + to.memory = memory; + to.sz = sz; + to.cap = cap; + to.wasted_ = wasted_; + + memory = NULL; + sz = cap = wasted_ = 0; + } + + +}; + +template +void RegionAllocator::capacity(uint32_t min_cap) +{ + if (cap >= min_cap) return; + + uint32_t prev_cap = cap; + while (cap < min_cap){ + // NOTE: Multiply by a factor (13/8) without causing overflow, then add 2 and make the + // result even by clearing the least significant bit. The resulting sequence of capacities + // is carefully chosen to hit a maximum capacity that is close to the '2^32-1' limit when + // using 'uint32_t' as indices so that as much as possible of this space can be used. + uint32_t delta = ((cap >> 1) + (cap >> 3) + 2) & ~1; + cap += delta; + + if (cap <= prev_cap) + throw OutOfMemoryException(); + } + //printf(" .. (%p) cap = %u\n", this, cap); + + assert(cap > 0); + memory = (T*)xrealloc(memory, sizeof(T)*cap); +} + + +template +typename RegionAllocator::Ref +RegionAllocator::alloc(int size) +{ + //printf("ALLOC called (this = %p, size = %d)\n", this, size); fflush(stdout); + assert(size > 0); + capacity(sz + size); + + uint32_t prev_sz = sz; + sz += size; + + // Handle overflow: + if (sz < prev_sz) + throw OutOfMemoryException(); + + return prev_sz; +} + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/mtl/Heap.h b/packages/bee/glucose-2.2/mtl/Heap.h new file mode 100755 index 000000000..e134b98f5 --- /dev/null +++ b/packages/bee/glucose-2.2/mtl/Heap.h @@ -0,0 +1,148 @@ +/******************************************************************************************[Heap.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Heap_h +#define Glucose_Heap_h + +#include "mtl/Vec.h" + +namespace Glucose { + +//================================================================================================= +// A heap implementation with support for decrease/increase key. + + +template +class Heap { + Comp lt; // The heap is a minimum-heap with respect to this comparator + vec heap; // Heap of integers + vec indices; // Each integers position (index) in the Heap + + // Index "traversal" functions + static inline int left (int i) { return i*2+1; } + static inline int right (int i) { return (i+1)*2; } + static inline int parent(int i) { return (i-1) >> 1; } + + + void percolateUp(int i) + { + int x = heap[i]; + int p = parent(i); + + while (i != 0 && lt(x, heap[p])){ + heap[i] = heap[p]; + indices[heap[p]] = i; + i = p; + p = parent(p); + } + heap [i] = x; + indices[x] = i; + } + + + void percolateDown(int i) + { + int x = heap[i]; + while (left(i) < heap.size()){ + int child = right(i) < heap.size() && lt(heap[right(i)], heap[left(i)]) ? right(i) : left(i); + if (!lt(heap[child], x)) break; + heap[i] = heap[child]; + indices[heap[i]] = i; + i = child; + } + heap [i] = x; + indices[x] = i; + } + + + public: + Heap(const Comp& c) : lt(c) { } + + int size () const { return heap.size(); } + bool empty () const { return heap.size() == 0; } + bool inHeap (int n) const { return n < indices.size() && indices[n] >= 0; } + int operator[](int index) const { assert(index < heap.size()); return heap[index]; } + + + void decrease (int n) { assert(inHeap(n)); percolateUp (indices[n]); } + void increase (int n) { assert(inHeap(n)); percolateDown(indices[n]); } + + + // Safe variant of insert/decrease/increase: + void update(int n) + { + if (!inHeap(n)) + insert(n); + else { + percolateUp(indices[n]); + percolateDown(indices[n]); } + } + + + void insert(int n) + { + indices.growTo(n+1, -1); + assert(!inHeap(n)); + + indices[n] = heap.size(); + heap.push(n); + percolateUp(indices[n]); + } + + + int removeMin() + { + int x = heap[0]; + heap[0] = heap.last(); + indices[heap[0]] = 0; + indices[x] = -1; + heap.pop(); + if (heap.size() > 1) percolateDown(0); + return x; + } + + + // Rebuild the heap from scratch, using the elements in 'ns': + void build(vec& ns) { + for (int i = 0; i < heap.size(); i++) + indices[heap[i]] = -1; + heap.clear(); + + for (int i = 0; i < ns.size(); i++){ + indices[ns[i]] = i; + heap.push(ns[i]); } + + for (int i = heap.size() / 2 - 1; i >= 0; i--) + percolateDown(i); + } + + void clear(bool dealloc = false) + { + for (int i = 0; i < heap.size(); i++) + indices[heap[i]] = -1; + heap.clear(dealloc); + } +}; + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/mtl/IntTypes.h b/packages/bee/glucose-2.2/mtl/IntTypes.h new file mode 100755 index 000000000..f97fbb767 --- /dev/null +++ b/packages/bee/glucose-2.2/mtl/IntTypes.h @@ -0,0 +1,82 @@ +/**************************************************************************************[IntTypes.h] +Copyright (c) 2009-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_IntTypes_h +#define Minisat_IntTypes_h + +//#ifdef __sun + // Not sure if there are newer versions that support C99 headers. The + // needed features are implemented in the headers below though: + +//# include +//# include +//# include + +#ifdef _MSC_VER + +#if _MSC_VER >= 1600 // [ +#include +#else // ] _MSC_VER >= 1600 [ + +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +#endif //] + +#else + +# include +# include + +#endif + +#include + +//================================================================================================= + +#endif diff --git a/packages/bee/glucose-2.2/mtl/Map.h b/packages/bee/glucose-2.2/mtl/Map.h new file mode 100755 index 000000000..b3ad1ca1d --- /dev/null +++ b/packages/bee/glucose-2.2/mtl/Map.h @@ -0,0 +1,193 @@ +/*******************************************************************************************[Map.h] +Copyright (c) 2006-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Map_h +#define Glucose_Map_h + +#include "mtl/IntTypes.h" +#include "mtl/Vec.h" + +namespace Glucose { + +//================================================================================================= +// Default hash/equals functions +// + + template struct Hash { uint32_t operator()(const K& k) const { return hash(k); } }; + template struct Equal { bool operator()(const K& k1, const K& k2) const { return k1 == k2; } }; + + template struct DeepHash { uint32_t operator()(const K* k) const { return hash(*k); } }; +template struct DeepEqual { bool operator()(const K* k1, const K* k2) const { return *k1 == *k2; } }; + +static inline uint32_t hash(uint32_t x){ return x; } +static inline uint32_t hash(uint64_t x){ return (uint32_t)x; } +static inline uint32_t hash(int32_t x) { return (uint32_t)x; } +static inline uint32_t hash(int64_t x) { return (uint32_t)x; } + + +//================================================================================================= +// Some primes +// + +static const int nprimes = 25; +static const int primes [nprimes] = { 31, 73, 151, 313, 643, 1291, 2593, 5233, 10501, 21013, 42073, 84181, 168451, 337219, 674701, 1349473, 2699299, 5398891, 10798093, 21596719, 43193641, 86387383, 172775299, 345550609, 691101253 }; + +//================================================================================================= +// Hash table implementation of Maps +// + +template, class E = Equal > +class Map { + public: + struct Pair { K key; D data; }; + + private: + H hash; + E equals; + + vec* table; + int cap; + int size; + + // Don't allow copying (error prone): + Map& operator = (Map& other) { assert(0); } + Map (Map& other) { assert(0); } + + bool checkCap(int new_size) const { return new_size > cap; } + + int32_t index (const K& k) const { return hash(k) % cap; } + void _insert (const K& k, const D& d) { + vec& ps = table[index(k)]; + ps.push(); ps.last().key = k; ps.last().data = d; } + + void rehash () { + const vec* old = table; + + int old_cap = cap; + int newsize = primes[0]; + for (int i = 1; newsize <= cap && i < nprimes; i++) + newsize = primes[i]; + + table = new vec[newsize]; + cap = newsize; + + for (int i = 0; i < old_cap; i++){ + for (int j = 0; j < old[i].size(); j++){ + _insert(old[i][j].key, old[i][j].data); }} + + delete [] old; + + // printf(" --- rehashing, old-cap=%d, new-cap=%d\n", cap, newsize); + } + + + public: + + Map () : table(NULL), cap(0), size(0) {} + Map (const H& h, const E& e) : hash(h), equals(e), table(NULL), cap(0), size(0){} + ~Map () { delete [] table; } + + // PRECONDITION: the key must already exist in the map. + const D& operator [] (const K& k) const + { + assert(size != 0); + const D* res = NULL; + const vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)) + res = &ps[i].data; + assert(res != NULL); + return *res; + } + + // PRECONDITION: the key must already exist in the map. + D& operator [] (const K& k) + { + assert(size != 0); + D* res = NULL; + vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)) + res = &ps[i].data; + assert(res != NULL); + return *res; + } + + // PRECONDITION: the key must *NOT* exist in the map. + void insert (const K& k, const D& d) { if (checkCap(size+1)) rehash(); _insert(k, d); size++; } + bool peek (const K& k, D& d) const { + if (size == 0) return false; + const vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)){ + d = ps[i].data; + return true; } + return false; + } + + bool has (const K& k) const { + if (size == 0) return false; + const vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)) + return true; + return false; + } + + // PRECONDITION: the key must exist in the map. + void remove(const K& k) { + assert(table != NULL); + vec& ps = table[index(k)]; + int j = 0; + for (; j < ps.size() && !equals(ps[j].key, k); j++); + assert(j < ps.size()); + ps[j] = ps.last(); + ps.pop(); + size--; + } + + void clear () { + cap = size = 0; + delete [] table; + table = NULL; + } + + int elems() const { return size; } + int bucket_count() const { return cap; } + + // NOTE: the hash and equality objects are not moved by this method: + void moveTo(Map& other){ + delete [] other.table; + + other.table = table; + other.cap = cap; + other.size = size; + + table = NULL; + size = cap = 0; + } + + // NOTE: given a bit more time, I could make a more C++-style iterator out of this: + const vec& bucket(int i) const { return table[i]; } +}; + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/mtl/Queue.h b/packages/bee/glucose-2.2/mtl/Queue.h new file mode 100755 index 000000000..6bb1d5646 --- /dev/null +++ b/packages/bee/glucose-2.2/mtl/Queue.h @@ -0,0 +1,69 @@ +/*****************************************************************************************[Queue.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Queue_h +#define Glucose_Queue_h + +#include "mtl/Vec.h" + +namespace Glucose { + +//================================================================================================= + +template +class Queue { + vec buf; + int first; + int end; + +public: + typedef T Key; + + Queue() : buf(1), first(0), end(0) {} + + void clear (bool dealloc = false) { buf.clear(dealloc); buf.growTo(1); first = end = 0; } + int size () const { return (end >= first) ? end - first : end - first + buf.size(); } + + const T& operator [] (int index) const { assert(index >= 0); assert(index < size()); return buf[(first + index) % buf.size()]; } + T& operator [] (int index) { assert(index >= 0); assert(index < size()); return buf[(first + index) % buf.size()]; } + + T peek () const { assert(first != end); return buf[first]; } + void pop () { assert(first != end); first++; if (first == buf.size()) first = 0; } + void insert(T elem) { // INVARIANT: buf[end] is always unused + buf[end++] = elem; + if (end == buf.size()) end = 0; + if (first == end){ // Resize: + vec tmp((buf.size()*3 + 1) >> 1); + //**/printf("queue alloc: %d elems (%.1f MB)\n", tmp.size(), tmp.size() * sizeof(T) / 1000000.0); + int i = 0; + for (int j = first; j < buf.size(); j++) tmp[i++] = buf[j]; + for (int j = 0 ; j < end ; j++) tmp[i++] = buf[j]; + first = 0; + end = buf.size(); + tmp.moveTo(buf); + } + } +}; + + +//================================================================================================= +} + +#endif diff --git a/packages/swi-minisat2/C/Sort.h b/packages/bee/glucose-2.2/mtl/Sort.h old mode 100644 new mode 100755 similarity index 94% rename from packages/swi-minisat2/C/Sort.h rename to packages/bee/glucose-2.2/mtl/Sort.h index 1f301f5c2..50cb44844 --- a/packages/swi-minisat2/C/Sort.h +++ b/packages/bee/glucose-2.2/mtl/Sort.h @@ -1,5 +1,6 @@ /******************************************************************************************[Sort.h] -MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2003-2007, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, @@ -17,15 +18,17 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************************************/ -#ifndef Sort_h -#define Sort_h +#ifndef Glucose_Sort_h +#define Glucose_Sort_h -#include "Vec.h" +#include "mtl/Vec.h" //================================================================================================= // Some sorting algorithms for vec's +namespace Glucose { + template struct LessThan_default { bool operator () (T x, T y) { return x < y; } @@ -90,4 +93,6 @@ template void sort(vec& v) { //================================================================================================= +} + #endif diff --git a/packages/bee/glucose-2.2/mtl/Vec.h b/packages/bee/glucose-2.2/mtl/Vec.h new file mode 100755 index 000000000..cef53e3c1 --- /dev/null +++ b/packages/bee/glucose-2.2/mtl/Vec.h @@ -0,0 +1,132 @@ +/*******************************************************************************************[Vec.h] +Copyright (c) 2003-2007, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Vec_h +#define Glucose_Vec_h + +#include +#include + +#include "mtl/IntTypes.h" +#include "mtl/XAlloc.h" + +using namespace std; + +namespace Glucose { + +//================================================================================================= +// Automatically resizable arrays +// +// NOTE! Don't use this vector on datatypes that cannot be re-located in memory (with realloc) + +template +class vec { + T* data; + int sz; + int cap; + + // Don't allow copying (error prone): + vec& operator = (vec& other) { assert(0); return *this; } + vec (vec& other) { assert(0); } + + // Helpers for calculating next capacity: + static inline int imax (int x, int y) { int mask = (y-x) >> (sizeof(int)*8-1); return (x&mask) + (y&(~mask)); } + //static inline void nextCap(int& cap){ cap += ((cap >> 1) + 2) & ~1; } + static inline void nextCap(int& cap){ cap += ((cap >> 1) + 2) & ~1; } + +public: + // Constructors: + vec() : data(NULL) , sz(0) , cap(0) { } + explicit vec(int size) : data(NULL) , sz(0) , cap(0) { growTo(size); } + vec(int size, const T& pad) : data(NULL) , sz(0) , cap(0) { growTo(size, pad); } + ~vec() { clear(true); } + + // Pointer to first element: + operator T* (void) { return data; } + + // Size operations: + int size (void) const { return sz; } + void shrink (int nelems) { assert(nelems <= sz); for (int i = 0; i < nelems; i++) sz--, data[sz].~T(); } + void shrink_ (int nelems) { assert(nelems <= sz); sz -= nelems; } + int capacity (void) const { return cap; } + void capacity (int min_cap); + void growTo (int size); + void growTo (int size, const T& pad); + void clear (bool dealloc = false); + + // Stack interface: + void push (void) { if (sz == cap) capacity(sz+1); new (&data[sz]) T(); sz++; } + void push (const T& elem) { if (sz == cap) capacity(sz+1); data[sz++] = elem; } + void push_ (const T& elem) { assert(sz < cap); data[sz++] = elem; } + void pop (void) { assert(sz > 0); sz--, data[sz].~T(); } + // NOTE: it seems possible that overflow can happen in the 'sz+1' expression of 'push()', but + // in fact it can not since it requires that 'cap' is equal to INT_MAX. This in turn can not + // happen given the way capacities are calculated (below). Essentially, all capacities are + // even, but INT_MAX is odd. + + const T& last (void) const { return data[sz-1]; } + T& last (void) { return data[sz-1]; } + + // Vector interface: + const T& operator [] (int index) const { return data[index]; } + T& operator [] (int index) { return data[index]; } + + // Duplicatation (preferred instead): + void copyTo(vec& copy) const { copy.clear(); copy.growTo(sz); for (int i = 0; i < sz; i++) copy[i] = data[i]; } + void moveTo(vec& dest) { dest.clear(true); dest.data = data; dest.sz = sz; dest.cap = cap; data = NULL; sz = 0; cap = 0; } +}; + + +template +void vec::capacity(int min_cap) { + if (cap >= min_cap) return; + int add = imax((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2 + if (add > INT_MAX - cap || ((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL && errno == ENOMEM)) + throw OutOfMemoryException(); + } + + +template +void vec::growTo(int size, const T& pad) { + if (sz >= size) return; + capacity(size); + for (int i = sz; i < size; i++) data[i] = pad; + sz = size; } + + +template +void vec::growTo(int size) { + if (sz >= size) return; + capacity(size); + for (int i = sz; i < size; i++) new (&data[i]) T(); + sz = size; } + + +template +void vec::clear(bool dealloc) { + if (data != NULL){ + for (int i = 0; i < sz; i++) data[i].~T(); + sz = 0; + if (dealloc) free(data), data = NULL, cap = 0; } } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/mtl/XAlloc.h b/packages/bee/glucose-2.2/mtl/XAlloc.h new file mode 100755 index 000000000..f8ca4fec4 --- /dev/null +++ b/packages/bee/glucose-2.2/mtl/XAlloc.h @@ -0,0 +1,47 @@ +/****************************************************************************************[XAlloc.h] +Copyright (c) 2009-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef Glucose_XAlloc_h +#define Glucose_XAlloc_h + +#include +#include +#include + +namespace Glucose { + +//================================================================================================= +// Simple layer on top of malloc/realloc to catch out-of-memory situtaions and provide some typing: + +class OutOfMemoryException{}; +static inline void* xrealloc(void *ptr, size_t size) +{ + void* mem = realloc(ptr, size); + if (mem == NULL && errno == ENOMEM){ + throw OutOfMemoryException(); + }else { + return mem; + } +} + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/simp/Main.cc b/packages/bee/glucose-2.2/simp/Main.cc new file mode 100755 index 000000000..85be23a0a --- /dev/null +++ b/packages/bee/glucose-2.2/simp/Main.cc @@ -0,0 +1,234 @@ +/*****************************************************************************************[Main.cc] + Glucose -- Copyright (c) 2009, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose are exactly the same as Minisat on which it is based on. (see below). + +--------------- + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include + +#include +#include +#include + +#include "utils/System.h" +#include "utils/ParseUtils.h" +#include "utils/Options.h" +#include "core/Dimacs.h" +#include "simp/SimpSolver.h" + +using namespace Glucose; + +//================================================================================================= + + +void printStats(Solver& solver) +{ + double cpu_time = cpuTime(); + double mem_used = 0;//memUsedPeak(); + printf("c restarts : %"PRIu64" (%"PRIu64" conflicts in avg)\n", solver.starts,(solver.starts>0 ?solver.conflicts/solver.starts : 0)); + printf("c blocked restarts : %"PRIu64" (multiple: %"PRIu64") \n", solver.nbstopsrestarts,solver.nbstopsrestartssame); + printf("c last block at restart : %"PRIu64"\n",solver.lastblockatrestart); + printf("c nb ReduceDB : %lld\n", solver.nbReduceDB); + printf("c nb removed Clauses : %lld\n",solver.nbRemovedClauses); + printf("c nb learnts DL2 : %lld\n", solver.nbDL2); + printf("c nb learnts size 2 : %lld\n", solver.nbBin); + printf("c nb learnts size 1 : %lld\n", solver.nbUn); + + printf("c conflicts : %-12"PRIu64" (%.0f /sec)\n", solver.conflicts , solver.conflicts /cpu_time); + printf("c decisions : %-12"PRIu64" (%4.2f %% random) (%.0f /sec)\n", solver.decisions, (float)solver.rnd_decisions*100 / (float)solver.decisions, solver.decisions /cpu_time); + printf("c propagations : %-12"PRIu64" (%.0f /sec)\n", solver.propagations, solver.propagations/cpu_time); + printf("c conflict literals : %-12"PRIu64" (%4.2f %% deleted)\n", solver.tot_literals, (solver.max_literals - solver.tot_literals)*100 / (double)solver.max_literals); + printf("c nb reduced Clauses : %lld\n",solver.nbReducedClauses); + + if (mem_used != 0) printf("Memory used : %.2f MB\n", mem_used); + printf("c CPU time : %g s\n", cpu_time); +} + + + +static Solver* solver; +// Terminate by notifying the solver and back out gracefully. This is mainly to have a test-case +// for this feature of the Solver as it may take longer than an immediate call to '_exit()'. +static void SIGINT_interrupt(int signum) { solver->interrupt(); } + +// Note that '_exit()' rather than 'exit()' has to be used. The reason is that 'exit()' calls +// destructors and may cause deadlocks if a malloc/free function happens to be running (these +// functions are guarded by locks for multithreaded use). +static void SIGINT_exit(int signum) { + printf("\n"); printf("*** INTERRUPTED ***\n"); + if (solver->verbosity > 0){ + printStats(*solver); + printf("\n"); printf("*** INTERRUPTED ***\n"); } + _exit(1); } + + +//================================================================================================= +// Main: + +int main(int argc, char** argv) +{ + try { + printf("c\nc This is glucose 2.1 -- based on MiniSAT (Many thanks to MiniSAT team)\nc Simplification mode is turned on\nc\n"); + setUsageHelp("c USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); + + +#if defined(__linux__) + fpu_control_t oldcw, newcw; + _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); + printf("WARNING: for repeatability, setting FPU to use double precision\n"); +#endif + // Extra options: + // + IntOption verb ("MAIN", "verb", "Verbosity level (0=silent, 1=some, 2=more).", 1, IntRange(0, 2)); + IntOption vv ("MAIN", "vv", "Verbosity every vv conflicts", 10000, IntRange(1,INT32_MAX)); + BoolOption pre ("MAIN", "pre", "Completely turn on/off any preprocessing.", true); + StringOption dimacs ("MAIN", "dimacs", "If given, stop after preprocessing and write the result to this file."); + IntOption cpu_lim("MAIN", "cpu-lim","Limit on CPU time allowed in seconds.\n", INT32_MAX, IntRange(0, INT32_MAX)); + IntOption mem_lim("MAIN", "mem-lim","Limit on memory usage in megabytes.\n", INT32_MAX, IntRange(0, INT32_MAX)); + + parseOptions(argc, argv, true); + + SimpSolver S; + double initial_time = cpuTime(); + + if (!pre) S.eliminate(true); + + S.verbosity = verb; + S.verbEveryConflicts = vv; + solver = &S; + // Use signal handlers that forcibly quit until the solver will be able to respond to + // interrupts: + signal(SIGINT, SIGINT_exit); + signal(SIGXCPU,SIGINT_exit); + + // Set limit on CPU-time: + if (cpu_lim != INT32_MAX){ + rlimit rl; + getrlimit(RLIMIT_CPU, &rl); + if (rl.rlim_max == RLIM_INFINITY || (rlim_t)cpu_lim < rl.rlim_max){ + rl.rlim_cur = cpu_lim; + if (setrlimit(RLIMIT_CPU, &rl) == -1) + printf("WARNING! Could not set resource limit: CPU-time.\n"); + } } + + // Set limit on virtual memory: + if (mem_lim != INT32_MAX){ + rlim_t new_mem_lim = (rlim_t)mem_lim * 1024*1024; + rlimit rl; + getrlimit(RLIMIT_AS, &rl); + if (rl.rlim_max == RLIM_INFINITY || new_mem_lim < rl.rlim_max){ + rl.rlim_cur = new_mem_lim; + if (setrlimit(RLIMIT_AS, &rl) == -1) + printf("WARNING! Could not set resource limit: Virtual memory.\n"); + } } + + if (argc == 1) + printf("Reading from standard input... Use '--help' for help.\n"); + + gzFile in = (argc == 1) ? gzdopen(0, "rb") : gzopen(argv[1], "rb"); + if (in == NULL) + printf("ERROR! Could not open file: %s\n", argc == 1 ? "" : argv[1]), exit(1); + + if (S.verbosity > 0){ + printf("c ========================================[ Problem Statistics ]===========================================\n"); + printf("c | |\n"); } + + parse_DIMACS(in, S); + gzclose(in); + FILE* res = (argc >= 3) ? fopen(argv[2], "wb") : NULL; + + if (S.verbosity > 0){ + printf("c | Number of variables: %12d |\n", S.nVars()); + printf("c | Number of clauses: %12d |\n", S.nClauses()); } + + double parsed_time = cpuTime(); + if (S.verbosity > 0){ + printf("c | Parse time: %12.2f s |\n", parsed_time - initial_time); + printf("c | |\n"); } + + // Change to signal-handlers that will only notify the solver and allow it to terminate + // voluntarily: + signal(SIGINT, SIGINT_interrupt); + signal(SIGXCPU,SIGINT_interrupt); + + S.eliminate(true); + double simplified_time = cpuTime(); + if (S.verbosity > 0){ + printf("c | Simplification time: %12.2f s |\n", simplified_time - parsed_time); + printf("c | |\n"); } + + if (!S.okay()){ + if (res != NULL) fprintf(res, "UNSAT\n"), fclose(res); + if (S.verbosity > 0){ + printf("c =========================================================================================================\n"); + printf("Solved by simplification\n"); + printStats(S); + printf("\n"); } + printf("UNSATISFIABLE\n"); + exit(20); + } + + if (dimacs){ + if (S.verbosity > 0) + printf("c =======================================[ Writing DIMACS ]===============================================\n"); + S.toDimacs((const char*)dimacs); + if (S.verbosity > 0) + printStats(S); + exit(0); + } + + vec dummy; + lbool ret = S.solveLimited(dummy); + + if (S.verbosity > 0){ + printStats(S); + printf("\n"); } + printf(ret == l_True ? "s SATISFIABLE\n" : ret == l_False ? "s UNSATISFIABLE\n" : "s INDETERMINATE\n"); + if (res != NULL){ + if (ret == l_True){ + fprintf(res, "SAT\n"); + for (int i = 0; i < S.nVars(); i++) + if (S.model[i] != l_Undef) + fprintf(res, "%s%s%d", (i==0)?"":" ", (S.model[i]==l_True)?"":"-", i+1); + fprintf(res, " 0\n"); + }else if (ret == l_False) + fprintf(res, "UNSAT\n"); + else + fprintf(res, "INDET\n"); + fclose(res); + } + +#ifdef NDEBUG + exit(ret == l_True ? 10 : ret == l_False ? 20 : 0); // (faster than "return", which will invoke the destructor for 'Solver') +#else + return (ret == l_True ? 10 : ret == l_False ? 20 : 0); +#endif + } catch (OutOfMemoryException&){ + printf("c =========================================================================================================\n"); + printf("INDETERMINATE\n"); + exit(0); + } +} diff --git a/packages/bee/glucose-2.2/simp/SimpSolver.cc b/packages/bee/glucose-2.2/simp/SimpSolver.cc new file mode 100755 index 000000000..d90969d47 --- /dev/null +++ b/packages/bee/glucose-2.2/simp/SimpSolver.cc @@ -0,0 +1,717 @@ +/***********************************************************************************[SimpSolver.cc] +Copyright (c) 2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include "mtl/Sort.h" +#include "simp/SimpSolver.h" +#include "utils/System.h" + +using namespace Glucose; + +//================================================================================================= +// Options: + + +static const char* _cat = "SIMP"; + +static BoolOption opt_use_asymm (_cat, "asymm", "Shrink clauses by asymmetric branching.", false); +static BoolOption opt_use_rcheck (_cat, "rcheck", "Check if a clause is already implied. (costly)", false); +static BoolOption opt_use_elim (_cat, "elim", "Perform variable elimination.", true); +static IntOption opt_grow (_cat, "grow", "Allow a variable elimination step to grow by a number of clauses.", 0); +static IntOption opt_clause_lim (_cat, "cl-lim", "Variables are not eliminated if it produces a resolvent with a length above this limit. -1 means no limit", 20, IntRange(-1, INT32_MAX)); +static IntOption opt_subsumption_lim (_cat, "sub-lim", "Do not check if subsumption against a clause larger than this. -1 means no limit.", 1000, IntRange(-1, INT32_MAX)); +static DoubleOption opt_simp_garbage_frac(_cat, "simp-gc-frac", "The fraction of wasted memory allowed before a garbage collection is triggered during simplification.", 0.5, DoubleRange(0, false, HUGE_VAL, false)); + + +//================================================================================================= +// Constructor/Destructor: + + +SimpSolver::SimpSolver() : + grow (opt_grow) + , clause_lim (opt_clause_lim) + , subsumption_lim (opt_subsumption_lim) + , simp_garbage_frac (opt_simp_garbage_frac) + , use_asymm (opt_use_asymm) + , use_rcheck (opt_use_rcheck) + , use_elim (opt_use_elim) + , merges (0) + , asymm_lits (0) + , eliminated_vars (0) + , elimorder (1) + , use_simplification (true) + , occurs (ClauseDeleted(ca)) + , elim_heap (ElimLt(n_occ)) + , bwdsub_assigns (0) + , n_touched (0) +{ + vec dummy(1,lit_Undef); + ca.extra_clause_field = true; // NOTE: must happen before allocating the dummy clause below. + bwdsub_tmpunit = ca.alloc(dummy); + remove_satisfied = false; +} + + +SimpSolver::~SimpSolver() +{ +} + + +Var SimpSolver::newVar(bool sign, bool dvar) { + Var v = Solver::newVar(sign, dvar); + + frozen .push((char)false); + eliminated.push((char)false); + + if (use_simplification){ + n_occ .push(0); + n_occ .push(0); + occurs .init(v); + touched .push(0); + elim_heap .insert(v); + } + return v; } + + + +lbool SimpSolver::solve_(bool do_simp, bool turn_off_simp) +{ + vec extra_frozen; + lbool result = l_True; + + do_simp &= use_simplification; + + if (do_simp){ + // Assumptions must be temporarily frozen to run variable elimination: + for (int i = 0; i < assumptions.size(); i++){ + Var v = var(assumptions[i]); + + // If an assumption has been eliminated, remember it. + assert(!isEliminated(v)); + + if (!frozen[v]){ + // Freeze and store. + setFrozen(v, true); + extra_frozen.push(v); + } } + + result = lbool(eliminate(turn_off_simp)); + } + + if (result == l_True) + result = Solver::solve_(); + else if (verbosity >= 1) + printf("===============================================================================\n"); + + if (result == l_True) + extendModel(); + + if (do_simp) + // Unfreeze the assumptions that were frozen: + for (int i = 0; i < extra_frozen.size(); i++) + setFrozen(extra_frozen[i], false); + + return result; +} + + + +bool SimpSolver::addClause_(vec& ps) +{ +#ifndef NDEBUG + for (int i = 0; i < ps.size(); i++) + assert(!isEliminated(var(ps[i]))); +#endif + + int nclauses = clauses.size(); + + if (use_rcheck && implied(ps)) + return true; + + if (!Solver::addClause_(ps)) + return false; + + if (use_simplification && clauses.size() == nclauses + 1){ + CRef cr = clauses.last(); + const Clause& c = ca[cr]; + + // NOTE: the clause is added to the queue immediately and then + // again during 'gatherTouchedClauses()'. If nothing happens + // in between, it will only be checked once. Otherwise, it may + // be checked twice unnecessarily. This is an unfortunate + // consequence of how backward subsumption is used to mimic + // forward subsumption. + subsumption_queue.insert(cr); + for (int i = 0; i < c.size(); i++){ + occurs[var(c[i])].push(cr); + n_occ[toInt(c[i])]++; + touched[var(c[i])] = 1; + n_touched++; + if (elim_heap.inHeap(var(c[i]))) + elim_heap.increase(var(c[i])); + } + } + + return true; +} + + +void SimpSolver::removeClause(CRef cr) +{ + const Clause& c = ca[cr]; + + if (use_simplification) + for (int i = 0; i < c.size(); i++){ + n_occ[toInt(c[i])]--; + updateElimHeap(var(c[i])); + occurs.smudge(var(c[i])); + } + + Solver::removeClause(cr); +} + + +bool SimpSolver::strengthenClause(CRef cr, Lit l) +{ + Clause& c = ca[cr]; + assert(decisionLevel() == 0); + assert(use_simplification); + + // FIX: this is too inefficient but would be nice to have (properly implemented) + // if (!find(subsumption_queue, &c)) + subsumption_queue.insert(cr); + + if (c.size() == 2){ + removeClause(cr); + c.strengthen(l); + }else{ + detachClause(cr, true); + c.strengthen(l); + attachClause(cr); + remove(occurs[var(l)], cr); + n_occ[toInt(l)]--; + updateElimHeap(var(l)); + } + + return c.size() == 1 ? enqueue(c[0]) && propagate() == CRef_Undef : true; +} + + +// Returns FALSE if clause is always satisfied ('out_clause' should not be used). +bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, vec& out_clause) +{ + merges++; + out_clause.clear(); + + bool ps_smallest = _ps.size() < _qs.size(); + const Clause& ps = ps_smallest ? _qs : _ps; + const Clause& qs = ps_smallest ? _ps : _qs; + + for (int i = 0; i < qs.size(); i++){ + if (var(qs[i]) != v){ + for (int j = 0; j < ps.size(); j++) + if (var(ps[j]) == var(qs[i])) + if (ps[j] == ~qs[i]) + return false; + else + goto next; + out_clause.push(qs[i]); + } + next:; + } + + for (int i = 0; i < ps.size(); i++) + if (var(ps[i]) != v) + out_clause.push(ps[i]); + + return true; +} + + +// Returns FALSE if clause is always satisfied. +bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, int& size) +{ + merges++; + + bool ps_smallest = _ps.size() < _qs.size(); + const Clause& ps = ps_smallest ? _qs : _ps; + const Clause& qs = ps_smallest ? _ps : _qs; + const Lit* __ps = (const Lit*)ps; + const Lit* __qs = (const Lit*)qs; + + size = ps.size()-1; + + for (int i = 0; i < qs.size(); i++){ + if (var(__qs[i]) != v){ + for (int j = 0; j < ps.size(); j++) + if (var(__ps[j]) == var(__qs[i])) + if (__ps[j] == ~__qs[i]) + return false; + else + goto next; + size++; + } + next:; + } + + return true; +} + + +void SimpSolver::gatherTouchedClauses() +{ + if (n_touched == 0) return; + + int i,j; + for (i = j = 0; i < subsumption_queue.size(); i++) + if (ca[subsumption_queue[i]].mark() == 0) + ca[subsumption_queue[i]].mark(2); + + for (i = 0; i < touched.size(); i++) + if (touched[i]){ + const vec& cs = occurs.lookup(i); + for (j = 0; j < cs.size(); j++) + if (ca[cs[j]].mark() == 0){ + subsumption_queue.insert(cs[j]); + ca[cs[j]].mark(2); + } + touched[i] = 0; + } + + for (i = 0; i < subsumption_queue.size(); i++) + if (ca[subsumption_queue[i]].mark() == 2) + ca[subsumption_queue[i]].mark(0); + + n_touched = 0; +} + + +bool SimpSolver::implied(const vec& c) +{ + assert(decisionLevel() == 0); + + trail_lim.push(trail.size()); + for (int i = 0; i < c.size(); i++) + if (value(c[i]) == l_True){ + cancelUntil(0); + return false; + }else if (value(c[i]) != l_False){ + assert(value(c[i]) == l_Undef); + uncheckedEnqueue(~c[i]); + } + + bool result = propagate() != CRef_Undef; + cancelUntil(0); + return result; +} + + +// Backward subsumption + backward subsumption resolution +bool SimpSolver::backwardSubsumptionCheck(bool verbose) +{ + int cnt = 0; + int subsumed = 0; + int deleted_literals = 0; + assert(decisionLevel() == 0); + + while (subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()){ + + // Empty subsumption queue and return immediately on user-interrupt: + if (asynch_interrupt){ + subsumption_queue.clear(); + bwdsub_assigns = trail.size(); + break; } + + // Check top-level assignments by creating a dummy clause and placing it in the queue: + if (subsumption_queue.size() == 0 && bwdsub_assigns < trail.size()){ + Lit l = trail[bwdsub_assigns++]; + ca[bwdsub_tmpunit][0] = l; + ca[bwdsub_tmpunit].calcAbstraction(); + subsumption_queue.insert(bwdsub_tmpunit); } + + CRef cr = subsumption_queue.peek(); subsumption_queue.pop(); + Clause& c = ca[cr]; + + if (c.mark()) continue; + + if (verbose && verbosity >= 2 && cnt++ % 1000 == 0) + printf("subsumption left: %10d (%10d subsumed, %10d deleted literals)\r", subsumption_queue.size(), subsumed, deleted_literals); + + assert(c.size() > 1 || value(c[0]) == l_True); // Unit-clauses should have been propagated before this point. + + // Find best variable to scan: + Var best = var(c[0]); + for (int i = 1; i < c.size(); i++) + if (occurs[var(c[i])].size() < occurs[best].size()) + best = var(c[i]); + + // Search all candidates: + vec& _cs = occurs.lookup(best); + CRef* cs = (CRef*)_cs; + + for (int j = 0; j < _cs.size(); j++) + if (c.mark()) + break; + else if (!ca[cs[j]].mark() && cs[j] != cr && (subsumption_lim == -1 || ca[cs[j]].size() < subsumption_lim)){ + Lit l = c.subsumes(ca[cs[j]]); + + if (l == lit_Undef) + subsumed++, removeClause(cs[j]); + else if (l != lit_Error){ + deleted_literals++; + + if (!strengthenClause(cs[j], ~l)) + return false; + + // Did current candidate get deleted from cs? Then check candidate at index j again: + if (var(l) == best) + j--; + } + } + } + + return true; +} + + +bool SimpSolver::asymm(Var v, CRef cr) +{ + Clause& c = ca[cr]; + assert(decisionLevel() == 0); + + if (c.mark() || satisfied(c)) return true; + + trail_lim.push(trail.size()); + Lit l = lit_Undef; + for (int i = 0; i < c.size(); i++) + if (var(c[i]) != v && value(c[i]) != l_False) + uncheckedEnqueue(~c[i]); + else + l = c[i]; + + if (propagate() != CRef_Undef){ + cancelUntil(0); + asymm_lits++; + if (!strengthenClause(cr, l)) + return false; + }else + cancelUntil(0); + + return true; +} + + +bool SimpSolver::asymmVar(Var v) +{ + assert(use_simplification); + + const vec& cls = occurs.lookup(v); + + if (value(v) != l_Undef || cls.size() == 0) + return true; + + for (int i = 0; i < cls.size(); i++) + if (!asymm(v, cls[i])) + return false; + + return backwardSubsumptionCheck(); +} + + +static void mkElimClause(vec& elimclauses, Lit x) +{ + elimclauses.push(toInt(x)); + elimclauses.push(1); +} + + +static void mkElimClause(vec& elimclauses, Var v, Clause& c) +{ + int first = elimclauses.size(); + int v_pos = -1; + + // Copy clause to elimclauses-vector. Remember position where the + // variable 'v' occurs: + for (int i = 0; i < c.size(); i++){ + elimclauses.push(toInt(c[i])); + if (var(c[i]) == v) + v_pos = i + first; + } + assert(v_pos != -1); + + // Swap the first literal with the 'v' literal, so that the literal + // containing 'v' will occur first in the clause: + uint32_t tmp = elimclauses[v_pos]; + elimclauses[v_pos] = elimclauses[first]; + elimclauses[first] = tmp; + + // Store the length of the clause last: + elimclauses.push(c.size()); +} + + + +bool SimpSolver::eliminateVar(Var v) +{ + assert(!frozen[v]); + assert(!isEliminated(v)); + assert(value(v) == l_Undef); + + // Split the occurrences into positive and negative: + // + const vec& cls = occurs.lookup(v); + vec pos, neg; + for (int i = 0; i < cls.size(); i++) + (find(ca[cls[i]], mkLit(v)) ? pos : neg).push(cls[i]); + + // Check wether the increase in number of clauses stays within the allowed ('grow'). Moreover, no + // clause must exceed the limit on the maximal clause size (if it is set): + // + int cnt = 0; + int clause_size = 0; + + for (int i = 0; i < pos.size(); i++) + for (int j = 0; j < neg.size(); j++) + if (merge(ca[pos[i]], ca[neg[j]], v, clause_size) && + (++cnt > cls.size() + grow || (clause_lim != -1 && clause_size > clause_lim))) + return true; + + // Delete and store old clauses: + eliminated[v] = true; + setDecisionVar(v, false); + eliminated_vars++; + + if (pos.size() > neg.size()){ + for (int i = 0; i < neg.size(); i++) + mkElimClause(elimclauses, v, ca[neg[i]]); + mkElimClause(elimclauses, mkLit(v)); + }else{ + for (int i = 0; i < pos.size(); i++) + mkElimClause(elimclauses, v, ca[pos[i]]); + mkElimClause(elimclauses, ~mkLit(v)); + } + + for (int i = 0; i < cls.size(); i++) + removeClause(cls[i]); + + // Produce clauses in cross product: + vec& resolvent = add_tmp; + for (int i = 0; i < pos.size(); i++) + for (int j = 0; j < neg.size(); j++) + if (merge(ca[pos[i]], ca[neg[j]], v, resolvent) && !addClause_(resolvent)) + return false; + + // Free occurs list for this variable: + occurs[v].clear(true); + + // Free watchers lists for this variable, if possible: + if (watches[ mkLit(v)].size() == 0) watches[ mkLit(v)].clear(true); + if (watches[~mkLit(v)].size() == 0) watches[~mkLit(v)].clear(true); + + return backwardSubsumptionCheck(); +} + + +bool SimpSolver::substitute(Var v, Lit x) +{ + assert(!frozen[v]); + assert(!isEliminated(v)); + assert(value(v) == l_Undef); + + if (!ok) return false; + + eliminated[v] = true; + setDecisionVar(v, false); + const vec& cls = occurs.lookup(v); + + vec& subst_clause = add_tmp; + for (int i = 0; i < cls.size(); i++){ + Clause& c = ca[cls[i]]; + + subst_clause.clear(); + for (int j = 0; j < c.size(); j++){ + Lit p = c[j]; + subst_clause.push(var(p) == v ? x ^ sign(p) : p); + } + + removeClause(cls[i]); + + if (!addClause_(subst_clause)) + return ok = false; + } + + return true; +} + + +void SimpSolver::extendModel() +{ + int i, j; + Lit x; + + for (i = elimclauses.size()-1; i > 0; i -= j){ + for (j = elimclauses[i--]; j > 1; j--, i--) + if (modelValue(toLit(elimclauses[i])) != l_False) + goto next; + + x = toLit(elimclauses[i]); + model[var(x)] = lbool(!sign(x)); + next:; + } +} + + +bool SimpSolver::eliminate(bool turn_off_elim) +{ + if (!simplify()) + return false; + else if (!use_simplification) + return true; + + // Main simplification loop: + // + while (n_touched > 0 || bwdsub_assigns < trail.size() || elim_heap.size() > 0){ + + gatherTouchedClauses(); + // printf(" ## (time = %6.2f s) BWD-SUB: queue = %d, trail = %d\n", cpuTime(), subsumption_queue.size(), trail.size() - bwdsub_assigns); + if ((subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()) && + !backwardSubsumptionCheck(true)){ + ok = false; goto cleanup; } + + // Empty elim_heap and return immediately on user-interrupt: + if (asynch_interrupt){ + assert(bwdsub_assigns == trail.size()); + assert(subsumption_queue.size() == 0); + assert(n_touched == 0); + elim_heap.clear(); + goto cleanup; } + + // printf(" ## (time = %6.2f s) ELIM: vars = %d\n", cpuTime(), elim_heap.size()); + for (int cnt = 0; !elim_heap.empty(); cnt++){ + Var elim = elim_heap.removeMin(); + + if (asynch_interrupt) break; + + if (isEliminated(elim) || value(elim) != l_Undef) continue; + + if (verbosity >= 2 && cnt % 100 == 0) + printf("elimination left: %10d\r", elim_heap.size()); + + if (use_asymm){ + // Temporarily freeze variable. Otherwise, it would immediately end up on the queue again: + bool was_frozen = frozen[elim]; + frozen[elim] = true; + if (!asymmVar(elim)){ + ok = false; goto cleanup; } + frozen[elim] = was_frozen; } + + // At this point, the variable may have been set by assymetric branching, so check it + // again. Also, don't eliminate frozen variables: + if (use_elim && value(elim) == l_Undef && !frozen[elim] && !eliminateVar(elim)){ + ok = false; goto cleanup; } + + checkGarbage(simp_garbage_frac); + } + + assert(subsumption_queue.size() == 0); + } + cleanup: + + // If no more simplification is needed, free all simplification-related data structures: + if (turn_off_elim){ + touched .clear(true); + occurs .clear(true); + n_occ .clear(true); + elim_heap.clear(true); + subsumption_queue.clear(true); + + use_simplification = false; + remove_satisfied = true; + ca.extra_clause_field = false; + + // Force full cleanup (this is safe and desirable since it only happens once): + rebuildOrderHeap(); + garbageCollect(); + }else{ + // Cheaper cleanup: + cleanUpClauses(); // TODO: can we make 'cleanUpClauses()' not be linear in the problem size somehow? + checkGarbage(); + } + + if (verbosity >= 1 && elimclauses.size() > 0) + printf("c | Eliminated clauses: %10.2f Mb |\n", + double(elimclauses.size() * sizeof(uint32_t)) / (1024*1024)); + + return ok; +} + + +void SimpSolver::cleanUpClauses() +{ + occurs.cleanAll(); + int i,j; + for (i = j = 0; i < clauses.size(); i++) + if (ca[clauses[i]].mark() == 0) + clauses[j++] = clauses[i]; + clauses.shrink(i - j); +} + + +//================================================================================================= +// Garbage Collection methods: + + +void SimpSolver::relocAll(ClauseAllocator& to) +{ + if (!use_simplification) return; + + // All occurs lists: + // + for (int i = 0; i < nVars(); i++){ + vec& cs = occurs[i]; + for (int j = 0; j < cs.size(); j++) + ca.reloc(cs[j], to); + } + + // Subsumption queue: + // + for (int i = 0; i < subsumption_queue.size(); i++) + ca.reloc(subsumption_queue[i], to); + + // Temporary clause: + // + ca.reloc(bwdsub_tmpunit, to); +} + + +void SimpSolver::garbageCollect() +{ + // Initialize the next region to a size corresponding to the estimated utilization degree. This + // is not precise but should avoid some unnecessary reallocations for the new region: + ClauseAllocator to(ca.size() - ca.wasted()); + + cleanUpClauses(); + to.extra_clause_field = ca.extra_clause_field; // NOTE: this is important to keep (or lose) the extra fields. + relocAll(to); + Solver::relocAll(to); + if (verbosity >= 2) + printf("| Garbage collection: %12d bytes => %12d bytes |\n", + ca.size()*ClauseAllocator::Unit_Size, to.size()*ClauseAllocator::Unit_Size); + to.moveTo(ca); +} diff --git a/packages/bee/glucose-2.2/simp/SimpSolver.h b/packages/bee/glucose-2.2/simp/SimpSolver.h new file mode 100755 index 000000000..7575596eb --- /dev/null +++ b/packages/bee/glucose-2.2/simp/SimpSolver.h @@ -0,0 +1,197 @@ +/************************************************************************************[SimpSolver.h] +Copyright (c) 2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_SimpSolver_h +#define Glucose_SimpSolver_h + +#include "mtl/Queue.h" +#include "core/Solver.h" + + +namespace Glucose { + +//================================================================================================= + + +class SimpSolver : public Solver { + public: + // Constructor/Destructor: + // + SimpSolver(); + ~SimpSolver(); + + // Problem specification: + // + Var newVar (bool polarity = true, bool dvar = true); + bool addClause (const vec& ps); + bool addEmptyClause(); // Add the empty clause to the solver. + bool addClause (Lit p); // Add a unit clause to the solver. + bool addClause (Lit p, Lit q); // Add a binary clause to the solver. + bool addClause (Lit p, Lit q, Lit r); // Add a ternary clause to the solver. + bool addClause_( vec& ps); + bool substitute(Var v, Lit x); // Replace all occurences of v with x (may cause a contradiction). + + // Variable mode: + // + void setFrozen (Var v, bool b); // If a variable is frozen it will not be eliminated. + bool isEliminated(Var v) const; + + // Solving: + // + bool solve (const vec& assumps, bool do_simp = true, bool turn_off_simp = false); + lbool solveLimited(const vec& assumps, bool do_simp = true, bool turn_off_simp = false); + bool solve ( bool do_simp = true, bool turn_off_simp = false); + bool solve (Lit p , bool do_simp = true, bool turn_off_simp = false); + bool solve (Lit p, Lit q, bool do_simp = true, bool turn_off_simp = false); + bool solve (Lit p, Lit q, Lit r, bool do_simp = true, bool turn_off_simp = false); + bool eliminate (bool turn_off_elim = false); // Perform variable elimination based simplification. + + // Memory managment: + // + virtual void garbageCollect(); + + + // Generate a (possibly simplified) DIMACS file: + // +#if 0 + void toDimacs (const char* file, const vec& assumps); + void toDimacs (const char* file); + void toDimacs (const char* file, Lit p); + void toDimacs (const char* file, Lit p, Lit q); + void toDimacs (const char* file, Lit p, Lit q, Lit r); +#endif + + // Mode of operation: + // + int grow; // Allow a variable elimination step to grow by a number of clauses (default to zero). + int clause_lim; // Variables are not eliminated if it produces a resolvent with a length above this limit. + // -1 means no limit. + int subsumption_lim; // Do not check if subsumption against a clause larger than this. -1 means no limit. + double simp_garbage_frac; // A different limit for when to issue a GC during simplification (Also see 'garbage_frac'). + + bool use_asymm; // Shrink clauses by asymmetric branching. + bool use_rcheck; // Check if a clause is already implied. Prett costly, and subsumes subsumptions :) + bool use_elim; // Perform variable elimination. + + // Statistics: + // + int merges; + int asymm_lits; + int eliminated_vars; + + protected: + + // Helper structures: + // + struct ElimLt { + const vec& n_occ; + explicit ElimLt(const vec& no) : n_occ(no) {} + + // TODO: are 64-bit operations here noticably bad on 32-bit platforms? Could use a saturating + // 32-bit implementation instead then, but this will have to do for now. + uint64_t cost (Var x) const { return (uint64_t)n_occ[toInt(mkLit(x))] * (uint64_t)n_occ[toInt(~mkLit(x))]; } + bool operator()(Var x, Var y) const { return cost(x) < cost(y); } + + // TODO: investigate this order alternative more. + // bool operator()(Var x, Var y) const { + // int c_x = cost(x); + // int c_y = cost(y); + // return c_x < c_y || c_x == c_y && x < y; } + }; + + struct ClauseDeleted { + const ClauseAllocator& ca; + explicit ClauseDeleted(const ClauseAllocator& _ca) : ca(_ca) {} + bool operator()(const CRef& cr) const { return ca[cr].mark() == 1; } }; + + // Solver state: + // + int elimorder; + bool use_simplification; + vec elimclauses; + vec touched; + OccLists, ClauseDeleted> + occurs; + vec n_occ; + Heap elim_heap; + Queue subsumption_queue; + vec frozen; + vec eliminated; + int bwdsub_assigns; + int n_touched; + + // Temporaries: + // + CRef bwdsub_tmpunit; + + // Main internal methods: + // + lbool solve_ (bool do_simp = true, bool turn_off_simp = false); + bool asymm (Var v, CRef cr); + bool asymmVar (Var v); + void updateElimHeap (Var v); + void gatherTouchedClauses (); + bool merge (const Clause& _ps, const Clause& _qs, Var v, vec& out_clause); + bool merge (const Clause& _ps, const Clause& _qs, Var v, int& size); + bool backwardSubsumptionCheck (bool verbose = false); + bool eliminateVar (Var v); + void extendModel (); + + void removeClause (CRef cr); + bool strengthenClause (CRef cr, Lit l); + void cleanUpClauses (); + bool implied (const vec& c); + void relocAll (ClauseAllocator& to); +}; + + +//================================================================================================= +// Implementation of inline methods: + + +inline bool SimpSolver::isEliminated (Var v) const { return eliminated[v]; } +inline void SimpSolver::updateElimHeap(Var v) { + assert(use_simplification); + // if (!frozen[v] && !isEliminated(v) && value(v) == l_Undef) + if (elim_heap.inHeap(v) || (!frozen[v] && !isEliminated(v) && value(v) == l_Undef)) + elim_heap.update(v); } + + +inline bool SimpSolver::addClause (const vec& ps) { ps.copyTo(add_tmp); return addClause_(add_tmp); } +inline bool SimpSolver::addEmptyClause() { add_tmp.clear(); return addClause_(add_tmp); } +inline bool SimpSolver::addClause (Lit p) { add_tmp.clear(); add_tmp.push(p); return addClause_(add_tmp); } +inline bool SimpSolver::addClause (Lit p, Lit q) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); } +inline bool SimpSolver::addClause (Lit p, Lit q, Lit r) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); } +inline void SimpSolver::setFrozen (Var v, bool b) { frozen[v] = (char)b; if (use_simplification && !b) { updateElimHeap(v); } } + +inline bool SimpSolver::solve ( bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (Lit p , bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (Lit p, Lit q, bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (Lit p, Lit q, Lit r, bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (const vec& assumps, bool do_simp, bool turn_off_simp){ + budgetOff(); assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp) == l_True; } + +inline lbool SimpSolver::solveLimited (const vec& assumps, bool do_simp, bool turn_off_simp){ + assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp); } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/utils/Options.cc b/packages/bee/glucose-2.2/utils/Options.cc new file mode 100755 index 000000000..dbe8a2906 --- /dev/null +++ b/packages/bee/glucose-2.2/utils/Options.cc @@ -0,0 +1,93 @@ +/**************************************************************************************[Options.cc] +Copyright (c) 2008-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include "mtl/Sort.h" +#include "utils/Options.h" +//#include "utils/ParseUtils.h" + +using namespace Glucose; + +void Glucose::parseOptions(int& argc, char** argv, bool strict) +{ + int i, j; + for (i = j = 1; i < argc; i++){ + const char* str = argv[i]; + if (match(str, "--") && match(str, Option::getHelpPrefixString()) && match(str, "help")){ + if (*str == '\0') + printUsageAndExit(argc, argv); + else if (match(str, "-verb")) + printUsageAndExit(argc, argv, true); + } else { + bool parsed_ok = false; + + for (int k = 0; !parsed_ok && k < Option::getOptionList().size(); k++){ + parsed_ok = Option::getOptionList()[k]->parse(argv[i]); + + // fprintf(stderr, "checking %d: %s against flag <%s> (%s)\n", i, argv[i], Option::getOptionList()[k]->name, parsed_ok ? "ok" : "skip"); + } + + if (!parsed_ok) { + if (strict && match(argv[i], "-")) { + fprintf(stderr, "ERROR! Unknown flag \"%s\". Use '--%shelp' for help.\n", argv[i], Option::getHelpPrefixString()), exit(1); + } else { + argv[j++] = argv[i]; + } + } + } + } + + argc -= (i - j); +} + + +void Glucose::setUsageHelp (const char* str){ Option::getUsageString() = str; } +void Glucose::setHelpPrefixStr (const char* str){ Option::getHelpPrefixString() = str; } +void Glucose::printUsageAndExit (int argc, char** argv, bool verbose) +{ + const char* usage = Option::getUsageString(); + if (usage != NULL) + fprintf(stderr, usage, argv[0]); + + sort(Option::getOptionList(), Option::OptionLt()); + + const char* prev_cat = NULL; + const char* prev_type = NULL; + + for (int i = 0; i < Option::getOptionList().size(); i++){ + const char* cat = Option::getOptionList()[i]->category; + const char* type = Option::getOptionList()[i]->type_name; + + if (cat != prev_cat) + fprintf(stderr, "\n%s OPTIONS:\n\n", cat); + else if (type != prev_type) + fprintf(stderr, "\n"); + + Option::getOptionList()[i]->help(verbose); + + prev_cat = Option::getOptionList()[i]->category; + prev_type = Option::getOptionList()[i]->type_name; + } + + fprintf(stderr, "\nHELP OPTIONS:\n\n"); + fprintf(stderr, " --%shelp Print help message.\n", Option::getHelpPrefixString()); + fprintf(stderr, " --%shelp-verb Print verbose help message.\n", Option::getHelpPrefixString()); + fprintf(stderr, "\n"); + exit(0); +} + diff --git a/packages/bee/glucose-2.2/utils/Options.h b/packages/bee/glucose-2.2/utils/Options.h new file mode 100755 index 000000000..34f31eb2c --- /dev/null +++ b/packages/bee/glucose-2.2/utils/Options.h @@ -0,0 +1,402 @@ +/***************************************************************************************[Options.h] +Copyright (c) 2008-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Options_h +#define Glucose_Options_h + +#include +#include +#include +#include + +#include "mtl/IntTypes.h" +#include "mtl/Vec.h" +//#include "utils/ParseUtils.h" + +namespace Glucose { + +// copied from utils/ParseUtils.h to avoid adding the entire adder +//================================================================================================== +// String matching: in case of a match the input iterator will be advanced the corresponding +// number of characters. +template +static bool match(B& in, const char* str) { + int i; + for (i = 0; str[i] != '\0'; i++) + if (in[i] != str[i]) + return false; + + in += i; + + return true; +} + +//================================================================================================== +// Top-level option parse/help functions: + + +extern void parseOptions (int& argc, char** argv, bool strict = false); +extern void printUsageAndExit(int argc, char** argv, bool verbose = false); +extern void setUsageHelp (const char* str); +extern void setHelpPrefixStr (const char* str); + + +//================================================================================================== +// Options is an abstract class that gives the interface for all types options: + + +class Option +{ + protected: + const char* name; + const char* description; + const char* category; + const char* type_name; + + static vec& getOptionList () { static vec options; return options; } + static const char*& getUsageString() { static const char* usage_str; return usage_str; } + static const char*& getHelpPrefixString() { static const char* help_prefix_str = ""; return help_prefix_str; } + + struct OptionLt { + bool operator()(const Option* x, const Option* y) { + int test1 = strcmp(x->category, y->category); + return test1 < 0 || (test1 == 0 && strcmp(x->type_name, y->type_name) < 0); + } + }; + + Option(const char* name_, + const char* desc_, + const char* cate_, + const char* type_) : + name (name_) + , description(desc_) + , category (cate_) + , type_name (type_) + { + getOptionList().push(this); + } + + public: + virtual ~Option() {} + + virtual bool parse (const char* str) = 0; + virtual void help (bool verbose = false) = 0; + + friend void parseOptions (int& argc, char** argv, bool strict); + friend void printUsageAndExit (int argc, char** argv, bool verbose); + friend void setUsageHelp (const char* str); + friend void setHelpPrefixStr (const char* str); +}; + + +//================================================================================================== +// Range classes with specialization for floating types: + + +struct IntRange { + int begin; + int end; + IntRange(int b, int e) : begin(b), end(e) {} +}; + +struct Int64Range { + int64_t begin; + int64_t end; + Int64Range(int64_t b, int64_t e) : begin(b), end(e) {} +}; + +struct DoubleRange { + double begin; + double end; + bool begin_inclusive; + bool end_inclusive; + DoubleRange(double b, bool binc, double e, bool einc) : begin(b), end(e), begin_inclusive(binc), end_inclusive(einc) {} +}; + + +//================================================================================================== +// Double options: + + +class DoubleOption : public Option +{ + protected: + DoubleRange range; + double value; + + public: + DoubleOption(const char* c, const char* n, const char* d, double def = double(), DoubleRange r = DoubleRange(-HUGE_VAL, false, HUGE_VAL, false)) + : Option(n, d, c, ""), range(r), value(def) { + // FIXME: set LC_NUMERIC to "C" to make sure that strtof/strtod parses decimal point correctly. + } + + operator double (void) const { return value; } + operator double& (void) { return value; } + DoubleOption& operator=(double x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + char* end; + double tmp = strtod(span, &end); + + if (end == NULL) + return false; + else if (tmp >= range.end && (!range.end_inclusive || tmp != range.end)){ + fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name); + exit(1); + }else if (tmp <= range.begin && (!range.begin_inclusive || tmp != range.begin)){ + fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name); + exit(1); } + + value = tmp; + // fprintf(stderr, "READ VALUE: %g\n", value); + + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-12s = %-8s %c%4.2g .. %4.2g%c (default: %g)\n", + name, type_name, + range.begin_inclusive ? '[' : '(', + range.begin, + range.end, + range.end_inclusive ? ']' : ')', + value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + + +//================================================================================================== +// Int options: + + +class IntOption : public Option +{ + protected: + IntRange range; + int32_t value; + + public: + IntOption(const char* c, const char* n, const char* d, int32_t def = int32_t(), IntRange r = IntRange(INT32_MIN, INT32_MAX)) + : Option(n, d, c, ""), range(r), value(def) {} + + operator int32_t (void) const { return value; } + operator int32_t& (void) { return value; } + IntOption& operator= (int32_t x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + char* end; + int32_t tmp = strtol(span, &end, 10); + + if (end == NULL) + return false; + else if (tmp > range.end){ + fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name); + exit(1); + }else if (tmp < range.begin){ + fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name); + exit(1); } + + value = tmp; + + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-12s = %-8s [", name, type_name); + if (range.begin == INT32_MIN) + fprintf(stderr, "imin"); + else + fprintf(stderr, "%4d", range.begin); + + fprintf(stderr, " .. "); + if (range.end == INT32_MAX) + fprintf(stderr, "imax"); + else + fprintf(stderr, "%4d", range.end); + + fprintf(stderr, "] (default: %d)\n", value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + + +// Leave this out for visual C++ until Microsoft implements C99 and gets support for strtoll. +#ifndef _MSC_VER + +class Int64Option : public Option +{ + protected: + Int64Range range; + int64_t value; + + public: + Int64Option(const char* c, const char* n, const char* d, int64_t def = int64_t(), Int64Range r = Int64Range(INT64_MIN, INT64_MAX)) + : Option(n, d, c, ""), range(r), value(def) {} + + operator int64_t (void) const { return value; } + operator int64_t& (void) { return value; } + Int64Option& operator= (int64_t x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + char* end; + int64_t tmp = strtoll(span, &end, 10); + + if (end == NULL) + return false; + else if (tmp > range.end){ + fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name); + exit(1); + }else if (tmp < range.begin){ + fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name); + exit(1); } + + value = tmp; + + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-12s = %-8s [", name, type_name); + if (range.begin == INT64_MIN) + fprintf(stderr, "imin"); + else + fprintf(stderr, "%4" PRIi64, range.begin); + + fprintf(stderr, " .. "); + if (range.end == INT64_MAX) + fprintf(stderr, "imax"); + else + fprintf(stderr, "%4" PRIi64, range.end); + + fprintf(stderr, "] (default: %" PRIi64 ")\n", value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; +#endif + +//================================================================================================== +// String option: + + +class StringOption : public Option +{ + const char* value; + public: + StringOption(const char* c, const char* n, const char* d, const char* def = NULL) + : Option(n, d, c, ""), value(def) {} + + operator const char* (void) const { return value; } + operator const char*& (void) { return value; } + StringOption& operator= (const char* x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + value = span; + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-10s = %8s\n", name, type_name); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + + +//================================================================================================== +// Bool option: + + +class BoolOption : public Option +{ + bool value; + + public: + BoolOption(const char* c, const char* n, const char* d, bool v) + : Option(n, d, c, ""), value(v) {} + + operator bool (void) const { return value; } + operator bool& (void) { return value; } + BoolOption& operator=(bool b) { value = b; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (match(span, "-")){ + bool b = !match(span, "no-"); + + if (strcmp(span, name) == 0){ + value = b; + return true; } + } + + return false; + } + + virtual void help (bool verbose = false){ + + fprintf(stderr, " -%s, -no-%s", name, name); + + for (uint32_t i = 0; i < 32 - strlen(name)*2; i++) + fprintf(stderr, " "); + + fprintf(stderr, " "); + fprintf(stderr, "(default: %s)\n", value ? "on" : "off"); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/utils/ParseUtils.h b/packages/bee/glucose-2.2/utils/ParseUtils.h new file mode 100755 index 000000000..636551b77 --- /dev/null +++ b/packages/bee/glucose-2.2/utils/ParseUtils.h @@ -0,0 +1,153 @@ +/************************************************************************************[ParseUtils.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_ParseUtils_h +#define Glucose_ParseUtils_h + +#include +#include +#include + +//#include // comment out to make it easy to compile PL-Minisat in Windows + +namespace Glucose { + +//------------------------------------------------------------------------------------------------- +// A simple buffered character stream class: + +static const int buffer_size = 1048576; + +// next code was comment out to make it easy to compile PL-Minisat in Windows +/* +class StreamBuffer { + gzFile in; + unsigned char buf[buffer_size]; + int pos; + int size; + + void assureLookahead() { + if (pos >= size) { + pos = 0; + size = gzread(in, buf, sizeof(buf)); } } + +public: + explicit StreamBuffer(gzFile i) : in(i), pos(0), size(0) { assureLookahead(); } + + int operator * () const { return (pos >= size) ? EOF : buf[pos]; } + void operator ++ () { pos++; assureLookahead(); } + int position () const { return pos; } +}; + + +//------------------------------------------------------------------------------------------------- +// End-of-file detection functions for StreamBuffer and char*: + + +static inline bool isEof(StreamBuffer& in) { return *in == EOF; } +static inline bool isEof(const char* in) { return *in == '\0'; } +*/ + +//------------------------------------------------------------------------------------------------- +// Generic parse functions parametrized over the input-stream type. + + +template +static void skipWhitespace(B& in) { + while ((*in >= 9 && *in <= 13) || *in == 32) + ++in; } + + +template +static void skipLine(B& in) { + for (;;){ + if (isEof(in)) return; + if (*in == '\n') { ++in; return; } + ++in; } } + +template +static double parseDouble(B& in) { // only in the form X.XXXXXe-XX + bool neg= false; + double accu = 0.0; + double currentExponent = 1; + int exponent; + + skipWhitespace(in); + if(*in == EOF) return 0; + if (*in == '-') neg = true, ++in; + else if (*in == '+') ++in; + if (*in < '1' || *in > '9') printf("PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + accu = (double)(*in - '0'); + ++in; + if (*in != '.') printf("PARSE ERROR! Unexpected char: %c\n", *in),exit(3); + ++in; // skip dot + currentExponent = 0.1; + while (*in >= '0' && *in <= '9') + accu = accu + currentExponent * ((double)(*in - '0')), + currentExponent /= 10, + ++in; + if (*in != 'e') printf("PARSE ERROR! Unexpected char: %c\n", *in),exit(3); + ++in; // skip dot + exponent = parseInt(in); // read exponent + accu *= pow(10,exponent); + return neg ? -accu:accu; +} + + +template +static int parseInt(B& in) { + int val = 0; + bool neg = false; + skipWhitespace(in); + if (*in == '-') neg = true, ++in; + else if (*in == '+') ++in; + if (*in < '0' || *in > '9') fprintf(stderr, "PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + while (*in >= '0' && *in <= '9') + val = val*10 + (*in - '0'), + ++in; + return neg ? -val : val; } + + +// String matching: in case of a match the input iterator will be advanced the corresponding +// number of characters. +template +static bool match(B& in, const char* str) { + int i; + for (i = 0; str[i] != '\0'; i++) + if (in[i] != str[i]) + return false; + + in += i; + + return true; +} + +// String matching: consumes characters eagerly, but does not require random access iterator. +template +static bool eagerMatch(B& in, const char* str) { + for (; *str != '\0'; ++str, ++in) + if (*str != *in) + return false; + return true; } + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-2.2/utils/System.cc b/packages/bee/glucose-2.2/utils/System.cc new file mode 100755 index 000000000..a516e0b9d --- /dev/null +++ b/packages/bee/glucose-2.2/utils/System.cc @@ -0,0 +1,95 @@ +/***************************************************************************************[System.cc] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include "utils/System.h" + +#if defined(__linux__) + +#include +#include + +using namespace Glucose; + +// TODO: split the memory reading functions into two: one for reading high-watermark of RSS, and +// one for reading the current virtual memory size. + +static inline int memReadStat(int field) +{ + char name[256]; + pid_t pid = getpid(); + int value; + + sprintf(name, "/proc/%d/statm", pid); + FILE* in = fopen(name, "rb"); + if (in == NULL) return 0; + + for (; field >= 0; field--) + if (fscanf(in, "%d", &value) != 1) + printf("ERROR! Failed to parse memory statistics from \"/proc\".\n"), exit(1); + fclose(in); + return value; +} + + +static inline int memReadPeak(void) +{ + char name[256]; + pid_t pid = getpid(); + + sprintf(name, "/proc/%d/status", pid); + FILE* in = fopen(name, "rb"); + if (in == NULL) return 0; + + // Find the correct line, beginning with "VmPeak:": + int peak_kb = 0; + while (!feof(in) && fscanf(in, "VmPeak: %d kB", &peak_kb) != 1) + while (!feof(in) && fgetc(in) != '\n') + ; + fclose(in); + + return peak_kb; +} + +double Glucose::memUsed() { return (double)memReadStat(0) * (double)getpagesize() / (1024*1024); } +double Glucose::memUsedPeak() { + double peak = memReadPeak() / 1024; + return peak == 0 ? memUsed() : peak; } + +#elif defined(__FreeBSD__) + +double Glucose::memUsed(void) { + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + return (double)ru.ru_maxrss / 1024; } +double MiniSat::memUsedPeak(void) { return memUsed(); } + + +#elif defined(__APPLE__) +#include + +double Glucose::memUsed(void) { + malloc_statistics_t t; + malloc_zone_statistics(NULL, &t); + return (double)t.max_size_in_use / (1024*1024); } + +#else +double Glucose::memUsed() { + return 0; } +#endif diff --git a/packages/bee/glucose-2.2/utils/System.h b/packages/bee/glucose-2.2/utils/System.h new file mode 100755 index 000000000..478807053 --- /dev/null +++ b/packages/bee/glucose-2.2/utils/System.h @@ -0,0 +1,60 @@ +/****************************************************************************************[System.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_System_h +#define Glucose_System_h + +#if defined(__linux__) +#include +#endif + +#include "mtl/IntTypes.h" + +//------------------------------------------------------------------------------------------------- + +namespace Glucose { + +static inline double cpuTime(void); // CPU-time in seconds. +extern double memUsed(); // Memory in mega bytes (returns 0 for unsupported architectures). +extern double memUsedPeak(); // Peak-memory in mega bytes (returns 0 for unsupported architectures). + +} + +//------------------------------------------------------------------------------------------------- +// Implementation of inline functions: + +#if defined(_MSC_VER) || defined(__MINGW32__) +#include + +static inline double Glucose::cpuTime(void) { return (double)clock() / CLOCKS_PER_SEC; } + +#else +#include +#include +#include + +static inline double Glucose::cpuTime(void) { + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + return (double)ru.ru_utime.tv_sec + (double)ru.ru_utime.tv_usec / 1000000; } + +#endif + +#endif diff --git a/packages/bee/glucose-4/LICENCE b/packages/bee/glucose-4/LICENCE new file mode 100644 index 000000000..6fa3b63ae --- /dev/null +++ b/packages/bee/glucose-4/LICENCE @@ -0,0 +1,47 @@ + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/packages/bee/glucose-4/README b/packages/bee/glucose-4/README new file mode 100644 index 000000000..19cd95f42 --- /dev/null +++ b/packages/bee/glucose-4/README @@ -0,0 +1,24 @@ +Directory overview: +================== + +mtl/ Minisat Template Library +core/ A core version of the solver glucose (no main here) +simp/ An extended solver with simplification capabilities +parallel/ A multicore version of glucose +README +LICENSE +Changelog + +To build (release version: without assertions, statically linked, etc): +====================================================================== +Like minisat.... + +cd { simp | parallel } +make rs + +Usage: +====== + +in simp directory: ./glucose --help + +in parallel directory: ./glucose-syrup --help \ No newline at end of file diff --git a/packages/bee/glucose-4/core/BoundedQueue.h b/packages/bee/glucose-4/core/BoundedQueue.h new file mode 100644 index 000000000..5269c9b74 --- /dev/null +++ b/packages/bee/glucose-4/core/BoundedQueue.h @@ -0,0 +1,148 @@ +/***************************************************************************************[BoundedQueue.h] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + + +#ifndef BoundedQueue_h +#define BoundedQueue_h + +#include "mtl/Vec.h" + +//================================================================================================= + +namespace Glucose { + +template +class bqueue { + vec elems; + int first; + int last; + unsigned long long sumofqueue; + int maxsize; + int queuesize; // Number of current elements (must be < maxsize !) + bool expComputed; + double exp,value; +public: + bqueue(void) : first(0), last(0), sumofqueue(0), maxsize(0), queuesize(0),expComputed(false) { } + + void initSize(int size) {growTo(size);exp = 2.0/(size+1);} // Init size of bounded size queue + + void push(T x) { + expComputed = false; + if (queuesize==maxsize) { + assert(last==first); // The queue is full, next value to enter will replace oldest one + sumofqueue -= elems[last]; + if ((++last) == maxsize) last = 0; + } else + queuesize++; + sumofqueue += x; + elems[first] = x; + if ((++first) == maxsize) {first = 0;last = 0;} + } + + T peek() { assert(queuesize>0); return elems[last]; } + void pop() {sumofqueue-=elems[last]; queuesize--; if ((++last) == maxsize) last = 0;} + + unsigned long long getsum() const {return sumofqueue;} + unsigned int getavg() const {return (unsigned int)(sumofqueue/((unsigned long long)queuesize));} + int maxSize() const {return maxsize;} + double getavgDouble() const { + double tmp = 0; + for(int i=0;i + +#include "utils/ParseUtils.h" +#include "core/SolverTypes.h" + +namespace Glucose { + +//================================================================================================= +// DIMACS Parser: + +template +static void readClause(B& in, Solver& S, vec& lits) { + int parsed_lit, var; + lits.clear(); + for (;;){ + parsed_lit = parseInt(in); + if (parsed_lit == 0) break; + var = abs(parsed_lit)-1; + while (var >= S.nVars()) S.newVar(); + lits.push( (parsed_lit > 0) ? mkLit(var) : ~mkLit(var) ); + } +} + +template +static void parse_DIMACS_main(B& in, Solver& S) { + vec lits; + int vars = 0; + int clauses = 0; + int cnt = 0; + for (;;){ + skipWhitespace(in); + if (*in == EOF) break; + else if (*in == 'p'){ + if (eagerMatch(in, "p cnf")){ + vars = parseInt(in); + clauses = parseInt(in); + // SATRACE'06 hack + // if (clauses > 4000000) + // S.eliminate(true); + }else{ + printf("PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + } + } else if (*in == 'c' || *in == 'p') + skipLine(in); + else{ + cnt++; + readClause(in, S, lits); + S.addClause_(lits); } + } + if (vars != S.nVars()) + fprintf(stderr, "WARNING! DIMACS header mismatch: wrong number of variables.\n"); + if (cnt != clauses) + fprintf(stderr, "WARNING! DIMACS header mismatch: wrong number of clauses.\n"); +} + +// Inserts problem into solver. +// +template +static void parse_DIMACS(gzFile input_stream, Solver& S) { + StreamBuffer in(input_stream); + parse_DIMACS_main(in, S); } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/core/Solver.cc b/packages/bee/glucose-4/core/Solver.cc new file mode 100644 index 000000000..3b0d5ee08 --- /dev/null +++ b/packages/bee/glucose-4/core/Solver.cc @@ -0,0 +1,1710 @@ +/***************************************************************************************[Solver.cc] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#include + +#include "utils/System.h" +#include "mtl/Sort.h" +#include "core/Solver.h" +#include "core/Constants.h" + +using namespace Glucose; + +//================================================================================================= +// Options: + +static const char* _cat = "CORE"; +static const char* _cr = "CORE -- RESTART"; +static const char* _cred = "CORE -- REDUCE"; +static const char* _cm = "CORE -- MINIMIZE"; + + + + +static DoubleOption opt_K(_cr, "K", "The constant used to force restart", 0.8, DoubleRange(0, false, 1, false)); +static DoubleOption opt_R(_cr, "R", "The constant used to block restart", 1.4, DoubleRange(1, false, 5, false)); +static IntOption opt_size_lbd_queue(_cr, "szLBDQueue", "The size of moving average for LBD (restarts)", 50, IntRange(10, INT32_MAX)); +static IntOption opt_size_trail_queue(_cr, "szTrailQueue", "The size of moving average for trail (block restarts)", 5000, IntRange(10, INT32_MAX)); + +static IntOption opt_first_reduce_db(_cred, "firstReduceDB", "The number of conflicts before the first reduce DB", 2000, IntRange(0, INT32_MAX)); +static IntOption opt_inc_reduce_db(_cred, "incReduceDB", "Increment for reduce DB", 300, IntRange(0, INT32_MAX)); +static IntOption opt_spec_inc_reduce_db(_cred, "specialIncReduceDB", "Special increment for reduce DB", 1000, IntRange(0, INT32_MAX)); +static IntOption opt_lb_lbd_frozen_clause(_cred, "minLBDFrozenClause", "Protect clauses if their LBD decrease and is lower than (for one turn)", 30, IntRange(0, INT32_MAX)); + +static IntOption opt_lb_size_minimzing_clause(_cm, "minSizeMinimizingClause", "The min size required to minimize clause", 30, IntRange(3, INT32_MAX)); +static IntOption opt_lb_lbd_minimzing_clause(_cm, "minLBDMinimizingClause", "The min LBD required to minimize clause", 6, IntRange(3, INT32_MAX)); + + +static DoubleOption opt_var_decay(_cat, "var-decay", "The variable activity decay factor (starting point)", 0.8, DoubleRange(0, false, 1, false)); +static DoubleOption opt_max_var_decay(_cat, "max-var-decay", "The variable activity decay factor", 0.95, DoubleRange(0, false, 1, false)); +static DoubleOption opt_clause_decay(_cat, "cla-decay", "The clause activity decay factor", 0.999, DoubleRange(0, false, 1, false)); +static DoubleOption opt_random_var_freq(_cat, "rnd-freq", "The frequency with which the decision heuristic tries to choose a random variable", 0, DoubleRange(0, true, 1, true)); +static DoubleOption opt_random_seed(_cat, "rnd-seed", "Used by the random variable selection", 91648253, DoubleRange(0, false, HUGE_VAL, false)); +static IntOption opt_ccmin_mode(_cat, "ccmin-mode", "Controls conflict clause minimization (0=none, 1=basic, 2=deep)", 2, IntRange(0, 2)); +static IntOption opt_phase_saving(_cat, "phase-saving", "Controls the level of phase saving (0=none, 1=limited, 2=full)", 2, IntRange(0, 2)); +static BoolOption opt_rnd_init_act(_cat, "rnd-init", "Randomize the initial activity", false); +static DoubleOption opt_garbage_frac(_cat, "gc-frac", "The fraction of wasted memory allowed before a garbage collection is triggered", 0.20, DoubleRange(0, false, HUGE_VAL, false)); + + +//================================================================================================= +// Constructor/Destructor: + +Solver::Solver() : + +// Parameters (user settable): +// +verbosity(0) +, showModel(0) +, K(opt_K) +, R(opt_R) +, sizeLBDQueue(opt_size_lbd_queue) +, sizeTrailQueue(opt_size_trail_queue) +, firstReduceDB(opt_first_reduce_db) +, incReduceDB(opt_inc_reduce_db) +, specialIncReduceDB(opt_spec_inc_reduce_db) +, lbLBDFrozenClause(opt_lb_lbd_frozen_clause) +, lbSizeMinimizingClause(opt_lb_size_minimzing_clause) +, lbLBDMinimizingClause(opt_lb_lbd_minimzing_clause) +, var_decay(opt_var_decay) +, max_var_decay(opt_max_var_decay) +, clause_decay(opt_clause_decay) +, random_var_freq(opt_random_var_freq) +, random_seed(opt_random_seed) +, ccmin_mode(opt_ccmin_mode) +, phase_saving(opt_phase_saving) +, rnd_pol(false) +, rnd_init_act(opt_rnd_init_act) +, garbage_frac(opt_garbage_frac) +, certifiedOutput(NULL) +, certifiedUNSAT(false) // Not in the first parallel version +, panicModeLastRemoved(0), panicModeLastRemovedShared(0) +, useUnaryWatched(false) +, promoteOneWatchedClause(true) +// Statistics: (formerly in 'SolverStats') +// +, nbPromoted(0) +, originalClausesSeen(0) +, sumDecisionLevels(0) +, nbRemovedClauses(0), nbRemovedUnaryWatchedClauses(0), nbReducedClauses(0), nbDL2(0), nbBin(0), nbUn(0), nbReduceDB(0) +, solves(0), starts(0), decisions(0), rnd_decisions(0), propagations(0), conflicts(0), conflictsRestarts(0) +, nbstopsrestarts(0), nbstopsrestartssame(0), lastblockatrestart(0) +, dec_vars(0), clauses_literals(0), learnts_literals(0), max_literals(0), tot_literals(0) +, curRestart(1) + +, ok(true) +, cla_inc(1) +, var_inc(1) +, watches(WatcherDeleted(ca)) +, watchesBin(WatcherDeleted(ca)) +, unaryWatches(WatcherDeleted(ca)) +, qhead(0) +, simpDB_assigns(-1) +, simpDB_props(0) +, order_heap(VarOrderLt(activity)) +, progress_estimate(0) +, remove_satisfied(true) +, reduceOnSize(false) // +, reduceOnSizeSize(12) // Constant to use on size reductions +,lastLearntClause(CRef_Undef) +// Resource constraints: +// +, conflict_budget(-1) +, propagation_budget(-1) +, asynch_interrupt(false) +, incremental(false) +, nbVarsInitialFormula(INT32_MAX) +, totalTime4Sat(0.) +, totalTime4Unsat(0.) +, nbSatCalls(0) +, nbUnsatCalls(0) +{ + MYFLAG = 0; + // Initialize only first time. Useful for incremental solving (not in // version), useless otherwise + // Kept here for simplicity + lbdQueue.initSize(sizeLBDQueue); + trailQueue.initSize(sizeTrailQueue); + sumLBD = 0; + nbclausesbeforereduce = firstReduceDB; +} + +//------------------------------------------------------- +// Special constructor used for cloning solvers +//------------------------------------------------------- + +Solver::Solver(const Solver &s) : + verbosity(s.verbosity) +, showModel(s.showModel) +, K(s.K) +, R(s.R) +, sizeLBDQueue(s.sizeLBDQueue) +, sizeTrailQueue(s.sizeTrailQueue) +, firstReduceDB(s.firstReduceDB) +, incReduceDB(s.incReduceDB) +, specialIncReduceDB(s.specialIncReduceDB) +, lbLBDFrozenClause(s.lbLBDFrozenClause) +, lbSizeMinimizingClause(s.lbSizeMinimizingClause) +, lbLBDMinimizingClause(s.lbLBDMinimizingClause) +, var_decay(s.var_decay) +, max_var_decay(s.max_var_decay) +, clause_decay(s.clause_decay) +, random_var_freq(s.random_var_freq) +, random_seed(s.random_seed) +, ccmin_mode(s.ccmin_mode) +, phase_saving(s.phase_saving) +, rnd_pol(s.rnd_pol) +, rnd_init_act(s.rnd_init_act) +, garbage_frac(s.garbage_frac) +, certifiedOutput(NULL) +, certifiedUNSAT(false) // Not in the first parallel version +, panicModeLastRemoved(s.panicModeLastRemoved), panicModeLastRemovedShared(s.panicModeLastRemovedShared) +, useUnaryWatched(s.useUnaryWatched) +, promoteOneWatchedClause(s.promoteOneWatchedClause) +// Statistics: (formerly in 'SolverStats') +// +, nbPromoted(s.nbPromoted) +, originalClausesSeen(s.originalClausesSeen) +, sumDecisionLevels(s.sumDecisionLevels) +, nbRemovedClauses(s.nbRemovedClauses), nbRemovedUnaryWatchedClauses(s.nbRemovedUnaryWatchedClauses) +, nbReducedClauses(s.nbReducedClauses), nbDL2(s.nbDL2), nbBin(s.nbBin), nbUn(s.nbUn), nbReduceDB(s.nbReduceDB) +, solves(s.solves), starts(s.starts), decisions(s.decisions), rnd_decisions(s.rnd_decisions) +, propagations(s.propagations), conflicts(s.conflicts), conflictsRestarts(s.conflictsRestarts) +, nbstopsrestarts(s.nbstopsrestarts), nbstopsrestartssame(s.nbstopsrestartssame) +, lastblockatrestart(s.lastblockatrestart) +, dec_vars(s.dec_vars), clauses_literals(s.clauses_literals) +, learnts_literals(s.learnts_literals), max_literals(s.max_literals), tot_literals(s.tot_literals) +, curRestart(s.curRestart) + +, ok(true) +, cla_inc(s.cla_inc) +, var_inc(s.var_inc) +, watches(WatcherDeleted(ca)) +, watchesBin(WatcherDeleted(ca)) +, unaryWatches(WatcherDeleted(ca)) +, qhead(s.qhead) +, simpDB_assigns(s.simpDB_assigns) +, simpDB_props(s.simpDB_props) +, order_heap(VarOrderLt(activity)) +, progress_estimate(s.progress_estimate) +, remove_satisfied(s.remove_satisfied) +, reduceOnSize(s.reduceOnSize) // +, reduceOnSizeSize(s.reduceOnSizeSize) // Constant to use on size reductions +,lastLearntClause(CRef_Undef) +// Resource constraints: +// +, conflict_budget(s.conflict_budget) +, propagation_budget(s.propagation_budget) +, asynch_interrupt(s.asynch_interrupt) +, incremental(s.incremental) +, nbVarsInitialFormula(s.nbVarsInitialFormula) +, totalTime4Sat(s.totalTime4Sat) +, totalTime4Unsat(s.totalTime4Unsat) +, nbSatCalls(s.nbSatCalls) +, nbUnsatCalls(s.nbUnsatCalls) +{ + // Copy clauses. + s.ca.copyTo(ca); + ca.extra_clause_field = s.ca.extra_clause_field; + + // Initialize other variables + MYFLAG = 0; + // Initialize only first time. Useful for incremental solving (not in // version), useless otherwise + // Kept here for simplicity + sumLBD = s.sumLBD; + nbclausesbeforereduce = s.nbclausesbeforereduce; + + // Copy all search vectors + s.watches.copyTo(watches); + s.watchesBin.copyTo(watchesBin); + s.unaryWatches.copyTo(unaryWatches); + s.assigns.memCopyTo(assigns); + s.vardata.memCopyTo(vardata); + s.activity.memCopyTo(activity); + s.seen.memCopyTo(seen); + s.permDiff.memCopyTo(permDiff); + s.polarity.memCopyTo(polarity); + s.decision.memCopyTo(decision); + s.trail.memCopyTo(trail); + s.order_heap.copyTo(order_heap); + s.clauses.memCopyTo(clauses); + s.learnts.memCopyTo(learnts); + + s.lbdQueue.copyTo(lbdQueue); + s.trailQueue.copyTo(trailQueue); + +} + +Solver::~Solver() { +} + +/**************************************************************** + Set the incremental mode +****************************************************************/ + +// This function set the incremental mode to true. +// You can add special code for this mode here. + +void Solver::setIncrementalMode() { + incremental = true; +} + +// Number of variables without selectors +void Solver::initNbInitialVars(int nb) { + nbVarsInitialFormula = nb; +} + +bool Solver::isIncremental() { + return incremental; +} + + +//================================================================================================= +// Minor methods: + + +// Creates a new SAT variable in the solver. If 'decision' is cleared, variable will not be +// used as a decision variable (NOTE! This has effects on the meaning of a SATISFIABLE result). +// + +Var Solver::newVar(bool sign, bool dvar) { + int v = nVars(); + watches .init(mkLit(v, false)); + watches .init(mkLit(v, true)); + watchesBin .init(mkLit(v, false)); + watchesBin .init(mkLit(v, true)); + unaryWatches .init(mkLit(v, false)); + unaryWatches .init(mkLit(v, true)); + assigns .push(l_Undef); + vardata .push(mkVarData(CRef_Undef, 0)); + activity .push(rnd_init_act ? drand(random_seed) * 0.00001 : 0); + seen .push(0); + permDiff .push(0); + polarity .push(sign); + decision .push(); + trail .capacity(v + 1); + setDecisionVar(v, dvar); + return v; +} + +bool Solver::addClause_(vec& ps) { + + assert(decisionLevel() == 0); + if (!ok) return false; + + // Check if clause is satisfied and remove false/duplicate literals: + sort(ps); + + vec oc; + oc.clear(); + + Lit p; + int i, j, flag = 0; + if (certifiedUNSAT) { + for (i = j = 0, p = lit_Undef; i < ps.size(); i++) { + oc.push(ps[i]); + if (value(ps[i]) == l_True || ps[i] == ~p || value(ps[i]) == l_False) + flag = 1; + } + } + + for (i = j = 0, p = lit_Undef; i < ps.size(); i++) + if (value(ps[i]) == l_True || ps[i] == ~p) + return true; + else if (value(ps[i]) != l_False && ps[i] != p) + ps[j++] = p = ps[i]; + ps.shrink(i - j); + + if (flag && (certifiedUNSAT)) { + for (i = j = 0, p = lit_Undef; i < ps.size(); i++) + fprintf(certifiedOutput, "%i ", (var(ps[i]) + 1) * (-2 * sign(ps[i]) + 1)); + fprintf(certifiedOutput, "0\n"); + + fprintf(certifiedOutput, "d "); + for (i = j = 0, p = lit_Undef; i < oc.size(); i++) + fprintf(certifiedOutput, "%i ", (var(oc[i]) + 1) * (-2 * sign(oc[i]) + 1)); + fprintf(certifiedOutput, "0\n"); + } + + + if (ps.size() == 0) + return ok = false; + else if (ps.size() == 1) { + uncheckedEnqueue(ps[0]); + return ok = (propagate() == CRef_Undef); + } else { + CRef cr = ca.alloc(ps, false); + clauses.push(cr); + attachClause(cr); + } + + return true; +} + +void Solver::attachClause(CRef cr) { + const Clause& c = ca[cr]; + + assert(c.size() > 1); + if (c.size() == 2) { + watchesBin[~c[0]].push(Watcher(cr, c[1])); + watchesBin[~c[1]].push(Watcher(cr, c[0])); + } else { + watches[~c[0]].push(Watcher(cr, c[1])); + watches[~c[1]].push(Watcher(cr, c[0])); + } + if (c.learnt()) learnts_literals += c.size(); + else clauses_literals += c.size(); +} + +void Solver::attachClausePurgatory(CRef cr) { + const Clause& c = ca[cr]; + + assert(c.size() > 1); + unaryWatches[~c[0]].push(Watcher(cr, c[1])); + +} + +void Solver::detachClause(CRef cr, bool strict) { + const Clause& c = ca[cr]; + + assert(c.size() > 1); + if (c.size() == 2) { + if (strict) { + remove(watchesBin[~c[0]], Watcher(cr, c[1])); + remove(watchesBin[~c[1]], Watcher(cr, c[0])); + } else { + // Lazy detaching: (NOTE! Must clean all watcher lists before garbage collecting this clause) + watchesBin.smudge(~c[0]); + watchesBin.smudge(~c[1]); + } + } else { + if (strict) { + remove(watches[~c[0]], Watcher(cr, c[1])); + remove(watches[~c[1]], Watcher(cr, c[0])); + } else { + // Lazy detaching: (NOTE! Must clean all watcher lists before garbage collecting this clause) + watches.smudge(~c[0]); + watches.smudge(~c[1]); + } + } + if (c.learnt()) learnts_literals -= c.size(); + else clauses_literals -= c.size(); +} + + +// The purgatory is the 1-Watched scheme for imported clauses + +void Solver::detachClausePurgatory(CRef cr, bool strict) { + const Clause& c = ca[cr]; + + assert(c.size() > 1); + if (strict) + remove(unaryWatches[~c[0]], Watcher(cr, c[1])); + else + unaryWatches.smudge(~c[0]); +} + +void Solver::removeClause(CRef cr, bool inPurgatory) { + + Clause& c = ca[cr]; + + if (certifiedUNSAT) { + fprintf(certifiedOutput, "d "); + for (int i = 0; i < c.size(); i++) + fprintf(certifiedOutput, "%i ", (var(c[i]) + 1) * (-2 * sign(c[i]) + 1)); + fprintf(certifiedOutput, "0\n"); + } + + if (inPurgatory) + detachClausePurgatory(cr); + else + detachClause(cr); + // Don't leave pointers to free'd memory! + if (locked(c)) vardata[var(c[0])].reason = CRef_Undef; + c.mark(1); + ca.free(cr); +} + +bool Solver::satisfied(const Clause& c) const { + if(incremental) + return (value(c[0]) == l_True) || (value(c[1]) == l_True); + + // Default mode + for (int i = 0; i < c.size(); i++) + if (value(c[i]) == l_True) + return true; + return false; +} + +/************************************************************ + * Compute LBD functions + *************************************************************/ + +inline unsigned int Solver::computeLBD(const vec & lits,int end) { + int nblevels = 0; + MYFLAG++; + + if(incremental) { // ----------------- INCREMENTAL MODE + if(end==-1) end = lits.size(); + int nbDone = 0; + for(int i=0;i=end) break; + if(isSelector(var(lits[i]))) continue; + nbDone++; + int l = level(var(lits[i])); + if (permDiff[l] != MYFLAG) { + permDiff[l] = MYFLAG; + nblevels++; + } + } + } else { // -------- DEFAULT MODE. NOT A LOT OF DIFFERENCES... BUT EASIER TO READ + for(int i=0;i=c.sizeWithoutSelectors()) break; + if(isSelector(var(c[i]))) continue; + nbDone++; + int l = level(var(c[i])); + if (permDiff[l] != MYFLAG) { + permDiff[l] = MYFLAG; + nblevels++; + } + } + } else { // -------- DEFAULT MODE. NOT A LOT OF DIFFERENCES... BUT EASIER TO READ + for(int i=0;i &out_learnt) { + + // Find the LBD measure + unsigned int lbd = computeLBD(out_learnt); + Lit p = ~out_learnt[0]; + + if (lbd <= lbLBDMinimizingClause) { + MYFLAG++; + + for (int i = 1; i < out_learnt.size(); i++) { + permDiff[var(out_learnt[i])] = MYFLAG; + } + + vec& wbin = watchesBin[p]; + int nb = 0; + for (int k = 0; k < wbin.size(); k++) { + Lit imp = wbin[k].blocker; + if (permDiff[var(imp)] == MYFLAG && value(imp) == l_True) { + nb++; + permDiff[var(imp)] = MYFLAG - 1; + } + } + int l = out_learnt.size() - 1; + if (nb > 0) { + nbReducedClauses++; + for (int i = 1; i < out_learnt.size() - nb; i++) { + if (permDiff[var(out_learnt[i])] != MYFLAG) { + Lit p = out_learnt[l]; + out_learnt[l] = out_learnt[i]; + out_learnt[i] = p; + l--; + i--; + } + } + + out_learnt.shrink(nb); + + } + } +} + +// Revert to the state at given level (keeping all assignment at 'level' but not beyond). +// + +void Solver::cancelUntil(int level) { + if (decisionLevel() > level) { + for (int c = trail.size() - 1; c >= trail_lim[level]; c--) { + Var x = var(trail[c]); + assigns [x] = l_Undef; + if (phase_saving > 1 || ((phase_saving == 1) && c > trail_lim.last())) { + polarity[x] = sign(trail[c]); + } + insertVarOrder(x); + } + qhead = trail_lim[level]; + trail.shrink(trail.size() - trail_lim[level]); + trail_lim.shrink(trail_lim.size() - level); + } +} + + +//================================================================================================= +// Major methods: + +Lit Solver::pickBranchLit() { + Var next = var_Undef; + + // Random decision: + if (drand(random_seed) < random_var_freq && !order_heap.empty()) { + next = order_heap[irand(random_seed, order_heap.size())]; + if (value(next) == l_Undef && decision[next]) + rnd_decisions++; + } + + // Activity based decision: + while (next == var_Undef || value(next) != l_Undef || !decision[next]) + if (order_heap.empty()) { + next = var_Undef; + break; + } else { + next = order_heap.removeMin(); + } + + return next == var_Undef ? lit_Undef : mkLit(next, rnd_pol ? drand(random_seed) < 0.5 : polarity[next]); +} + +/*_________________________________________________________________________________________________ +| +| analyze : (confl : Clause*) (out_learnt : vec&) (out_btlevel : int&) -> [void] +| +| Description: +| Analyze conflict and produce a reason clause. +| +| Pre-conditions: +| * 'out_learnt' is assumed to be cleared. +| * Current decision level must be greater than root level. +| +| Post-conditions: +| * 'out_learnt[0]' is the asserting literal at level 'out_btlevel'. +| * If out_learnt.size() > 1 then 'out_learnt[1]' has the greatest decision level of the +| rest of literals. There may be others from the same level though. +| +|________________________________________________________________________________________________@*/ +void Solver::analyze(CRef confl, vec& out_learnt,vec&selectors, int& out_btlevel,unsigned int &lbd,unsigned int &szWithoutSelectors) { + int pathC = 0; + Lit p = lit_Undef; + + + // Generate conflict clause: + // + out_learnt.push(); // (leave room for the asserting literal) + int index = trail.size() - 1; + do { + assert(confl != CRef_Undef); // (otherwise should be UIP) + Clause& c = ca[confl]; + // Special case for binary clauses + // The first one has to be SAT + if (p != lit_Undef && c.size() == 2 && value(c[0]) == l_False) { + + assert(value(c[1]) == l_True); + Lit tmp = c[0]; + c[0] = c[1], c[1] = tmp; + } + + if (c.learnt()) { + parallelImportClauseDuringConflictAnalysis(c,confl); + claBumpActivity(c); + } else { // original clause + if (!c.getSeen()) { + originalClausesSeen++; + c.setSeen(true); + } + } + + // DYNAMIC NBLEVEL trick (see competition'09 companion paper) + if (c.learnt() && c.lbd() > 2) { + unsigned int nblevels = computeLBD(c); + if (nblevels + 1 < c.lbd()) { // improve the LBD + if (c.lbd() <= lbLBDFrozenClause) { + c.setCanBeDel(false); + } + // seems to be interesting : keep it for the next round + c.setLBD(nblevels); // Update it + } + } + + + for (int j = (p == lit_Undef) ? 0 : 1; j < c.size(); j++) { + Lit q = c[j]; + + if (!seen[var(q)]) { + if (level(var(q)) == 0) { + } else { // Here, the old case + if(!isSelector(var(q))) + varBumpActivity(var(q)); + seen[var(q)] = 1; + if (level(var(q)) >= decisionLevel()) { + pathC++; + // UPDATEVARACTIVITY trick (see competition'09 companion paper) + if (!isSelector(var(q)) && (reason(var(q)) != CRef_Undef) && ca[reason(var(q))].learnt()) + lastDecisionLevel.push(q); + } else { + if(isSelector(var(q))) { + assert(value(q) == l_False); + selectors.push(q); + } else + out_learnt.push(q); + } + } + } + } + + // Select next clause to look at: + while (!seen[var(trail[index--])]); + p = trail[index + 1]; + confl = reason(var(p)); + seen[var(p)] = 0; + pathC--; + + } while (pathC > 0); + out_learnt[0] = ~p; + + // Simplify conflict clause: + // + int i, j; + + for (int i = 0; i < selectors.size(); i++) + out_learnt.push(selectors[i]); + + out_learnt.copyTo(analyze_toclear); + if (ccmin_mode == 2) { + uint32_t abstract_level = 0; + for (i = 1; i < out_learnt.size(); i++) + abstract_level |= abstractLevel(var(out_learnt[i])); // (maintain an abstraction of levels involved in conflict) + + for (i = j = 1; i < out_learnt.size(); i++) + if (reason(var(out_learnt[i])) == CRef_Undef || !litRedundant(out_learnt[i], abstract_level)) + out_learnt[j++] = out_learnt[i]; + + } else if (ccmin_mode == 1) { + for (i = j = 1; i < out_learnt.size(); i++) { + Var x = var(out_learnt[i]); + + if (reason(x) == CRef_Undef) + out_learnt[j++] = out_learnt[i]; + else { + Clause& c = ca[reason(var(out_learnt[i]))]; + // Thanks to Siert Wieringa for this bug fix! + for (int k = ((c.size() == 2) ? 0 : 1); k < c.size(); k++) + if (!seen[var(c[k])] && level(var(c[k])) > 0) { + out_learnt[j++] = out_learnt[i]; + break; + } + } + } + } else + i = j = out_learnt.size(); + + max_literals += out_learnt.size(); + out_learnt.shrink(i - j); + tot_literals += out_learnt.size(); + + + /* *************************************** + Minimisation with binary clauses of the asserting clause + First of all : we look for small clauses + Then, we reduce clauses with small LBD. + Otherwise, this can be useless + */ + if (!incremental && out_learnt.size() <= lbSizeMinimizingClause) { + minimisationWithBinaryResolution(out_learnt); + } + // Find correct backtrack level: + // + if (out_learnt.size() == 1) + out_btlevel = 0; + else { + int max_i = 1; + // Find the first literal assigned at the next-highest level: + for (int i = 2; i < out_learnt.size(); i++) + if (level(var(out_learnt[i])) > level(var(out_learnt[max_i]))) + max_i = i; + // Swap-in this literal at index 1: + Lit p = out_learnt[max_i]; + out_learnt[max_i] = out_learnt[1]; + out_learnt[1] = p; + out_btlevel = level(var(p)); + } + if(incremental) { + szWithoutSelectors = 0; + for(int i=0;i0) break; + } + } else + szWithoutSelectors = out_learnt.size(); + + // Compute LBD + lbd = computeLBD(out_learnt,out_learnt.size()-selectors.size()); + + // UPDATEVARACTIVITY trick (see competition'09 companion paper) + if (lastDecisionLevel.size() > 0) { + for (int i = 0; i < lastDecisionLevel.size(); i++) { + if (ca[reason(var(lastDecisionLevel[i]))].lbd() < lbd) + varBumpActivity(var(lastDecisionLevel[i])); + } + lastDecisionLevel.clear(); + } + + + + for (int j = 0; j < analyze_toclear.size(); j++) seen[var(analyze_toclear[j])] = 0; // ('seen[]' is now cleared) + for (int j = 0; j < selectors.size(); j++) seen[var(selectors[j])] = 0; +} + + +// Check if 'p' can be removed. 'abstract_levels' is used to abort early if the algorithm is +// visiting literals at levels that cannot be removed later. + +bool Solver::litRedundant(Lit p, uint32_t abstract_levels) { + analyze_stack.clear(); + analyze_stack.push(p); + int top = analyze_toclear.size(); + while (analyze_stack.size() > 0) { + assert(reason(var(analyze_stack.last())) != CRef_Undef); + Clause& c = ca[reason(var(analyze_stack.last()))]; + analyze_stack.pop(); // + if (c.size() == 2 && value(c[0]) == l_False) { + assert(value(c[1]) == l_True); + Lit tmp = c[0]; + c[0] = c[1], c[1] = tmp; + } + + for (int i = 1; i < c.size(); i++) { + Lit p = c[i]; + if (!seen[var(p)]) { + if (level(var(p)) > 0) { + if (reason(var(p)) != CRef_Undef && (abstractLevel(var(p)) & abstract_levels) != 0) { + seen[var(p)] = 1; + analyze_stack.push(p); + analyze_toclear.push(p); + } else { + for (int j = top; j < analyze_toclear.size(); j++) + seen[var(analyze_toclear[j])] = 0; + analyze_toclear.shrink(analyze_toclear.size() - top); + return false; + } + } + } + } + } + + return true; +} + + +/*_________________________________________________________________________________________________ +| +| analyzeFinal : (p : Lit) -> [void] +| +| Description: +| Specialized analysis procedure to express the final conflict in terms of assumptions. +| Calculates the (possibly empty) set of assumptions that led to the assignment of 'p', and +| stores the result in 'out_conflict'. +|________________________________________________________________________________________________@*/ +void Solver::analyzeFinal(Lit p, vec& out_conflict) { + out_conflict.clear(); + out_conflict.push(p); + + if (decisionLevel() == 0) + return; + + seen[var(p)] = 1; + + for (int i = trail.size() - 1; i >= trail_lim[0]; i--) { + Var x = var(trail[i]); + if (seen[x]) { + if (reason(x) == CRef_Undef) { + assert(level(x) > 0); + out_conflict.push(~trail[i]); + } else { + Clause& c = ca[reason(x)]; + // for (int j = 1; j < c.size(); j++) Minisat (glucose 2.0) loop + // Bug in case of assumptions due to special data structures for Binary. + // Many thanks to Sam Bayless (sbayless@cs.ubc.ca) for discover this bug. + for (int j = ((c.size() == 2) ? 0 : 1); j < c.size(); j++) + if (level(var(c[j])) > 0) + seen[var(c[j])] = 1; + } + + seen[x] = 0; + } + } + + seen[var(p)] = 0; +} + +void Solver::uncheckedEnqueue(Lit p, CRef from) { + assert(value(p) == l_Undef); + assigns[var(p)] = lbool(!sign(p)); + vardata[var(p)] = mkVarData(from, decisionLevel()); + trail.push_(p); +} + +/*_________________________________________________________________________________________________ +| +| propagate : [void] -> [Clause*] +| +| Description: +| Propagates all enqueued facts. If a conflict arises, the conflicting clause is returned, +| otherwise CRef_Undef. +| +| Post-conditions: +| * the propagation queue is empty, even if there was a conflict. +|________________________________________________________________________________________________@*/ +CRef Solver::propagate() { + CRef confl = CRef_Undef; + int num_props = 0; + int previousqhead = qhead; + watches.cleanAll(); + watchesBin.cleanAll(); + unaryWatches.cleanAll(); + while (qhead < trail.size()) { + Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate. + vec& ws = watches[p]; + Watcher *i, *j, *end; + num_props++; + + + // First, Propagate binary clauses + vec& wbin = watchesBin[p]; + + for (int k = 0; k < wbin.size(); k++) { + + Lit imp = wbin[k].blocker; + + if (value(imp) == l_False) { + return wbin[k].cref; + } + + if (value(imp) == l_Undef) { + uncheckedEnqueue(imp, wbin[k].cref); + } + } + + // Now propagate other 2-watched clauses + for (i = j = (Watcher*) ws, end = i + ws.size(); i != end;) { + // Try to avoid inspecting the clause: + Lit blocker = i->blocker; + if (value(blocker) == l_True) { + *j++ = *i++; + continue; + } + + // Make sure the false literal is data[1]: + CRef cr = i->cref; + Clause& c = ca[cr]; + assert(!c.getOneWatched()); + Lit false_lit = ~p; + if (c[0] == false_lit) + c[0] = c[1], c[1] = false_lit; + assert(c[1] == false_lit); + i++; + + // If 0th watch is true, then clause is already satisfied. + Lit first = c[0]; + Watcher w = Watcher(cr, first); + if (first != blocker && value(first) == l_True) { + + *j++ = w; + continue; + } + if(incremental) { // ----------------- INCREMENTAL MODE + int choosenPos = -1; + for (int k = 2; k < c.size(); k++) { + + if (value(c[k]) != l_False){ + if(decisionLevel()>assumptions.size()) { + choosenPos = k; + break; + } else { + choosenPos = k; + + if(value(c[k])==l_True || !isSelector(var(c[k]))) { + break; + } + } + + } + } + if(choosenPos!=-1) { + c[1] = c[choosenPos]; c[choosenPos] = false_lit; + watches[~c[1]].push(w); + goto NextClause; } + } else { // ----------------- DEFAULT MODE (NOT INCREMENTAL) + for (int k = 2; k < c.size(); k++) { + + if (value(c[k]) != l_False){ + c[1] = c[k]; c[k] = false_lit; + watches[~c[1]].push(w); + goto NextClause; } + } + } + + // Did not find watch -- clause is unit under assignment: + *j++ = w; + if (value(first) == l_False) { + confl = cr; + qhead = trail.size(); + // Copy the remaining watches: + while (i < end) + *j++ = *i++; + } else { + uncheckedEnqueue(first, cr); + + + } +NextClause: + ; + } + ws.shrink(i - j); + + // unaryWatches "propagation" + if (useUnaryWatched && confl == CRef_Undef) { + confl = propagateUnaryWatches(p); + + } + + } + + + + propagations += num_props; + simpDB_props -= num_props; + + return confl; +} + +/*_________________________________________________________________________________________________ +| +| propagateUnaryWatches : [Lit] -> [Clause*] +| +| Description: +| Propagates unary watches of Lit p, return a conflict +| otherwise CRef_Undef +| +|________________________________________________________________________________________________@*/ + +CRef Solver::propagateUnaryWatches(Lit p) { + CRef confl= CRef_Undef; + Watcher *i, *j, *end; + vec& ws = unaryWatches[p]; + for (i = j = (Watcher*) ws, end = i + ws.size(); i != end;) { + // Try to avoid inspecting the clause: + Lit blocker = i->blocker; + if (value(blocker) == l_True) { + *j++ = *i++; + continue; + } + + // Make sure the false literal is data[1]: + CRef cr = i->cref; + Clause& c = ca[cr]; + assert(c.getOneWatched()); + Lit false_lit = ~p; + assert(c[0] == false_lit); // this is unary watch... No other choice if "propagated" + //if (c[0] == false_lit) + //c[0] = c[1], c[1] = false_lit; + //assert(c[1] == false_lit); + i++; + Watcher w = Watcher(cr, c[0]); + for (int k = 1; k < c.size(); k++) { + if (value(c[k]) != l_False) { + c[0] = c[k]; + c[k] = false_lit; + unaryWatches[~c[0]].push(w); + goto NextClauseUnary; + } + } + + // Did not find watch -- clause is empty under assignment: + *j++ = w; + + confl = cr; + qhead = trail.size(); + // Copy the remaining watches: + while (i < end) + *j++ = *i++; + + // We can add it now to the set of clauses when backtracking + //printf("*"); + if (promoteOneWatchedClause) { + nbPromoted++; + // Let's find the two biggest decision levels in the clause s.t. it will correctly be propagated when we'll backtrack + int maxlevel = -1; + int index = -1; + for (int k = 1; k < c.size(); k++) { + assert(value(c[k]) == l_False); + assert(level(var(c[k])) <= level(var(c[0]))); + if (level(var(c[k])) > maxlevel) { + index = k; + maxlevel = level(var(c[k])); + } + } + detachClausePurgatory(cr, true); // TODO: check that the cleanAll is ok (use ",true" otherwise) + assert(index != -1); + Lit tmp = c[1]; + c[1] = c[index], c[index] = tmp; + attachClause(cr); + // TODO used in function ParallelSolver::reportProgressArrayImports + //Override :-( + //goodImportsFromThreads[ca[cr].importedFrom()]++; + ca[cr].setOneWatched(false); + ca[cr].setExported(2); + } +NextClauseUnary: + ; + } + ws.shrink(i - j); + + return confl; +} + +/*_________________________________________________________________________________________________ +| +| reduceDB : () -> [void] +| +| Description: +| Remove half of the learnt clauses, minus the clauses locked by the current assignment. Locked +| clauses are clauses that are reason to some assignment. Binary clauses are never removed. +|________________________________________________________________________________________________@*/ + + +void Solver::reduceDB() +{ + + int i, j; + nbReduceDB++; + sort(learnts, reduceDB_lt(ca)); + + // We have a lot of "good" clauses, it is difficult to compare them. Keep more ! + if(ca[learnts[learnts.size() / RATIOREMOVECLAUSES]].lbd()<=3) nbclausesbeforereduce +=specialIncReduceDB; + // Useless :-) + if(ca[learnts.last()].lbd()<=5) nbclausesbeforereduce +=specialIncReduceDB; + + + // Don't delete binary or locked clauses. From the rest, delete clauses from the first half + // Keep clauses which seem to be usefull (their lbd was reduce during this sequence) + + int limit = learnts.size() / 2; + + for (i = j = 0; i < learnts.size(); i++){ + Clause& c = ca[learnts[i]]; + if (c.lbd()>2 && c.size() > 2 && c.canBeDel() && !locked(c) && (i < limit)) { + removeClause(learnts[i]); + nbRemovedClauses++; + } + else { + if(!c.canBeDel()) limit++; //we keep c, so we can delete an other clause + c.setCanBeDel(true); // At the next step, c can be delete + learnts[j++] = learnts[i]; + } + } + learnts.shrink(i - j); + checkGarbage(); +} + + +void Solver::removeSatisfied(vec& cs) { + + int i, j; + for (i = j = 0; i < cs.size(); i++) { + Clause& c = ca[cs[i]]; + + + if (satisfied(c)) + if (c.getOneWatched()) + removeClause(cs[i], true); + else + removeClause(cs[i]); + else + cs[j++] = cs[i]; + } + cs.shrink(i - j); +} + +void Solver::rebuildOrderHeap() { + vec vs; + for (Var v = 0; v < nVars(); v++) + if (decision[v] && value(v) == l_Undef) + vs.push(v); + order_heap.build(vs); + +} + +/*_________________________________________________________________________________________________ +| +| simplify : [void] -> [bool] +| +| Description: +| Simplify the clause database according to the current top-level assigment. Currently, the only +| thing done here is the removal of satisfied clauses, but more things can be put here. +|________________________________________________________________________________________________@*/ +bool Solver::simplify() { + assert(decisionLevel() == 0); + + if (!ok) return ok = false; + else { + CRef cr = propagate(); + if (cr != CRef_Undef) { + return ok = false; + } + } + + + if (nAssigns() == simpDB_assigns || (simpDB_props > 0)) + return true; + + // Remove satisfied clauses: + removeSatisfied(learnts); + removeSatisfied(unaryWatchedClauses); + if (remove_satisfied) // Can be turned off. + removeSatisfied(clauses); + checkGarbage(); + rebuildOrderHeap(); + + simpDB_assigns = nAssigns(); + simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now) + + return true; +} + + +/*_________________________________________________________________________________________________ +| +| search : (nof_conflicts : int) (params : const SearchParams&) -> [lbool] +| +| Description: +| Search for a model the specified number of conflicts. +| NOTE! Use negative value for 'nof_conflicts' indicate infinity. +| +| Output: +| 'l_True' if a partial assigment that is consistent with respect to the clauseset is found. If +| all variables are decision variables, this means that the clause set is satisfiable. 'l_False' +| if the clause set is unsatisfiable. 'l_Undef' if the bound on number of conflicts is reached. +|________________________________________________________________________________________________@*/ +lbool Solver::search(int nof_conflicts) { + assert(ok); + int backtrack_level; + int conflictC = 0; + vec learnt_clause, selectors; + unsigned int nblevels,szWithoutSelectors = 0; + bool blocked = false; + starts++; + for (;;) { + if (decisionLevel() == 0) { // We import clauses FIXME: ensure that we will import clauses enventually (restart after some point) + parallelImportUnaryClauses(); + + if (parallelImportClauses()) + return l_False; + + } + CRef confl = propagate(); + + if (confl != CRef_Undef) { + if(parallelJobIsFinished()) + return l_Undef; + + + sumDecisionLevels += decisionLevel(); + // CONFLICT + conflicts++; + conflictC++; + conflictsRestarts++; + if (conflicts % 5000 == 0 && var_decay < max_var_decay) + var_decay += 0.01; + + if (verbosity >= 1 && conflicts % verbEveryConflicts == 0) { + printf("c | %8d %7d %5d | %7d %8d %8d | %5d %8d %6d %8d | %6.3f %% |\n", + (int) starts, (int) nbstopsrestarts, (int) (conflicts / starts), + (int) dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]), nClauses(), (int) clauses_literals, + (int) nbReduceDB, nLearnts(), (int) nbDL2, (int) nbRemovedClauses, progressEstimate()*100); + } + if (decisionLevel() == 0) { + return l_False; + + } + + trailQueue.push(trail.size()); + // BLOCK RESTART (CP 2012 paper) + if (conflictsRestarts > LOWER_BOUND_FOR_BLOCKING_RESTART && lbdQueue.isvalid() && trail.size() > R * trailQueue.getavg()) { + lbdQueue.fastclear(); + nbstopsrestarts++; + if (!blocked) { + lastblockatrestart = starts; + nbstopsrestartssame++; + blocked = true; + } + } + + learnt_clause.clear(); + selectors.clear(); + + analyze(confl, learnt_clause, selectors, backtrack_level, nblevels,szWithoutSelectors); + + lbdQueue.push(nblevels); + sumLBD += nblevels; + + cancelUntil(backtrack_level); + + if (certifiedUNSAT) { + for (int i = 0; i < learnt_clause.size(); i++) + fprintf(certifiedOutput, "%i ", (var(learnt_clause[i]) + 1) * + (-2 * sign(learnt_clause[i]) + 1)); + fprintf(certifiedOutput, "0\n"); + } + + + if (learnt_clause.size() == 1) { + uncheckedEnqueue(learnt_clause[0]); + nbUn++; + parallelExportUnaryClause(learnt_clause[0]); + } else { + CRef cr = ca.alloc(learnt_clause, true); + ca[cr].setLBD(nblevels); + ca[cr].setOneWatched(false); + ca[cr].setSizeWithoutSelectors(szWithoutSelectors); + if (nblevels <= 2) nbDL2++; // stats + if (ca[cr].size() == 2) nbBin++; // stats + learnts.push(cr); + attachClause(cr); + lastLearntClause = cr; // Use in multithread (to hard to put inside ParallelSolver) + parallelExportClauseDuringSearch(ca[cr]); + claBumpActivity(ca[cr]); + uncheckedEnqueue(learnt_clause[0], cr); + + } + varDecayActivity(); + claDecayActivity(); + + + } else { + // Our dynamic restart, see the SAT09 competition compagnion paper + if ( + (lbdQueue.isvalid() && ((lbdQueue.getavg() * K) > (sumLBD / conflictsRestarts)))) { + lbdQueue.fastclear(); + progress_estimate = progressEstimate(); + int bt = 0; + if(incremental) // DO NOT BACKTRACK UNTIL 0.. USELESS + bt = (decisionLevel()= ((unsigned int) curRestart * nbclausesbeforereduce)) { + + if (learnts.size() > 0) { + curRestart = (conflicts / nbclausesbeforereduce) + 1; + reduceDB(); + if (!panicModeIsEnabled()) + nbclausesbeforereduce += incReduceDB; + } + } + + lastLearntClause = CRef_Undef; + Lit next = lit_Undef; + while (decisionLevel() < assumptions.size()) { + // Perform user provided assumption: + Lit p = assumptions[decisionLevel()]; + if (value(p) == l_True) { + // Dummy decision level: + newDecisionLevel(); + } else if (value(p) == l_False) { + analyzeFinal(~p, conflict); + return l_False; + } else { + next = p; + break; + } + } + + if (next == lit_Undef) { + // New variable decision: + decisions++; + next = pickBranchLit(); + if (next == lit_Undef) { + if (verbosity >= 1) { + printf("c last restart ## conflicts : %d %d \n", conflictC, decisionLevel()); + } + // Model found: + return l_True; + } + } + + // Increase decision level and enqueue 'next' + newDecisionLevel(); + uncheckedEnqueue(next); + } + } +} + +double Solver::progressEstimate() const { + double progress = 0; + double F = 1.0 / nVars(); + + for (int i = 0; i <= decisionLevel(); i++) { + int beg = i == 0 ? 0 : trail_lim[i - 1]; + int end = i == decisionLevel() ? trail.size() : trail_lim[i]; + progress += pow(F, i) * (end - beg); + } + + return progress / nVars(); +} + +void Solver::printIncrementalStats() { + + printf("c---------- Glucose Stats -------------------------\n"); + printf("c restarts : %" PRIu64"\n", starts); + printf("c nb ReduceDB : %" PRIu64"\n", nbReduceDB); + printf("c nb removed Clauses : %" PRIu64"\n", nbRemovedClauses); + printf("c nb learnts DL2 : %" PRIu64"\n", nbDL2); + printf("c nb learnts size 2 : %" PRIu64"\n", nbBin); + printf("c nb learnts size 1 : %" PRIu64"\n", nbUn); + + printf("c conflicts : %" PRIu64"\n", conflicts); + printf("c decisions : %" PRIu64"\n", decisions); + printf("c propagations : %" PRIu64"\n", propagations); + + printf("\nc SAT Calls : %d in %g seconds\n",nbSatCalls,totalTime4Sat); + printf("c UNSAT Calls : %d in %g seconds\n",nbUnsatCalls,totalTime4Unsat); + + printf("c--------------------------------------------------\n"); +} + +// NOTE: assumptions passed in member-variable 'assumptions'. + +lbool Solver::solve_(bool do_simp, bool turn_off_simp) // Parameters are useless in core but useful for SimpSolver.... +{ + + if(incremental && certifiedUNSAT) { + printf("Can not use incremental and certified unsat in the same time\n"); + exit(-1); + } + + model.clear(); + conflict.clear(); + if (!ok) return l_False; + double curTime = cpuTime(); + + solves++; + + + + lbool status = l_Undef; + if(!incremental && verbosity>=1) { + printf("c ========================================[ MAGIC CONSTANTS ]==============================================\n"); + printf("c | Constants are supposed to work well together :-) |\n"); + printf("c | however, if you find better choices, please let us known... |\n"); + printf("c |-------------------------------------------------------------------------------------------------------|\n"); + printf("c | | | |\n"); + printf("c | - Restarts: | - Reduce Clause DB: | - Minimize Asserting: |\n"); + printf("c | * LBD Queue : %6d | * First : %6d | * size < %3d |\n",lbdQueue.maxSize(),nbclausesbeforereduce,lbSizeMinimizingClause); + printf("c | * Trail Queue : %6d | * Inc : %6d | * lbd < %3d |\n",trailQueue.maxSize(),incReduceDB,lbLBDMinimizingClause); + printf("c | * K : %6.2f | * Special : %6d | |\n",K,specialIncReduceDB); + printf("c | * R : %6.2f | * Protected : (lbd)< %2d | |\n",R,lbLBDFrozenClause); + printf("c | | | |\n"); + printf("c ==================================[ Search Statistics (every %6d conflicts) ]=========================\n",verbEveryConflicts); + printf("c | |\n"); + + printf("c | RESTARTS | ORIGINAL | LEARNT | Progress |\n"); + printf("c | NB Blocked Avg Cfc | Vars Clauses Literals | Red Learnts LBD2 Removed | |\n"); + printf("c =========================================================================================================\n"); + } + + // Search: + int curr_restarts = 0; + while (status == l_Undef){ + status = search(0); // the parameter is useless in glucose, kept to allow modifications + + if (!withinBudget()) break; + curr_restarts++; + } + + if (!incremental && verbosity >= 1) + printf("c =========================================================================================================\n"); + + if (certifiedUNSAT){ // Want certified output + if (status == l_False) + fprintf(certifiedOutput, "0\n"); + fclose(certifiedOutput); + } + + + if (status == l_True){ + // Extend & copy model: + model.growTo(nVars()); + for (int i = 0; i < nVars(); i++) model[i] = value(i); + }else if (status == l_False && conflict.size() == 0) + ok = false; + + + + cancelUntil(0); + + + double finalTime = cpuTime(); + if(status==l_True) { + nbSatCalls++; + totalTime4Sat +=(finalTime-curTime); + } + if(status==l_False) { + nbUnsatCalls++; + totalTime4Unsat +=(finalTime-curTime); + } + + + return status; + +} + + + + + +//================================================================================================= +// Writing CNF to DIMACS: +// +// FIXME: this needs to be rewritten completely. + +static Var mapVar(Var x, vec& map, Var& max) { + if (map.size() <= x || map[x] == -1) { + map.growTo(x + 1, -1); + map[x] = max++; + } + return map[x]; +} + +void Solver::toDimacs(FILE* f, Clause& c, vec& map, Var& max) { + if (satisfied(c)) return; + + for (int i = 0; i < c.size(); i++) + if (value(c[i]) != l_False) + fprintf(f, "%s%d ", sign(c[i]) ? "-" : "", mapVar(var(c[i]), map, max) + 1); + fprintf(f, "0\n"); +} + +void Solver::toDimacs(const char *file, const vec& assumps) { + FILE* f = fopen(file, "wr"); + if (f == NULL) + fprintf(stderr, "could not open file %s\n", file), exit(1); + toDimacs(f, assumps); + fclose(f); +} + +void Solver::toDimacs(FILE* f, const vec& assumps) { + // Handle case when solver is in contradictory state: + if (!ok) { + fprintf(f, "p cnf 1 2\n1 0\n-1 0\n"); + return; + } + + vec map; + Var max = 0; + + // Cannot use removeClauses here because it is not safe + // to deallocate them at this point. Could be improved. + int cnt = 0; + for (int i = 0; i < clauses.size(); i++) + if (!satisfied(ca[clauses[i]])) + cnt++; + + for (int i = 0; i < clauses.size(); i++) + if (!satisfied(ca[clauses[i]])) { + Clause& c = ca[clauses[i]]; + for (int j = 0; j < c.size(); j++) + if (value(c[j]) != l_False) + mapVar(var(c[j]), map, max); + } + + // Assumptions are added as unit clauses: + cnt += assumptions.size(); + + fprintf(f, "p cnf %d %d\n", max, cnt); + + for (int i = 0; i < assumptions.size(); i++) { + assert(value(assumptions[i]) != l_False); + fprintf(f, "%s%d 0\n", sign(assumptions[i]) ? "-" : "", mapVar(var(assumptions[i]), map, max) + 1); + } + + for (int i = 0; i < clauses.size(); i++) + toDimacs(f, ca[clauses[i]], map, max); + + if (verbosity > 0) + printf("Wrote %d clauses with %d variables.\n", cnt, max); +} + + +//================================================================================================= +// Garbage Collection methods: + +void Solver::relocAll(ClauseAllocator& to) { + // All watchers: + // + // for (int i = 0; i < watches.size(); i++) + watches.cleanAll(); + watchesBin.cleanAll(); + unaryWatches.cleanAll(); + for (int v = 0; v < nVars(); v++) + for (int s = 0; s < 2; s++) { + Lit p = mkLit(v, s); + // printf(" >>> RELOCING: %s%d\n", sign(p)?"-":"", var(p)+1); + vec& ws = watches[p]; + for (int j = 0; j < ws.size(); j++) + ca.reloc(ws[j].cref, to); + vec& ws2 = watchesBin[p]; + for (int j = 0; j < ws2.size(); j++) + ca.reloc(ws2[j].cref, to); + vec& ws3 = unaryWatches[p]; + for (int j = 0; j < ws3.size(); j++) + ca.reloc(ws3[j].cref, to); + } + + // All reasons: + // + for (int i = 0; i < trail.size(); i++) { + Var v = var(trail[i]); + + if (reason(v) != CRef_Undef && (ca[reason(v)].reloced() || locked(ca[reason(v)]))) + ca.reloc(vardata[v].reason, to); + } + + // All learnt: + // + for (int i = 0; i < learnts.size(); i++) + ca.reloc(learnts[i], to); + + // All original: + // + for (int i = 0; i < clauses.size(); i++) + ca.reloc(clauses[i], to); + + for (int i = 0; i < unaryWatchedClauses.size(); i++) + ca.reloc(unaryWatchedClauses[i], to); +} + + + +void Solver::garbageCollect() { + // Initialize the next region to a size corresponding to the estimated utilization degree. This + // is not precise but should avoid some unnecessary reallocations for the new region: + ClauseAllocator to(ca.size() - ca.wasted()); + + relocAll(to); + if (verbosity >= 2) + printf("| Garbage collection: %12d bytes => %12d bytes |\n", + ca.size() * ClauseAllocator::Unit_Size, to.size() * ClauseAllocator::Unit_Size); + to.moveTo(ca); +} + +//-------------------------------------------------------------- +// Functions related to MultiThread. +// Useless in case of single core solver (aka original glucose) +// Keep them empty if you just use core solver +//-------------------------------------------------------------- + +bool Solver::panicModeIsEnabled() { + return false; +} + +void Solver::parallelImportUnaryClauses() { +} + +bool Solver::parallelImportClauses() { + return false; +} + + +void Solver::parallelExportUnaryClause(Lit p) { +} +void Solver::parallelExportClauseDuringSearch(Clause &c) { +} + +bool Solver::parallelJobIsFinished() { + // Parallel: another job has finished let's quit + return false; +} + +void Solver::parallelImportClauseDuringConflictAnalysis(Clause &c,CRef confl) { +} diff --git a/packages/bee/glucose-4/core/Solver.h b/packages/bee/glucose-4/core/Solver.h new file mode 100644 index 000000000..63d531615 --- /dev/null +++ b/packages/bee/glucose-4/core/Solver.h @@ -0,0 +1,581 @@ +/***************************************************************************************[Solver.h] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#ifndef Glucose_Solver_h +#define Glucose_Solver_h + +#include "mtl/Heap.h" +#include "mtl/Alg.h" +#include "utils/Options.h" +#include "core/SolverTypes.h" +#include "core/BoundedQueue.h" +#include "core/Constants.h" +#include "mtl/Clone.h" + + +namespace Glucose { + +//================================================================================================= +// Solver -- the main class: + +class Solver : public Clone { + + friend class SolverConfiguration; + +public: + + // Constructor/Destructor: + // + Solver(); + Solver(const Solver &s); + + virtual ~Solver(); + + /** + * Clone function + */ + virtual Clone* clone() const { + return new Solver(*this); + } + + // Problem specification: + // + virtual Var newVar (bool polarity = true, bool dvar = true); // Add a new variable with parameters specifying variable mode. + bool addClause (const vec& ps); // Add a clause to the solver. + bool addEmptyClause(); // Add the empty clause, making the solver contradictory. + bool addClause (Lit p); // Add a unit clause to the solver. + bool addClause (Lit p, Lit q); // Add a binary clause to the solver. + bool addClause (Lit p, Lit q, Lit r); // Add a ternary clause to the solver. + virtual bool addClause_( vec& ps); // Add a clause to the solver without making superflous internal copy. Will + // change the passed vector 'ps'. + + // Solving: + // + bool simplify (); // Removes already satisfied clauses. + bool solve (const vec& assumps); // Search for a model that respects a given set of assumptions. + lbool solveLimited (const vec& assumps); // Search for a model that respects a given set of assumptions (With resource constraints). + bool solve (); // Search without assumptions. + bool solve (Lit p); // Search for a model that respects a single assumption. + bool solve (Lit p, Lit q); // Search for a model that respects two assumptions. + bool solve (Lit p, Lit q, Lit r); // Search for a model that respects three assumptions. + bool okay () const; // FALSE means solver is in a conflicting state + + // Convenience versions of 'toDimacs()': + void toDimacs (FILE* f, const vec& assumps); // Write CNF to file in DIMACS-format. + void toDimacs (const char *file, const vec& assumps); + void toDimacs (FILE* f, Clause& c, vec& map, Var& max); + void toDimacs (const char* file); + void toDimacs (const char* file, Lit p); + void toDimacs (const char* file, Lit p, Lit q); + void toDimacs (const char* file, Lit p, Lit q, Lit r); + + // Display clauses and literals + void printLit(Lit l); + void printClause(CRef c); + void printInitialClause(CRef c); + + // Variable mode: + // + void setPolarity (Var v, bool b); // Declare which polarity the decision heuristic should use for a variable. Requires mode 'polarity_user'. + void setDecisionVar (Var v, bool b); // Declare if a variable should be eligible for selection in the decision heuristic. + + // Read state: + // + lbool value (Var x) const; // The current value of a variable. + lbool value (Lit p) const; // The current value of a literal. + lbool modelValue (Var x) const; // The value of a variable in the last model. The last call to solve must have been satisfiable. + lbool modelValue (Lit p) const; // The value of a literal in the last model. The last call to solve must have been satisfiable. + int nAssigns () const; // The current number of assigned literals. + int nClauses () const; // The current number of original clauses. + int nLearnts () const; // The current number of learnt clauses. + int nVars () const; // The current number of variables. + int nFreeVars () const; + + inline char valuePhase(Var v) {return polarity[v];} + + // Incremental mode + void setIncrementalMode(); + void initNbInitialVars(int nb); + void printIncrementalStats(); + bool isIncremental(); + // Resource contraints: + // + void setConfBudget(int64_t x); + void setPropBudget(int64_t x); + void budgetOff(); + void interrupt(); // Trigger a (potentially asynchronous) interruption of the solver. + void clearInterrupt(); // Clear interrupt indicator flag. + + // Memory managment: + // + virtual void garbageCollect(); + void checkGarbage(double gf); + void checkGarbage(); + + // Extra results: (read-only member variable) + // + vec model; // If problem is satisfiable, this vector contains the model (if any). + vec conflict; // If problem is unsatisfiable (possibly under assumptions), + // this vector represent the final conflict clause expressed in the assumptions. + + // Mode of operation: + // + int verbosity; + int verbEveryConflicts; + int showModel; + + // Constants For restarts + double K; + double R; + double sizeLBDQueue; + double sizeTrailQueue; + + // Constants for reduce DB + int firstReduceDB; + int incReduceDB; + int specialIncReduceDB; + unsigned int lbLBDFrozenClause; + + // Constant for reducing clause + int lbSizeMinimizingClause; + unsigned int lbLBDMinimizingClause; + + // Constant for heuristic + double var_decay; + double max_var_decay; + double clause_decay; + double random_var_freq; + double random_seed; + int ccmin_mode; // Controls conflict clause minimization (0=none, 1=basic, 2=deep). + int phase_saving; // Controls the level of phase saving (0=none, 1=limited, 2=full). + bool rnd_pol; // Use random polarities for branching heuristics. + bool rnd_init_act; // Initialize variable activities with a small random value. + + // Constant for Memory managment + double garbage_frac; // The fraction of wasted memory allowed before a garbage collection is triggered. + + // Certified UNSAT ( Thanks to Marijn Heule) + FILE* certifiedOutput; + bool certifiedUNSAT; + + // Panic mode. + // Save memory + uint32_t panicModeLastRemoved, panicModeLastRemovedShared; + + bool useUnaryWatched; // Enable unary watched literals + bool promoteOneWatchedClause; // One watched clauses are promotted to two watched clauses if found empty + + // Functions useful for multithread solving + // Useless in the sequential case + // Overide in ParallelSolver + virtual void parallelImportClauseDuringConflictAnalysis(Clause &c,CRef confl); + virtual bool parallelImportClauses(); // true if the empty clause was received + virtual void parallelImportUnaryClauses(); + virtual void parallelExportUnaryClause(Lit p); + virtual void parallelExportClauseDuringSearch(Clause &c); + virtual bool parallelJobIsFinished(); + virtual bool panicModeIsEnabled(); + + + + // Statistics: (read-only member variable) + uint64_t nbPromoted; // Number of clauses from unary to binary watch scheme + uint64_t originalClausesSeen; // Number of original clauses seen + uint64_t sumDecisionLevels; + // + uint64_t nbRemovedClauses,nbRemovedUnaryWatchedClauses, nbReducedClauses,nbDL2,nbBin,nbUn,nbReduceDB,solves, starts, decisions, rnd_decisions, propagations, conflicts,conflictsRestarts,nbstopsrestarts,nbstopsrestartssame,lastblockatrestart; + uint64_t dec_vars, clauses_literals, learnts_literals, max_literals, tot_literals; + +protected: + + long curRestart; + // Helper structures: + // + struct VarData { CRef reason; int level; }; + static inline VarData mkVarData(CRef cr, int l){ VarData d = {cr, l}; return d; } + + struct Watcher { + CRef cref; + Lit blocker; + Watcher(CRef cr, Lit p) : cref(cr), blocker(p) {} + bool operator==(const Watcher& w) const { return cref == w.cref; } + bool operator!=(const Watcher& w) const { return cref != w.cref; } +/* Watcher &operator=(Watcher w) { + this->cref = w.cref; + this->blocker = w.blocker; + return *this; + } +*/ + }; + + struct WatcherDeleted + { + const ClauseAllocator& ca; + WatcherDeleted(const ClauseAllocator& _ca) : ca(_ca) {} + bool operator()(const Watcher& w) const { return ca[w.cref].mark() == 1; } + }; + + struct VarOrderLt { + const vec& activity; + bool operator () (Var x, Var y) const { return activity[x] > activity[y]; } + VarOrderLt(const vec& act) : activity(act) { } + }; + + + // Solver state: + // + int lastIndexRed; + bool ok; // If FALSE, the constraints are already unsatisfiable. No part of the solver state may be used! + double cla_inc; // Amount to bump next clause with. + vec activity; // A heuristic measurement of the activity of a variable. + double var_inc; // Amount to bump next variable with. + OccLists, WatcherDeleted> + watches; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true). + OccLists, WatcherDeleted> + watchesBin; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true). + OccLists, WatcherDeleted> + unaryWatches; // Unary watch scheme (clauses are seen when they become empty + vec clauses; // List of problem clauses. + vec learnts; // List of learnt clauses. + vec unaryWatchedClauses; // List of imported clauses (after the purgatory) // TODO put inside ParallelSolver + + vec assigns; // The current assignments. + vec polarity; // The preferred polarity of each variable. + vec decision; // Declares if a variable is eligible for selection in the decision heuristic. + vec trail; // Assignment stack; stores all assigments made in the order they were made. + vec nbpos; + vec trail_lim; // Separator indices for different decision levels in 'trail'. + vec vardata; // Stores reason and level for each variable. + int qhead; // Head of queue (as index into the trail -- no more explicit propagation queue in MiniSat). + int simpDB_assigns; // Number of top-level assignments since last execution of 'simplify()'. + int64_t simpDB_props; // Remaining number of propagations that must be made before next execution of 'simplify()'. + vec assumptions; // Current set of assumptions provided to solve by the user. + Heap order_heap; // A priority queue of variables ordered with respect to the variable activity. + double progress_estimate;// Set by 'search()'. + bool remove_satisfied; // Indicates whether possibly inefficient linear scan for satisfied clauses should be performed in 'simplify'. + bool reduceOnSize; + int reduceOnSizeSize; // See XMinisat paper + vec permDiff; // permDiff[var] contains the current conflict number... Used to count the number of LBD + + + // UPDATEVARACTIVITY trick (see competition'09 companion paper) + vec lastDecisionLevel; + + ClauseAllocator ca; + + int nbclausesbeforereduce; // To know when it is time to reduce clause database + + // Used for restart strategies + bqueue trailQueue,lbdQueue; // Bounded queues for restarts. + float sumLBD; // used to compute the global average of LBD. Restarts... + int sumAssumptions; + CRef lastLearntClause; + + + // Temporaries (to reduce allocation overhead). Each variable is prefixed by the method in which it is + // used, exept 'seen' wich is used in several places. + // + vec seen; + vec analyze_stack; + vec analyze_toclear; + vec add_tmp; + unsigned int MYFLAG; + + // Initial reduceDB strategy + double max_learnts; + double learntsize_adjust_confl; + int learntsize_adjust_cnt; + + // Resource contraints: + // + int64_t conflict_budget; // -1 means no budget. + int64_t propagation_budget; // -1 means no budget. + bool asynch_interrupt; + + // Variables added for incremental mode + int incremental; // Use incremental SAT Solver + int nbVarsInitialFormula; // nb VAR in formula without assumptions (incremental SAT) + double totalTime4Sat,totalTime4Unsat; + int nbSatCalls,nbUnsatCalls; + vec assumptionPositions,initialPositions; + + + // Main internal methods: + // + void insertVarOrder (Var x); // Insert a variable in the decision order priority queue. + Lit pickBranchLit (); // Return the next decision variable. + void newDecisionLevel (); // Begins a new decision level. + void uncheckedEnqueue (Lit p, CRef from = CRef_Undef); // Enqueue a literal. Assumes value of literal is undefined. + bool enqueue (Lit p, CRef from = CRef_Undef); // Test if fact 'p' contradicts current state, enqueue otherwise. + CRef propagate (); // Perform unit propagation. Returns possibly conflicting clause. + CRef propagateUnaryWatches(Lit p); // Perform propagation on unary watches of p, can find only conflicts + void cancelUntil (int level); // Backtrack until a certain level. + void analyze (CRef confl, vec& out_learnt, vec & selectors, int& out_btlevel,unsigned int &nblevels,unsigned int &szWithoutSelectors); // (bt = backtrack) + void analyzeFinal (Lit p, vec& out_conflict); // COULD THIS BE IMPLEMENTED BY THE ORDINARIY "analyze" BY SOME REASONABLE GENERALIZATION? + bool litRedundant (Lit p, uint32_t abstract_levels); // (helper method for 'analyze()') + lbool search (int nof_conflicts); // Search for a given number of conflicts. + virtual lbool solve_ (bool do_simp = true, bool turn_off_simp = false); // Main solve method (assumptions given in 'assumptions'). + virtual void reduceDB (); // Reduce the set of learnt clauses. + void removeSatisfied (vec& cs); // Shrink 'cs' to contain only non-satisfied clauses. + void rebuildOrderHeap (); + + // Maintaining Variable/Clause activity: + // + void varDecayActivity (); // Decay all variables with the specified factor. Implemented by increasing the 'bump' value instead. + void varBumpActivity (Var v, double inc); // Increase a variable with the current 'bump' value. + void varBumpActivity (Var v); // Increase a variable with the current 'bump' value. + void claDecayActivity (); // Decay all clauses with the specified factor. Implemented by increasing the 'bump' value instead. + void claBumpActivity (Clause& c); // Increase a clause with the current 'bump' value. + + // Operations on clauses: + // + void attachClause (CRef cr); // Attach a clause to watcher lists. + void detachClause (CRef cr, bool strict = false); // Detach a clause to watcher lists. + void detachClausePurgatory(CRef cr, bool strict = false); + void attachClausePurgatory(CRef cr); + void removeClause (CRef cr, bool inPurgatory = false); // Detach and free a clause. + bool locked (const Clause& c) const; // Returns TRUE if a clause is a reason for some implication in the current state. + bool satisfied (const Clause& c) const; // Returns TRUE if a clause is satisfied in the current state. + + unsigned int computeLBD(const vec & lits,int end=-1); + unsigned int computeLBD(const Clause &c); + void minimisationWithBinaryResolution(vec &out_learnt); + + virtual void relocAll (ClauseAllocator& to); + + // Misc: + // + int decisionLevel () const; // Gives the current decisionlevel. + uint32_t abstractLevel (Var x) const; // Used to represent an abstraction of sets of decision levels. + CRef reason (Var x) const; + int level (Var x) const; + double progressEstimate () const; // DELETE THIS ?? IT'S NOT VERY USEFUL ... + bool withinBudget () const; + inline bool isSelector(Var v) {return (incremental && v>nbVarsInitialFormula);} + + // Static helpers: + // + + // Returns a random float 0 <= x < 1. Seed must never be 0. + static inline double drand(double& seed) { + seed *= 1389796; + int q = (int)(seed / 2147483647); + seed -= (double)q * 2147483647; + return seed / 2147483647; } + + // Returns a random integer 0 <= x < size. Seed must never be 0. + static inline int irand(double& seed, int size) { + return (int)(drand(seed) * size); } +}; + + +//================================================================================================= +// Implementation of inline methods: + +inline CRef Solver::reason(Var x) const { return vardata[x].reason; } +inline int Solver::level (Var x) const { return vardata[x].level; } + +inline void Solver::insertVarOrder(Var x) { + if (!order_heap.inHeap(x) && decision[x]) order_heap.insert(x); } + +inline void Solver::varDecayActivity() { var_inc *= (1 / var_decay); } +inline void Solver::varBumpActivity(Var v) { varBumpActivity(v, var_inc); } +inline void Solver::varBumpActivity(Var v, double inc) { + if ( (activity[v] += inc) > 1e100 ) { + // Rescale: + for (int i = 0; i < nVars(); i++) + activity[i] *= 1e-100; + var_inc *= 1e-100; } + + // Update order_heap with respect to new activity: + if (order_heap.inHeap(v)) + order_heap.decrease(v); } + +inline void Solver::claDecayActivity() { cla_inc *= (1 / clause_decay); } +inline void Solver::claBumpActivity (Clause& c) { + if ( (c.activity() += cla_inc) > 1e20 ) { + // Rescale: + for (int i = 0; i < learnts.size(); i++) + ca[learnts[i]].activity() *= 1e-20; + cla_inc *= 1e-20; } } + +inline void Solver::checkGarbage(void){ return checkGarbage(garbage_frac); } +inline void Solver::checkGarbage(double gf){ + if (ca.wasted() > ca.size() * gf) + garbageCollect(); } + +// NOTE: enqueue does not set the ok flag! (only public methods do) +inline bool Solver::enqueue (Lit p, CRef from) { return value(p) != l_Undef ? value(p) != l_False : (uncheckedEnqueue(p, from), true); } +inline bool Solver::addClause (const vec& ps) { ps.copyTo(add_tmp); return addClause_(add_tmp); } +inline bool Solver::addEmptyClause () { add_tmp.clear(); return addClause_(add_tmp); } +inline bool Solver::addClause (Lit p) { add_tmp.clear(); add_tmp.push(p); return addClause_(add_tmp); } +inline bool Solver::addClause (Lit p, Lit q) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); } +inline bool Solver::addClause (Lit p, Lit q, Lit r) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); } + inline bool Solver::locked (const Clause& c) const { + if(c.size()>2) + return value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c; + return + (value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c) + || + (value(c[1]) == l_True && reason(var(c[1])) != CRef_Undef && ca.lea(reason(var(c[1]))) == &c); + } +inline void Solver::newDecisionLevel() { trail_lim.push(trail.size()); } + +inline int Solver::decisionLevel () const { return trail_lim.size(); } +inline uint32_t Solver::abstractLevel (Var x) const { return 1 << (level(x) & 31); } +inline lbool Solver::value (Var x) const { return assigns[x]; } +inline lbool Solver::value (Lit p) const { return assigns[var(p)] ^ sign(p); } +inline lbool Solver::modelValue (Var x) const { return model[x]; } +inline lbool Solver::modelValue (Lit p) const { return model[var(p)] ^ sign(p); } +inline int Solver::nAssigns () const { return trail.size(); } +inline int Solver::nClauses () const { return clauses.size(); } +inline int Solver::nLearnts () const { return learnts.size(); } +inline int Solver::nVars () const { return vardata.size(); } +inline int Solver::nFreeVars () const { return (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]); } +inline void Solver::setPolarity (Var v, bool b) { polarity[v] = b; } +inline void Solver::setDecisionVar(Var v, bool b) +{ + if ( b && !decision[v]) dec_vars++; + else if (!b && decision[v]) dec_vars--; + + decision[v] = b; + insertVarOrder(v); +} +inline void Solver::setConfBudget(int64_t x){ conflict_budget = conflicts + x; } +inline void Solver::setPropBudget(int64_t x){ propagation_budget = propagations + x; } +inline void Solver::interrupt(){ asynch_interrupt = true; } +inline void Solver::clearInterrupt(){ asynch_interrupt = false; } +inline void Solver::budgetOff(){ conflict_budget = propagation_budget = -1; } +inline bool Solver::withinBudget() const { + return !asynch_interrupt && + (conflict_budget < 0 || conflicts < (uint64_t)conflict_budget) && + (propagation_budget < 0 || propagations < (uint64_t)propagation_budget); } + +// FIXME: after the introduction of asynchronous interrruptions the solve-versions that return a +// pure bool do not give a safe interface. Either interrupts must be possible to turn off here, or +// all calls to solve must return an 'lbool'. I'm not yet sure which I prefer. +inline bool Solver::solve () { budgetOff(); assumptions.clear(); return solve_() == l_True; } +inline bool Solver::solve (Lit p) { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_() == l_True; } +inline bool Solver::solve (Lit p, Lit q) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_() == l_True; } +inline bool Solver::solve (Lit p, Lit q, Lit r) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_() == l_True; } +inline bool Solver::solve (const vec& assumps){ budgetOff(); assumps.copyTo(assumptions); return solve_() == l_True; } +inline lbool Solver::solveLimited (const vec& assumps){ assumps.copyTo(assumptions); return solve_(); } +inline bool Solver::okay () const { return ok; } + +inline void Solver::toDimacs (const char* file){ vec as; toDimacs(file, as); } +inline void Solver::toDimacs (const char* file, Lit p){ vec as; as.push(p); toDimacs(file, as); } +inline void Solver::toDimacs (const char* file, Lit p, Lit q){ vec as; as.push(p); as.push(q); toDimacs(file, as); } +inline void Solver::toDimacs (const char* file, Lit p, Lit q, Lit r){ vec as; as.push(p); as.push(q); as.push(r); toDimacs(file, as); } + + + +//================================================================================================= +// Debug etc: + + +inline void Solver::printLit(Lit l) +{ + printf("%s%d:%c", sign(l) ? "-" : "", var(l)+1, value(l) == l_True ? '1' : (value(l) == l_False ? '0' : 'X')); +} + + +inline void Solver::printClause(CRef cr) +{ + Clause &c = ca[cr]; + for (int i = 0; i < c.size(); i++){ + printLit(c[i]); + printf(" "); + } +} + +inline void Solver::printInitialClause(CRef cr) +{ + Clause &c = ca[cr]; + for (int i = 0; i < c.size(); i++){ + if(!isSelector(var(c[i]))) { + printLit(c[i]); + printf(" "); + } + } +} + +//================================================================================================= + +struct reduceDB_lt { + ClauseAllocator& ca; + + reduceDB_lt(ClauseAllocator& ca_) : ca(ca_) { + } + + bool operator()(CRef x, CRef y) { + + // Main criteria... Like in MiniSat we keep all binary clauses + if (ca[x].size() > 2 && ca[y].size() == 2) return 1; + + if (ca[y].size() > 2 && ca[x].size() == 2) return 0; + if (ca[x].size() == 2 && ca[y].size() == 2) return 0; + + // Second one based on literal block distance + if (ca[x].lbd() > ca[y].lbd()) return 1; + if (ca[x].lbd() < ca[y].lbd()) return 0; + + + // Finally we can use old activity or size, we choose the last one + return ca[x].activity() < ca[y].activity(); + //return x->size() < y->size(); + + //return ca[x].size() > 2 && (ca[y].size() == 2 || ca[x].activity() < ca[y].activity()); } + } +}; + + +} + + +#endif diff --git a/packages/bee/glucose-4/core/SolverTypes.h b/packages/bee/glucose-4/core/SolverTypes.h new file mode 100644 index 000000000..1d5b3da4c --- /dev/null +++ b/packages/bee/glucose-4/core/SolverTypes.h @@ -0,0 +1,507 @@ +/***************************************************************************************[SolverTypes.h] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + + +#ifndef Glucose_SolverTypes_h +#define Glucose_SolverTypes_h + +#include +#include + +// #include // comment out to make it easy to compile PL-Minisat in Windows + +#include "mtl/IntTypes.h" +#include "mtl/Alg.h" +#include "mtl/Vec.h" +#include "mtl/Map.h" +#include "mtl/Alloc.h" + + +namespace Glucose { + +//================================================================================================= +// Variables, literals, lifted booleans, clauses: + + +// NOTE! Variables are just integers. No abstraction here. They should be chosen from 0..N, +// so that they can be used as array indices. + +typedef int Var; +#define var_Undef (-1) + + +struct Lit { + int x; + + // Use this as a constructor: + friend Lit mkLit(Var var, bool sign); + + bool operator == (Lit p) const { return x == p.x; } + bool operator != (Lit p) const { return x != p.x; } + bool operator < (Lit p) const { return x < p.x; } // '<' makes p, ~p adjacent in the ordering. +}; + + +inline Lit mkLit (Var var, bool sign = false) { Lit p; p.x = var + var + (int)sign; return p; } +inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; } +inline Lit operator ^(Lit p, bool b) { Lit q; q.x = p.x ^ (unsigned int)b; return q; } +inline bool sign (Lit p) { return p.x & 1; } +inline int var (Lit p) { return p.x >> 1; } + +// Mapping Literals to and from compact integers suitable for array indexing: +inline int toInt (Var v) { return v; } +inline int toInt (Lit p) { return p.x; } +inline Lit toLit (int i) { Lit p; p.x = i; return p; } + +//const Lit lit_Undef = mkLit(var_Undef, false); // }- Useful special constants. +//const Lit lit_Error = mkLit(var_Undef, true ); // } + +const Lit lit_Undef = { -2 }; // }- Useful special constants. +const Lit lit_Error = { -1 }; // } + + +//================================================================================================= +// Lifted booleans: +// +// NOTE: this implementation is optimized for the case when comparisons between values are mostly +// between one variable and one constant. Some care had to be taken to make sure that gcc +// does enough constant propagation to produce sensible code, and this appears to be somewhat +// fragile unfortunately. + +#define l_True (Glucose::lbool((uint8_t)0)) // gcc does not do constant propagation if these are real constants. +#define l_False (Glucose::lbool((uint8_t)1)) +#define l_Undef (Glucose::lbool((uint8_t)2)) + +class lbool { + uint8_t value; + +public: + explicit lbool(uint8_t v) : value(v) { } + + lbool() : value(0) { } + explicit lbool(bool x) : value(!x) { } + + bool operator == (lbool b) const { return ((b.value&2) & (value&2)) | (!(b.value&2)&(value == b.value)); } + bool operator != (lbool b) const { return !(*this == b); } + lbool operator ^ (bool b) const { return lbool((uint8_t)(value^(uint8_t)b)); } + + lbool operator && (lbool b) const { + uint8_t sel = (this->value << 1) | (b.value << 3); + uint8_t v = (0xF7F755F4 >> sel) & 3; + return lbool(v); } + + lbool operator || (lbool b) const { + uint8_t sel = (this->value << 1) | (b.value << 3); + uint8_t v = (0xFCFCF400 >> sel) & 3; + return lbool(v); } + + friend int toInt (lbool l); + friend lbool toLbool(int v); +}; +inline int toInt (lbool l) { return l.value; } +inline lbool toLbool(int v) { return lbool((uint8_t)v); } + +//================================================================================================= +// Clause -- a simple class for representing a clause: + +class Clause; +typedef RegionAllocator::Ref CRef; + +#define BITS_LBD 13 +#define BITS_SIZEWITHOUTSEL 19 +#define BITS_REALSIZE 21 +class Clause { + struct { + unsigned mark : 2; + unsigned learnt : 1; + unsigned szWithoutSelectors : BITS_SIZEWITHOUTSEL; + unsigned canbedel : 1; + unsigned extra_size : 2; // extra size (end of 32bits) 0..3 + unsigned size : BITS_REALSIZE; + unsigned seen : 1; + unsigned reloced : 1; + unsigned exported : 2; // Values to keep track of the clause status for exportations + unsigned oneWatched : 1; + unsigned lbd : BITS_LBD; + } header; + + union { Lit lit; float act; uint32_t abs; CRef rel; } data[0]; + + friend class ClauseAllocator; + + // NOTE: This constructor cannot be used directly (doesn't allocate enough memory). + template + Clause(const V& ps, int _extra_size, bool learnt) { + assert(_extra_size < (1<<2)); + header.mark = 0; + header.learnt = learnt; + header.extra_size = _extra_size; + header.reloced = 0; + header.size = ps.size(); + header.lbd = 0; + header.canbedel = 1; + header.exported = 0; + header.oneWatched = 0; + header.seen = 0; + for (int i = 0; i < ps.size(); i++) + data[i].lit = ps[i]; + + if (header.extra_size > 0){ + if (header.learnt) + data[header.size].act = 0; + else + calcAbstraction(); + if (header.extra_size > 1) { + data[header.size+1].abs = 0; // learntFrom + } + } + } + +public: + void calcAbstraction() { + assert(header.extra_size > 0); + uint32_t abstraction = 0; + for (int i = 0; i < size(); i++) + abstraction |= 1 << (var(data[i].lit) & 31); + data[header.size].abs = abstraction; } + + int size () const { return header.size; } + void shrink (int i) { assert(i <= size()); + if (header.extra_size > 0) { + data[header.size-i] = data[header.size]; + if (header.extra_size > 1) { // Special case for imported clauses + data[header.size-i-1] = data[header.size-1]; + } + } + header.size -= i; } + void pop () { shrink(1); } + bool learnt () const { return header.learnt; } + bool has_extra () const { return header.extra_size > 0; } + uint32_t mark () const { return header.mark; } + void mark (uint32_t m) { header.mark = m; } + const Lit& last () const { return data[header.size-1].lit; } + + bool reloced () const { return header.reloced; } + CRef relocation () const { return data[0].rel; } + void relocate (CRef c) { header.reloced = 1; data[0].rel = c; } + + // NOTE: somewhat unsafe to change the clause in-place! Must manually call 'calcAbstraction' afterwards for + // subsumption operations to behave correctly. + Lit& operator [] (int i) { return data[i].lit; } + Lit operator [] (int i) const { return data[i].lit; } + operator const Lit* (void) const { return (Lit*)data; } + + float& activity () { assert(header.extra_size > 0); return data[header.size].act; } + uint32_t abstraction () const { assert(header.extra_size > 0); return data[header.size].abs; } + + // Handle imported clauses lazy sharing + bool wasImported() const {return header.extra_size > 1;} + uint32_t importedFrom () const { assert(header.extra_size > 1); return data[header.size + 1].abs;} + void setImportedFrom(uint32_t ifrom) {assert(header.extra_size > 1); data[header.size+1].abs = ifrom;} + + Lit subsumes (const Clause& other) const; + void strengthen (Lit p); + void setLBD(int i) {if (i < (1<<(BITS_LBD-1))) header.lbd = i; else header.lbd = (1<<(BITS_LBD-1));} + // unsigned int& lbd () { return header.lbd; } + unsigned int lbd () const { return header.lbd; } + void setCanBeDel(bool b) {header.canbedel = b;} + bool canBeDel() {return header.canbedel;} + void setSeen(bool b) {header.seen = b;} + bool getSeen() {return header.seen;} + void setExported(unsigned int b) {header.exported = b;} + unsigned int getExported() {return header.exported;} + void setOneWatched(bool b) {header.oneWatched = b;} + bool getOneWatched() {return header.oneWatched;} + void setSizeWithoutSelectors (unsigned int n) {header.szWithoutSelectors = n; } + unsigned int sizeWithoutSelectors () const { return header.szWithoutSelectors; } + +}; + + +//================================================================================================= +// ClauseAllocator -- a simple class for allocating memory for clauses: + + +const CRef CRef_Undef = RegionAllocator::Ref_Undef; +class ClauseAllocator : public RegionAllocator +{ + static int clauseWord32Size(int size, int extra_size){ + return (sizeof(Clause) + (sizeof(Lit) * (size + extra_size))) / sizeof(uint32_t); } + public: + bool extra_clause_field; + + ClauseAllocator(uint32_t start_cap) : RegionAllocator(start_cap), extra_clause_field(false){} + ClauseAllocator() : extra_clause_field(false){} + + void moveTo(ClauseAllocator& to){ + to.extra_clause_field = extra_clause_field; + RegionAllocator::moveTo(to); } + + template + CRef alloc(const Lits& ps, bool learnt = false, bool imported = false) + { + assert(sizeof(Lit) == sizeof(uint32_t)); + assert(sizeof(float) == sizeof(uint32_t)); + + bool use_extra = learnt | extra_clause_field; + int extra_size = imported?3:(use_extra?1:0); + CRef cid = RegionAllocator::alloc(clauseWord32Size(ps.size(), extra_size)); + new (lea(cid)) Clause(ps, extra_size, learnt); + + return cid; + } + + // Deref, Load Effective Address (LEA), Inverse of LEA (AEL): + Clause& operator[](Ref r) { return (Clause&)RegionAllocator::operator[](r); } + const Clause& operator[](Ref r) const { return (Clause&)RegionAllocator::operator[](r); } + Clause* lea (Ref r) { return (Clause*)RegionAllocator::lea(r); } + const Clause* lea (Ref r) const { return (Clause*)RegionAllocator::lea(r); } + Ref ael (const Clause* t){ return RegionAllocator::ael((uint32_t*)t); } + + void free(CRef cid) + { + Clause& c = operator[](cid); + RegionAllocator::free(clauseWord32Size(c.size(), c.has_extra())); + } + + void reloc(CRef& cr, ClauseAllocator& to) + { + Clause& c = operator[](cr); + + if (c.reloced()) { cr = c.relocation(); return; } + + cr = to.alloc(c, c.learnt(), c.wasImported()); + c.relocate(cr); + + // Copy extra data-fields: + // (This could be cleaned-up. Generalize Clause-constructor to be applicable here instead?) + to[cr].mark(c.mark()); + if (to[cr].learnt()) { + to[cr].activity() = c.activity(); + to[cr].setLBD(c.lbd()); + to[cr].setExported(c.getExported()); + to[cr].setOneWatched(c.getOneWatched()); + to[cr].setSeen(c.getSeen()); + to[cr].setSizeWithoutSelectors(c.sizeWithoutSelectors()); + to[cr].setCanBeDel(c.canBeDel()); + if (c.wasImported()) { + to[cr].setImportedFrom(c.importedFrom()); + } + } + else if (to[cr].has_extra()) to[cr].calcAbstraction(); + } +}; + + +//================================================================================================= +// OccLists -- a class for maintaining occurence lists with lazy deletion: + +template +class OccLists +{ + vec occs; + vec dirty; + vec dirties; + Deleted deleted; + + public: + OccLists(const Deleted& d) : deleted(d) {} + + void init (const Idx& idx){ occs.growTo(toInt(idx)+1); dirty.growTo(toInt(idx)+1, 0); } + // Vec& operator[](const Idx& idx){ return occs[toInt(idx)]; } + Vec& operator[](const Idx& idx){ return occs[toInt(idx)]; } + Vec& lookup (const Idx& idx){ if (dirty[toInt(idx)]) clean(idx); return occs[toInt(idx)]; } + + void cleanAll (); + void copyTo(OccLists ©) const { + + copy.occs.growTo(occs.size()); + for(int i = 0;i +void OccLists::cleanAll() +{ + for (int i = 0; i < dirties.size(); i++) + // Dirties may contain duplicates so check here if a variable is already cleaned: + if (dirty[toInt(dirties[i])]) + clean(dirties[i]); + dirties.clear(); +} + + +template +void OccLists::clean(const Idx& idx) +{ + Vec& vec = occs[toInt(idx)]; + int i, j; + for (i = j = 0; i < vec.size(); i++) + if (!deleted(vec[i])) + vec[j++] = vec[i]; + vec.shrink(i - j); + dirty[toInt(idx)] = 0; +} + + +//================================================================================================= +// CMap -- a class for mapping clauses to values: + + +template +class CMap +{ + struct CRefHash { + uint32_t operator()(CRef cr) const { return (uint32_t)cr; } }; + + typedef Map HashTable; + HashTable map; + + public: + // Size-operations: + void clear () { map.clear(); } + int size () const { return map.elems(); } + + + // Insert/Remove/Test mapping: + void insert (CRef cr, const T& t){ map.insert(cr, t); } + void growTo (CRef cr, const T& t){ map.insert(cr, t); } // NOTE: for compatibility + void remove (CRef cr) { map.remove(cr); } + bool has (CRef cr, T& t) { return map.peek(cr, t); } + + // Vector interface (the clause 'c' must already exist): + const T& operator [] (CRef cr) const { return map[cr]; } + T& operator [] (CRef cr) { return map[cr]; } + + // Iteration (not transparent at all at the moment): + int bucket_count() const { return map.bucket_count(); } + const vec& bucket(int i) const { return map.bucket(i); } + + // Move contents to other map: + void moveTo(CMap& other){ map.moveTo(other.map); } + + // TMP debug: + void debug(){ + printf(" --- size = %d, bucket_count = %d\n", size(), map.bucket_count()); } +}; + + +/*_________________________________________________________________________________________________ +| +| subsumes : (other : const Clause&) -> Lit +| +| Description: +| Checks if clause subsumes 'other', and at the same time, if it can be used to simplify 'other' +| by subsumption resolution. +| +| Result: +| lit_Error - No subsumption or simplification +| lit_Undef - Clause subsumes 'other' +| p - The literal p can be deleted from 'other' +|________________________________________________________________________________________________@*/ +inline Lit Clause::subsumes(const Clause& other) const +{ + //if (other.size() < size() || (extra.abst & ~other.extra.abst) != 0) + //if (other.size() < size() || (!learnt() && !other.learnt() && (extra.abst & ~other.extra.abst) != 0)) + assert(!header.learnt); assert(!other.header.learnt); + assert(header.extra_size > 0); assert(other.header.extra_size > 0); + if (other.header.size < header.size || (data[header.size].abs & ~other.data[other.header.size].abs) != 0) + return lit_Error; + + Lit ret = lit_Undef; + const Lit* c = (const Lit*)(*this); + const Lit* d = (const Lit*)other; + + for (unsigned i = 0; i < header.size; i++) { + // search for c[i] or ~c[i] + for (unsigned j = 0; j < other.header.size; j++) + if (c[i] == d[j]) + goto ok; + else if (ret == lit_Undef && c[i] == ~d[j]){ + ret = c[i]; + goto ok; + } + + // did not find it + return lit_Error; + ok:; + } + + return ret; +} + +inline void Clause::strengthen(Lit p) +{ + remove(*this, p); + calcAbstraction(); +} + +//================================================================================================= +} + + +#endif diff --git a/packages/bee/glucose-4/mtl/Alg.h b/packages/bee/glucose-4/mtl/Alg.h new file mode 100644 index 000000000..9afb4552b --- /dev/null +++ b/packages/bee/glucose-4/mtl/Alg.h @@ -0,0 +1,84 @@ +/*******************************************************************************************[Alg.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Alg_h +#define Glucose_Alg_h + +#include "mtl/Vec.h" + +namespace Glucose { + +//================================================================================================= +// Useful functions on vector-like types: + +//================================================================================================= +// Removing and searching for elements: +// + +template +static inline void remove(V& ts, const T& t) +{ + int j = 0; + for (; j < ts.size() && ts[j] != t; j++); + assert(j < ts.size()); + for (; j < ts.size()-1; j++) ts[j] = ts[j+1]; + ts.pop(); +} + + +template +static inline bool find(V& ts, const T& t) +{ + int j = 0; + for (; j < ts.size() && ts[j] != t; j++); + return j < ts.size(); +} + + +//================================================================================================= +// Copying vectors with support for nested vector types: +// + +// Base case: +template +static inline void copy(const T& from, T& to) +{ + to = from; +} + +// Recursive case: +template +static inline void copy(const vec& from, vec& to, bool append = false) +{ + if (!append) + to.clear(); + for (int i = 0; i < from.size(); i++){ + to.push(); + copy(from[i], to.last()); + } +} + +template +static inline void append(const vec& from, vec& to){ copy(from, to, true); } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/mtl/Alloc.h b/packages/bee/glucose-4/mtl/Alloc.h new file mode 100644 index 000000000..baa609597 --- /dev/null +++ b/packages/bee/glucose-4/mtl/Alloc.h @@ -0,0 +1,142 @@ +/*****************************************************************************************[Alloc.h] +Copyright (c) 2008-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef Glucose_Alloc_h +#define Glucose_Alloc_h + +#include "mtl/XAlloc.h" +#include "mtl/Vec.h" + +namespace Glucose { + +//================================================================================================= +// Simple Region-based memory allocator: + +template +class RegionAllocator +{ + T* memory; + uint32_t sz; + uint32_t cap; + uint32_t wasted_; + + void capacity(uint32_t min_cap); + + public: + // TODO: make this a class for better type-checking? + typedef uint32_t Ref; + enum { Ref_Undef = UINT32_MAX }; + enum { Unit_Size = sizeof(uint32_t) }; + + explicit RegionAllocator(uint32_t start_cap = 1024*1024) : memory(NULL), sz(0), cap(0), wasted_(0){ capacity(start_cap); } + ~RegionAllocator() + { + if (memory != NULL) + ::free(memory); + } + + + uint32_t size () const { return sz; } + uint32_t getCap () const { return cap;} + uint32_t wasted () const { return wasted_; } + + Ref alloc (int size); + void free (int size) { wasted_ += size; } + + // Deref, Load Effective Address (LEA), Inverse of LEA (AEL): + T& operator[](Ref r) { assert(r >= 0 && r < sz); return memory[r]; } + const T& operator[](Ref r) const { assert(r >= 0 && r < sz); return memory[r]; } + + T* lea (Ref r) { assert(r >= 0 && r < sz); return &memory[r]; } + const T* lea (Ref r) const { assert(r >= 0 && r < sz); return &memory[r]; } + Ref ael (const T* t) { assert((void*)t >= (void*)&memory[0] && (void*)t < (void*)&memory[sz-1]); + return (Ref)(t - &memory[0]); } + + void moveTo(RegionAllocator& to) { + if (to.memory != NULL) ::free(to.memory); + to.memory = memory; + to.sz = sz; + to.cap = cap; + to.wasted_ = wasted_; + + memory = NULL; + sz = cap = wasted_ = 0; + } + + void copyTo(RegionAllocator& to) const { + // if (to.memory != NULL) ::free(to.memory); + to.memory = (T*)xrealloc(to.memory, sizeof(T)*cap); + memcpy(to.memory,memory,sizeof(T)*cap); + to.sz = sz; + to.cap = cap; + to.wasted_ = wasted_; + } + + + +}; + +template +void RegionAllocator::capacity(uint32_t min_cap) +{ + if (cap >= min_cap) return; + + uint32_t prev_cap = cap; + while (cap < min_cap){ + // NOTE: Multiply by a factor (13/8) without causing overflow, then add 2 and make the + // result even by clearing the least significant bit. The resulting sequence of capacities + // is carefully chosen to hit a maximum capacity that is close to the '2^32-1' limit when + // using 'uint32_t' as indices so that as much as possible of this space can be used. + uint32_t delta = ((cap >> 1) + (cap >> 3) + 2) & ~1; + cap += delta; + + if (cap <= prev_cap) + throw OutOfMemoryException(); + } + //printf(" .. (%p) cap = %u\n", this, cap); + + assert(cap > 0); + memory = (T*)xrealloc(memory, sizeof(T)*cap); +} + + +template +typename RegionAllocator::Ref +RegionAllocator::alloc(int size) +{ + //printf("ALLOC called (this = %p, size = %d)\n", this, size); fflush(stdout); + assert(size > 0); + capacity(sz + size); + + uint32_t prev_sz = sz; + sz += size; + + // Handle overflow: + if (sz < prev_sz) + throw OutOfMemoryException(); + + return prev_sz; +} + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/mtl/Clone.h b/packages/bee/glucose-4/mtl/Clone.h new file mode 100644 index 000000000..c0ec225ce --- /dev/null +++ b/packages/bee/glucose-4/mtl/Clone.h @@ -0,0 +1,13 @@ +#ifndef Glucose_Clone_h +#define Glucose_Clone_h + + +namespace Glucose { + + class Clone { + public: + virtual Clone* clone() const = 0; + }; +}; + +#endif \ No newline at end of file diff --git a/packages/swi-minisat2/C/Heap.h b/packages/bee/glucose-4/mtl/Heap.h similarity index 64% rename from packages/swi-minisat2/C/Heap.h rename to packages/bee/glucose-4/mtl/Heap.h index b07ccd152..0c40c4ff3 100644 --- a/packages/swi-minisat2/C/Heap.h +++ b/packages/bee/glucose-4/mtl/Heap.h @@ -1,5 +1,6 @@ /******************************************************************************************[Heap.h] -MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, @@ -17,10 +18,12 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************************************/ -#ifndef Heap_h -#define Heap_h +#ifndef Glucose_Heap_h +#define Glucose_Heap_h -#include "Vec.h" +#include "mtl/Vec.h" + +namespace Glucose { //================================================================================================= // A heap implementation with support for decrease/increase key. @@ -28,9 +31,9 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA template class Heap { - Comp lt; - vec heap; // heap of ints - vec indices; // int -> index in heap + Comp lt; // The heap is a minimum-heap with respect to this comparator + vec heap; // Heap of integers + vec indices; // Each integers position (index) in the Heap // Index "traversal" functions static inline int left (int i) { return i*2+1; } @@ -38,20 +41,24 @@ class Heap { static inline int parent(int i) { return (i-1) >> 1; } - inline void percolateUp(int i) + + void percolateUp(int i) { - int x = heap[i]; - while (i != 0 && lt(x, heap[parent(i)])){ - heap[i] = heap[parent(i)]; - indices[heap[i]] = i; - i = parent(i); + int x = heap[i]; + int p = parent(i); + + while (i != 0 && lt(x, heap[p])){ + heap[i] = heap[p]; + indices[heap[p]] = i; + i = p; + p = parent(p); } heap [i] = x; indices[x] = i; } - inline void percolateDown(int i) + void percolateDown(int i) { int x = heap[i]; while (left(i) < heap.size()){ @@ -66,11 +73,6 @@ class Heap { } - bool heapProperty (int i) const { - return i >= heap.size() - || ((i == 0 || !lt(heap[i], heap[parent(i)])) && heapProperty(left(i)) && heapProperty(right(i))); } - - public: Heap(const Comp& c) : lt(c) { } @@ -79,10 +81,21 @@ class Heap { bool inHeap (int n) const { return n < indices.size() && indices[n] >= 0; } int operator[](int index) const { assert(index < heap.size()); return heap[index]; } - void decrease (int n) { assert(inHeap(n)); percolateUp(indices[n]); } - // RENAME WHEN THE DEPRECATED INCREASE IS REMOVED. - void increase_ (int n) { assert(inHeap(n)); percolateDown(indices[n]); } + void decrease (int n) { assert(inHeap(n)); percolateUp (indices[n]); } + void increase (int n) { assert(inHeap(n)); percolateDown(indices[n]); } + + void copyTo(Heap& copy) const {heap.copyTo(copy.heap);indices.copyTo(copy.indices);} + + // Safe variant of insert/decrease/increase: + void update(int n) + { + if (!inHeap(n)) + insert(n); + else { + percolateUp(indices[n]); + percolateDown(indices[n]); } + } void insert(int n) @@ -108,62 +121,30 @@ class Heap { } + // Rebuild the heap from scratch, using the elements in 'ns': + void build(vec& ns) { + for (int i = 0; i < heap.size(); i++) + indices[heap[i]] = -1; + heap.clear(); + + for (int i = 0; i < ns.size(); i++){ + indices[ns[i]] = i; + heap.push(ns[i]); } + + for (int i = heap.size() / 2 - 1; i >= 0; i--) + percolateDown(i); + } + void clear(bool dealloc = false) { for (int i = 0; i < heap.size(); i++) indices[heap[i]] = -1; -#ifdef NDEBUG - for (int i = 0; i < indices.size(); i++) - assert(indices[i] == -1); -#endif heap.clear(dealloc); } - - - // Fool proof variant of insert/decrease/increase - void update (int n) - { - if (!inHeap(n)) - insert(n); - else { - percolateUp(indices[n]); - percolateDown(indices[n]); - } - } - - - // Delete elements from the heap using a given filter function (-object). - // *** this could probaly be replaced with a more general "buildHeap(vec&)" method *** - template - void filter(const F& filt) { - int i,j; - for (i = j = 0; i < heap.size(); i++) - if (filt(heap[i])){ - heap[j] = heap[i]; - indices[heap[i]] = j++; - }else - indices[heap[i]] = -1; - - heap.shrink(i - j); - for (int i = heap.size() / 2 - 1; i >= 0; i--) - percolateDown(i); - - assert(heapProperty()); - } - - - // DEBUG: consistency checking - bool heapProperty() const { - return heapProperty(1); } - - - // COMPAT: should be removed - void setBounds (int n) { } - void increase (int n) { decrease(n); } - int getmin () { return removeMin(); } - }; //================================================================================================= +} + #endif diff --git a/packages/bee/glucose-4/mtl/IntTypes.h b/packages/bee/glucose-4/mtl/IntTypes.h new file mode 100644 index 000000000..2d8d4e872 --- /dev/null +++ b/packages/bee/glucose-4/mtl/IntTypes.h @@ -0,0 +1,46 @@ +/**************************************************************************************[IntTypes.h] +Copyright (c) 2009-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_IntTypes_h +#define Glucose_IntTypes_h + +#ifdef __sun + // Not sure if there are newer versions that support C99 headers. The + // needed features are implemented in the headers below though: + +# include +# include +# include + +#else + +# include +# include + +#endif + +#include + +#ifndef PRIu64 +#define PRIu64 "lu" +#define PRIi64 "ld" +#endif +//================================================================================================= + +#endif diff --git a/packages/bee/glucose-4/mtl/Map.h b/packages/bee/glucose-4/mtl/Map.h new file mode 100644 index 000000000..f29ae2d1e --- /dev/null +++ b/packages/bee/glucose-4/mtl/Map.h @@ -0,0 +1,193 @@ +/*******************************************************************************************[Map.h] +Copyright (c) 2006-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Map_h +#define Glucose_Map_h + +#include "mtl/IntTypes.h" +#include "mtl/Vec.h" + +namespace Glucose { + +//================================================================================================= +// Default hash/equals functions +// + +template struct Hash { uint32_t operator()(const K& k) const { return hash(k); } }; +template struct Equal { bool operator()(const K& k1, const K& k2) const { return k1 == k2; } }; + +template struct DeepHash { uint32_t operator()(const K* k) const { return hash(*k); } }; +template struct DeepEqual { bool operator()(const K* k1, const K* k2) const { return *k1 == *k2; } }; + +static inline uint32_t hash(uint32_t x){ return x; } +static inline uint32_t hash(uint64_t x){ return (uint32_t)x; } +static inline uint32_t hash(int32_t x) { return (uint32_t)x; } +static inline uint32_t hash(int64_t x) { return (uint32_t)x; } + + +//================================================================================================= +// Some primes +// + +static const int nprimes = 25; +static const int primes [nprimes] = { 31, 73, 151, 313, 643, 1291, 2593, 5233, 10501, 21013, 42073, 84181, 168451, 337219, 674701, 1349473, 2699299, 5398891, 10798093, 21596719, 43193641, 86387383, 172775299, 345550609, 691101253 }; + +//================================================================================================= +// Hash table implementation of Maps +// + +template, class E = Equal > +class Map { + public: + struct Pair { K key; D data; }; + + private: + H hash; + E equals; + + vec* table; + int cap; + int size; + + // Don't allow copying (error prone): + Map& operator = (Map& other) { assert(0); } + Map (Map& other) { assert(0); } + + bool checkCap(int new_size) const { return new_size > cap; } + + int32_t index (const K& k) const { return hash(k) % cap; } + void _insert (const K& k, const D& d) { + vec& ps = table[index(k)]; + ps.push(); ps.last().key = k; ps.last().data = d; } + + void rehash () { + const vec* old = table; + + int old_cap = cap; + int newsize = primes[0]; + for (int i = 1; newsize <= cap && i < nprimes; i++) + newsize = primes[i]; + + table = new vec[newsize]; + cap = newsize; + + for (int i = 0; i < old_cap; i++){ + for (int j = 0; j < old[i].size(); j++){ + _insert(old[i][j].key, old[i][j].data); }} + + delete [] old; + + // printf(" --- rehashing, old-cap=%d, new-cap=%d\n", cap, newsize); + } + + + public: + + Map () : table(NULL), cap(0), size(0) {} + Map (const H& h, const E& e) : hash(h), equals(e), table(NULL), cap(0), size(0){} + ~Map () { delete [] table; } + + // PRECONDITION: the key must already exist in the map. + const D& operator [] (const K& k) const + { + assert(size != 0); + const D* res = NULL; + const vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)) + res = &ps[i].data; + assert(res != NULL); + return *res; + } + + // PRECONDITION: the key must already exist in the map. + D& operator [] (const K& k) + { + assert(size != 0); + D* res = NULL; + vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)) + res = &ps[i].data; + assert(res != NULL); + return *res; + } + + // PRECONDITION: the key must *NOT* exist in the map. + void insert (const K& k, const D& d) { if (checkCap(size+1)) rehash(); _insert(k, d); size++; } + bool peek (const K& k, D& d) const { + if (size == 0) return false; + const vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)){ + d = ps[i].data; + return true; } + return false; + } + + bool has (const K& k) const { + if (size == 0) return false; + const vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)) + return true; + return false; + } + + // PRECONDITION: the key must exist in the map. + void remove(const K& k) { + assert(table != NULL); + vec& ps = table[index(k)]; + int j = 0; + for (; j < ps.size() && !equals(ps[j].key, k); j++); + assert(j < ps.size()); + ps[j] = ps.last(); + ps.pop(); + size--; + } + + void clear () { + cap = size = 0; + delete [] table; + table = NULL; + } + + int elems() const { return size; } + int bucket_count() const { return cap; } + + // NOTE: the hash and equality objects are not moved by this method: + void moveTo(Map& other){ + delete [] other.table; + + other.table = table; + other.cap = cap; + other.size = size; + + table = NULL; + size = cap = 0; + } + + // NOTE: given a bit more time, I could make a more C++-style iterator out of this: + const vec& bucket(int i) const { return table[i]; } +}; + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/mtl/Queue.h b/packages/bee/glucose-4/mtl/Queue.h new file mode 100644 index 000000000..c71e45bae --- /dev/null +++ b/packages/bee/glucose-4/mtl/Queue.h @@ -0,0 +1,80 @@ +/*****************************************************************************************[Queue.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Queue_h +#define Glucose_Queue_h + +#include "mtl/Vec.h" + +namespace Glucose { + +//================================================================================================= + +template +class Queue { + vec buf; + int first; + int end; + +public: + typedef T Key; + + Queue() : buf(1), first(0), end(0) {} + + void clear (bool dealloc = false) { buf.clear(dealloc); buf.growTo(1); first = end = 0; } + int size () const { return (end >= first) ? end - first : end - first + buf.size(); } + + + + const T& operator [] (int index) const { assert(index >= 0); assert(index < size()); return buf[(first + index) % buf.size()]; } + T& operator [] (int index) { assert(index >= 0); assert(index < size()); return buf[(first + index) % buf.size()]; } + + T peek () const { assert(first != end); return buf[first]; } + void pop () { assert(first != end); first++; if (first == buf.size()) first = 0; } + + + void copyTo(Queue& copy) const { + copy.first = first; + copy.end = end; + buf.memCopyTo(copy.buf); + } + + + void insert(T elem) { // INVARIANT: buf[end] is always unused + buf[end++] = elem; + if (end == buf.size()) end = 0; + if (first == end){ // Resize: + vec tmp((buf.size()*3 + 1) >> 1); + //**/printf("queue alloc: %d elems (%.1f MB)\n", tmp.size(), tmp.size() * sizeof(T) / 1000000.0); + int i = 0; + for (int j = first; j < buf.size(); j++) tmp[i++] = buf[j]; + for (int j = 0 ; j < end ; j++) tmp[i++] = buf[j]; + first = 0; + end = buf.size(); + tmp.moveTo(buf); + } + } +}; + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/mtl/Sort.h b/packages/bee/glucose-4/mtl/Sort.h new file mode 100644 index 000000000..50cb44844 --- /dev/null +++ b/packages/bee/glucose-4/mtl/Sort.h @@ -0,0 +1,98 @@ +/******************************************************************************************[Sort.h] +Copyright (c) 2003-2007, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Sort_h +#define Glucose_Sort_h + +#include "mtl/Vec.h" + +//================================================================================================= +// Some sorting algorithms for vec's + + +namespace Glucose { + +template +struct LessThan_default { + bool operator () (T x, T y) { return x < y; } +}; + + +template +void selectionSort(T* array, int size, LessThan lt) +{ + int i, j, best_i; + T tmp; + + for (i = 0; i < size-1; i++){ + best_i = i; + for (j = i+1; j < size; j++){ + if (lt(array[j], array[best_i])) + best_i = j; + } + tmp = array[i]; array[i] = array[best_i]; array[best_i] = tmp; + } +} +template static inline void selectionSort(T* array, int size) { + selectionSort(array, size, LessThan_default()); } + +template +void sort(T* array, int size, LessThan lt) +{ + if (size <= 15) + selectionSort(array, size, lt); + + else{ + T pivot = array[size / 2]; + T tmp; + int i = -1; + int j = size; + + for(;;){ + do i++; while(lt(array[i], pivot)); + do j--; while(lt(pivot, array[j])); + + if (i >= j) break; + + tmp = array[i]; array[i] = array[j]; array[j] = tmp; + } + + sort(array , i , lt); + sort(&array[i], size-i, lt); + } +} +template static inline void sort(T* array, int size) { + sort(array, size, LessThan_default()); } + + +//================================================================================================= +// For 'vec's: + + +template void sort(vec& v, LessThan lt) { + sort((T*)v, v.size(), lt); } +template void sort(vec& v) { + sort(v, LessThan_default()); } + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/mtl/Vec.h b/packages/bee/glucose-4/mtl/Vec.h new file mode 100644 index 000000000..954eef733 --- /dev/null +++ b/packages/bee/glucose-4/mtl/Vec.h @@ -0,0 +1,137 @@ +/*******************************************************************************************[Vec.h] +Copyright (c) 2003-2007, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Vec_h +#define Glucose_Vec_h + +#include +#include + +#include "mtl/IntTypes.h" +#include "mtl/XAlloc.h" +#include + +namespace Glucose { + +//================================================================================================= +// Automatically resizable arrays +// +// NOTE! Don't use this vector on datatypes that cannot be re-located in memory (with realloc) + +template +class vec { + T* data; + int sz; + int cap; + + // Don't allow copying (error prone): + vec& operator = (vec& other) { assert(0); return *this; } + vec (vec& other) { assert(0); } + + // Helpers for calculating next capacity: + static inline int imax (int x, int y) { int mask = (y-x) >> (sizeof(int)*8-1); return (x&mask) + (y&(~mask)); } + //static inline void nextCap(int& cap){ cap += ((cap >> 1) + 2) & ~1; } + static inline void nextCap(int& cap){ cap += ((cap >> 1) + 2) & ~1; } + +public: + // Constructors: + vec() : data(NULL) , sz(0) , cap(0) { } + explicit vec(int size) : data(NULL) , sz(0) , cap(0) { growTo(size); } + vec(int size, const T& pad) : data(NULL) , sz(0) , cap(0) { growTo(size, pad); } + ~vec() { clear(true); } + + // Pointer to first element: + operator T* (void) { return data; } + + // Size operations: + int size (void) const { return sz; } + void shrink (int nelems) { assert(nelems <= sz); for (int i = 0; i < nelems; i++) sz--, data[sz].~T(); } + void shrink_ (int nelems) { assert(nelems <= sz); sz -= nelems; } + int capacity (void) const { return cap; } + void capacity (int min_cap); + void growTo (int size); + void growTo (int size, const T& pad); + void clear (bool dealloc = false); + + // Stack interface: + void push (void) { if (sz == cap) capacity(sz+1); new (&data[sz]) T(); sz++; } + void push (const T& elem) { if (sz == cap) capacity(sz+1); data[sz++] = elem; } + void push_ (const T& elem) { assert(sz < cap); data[sz++] = elem; } + void pop (void) { assert(sz > 0); sz--, data[sz].~T(); } + // NOTE: it seems possible that overflow can happen in the 'sz+1' expression of 'push()', but + // in fact it can not since it requires that 'cap' is equal to INT_MAX. This in turn can not + // happen given the way capacities are calculated (below). Essentially, all capacities are + // even, but INT_MAX is odd. + + const T& last (void) const { return data[sz-1]; } + T& last (void) { return data[sz-1]; } + + // Vector interface: + const T& operator [] (int index) const { return data[index]; } + T& operator [] (int index) { return data[index]; } + + // Duplicatation (preferred instead): + void copyTo(vec& copy) const { copy.clear(); copy.growTo(sz); for (int i = 0; i < sz; i++) copy[i] = data[i]; } + void moveTo(vec& dest) { dest.clear(true); dest.data = data; dest.sz = sz; dest.cap = cap; data = NULL; sz = 0; cap = 0; } + void memCopyTo(vec& copy) const{ + copy.capacity(cap); + copy.sz = sz; + memcpy(copy.data,data,sizeof(T)*cap); + } + +}; + + +template +void vec::capacity(int min_cap) { + if (cap >= min_cap) return; + int add = imax((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2 + if (add > INT_MAX - cap || ((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM) + throw OutOfMemoryException(); + } + + +template +void vec::growTo(int size, const T& pad) { + if (sz >= size) return; + capacity(size); + for (int i = sz; i < size; i++) data[i] = pad; + sz = size; } + + +template +void vec::growTo(int size) { + if (sz >= size) return; + capacity(size); + for (int i = sz; i < size; i++) new (&data[i]) T(); + sz = size; } + + +template +void vec::clear(bool dealloc) { + if (data != NULL){ + for (int i = 0; i < sz; i++) data[i].~T(); + sz = 0; + if (dealloc) free(data), data = NULL, cap = 0; } } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/mtl/XAlloc.h b/packages/bee/glucose-4/mtl/XAlloc.h new file mode 100644 index 000000000..f8ca4fec4 --- /dev/null +++ b/packages/bee/glucose-4/mtl/XAlloc.h @@ -0,0 +1,47 @@ +/****************************************************************************************[XAlloc.h] +Copyright (c) 2009-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef Glucose_XAlloc_h +#define Glucose_XAlloc_h + +#include +#include +#include + +namespace Glucose { + +//================================================================================================= +// Simple layer on top of malloc/realloc to catch out-of-memory situtaions and provide some typing: + +class OutOfMemoryException{}; +static inline void* xrealloc(void *ptr, size_t size) +{ + void* mem = realloc(ptr, size); + if (mem == NULL && errno == ENOMEM){ + throw OutOfMemoryException(); + }else { + return mem; + } +} + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/parallel/ClausesBuffer.cc b/packages/bee/glucose-4/parallel/ClausesBuffer.cc new file mode 100644 index 000000000..5b18767a0 --- /dev/null +++ b/packages/bee/glucose-4/parallel/ClausesBuffer.cc @@ -0,0 +1,235 @@ +/**********************************************************************************[ClausesBuffer.cc] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +/* ClausesBuffer + * + * This class is responsible for exchanging clauses between threads. + * It is based on a fixed-length FIFO array of literals. + * If the FIFO is full, then old clauses are removed (even if it was not yet sent to all threads) + * + * a clause " l1 l2 l3" is pushed in the FIFO with the following 6 unsigned integers + * 3 nseen origin l1 l2 l3 + * + 3 is the size of the pushed clause + * + nseen is the number of thread which imported this clause (initialized with nthreads-1) + * (when set to 0, the clause is removed from the fifo) + * + origin is the thread id of the thread which added this clause to the fifo + * + l1 l2 l3 are the literals of the clause + * + * ********************************************************************************************** + * **CAREFUL** This class is not thread-safe. In glucose-syrup, the SharedCompanion is + * responsible for ensuring atomicity of main functions + * ********************************************************************************************** + * + * */ + +#include "parallel/ClausesBuffer.h" + +//================================================================================================= + +using namespace Glucose; + +extern BoolOption opt_whenFullRemoveOlder; +extern IntOption opt_fifoSizeByCore; + +// index : size clause +// index + 1 : nbSeen +// index + 2 : threadId +// index + 3 : .. index + 3 + size : Lit of clause +ClausesBuffer::ClausesBuffer(int _nbThreads, unsigned int _maxsize) : first(0), last(_maxsize-1), + maxsize(_maxsize), queuesize(0), + removedClauses(0), + forcedRemovedClauses(0), nbThreads(_nbThreads), + whenFullRemoveOlder(opt_whenFullRemoveOlder), fifoSizeByCore(opt_fifoSizeByCore) { + lastOfThread.growTo(_nbThreads); + for(int i=0;i= maxsize) + return i - maxsize; + return i; +} + +void ClausesBuffer::removeLastClause() { + assert(queuesize > 0); + do { + unsigned int size = (unsigned int) elems[nextIndex(last)]; + unsigned int nextlast = addIndex(last, size+headerSize); + + for(int i=0;i 0); + queuesize --; + } + removedClauses ++; + assert(last >= 0); + assert(last < maxsize); + assert(last == nextlast); + } while (queuesize > 0 && (elems[addIndex(last,2)] == 0)); + +} + + +// Pushes a single uint to the fifo +inline void ClausesBuffer::noCheckPush(uint32_t x) { + elems[first] = x; + first = nextIndex(first); +} + +// Pops a single uint from the fifo +inline uint32_t ClausesBuffer::noCheckPop(uint32_t & index) { + index = nextIndex(index); + uint32_t ret = elems[index]; + return ret; +} + + + +// Return true if the clause was succesfully added +bool ClausesBuffer::pushClause(int threadId, Clause & c) { + if (!whenFullRemoveOlder && (queuesize + c.size() + headerSize >= maxsize)) + return false; // We need to remove some old clauses + while (queuesize + c.size() + headerSize >= maxsize) { // We need to remove some old clauses + forcedRemovedClauses ++; + removeLastClause(); + assert(queuesize > 0); + } + noCheckPush(c.size()); + noCheckPush(nbThreads>1?nbThreads-1:1); + noCheckPush(threadId); + for(int i=0;i (%d, %d)\n", first, last); +} + +bool ClausesBuffer::getClause(int threadId, int & threadOrigin, vec & resultClause, bool firstFound) { + assert(lastOfThread.size() > threadId); + unsigned int thislast = lastOfThread[threadId]; + assert(!firstFound || thislast == last); // FIXME: Gilles has this assertion on his cluster + + // Early exiting + if (nextIndex(thislast) == first) return false; + + if ( ( thislast < last && last < first) || + ( first < thislast && thislast < last ) || + ( last < first && first < thislast) ) { + // Special case where last has moved and lastOfThread[threadId] is no more valid (is behind) + thislast = last; + } + assert(!firstFound); + // Go to next clause for this thread id + if (!firstFound) { + while (nextIndex(thislast) != first && elems[addIndex(thislast,3)] == ((unsigned int)threadId)) { // 3 = 2 + 1 + thislast = addIndex(thislast, elems[nextIndex(thislast)] + headerSize); // + assert(thislast >= 0); + assert(thislast < maxsize); + } + assert(nextIndex(thislast)==first || elems[addIndex(thislast,3)] != (unsigned int)threadId); + } + + if (nextIndex(thislast) == first) { + lastOfThread[threadId] = thislast; + return false; + } + assert(elems[addIndex(thislast,3)] != ((unsigned int) threadId)); + unsigned int previouslast = thislast; + bool removeAfter = false; + int csize = noCheckPop(thislast); + removeAfter = (--elems[addIndex(thislast,1)] == 0); // We are sure this is not one of our own clause + thislast = nextIndex(thislast); // Skips the removeAfter fieldr + threadOrigin = noCheckPop(thislast); + assert(threadOrigin != threadId); + resultClause.clear(); + for(int i=0;i elems; + unsigned int first; + unsigned int last; + unsigned int maxsize; + unsigned int queuesize; // Number of current elements (must be < maxsize !) + unsigned int removedClauses; + unsigned int forcedRemovedClauses; + static const int headerSize = 3; + int nbThreads; + bool whenFullRemoveOlder; + unsigned int fifoSizeByCore; + vec lastOfThread; // Last value for a thread + + public: + ClausesBuffer(int _nbThreads, unsigned int _maxsize); + ClausesBuffer(); + + void setNbThreads(int _nbThreads); + unsigned int nextIndex(unsigned int i); + unsigned int addIndex(unsigned int i, unsigned int a); + void removeLastClause(); + + void noCheckPush(uint32_t x); + uint32_t noCheckPop(unsigned int & index); + + // Return true if the clause was succesfully added + bool pushClause(int threadId, Clause & c); + bool getClause(int threadId, int & threadOrigin, vec & resultClause, bool firstFound = false); + + int maxSize() const {return maxsize;} + uint32_t getCap(); + void growTo(int size) { + assert(0); // Not implemented (essentially for efficiency reasons) + elems.growTo(size); + first=0; maxsize=size; queuesize = 0;last = 0; + for(int i=0;i + +#include +#include + + +#include "utils/System.h" +#include "utils/ParseUtils.h" +#include "utils/Options.h" +#include "core/Dimacs.h" +#include "core/SolverTypes.h" + +#include "simp/SimpSolver.h" +#include "parallel/ParallelSolver.h" +#include "parallel/MultiSolvers.h" + +using namespace Glucose; + + + +static MultiSolvers* pmsolver; + +// Terminate by notifying the solver and back out gracefully. This is mainly to have a test-case +// for this feature of the Solver as it may take longer than an immediate call to '_exit()'. +//static void SIGINT_interrupt(int signum) { pmsolver->interrupt(); } + + +// Note that '_exit()' rather than 'exit()' has to be used. The reason is that 'exit()' calls +// destructors and may cause deadlocks if a malloc/free function happens to be running (these +// functions are guarded by locks for multithreaded use). +static void SIGINT_exit(int signum) { + printf("\n"); printf("*** INTERRUPTED ***\n"); + if (pmsolver->verbosity() > 0){ + pmsolver->printFinalStats(); + printf("\n"); printf("*** INTERRUPTED ***\n"); } + _exit(1); } + + +//================================================================================================= +// Main: + + +int main(int argc, char** argv) +{ + double realTimeStart = realTime(); + printf("c\nc This is glucose-syrup 4.0 (glucose in many threads) -- based on MiniSAT (Many thanks to MiniSAT team)\nc\n"); + try { + setUsageHelp("c USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); + // printf("This is MiniSat 2.0 beta\n"); + +#if defined(__linux__) + fpu_control_t oldcw, newcw; + _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); + printf("c WARNING: for repeatability, setting FPU to use double precision\n"); +#endif + // Extra options: + // + IntOption verb ("MAIN", "verb", "Verbosity level (0=silent, 1=some, 2=more).", 1, IntRange(0, 2)); + BoolOption mod ("MAIN", "model", "show model.", false); + IntOption vv ("MAIN", "vv", "Verbosity every vv conflicts", 10000, IntRange(1,INT32_MAX)); + IntOption cpu_lim("MAIN", "cpu-lim","Limit on CPU time allowed in seconds.\n", INT32_MAX, IntRange(0, INT32_MAX)); + IntOption mem_lim("MAIN", "mem-lim","Limit on memory usage in megabytes.\n", INT32_MAX, IntRange(0, INT32_MAX)); + + parseOptions(argc, argv, true); + + MultiSolvers msolver; + pmsolver = & msolver; + msolver.setVerbosity(verb); + msolver.setVerbEveryConflicts(vv); + msolver.setShowModel(mod); + + double initial_time = cpuTime(); + + // Use signal handlers that forcibly quit until the solver will be able to respond to + // interrupts: + signal(SIGINT, SIGINT_exit); + signal(SIGXCPU,SIGINT_exit); + + // Set limit on CPU-time: + if (cpu_lim != INT32_MAX){ + rlimit rl; + getrlimit(RLIMIT_CPU, &rl); + if (rl.rlim_max == RLIM_INFINITY || (rlim_t)cpu_lim < rl.rlim_max){ + rl.rlim_cur = cpu_lim; + if (setrlimit(RLIMIT_CPU, &rl) == -1) + printf("c WARNING! Could not set resource limit: CPU-time.\n"); + } } + + // Set limit on virtual memory: + if (mem_lim != INT32_MAX){ + rlim_t new_mem_lim = (rlim_t)mem_lim * 1024*1024; + rlimit rl; + getrlimit(RLIMIT_AS, &rl); + if (rl.rlim_max == RLIM_INFINITY || new_mem_lim < rl.rlim_max){ + rl.rlim_cur = new_mem_lim; + if (setrlimit(RLIMIT_AS, &rl) == -1) + printf("c WARNING! Could not set resource limit: Virtual memory.\n"); + } } + + if (argc == 1) + printf("c Reading from standard input... Use '--help' for help.\n"); + + gzFile in = (argc == 1) ? gzdopen(0, "rb") : gzopen(argv[1], "rb"); + if (in == NULL) + printf("c ERROR! Could not open file: %s\n", argc == 1 ? "" : argv[1]), exit(1); + + if (msolver.verbosity() > 0){ + printf("c ========================================[ Problem Statistics ]===========================================\n"); + printf("c | |\n"); } + + parse_DIMACS(in, msolver); + gzclose(in); + + + + FILE* res = (argc >= 3) ? fopen(argv[argc-1], "wb") : NULL; + + if (msolver.verbosity() > 0){ + printf("c | Number of variables: %12d |\n", msolver.nVars()); + printf("c | Number of clauses: %12d |\n", msolver.nClauses()); } + + double parsed_time = cpuTime(); + if (msolver.verbosity() > 0){ + printf("c | Parse time: %12.2f s |\n", parsed_time - initial_time); + printf("c | |\n"); } + + // Change to signal-handlers that will only notify the solver and allow it to terminate + // voluntarily: + //signal(SIGINT, SIGINT_interrupt); + //signal(SIGXCPU,SIGINT_interrupt); + + + int ret2 = msolver.simplify(); + if(ret2) + msolver.eliminate(); + double simplified_time = cpuTime(); + if (msolver.verbosity() > 0){ + printf("c | Simplification time: %12.2f s |\n", simplified_time - parsed_time); + printf("c | |\n"); } + + if (!ret2 || !msolver.okay()){ + //if (S.certifiedOutput != NULL) fprintf(S.certifiedOutput, "0\n"), fclose(S.certifiedOutput); + if (res != NULL) fprintf(res, "UNSAT\n"), fclose(res); + if (msolver.verbosity() > 0){ + printf("c =========================================================================================================\n"); + printf("Solved by unit propagation\n"); + printf("c real time : %g s\n", realTime() - realTimeStart); + printf("c cpu time : %g s\n", cpuTime()); + printf("\n"); } + printf("s UNSATISFIABLE\n"); + exit(20); + } + + // vec dummy; + lbool ret = msolver.solve(); + + + printf("c\n"); + printf("c real time : %g s\n", realTime() - realTimeStart); + printf("c cpu time : %g s\n", cpuTime()); + if (msolver.verbosity() > 0){ + msolver.printFinalStats(); + printf("\n"); } + + //-------------- Result is put in a external file + /* I must admit I have to print the model of one thread... But which one? FIXME !! + if (res != NULL){ + if (ret == l_True){ + fprintf(res, "SAT\n"); + for (int i = 0; i < S.nVars(); i++) + if (S.model[i] != l_Undef) + fprintf(res, "%s%s%d", (i==0)?"":" ", (S.model[i]==l_True)?"":"-", i+1); + fprintf(res, " 0\n"); + }else if (ret == l_False) + fprintf(res, "UNSAT\n"); + else + fprintf(res, "INDET\n"); + fclose(res); + + //-------------- Want certified output + } else { + */ + printf(ret == l_True ? "s SATISFIABLE\n" : ret == l_False ? "s UNSATISFIABLE\n" : "s INDETERMINATE\n"); + + if(msolver.getShowModel() && ret==l_True) { + printf("v "); + for (int i = 0; i < msolver.model.size() ; i++) + if (msolver.model[i] != l_Undef) + printf("%s%s%d", (i==0)?"":" ", (msolver.model[i]==l_True)?"":"-", i+1); + printf(" 0\n"); + } + + + +#ifdef NDEBUG + exit(ret == l_True ? 10 : ret == l_False ? 20 : 0); // (faster than "return", which will invoke the destructor for 'Solver') +#else + return (ret == l_True ? 10 : ret == l_False ? 20 : 0); +#endif + } catch (OutOfMemoryException&){ + printf("c ===================================================================================================\n"); + printf("INDETERMINATE\n"); + exit(0); + } +} diff --git a/packages/bee/glucose-4/parallel/MultiSolvers.cc b/packages/bee/glucose-4/parallel/MultiSolvers.cc new file mode 100644 index 000000000..b0c19492a --- /dev/null +++ b/packages/bee/glucose-4/parallel/MultiSolvers.cc @@ -0,0 +1,543 @@ +/***************************************************************************************[MultiSolvers.cc] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#include +#include "parallel/MultiSolvers.h" +#include "mtl/Sort.h" +#include "utils/System.h" +#include "simp/SimpSolver.h" +#include +#include +#include "parallel/SolverConfiguration.h" + +using namespace Glucose; + +extern const char* _parallel ; +extern const char* _cunstable; +// Options at the parallel solver level +static IntOption opt_nbsolversmultithreads (_parallel, "nthreads", "Number of core threads for syrup (0 for automatic)", 0); +static IntOption opt_maxnbsolvers (_parallel, "maxnbthreads", "Maximum number of core threads to ask for (when nbthreads=0)", 4); +static IntOption opt_maxmemory (_parallel, "maxmemory", "Maximum memory to use (in Mb, 0 for no software limit)", 3000); +static IntOption opt_statsInterval (_parallel, "statsinterval", "Seconds (real time) between two stats reports", 5); +// +// Shared with ClausesBuffer.cc +BoolOption opt_whenFullRemoveOlder (_parallel, "removeolder", "When the FIFO for exchanging clauses between threads is full, remove older clauses", false); +IntOption opt_fifoSizeByCore(_parallel, "fifosize", "Size of the FIFO structure for exchanging clauses between threads, by threads", 100000); +// +// Shared options with Solver.cc +BoolOption opt_dontExportDirectReusedClauses (_cunstable, "reusedClauses", "Don't export directly reused clauses", false); +BoolOption opt_plingeling (_cunstable, "plingeling", "plingeling strategy for sharing clauses (exploratory feature)", false); + +#include +#include +#include + +static inline double cpuTime(void) { + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); +return (double)ru.ru_utime.tv_sec + (double)ru.ru_utime.tv_usec / 1000000; } + + +void MultiSolvers::informEnd(lbool res) { + result = res; + pthread_cond_broadcast(&cfinished); +} + +MultiSolvers::MultiSolvers(ParallelSolver *s): + ok (true) + , maxnbthreads(4), nbthreads(opt_nbsolversmultithreads), nbsolvers(opt_nbsolversmultithreads) + , nbcompanions(4), nbcompbysolver(2) + , allClonesAreBuilt(0) + , showModel(false) + , winner(-1) + , var_decay(1 / 0.95), clause_decay(1 / 0.999),cla_inc(1), var_inc(1) + , random_var_freq(0.02) + , restart_first(100), restart_inc(1.5) + , learntsize_factor((double)1/(double)3), learntsize_inc(1.1) + , expensive_ccmin(true) + , polarity_mode (polarity_false) + , maxmemory(opt_maxmemory), maxnbsolvers(opt_maxnbsolvers) + , verb(0) , verbEveryConflicts(10000) + , numvar(0), numclauses(0) + +{ + result = l_Undef; + SharedCompanion *sc = new SharedCompanion(); + this->sharedcomp = sc; + + // Generate only solver 0. + // It loads the formula + // All others solvers are clone of this one + solvers.push(s); + s->verbosity = 0; // No reportf in solvers... All is done in MultiSolver + s->setThreadNumber(0); + //s->belongsto = this; + s->sharedcomp = sc; + sc->addSolver(s); + assert(solvers[0]->threadNumber() == 0); + + pthread_mutex_init(&m,NULL); //PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_init(&mfinished,NULL); //PTHREAD_MUTEX_INITIALIZER; + pthread_cond_init(&cfinished,NULL); + + if (nbsolvers > 0 ) + fprintf(stdout,"c %d solvers engines and 1 companion as a blackboard created.\n", nbsolvers); +} + +MultiSolvers::MultiSolvers() : MultiSolvers(new ParallelSolver(-1)) { + +} + +MultiSolvers::~MultiSolvers() +{} + +/** + * Generate All solvers + */ + +void MultiSolvers::generateAllSolvers() { + assert(solvers[0] != NULL); + assert(allClonesAreBuilt==0); + + for(int i=1;iclone(); + solvers.push(s); + s->verbosity = 0; // No reportf in solvers... All is done in MultiSolver + s->setThreadNumber(i); + s->sharedcomp = this->sharedcomp; + this->sharedcomp->addSolver(s); + assert(solvers[i]->threadNumber() == i); + } + + adjustParameters(); + + allClonesAreBuilt = 1; +} + +/** + * Choose solver for threads i (if no given in command line see above) + */ + + +ParallelSolver* MultiSolvers::retrieveSolver(int i) { + return new ParallelSolver(i); +} + +Var MultiSolvers::newVar(bool sign, bool dvar) +{ + assert(solvers[0] != NULL); + numvar++; + int v; + sharedcomp->newVar(sign); + if(!allClonesAreBuilt) { // At the beginning we want to generate only solvers 0 + v = solvers[0]->newVar(sign,dvar); + assert(numvar == v+1); // Just a useless check + } else { + for(int i=0;inewVar(sign,dvar); + } + } + return numvar; +} + +bool MultiSolvers::addClause_(vec&ps) { + assert(solvers[0] != NULL); // There is at least one solver. + // Check if clause is satisfied and remove false/duplicate literals: + if (!okay()) return false; + + sort(ps); + Lit p; int i, j; + for (i = j = 0, p = lit_Undef; i < ps.size(); i++) + if (solvers[0]->value(ps[i]) == l_True || ps[i] == ~p) + return true; + else if (solvers[0]->value(ps[i]) != l_False && ps[i] != p) + ps[j++] = p = ps[i]; + ps.shrink(i - j); + + + if (ps.size() == 0) { + return ok = false; + } + else if (ps.size() == 1){ + assert(solvers[0]->value(ps[0]) == l_Undef); // TODO : Passes values to all threads + solvers[0]->uncheckedEnqueue(ps[0]); + if(!allClonesAreBuilt) { + return ok = ( (solvers[0]->propagate()) == CRef_Undef); // checks only main solver here for propagation constradiction + } + + // Here, all clones are built. + // Gives the unit clause to everybody + for(int i=0;iuncheckedEnqueue(ps[0]); + return ok = ( (solvers[0]->propagate()) == CRef_Undef); // checks only main solver here for propagation constradiction + }else{ + // printf("Adding clause %0xd for solver %d.\n",(void*)c, thn); + // At the beginning only solver 0 load the formula + solvers[0]->addClause(ps); + + if(!allClonesAreBuilt) { + numclauses++; + return true; + } + // Clones are built, need to pass the clause to all the threads + for(int i=1;iaddClause(ps); + } + numclauses++; + } + return true; +} + + +bool MultiSolvers::simplify() { + assert(solvers[0] != NULL); // There is at least one solver. + + if (!okay()) return false; + return ok = solvers[0]->simplify(); +} + + +bool MultiSolvers::eliminate() { + + // TODO allow variable elimination when all threads are built! + assert(allClonesAreBuilt==false); + + SimpSolver * s = (SimpSolver*)getPrimarySolver(); + return s->eliminate(true); +} + + +// TODO: Use a template here +void *localLaunch(void*arg) { + ParallelSolver* s = (ParallelSolver*)arg; + + (void)s->solve(); + + pthread_exit(NULL); +} + + +#define MAXIMUM_SLEEP_DURATION 5 +void MultiSolvers::printStats() { + static int nbprinted = 1; + double cpu_time = cpuTime(); + printf("c\n"); + + printf("c |-------------------------------------------------------------------------------------------------------|\n"); + printf("c | id | starts | decisions | confls | Init T | learnts | exported | imported | promoted | %% | \n"); + printf("c |-------------------------------------------------------------------------------------------------------|\n"); + + //printf("%.0fs | ",cpu_time); + for(int i=0;ireportProgress(); + //printf(" %2d: %12ld confl. |", i, (long int) solvers[i]->conflicts); + } + long long int totalconf = 0; + long long int totalprop = 0; + for(int i=0;iconflicts; + totalprop+= solvers[i]->propagations; + } + printf("c \n"); + + printf("c synthesis %11lld conflicts %11lld propagations %8.0f conflicts/sec %8.0f propagations/sec\n", + totalconf, totalprop, (double)totalconf / cpu_time, (double) totalprop / cpu_time); + + + nbprinted ++; +} + +// Still a ugly function... To be rewritten with some statistics class some day +void MultiSolvers::printFinalStats() { + sharedcomp->printStats(); + printf("c\nc\n"); + printf("c\n"); + printf("c |---------------------------------------- FINAL STATS --------------------------------------------------|\n"); + printf("c\n"); + + printf("c |---------------"); + for(int i = 0;iconflicts); + totalconf += solvers[i]->conflicts; + } + printf("| %15lld |\n",totalconf); + + printf("c | Exported "); + uint64_t exported = 0; + for(int i=0;inbexported); + exported += solvers[i]->nbexported; + } + printf("| %15" PRIu64" |\n", exported); + + printf("c | Imported "); + uint64_t imported = 0; + for(int i=0;inbimported); + imported += solvers[i]->nbimported; + } + printf("| %15" PRIu64" |\n", imported); + + printf("c | Good "); + uint64_t importedGood = 0; + for(int i=0;inbImportedGoodClauses); + importedGood += solvers[i]->nbImportedGoodClauses; + } + printf("| %15" PRIu64" |\n", importedGood); + + printf("c | Purge "); + uint64_t importedPurg = 0; + for(int i=0;inbimportedInPurgatory); + importedPurg += solvers[i]->nbimportedInPurgatory; + } + printf("| %15" PRIu64" |\n", importedPurg); + + printf("c | Promoted "); + uint64_t promoted = 0; + for(int i=0;inbPromoted); + promoted += solvers[i]->nbPromoted; + } + printf("| %15" PRIu64" |\n", promoted); + + printf("c | Remove imp "); + uint64_t removedimported = 0; + for(int i=0;inbRemovedUnaryWatchedClauses); + removedimported += solvers[i]->nbRemovedUnaryWatchedClauses; + } + printf("| %15" PRIu64" |\n", removedimported); + + printf("c | Blocked Reuse "); + uint64_t blockedreused = 0; + for(int i=0;inbNotExportedBecauseDirectlyReused); + blockedreused += solvers[i]->nbNotExportedBecauseDirectlyReused; + } + printf("| %15" PRIu64" |\n",blockedreused); + + + printf("c | Orig seen "); + for(int i=0;ioriginalClausesSeen); + } + printf("| |\n"); + + printf("c | Unaries "); + for(int i=0;inbUn); + } + printf("| |\n"); + + printf("c | Binaries "); + for(int i=0;inbBin); + } + printf("| |\n"); + + + printf("c | Glues "); + for(int i=0;inbDL2); + } + printf("| |\n"); + + + int winner = -1; + for(int i=0;iwinner()==solvers[i]) + winner = i; + } + + if(winner!=-1) { +int sum = 0; + printf("c | Hamming "); + for(int i = 0;ivaluePhase(j)!= solvers[winner]->valuePhase(j)) nb++; + } + printf("| %10d ",nb); + sum+=nb; + + } + printf("| %15d |\n",sum/(solvers.size()>1?solvers.size()-1:1)); + } + + printf("c |---------------"); + for(int i = 0;i=1) + printf("c | Automatic Adjustement of the number of solvers. MaxMemory=%5d, MaxCores=%3d. |\n", maxmemory, maxnbsolvers); + unsigned int tmpnbsolvers = maxmemory * 4 / 10 / mem; + if (tmpnbsolvers > maxnbsolvers) tmpnbsolvers = maxnbsolvers; + if (tmpnbsolvers < 1) tmpnbsolvers = 1; + if(verb>=1) + printf("c | One Solver is taking %.2fMb... Let's take %d solvers for this run (max 40%% of the maxmemory). |\n", mem, tmpnbsolvers); + nbsolvers = tmpnbsolvers; + nbthreads = nbsolvers; + } else { + assert(nbthreads == nbsolvers); + } +} + +lbool MultiSolvers::solve() { + pthread_attr_t thAttr; + int i; + + adjustNumberOfCores(); + sharedcomp->setNbThreads(nbsolvers); + if(verb>=1) + printf("c | Generating clones |\n"); + generateAllSolvers(); + if(verb>=1) { + printf("c |  all clones generated. Memory = %6.2fMb. |\n", memUsed()); + printf("c ========================================================================================================|\n"); + } + + + model.clear(); + + /* Initialize and set thread detached attribute */ + pthread_attr_init(&thAttr); + pthread_attr_setdetachstate(&thAttr, PTHREAD_CREATE_JOINABLE); + + + + // Launching all solvers + for (i = 0; i < nbsolvers; i++) { + pthread_t * pt = (pthread_t*)malloc(sizeof(pthread_t)); + threads.push(pt); + solvers[i]->pmfinished = &mfinished; + solvers[i]->pcfinished = &cfinished; + pthread_create(threads[i], &thAttr, &localLaunch, (void*)solvers[i]); + } + + bool done = false; + + (void)pthread_mutex_lock(&m); + while (!done) { + struct timespec timeout; + time(&timeout.tv_sec); + timeout.tv_sec += MAXIMUM_SLEEP_DURATION; + timeout.tv_nsec = 0; + if (pthread_cond_timedwait(&cfinished, &mfinished, &timeout) != ETIMEDOUT) + done = true; + else + printStats(); + + float mem = memUsed(); + if(verb>=1) printf("c Total Memory so far : %.2fMb\n", mem); + if ( (maxmemory > 0) && (mem > maxmemory) && !sharedcomp->panicMode) + printf("c ** reduceDB switching to Panic Mode due to memory limitations !\n"), sharedcomp->panicMode = true; + + } + (void)pthread_mutex_unlock(&m); + + for (i = 0; i < nbsolvers; i++) { // Wait for all threads to finish + pthread_join(*threads[i], NULL); + } + + assert(sharedcomp != NULL); + result = sharedcomp->jobStatus; + if (result == l_True) { + int n = sharedcomp->jobFinishedBy->nVars(); + model.growTo(n); + for(int i = 0; i < n; i++) + model[i] = sharedcomp->jobFinishedBy->model[i]; + } + + + return result; + /* + for(int i=0;i& ps); // Add a clause to the solver. NOTE! 'ps' may be shrunk by this method! + bool addClause_( vec& ps); + + bool simplify (); // Removes already satisfied clauses. + + int nVars () const; // The current number of variables. + int nClauses () const; // The current number of variables. + ParallelSolver *getPrimarySolver(); + + void generateAllSolvers(); + + // Solving: + // + lbool solve (); // Search without assumptions. + bool eliminate(); // Perform variable elimination + void adjustParameters(); + void adjustNumberOfCores(); + void interrupt() {} + vec model; // If problem is satisfiable, this vector contains the model (if any). + inline bool okay() { + if(!ok) return ok; + for(int i = 0;iokay()) { + ok = false; + return false; + } + } + return true; + + } + + protected: + friend class ParallelSolver; + friend class SolverCompanion; + +struct Stats { + uint64_t min, max, avg, std, med; + Stats(uint64_t _min = 0,uint64_t _max = 0,uint64_t _avg = 0,uint64_t _std = 0,uint64_t _med = 0) : + min(_min), max(_max), avg(_avg), std(_std), med(_med) {} +}; + + void printStats(); + int ok; + lbool result; + int maxnbthreads; // Maximal number of threads + int nbthreads; // Current number of threads + int nbsolvers; // Number of CDCL solvers + int nbcompanions; // Number of companions + int nbcompbysolver; // Number of companions by solvers + bool immediateSharingGlue ; + int allClonesAreBuilt; + bool showModel; // show model on/off + + int winner; + + vec add_tmp; + + double var_decay; // Inverse of the variable activity decay factor. (default 1 / 0.95) + double clause_decay; // Inverse of the clause activity decay factor. (1 / 0.999) + double cla_inc; // Amount to bump next clause with. + double var_inc; // Amount to bump next variable with. + double random_var_freq; // The frequency with which the decision heuristic tries to choose a random variable. (default 0.02) + int restart_first; // The initial restart limit. (default 100) + double restart_inc; // The factor with which the restart limit is multiplied in each restart. (default 1.5) + double learntsize_factor; // The intitial limit for learnt clauses is a factor of the original clauses. (default 1 / 3) + double learntsize_inc; // The limit for learnt clauses is multiplied with this factor each restart. (default 1.1) + bool expensive_ccmin; // Controls conflict clause minimization. (default TRUE) + int polarity_mode; // Controls which polarity the decision heuristic chooses. See enum below for allowed modes. (default polarity_false) + unsigned int maxmemory; + unsigned int maxnbsolvers; + int verb; + int verbEveryConflicts; + int numvar; // Number of variables + int numclauses; // Number of clauses + + enum { polarity_true = 0, polarity_false = 1, polarity_user = 2, polarity_rnd = 3 }; + + //ClauseAllocator ca; + SharedCompanion * sharedcomp; + + void informEnd(lbool res); + ParallelSolver* retrieveSolver(int i); + + pthread_mutex_t m; // mutex for any high level sync between all threads (like reportf) + pthread_mutex_t mfinished; // mutex on which main process may wait for... As soon as one process finishes it release the mutex + pthread_cond_t cfinished; // condition variable that says that a thread has finished + + vec solvers; // set of plain solvers + vec solvercompanions; // set of companion solvers + vec threads; // all threads of this process + vec threadIndexOfSolver; // threadIndexOfSolver[solvers[i]] is the index in threads[] of the solver i + vec threadIndexOfSolverCompanion; // threadIndexOfSolverCompanion[solvercompanions[i]] is the index in threads[] of the solvercompanion i +}; + +inline bool MultiSolvers::addClause (const vec& ps) { ps.copyTo(add_tmp); return addClause_(add_tmp); } + +inline void MultiSolvers::setVerbosity(int i) {verb = i;} +inline void MultiSolvers::setVerbEveryConflicts(int i) {verbEveryConflicts=i;} +inline int MultiSolvers::nVars () const { return numvar; } +inline int MultiSolvers::nClauses () const { return numclauses; } +inline int MultiSolvers::verbosity() {return verb;} +inline ParallelSolver* MultiSolvers::getPrimarySolver() {return solvers[0];} + + +} +#endif + diff --git a/packages/bee/glucose-4/parallel/ParallelSolver.cc b/packages/bee/glucose-4/parallel/ParallelSolver.cc new file mode 100644 index 000000000..ff948e9fd --- /dev/null +++ b/packages/bee/glucose-4/parallel/ParallelSolver.cc @@ -0,0 +1,490 @@ +/***************************************************************************************[ParallelSolver.cc] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#include "parallel/ParallelSolver.h" +#include "mtl/Sort.h" + +using namespace Glucose; + +const char* _cunstable = "CORE/PARALLEL -- UNSTABLE FEATURES"; +const char* _parallel = "PARALLEL"; + +extern BoolOption opt_dontExportDirectReusedClauses; // (_cunstable, "reusedClauses", "Don't export directly reused clauses", false); +extern BoolOption opt_plingeling; // (_cunstable, "plingeling", "plingeling strategy for sharing clauses (exploratory feature)", false); + + +ParallelSolver::ParallelSolver(int threadId) : + SimpSolver() +, thn(threadId) // The thread number of this solver +, nbexported(0) +, nbimported(0) +, nbexportedunit(0), nbimportedunit(0), nbimportedInPurgatory(0), nbImportedGoodClauses(0) +, goodlimitlbd(8) +, goodlimitsize(30) +, purgatory(true) +, shareAfterProbation(!opt_plingeling) // only share clauses after probation +, plingeling(opt_plingeling) +, firstSharing(5000) // Strong limit : do not share anything (except unary clauses) before this number of conflicts +, limitSharingByGoodLBD(true) // Moving limit of what a good LBD is (median value of last learnt clauses set) +, limitSharingByFixedLimitLBD(0) // No fixed bound (like 8 in plingeling) +, limitSharingByFixedLimitSize(0) // No fixed boud (like 40 in plingeling) +, dontExportDirectReusedClauses(opt_dontExportDirectReusedClauses) +, nbNotExportedBecauseDirectlyReused(0) +{ + useUnaryWatched = true; // We want to use promoted clauses here ! +} + + + + +ParallelSolver::~ParallelSolver() { + printf("c Solver of thread %d ended.\n", thn); + fflush(stdout); +} + +ParallelSolver::ParallelSolver(const ParallelSolver &s) : SimpSolver(s) +, nbexported(s.nbexported) +, nbimported(s.nbimported) +, nbexportedunit(s.nbexportedunit), nbimportedunit(s.nbimportedunit), nbimportedInPurgatory(s.nbimportedInPurgatory) +, nbImportedGoodClauses(s.nbImportedGoodClauses) +, goodlimitlbd(s.goodlimitlbd) +, goodlimitsize(s.goodlimitsize) +, purgatory(s.purgatory) +, shareAfterProbation(s.shareAfterProbation) // only share clauses after probation +, plingeling(s.plingeling) +, firstSharing(s.firstSharing) // Strong limit : do not share anything (except unary clauses) before this number of conflicts +, limitSharingByGoodLBD(s.limitSharingByGoodLBD) // Moving limit of what a good LBD is (median value of last learnt clauses set) +, limitSharingByFixedLimitLBD(s.limitSharingByFixedLimitLBD) // No fixed bound (like 8 in plingeling) +, limitSharingByFixedLimitSize(s.limitSharingByFixedLimitSize) // No fixed boud (like 40 in plingeling) +, dontExportDirectReusedClauses(s.dontExportDirectReusedClauses) +, nbNotExportedBecauseDirectlyReused(s.nbNotExportedBecauseDirectlyReused) +{ + s.goodImportsFromThreads.memCopyTo(goodImportsFromThreads); + useUnaryWatched = s.useUnaryWatched; +} + + +// Strategy to reduce unary watches list +struct reduceDB_oneWatched_lt { + ClauseAllocator& ca; + + reduceDB_oneWatched_lt(ClauseAllocator& ca_) : ca(ca_) { + } + + bool operator()(CRef x, CRef y) { + + // Main criteria... Like in MiniSat we keep all binary clauses + if (ca[x].size() > 2 && ca[y].size() == 2) return 1; + + if (ca[y].size() > 2 && ca[x].size() == 2) return 0; + if (ca[x].size() == 2 && ca[y].size() == 2) return 0; + + // Second one based on literal block distance + if (ca[x].size() > ca[y].size()) return 1; + if (ca[x].size() < ca[y].size()) return 0; + + if (ca[x].lbd() > ca[y].lbd()) return 1; + if (ca[x].lbd() < ca[y].lbd()) return 0; + + // Finally we can use old activity or size, we choose the last one + return ca[x].activity() < ca[y].activity(); + //return x->size() < y->size(); + + //return ca[x].size() > 2 && (ca[y].size() == 2 || ca[x].activity() < ca[y].activity()); } + } +}; + +// @overide +void ParallelSolver::reduceDB() { + + int i, j; + nbReduceDB++; + sort(learnts, reduceDB_lt(ca)); + + int limit; + + if (!panicModeIsEnabled()) { + // We have a lot of "good" clauses, it is difficult to compare them. Keep more ! + if (ca[learnts[learnts.size() / RATIOREMOVECLAUSES]].lbd() <= 3) nbclausesbeforereduce += specialIncReduceDB; + // Useless :-) + if (ca[learnts.last()].lbd() <= 5) nbclausesbeforereduce += specialIncReduceDB; + + // Don't delete binary or locked clauses. From the rest, delete clauses from the first half + // Keep clauses which seem to be usefull (their lbd was reduce during this sequence) + + limit = learnts.size() / 2; + } else { + limit = panicModeLastRemoved; + } + panicModeLastRemoved = 0; + + uint64_t sumsize = 0; + for (i = j = 0; i < learnts.size(); i++) { + + Clause& c = ca[learnts[i]]; + if (i == learnts.size() / 2) + goodlimitlbd = c.lbd(); + sumsize += c.size(); + if (c.lbd() > 2 && c.size() > 2 && c.canBeDel() && !locked(c) && (i < limit)) { + removeClause(learnts[i]); + nbRemovedClauses++; + panicModeLastRemoved++; + } else { + if (!c.canBeDel()) limit++; //we keep c, so we can delete an other clause + c.setCanBeDel(true); // At the next step, c can be delete + learnts[j++] = learnts[i]; + } + } + learnts.shrink(i - j); + + if (learnts.size() > 0) + goodlimitsize = 1 + (double) sumsize / (double) learnts.size(); + + // Special treatment for imported clauses + if (!panicModeIsEnabled()) + limit = unaryWatchedClauses.size() - (learnts.size() * 2); + else + limit = panicModeLastRemovedShared; + panicModeLastRemovedShared = 0; + if ((unaryWatchedClauses.size() > 100) && (limit > 0)) { + + sort(unaryWatchedClauses, reduceDB_oneWatched_lt(ca)); + + for (i = j = 0; i < unaryWatchedClauses.size(); i++) { + Clause& c = ca[unaryWatchedClauses[i]]; + if (c.lbd() > 2 && c.size() > 2 && c.canBeDel() && !locked(c) && (i < limit)) { + removeClause(unaryWatchedClauses[i], c.getOneWatched()); // remove from the purgatory (or not) + nbRemovedUnaryWatchedClauses++; + panicModeLastRemovedShared++; + } else { + if (!c.canBeDel()) limit++; //we keep c, so we can delete an other clause + c.setCanBeDel(true); // At the next step, c can be delete + unaryWatchedClauses[j++] = unaryWatchedClauses[i]; + } + } + unaryWatchedClauses.shrink(i - j); + } + + checkGarbage(); +} + + +/*_________________________________________________________________________________________________ +| +| parallelImportClauseDuringConflictAnalysis : (Clause &c,CRef confl) -> [void] +| +| Description: +| Verify if the clause using during conflict analysis is good for export +| @see : analyze +| Output: +|________________________________________________________________________________________________@*/ + + +void ParallelSolver::parallelImportClauseDuringConflictAnalysis(Clause &c,CRef confl) { + if (dontExportDirectReusedClauses && (confl == lastLearntClause) && (c.getExported() < 2)) { // Experimental stuff + c.setExported(2); + nbNotExportedBecauseDirectlyReused++; + } else if (shareAfterProbation && c.getExported() != 2 && conflicts > firstSharing) { + c.setExported(c.getExported() + 1); + if (!c.wasImported() && c.getExported() == 2) { // It's a new interesting clause: + if (c.lbd() == 2 || (c.size() < goodlimitsize && c.lbd() <= goodlimitlbd)) { + shareClause(c); + } + } + } + +} + + + +// These Two functions are useless here !! +void ParallelSolver::reportProgress() { + printf("c | %2d | %6d | %10d | %10d | %8d | %8d | %8d | %8d | %8d | %6.3f |\n",(int)thn,(int)starts,(int)decisions,(int)conflicts,(int)originalClausesSeen,(int)learnts.size(),(int)nbexported,(int)nbimported,(int)nbPromoted,progressEstimate()*100); + + //printf("c thread=%d confl=%lld starts=%llu reduceDB=%llu learnts=%d broadcast=%llu blockedReuse=%lld imported=%llu promoted=%llu limitlbd=%llu limitsize=%llu\n", thn, conflicts, starts, nbReduceDB, learnts.size(), nbexported, nbNotExportedBecauseDirectlyReused, nbimported, nbPromoted, goodlimitlbd, goodlimitsize); +} + +void ParallelSolver::reportProgressArrayImports(vec &totalColumns) { + return ; // TODO : does not currently work + unsigned int totalImports = 0; + printf("c %3d | ", thn); + for (int i = 0; i < sharedcomp->nbThreads; i++) { + totalImports += goodImportsFromThreads[i]; + totalColumns[i] += goodImportsFromThreads[i]; + printf(" %8d", goodImportsFromThreads[i]); + } + printf(" | %8d\n", totalImports); + +} + + + +/*_________________________________________________________________________________________________ +| +| shareClause : (Clause &c) -> [bool] +| +| Description: +| share a clause to other cores +| @see : analyze +| Output: true if the clause is indeed sent +|________________________________________________________________________________________________@*/ + +bool ParallelSolver::shareClause(Clause & c) { + bool sent = sharedcomp->addLearnt(this, c); + if (sent) + nbexported++; + return sent; +} + +/*_________________________________________________________________________________________________ +| +| panicModeIsEnabled : () -> [bool] +| +| Description: +| is panic mode (save memory) is enabled ? +|________________________________________________________________________________________________@*/ + +bool ParallelSolver::panicModeIsEnabled() { + return sharedcomp->panicMode; +} + +/*_________________________________________________________________________________________________ +| +| parallelImportUnaryClauses : () -> [void] +| +| Description: +| import all unary clauses from other cores +|________________________________________________________________________________________________@*/ + +void ParallelSolver::parallelImportUnaryClauses() { + Lit l; + while ((l = sharedcomp->getUnary(this)) != lit_Undef) { + if (value(var(l)) == l_Undef) { + uncheckedEnqueue(l); + nbimportedunit++; + } + } +} + +/*_________________________________________________________________________________________________ +| +| parallelImportClauses : () -> [bool] +| +| Description: +| import all clauses from other cores +| Output : if there is a final conflict +|________________________________________________________________________________________________@*/ + +bool ParallelSolver::parallelImportClauses() { + + assert(decisionLevel() == 0); + int importedFromThread; + while (sharedcomp->getNewClause(this, importedFromThread, importedClause)) { + assert(importedFromThread <= sharedcomp->nbThreads); + assert(importedFromThread >= 0); + + assert(importedFromThread != thn); + + if (importedClause.size() == 0) + return true; + + //printf("Thread %d imports clause from thread %d\n", threadNumber(), importedFromThread); + CRef cr = ca.alloc(importedClause, true, true); + ca[cr].setLBD(importedClause.size()); + if (plingeling) // 0 means a broadcasted clause (good clause), 1 means a survivor clause, broadcasted + ca[cr].setExported(2); // A broadcasted clause (or a survivor clause) do not share it anymore + else { + ca[cr].setExported(1); // next time we see it in analyze, we share it (follow route / broadcast depending on the global strategy, part of an ongoing experimental stuff: a clause in one Watched will be set to exported 2 when promotted. + } + ca[cr].setImportedFrom(importedFromThread); + unaryWatchedClauses.push(cr); + if (plingeling || ca[cr].size() <= 2) {//|| importedRoute == 0) { // importedRoute == 0 means a glue clause in another thread (or any very good clause) + ca[cr].setOneWatched(false); // Warning: those clauses will never be promoted by a conflict clause (or rarely: they are propagated!) + attachClause(cr); + nbImportedGoodClauses++; + } else { + ca[cr].setOneWatched(true); + attachClausePurgatory(cr); // + nbimportedInPurgatory++; + } + assert(ca[cr].learnt()); + nbimported++; + } + return false; +} + + +/*_________________________________________________________________________________________________ +| +| parallelExportUnaryClause : (Lit p) -> [void] +| +| Description: +| export unary clauses to other cores +|________________________________________________________________________________________________@*/ + +void ParallelSolver::parallelExportUnaryClause(Lit p) { + // Multithread + sharedcomp->addLearnt(this,p ); // TODO: there can be a contradiction here (two theads proving a and -a) + nbexportedunit++; +} + + +/*_________________________________________________________________________________________________ +| +| parallelExportClauseDuringSearch : (Clause &c) -> [void] +| +| Description: +| Verify if a new learnt clause is useful for export +| @see search +| +|________________________________________________________________________________________________@*/ + +void ParallelSolver::parallelExportClauseDuringSearch(Clause &c) { + // + // Multithread + // Now I'm sharing the clause if seen in at least two conflicts analysis shareClause(ca[cr]); + if ((plingeling && !shareAfterProbation && c.lbd() < 8 && c.size() < 40) || + (c.lbd() <= 2)) { // For this class of clauses, I'm sharing them asap (they are Glue CLauses, no probation for them) + shareClause(c); + c.setExported(2); + } + +} + + +/*_________________________________________________________________________________________________ +| +| parallelJobIsFinished : () -> [bool] +| +| Description: +| Is a core already finish the search +| +|________________________________________________________________________________________________@*/ + +bool ParallelSolver::parallelJobIsFinished() { + // Parallel: another job has finished let's quit + return (sharedcomp->jobFinished()); +} + +// @overide +lbool ParallelSolver::solve_(bool do_simp, bool turn_off_simp) { + vec extra_frozen; + lbool result = l_True; + do_simp &= use_simplification; + if (do_simp){ + // Assumptions must be temporarily frozen to run variable elimination: + for (int i = 0; i < assumptions.size(); i++){ + Var v = var(assumptions[i]); + + // If an assumption has been eliminated, remember it. + assert(!isEliminated(v)); + + if (!frozen[v]){ + // Freeze and store. + setFrozen(v, true); + extra_frozen.push(v); + } } + + result = lbool(eliminate(turn_off_simp)); + } + + model.clear(); + conflict.clear(); + if (!ok) return l_False; + + solves++; + + + lbool status = l_Undef; + + // Search: + int curr_restarts = 0; + while (status == l_Undef && !sharedcomp->jobFinished()) { + status = search(0); // the parameter is useless in glucose, kept to allow modifications + if (!withinBudget()) break; + curr_restarts++; + } + + if (verbosity >= 1) + printf("c =========================================================================================================\n"); + + +/* if (do_simp) + // Unfreeze the assumptions that were frozen: + for (int i = 0; i < extra_frozen.size(); i++) + setFrozen(extra_frozen[i], false); +*/ + + bool firstToFinish = false; + if (status != l_Undef) + firstToFinish = sharedcomp->IFinished(this); + if (firstToFinish) { + printf("c Thread %d is 100%% pure glucose! First thread to finish! (%s answer).\n", threadNumber(), status == l_True ? "SAT" : status == l_False ? "UNSAT" : "UNKOWN"); + sharedcomp->jobStatus = status; + } + + if (firstToFinish && status == l_True) { + extendModel(); + + + // Extend & copy model: + model.growTo(nVars()); + for (int i = 0; i < nVars(); i++) model[i] = value(i); + } else if (status == l_False && conflict.size() == 0) + ok = false; + + + pthread_cond_signal(pcfinished); + + //cancelUntil(0); + + + return status; + +} diff --git a/packages/bee/glucose-4/parallel/ParallelSolver.h b/packages/bee/glucose-4/parallel/ParallelSolver.h new file mode 100644 index 000000000..970179280 --- /dev/null +++ b/packages/bee/glucose-4/parallel/ParallelSolver.h @@ -0,0 +1,144 @@ +/**************************************************************************************[ParallelSolver.h] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#ifndef PARALLELSOLVER_H +#define PARALLELSOLVER_H + +#include "core/SolverTypes.h" +#include "core/Solver.h" +#include "simp/SimpSolver.h" +#include "parallel/SharedCompanion.h" +namespace Glucose { +//================================================================================================= + //class MultiSolvers; + //class SolverCompanion; + // class MultiSolvers; + +class ParallelSolver : public SimpSolver { + friend class MultiSolvers; + friend class SolverCompanion; + friend class SharedCompanion; +// friend class ReasoningCompanion; +// friend class SolverConfiguration; + +protected : + // Multithread : + int thn; // internal thread number + //MultiSolvers* belongsto; // Not working (due to incomplete types) + SharedCompanion *sharedcomp; + bool coreFUIP; // true if one core is specialized for branching on all FUIP + bool ImTheSolverFUIP; + pthread_mutex_t *pmfinished; // mutex on which main process may wait for... As soon as one process finishes it release the mutex + pthread_cond_t *pcfinished; // condition variable that says that a thread as finished + +public: + // Constructor/Destructor: + // + ParallelSolver(int threadId); + ParallelSolver(const ParallelSolver &s); + ~ParallelSolver(); + + /** + * Clone function + */ + virtual Clone* clone() const { + return new ParallelSolver(*this); + } + + int threadNumber () const; + void setThreadNumber (int i); + void reportProgress(); + void reportProgressArrayImports(vec &totalColumns); + virtual void reduceDB(); + virtual lbool solve_ (bool do_simp = true, bool turn_off_simp = false); + + vec importedClause; // Temporary clause used to copy each imported clause + uint64_t nbexported; + uint64_t nbimported; + uint64_t nbexportedunit, nbimportedunit , nbimportedInPurgatory, nbImportedGoodClauses; + unsigned int goodlimitlbd; // LBD score of the "good" clauses, locally + int goodlimitsize; + bool purgatory; // mode of operation + bool shareAfterProbation; // Share any none glue clause only after probation (seen 2 times in conflict analysis) + bool plingeling; // plingeling strategy for sharing clauses (experimental) + + // Stats front end + uint64_t getNbExported() { return nbexported;} + uint64_t getNbImported() { return nbimported;} + uint64_t getNbExportedUnit() {return nbexportedunit;} + + uint32_t firstSharing, limitSharingByGoodLBD, limitSharingByFixedLimitLBD, limitSharingByFixedLimitSize; + uint32_t probationByFollowingRoads, probationByFriend; + uint32_t survivorLayers; // Number of layers for a common clause to survive + bool dontExportDirectReusedClauses ; // When true, directly reused clauses are not exported + uint64_t nbNotExportedBecauseDirectlyReused; + + + vec goodImportsFromThreads; // Stats of good importations from other threads + + virtual void parallelImportClauseDuringConflictAnalysis(Clause &c,CRef confl); + virtual bool parallelImportClauses(); // true if the empty clause was received + virtual void parallelImportUnaryClauses(); + virtual void parallelExportUnaryClause(Lit p); + virtual void parallelExportClauseDuringSearch(Clause &c); + virtual bool parallelJobIsFinished(); + virtual bool panicModeIsEnabled(); + + bool shareClause(Clause & c); // true if the clause was succesfully sent + + + +}; + + + inline int ParallelSolver::threadNumber () const {return thn;} + inline void ParallelSolver::setThreadNumber (int i) {thn = i;} +} +#endif /* PARALLELSOLVER_H */ + diff --git a/packages/bee/glucose-4/parallel/SharedCompanion.cc b/packages/bee/glucose-4/parallel/SharedCompanion.cc new file mode 100644 index 000000000..dadc6724b --- /dev/null +++ b/packages/bee/glucose-4/parallel/SharedCompanion.cc @@ -0,0 +1,167 @@ +/***************************************************************************************[SharedCompanion.cc] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#include "core/Solver.h" +#include "parallel/ParallelSolver.h" +#include "core/SolverTypes.h" +#include "parallel/ClausesBuffer.h" +#include "parallel/SharedCompanion.h" + + +using namespace Glucose; + +SharedCompanion::SharedCompanion(int _nbThreads) : + nbThreads(_nbThreads), + bjobFinished(false), + jobFinishedBy(NULL), + panicMode(false), // The bug in the SAT2014 competition :) + jobStatus(l_Undef), + random_seed(9164825) { + + pthread_mutex_init(&mutexSharedClauseCompanion,NULL); // This is the shared companion lock + pthread_mutex_init(&mutexSharedUnitCompanion,NULL); // This is the shared companion lock + pthread_mutex_init(&mutexSharedCompanion,NULL); // This is the shared companion lock + pthread_mutex_init(&mutexJobFinished,NULL); // This is the shared companion lock + if (_nbThreads> 0) { + setNbThreads(_nbThreads); + fprintf(stdout,"c Shared companion initialized: handling of clauses of %d threads.\nc %d ints for the sharing clause buffer (not expandable) .\n", _nbThreads, clausesBuffer.maxSize()); + } + +} + +void SharedCompanion::setNbThreads(int _nbThreads) { + nbThreads = _nbThreads; + clausesBuffer.setNbThreads(_nbThreads); +} + +void SharedCompanion::printStats() { +} + +// No multithread safe +bool SharedCompanion::addSolver(ParallelSolver* s) { + watchedSolvers.push(s); + pthread_mutex_t* mu = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t)); + pthread_mutex_init(mu,NULL); + assert(s->thn == watchedSolvers.size()-1); // all solvers must have been registered in the good order + nextUnit.push(0); + + return true; +} +void SharedCompanion::newVar(bool sign) { + isUnary .push(l_Undef); +} + +void SharedCompanion::addLearnt(ParallelSolver *s,Lit unary) { + pthread_mutex_lock(&mutexSharedUnitCompanion); + if (isUnary[var(unary)]==l_Undef) { + unitLit.push(unary); + isUnary[var(unary)] = sign(unary)?l_False:l_True; + } + pthread_mutex_unlock(&mutexSharedUnitCompanion); +} + +Lit SharedCompanion::getUnary(ParallelSolver *s) { + int sn = s->thn; + Lit ret = lit_Undef; + + pthread_mutex_lock(&mutexSharedUnitCompanion); + if (nextUnit[sn] < unitLit.size()) + ret = unitLit[nextUnit[sn]++]; + pthread_mutex_unlock(&mutexSharedUnitCompanion); + return ret; +} + +// Specialized functions for this companion +// must be multithread safe +// Add a clause to the threads-wide clause database (all clauses, through) +bool SharedCompanion::addLearnt(ParallelSolver *s, Clause & c) { + int sn = s->thn; // thread number of the solver + bool ret = false; + assert(watchedSolvers.size()>sn); + + pthread_mutex_lock(&mutexSharedClauseCompanion); + ret = clausesBuffer.pushClause(sn, c); + pthread_mutex_unlock(&mutexSharedClauseCompanion); + return ret; +} + + +bool SharedCompanion::getNewClause(ParallelSolver *s, int & threadOrigin, vec& newclause) { // gets a new interesting clause for solver s + int sn = s->thn; + + // First, let's get the clauses on the big blackboard + pthread_mutex_lock(&mutexSharedClauseCompanion); + bool b = clausesBuffer.getClause(sn, threadOrigin, newclause); + pthread_mutex_unlock(&mutexSharedClauseCompanion); + + return b; +} + +bool SharedCompanion::jobFinished() { + bool ret = false; + pthread_mutex_lock(&mutexJobFinished); + ret = bjobFinished; + pthread_mutex_unlock(&mutexJobFinished); + return ret; +} + +bool SharedCompanion::IFinished(ParallelSolver *s) { + bool ret = false; + pthread_mutex_lock(&mutexJobFinished); + if (!bjobFinished) { + ret = true; + bjobFinished = true; + jobFinishedBy = s; + } + pthread_mutex_unlock(&mutexJobFinished); + return ret; +} + + + diff --git a/packages/bee/glucose-4/parallel/SharedCompanion.h b/packages/bee/glucose-4/parallel/SharedCompanion.h new file mode 100644 index 000000000..9ab34614b --- /dev/null +++ b/packages/bee/glucose-4/parallel/SharedCompanion.h @@ -0,0 +1,122 @@ +/***************************************************************************************[SharedCompanion.h] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +/* This class is responsible for protecting (by mutex) information exchange between threads. + * It also allows each solver to send / receive clause / unary clauses. + * + * Only one sharedCompanion is created for all the solvers + */ + + +#ifndef SharedCompanion_h +#define SharedCompanion_h +#include "core/SolverTypes.h" +#include "parallel/ParallelSolver.h" +#include "parallel/SolverCompanion.h" +#include "parallel/ClausesBuffer.h" + +namespace Glucose { + + +class SharedCompanion : public SolverCompanion { + friend class MultiSolvers; + friend class ParallelSolver; +public: + SharedCompanion(int nbThreads=0); + void setNbThreads(int _nbThreads); // Sets the number of threads (cannot by changed once the solver is running) + void newVar(bool sign); // Adds a var (used to keep track of unary variables) + void printStats(); // Printing statistics of all solvers + + bool jobFinished(); // True if the job is over + bool IFinished(ParallelSolver *s); // returns true if you are the first solver to finish + bool addSolver(ParallelSolver*); // attach a solver to accompany + void addLearnt(ParallelSolver *s,Lit unary); // Add a unary clause to share + bool addLearnt(ParallelSolver *s, Clause & c); // Add a clause to the shared companion, as a database manager + + bool getNewClause(ParallelSolver *s, int &th, vec & nc); // gets a new interesting clause for solver s + Lit getUnary(ParallelSolver *s); // Gets a new unary literal + inline ParallelSolver* winner(){return jobFinishedBy;} // Gets the first solver that called IFinished() + + protected: + + ClausesBuffer clausesBuffer; // A big blackboard for all threads sharing non unary clauses + int nbThreads; // Number of threads + + // A set of mutex variables + pthread_mutex_t mutexSharedCompanion; // mutex for any high level sync between all threads (like reportf) + pthread_mutex_t mutexSharedClauseCompanion; // mutex for reading/writing clauses on the blackboard + pthread_mutex_t mutexSharedUnitCompanion; // mutex for reading/writing unit clauses on the blackboard + pthread_mutex_t mutexJobFinished; + + bool bjobFinished; + ParallelSolver *jobFinishedBy; + bool panicMode; // panicMode means no more increasing space needed + lbool jobStatus; // globale status of the job + + // Shared clauses are a queue of lits... + // friend class wholearnt; + vec nextUnit; // indice of next unit clause to retrieve for solver number i + vec unitLit; // Set of unit literals found so far + vec isUnary; // sign of the unary var (if proved, or l_Undef if not) + double random_seed; + + // Returns a random float 0 <= x < 1. Seed must never be 0. + static inline double drand(double& seed) { + seed *= 1389796; + int q = (int)(seed / 2147483647); + seed -= (double)q * 2147483647; + return seed / 2147483647; } + + // Returns a random integer 0 <= x < size. Seed must never be 0. + static inline int irand(double& seed, int size) { + return (int)(drand(seed) * size); } + +}; +} +#endif diff --git a/packages/bee/glucose-4/parallel/SolverCompanion.cc b/packages/bee/glucose-4/parallel/SolverCompanion.cc new file mode 100644 index 000000000..8cd5c5199 --- /dev/null +++ b/packages/bee/glucose-4/parallel/SolverCompanion.cc @@ -0,0 +1,87 @@ +/***************************************************************************************[SolverCompanion.cc] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +/* This class is a general companion for a solver. + * The idea is to be able to have different kind of companions: + * - SharedCompanion that shares clauses between threads + * - NetworkCompanion (Not in this version) that sends clauses over the network + * + * The implementaton is trivial. Just keep track of watched Solvers by the companion. + **/ + +#include "parallel/SolverCompanion.h" + +using namespace Glucose; + +SolverCompanion::SolverCompanion() +{} + +SolverCompanion::~SolverCompanion() +{} + + +bool SolverCompanion::addSolver(ParallelSolver* s) { + watchedSolvers.push(s); + return true; +} + +int SolverCompanion::runOnceCompanion() { + int errcode = 0; + for(int indexSolver = 0; indexSolver watchedSolvers; +}; +} +#endif + diff --git a/packages/bee/glucose-4/parallel/SolverConfiguration.cc b/packages/bee/glucose-4/parallel/SolverConfiguration.cc new file mode 100644 index 000000000..48127c298 --- /dev/null +++ b/packages/bee/glucose-4/parallel/SolverConfiguration.cc @@ -0,0 +1,131 @@ +/***************************************************************************************[SolverConfiguration.cc] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#include "parallel/MultiSolvers.h" +#include "core/Solver.h" +//#include "parallel/ParallelSolver.h" +#include "parallel/SolverConfiguration.h" + +using namespace Glucose; + + void SolverConfiguration::configure(MultiSolvers *ms, int nbsolvers) { + + if (nbsolvers < 2 ) return; + + ms->solvers[1]->var_decay = 0.94; + ms->solvers[1]->max_var_decay = 0.96; + ms->solvers[1]->firstReduceDB=600; + + if (nbsolvers < 3 ) return; + + ms->solvers[2]->var_decay = 0.90; + ms->solvers[2]->max_var_decay = 0.97; + ms->solvers[2]->firstReduceDB=500; + + if (nbsolvers < 4 ) return; + + ms->solvers[3]->var_decay = 0.85; + ms->solvers[3]->max_var_decay = 0.93; + ms->solvers[3]->firstReduceDB=400; + + if (nbsolvers < 5 ) return; + + // Glucose 2.0 (+ blocked restarts) + ms->solvers[4]->var_decay = 0.95; + ms->solvers[4]->max_var_decay = 0.95; + ms->solvers[4]->firstReduceDB=4000; + ms->solvers[4]->lbdQueue.growTo(100); + ms->solvers[4]->sizeLBDQueue = 100; + ms->solvers[4]->K = 0.7; + ms->solvers[4]->incReduceDB = 500; + + if (nbsolvers < 6 ) return; + + ms->solvers[5]->var_decay = 0.93; + ms->solvers[5]->max_var_decay = 0.96; + ms->solvers[5]->firstReduceDB=100; + ms->solvers[5]->incReduceDB = 500; + + if (nbsolvers < 7 ) return; + + ms->solvers[6]->var_decay = 0.75; + ms->solvers[6]->max_var_decay = 0.94; + ms->solvers[6]->firstReduceDB=2000; + + if (nbsolvers < 8 ) return; + + ms->solvers[7]->var_decay = 0.94; + ms->solvers[7]->max_var_decay = 0.96; + ms->solvers[7]->firstReduceDB=800; + + if (nbsolvers < 9) return; + + ms->solvers[8]->reduceOnSize = true; + + if (nbsolvers < 10 ) return; + + ms->solvers[9]->reduceOnSize = true; + ms->solvers[9]->reduceOnSizeSize = 14; + + if (nbsolvers < 11 ) return; + + double noisevar_decay = 0.005; + int noiseReduceDB = 50; + for (int i=10;isolvers[i]-> var_decay = ms->solvers[i%8]->var_decay; + ms->solvers[i]-> max_var_decay = ms->solvers[i%8]->max_var_decay; + ms->solvers[i]-> firstReduceDB= ms->solvers[i%8]->firstReduceDB; + ms->solvers[i]->var_decay += noisevar_decay; + ms->solvers[i]->firstReduceDB+=noiseReduceDB; + if ((i+1) % 8 == 0) { + noisevar_decay += 0.006; + noiseReduceDB += 25; + } + } + } diff --git a/packages/bee/glucose-4/parallel/SolverConfiguration.h b/packages/bee/glucose-4/parallel/SolverConfiguration.h new file mode 100644 index 000000000..475ec72c6 --- /dev/null +++ b/packages/bee/glucose-4/parallel/SolverConfiguration.h @@ -0,0 +1,68 @@ +/***************************************************************************************[SolverConfiguration.h] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + + +#ifndef SolverConfiguration_h +#define SolverConfiguration_h + + + +namespace Glucose { + +class MultiSolvers; + +class SolverConfiguration { + +public : + static void configure(MultiSolvers *ms, int nbsolvers); + +}; + +} +#endif diff --git a/packages/bee/glucose-4/simp/Main.cc b/packages/bee/glucose-4/simp/Main.cc new file mode 100644 index 000000000..ca3bf4299 --- /dev/null +++ b/packages/bee/glucose-4/simp/Main.cc @@ -0,0 +1,294 @@ +/***************************************************************************************[Main.cc] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#include + +#include +#include +#include + +#include "utils/System.h" +#include "utils/ParseUtils.h" +#include "utils/Options.h" +#include "core/Dimacs.h" +#include "simp/SimpSolver.h" + +using namespace Glucose; + +//================================================================================================= + +static const char* _certified = "CORE -- CERTIFIED UNSAT"; + +void printStats(Solver& solver) +{ + double cpu_time = cpuTime(); + double mem_used = 0;//memUsedPeak(); + printf("c restarts : %" PRIu64" (%" PRIu64" conflicts in avg)\n", solver.starts,(solver.starts>0 ?solver.conflicts/solver.starts : 0)); + printf("c blocked restarts : %" PRIu64" (multiple: %" PRIu64") \n", solver.nbstopsrestarts,solver.nbstopsrestartssame); + printf("c last block at restart : %" PRIu64"\n",solver.lastblockatrestart); + printf("c nb ReduceDB : %" PRIu64"\n", solver.nbReduceDB); + printf("c nb removed Clauses : %" PRIu64"\n",solver.nbRemovedClauses); + printf("c nb learnts DL2 : %" PRIu64"\n", solver.nbDL2); + printf("c nb learnts size 2 : %" PRIu64"\n", solver.nbBin); + printf("c nb learnts size 1 : %" PRIu64"\n", solver.nbUn); + + printf("c conflicts : %-12" PRIu64" (%.0f /sec)\n", solver.conflicts , solver.conflicts /cpu_time); + printf("c decisions : %-12" PRIu64" (%4.2f %% random) (%.0f /sec)\n", solver.decisions, (float)solver.rnd_decisions*100 / (float)solver.decisions, solver.decisions /cpu_time); + printf("c propagations : %-12" PRIu64" (%.0f /sec)\n", solver.propagations, solver.propagations/cpu_time); + printf("c conflict literals : %-12" PRIu64" (%4.2f %% deleted)\n", solver.tot_literals, (solver.max_literals - solver.tot_literals)*100 / (double)solver.max_literals); + printf("c nb reduced Clauses : %" PRIu64"\n",solver.nbReducedClauses); + + if (mem_used != 0) printf("Memory used : %.2f MB\n", mem_used); + printf("c CPU time : %g s\n", cpu_time); +} + + + +static Solver* solver; +// Terminate by notifying the solver and back out gracefully. This is mainly to have a test-case +// for this feature of the Solver as it may take longer than an immediate call to '_exit()'. +static void SIGINT_interrupt(int signum) { solver->interrupt(); } + +// Note that '_exit()' rather than 'exit()' has to be used. The reason is that 'exit()' calls +// destructors and may cause deadlocks if a malloc/free function happens to be running (these +// functions are guarded by locks for multithreaded use). +static void SIGINT_exit(int signum) { + printf("\n"); printf("*** INTERRUPTED ***\n"); + if (solver->verbosity > 0){ + printStats(*solver); + printf("\n"); printf("*** INTERRUPTED ***\n"); } + _exit(1); } + + +//================================================================================================= +// Main: + +int main(int argc, char** argv) +{ + try { + printf("c\nc This is glucose 4.0 -- based on MiniSAT (Many thanks to MiniSAT team)\nc\n"); + + + setUsageHelp("c USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); + + +#if defined(__linux__) + fpu_control_t oldcw, newcw; + _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); + //printf("c WARNING: for repeatability, setting FPU to use double precision\n"); +#endif + // Extra options: + // + IntOption verb ("MAIN", "verb", "Verbosity level (0=silent, 1=some, 2=more).", 1, IntRange(0, 2)); + BoolOption mod ("MAIN", "model", "show model.", false); + IntOption vv ("MAIN", "vv", "Verbosity every vv conflicts", 10000, IntRange(1,INT32_MAX)); + BoolOption pre ("MAIN", "pre", "Completely turn on/off any preprocessing.", true); + StringOption dimacs ("MAIN", "dimacs", "If given, stop after preprocessing and write the result to this file."); + IntOption cpu_lim("MAIN", "cpu-lim","Limit on CPU time allowed in seconds.\n", INT32_MAX, IntRange(0, INT32_MAX)); + IntOption mem_lim("MAIN", "mem-lim","Limit on memory usage in megabytes.\n", INT32_MAX, IntRange(0, INT32_MAX)); + // BoolOption opt_incremental ("MAIN","incremental", "Use incremental SAT solving",false); + + BoolOption opt_certified (_certified, "certified", "Certified UNSAT using DRUP format", false); + StringOption opt_certified_file (_certified, "certified-output", "Certified UNSAT output file", "NULL"); + + parseOptions(argc, argv, true); + + SimpSolver S; + double initial_time = cpuTime(); + + S.parsing = 1; + //if (!pre) S.eliminate(true); + + S.verbosity = verb; + S.verbEveryConflicts = vv; + S.showModel = mod; + + S.certifiedUNSAT = opt_certified; + if(S.certifiedUNSAT) { + if(!strcmp(opt_certified_file,"NULL")) { + S.certifiedOutput = fopen("/dev/stdout", "wb"); + } else { + S.certifiedOutput = fopen(opt_certified_file, "wb"); + } + fprintf(S.certifiedOutput,"o proof DRUP\n"); + } + + solver = &S; + // Use signal handlers that forcibly quit until the solver will be able to respond to + // interrupts: + signal(SIGINT, SIGINT_exit); + signal(SIGXCPU,SIGINT_exit); + + + // Set limit on CPU-time: + if (cpu_lim != INT32_MAX){ + rlimit rl; + getrlimit(RLIMIT_CPU, &rl); + if (rl.rlim_max == RLIM_INFINITY || (rlim_t)cpu_lim < rl.rlim_max){ + rl.rlim_cur = cpu_lim; + if (setrlimit(RLIMIT_CPU, &rl) == -1) + printf("c WARNING! Could not set resource limit: CPU-time.\n"); + } } + + // Set limit on virtual memory: + if (mem_lim != INT32_MAX){ + rlim_t new_mem_lim = (rlim_t)mem_lim * 1024*1024; + rlimit rl; + getrlimit(RLIMIT_AS, &rl); + if (rl.rlim_max == RLIM_INFINITY || new_mem_lim < rl.rlim_max){ + rl.rlim_cur = new_mem_lim; + if (setrlimit(RLIMIT_AS, &rl) == -1) + printf("c WARNING! Could not set resource limit: Virtual memory.\n"); + } } + + if (argc == 1) + printf("c Reading from standard input... Use '--help' for help.\n"); + + gzFile in = (argc == 1) ? gzdopen(0, "rb") : gzopen(argv[1], "rb"); + if (in == NULL) + printf("ERROR! Could not open file: %s\n", argc == 1 ? "" : argv[1]), exit(1); + + if (S.verbosity > 0){ + printf("c ========================================[ Problem Statistics ]===========================================\n"); + printf("c | |\n"); } + + FILE* res = (argc >= 3) ? fopen(argv[argc-1], "wb") : NULL; + parse_DIMACS(in, S); + gzclose(in); + + if (S.verbosity > 0){ + printf("c | Number of variables: %12d |\n", S.nVars()); + printf("c | Number of clauses: %12d |\n", S.nClauses()); } + + double parsed_time = cpuTime(); + if (S.verbosity > 0){ + printf("c | Parse time: %12.2f s |\n", parsed_time - initial_time); + printf("c | |\n"); } + + // Change to signal-handlers that will only notify the solver and allow it to terminate + // voluntarily: + signal(SIGINT, SIGINT_interrupt); + signal(SIGXCPU,SIGINT_interrupt); + + S.parsing = 0; + if(pre/* && !S.isIncremental()*/) { + printf("c | Preprocesing is fully done\n"); + S.eliminate(true); + double simplified_time = cpuTime(); + if (S.verbosity > 0){ + printf("c | Simplification time: %12.2f s |\n", simplified_time - parsed_time); + } + } + printf("c | |\n"); + if (!S.okay()){ + if (S.certifiedUNSAT) fprintf(S.certifiedOutput, "0\n"), fclose(S.certifiedOutput); + if (res != NULL) fprintf(res, "UNSAT\n"), fclose(res); + if (S.verbosity > 0){ + printf("c =========================================================================================================\n"); + printf("Solved by simplification\n"); + printStats(S); + printf("\n"); } + printf("s UNSATISFIABLE\n"); + exit(20); + } + + if (dimacs){ + if (S.verbosity > 0) + printf("c =======================================[ Writing DIMACS ]===============================================\n"); + S.toDimacs((const char*)dimacs); + if (S.verbosity > 0) + printStats(S); + exit(0); + } + + vec dummy; + lbool ret = S.solveLimited(dummy); + + if (S.verbosity > 0){ + printStats(S); + printf("\n"); } + printf(ret == l_True ? "s SATISFIABLE\n" : ret == l_False ? "s UNSATISFIABLE\n" : "s INDETERMINATE\n"); + + if (res != NULL){ + if (ret == l_True){ + printf("SAT\n"); + for (int i = 0; i < S.nVars(); i++) + if (S.model[i] != l_Undef) + fprintf(res, "%s%s%d", (i==0)?"":" ", (S.model[i]==l_True)?"":"-", i+1); + fprintf(res, " 0\n"); + } else { + if (ret == l_False){ + fprintf(res, "UNSAT\n"); + } + } + fclose(res); + } else { + if(S.showModel && ret==l_True) { + printf("v "); + for (int i = 0; i < S.nVars(); i++) + if (S.model[i] != l_Undef) + printf("%s%s%d", (i==0)?"":" ", (S.model[i]==l_True)?"":"-", i+1); + printf(" 0\n"); + } + + } + + if (S.certifiedUNSAT) fprintf(S.certifiedOutput, "0\n"), fclose(S.certifiedOutput); + +#ifdef NDEBUG + exit(ret == l_True ? 10 : ret == l_False ? 20 : 0); // (faster than "return", which will invoke the destructor for 'Solver') +#else + return (ret == l_True ? 10 : ret == l_False ? 20 : 0); +#endif + } catch (OutOfMemoryException&){ + printf("c =========================================================================================================\n"); + printf("INDETERMINATE\n"); + exit(0); + } +} diff --git a/packages/bee/glucose-4/simp/SimpSolver.cc b/packages/bee/glucose-4/simp/SimpSolver.cc new file mode 100644 index 000000000..84bc72527 --- /dev/null +++ b/packages/bee/glucose-4/simp/SimpSolver.cc @@ -0,0 +1,826 @@ +/***************************************************************************************[SimpSolver.cc] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#include "mtl/Sort.h" +#include "simp/SimpSolver.h" +#include "utils/System.h" + +using namespace Glucose; + +//================================================================================================= +// Options: + + +static const char* _cat = "SIMP"; + +static BoolOption opt_use_asymm (_cat, "asymm", "Shrink clauses by asymmetric branching.", false); +static BoolOption opt_use_rcheck (_cat, "rcheck", "Check if a clause is already implied. (costly)", false); +static BoolOption opt_use_elim (_cat, "elim", "Perform variable elimination.", true); +static IntOption opt_grow (_cat, "grow", "Allow a variable elimination step to grow by a number of clauses.", 0); +static IntOption opt_clause_lim (_cat, "cl-lim", "Variables are not eliminated if it produces a resolvent with a length above this limit. -1 means no limit", 20, IntRange(-1, INT32_MAX)); +static IntOption opt_subsumption_lim (_cat, "sub-lim", "Do not check if subsumption against a clause larger than this. -1 means no limit.", 1000, IntRange(-1, INT32_MAX)); +static DoubleOption opt_simp_garbage_frac(_cat, "simp-gc-frac", "The fraction of wasted memory allowed before a garbage collection is triggered during simplification.", 0.5, DoubleRange(0, false, HUGE_VAL, false)); + + +//================================================================================================= +// Constructor/Destructor: + + +SimpSolver::SimpSolver() : + Solver() + , grow (opt_grow) + , clause_lim (opt_clause_lim) + , subsumption_lim (opt_subsumption_lim) + , simp_garbage_frac (opt_simp_garbage_frac) + , use_asymm (opt_use_asymm) + , use_rcheck (opt_use_rcheck) + , use_elim (opt_use_elim) + , merges (0) + , asymm_lits (0) + , eliminated_vars (0) + , elimorder (1) + , use_simplification (true) + , occurs (ClauseDeleted(ca)) + , elim_heap (ElimLt(n_occ)) + , bwdsub_assigns (0) + , n_touched (0) +{ + vec dummy(1,lit_Undef); + ca.extra_clause_field = true; // NOTE: must happen before allocating the dummy clause below. + bwdsub_tmpunit = ca.alloc(dummy); + remove_satisfied = false; +} + + +SimpSolver::~SimpSolver() +{ +} + + + +SimpSolver::SimpSolver(const SimpSolver &s) : Solver(s) + , grow (s.grow) + , clause_lim (s.clause_lim) + , subsumption_lim (s.subsumption_lim) + , simp_garbage_frac (s.simp_garbage_frac) + , use_asymm (s.use_asymm) + , use_rcheck (s.use_rcheck) + , use_elim (s.use_elim) + , merges (s.merges) + , asymm_lits (s.asymm_lits) + , eliminated_vars (s.eliminated_vars) + , elimorder (s.elimorder) + , use_simplification (s.use_simplification) + , occurs (ClauseDeleted(ca)) + , elim_heap (ElimLt(n_occ)) + , bwdsub_assigns (s.bwdsub_assigns) + , n_touched (s.n_touched) +{ + // TODO: Copy dummy... what is it??? + vec dummy(1,lit_Undef); + ca.extra_clause_field = true; // NOTE: must happen before allocating the dummy clause below. + bwdsub_tmpunit = ca.alloc(dummy); + remove_satisfied = false; + //End TODO + + + s.elimclauses.memCopyTo(elimclauses); + s.touched.memCopyTo(touched); + s.occurs.copyTo(occurs); + s.n_occ.memCopyTo(n_occ); + s.elim_heap.copyTo(elim_heap); + s.subsumption_queue.copyTo(subsumption_queue); + s.frozen.memCopyTo(frozen); + s.eliminated.memCopyTo(eliminated); + + use_simplification = s.use_simplification; + bwdsub_assigns = s.bwdsub_assigns; + n_touched = s.n_touched; + bwdsub_tmpunit = s.bwdsub_tmpunit; + qhead = s.qhead; + ok = s.ok; +} + + + +Var SimpSolver::newVar(bool sign, bool dvar) { + Var v = Solver::newVar(sign, dvar); + frozen .push((char)false); + eliminated.push((char)false); + + if (use_simplification){ + n_occ .push(0); + n_occ .push(0); + occurs .init(v); + touched .push(0); + elim_heap .insert(v); + } + return v; } + +lbool SimpSolver::solve_(bool do_simp, bool turn_off_simp) +{ + vec extra_frozen; + lbool result = l_True; + do_simp &= use_simplification; + + if (do_simp){ + // Assumptions must be temporarily frozen to run variable elimination: + for (int i = 0; i < assumptions.size(); i++){ + Var v = var(assumptions[i]); + + // If an assumption has been eliminated, remember it. + assert(!isEliminated(v)); + + if (!frozen[v]){ + // Freeze and store. + setFrozen(v, true); + extra_frozen.push(v); + } } + + result = lbool(eliminate(turn_off_simp)); + } + + if (result == l_True) + result = Solver::solve_(); + else if (verbosity >= 1) + printf("===============================================================================\n"); + + if (result == l_True) + extendModel(); + + if (do_simp) + // Unfreeze the assumptions that were frozen: + for (int i = 0; i < extra_frozen.size(); i++) + setFrozen(extra_frozen[i], false); + + + return result; +} + + + +bool SimpSolver::addClause_(vec& ps) +{ +#ifndef NDEBUG + for (int i = 0; i < ps.size(); i++) + assert(!isEliminated(var(ps[i]))); +#endif + int nclauses = clauses.size(); + + if (use_rcheck && implied(ps)) + return true; + + if (!Solver::addClause_(ps)) + return false; + + if(!parsing && certifiedUNSAT) { + for (int i = 0; i < ps.size(); i++) + fprintf(certifiedOutput, "%i " , (var(ps[i]) + 1) * (-2 * sign(ps[i]) + 1) ); + fprintf(certifiedOutput, "0\n"); + } + + if (use_simplification && clauses.size() == nclauses + 1){ + CRef cr = clauses.last(); + const Clause& c = ca[cr]; + + // NOTE: the clause is added to the queue immediately and then + // again during 'gatherTouchedClauses()'. If nothing happens + // in between, it will only be checked once. Otherwise, it may + // be checked twice unnecessarily. This is an unfortunate + // consequence of how backward subsumption is used to mimic + // forward subsumption. + subsumption_queue.insert(cr); + for (int i = 0; i < c.size(); i++){ + occurs[var(c[i])].push(cr); + n_occ[toInt(c[i])]++; + touched[var(c[i])] = 1; + n_touched++; + if (elim_heap.inHeap(var(c[i]))) + elim_heap.increase(var(c[i])); + } + } + + return true; +} + + + +void SimpSolver::removeClause(CRef cr,bool inPurgatory) +{ + const Clause& c = ca[cr]; + + if (use_simplification) + for (int i = 0; i < c.size(); i++){ + n_occ[toInt(c[i])]--; + updateElimHeap(var(c[i])); + occurs.smudge(var(c[i])); + } + + Solver::removeClause(cr,inPurgatory); +} + + +bool SimpSolver::strengthenClause(CRef cr, Lit l) +{ + Clause& c = ca[cr]; + assert(decisionLevel() == 0); + assert(use_simplification); + + // FIX: this is too inefficient but would be nice to have (properly implemented) + // if (!find(subsumption_queue, &c)) + subsumption_queue.insert(cr); + + if (certifiedUNSAT) { + for (int i = 0; i < c.size(); i++) + if (c[i] != l) fprintf(certifiedOutput, "%i " , (var(c[i]) + 1) * (-2 * sign(c[i]) + 1) ); + fprintf(certifiedOutput, "0\n"); + } + + if (c.size() == 2){ + removeClause(cr); + c.strengthen(l); + }else{ + if (certifiedUNSAT) { + fprintf(certifiedOutput, "d "); + for (int i = 0; i < c.size(); i++) + fprintf(certifiedOutput, "%i " , (var(c[i]) + 1) * (-2 * sign(c[i]) + 1) ); + fprintf(certifiedOutput, "0\n"); + } + + detachClause(cr, true); + c.strengthen(l); + attachClause(cr); + remove(occurs[var(l)], cr); + n_occ[toInt(l)]--; + updateElimHeap(var(l)); + } + + return c.size() == 1 ? enqueue(c[0]) && propagate() == CRef_Undef : true; +} + + +// Returns FALSE if clause is always satisfied ('out_clause' should not be used). +bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, vec& out_clause) +{ + merges++; + out_clause.clear(); + + bool ps_smallest = _ps.size() < _qs.size(); + const Clause& ps = ps_smallest ? _qs : _ps; + const Clause& qs = ps_smallest ? _ps : _qs; + + for (int i = 0; i < qs.size(); i++){ + if (var(qs[i]) != v){ + for (int j = 0; j < ps.size(); j++) + if (var(ps[j]) == var(qs[i])) + if (ps[j] == ~qs[i]) + return false; + else + goto next; + out_clause.push(qs[i]); + } + next:; + } + + for (int i = 0; i < ps.size(); i++) + if (var(ps[i]) != v) + out_clause.push(ps[i]); + + return true; +} + + +// Returns FALSE if clause is always satisfied. +bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, int& size) +{ + merges++; + + bool ps_smallest = _ps.size() < _qs.size(); + const Clause& ps = ps_smallest ? _qs : _ps; + const Clause& qs = ps_smallest ? _ps : _qs; + const Lit* __ps = (const Lit*)ps; + const Lit* __qs = (const Lit*)qs; + + size = ps.size()-1; + + for (int i = 0; i < qs.size(); i++){ + if (var(__qs[i]) != v){ + for (int j = 0; j < ps.size(); j++) + if (var(__ps[j]) == var(__qs[i])) + if (__ps[j] == ~__qs[i]) + return false; + else + goto next; + size++; + } + next:; + } + + return true; +} + + +void SimpSolver::gatherTouchedClauses() +{ + if (n_touched == 0) return; + + int i,j; + for (i = j = 0; i < subsumption_queue.size(); i++) + if (ca[subsumption_queue[i]].mark() == 0) + ca[subsumption_queue[i]].mark(2); + + for (i = 0; i < touched.size(); i++) + if (touched[i]){ + const vec& cs = occurs.lookup(i); + for (j = 0; j < cs.size(); j++) + if (ca[cs[j]].mark() == 0){ + subsumption_queue.insert(cs[j]); + ca[cs[j]].mark(2); + } + touched[i] = 0; + } + + for (i = 0; i < subsumption_queue.size(); i++) + if (ca[subsumption_queue[i]].mark() == 2) + ca[subsumption_queue[i]].mark(0); + + n_touched = 0; +} + + +bool SimpSolver::implied(const vec& c) +{ + assert(decisionLevel() == 0); + + trail_lim.push(trail.size()); + for (int i = 0; i < c.size(); i++) + if (value(c[i]) == l_True){ + cancelUntil(0); + return false; + }else if (value(c[i]) != l_False){ + assert(value(c[i]) == l_Undef); + uncheckedEnqueue(~c[i]); + } + + bool result = propagate() != CRef_Undef; + cancelUntil(0); + return result; +} + + +// Backward subsumption + backward subsumption resolution +bool SimpSolver::backwardSubsumptionCheck(bool verbose) +{ + int cnt = 0; + int subsumed = 0; + int deleted_literals = 0; + assert(decisionLevel() == 0); + + while (subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()){ + + // Empty subsumption queue and return immediately on user-interrupt: + if (asynch_interrupt){ + subsumption_queue.clear(); + bwdsub_assigns = trail.size(); + break; } + + // Check top-level assignments by creating a dummy clause and placing it in the queue: + if (subsumption_queue.size() == 0 && bwdsub_assigns < trail.size()){ + Lit l = trail[bwdsub_assigns++]; + ca[bwdsub_tmpunit][0] = l; + ca[bwdsub_tmpunit].calcAbstraction(); + subsumption_queue.insert(bwdsub_tmpunit); } + + CRef cr = subsumption_queue.peek(); subsumption_queue.pop(); + Clause& c = ca[cr]; + + if (c.mark()) continue; + + if (verbose && verbosity >= 2 && cnt++ % 1000 == 0) + printf("subsumption left: %10d (%10d subsumed, %10d deleted literals)\r", subsumption_queue.size(), subsumed, deleted_literals); + + assert(c.size() > 1 || value(c[0]) == l_True); // Unit-clauses should have been propagated before this point. + + // Find best variable to scan: + Var best = var(c[0]); + for (int i = 1; i < c.size(); i++) + if (occurs[var(c[i])].size() < occurs[best].size()) + best = var(c[i]); + + // Search all candidates: + vec& _cs = occurs.lookup(best); + CRef* cs = (CRef*)_cs; + + for (int j = 0; j < _cs.size(); j++) + if (c.mark()) + break; + else if (!ca[cs[j]].mark() && cs[j] != cr && (subsumption_lim == -1 || ca[cs[j]].size() < subsumption_lim)){ + Lit l = c.subsumes(ca[cs[j]]); + + if (l == lit_Undef) + subsumed++, removeClause(cs[j]); + else if (l != lit_Error){ + deleted_literals++; + + if (!strengthenClause(cs[j], ~l)) + return false; + + // Did current candidate get deleted from cs? Then check candidate at index j again: + if (var(l) == best) + j--; + } + } + } + + return true; +} + + +bool SimpSolver::asymm(Var v, CRef cr) +{ + Clause& c = ca[cr]; + assert(decisionLevel() == 0); + + if (c.mark() || satisfied(c)) return true; + + trail_lim.push(trail.size()); + Lit l = lit_Undef; + for (int i = 0; i < c.size(); i++) + if (var(c[i]) != v && value(c[i]) != l_False) + uncheckedEnqueue(~c[i]); + else + l = c[i]; + + if (propagate() != CRef_Undef){ + cancelUntil(0); + asymm_lits++; + if (!strengthenClause(cr, l)) + return false; + }else + cancelUntil(0); + + return true; +} + + +bool SimpSolver::asymmVar(Var v) +{ + assert(use_simplification); + + const vec& cls = occurs.lookup(v); + + if (value(v) != l_Undef || cls.size() == 0) + return true; + + for (int i = 0; i < cls.size(); i++) + if (!asymm(v, cls[i])) + return false; + + return backwardSubsumptionCheck(); +} + + +static void mkElimClause(vec& elimclauses, Lit x) +{ + elimclauses.push(toInt(x)); + elimclauses.push(1); +} + + +static void mkElimClause(vec& elimclauses, Var v, Clause& c) +{ + int first = elimclauses.size(); + int v_pos = -1; + + // Copy clause to elimclauses-vector. Remember position where the + // variable 'v' occurs: + for (int i = 0; i < c.size(); i++){ + elimclauses.push(toInt(c[i])); + if (var(c[i]) == v) + v_pos = i + first; + } + assert(v_pos != -1); + + // Swap the first literal with the 'v' literal, so that the literal + // containing 'v' will occur first in the clause: + uint32_t tmp = elimclauses[v_pos]; + elimclauses[v_pos] = elimclauses[first]; + elimclauses[first] = tmp; + + // Store the length of the clause last: + elimclauses.push(c.size()); +} + + + +bool SimpSolver::eliminateVar(Var v) +{ + assert(!frozen[v]); + assert(!isEliminated(v)); + assert(value(v) == l_Undef); + + // Split the occurrences into positive and negative: + // + const vec& cls = occurs.lookup(v); + vec pos, neg; + for (int i = 0; i < cls.size(); i++) + (find(ca[cls[i]], mkLit(v)) ? pos : neg).push(cls[i]); + + // Check wether the increase in number of clauses stays within the allowed ('grow'). Moreover, no + // clause must exceed the limit on the maximal clause size (if it is set): + // + int cnt = 0; + int clause_size = 0; + + for (int i = 0; i < pos.size(); i++) + for (int j = 0; j < neg.size(); j++) + if (merge(ca[pos[i]], ca[neg[j]], v, clause_size) && + (++cnt > cls.size() + grow || (clause_lim != -1 && clause_size > clause_lim))) + return true; + + // Delete and store old clauses: + eliminated[v] = true; + setDecisionVar(v, false); + eliminated_vars++; + + if (pos.size() > neg.size()){ + for (int i = 0; i < neg.size(); i++) + mkElimClause(elimclauses, v, ca[neg[i]]); + mkElimClause(elimclauses, mkLit(v)); + }else{ + for (int i = 0; i < pos.size(); i++) + mkElimClause(elimclauses, v, ca[pos[i]]); + mkElimClause(elimclauses, ~mkLit(v)); + } + + + // Produce clauses in cross product: + vec& resolvent = add_tmp; + for (int i = 0; i < pos.size(); i++) + for (int j = 0; j < neg.size(); j++) + if (merge(ca[pos[i]], ca[neg[j]], v, resolvent) && !addClause_(resolvent)) + return false; + + for (int i = 0; i < cls.size(); i++) + removeClause(cls[i]); + + // Free occurs list for this variable: + occurs[v].clear(true); + + // Free watchers lists for this variable, if possible: + if (watches[ mkLit(v)].size() == 0) watches[ mkLit(v)].clear(true); + if (watches[~mkLit(v)].size() == 0) watches[~mkLit(v)].clear(true); + + return backwardSubsumptionCheck(); +} + + +bool SimpSolver::substitute(Var v, Lit x) +{ + assert(!frozen[v]); + assert(!isEliminated(v)); + assert(value(v) == l_Undef); + + if (!ok) return false; + + eliminated[v] = true; + setDecisionVar(v, false); + const vec& cls = occurs.lookup(v); + + vec& subst_clause = add_tmp; + for (int i = 0; i < cls.size(); i++){ + Clause& c = ca[cls[i]]; + + subst_clause.clear(); + for (int j = 0; j < c.size(); j++){ + Lit p = c[j]; + subst_clause.push(var(p) == v ? x ^ sign(p) : p); + } + + + if (!addClause_(subst_clause)) + return ok = false; + + removeClause(cls[i]); + + } + + return true; +} + + +void SimpSolver::extendModel() +{ + int i, j; + Lit x; + + if(model.size()==0) model.growTo(nVars()); + + for (i = elimclauses.size()-1; i > 0; i -= j){ + for (j = elimclauses[i--]; j > 1; j--, i--) + if (modelValue(toLit(elimclauses[i])) != l_False) + goto next; + + x = toLit(elimclauses[i]); + model[var(x)] = lbool(!sign(x)); + next:; + } +} + + +bool SimpSolver::eliminate(bool turn_off_elim) +{ + if (!simplify()) { + ok = false; + return false; + } + else if (!use_simplification) + return true; + + // Main simplification loop: + // + + int toPerform = clauses.size()<=4800000; + + if(!toPerform) { + printf("c Too many clauses... No preprocessing\n"); + } + + while (toPerform && (n_touched > 0 || bwdsub_assigns < trail.size() || elim_heap.size() > 0)){ + + gatherTouchedClauses(); + // printf(" ## (time = %6.2f s) BWD-SUB: queue = %d, trail = %d\n", cpuTime(), subsumption_queue.size(), trail.size() - bwdsub_assigns); + if ((subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()) && + !backwardSubsumptionCheck(true)){ + ok = false; goto cleanup; } + + // Empty elim_heap and return immediately on user-interrupt: + if (asynch_interrupt){ + assert(bwdsub_assigns == trail.size()); + assert(subsumption_queue.size() == 0); + assert(n_touched == 0); + elim_heap.clear(); + goto cleanup; } + + // printf(" ## (time = %6.2f s) ELIM: vars = %d\n", cpuTime(), elim_heap.size()); + for (int cnt = 0; !elim_heap.empty(); cnt++){ + Var elim = elim_heap.removeMin(); + + if (asynch_interrupt) break; + + if (isEliminated(elim) || value(elim) != l_Undef) continue; + + if (verbosity >= 2 && cnt % 100 == 0) + printf("elimination left: %10d\r", elim_heap.size()); + + if (use_asymm){ + // Temporarily freeze variable. Otherwise, it would immediately end up on the queue again: + bool was_frozen = frozen[elim]; + frozen[elim] = true; + if (!asymmVar(elim)){ + ok = false; goto cleanup; } + frozen[elim] = was_frozen; } + + // At this point, the variable may have been set by assymetric branching, so check it + // again. Also, don't eliminate frozen variables: + if (use_elim && value(elim) == l_Undef && !frozen[elim] && !eliminateVar(elim)){ + ok = false; goto cleanup; } + + checkGarbage(simp_garbage_frac); + } + + assert(subsumption_queue.size() == 0); + } + cleanup: + + // If no more simplification is needed, free all simplification-related data structures: + if (turn_off_elim){ + touched .clear(true); + occurs .clear(true); + n_occ .clear(true); + elim_heap.clear(true); + subsumption_queue.clear(true); + + use_simplification = false; + remove_satisfied = true; + ca.extra_clause_field = false; + + // Force full cleanup (this is safe and desirable since it only happens once): + rebuildOrderHeap(); + garbageCollect(); + }else{ + // Cheaper cleanup: + cleanUpClauses(); // TODO: can we make 'cleanUpClauses()' not be linear in the problem size somehow? + checkGarbage(); + } + + if (verbosity >= 0 && elimclauses.size() > 0) + printf("c | Eliminated clauses: %10.2f Mb |\n", + double(elimclauses.size() * sizeof(uint32_t)) / (1024*1024)); + + + return ok; + + +} + + +void SimpSolver::cleanUpClauses() +{ + occurs.cleanAll(); + int i,j; + for (i = j = 0; i < clauses.size(); i++) + if (ca[clauses[i]].mark() == 0) + clauses[j++] = clauses[i]; + clauses.shrink(i - j); +} + + +//================================================================================================= +// Garbage Collection methods: + + +void SimpSolver::relocAll(ClauseAllocator& to) +{ + if (!use_simplification) return; + + // All occurs lists: + // + for (int i = 0; i < nVars(); i++){ + vec& cs = occurs[i]; + for (int j = 0; j < cs.size(); j++) + ca.reloc(cs[j], to); + } + + // Subsumption queue: + // + for (int i = 0; i < subsumption_queue.size(); i++) + ca.reloc(subsumption_queue[i], to); + + // Temporary clause: + // + ca.reloc(bwdsub_tmpunit, to); +} + + +void SimpSolver::garbageCollect() +{ + // Initialize the next region to a size corresponding to the estimated utilization degree. This + // is not precise but should avoid some unnecessary reallocations for the new region: + ClauseAllocator to(ca.size() - ca.wasted()); + + cleanUpClauses(); + to.extra_clause_field = ca.extra_clause_field; // NOTE: this is important to keep (or lose) the extra fields. + relocAll(to); + Solver::relocAll(to); + if (verbosity >= 2) + printf("| Garbage collection: %12d bytes => %12d bytes |\n", + ca.size()*ClauseAllocator::Unit_Size, to.size()*ClauseAllocator::Unit_Size); + to.moveTo(ca); +} diff --git a/packages/bee/glucose-4/simp/SimpSolver.h b/packages/bee/glucose-4/simp/SimpSolver.h new file mode 100644 index 000000000..5f457a803 --- /dev/null +++ b/packages/bee/glucose-4/simp/SimpSolver.h @@ -0,0 +1,237 @@ +/***************************************************************************************[SimpSolver.h] + Glucose -- Copyright (c) 2009-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + LRI - Univ. Paris Sud, France (2009-2013) + Labri - Univ. Bordeaux, France + + Syrup (Glucose Parallel) -- Copyright (c) 2013-2014, Gilles Audemard, Laurent Simon + CRIL - Univ. Artois, France + Labri - Univ. Bordeaux, France + +Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of +Glucose (sources until 2013, Glucose 3.0, single core) are exactly the same as Minisat on which it +is based on. (see below). + +Glucose-Syrup sources are based on another copyright. Permissions and copyrights for the parallel +version of Glucose-Syrup (the "Software") are granted, free of charge, to deal with the Software +without restriction, including the rights to use, copy, modify, merge, publish, distribute, +sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +- The above and below copyrights notices and this permission notice shall be included in all +copies or substantial portions of the Software; +- The parallel version of Glucose (all files modified since Glucose 3.0 releases, 2013) cannot +be used in any competitive event (sat competitions/evaluations) without the express permission of +the authors (Gilles Audemard / Laurent Simon). This is also the case for any competitive event +using Glucose Parallel as an embedded SAT engine (single core or not). + + +--------------- Original Minisat Copyrights + +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + **************************************************************************************************/ + +#ifndef Glucose_SimpSolver_h +#define Glucose_SimpSolver_h + +#include "mtl/Queue.h" +#include "core/Solver.h" +#include "mtl/Clone.h" + +namespace Glucose { + +//================================================================================================= + + +class SimpSolver : public Solver { + public: + // Constructor/Destructor: + // + SimpSolver(); + ~SimpSolver(); + + SimpSolver(const SimpSolver &s); + + + /** + * Clone function + */ + virtual Clone* clone() const { + return new SimpSolver(*this); + } + + + // Problem specification: + // + virtual Var newVar (bool polarity = true, bool dvar = true); // Add a new variable with parameters specifying variable mode. + bool addClause (const vec& ps); + bool addEmptyClause(); // Add the empty clause to the solver. + bool addClause (Lit p); // Add a unit clause to the solver. + bool addClause (Lit p, Lit q); // Add a binary clause to the solver. + bool addClause (Lit p, Lit q, Lit r); // Add a ternary clause to the solver. + virtual bool addClause_( vec& ps); + bool substitute(Var v, Lit x); // Replace all occurences of v with x (may cause a contradiction). + + // Variable mode: + // + void setFrozen (Var v, bool b); // If a variable is frozen it will not be eliminated. + bool isEliminated(Var v) const; + + // Solving: + // + bool solve (const vec& assumps, bool do_simp = true, bool turn_off_simp = false); + lbool solveLimited(const vec& assumps, bool do_simp = true, bool turn_off_simp = false); + bool solve ( bool do_simp = true, bool turn_off_simp = false); + bool solve (Lit p , bool do_simp = true, bool turn_off_simp = false); + bool solve (Lit p, Lit q, bool do_simp = true, bool turn_off_simp = false); + bool solve (Lit p, Lit q, Lit r, bool do_simp = true, bool turn_off_simp = false); + bool eliminate (bool turn_off_elim = false); // Perform variable elimination based simplification. + + // Memory managment: + // + virtual void garbageCollect(); + + + // Generate a (possibly simplified) DIMACS file: + // +#if 0 + void toDimacs (const char* file, const vec& assumps); + void toDimacs (const char* file); + void toDimacs (const char* file, Lit p); + void toDimacs (const char* file, Lit p, Lit q); + void toDimacs (const char* file, Lit p, Lit q, Lit r); +#endif + + // Mode of operation: + // + int parsing; + int grow; // Allow a variable elimination step to grow by a number of clauses (default to zero). + int clause_lim; // Variables are not eliminated if it produces a resolvent with a length above this limit. + // -1 means no limit. + int subsumption_lim; // Do not check if subsumption against a clause larger than this. -1 means no limit. + double simp_garbage_frac; // A different limit for when to issue a GC during simplification (Also see 'garbage_frac'). + + bool use_asymm; // Shrink clauses by asymmetric branching. + bool use_rcheck; // Check if a clause is already implied. Prett costly, and subsumes subsumptions :) + bool use_elim; // Perform variable elimination. + // Statistics: + // + int merges; + int asymm_lits; + int eliminated_vars; + + protected: + + // Helper structures: + // + struct ElimLt { + const vec& n_occ; + explicit ElimLt(const vec& no) : n_occ(no) {} + + // TODO: are 64-bit operations here noticably bad on 32-bit platforms? Could use a saturating + // 32-bit implementation instead then, but this will have to do for now. + uint64_t cost (Var x) const { return (uint64_t)n_occ[toInt(mkLit(x))] * (uint64_t)n_occ[toInt(~mkLit(x))]; } + bool operator()(Var x, Var y) const { return cost(x) < cost(y); } + + // TODO: investigate this order alternative more. + // bool operator()(Var x, Var y) const { + // int c_x = cost(x); + // int c_y = cost(y); + // return c_x < c_y || c_x == c_y && x < y; } + }; + + struct ClauseDeleted { + const ClauseAllocator& ca; + explicit ClauseDeleted(const ClauseAllocator& _ca) : ca(_ca) {} + bool operator()(const CRef& cr) const { return ca[cr].mark() == 1; } }; + + // Solver state: + // + int elimorder; + bool use_simplification; + vec elimclauses; + vec touched; + OccLists, ClauseDeleted> + occurs; + vec n_occ; + Heap elim_heap; + Queue subsumption_queue; + vec frozen; + vec eliminated; + int bwdsub_assigns; + int n_touched; + + // Temporaries: + // + CRef bwdsub_tmpunit; + + // Main internal methods: + // + virtual lbool solve_ (bool do_simp = true, bool turn_off_simp = false); + bool asymm (Var v, CRef cr); + bool asymmVar (Var v); + void updateElimHeap (Var v); + void gatherTouchedClauses (); + bool merge (const Clause& _ps, const Clause& _qs, Var v, vec& out_clause); + bool merge (const Clause& _ps, const Clause& _qs, Var v, int& size); + bool backwardSubsumptionCheck (bool verbose = false); + bool eliminateVar (Var v); + void extendModel (); + + void removeClause (CRef cr,bool inPurgatory=false); + bool strengthenClause (CRef cr, Lit l); + void cleanUpClauses (); + bool implied (const vec& c); + virtual void relocAll (ClauseAllocator& to); +}; + + +//================================================================================================= +// Implementation of inline methods: + + +inline bool SimpSolver::isEliminated (Var v) const { return eliminated[v]; } +inline void SimpSolver::updateElimHeap(Var v) { + assert(use_simplification); + // if (!frozen[v] && !isEliminated(v) && value(v) == l_Undef) + if (elim_heap.inHeap(v) || (!frozen[v] && !isEliminated(v) && value(v) == l_Undef)) + elim_heap.update(v); } + + +inline bool SimpSolver::addClause (const vec& ps) { ps.copyTo(add_tmp); return addClause_(add_tmp); } +inline bool SimpSolver::addEmptyClause() { add_tmp.clear(); return addClause_(add_tmp); } +inline bool SimpSolver::addClause (Lit p) { add_tmp.clear(); add_tmp.push(p); return addClause_(add_tmp); } +inline bool SimpSolver::addClause (Lit p, Lit q) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); } +inline bool SimpSolver::addClause (Lit p, Lit q, Lit r) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); } +inline void SimpSolver::setFrozen (Var v, bool b) { frozen[v] = (char)b; if (use_simplification && !b) { updateElimHeap(v); } } + +inline bool SimpSolver::solve ( bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (Lit p , bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (Lit p, Lit q, bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (Lit p, Lit q, Lit r, bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (const vec& assumps, bool do_simp, bool turn_off_simp){ + budgetOff(); assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp) == l_True; } + +inline lbool SimpSolver::solveLimited (const vec& assumps, bool do_simp, bool turn_off_simp){ + assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp); } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/utils/Options.cc b/packages/bee/glucose-4/utils/Options.cc new file mode 100644 index 000000000..dd225eacc --- /dev/null +++ b/packages/bee/glucose-4/utils/Options.cc @@ -0,0 +1,91 @@ ++/**************************************************************************************[Options.cc] +Copyright (c) 2008-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include "mtl/Sort.h" +#include "utils/Options.h" +//#include "utils/ParseUtils.h" + +using namespace Glucose; + +void Glucose::parseOptions(int& argc, char** argv, bool strict) +{ + int i, j; + for (i = j = 1; i < argc; i++){ + const char* str = argv[i]; + if (match(str, "--") && match(str, Option::getHelpPrefixString()) && match(str, "help")){ + if (*str == '\0') + printUsageAndExit(argc, argv); + else if (match(str, "-verb")) + printUsageAndExit(argc, argv, true); + } else { + bool parsed_ok = false; + + for (int k = 0; !parsed_ok && k < Option::getOptionList().size(); k++){ + parsed_ok = Option::getOptionList()[k]->parse(argv[i]); + + // fprintf(stderr, "checking %d: %s against flag <%s> (%s)\n", i, argv[i], Option::getOptionList()[k]->name, parsed_ok ? "ok" : "skip"); + } + + if (!parsed_ok) + if (strict && match(argv[i], "-")) + fprintf(stderr, "ERROR! Unknown flag \"%s\". Use '--%shelp' for help.\n", argv[i], Option::getHelpPrefixString()), exit(1); + else + argv[j++] = argv[i]; + } + } + + argc -= (i - j); +} + + +void Glucose::setUsageHelp (const char* str){ Option::getUsageString() = str; } +void Glucose::setHelpPrefixStr (const char* str){ Option::getHelpPrefixString() = str; } +void Glucose::printUsageAndExit (int argc, char** argv, bool verbose) +{ + const char* usage = Option::getUsageString(); + if (usage != NULL) + fprintf(stderr, usage, argv[0]); + + sort(Option::getOptionList(), Option::OptionLt()); + + const char* prev_cat = NULL; + const char* prev_type = NULL; + + for (int i = 0; i < Option::getOptionList().size(); i++){ + const char* cat = Option::getOptionList()[i]->category; + const char* type = Option::getOptionList()[i]->type_name; + + if (cat != prev_cat) + fprintf(stderr, "\n%s OPTIONS:\n\n", cat); + else if (type != prev_type) + fprintf(stderr, "\n"); + + Option::getOptionList()[i]->help(verbose); + + prev_cat = Option::getOptionList()[i]->category; + prev_type = Option::getOptionList()[i]->type_name; + } + + fprintf(stderr, "\nHELP OPTIONS:\n\n"); + fprintf(stderr, " --%shelp Print help message.\n", Option::getHelpPrefixString()); + fprintf(stderr, " --%shelp-verb Print verbose help message.\n", Option::getHelpPrefixString()); + fprintf(stderr, "\n"); + exit(0); +} + diff --git a/packages/bee/glucose-4/utils/Options.h b/packages/bee/glucose-4/utils/Options.h new file mode 100644 index 000000000..e99ca3db9 --- /dev/null +++ b/packages/bee/glucose-4/utils/Options.h @@ -0,0 +1,403 @@ +/***************************************************************************************[Options.h] +Copyright (c) 2008-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_Options_h +#define Glucose_Options_h + +#include +#include +#include +#include + +#include "mtl/IntTypes.h" +#include "mtl/Vec.h" +//#include "utils/ParseUtils.h" + +namespace Glucose { + + // copied from utils/ParseUtils.h to avoid compiling the entire header +//================================================================================================== +// String matching: in case of a match the input iterator will be advanced the corresponding +// number of characters. +template +static bool match(B& in, const char* str) { + int i; + for (i = 0; str[i] != '\0'; i++) + if (in[i] != str[i]) + return false; + + in += i; + + return true; +} + + +//================================================================================================== +// Top-level option parse/help functions: + + +extern void parseOptions (int& argc, char** argv, bool strict = false); +extern void printUsageAndExit(int argc, char** argv, bool verbose = false); +extern void setUsageHelp (const char* str); +extern void setHelpPrefixStr (const char* str); + + +//================================================================================================== +// Options is an abstract class that gives the interface for all types options: + + +class Option +{ + protected: + const char* name; + const char* description; + const char* category; + const char* type_name; + + static vec& getOptionList () { static vec options; return options; } + static const char*& getUsageString() { static const char* usage_str; return usage_str; } + static const char*& getHelpPrefixString() { static const char* help_prefix_str = ""; return help_prefix_str; } + + struct OptionLt { + bool operator()(const Option* x, const Option* y) { + int test1 = strcmp(x->category, y->category); + return test1 < 0 || test1 == 0 && strcmp(x->type_name, y->type_name) < 0; + } + }; + + Option(const char* name_, + const char* desc_, + const char* cate_, + const char* type_) : + name (name_) + , description(desc_) + , category (cate_) + , type_name (type_) + { + getOptionList().push(this); + } + + public: + virtual ~Option() {} + + virtual bool parse (const char* str) = 0; + virtual void help (bool verbose = false) = 0; + + friend void parseOptions (int& argc, char** argv, bool strict); + friend void printUsageAndExit (int argc, char** argv, bool verbose); + friend void setUsageHelp (const char* str); + friend void setHelpPrefixStr (const char* str); +}; + + +//================================================================================================== +// Range classes with specialization for floating types: + + +struct IntRange { + int begin; + int end; + IntRange(int b, int e) : begin(b), end(e) {} +}; + +struct Int64Range { + int64_t begin; + int64_t end; + Int64Range(int64_t b, int64_t e) : begin(b), end(e) {} +}; + +struct DoubleRange { + double begin; + double end; + bool begin_inclusive; + bool end_inclusive; + DoubleRange(double b, bool binc, double e, bool einc) : begin(b), end(e), begin_inclusive(binc), end_inclusive(einc) {} +}; + + +//================================================================================================== +// Double options: + + +class DoubleOption : public Option +{ + protected: + DoubleRange range; + double value; + + public: + DoubleOption(const char* c, const char* n, const char* d, double def = double(), DoubleRange r = DoubleRange(-HUGE_VAL, false, HUGE_VAL, false)) + : Option(n, d, c, ""), range(r), value(def) { + // FIXME: set LC_NUMERIC to "C" to make sure that strtof/strtod parses decimal point correctly. + } + + operator double (void) const { return value; } + operator double& (void) { return value; } + DoubleOption& operator=(double x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + char* end; + double tmp = strtod(span, &end); + + if (end == NULL) + return false; + else if (tmp >= range.end && (!range.end_inclusive || tmp != range.end)){ + fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name); + exit(1); + }else if (tmp <= range.begin && (!range.begin_inclusive || tmp != range.begin)){ + fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name); + exit(1); } + + value = tmp; + // fprintf(stderr, "READ VALUE: %g\n", value); + + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-12s = %-8s %c%4.2g .. %4.2g%c (default: %g)\n", + name, type_name, + range.begin_inclusive ? '[' : '(', + range.begin, + range.end, + range.end_inclusive ? ']' : ')', + value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + + +//================================================================================================== +// Int options: + + +class IntOption : public Option +{ + protected: + IntRange range; + int32_t value; + + public: + IntOption(const char* c, const char* n, const char* d, int32_t def = int32_t(), IntRange r = IntRange(INT32_MIN, INT32_MAX)) + : Option(n, d, c, ""), range(r), value(def) {} + + operator int32_t (void) const { return value; } + operator int32_t& (void) { return value; } + IntOption& operator= (int32_t x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + char* end; + int32_t tmp = strtol(span, &end, 10); + + if (end == NULL) + return false; + else if (tmp > range.end){ + fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name); + exit(1); + }else if (tmp < range.begin){ + fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name); + exit(1); } + + value = tmp; + + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-12s = %-8s [", name, type_name); + if (range.begin == INT32_MIN) + fprintf(stderr, "imin"); + else + fprintf(stderr, "%4d", range.begin); + + fprintf(stderr, " .. "); + if (range.end == INT32_MAX) + fprintf(stderr, "imax"); + else + fprintf(stderr, "%4d", range.end); + + fprintf(stderr, "] (default: %d)\n", value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + + +// Leave this out for visual C++ until Microsoft implements C99 and gets support for strtoll. +#ifndef _MSC_VER + +class Int64Option : public Option +{ + protected: + Int64Range range; + int64_t value; + + public: + Int64Option(const char* c, const char* n, const char* d, int64_t def = int64_t(), Int64Range r = Int64Range(INT64_MIN, INT64_MAX)) + : Option(n, d, c, ""), range(r), value(def) {} + + operator int64_t (void) const { return value; } + operator int64_t& (void) { return value; } + Int64Option& operator= (int64_t x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + char* end; + int64_t tmp = strtoll(span, &end, 10); + + if (end == NULL) + return false; + else if (tmp > range.end){ + fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name); + exit(1); + }else if (tmp < range.begin){ + fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name); + exit(1); } + + value = tmp; + + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-12s = %-8s [", name, type_name); + if (range.begin == INT64_MIN) + fprintf(stderr, "imin"); + else + fprintf(stderr, "%4" PRIi64, range.begin); + + fprintf(stderr, " .. "); + if (range.end == INT64_MAX) + fprintf(stderr, "imax"); + else + fprintf(stderr, "%4" PRIi64, range.end); + + fprintf(stderr, "] (default: %" PRIi64")\n", value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; +#endif + +//================================================================================================== +// String option: + + +class StringOption : public Option +{ + const char* value; + public: + StringOption(const char* c, const char* n, const char* d, const char* def = NULL) + : Option(n, d, c, ""), value(def) {} + + operator const char* (void) const { return value; } + operator const char*& (void) { return value; } + StringOption& operator= (const char* x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + value = span; + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-10s = %8s\n", name, type_name); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + + +//================================================================================================== +// Bool option: + + +class BoolOption : public Option +{ + bool value; + + public: + BoolOption(const char* c, const char* n, const char* d, bool v) + : Option(n, d, c, ""), value(v) {} + + operator bool (void) const { return value; } + operator bool& (void) { return value; } + BoolOption& operator=(bool b) { value = b; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (match(span, "-")){ + bool b = !match(span, "no-"); + + if (strcmp(span, name) == 0){ + value = b; + return true; } + } + + return false; + } + + virtual void help (bool verbose = false){ + + fprintf(stderr, " -%s, -no-%s", name, name); + + for (uint32_t i = 0; i < 32 - strlen(name)*2; i++) + fprintf(stderr, " "); + + fprintf(stderr, " "); + fprintf(stderr, "(default: %s)\n", value ? "on" : "off"); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/utils/ParseUtils.h b/packages/bee/glucose-4/utils/ParseUtils.h new file mode 100644 index 000000000..ce8f00870 --- /dev/null +++ b/packages/bee/glucose-4/utils/ParseUtils.h @@ -0,0 +1,155 @@ +/************************************************************************************[ParseUtils.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_ParseUtils_h +#define Glucose_ParseUtils_h + +#include +#include +#include + +//#include // comment out to make it easy to compile PL-Minisat in Windows + +namespace Glucose { + +//------------------------------------------------------------------------------------------------- +// A simple buffered character stream class: + +static const int buffer_size = 1048576; + +// next code was comment out to make it easy to compile PL-Minisat in Windows +/* + +class StreamBuffer { + gzFile in; + unsigned char buf[buffer_size]; + int pos; + int size; + + void assureLookahead() { + if (pos >= size) { + pos = 0; + size = gzread(in, buf, sizeof(buf)); } } + +public: + explicit StreamBuffer(gzFile i) : in(i), pos(0), size(0) { assureLookahead(); } + + int operator * () const { return (pos >= size) ? EOF : buf[pos]; } + void operator ++ () { pos++; assureLookahead(); } + int position () const { return pos; } +}; + + +//------------------------------------------------------------------------------------------------- +// End-of-file detection functions for StreamBuffer and char*: + + +static inline bool isEof(StreamBuffer& in) { return *in == EOF; } +static inline bool isEof(const char* in) { return *in == '\0'; } + +*/ + +//------------------------------------------------------------------------------------------------- +// Generic parse functions parametrized over the input-stream type. + + +template +static void skipWhitespace(B& in) { + while ((*in >= 9 && *in <= 13) || *in == 32) + ++in; } + + +template +static void skipLine(B& in) { + for (;;){ + if (isEof(in)) return; + if (*in == '\n') { ++in; return; } + ++in; } } + +template +static double parseDouble(B& in) { // only in the form X.XXXXXe-XX + bool neg= false; + double accu = 0.0; + double currentExponent = 1; + int exponent; + + skipWhitespace(in); + if(*in == EOF) return 0; + if (*in == '-') neg = true, ++in; + else if (*in == '+') ++in; + if (*in < '1' || *in > '9') printf("PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + accu = (double)(*in - '0'); + ++in; + if (*in != '.') printf("PARSE ERROR! Unexpected char: %c\n", *in),exit(3); + ++in; // skip dot + currentExponent = 0.1; + while (*in >= '0' && *in <= '9') + accu = accu + currentExponent * ((double)(*in - '0')), + currentExponent /= 10, + ++in; + if (*in != 'e') printf("PARSE ERROR! Unexpected char: %c\n", *in),exit(3); + ++in; // skip dot + exponent = parseInt(in); // read exponent + accu *= pow(10,exponent); + return neg ? -accu:accu; +} + + +template +static int parseInt(B& in) { + int val = 0; + bool neg = false; + skipWhitespace(in); + if (*in == '-') neg = true, ++in; + else if (*in == '+') ++in; + if (*in < '0' || *in > '9') fprintf(stderr, "PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + while (*in >= '0' && *in <= '9') + val = val*10 + (*in - '0'), + ++in; + return neg ? -val : val; } + + +// String matching: in case of a match the input iterator will be advanced the corresponding +// number of characters. +template +static bool match(B& in, const char* str) { + int i; + for (i = 0; str[i] != '\0'; i++) + if (in[i] != str[i]) + return false; + + in += i; + + return true; +} + +// String matching: consumes characters eagerly, but does not require random access iterator. +template +static bool eagerMatch(B& in, const char* str) { + for (; *str != '\0'; ++str, ++in) + if (*str != *in) + return false; + return true; } + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/glucose-4/utils/System.cc b/packages/bee/glucose-4/utils/System.cc new file mode 100644 index 000000000..a516e0b9d --- /dev/null +++ b/packages/bee/glucose-4/utils/System.cc @@ -0,0 +1,95 @@ +/***************************************************************************************[System.cc] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include "utils/System.h" + +#if defined(__linux__) + +#include +#include + +using namespace Glucose; + +// TODO: split the memory reading functions into two: one for reading high-watermark of RSS, and +// one for reading the current virtual memory size. + +static inline int memReadStat(int field) +{ + char name[256]; + pid_t pid = getpid(); + int value; + + sprintf(name, "/proc/%d/statm", pid); + FILE* in = fopen(name, "rb"); + if (in == NULL) return 0; + + for (; field >= 0; field--) + if (fscanf(in, "%d", &value) != 1) + printf("ERROR! Failed to parse memory statistics from \"/proc\".\n"), exit(1); + fclose(in); + return value; +} + + +static inline int memReadPeak(void) +{ + char name[256]; + pid_t pid = getpid(); + + sprintf(name, "/proc/%d/status", pid); + FILE* in = fopen(name, "rb"); + if (in == NULL) return 0; + + // Find the correct line, beginning with "VmPeak:": + int peak_kb = 0; + while (!feof(in) && fscanf(in, "VmPeak: %d kB", &peak_kb) != 1) + while (!feof(in) && fgetc(in) != '\n') + ; + fclose(in); + + return peak_kb; +} + +double Glucose::memUsed() { return (double)memReadStat(0) * (double)getpagesize() / (1024*1024); } +double Glucose::memUsedPeak() { + double peak = memReadPeak() / 1024; + return peak == 0 ? memUsed() : peak; } + +#elif defined(__FreeBSD__) + +double Glucose::memUsed(void) { + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + return (double)ru.ru_maxrss / 1024; } +double MiniSat::memUsedPeak(void) { return memUsed(); } + + +#elif defined(__APPLE__) +#include + +double Glucose::memUsed(void) { + malloc_statistics_t t; + malloc_zone_statistics(NULL, &t); + return (double)t.max_size_in_use / (1024*1024); } + +#else +double Glucose::memUsed() { + return 0; } +#endif diff --git a/packages/bee/glucose-4/utils/System.h b/packages/bee/glucose-4/utils/System.h new file mode 100644 index 000000000..cafb542b8 --- /dev/null +++ b/packages/bee/glucose-4/utils/System.h @@ -0,0 +1,73 @@ +/****************************************************************************************[System.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Glucose_System_h +#define Glucose_System_h + +#if defined(__linux__) +#include +#endif + +#include "mtl/IntTypes.h" + +//------------------------------------------------------------------------------------------------- + +namespace Glucose { + +static inline double cpuTime(void); // CPU-time in seconds. +static inline double realTime(void); +extern double memUsed(); // Memory in mega bytes (returns 0 for unsupported architectures). +extern double memUsedPeak(); // Peak-memory in mega bytes (returns 0 for unsupported architectures). + +} + +//------------------------------------------------------------------------------------------------- +// Implementation of inline functions: + +#if defined(_MSC_VER) || defined(__MINGW32__) +#include + +static inline double Glucose::cpuTime(void) { return (double)clock() / CLOCKS_PER_SEC; } + +#else +#include +#include +#include + +static inline double Glucose::cpuTime(void) { + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + return (double)ru.ru_utime.tv_sec + (double)ru.ru_utime.tv_usec / 1000000; } + +#endif + +#ifndef PLGlucose +// Laurent: I know that this will not compile directly under Windows... sorry for that +static inline double Glucose::realTime() { + struct timeval tv; + gettimeofday(&tv, NULL); + return (double)tv.tv_sec + (double) tv.tv_usec / 1000000; } +#else +// Amit: realTime == cpuTime just to make it compile in Windows +static inline double Glucose::realTime() { return (double)clock() / CLOCKS_PER_SEC; } + +#endif // PLGlucose + +#endif diff --git a/packages/bee/minisat-2.0.2/LICENSE b/packages/bee/minisat-2.0.2/LICENSE new file mode 100755 index 000000000..22816ff39 --- /dev/null +++ b/packages/bee/minisat-2.0.2/LICENSE @@ -0,0 +1,21 @@ +MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson + Copyright (c) 2007-2010 Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/bee/minisat-2.0.2/README b/packages/bee/minisat-2.0.2/README new file mode 100755 index 000000000..e5e5617d8 --- /dev/null +++ b/packages/bee/minisat-2.0.2/README @@ -0,0 +1,24 @@ +================================================================================ +DIRECTORY OVERVIEW: + +mtl/ Mini Template Library +utils/ Generic helper code (I/O, Parsing, CPU-time, etc) +core/ A core version of the solver +simp/ An extended solver with simplification capabilities +README +LICENSE + +================================================================================ +BUILDING: (release version: without assertions, statically linked, etc) + +export MROOT= (or setenv in cshell) +cd { core | simp } +gmake rs +cp minisat_static /minisat + +================================================================================ +EXAMPLES: + +Run minisat with same heuristics as version 2.0: + +> minisat -no-luby -rinc=1.5 -phase-saving=0 -rnd-freq=0.02 diff --git a/packages/bee/minisat-2.0.2/core/Dimacs.h b/packages/bee/minisat-2.0.2/core/Dimacs.h new file mode 100755 index 000000000..a05e900c1 --- /dev/null +++ b/packages/bee/minisat-2.0.2/core/Dimacs.h @@ -0,0 +1,89 @@ +/****************************************************************************************[Dimacs.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_Dimacs_h +#define Minisat_Dimacs_h + +#include + +#include "utils/ParseUtils.h" +#include "core/SolverTypes.h" + +namespace Minisat { + +//================================================================================================= +// DIMACS Parser: + +template +static void readClause(B& in, Solver& S, vec& lits) { + int parsed_lit, var; + lits.clear(); + for (;;){ + parsed_lit = parseInt(in); + if (parsed_lit == 0) break; + var = abs(parsed_lit)-1; + while (var >= S.nVars()) S.newVar(); + lits.push( (parsed_lit > 0) ? mkLit(var) : ~mkLit(var) ); + } +} + +template +static void parse_DIMACS_main(B& in, Solver& S) { + vec lits; + int vars = 0; + int clauses = 0; + int cnt = 0; + for (;;){ + skipWhitespace(in); + if (*in == EOF) break; + else if (*in == 'p'){ + if (eagerMatch(in, "p cnf")){ + vars = parseInt(in); + clauses = parseInt(in); + // SATRACE'06 hack + // if (clauses > 4000000) + // S.eliminate(true); + }else{ + printf("PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + } + } else if (*in == 'c' || *in == 'p') + skipLine(in); + else{ + cnt++; + readClause(in, S, lits); + S.addClause_(lits); } + } + if (vars != S.nVars()) + fprintf(stderr, "WARNING! DIMACS header mismatch: wrong number of variables.\n"); + if (cnt != clauses) + fprintf(stderr, "WARNING! DIMACS header mismatch: wrong number of clauses.\n"); +} + +// Inserts problem into solver. +// +template +static void parse_DIMACS(gzFile input_stream, Solver& S) { + StreamBuffer in(input_stream); + parse_DIMACS_main(in, S); } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/core/Main.cc b/packages/bee/minisat-2.0.2/core/Main.cc new file mode 100755 index 000000000..4388c3e08 --- /dev/null +++ b/packages/bee/minisat-2.0.2/core/Main.cc @@ -0,0 +1,192 @@ +/*****************************************************************************************[Main.cc] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include + +#include +#include + +#include "utils/System.h" +#include "utils/ParseUtils.h" +#include "utils/Options.h" +#include "core/Dimacs.h" +#include "core/Solver.h" + +using namespace Minisat; + +//================================================================================================= + + +void printStats(Solver& solver) +{ + double cpu_time = cpuTime(); + double mem_used = memUsedPeak(); + printf("restarts : %"PRIu64"\n", solver.starts); + printf("conflicts : %-12"PRIu64" (%.0f /sec)\n", solver.conflicts , solver.conflicts /cpu_time); + printf("decisions : %-12"PRIu64" (%4.2f %% random) (%.0f /sec)\n", solver.decisions, (float)solver.rnd_decisions*100 / (float)solver.decisions, solver.decisions /cpu_time); + printf("propagations : %-12"PRIu64" (%.0f /sec)\n", solver.propagations, solver.propagations/cpu_time); + printf("conflict literals : %-12"PRIu64" (%4.2f %% deleted)\n", solver.tot_literals, (solver.max_literals - solver.tot_literals)*100 / (double)solver.max_literals); + if (mem_used != 0) printf("Memory used : %.2f MB\n", mem_used); + printf("CPU time : %g s\n", cpu_time); +} + + +static Solver* solver; +// Terminate by notifying the solver and back out gracefully. This is mainly to have a test-case +// for this feature of the Solver as it may take longer than an immediate call to '_exit()'. +static void SIGINT_interrupt(int signum) { solver->interrupt(); } + +// Note that '_exit()' rather than 'exit()' has to be used. The reason is that 'exit()' calls +// destructors and may cause deadlocks if a malloc/free function happens to be running (these +// functions are guarded by locks for multithreaded use). +static void SIGINT_exit(int signum) { + printf("\n"); printf("*** INTERRUPTED ***\n"); + if (solver->verbosity > 0){ + printStats(*solver); + printf("\n"); printf("*** INTERRUPTED ***\n"); } + _exit(1); } + + +//================================================================================================= +// Main: + + +int main(int argc, char** argv) +{ + try { + setUsageHelp("USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); + // printf("This is MiniSat 2.0 beta\n"); + +#if defined(__linux__) + fpu_control_t oldcw, newcw; + _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); + printf("WARNING: for repeatability, setting FPU to use double precision\n"); +#endif + // Extra options: + // + IntOption verb ("MAIN", "verb", "Verbosity level (0=silent, 1=some, 2=more).", 1, IntRange(0, 2)); + IntOption cpu_lim("MAIN", "cpu-lim","Limit on CPU time allowed in seconds.\n", INT32_MAX, IntRange(0, INT32_MAX)); + IntOption mem_lim("MAIN", "mem-lim","Limit on memory usage in megabytes.\n", INT32_MAX, IntRange(0, INT32_MAX)); + + parseOptions(argc, argv, true); + + Solver S; + double initial_time = cpuTime(); + + S.verbosity = verb; + + solver = &S; + // Use signal handlers that forcibly quit until the solver will be able to respond to + // interrupts: + signal(SIGINT, SIGINT_exit); + signal(SIGXCPU,SIGINT_exit); + + // Set limit on CPU-time: + if (cpu_lim != INT32_MAX){ + rlimit rl; + getrlimit(RLIMIT_CPU, &rl); + if (rl.rlim_max == RLIM_INFINITY || (rlim_t)cpu_lim < rl.rlim_max){ + rl.rlim_cur = cpu_lim; + if (setrlimit(RLIMIT_CPU, &rl) == -1) + printf("WARNING! Could not set resource limit: CPU-time.\n"); + } } + + // Set limit on virtual memory: + if (mem_lim != INT32_MAX){ + rlim_t new_mem_lim = (rlim_t)mem_lim * 1024*1024; + rlimit rl; + getrlimit(RLIMIT_AS, &rl); + if (rl.rlim_max == RLIM_INFINITY || new_mem_lim < rl.rlim_max){ + rl.rlim_cur = new_mem_lim; + if (setrlimit(RLIMIT_AS, &rl) == -1) + printf("WARNING! Could not set resource limit: Virtual memory.\n"); + } } + + if (argc == 1) + printf("Reading from standard input... Use '--help' for help.\n"); + + gzFile in = (argc == 1) ? gzdopen(0, "rb") : gzopen(argv[1], "rb"); + if (in == NULL) + printf("ERROR! Could not open file: %s\n", argc == 1 ? "" : argv[1]), exit(1); + + if (S.verbosity > 0){ + printf("============================[ Problem Statistics ]=============================\n"); + printf("| |\n"); } + + parse_DIMACS(in, S); + gzclose(in); + FILE* res = (argc >= 3) ? fopen(argv[2], "wb") : NULL; + + if (S.verbosity > 0){ + printf("| Number of variables: %12d |\n", S.nVars()); + printf("| Number of clauses: %12d |\n", S.nClauses()); } + + double parsed_time = cpuTime(); + if (S.verbosity > 0){ + printf("| Parse time: %12.2f s |\n", parsed_time - initial_time); + printf("| |\n"); } + + // Change to signal-handlers that will only notify the solver and allow it to terminate + // voluntarily: + signal(SIGINT, SIGINT_interrupt); + signal(SIGXCPU,SIGINT_interrupt); + + if (!S.simplify()){ + if (res != NULL) fprintf(res, "UNSAT\n"), fclose(res); + if (S.verbosity > 0){ + printf("===============================================================================\n"); + printf("Solved by unit propagation\n"); + printStats(S); + printf("\n"); } + printf("UNSATISFIABLE\n"); + exit(20); + } + + vec dummy; + lbool ret = S.solveLimited(dummy); + if (S.verbosity > 0){ + printStats(S); + printf("\n"); } + printf(ret == l_True ? "SATISFIABLE\n" : ret == l_False ? "UNSATISFIABLE\n" : "INDETERMINATE\n"); + if (res != NULL){ + if (ret == l_True){ + fprintf(res, "SAT\n"); + for (int i = 0; i < S.nVars(); i++) + if (S.model[i] != l_Undef) + fprintf(res, "%s%s%d", (i==0)?"":" ", (S.model[i]==l_True)?"":"-", i+1); + fprintf(res, " 0\n"); + }else if (ret == l_False) + fprintf(res, "UNSAT\n"); + else + fprintf(res, "INDET\n"); + fclose(res); + } + +#ifdef NDEBUG + exit(ret == l_True ? 10 : ret == l_False ? 20 : 0); // (faster than "return", which will invoke the destructor for 'Solver') +#else + return (ret == l_True ? 10 : ret == l_False ? 20 : 0); +#endif + } catch (OutOfMemoryException&){ + printf("===============================================================================\n"); + printf("INDETERMINATE\n"); + exit(0); + } +} diff --git a/packages/bee/minisat-2.0.2/core/Solver.cc b/packages/bee/minisat-2.0.2/core/Solver.cc new file mode 100755 index 000000000..7da7f189d --- /dev/null +++ b/packages/bee/minisat-2.0.2/core/Solver.cc @@ -0,0 +1,923 @@ +/***************************************************************************************[Solver.cc] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include + +#include "mtl/Sort.h" +#include "core/Solver.h" + +using namespace Minisat; + +//================================================================================================= +// Options: + + +static const char* _cat = "CORE"; + +static DoubleOption opt_var_decay (_cat, "var-decay", "The variable activity decay factor", 0.95, DoubleRange(0, false, 1, false)); +static DoubleOption opt_clause_decay (_cat, "cla-decay", "The clause activity decay factor", 0.999, DoubleRange(0, false, 1, false)); +static DoubleOption opt_random_var_freq (_cat, "rnd-freq", "The frequency with which the decision heuristic tries to choose a random variable", 0, DoubleRange(0, true, 1, true)); +static DoubleOption opt_random_seed (_cat, "rnd-seed", "Used by the random variable selection", 91648253, DoubleRange(0, false, HUGE_VAL, false)); +static IntOption opt_ccmin_mode (_cat, "ccmin-mode", "Controls conflict clause minimization (0=none, 1=basic, 2=deep)", 2, IntRange(0, 2)); +static IntOption opt_phase_saving (_cat, "phase-saving", "Controls the level of phase saving (0=none, 1=limited, 2=full)", 2, IntRange(0, 2)); +static BoolOption opt_rnd_init_act (_cat, "rnd-init", "Randomize the initial activity", false); +static BoolOption opt_luby_restart (_cat, "luby", "Use the Luby restart sequence", true); +static IntOption opt_restart_first (_cat, "rfirst", "The base restart interval", 100, IntRange(1, INT32_MAX)); +static DoubleOption opt_restart_inc (_cat, "rinc", "Restart interval increase factor", 2, DoubleRange(1, false, HUGE_VAL, false)); +static DoubleOption opt_garbage_frac (_cat, "gc-frac", "The fraction of wasted memory allowed before a garbage collection is triggered", 0.20, DoubleRange(0, false, HUGE_VAL, false)); + + +//================================================================================================= +// Constructor/Destructor: + + +Solver::Solver() : + + // Parameters (user settable): + // + verbosity (0) + , var_decay (opt_var_decay) + , clause_decay (opt_clause_decay) + , random_var_freq (opt_random_var_freq) + , random_seed (opt_random_seed) + , luby_restart (opt_luby_restart) + , ccmin_mode (opt_ccmin_mode) + , phase_saving (opt_phase_saving) + , rnd_pol (false) + , rnd_init_act (opt_rnd_init_act) + , garbage_frac (opt_garbage_frac) + , restart_first (opt_restart_first) + , restart_inc (opt_restart_inc) + + // Parameters (the rest): + // + , learntsize_factor((double)1/(double)3), learntsize_inc(1.1) + + // Parameters (experimental): + // + , learntsize_adjust_start_confl (100) + , learntsize_adjust_inc (1.5) + + // Statistics: (formerly in 'SolverStats') + // + , solves(0), starts(0), decisions(0), rnd_decisions(0), propagations(0), conflicts(0) + , dec_vars(0), clauses_literals(0), learnts_literals(0), max_literals(0), tot_literals(0) + + , ok (true) + , cla_inc (1) + , var_inc (1) + , watches (WatcherDeleted(ca)) + , qhead (0) + , simpDB_assigns (-1) + , simpDB_props (0) + , order_heap (VarOrderLt(activity)) + , progress_estimate (0) + , remove_satisfied (true) + + // Resource constraints: + // + , conflict_budget (-1) + , propagation_budget (-1) + , asynch_interrupt (false) +{} + + +Solver::~Solver() +{ +} + + +//================================================================================================= +// Minor methods: + + +// Creates a new SAT variable in the solver. If 'decision' is cleared, variable will not be +// used as a decision variable (NOTE! This has effects on the meaning of a SATISFIABLE result). +// +Var Solver::newVar(bool sign, bool dvar) +{ + int v = nVars(); + watches .init(mkLit(v, false)); + watches .init(mkLit(v, true )); + assigns .push(l_Undef); + vardata .push(mkVarData(CRef_Undef, 0)); + //activity .push(0); + activity .push(rnd_init_act ? drand(random_seed) * 0.00001 : 0); + seen .push(0); + polarity .push(sign); + decision .push(); + trail .capacity(v+1); + setDecisionVar(v, dvar); + return v; +} + + +bool Solver::addClause_(vec& ps) +{ + assert(decisionLevel() == 0); + if (!ok) return false; + + // Check if clause is satisfied and remove false/duplicate literals: + sort(ps); + Lit p; int i, j; + for (i = j = 0, p = lit_Undef; i < ps.size(); i++) + if (value(ps[i]) == l_True || ps[i] == ~p) + return true; + else if (value(ps[i]) != l_False && ps[i] != p) + ps[j++] = p = ps[i]; + ps.shrink(i - j); + + if (ps.size() == 0) + return ok = false; + else if (ps.size() == 1){ + uncheckedEnqueue(ps[0]); + return ok = (propagate() == CRef_Undef); + }else{ + CRef cr = ca.alloc(ps, false); + clauses.push(cr); + attachClause(cr); + } + + return true; +} + + +void Solver::attachClause(CRef cr) { + const Clause& c = ca[cr]; + assert(c.size() > 1); + watches[~c[0]].push(Watcher(cr, c[1])); + watches[~c[1]].push(Watcher(cr, c[0])); + if (c.learnt()) learnts_literals += c.size(); + else clauses_literals += c.size(); } + + +void Solver::detachClause(CRef cr, bool strict) { + const Clause& c = ca[cr]; + assert(c.size() > 1); + + if (strict){ + remove(watches[~c[0]], Watcher(cr, c[1])); + remove(watches[~c[1]], Watcher(cr, c[0])); + }else{ + // Lazy detaching: (NOTE! Must clean all watcher lists before garbage collecting this clause) + watches.smudge(~c[0]); + watches.smudge(~c[1]); + } + + if (c.learnt()) learnts_literals -= c.size(); + else clauses_literals -= c.size(); } + + +void Solver::removeClause(CRef cr) { + Clause& c = ca[cr]; + detachClause(cr); + // Don't leave pointers to free'd memory! + if (locked(c)) vardata[var(c[0])].reason = CRef_Undef; + c.mark(1); + ca.free(cr); +} + + +bool Solver::satisfied(const Clause& c) const { + for (int i = 0; i < c.size(); i++) + if (value(c[i]) == l_True) + return true; + return false; } + + +// Revert to the state at given level (keeping all assignment at 'level' but not beyond). +// +void Solver::cancelUntil(int level) { + if (decisionLevel() > level){ + for (int c = trail.size()-1; c >= trail_lim[level]; c--){ + Var x = var(trail[c]); + assigns [x] = l_Undef; + if (phase_saving > 1 || (phase_saving == 1) && c > trail_lim.last()) + polarity[x] = sign(trail[c]); + insertVarOrder(x); } + qhead = trail_lim[level]; + trail.shrink(trail.size() - trail_lim[level]); + trail_lim.shrink(trail_lim.size() - level); + } } + + +//================================================================================================= +// Major methods: + + +Lit Solver::pickBranchLit() +{ + Var next = var_Undef; + + // Random decision: + if (drand(random_seed) < random_var_freq && !order_heap.empty()){ + next = order_heap[irand(random_seed,order_heap.size())]; + if (value(next) == l_Undef && decision[next]) + rnd_decisions++; } + + // Activity based decision: + while (next == var_Undef || value(next) != l_Undef || !decision[next]) + if (order_heap.empty()){ + next = var_Undef; + break; + }else + next = order_heap.removeMin(); + + return next == var_Undef ? lit_Undef : mkLit(next, rnd_pol ? drand(random_seed) < 0.5 : polarity[next]); +} + + +/*_________________________________________________________________________________________________ +| +| analyze : (confl : Clause*) (out_learnt : vec&) (out_btlevel : int&) -> [void] +| +| Description: +| Analyze conflict and produce a reason clause. +| +| Pre-conditions: +| * 'out_learnt' is assumed to be cleared. +| * Current decision level must be greater than root level. +| +| Post-conditions: +| * 'out_learnt[0]' is the asserting literal at level 'out_btlevel'. +| * If out_learnt.size() > 1 then 'out_learnt[1]' has the greatest decision level of the +| rest of literals. There may be others from the same level though. +| +|________________________________________________________________________________________________@*/ +void Solver::analyze(CRef confl, vec& out_learnt, int& out_btlevel) +{ + int pathC = 0; + Lit p = lit_Undef; + + // Generate conflict clause: + // + out_learnt.push(); // (leave room for the asserting literal) + int index = trail.size() - 1; + + do{ + assert(confl != CRef_Undef); // (otherwise should be UIP) + Clause& c = ca[confl]; + + if (c.learnt()) + claBumpActivity(c); + + for (int j = (p == lit_Undef) ? 0 : 1; j < c.size(); j++){ + Lit q = c[j]; + + if (!seen[var(q)] && level(var(q)) > 0){ + varBumpActivity(var(q)); + seen[var(q)] = 1; + if (level(var(q)) >= decisionLevel()) + pathC++; + else + out_learnt.push(q); + } + } + + // Select next clause to look at: + while (!seen[var(trail[index--])]); + p = trail[index+1]; + confl = reason(var(p)); + seen[var(p)] = 0; + pathC--; + + }while (pathC > 0); + out_learnt[0] = ~p; + + // Simplify conflict clause: + // + int i, j; + out_learnt.copyTo(analyze_toclear); + if (ccmin_mode == 2){ + uint32_t abstract_level = 0; + for (i = 1; i < out_learnt.size(); i++) + abstract_level |= abstractLevel(var(out_learnt[i])); // (maintain an abstraction of levels involved in conflict) + + for (i = j = 1; i < out_learnt.size(); i++) + if (reason(var(out_learnt[i])) == CRef_Undef || !litRedundant(out_learnt[i], abstract_level)) + out_learnt[j++] = out_learnt[i]; + + }else if (ccmin_mode == 1){ + for (i = j = 1; i < out_learnt.size(); i++){ + Var x = var(out_learnt[i]); + + if (reason(x) == CRef_Undef) + out_learnt[j++] = out_learnt[i]; + else{ + Clause& c = ca[reason(var(out_learnt[i]))]; + for (int k = 1; k < c.size(); k++) + if (!seen[var(c[k])] && level(var(c[k])) > 0){ + out_learnt[j++] = out_learnt[i]; + break; } + } + } + }else + i = j = out_learnt.size(); + + max_literals += out_learnt.size(); + out_learnt.shrink(i - j); + tot_literals += out_learnt.size(); + + // Find correct backtrack level: + // + if (out_learnt.size() == 1) + out_btlevel = 0; + else{ + int max_i = 1; + // Find the first literal assigned at the next-highest level: + for (int i = 2; i < out_learnt.size(); i++) + if (level(var(out_learnt[i])) > level(var(out_learnt[max_i]))) + max_i = i; + // Swap-in this literal at index 1: + Lit p = out_learnt[max_i]; + out_learnt[max_i] = out_learnt[1]; + out_learnt[1] = p; + out_btlevel = level(var(p)); + } + + for (int j = 0; j < analyze_toclear.size(); j++) seen[var(analyze_toclear[j])] = 0; // ('seen[]' is now cleared) +} + + +// Check if 'p' can be removed. 'abstract_levels' is used to abort early if the algorithm is +// visiting literals at levels that cannot be removed later. +bool Solver::litRedundant(Lit p, uint32_t abstract_levels) +{ + analyze_stack.clear(); analyze_stack.push(p); + int top = analyze_toclear.size(); + while (analyze_stack.size() > 0){ + assert(reason(var(analyze_stack.last())) != CRef_Undef); + Clause& c = ca[reason(var(analyze_stack.last()))]; analyze_stack.pop(); + + for (int i = 1; i < c.size(); i++){ + Lit p = c[i]; + if (!seen[var(p)] && level(var(p)) > 0){ + if (reason(var(p)) != CRef_Undef && (abstractLevel(var(p)) & abstract_levels) != 0){ + seen[var(p)] = 1; + analyze_stack.push(p); + analyze_toclear.push(p); + }else{ + for (int j = top; j < analyze_toclear.size(); j++) + seen[var(analyze_toclear[j])] = 0; + analyze_toclear.shrink(analyze_toclear.size() - top); + return false; + } + } + } + } + + return true; +} + + +/*_________________________________________________________________________________________________ +| +| analyzeFinal : (p : Lit) -> [void] +| +| Description: +| Specialized analysis procedure to express the final conflict in terms of assumptions. +| Calculates the (possibly empty) set of assumptions that led to the assignment of 'p', and +| stores the result in 'out_conflict'. +|________________________________________________________________________________________________@*/ +void Solver::analyzeFinal(Lit p, vec& out_conflict) +{ + out_conflict.clear(); + out_conflict.push(p); + + if (decisionLevel() == 0) + return; + + seen[var(p)] = 1; + + for (int i = trail.size()-1; i >= trail_lim[0]; i--){ + Var x = var(trail[i]); + if (seen[x]){ + if (reason(x) == CRef_Undef){ + assert(level(x) > 0); + out_conflict.push(~trail[i]); + }else{ + Clause& c = ca[reason(x)]; + for (int j = 1; j < c.size(); j++) + if (level(var(c[j])) > 0) + seen[var(c[j])] = 1; + } + seen[x] = 0; + } + } + + seen[var(p)] = 0; +} + + +void Solver::uncheckedEnqueue(Lit p, CRef from) +{ + assert(value(p) == l_Undef); + assigns[var(p)] = lbool(!sign(p)); + vardata[var(p)] = mkVarData(from, decisionLevel()); + trail.push_(p); +} + + +/*_________________________________________________________________________________________________ +| +| propagate : [void] -> [Clause*] +| +| Description: +| Propagates all enqueued facts. If a conflict arises, the conflicting clause is returned, +| otherwise CRef_Undef. +| +| Post-conditions: +| * the propagation queue is empty, even if there was a conflict. +|________________________________________________________________________________________________@*/ +CRef Solver::propagate() +{ + CRef confl = CRef_Undef; + int num_props = 0; + watches.cleanAll(); + + while (qhead < trail.size()){ + Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate. + vec& ws = watches[p]; + Watcher *i, *j, *end; + num_props++; + + for (i = j = (Watcher*)ws, end = i + ws.size(); i != end;){ + // Try to avoid inspecting the clause: + Lit blocker = i->blocker; + if (value(blocker) == l_True){ + *j++ = *i++; continue; } + + // Make sure the false literal is data[1]: + CRef cr = i->cref; + Clause& c = ca[cr]; + Lit false_lit = ~p; + if (c[0] == false_lit) + c[0] = c[1], c[1] = false_lit; + assert(c[1] == false_lit); + i++; + + // If 0th watch is true, then clause is already satisfied. + Lit first = c[0]; + Watcher w = Watcher(cr, first); + if (first != blocker && value(first) == l_True){ + *j++ = w; continue; } + + // Look for new watch: + for (int k = 2; k < c.size(); k++) + if (value(c[k]) != l_False){ + c[1] = c[k]; c[k] = false_lit; + watches[~c[1]].push(w); + goto NextClause; } + + // Did not find watch -- clause is unit under assignment: + *j++ = w; + if (value(first) == l_False){ + confl = cr; + qhead = trail.size(); + // Copy the remaining watches: + while (i < end) + *j++ = *i++; + }else + uncheckedEnqueue(first, cr); + + NextClause:; + } + ws.shrink(i - j); + } + propagations += num_props; + simpDB_props -= num_props; + + return confl; +} + + +/*_________________________________________________________________________________________________ +| +| reduceDB : () -> [void] +| +| Description: +| Remove half of the learnt clauses, minus the clauses locked by the current assignment. Locked +| clauses are clauses that are reason to some assignment. Binary clauses are never removed. +|________________________________________________________________________________________________@*/ +struct reduceDB_lt { + ClauseAllocator& ca; + reduceDB_lt(ClauseAllocator& ca_) : ca(ca_) {} + bool operator () (CRef x, CRef y) { + return ca[x].size() > 2 && (ca[y].size() == 2 || ca[x].activity() < ca[y].activity()); } +}; +void Solver::reduceDB() +{ + int i, j; + double extra_lim = cla_inc / learnts.size(); // Remove any clause below this activity + + sort(learnts, reduceDB_lt(ca)); + // Don't delete binary or locked clauses. From the rest, delete clauses from the first half + // and clauses with activity smaller than 'extra_lim': + for (i = j = 0; i < learnts.size(); i++){ + Clause& c = ca[learnts[i]]; + if (c.size() > 2 && !locked(c) && (i < learnts.size() / 2 || c.activity() < extra_lim)) + removeClause(learnts[i]); + else + learnts[j++] = learnts[i]; + } + learnts.shrink(i - j); + checkGarbage(); +} + + +void Solver::removeSatisfied(vec& cs) +{ + int i, j; + for (i = j = 0; i < cs.size(); i++){ + Clause& c = ca[cs[i]]; + if (satisfied(c)) + removeClause(cs[i]); + else + cs[j++] = cs[i]; + } + cs.shrink(i - j); +} + + +void Solver::rebuildOrderHeap() +{ + vec vs; + for (Var v = 0; v < nVars(); v++) + if (decision[v] && value(v) == l_Undef) + vs.push(v); + order_heap.build(vs); +} + + +/*_________________________________________________________________________________________________ +| +| simplify : [void] -> [bool] +| +| Description: +| Simplify the clause database according to the current top-level assigment. Currently, the only +| thing done here is the removal of satisfied clauses, but more things can be put here. +|________________________________________________________________________________________________@*/ +bool Solver::simplify() +{ + assert(decisionLevel() == 0); + + if (!ok || propagate() != CRef_Undef) + return ok = false; + + if (nAssigns() == simpDB_assigns || (simpDB_props > 0)) + return true; + + // Remove satisfied clauses: + removeSatisfied(learnts); + if (remove_satisfied) // Can be turned off. + removeSatisfied(clauses); + checkGarbage(); + rebuildOrderHeap(); + + simpDB_assigns = nAssigns(); + simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now) + + return true; +} + + +/*_________________________________________________________________________________________________ +| +| search : (nof_conflicts : int) (params : const SearchParams&) -> [lbool] +| +| Description: +| Search for a model the specified number of conflicts. +| NOTE! Use negative value for 'nof_conflicts' indicate infinity. +| +| Output: +| 'l_True' if a partial assigment that is consistent with respect to the clauseset is found. If +| all variables are decision variables, this means that the clause set is satisfiable. 'l_False' +| if the clause set is unsatisfiable. 'l_Undef' if the bound on number of conflicts is reached. +|________________________________________________________________________________________________@*/ +lbool Solver::search(int nof_conflicts) +{ + assert(ok); + int backtrack_level; + int conflictC = 0; + vec learnt_clause; + starts++; + + for (;;){ + CRef confl = propagate(); + if (confl != CRef_Undef){ + // CONFLICT + conflicts++; conflictC++; + if (decisionLevel() == 0) return l_False; + + learnt_clause.clear(); + analyze(confl, learnt_clause, backtrack_level); + cancelUntil(backtrack_level); + + if (learnt_clause.size() == 1){ + uncheckedEnqueue(learnt_clause[0]); + }else{ + CRef cr = ca.alloc(learnt_clause, true); + learnts.push(cr); + attachClause(cr); + claBumpActivity(ca[cr]); + uncheckedEnqueue(learnt_clause[0], cr); + } + + varDecayActivity(); + claDecayActivity(); + + if (--learntsize_adjust_cnt == 0){ + learntsize_adjust_confl *= learntsize_adjust_inc; + learntsize_adjust_cnt = (int)learntsize_adjust_confl; + max_learnts *= learntsize_inc; + + if (verbosity >= 1) + printf("| %9d | %7d %8d %8d | %8d %8d %6.0f | %6.3f %% |\n", + (int)conflicts, + (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]), nClauses(), (int)clauses_literals, + (int)max_learnts, nLearnts(), (double)learnts_literals/nLearnts(), progressEstimate()*100); + } + + }else{ + // NO CONFLICT + if (nof_conflicts >= 0 && conflictC >= nof_conflicts || !withinBudget()){ + // Reached bound on number of conflicts: + progress_estimate = progressEstimate(); + cancelUntil(0); + return l_Undef; } + + // Simplify the set of problem clauses: + if (decisionLevel() == 0 && !simplify()) + return l_False; + + if (learnts.size()-nAssigns() >= max_learnts) + // Reduce the set of learnt clauses: + reduceDB(); + + Lit next = lit_Undef; + while (decisionLevel() < assumptions.size()){ + // Perform user provided assumption: + Lit p = assumptions[decisionLevel()]; + if (value(p) == l_True){ + // Dummy decision level: + newDecisionLevel(); + }else if (value(p) == l_False){ + analyzeFinal(~p, conflict); + return l_False; + }else{ + next = p; + break; + } + } + + if (next == lit_Undef){ + // New variable decision: + decisions++; + next = pickBranchLit(); + + if (next == lit_Undef) + // Model found: + return l_True; + } + + // Increase decision level and enqueue 'next' + newDecisionLevel(); + uncheckedEnqueue(next); + } + } +} + + +double Solver::progressEstimate() const +{ + double progress = 0; + double F = 1.0 / nVars(); + + for (int i = 0; i <= decisionLevel(); i++){ + int beg = i == 0 ? 0 : trail_lim[i - 1]; + int end = i == decisionLevel() ? trail.size() : trail_lim[i]; + progress += pow(F, i) * (end - beg); + } + + return progress / nVars(); +} + +/* + Finite subsequences of the Luby-sequence: + + 0: 1 + 1: 1 1 2 + 2: 1 1 2 1 1 2 4 + 3: 1 1 2 1 1 2 4 1 1 2 1 1 2 4 8 + ... + + + */ + +static double luby(double y, int x){ + + // Find the finite subsequence that contains index 'x', and the + // size of that subsequence: + int size, seq; + for (size = 1, seq = 0; size < x+1; seq++, size = 2*size+1); + + while (size-1 != x){ + size = (size-1)>>1; + seq--; + x = x % size; + } + + return pow(y, seq); +} + +// NOTE: assumptions passed in member-variable 'assumptions'. +lbool Solver::solve_() +{ + model.clear(); + conflict.clear(); + if (!ok) return l_False; + + solves++; + + max_learnts = nClauses() * learntsize_factor; + learntsize_adjust_confl = learntsize_adjust_start_confl; + learntsize_adjust_cnt = (int)learntsize_adjust_confl; + lbool status = l_Undef; + + if (verbosity >= 1){ + printf("============================[ Search Statistics ]==============================\n"); + printf("| Conflicts | ORIGINAL | LEARNT | Progress |\n"); + printf("| | Vars Clauses Literals | Limit Clauses Lit/Cl | |\n"); + printf("===============================================================================\n"); + } + + // Search: + int curr_restarts = 0; + while (status == l_Undef){ + double rest_base = luby_restart ? luby(restart_inc, curr_restarts) : pow(restart_inc, curr_restarts); + status = search(rest_base * restart_first); + if (!withinBudget()) break; + curr_restarts++; + } + + if (verbosity >= 1) + printf("===============================================================================\n"); + + + if (status == l_True){ + // Extend & copy model: + model.growTo(nVars()); + for (int i = 0; i < nVars(); i++) model[i] = value(i); + }else if (status == l_False && conflict.size() == 0) + ok = false; + + cancelUntil(0); + return status; +} + +//================================================================================================= +// Writing CNF to DIMACS: +// +// FIXME: this needs to be rewritten completely. + +static Var mapVar(Var x, vec& map, Var& max) +{ + if (map.size() <= x || map[x] == -1){ + map.growTo(x+1, -1); + map[x] = max++; + } + return map[x]; +} + + +void Solver::toDimacs(FILE* f, Clause& c, vec& map, Var& max) +{ + if (satisfied(c)) return; + + for (int i = 0; i < c.size(); i++) + if (value(c[i]) != l_False) + fprintf(f, "%s%d ", sign(c[i]) ? "-" : "", mapVar(var(c[i]), map, max)+1); + fprintf(f, "0\n"); +} + + +void Solver::toDimacs(const char *file, const vec& assumps) +{ + FILE* f = fopen(file, "wr"); + if (f == NULL) + fprintf(stderr, "could not open file %s\n", file), exit(1); + toDimacs(f, assumps); + fclose(f); +} + + +void Solver::toDimacs(FILE* f, const vec& assumps) +{ + // Handle case when solver is in contradictory state: + if (!ok){ + fprintf(f, "p cnf 1 2\n1 0\n-1 0\n"); + return; } + + vec map; Var max = 0; + + // Cannot use removeClauses here because it is not safe + // to deallocate them at this point. Could be improved. + int cnt = 0; + for (int i = 0; i < clauses.size(); i++) + if (!satisfied(ca[clauses[i]])) + cnt++; + + for (int i = 0; i < clauses.size(); i++) + if (!satisfied(ca[clauses[i]])){ + Clause& c = ca[clauses[i]]; + for (int j = 0; j < c.size(); j++) + if (value(c[j]) != l_False) + mapVar(var(c[j]), map, max); + } + + // Assumptions are added as unit clauses: + cnt += assumptions.size(); + + fprintf(f, "p cnf %d %d\n", max, cnt); + + for (int i = 0; i < assumptions.size(); i++){ + assert(value(assumptions[i]) != l_False); + fprintf(f, "%s%d 0\n", sign(assumptions[i]) ? "-" : "", mapVar(var(assumptions[i]), map, max)+1); + } + + for (int i = 0; i < clauses.size(); i++) + toDimacs(f, ca[clauses[i]], map, max); + + if (verbosity > 0) + printf("Wrote %d clauses with %d variables.\n", cnt, max); +} + + +//================================================================================================= +// Garbage Collection methods: + +void Solver::relocAll(ClauseAllocator& to) +{ + // All watchers: + // + // for (int i = 0; i < watches.size(); i++) + watches.cleanAll(); + for (int v = 0; v < nVars(); v++) + for (int s = 0; s < 2; s++){ + Lit p = mkLit(v, s); + // printf(" >>> RELOCING: %s%d\n", sign(p)?"-":"", var(p)+1); + vec& ws = watches[p]; + for (int j = 0; j < ws.size(); j++) + ca.reloc(ws[j].cref, to); + } + + // All reasons: + // + for (int i = 0; i < trail.size(); i++){ + Var v = var(trail[i]); + + if (reason(v) != CRef_Undef && (ca[reason(v)].reloced() || locked(ca[reason(v)]))) + ca.reloc(vardata[v].reason, to); + } + + // All learnt: + // + for (int i = 0; i < learnts.size(); i++) + ca.reloc(learnts[i], to); + + // All original: + // + for (int i = 0; i < clauses.size(); i++) + ca.reloc(clauses[i], to); +} + + +void Solver::garbageCollect() +{ + // Initialize the next region to a size corresponding to the estimated utilization degree. This + // is not precise but should avoid some unnecessary reallocations for the new region: + ClauseAllocator to(ca.size() - ca.wasted()); + + relocAll(to); + if (verbosity >= 2) + printf("| Garbage collection: %12d bytes => %12d bytes |\n", + ca.size()*ClauseAllocator::Unit_Size, to.size()*ClauseAllocator::Unit_Size); + to.moveTo(ca); +} diff --git a/packages/bee/minisat-2.0.2/core/Solver.h b/packages/bee/minisat-2.0.2/core/Solver.h new file mode 100755 index 000000000..90119e586 --- /dev/null +++ b/packages/bee/minisat-2.0.2/core/Solver.h @@ -0,0 +1,373 @@ +/****************************************************************************************[Solver.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_Solver_h +#define Minisat_Solver_h + +#include "mtl/Vec.h" +#include "mtl/Heap.h" +#include "mtl/Alg.h" +#include "utils/Options.h" +#include "core/SolverTypes.h" + + +namespace Minisat { + +//================================================================================================= +// Solver -- the main class: + +class Solver { +public: + + // Constructor/Destructor: + // + Solver(); + virtual ~Solver(); + + // Problem specification: + // + Var newVar (bool polarity = true, bool dvar = true); // Add a new variable with parameters specifying variable mode. + + bool addClause (const vec& ps); // Add a clause to the solver. + bool addEmptyClause(); // Add the empty clause, making the solver contradictory. + bool addClause (Lit p); // Add a unit clause to the solver. + bool addClause (Lit p, Lit q); // Add a binary clause to the solver. + bool addClause (Lit p, Lit q, Lit r); // Add a ternary clause to the solver. + bool addClause_( vec& ps); // Add a clause to the solver without making superflous internal copy. Will + // change the passed vector 'ps'. + + // Solving: + // + bool simplify (); // Removes already satisfied clauses. + bool solve (const vec& assumps); // Search for a model that respects a given set of assumptions. + lbool solveLimited (const vec& assumps); // Search for a model that respects a given set of assumptions (With resource constraints). + bool solve (); // Search without assumptions. + bool solve (Lit p); // Search for a model that respects a single assumption. + bool solve (Lit p, Lit q); // Search for a model that respects two assumptions. + bool solve (Lit p, Lit q, Lit r); // Search for a model that respects three assumptions. + bool okay () const; // FALSE means solver is in a conflicting state + + void toDimacs (FILE* f, const vec& assumps); // Write CNF to file in DIMACS-format. + void toDimacs (const char *file, const vec& assumps); + void toDimacs (FILE* f, Clause& c, vec& map, Var& max); + + // Convenience versions of 'toDimacs()': + void toDimacs (const char* file); + void toDimacs (const char* file, Lit p); + void toDimacs (const char* file, Lit p, Lit q); + void toDimacs (const char* file, Lit p, Lit q, Lit r); + + // Variable mode: + // + void setPolarity (Var v, bool b); // Declare which polarity the decision heuristic should use for a variable. Requires mode 'polarity_user'. + void setDecisionVar (Var v, bool b); // Declare if a variable should be eligible for selection in the decision heuristic. + + // Read state: + // + lbool value (Var x) const; // The current value of a variable. + lbool value (Lit p) const; // The current value of a literal. + lbool modelValue (Var x) const; // The value of a variable in the last model. The last call to solve must have been satisfiable. + lbool modelValue (Lit p) const; // The value of a literal in the last model. The last call to solve must have been satisfiable. + int nAssigns () const; // The current number of assigned literals. + int nClauses () const; // The current number of original clauses. + int nLearnts () const; // The current number of learnt clauses. + int nVars () const; // The current number of variables. + int nFreeVars () const; + + // Resource contraints: + // + void setConfBudget(int64_t x); + void setPropBudget(int64_t x); + void budgetOff(); + void interrupt(); // Trigger a (potentially asynchronous) interruption of the solver. + void clearInterrupt(); // Clear interrupt indicator flag. + + // Memory managment: + // + virtual void garbageCollect(); + void checkGarbage(double gf); + void checkGarbage(); + + // Extra results: (read-only member variable) + // + vec model; // If problem is satisfiable, this vector contains the model (if any). + vec conflict; // If problem is unsatisfiable (possibly under assumptions), + // this vector represent the final conflict clause expressed in the assumptions. + + // Mode of operation: + // + int verbosity; + double var_decay; + double clause_decay; + double random_var_freq; + double random_seed; + bool luby_restart; + int ccmin_mode; // Controls conflict clause minimization (0=none, 1=basic, 2=deep). + int phase_saving; // Controls the level of phase saving (0=none, 1=limited, 2=full). + bool rnd_pol; // Use random polarities for branching heuristics. + bool rnd_init_act; // Initialize variable activities with a small random value. + double garbage_frac; // The fraction of wasted memory allowed before a garbage collection is triggered. + + int restart_first; // The initial restart limit. (default 100) + double restart_inc; // The factor with which the restart limit is multiplied in each restart. (default 1.5) + double learntsize_factor; // The intitial limit for learnt clauses is a factor of the original clauses. (default 1 / 3) + double learntsize_inc; // The limit for learnt clauses is multiplied with this factor each restart. (default 1.1) + + int learntsize_adjust_start_confl; + double learntsize_adjust_inc; + + // Statistics: (read-only member variable) + // + uint64_t solves, starts, decisions, rnd_decisions, propagations, conflicts; + uint64_t dec_vars, clauses_literals, learnts_literals, max_literals, tot_literals; + +protected: + + // Helper structures: + // + struct VarData { CRef reason; int level; }; + static inline VarData mkVarData(CRef cr, int l){ VarData d = {cr, l}; return d; } + + struct Watcher { + CRef cref; + Lit blocker; + Watcher(CRef cr, Lit p) : cref(cr), blocker(p) {} + bool operator==(const Watcher& w) const { return cref == w.cref; } + bool operator!=(const Watcher& w) const { return cref != w.cref; } + }; + + struct WatcherDeleted + { + const ClauseAllocator& ca; + WatcherDeleted(const ClauseAllocator& _ca) : ca(_ca) {} + bool operator()(const Watcher& w) const { return ca[w.cref].mark() == 1; } + }; + + struct VarOrderLt { + const vec& activity; + bool operator () (Var x, Var y) const { return activity[x] > activity[y]; } + VarOrderLt(const vec& act) : activity(act) { } + }; + + // Solver state: + // + bool ok; // If FALSE, the constraints are already unsatisfiable. No part of the solver state may be used! + vec clauses; // List of problem clauses. + vec learnts; // List of learnt clauses. + double cla_inc; // Amount to bump next clause with. + vec activity; // A heuristic measurement of the activity of a variable. + double var_inc; // Amount to bump next variable with. + OccLists, WatcherDeleted> + watches; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true). + vec assigns; // The current assignments. + vec polarity; // The preferred polarity of each variable. + vec decision; // Declares if a variable is eligible for selection in the decision heuristic. + vec trail; // Assignment stack; stores all assigments made in the order they were made. + vec trail_lim; // Separator indices for different decision levels in 'trail'. + vec vardata; // Stores reason and level for each variable. + int qhead; // Head of queue (as index into the trail -- no more explicit propagation queue in MiniSat). + int simpDB_assigns; // Number of top-level assignments since last execution of 'simplify()'. + int64_t simpDB_props; // Remaining number of propagations that must be made before next execution of 'simplify()'. + vec assumptions; // Current set of assumptions provided to solve by the user. + Heap order_heap; // A priority queue of variables ordered with respect to the variable activity. + double progress_estimate;// Set by 'search()'. + bool remove_satisfied; // Indicates whether possibly inefficient linear scan for satisfied clauses should be performed in 'simplify'. + + ClauseAllocator ca; + + // Temporaries (to reduce allocation overhead). Each variable is prefixed by the method in which it is + // used, exept 'seen' wich is used in several places. + // + vec seen; + vec analyze_stack; + vec analyze_toclear; + vec add_tmp; + + double max_learnts; + double learntsize_adjust_confl; + int learntsize_adjust_cnt; + + // Resource contraints: + // + int64_t conflict_budget; // -1 means no budget. + int64_t propagation_budget; // -1 means no budget. + bool asynch_interrupt; + + // Main internal methods: + // + void insertVarOrder (Var x); // Insert a variable in the decision order priority queue. + Lit pickBranchLit (); // Return the next decision variable. + void newDecisionLevel (); // Begins a new decision level. + void uncheckedEnqueue (Lit p, CRef from = CRef_Undef); // Enqueue a literal. Assumes value of literal is undefined. + bool enqueue (Lit p, CRef from = CRef_Undef); // Test if fact 'p' contradicts current state, enqueue otherwise. + CRef propagate (); // Perform unit propagation. Returns possibly conflicting clause. + void cancelUntil (int level); // Backtrack until a certain level. + void analyze (CRef confl, vec& out_learnt, int& out_btlevel); // (bt = backtrack) + void analyzeFinal (Lit p, vec& out_conflict); // COULD THIS BE IMPLEMENTED BY THE ORDINARIY "analyze" BY SOME REASONABLE GENERALIZATION? + bool litRedundant (Lit p, uint32_t abstract_levels); // (helper method for 'analyze()') + lbool search (int nof_conflicts); // Search for a given number of conflicts. + lbool solve_ (); // Main solve method (assumptions given in 'assumptions'). + void reduceDB (); // Reduce the set of learnt clauses. + void removeSatisfied (vec& cs); // Shrink 'cs' to contain only non-satisfied clauses. + void rebuildOrderHeap (); + + // Maintaining Variable/Clause activity: + // + void varDecayActivity (); // Decay all variables with the specified factor. Implemented by increasing the 'bump' value instead. + void varBumpActivity (Var v, double inc); // Increase a variable with the current 'bump' value. + void varBumpActivity (Var v); // Increase a variable with the current 'bump' value. + void claDecayActivity (); // Decay all clauses with the specified factor. Implemented by increasing the 'bump' value instead. + void claBumpActivity (Clause& c); // Increase a clause with the current 'bump' value. + + // Operations on clauses: + // + void attachClause (CRef cr); // Attach a clause to watcher lists. + void detachClause (CRef cr, bool strict = false); // Detach a clause to watcher lists. + void removeClause (CRef cr); // Detach and free a clause. + bool locked (const Clause& c) const; // Returns TRUE if a clause is a reason for some implication in the current state. + bool satisfied (const Clause& c) const; // Returns TRUE if a clause is satisfied in the current state. + + void relocAll (ClauseAllocator& to); + + // Misc: + // + int decisionLevel () const; // Gives the current decisionlevel. + uint32_t abstractLevel (Var x) const; // Used to represent an abstraction of sets of decision levels. + CRef reason (Var x) const; + int level (Var x) const; + double progressEstimate () const; // DELETE THIS ?? IT'S NOT VERY USEFUL ... + bool withinBudget () const; + + // Static helpers: + // + + // Returns a random float 0 <= x < 1. Seed must never be 0. + static inline double drand(double& seed) { + seed *= 1389796; + int q = (int)(seed / 2147483647); + seed -= (double)q * 2147483647; + return seed / 2147483647; } + + // Returns a random integer 0 <= x < size. Seed must never be 0. + static inline int irand(double& seed, int size) { + return (int)(drand(seed) * size); } +}; + + +//================================================================================================= +// Implementation of inline methods: + +inline CRef Solver::reason(Var x) const { return vardata[x].reason; } +inline int Solver::level (Var x) const { return vardata[x].level; } + +inline void Solver::insertVarOrder(Var x) { + if (!order_heap.inHeap(x) && decision[x]) order_heap.insert(x); } + +inline void Solver::varDecayActivity() { var_inc *= (1 / var_decay); } +inline void Solver::varBumpActivity(Var v) { varBumpActivity(v, var_inc); } +inline void Solver::varBumpActivity(Var v, double inc) { + if ( (activity[v] += inc) > 1e100 ) { + // Rescale: + for (int i = 0; i < nVars(); i++) + activity[i] *= 1e-100; + var_inc *= 1e-100; } + + // Update order_heap with respect to new activity: + if (order_heap.inHeap(v)) + order_heap.decrease(v); } + +inline void Solver::claDecayActivity() { cla_inc *= (1 / clause_decay); } +inline void Solver::claBumpActivity (Clause& c) { + if ( (c.activity() += cla_inc) > 1e20 ) { + // Rescale: + for (int i = 0; i < learnts.size(); i++) + ca[learnts[i]].activity() *= 1e-20; + cla_inc *= 1e-20; } } + +inline void Solver::checkGarbage(void){ return checkGarbage(garbage_frac); } +inline void Solver::checkGarbage(double gf){ + if (ca.wasted() > ca.size() * gf) + garbageCollect(); } + +// NOTE: enqueue does not set the ok flag! (only public methods do) +inline bool Solver::enqueue (Lit p, CRef from) { return value(p) != l_Undef ? value(p) != l_False : (uncheckedEnqueue(p, from), true); } +inline bool Solver::addClause (const vec& ps) { ps.copyTo(add_tmp); return addClause_(add_tmp); } +inline bool Solver::addEmptyClause () { add_tmp.clear(); return addClause_(add_tmp); } +inline bool Solver::addClause (Lit p) { add_tmp.clear(); add_tmp.push(p); return addClause_(add_tmp); } +inline bool Solver::addClause (Lit p, Lit q) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); } +inline bool Solver::addClause (Lit p, Lit q, Lit r) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); } +inline bool Solver::locked (const Clause& c) const { return value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c; } +inline void Solver::newDecisionLevel() { trail_lim.push(trail.size()); } + +inline int Solver::decisionLevel () const { return trail_lim.size(); } +inline uint32_t Solver::abstractLevel (Var x) const { return 1 << (level(x) & 31); } +inline lbool Solver::value (Var x) const { return assigns[x]; } +inline lbool Solver::value (Lit p) const { return assigns[var(p)] ^ sign(p); } +inline lbool Solver::modelValue (Var x) const { return model[x]; } +inline lbool Solver::modelValue (Lit p) const { return model[var(p)] ^ sign(p); } +inline int Solver::nAssigns () const { return trail.size(); } +inline int Solver::nClauses () const { return clauses.size(); } +inline int Solver::nLearnts () const { return learnts.size(); } +inline int Solver::nVars () const { return vardata.size(); } +inline int Solver::nFreeVars () const { return (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]); } +inline void Solver::setPolarity (Var v, bool b) { polarity[v] = b; } +inline void Solver::setDecisionVar(Var v, bool b) +{ + if ( b && !decision[v]) dec_vars++; + else if (!b && decision[v]) dec_vars--; + + decision[v] = b; + insertVarOrder(v); +} +inline void Solver::setConfBudget(int64_t x){ conflict_budget = conflicts + x; } +inline void Solver::setPropBudget(int64_t x){ propagation_budget = propagations + x; } +inline void Solver::interrupt(){ asynch_interrupt = true; } +inline void Solver::clearInterrupt(){ asynch_interrupt = false; } +inline void Solver::budgetOff(){ conflict_budget = propagation_budget = -1; } +inline bool Solver::withinBudget() const { + return !asynch_interrupt && + (conflict_budget < 0 || conflicts < (uint64_t)conflict_budget) && + (propagation_budget < 0 || propagations < (uint64_t)propagation_budget); } + +// FIXME: after the introduction of asynchronous interrruptions the solve-versions that return a +// pure bool do not give a safe interface. Either interrupts must be possible to turn off here, or +// all calls to solve must return an 'lbool'. I'm not yet sure which I prefer. +inline bool Solver::solve () { budgetOff(); assumptions.clear(); return solve_() == l_True; } +inline bool Solver::solve (Lit p) { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_() == l_True; } +inline bool Solver::solve (Lit p, Lit q) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_() == l_True; } +inline bool Solver::solve (Lit p, Lit q, Lit r) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_() == l_True; } +inline bool Solver::solve (const vec& assumps){ budgetOff(); assumps.copyTo(assumptions); return solve_() == l_True; } +inline lbool Solver::solveLimited (const vec& assumps){ assumps.copyTo(assumptions); return solve_(); } +inline bool Solver::okay () const { return ok; } + +inline void Solver::toDimacs (const char* file){ vec as; toDimacs(file, as); } +inline void Solver::toDimacs (const char* file, Lit p){ vec as; as.push(p); toDimacs(file, as); } +inline void Solver::toDimacs (const char* file, Lit p, Lit q){ vec as; as.push(p); as.push(q); toDimacs(file, as); } +inline void Solver::toDimacs (const char* file, Lit p, Lit q, Lit r){ vec as; as.push(p); as.push(q); as.push(r); toDimacs(file, as); } + + +//================================================================================================= +// Debug etc: + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/core/SolverTypes.h b/packages/bee/minisat-2.0.2/core/SolverTypes.h new file mode 100755 index 000000000..61f3d931d --- /dev/null +++ b/packages/bee/minisat-2.0.2/core/SolverTypes.h @@ -0,0 +1,407 @@ +/***********************************************************************************[SolverTypes.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef Minisat_SolverTypes_h +#define Minisat_SolverTypes_h + +#include + +#include "mtl/IntTypes.h" +#include "mtl/Alg.h" +#include "mtl/Vec.h" +#include "mtl/Map.h" +#include "mtl/Alloc.h" + +namespace Minisat { + +//================================================================================================= +// Variables, literals, lifted booleans, clauses: + + +// NOTE! Variables are just integers. No abstraction here. They should be chosen from 0..N, +// so that they can be used as array indices. + +typedef int Var; +#define var_Undef (-1) + + +struct Lit { + int x; + + // Use this as a constructor: + friend Lit mkLit(Var var, bool sign); + + bool operator == (Lit p) const { return x == p.x; } + bool operator != (Lit p) const { return x != p.x; } + bool operator < (Lit p) const { return x < p.x; } // '<' makes p, ~p adjacent in the ordering. +}; + + +inline Lit mkLit (Var var, bool sign=false) { Lit p; p.x = var + var + (int)sign; return p; } +inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; } +inline Lit operator ^(Lit p, bool b) { Lit q; q.x = p.x ^ (unsigned int)b; return q; } +inline bool sign (Lit p) { return p.x & 1; } +inline int var (Lit p) { return p.x >> 1; } + +// Mapping Literals to and from compact integers suitable for array indexing: +inline int toInt (Var v) { return v; } +inline int toInt (Lit p) { return p.x; } +inline Lit toLit (int i) { Lit p; p.x = i; return p; } + +//const Lit lit_Undef = mkLit(var_Undef, false); // }- Useful special constants. +//const Lit lit_Error = mkLit(var_Undef, true ); // } + +const Lit lit_Undef = { -2 }; // }- Useful special constants. +const Lit lit_Error = { -1 }; // } + + +//================================================================================================= +// Lifted booleans: +// +// NOTE: this implementation is optimized for the case when comparisons between values are mostly +// between one variable and one constant. Some care had to be taken to make sure that gcc +// does enough constant propagation to produce sensible code, and this appears to be somewhat +// fragile unfortunately. + +#define l_True (lbool((uint8_t)0)) // gcc does not do constant propagation if these are real constants. +#define l_False (lbool((uint8_t)1)) +#define l_Undef (lbool((uint8_t)2)) + +class lbool { + uint8_t value; + +public: + explicit lbool(uint8_t v) : value(v) { } + + lbool() : value(0) { } + explicit lbool(bool x) : value(!x) { } + + bool operator == (lbool b) const { return ((b.value&2) & (value&2)) | (!(b.value&2)&(value == b.value)); } + bool operator != (lbool b) const { return !(*this == b); } + lbool operator ^ (bool b) const { return lbool((uint8_t)(value^(uint8_t)b)); } + + lbool operator && (lbool b) const { + uint8_t sel = (this->value << 1) | (b.value << 3); + uint8_t v = (0xF7F755F4 >> sel) & 3; + return lbool(v); } + + lbool operator || (lbool b) const { + uint8_t sel = (this->value << 1) | (b.value << 3); + uint8_t v = (0xFCFCF400 >> sel) & 3; + return lbool(v); } + + friend int toInt (lbool l); + friend lbool toLbool(int v); +}; +inline int toInt (lbool l) { return l.value; } +inline lbool toLbool(int v) { return lbool((uint8_t)v); } + +//================================================================================================= +// Clause -- a simple class for representing a clause: + +class Clause; +typedef RegionAllocator::Ref CRef; + +class Clause { + struct { + unsigned mark : 2; + unsigned learnt : 1; + unsigned has_extra : 1; + unsigned reloced : 1; + unsigned size : 27; } header; + union { Lit lit; float act; uint32_t abs; CRef rel; } data[0]; + + friend class ClauseAllocator; + + // NOTE: This constructor cannot be used directly (doesn't allocate enough memory). + template + Clause(const V& ps, bool use_extra, bool learnt) { + header.mark = 0; + header.learnt = learnt; + header.has_extra = use_extra; + header.reloced = 0; + header.size = ps.size(); + + for (int i = 0; i < ps.size(); i++) + data[i].lit = ps[i]; + + if (header.has_extra){ + if (header.learnt) + data[header.size].act = 0; + else + calcAbstraction(); } + } + +public: + void calcAbstraction() { + assert(header.has_extra); + uint32_t abstraction = 0; + for (int i = 0; i < size(); i++) + abstraction |= 1 << (var(data[i].lit) & 31); + data[header.size].abs = abstraction; } + + + int size () const { return header.size; } + void shrink (int i) { assert(i <= size()); if (header.has_extra) data[header.size-i] = data[header.size]; header.size -= i; } + void pop () { shrink(1); } + bool learnt () const { return header.learnt; } + bool has_extra () const { return header.has_extra; } + uint32_t mark () const { return header.mark; } + void mark (uint32_t m) { header.mark = m; } + const Lit& last () const { return data[header.size-1].lit; } + + bool reloced () const { return header.reloced; } + CRef relocation () const { return data[0].rel; } + void relocate (CRef c) { header.reloced = 1; data[0].rel = c; } + + // NOTE: somewhat unsafe to change the clause in-place! Must manually call 'calcAbstraction' afterwards for + // subsumption operations to behave correctly. + Lit& operator [] (int i) { return data[i].lit; } + Lit operator [] (int i) const { return data[i].lit; } + operator const Lit* (void) const { return (Lit*)data; } + + float& activity () { assert(header.has_extra); return data[header.size].act; } + uint32_t abstraction () const { assert(header.has_extra); return data[header.size].abs; } + + Lit subsumes (const Clause& other) const; + void strengthen (Lit p); +}; + + +//================================================================================================= +// ClauseAllocator -- a simple class for allocating memory for clauses: + + +const CRef CRef_Undef = RegionAllocator::Ref_Undef; +class ClauseAllocator : public RegionAllocator +{ + static int clauseWord32Size(int size, bool has_extra){ + return (sizeof(Clause) + (sizeof(Lit) * (size + (int)has_extra))) / sizeof(uint32_t); } + public: + bool extra_clause_field; + + ClauseAllocator(uint32_t start_cap) : RegionAllocator(start_cap), extra_clause_field(false){} + ClauseAllocator() : extra_clause_field(false){} + + void moveTo(ClauseAllocator& to){ + to.extra_clause_field = extra_clause_field; + RegionAllocator::moveTo(to); } + + template + CRef alloc(const Lits& ps, bool learnt = false) + { + assert(sizeof(Lit) == sizeof(uint32_t)); + assert(sizeof(float) == sizeof(uint32_t)); + bool use_extra = learnt | extra_clause_field; + + CRef cid = RegionAllocator::alloc(clauseWord32Size(ps.size(), use_extra)); + new (lea(cid)) Clause(ps, use_extra, learnt); + + return cid; + } + + // Deref, Load Effective Address (LEA), Inverse of LEA (AEL): + Clause& operator[](Ref r) { return (Clause&)RegionAllocator::operator[](r); } + const Clause& operator[](Ref r) const { return (Clause&)RegionAllocator::operator[](r); } + Clause* lea (Ref r) { return (Clause*)RegionAllocator::lea(r); } + const Clause* lea (Ref r) const { return (Clause*)RegionAllocator::lea(r); } + Ref ael (const Clause* t){ return RegionAllocator::ael((uint32_t*)t); } + + void free(CRef cid) + { + Clause& c = operator[](cid); + RegionAllocator::free(clauseWord32Size(c.size(), c.has_extra())); + } + + void reloc(CRef& cr, ClauseAllocator& to) + { + Clause& c = operator[](cr); + + if (c.reloced()) { cr = c.relocation(); return; } + + cr = to.alloc(c, c.learnt()); + c.relocate(cr); + + // Copy extra data-fields: + // (This could be cleaned-up. Generalize Clause-constructor to be applicable here instead?) + to[cr].mark(c.mark()); + if (to[cr].learnt()) to[cr].activity() = c.activity(); + else if (to[cr].has_extra()) to[cr].calcAbstraction(); + } +}; + + +//================================================================================================= +// OccLists -- a class for maintaining occurence lists with lazy deletion: + +template +class OccLists +{ + vec occs; + vec dirty; + vec dirties; + Deleted deleted; + + public: + OccLists(const Deleted& d) : deleted(d) {} + + void init (const Idx& idx){ occs.growTo(toInt(idx)+1); dirty.growTo(toInt(idx)+1, 0); } + // Vec& operator[](const Idx& idx){ return occs[toInt(idx)]; } + Vec& operator[](const Idx& idx){ return occs[toInt(idx)]; } + Vec& lookup (const Idx& idx){ if (dirty[toInt(idx)]) clean(idx); return occs[toInt(idx)]; } + + void cleanAll (); + void clean (const Idx& idx); + void smudge (const Idx& idx){ + if (dirty[toInt(idx)] == 0){ + dirty[toInt(idx)] = 1; + dirties.push(idx); + } + } + + void clear(bool free = true){ + occs .clear(free); + dirty .clear(free); + dirties.clear(free); + } +}; + + +template +void OccLists::cleanAll() +{ + for (int i = 0; i < dirties.size(); i++) + // Dirties may contain duplicates so check here if a variable is already cleaned: + if (dirty[toInt(dirties[i])]) + clean(dirties[i]); + dirties.clear(); +} + + +template +void OccLists::clean(const Idx& idx) +{ + Vec& vec = occs[toInt(idx)]; + int i, j; + for (i = j = 0; i < vec.size(); i++) + if (!deleted(vec[i])) + vec[j++] = vec[i]; + vec.shrink(i - j); + dirty[toInt(idx)] = 0; +} + + +//================================================================================================= +// CMap -- a class for mapping clauses to values: + + +template +class CMap +{ + struct CRefHash { + uint32_t operator()(CRef cr) const { return (uint32_t)cr; } }; + + typedef Map HashTable; + HashTable map; + + public: + // Size-operations: + void clear () { map.clear(); } + int size () const { return map.elems(); } + + + // Insert/Remove/Test mapping: + void insert (CRef cr, const T& t){ map.insert(cr, t); } + void growTo (CRef cr, const T& t){ map.insert(cr, t); } // NOTE: for compatibility + void remove (CRef cr) { map.remove(cr); } + bool has (CRef cr, T& t) { return map.peek(cr, t); } + + // Vector interface (the clause 'c' must already exist): + const T& operator [] (CRef cr) const { return map[cr]; } + T& operator [] (CRef cr) { return map[cr]; } + + // Iteration (not transparent at all at the moment): + int bucket_count() const { return map.bucket_count(); } + const vec& bucket(int i) const { return map.bucket(i); } + + // Move contents to other map: + void moveTo(CMap& other){ map.moveTo(other.map); } + + // TMP debug: + void debug(){ + printf(" --- size = %d, bucket_count = %d\n", size(), map.bucket_count()); } +}; + + +/*_________________________________________________________________________________________________ +| +| subsumes : (other : const Clause&) -> Lit +| +| Description: +| Checks if clause subsumes 'other', and at the same time, if it can be used to simplify 'other' +| by subsumption resolution. +| +| Result: +| lit_Error - No subsumption or simplification +| lit_Undef - Clause subsumes 'other' +| p - The literal p can be deleted from 'other' +|________________________________________________________________________________________________@*/ +inline Lit Clause::subsumes(const Clause& other) const +{ + //if (other.size() < size() || (extra.abst & ~other.extra.abst) != 0) + //if (other.size() < size() || (!learnt() && !other.learnt() && (extra.abst & ~other.extra.abst) != 0)) + assert(!header.learnt); assert(!other.header.learnt); + assert(header.has_extra); assert(other.header.has_extra); + if (other.header.size < header.size || (data[header.size].abs & ~other.data[other.header.size].abs) != 0) + return lit_Error; + + Lit ret = lit_Undef; + const Lit* c = (const Lit*)(*this); + const Lit* d = (const Lit*)other; + + for (unsigned i = 0; i < header.size; i++) { + // search for c[i] or ~c[i] + for (unsigned j = 0; j < other.header.size; j++) + if (c[i] == d[j]) + goto ok; + else if (ret == lit_Undef && c[i] == ~d[j]){ + ret = c[i]; + goto ok; + } + + // did not find it + return lit_Error; + ok:; + } + + return ret; +} + +inline void Clause::strengthen(Lit p) +{ + remove(*this, p); + calcAbstraction(); +} + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/doc/ReleaseNotes-2.2.0.txt b/packages/bee/minisat-2.0.2/doc/ReleaseNotes-2.2.0.txt new file mode 100755 index 000000000..7f084de2b --- /dev/null +++ b/packages/bee/minisat-2.0.2/doc/ReleaseNotes-2.2.0.txt @@ -0,0 +1,79 @@ +Release Notes for MiniSat 2.2.0 +=============================== + +Changes since version 2.0: + + * Started using a more standard release numbering. + + * Includes some now well-known heuristics: phase-saving and luby + restarts. The old heuristics are still present and can be activated + if needed. + + * Detection/Handling of out-of-memory and vector capacity + overflow. This is fairly new and relatively untested. + + * Simple resource controls: CPU-time, memory, number of + conflicts/decisions. + + * CPU-time limiting is implemented by a more general, but simple, + asynchronous interruption feature. This means that the solving + procedure can be interrupted from another thread or in a signal + handler. + + * Improved portability with respect to building on Solaris and with + Visual Studio. This is not regularly tested and chances are that + this have been broken since, but should be fairly easy to fix if + so. + + * Changed C++ file-extention to the less problematic ".cc". + + * Source code is now namespace-protected + + * Introducing a new Clause Memory Allocator that brings reduced + memory consumption on 64-bit architechtures and improved + performance (to some extent). The allocator uses a region-based + approach were all references to clauses are represented as a 32-bit + index into a global memory region that contains all clauses. To + free up and compact memory it uses a simple copying garbage + collector. + + * Improved unit-propagation by Blocking Literals. For each entry in + the watcher lists, pair the pointer to a clause with some + (arbitrary) literal from the clause. The idea is that if the + literal is currently true (i.e. the clause is satisfied) the + watchers of the clause does not need to be altered. This can thus + be detected without touching the clause's memory at all. As often + as can be done cheaply, the blocking literal for entries to the + watcher list of a literal 'p' is set to the other literal watched + in the corresponding clause. + + * Basic command-line/option handling system. Makes it easy to specify + options in the class that they affect, and whenever that class is + used in an executable, parsing of options and help messages are + brought in automatically. + + * General clean-up and various minor bug-fixes. + + * Changed implementation of variable-elimination/model-extension: + + - The interface is changed so that arbitrary remembering is no longer + possible. If you need to mention some variable again in the future, + this variable has to be frozen. + + - When eliminating a variable, only clauses that contain the variable + with one sign is necessary to store. Thereby making the other sign + a "default" value when extending models. + + - The memory consumption for eliminated clauses is further improved + by storing all eliminated clauses in a single contiguous vector. + + * Some common utility code (I/O, Parsing, CPU-time, etc) is ripped + out and placed in a separate "utils" directory. + + * The DIMACS parse is refactored so that it can be reused in other + applications (not very elegant, but at least possible). + + * Some simple improvements to scalability of preprocessing, using + more lazy clause removal from data-structures and a couple of + ad-hoc limits (the longest clause that can be produced in variable + elimination, and the longest clause used in backward subsumption). diff --git a/packages/bee/minisat-2.0.2/mtl/Alg.h b/packages/bee/minisat-2.0.2/mtl/Alg.h new file mode 100755 index 000000000..bb1ee5ad2 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/Alg.h @@ -0,0 +1,84 @@ +/*******************************************************************************************[Alg.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_Alg_h +#define Minisat_Alg_h + +#include "mtl/Vec.h" + +namespace Minisat { + +//================================================================================================= +// Useful functions on vector-like types: + +//================================================================================================= +// Removing and searching for elements: +// + +template +static inline void remove(V& ts, const T& t) +{ + int j = 0; + for (; j < ts.size() && ts[j] != t; j++); + assert(j < ts.size()); + for (; j < ts.size()-1; j++) ts[j] = ts[j+1]; + ts.pop(); +} + + +template +static inline bool find(V& ts, const T& t) +{ + int j = 0; + for (; j < ts.size() && ts[j] != t; j++); + return j < ts.size(); +} + + +//================================================================================================= +// Copying vectors with support for nested vector types: +// + +// Base case: +template +static inline void copy(const T& from, T& to) +{ + to = from; +} + +// Recursive case: +template +static inline void copy(const vec& from, vec& to, bool append = false) +{ + if (!append) + to.clear(); + for (int i = 0; i < from.size(); i++){ + to.push(); + copy(from[i], to.last()); + } +} + +template +static inline void append(const vec& from, vec& to){ copy(from, to, true); } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/mtl/Alloc.h b/packages/bee/minisat-2.0.2/mtl/Alloc.h new file mode 100755 index 000000000..76322b8b6 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/Alloc.h @@ -0,0 +1,131 @@ +/*****************************************************************************************[Alloc.h] +Copyright (c) 2008-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef Minisat_Alloc_h +#define Minisat_Alloc_h + +#include "mtl/XAlloc.h" +#include "mtl/Vec.h" + +namespace Minisat { + +//================================================================================================= +// Simple Region-based memory allocator: + +template +class RegionAllocator +{ + T* memory; + uint32_t sz; + uint32_t cap; + uint32_t wasted_; + + void capacity(uint32_t min_cap); + + public: + // TODO: make this a class for better type-checking? + typedef uint32_t Ref; + enum { Ref_Undef = UINT32_MAX }; + enum { Unit_Size = sizeof(uint32_t) }; + + explicit RegionAllocator(uint32_t start_cap = 1024*1024) : memory(NULL), sz(0), cap(0), wasted_(0){ capacity(start_cap); } + ~RegionAllocator() + { + if (memory != NULL) + ::free(memory); + } + + + uint32_t size () const { return sz; } + uint32_t wasted () const { return wasted_; } + + Ref alloc (int size); + void free (int size) { wasted_ += size; } + + // Deref, Load Effective Address (LEA), Inverse of LEA (AEL): + T& operator[](Ref r) { assert(r >= 0 && r < sz); return memory[r]; } + const T& operator[](Ref r) const { assert(r >= 0 && r < sz); return memory[r]; } + + T* lea (Ref r) { assert(r >= 0 && r < sz); return &memory[r]; } + const T* lea (Ref r) const { assert(r >= 0 && r < sz); return &memory[r]; } + Ref ael (const T* t) { assert((void*)t >= (void*)&memory[0] && (void*)t < (void*)&memory[sz-1]); + return (Ref)(t - &memory[0]); } + + void moveTo(RegionAllocator& to) { + if (to.memory != NULL) ::free(to.memory); + to.memory = memory; + to.sz = sz; + to.cap = cap; + to.wasted_ = wasted_; + + memory = NULL; + sz = cap = wasted_ = 0; + } + + +}; + +template +void RegionAllocator::capacity(uint32_t min_cap) +{ + if (cap >= min_cap) return; + + uint32_t prev_cap = cap; + while (cap < min_cap){ + // NOTE: Multiply by a factor (13/8) without causing overflow, then add 2 and make the + // result even by clearing the least significant bit. The resulting sequence of capacities + // is carefully chosen to hit a maximum capacity that is close to the '2^32-1' limit when + // using 'uint32_t' as indices so that as much as possible of this space can be used. + uint32_t delta = ((cap >> 1) + (cap >> 3) + 2) & ~1; + cap += delta; + + if (cap <= prev_cap) + throw OutOfMemoryException(); + } + // printf(" .. (%p) cap = %u\n", this, cap); + + assert(cap > 0); + memory = (T*)xrealloc(memory, sizeof(T)*cap); +} + + +template +typename RegionAllocator::Ref +RegionAllocator::alloc(int size) +{ + // printf("ALLOC called (this = %p, size = %d)\n", this, size); fflush(stdout); + assert(size > 0); + capacity(sz + size); + + uint32_t prev_sz = sz; + sz += size; + + // Handle overflow: + if (sz < prev_sz) + throw OutOfMemoryException(); + + return prev_sz; +} + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/mtl/Heap.h b/packages/bee/minisat-2.0.2/mtl/Heap.h new file mode 100755 index 000000000..226407e77 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/Heap.h @@ -0,0 +1,148 @@ +/******************************************************************************************[Heap.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_Heap_h +#define Minisat_Heap_h + +#include "mtl/Vec.h" + +namespace Minisat { + +//================================================================================================= +// A heap implementation with support for decrease/increase key. + + +template +class Heap { + Comp lt; // The heap is a minimum-heap with respect to this comparator + vec heap; // Heap of integers + vec indices; // Each integers position (index) in the Heap + + // Index "traversal" functions + static inline int left (int i) { return i*2+1; } + static inline int right (int i) { return (i+1)*2; } + static inline int parent(int i) { return (i-1) >> 1; } + + + void percolateUp(int i) + { + int x = heap[i]; + int p = parent(i); + + while (i != 0 && lt(x, heap[p])){ + heap[i] = heap[p]; + indices[heap[p]] = i; + i = p; + p = parent(p); + } + heap [i] = x; + indices[x] = i; + } + + + void percolateDown(int i) + { + int x = heap[i]; + while (left(i) < heap.size()){ + int child = right(i) < heap.size() && lt(heap[right(i)], heap[left(i)]) ? right(i) : left(i); + if (!lt(heap[child], x)) break; + heap[i] = heap[child]; + indices[heap[i]] = i; + i = child; + } + heap [i] = x; + indices[x] = i; + } + + + public: + Heap(const Comp& c) : lt(c) { } + + int size () const { return heap.size(); } + bool empty () const { return heap.size() == 0; } + bool inHeap (int n) const { return n < indices.size() && indices[n] >= 0; } + int operator[](int index) const { assert(index < heap.size()); return heap[index]; } + + + void decrease (int n) { assert(inHeap(n)); percolateUp (indices[n]); } + void increase (int n) { assert(inHeap(n)); percolateDown(indices[n]); } + + + // Safe variant of insert/decrease/increase: + void update(int n) + { + if (!inHeap(n)) + insert(n); + else { + percolateUp(indices[n]); + percolateDown(indices[n]); } + } + + + void insert(int n) + { + indices.growTo(n+1, -1); + assert(!inHeap(n)); + + indices[n] = heap.size(); + heap.push(n); + percolateUp(indices[n]); + } + + + int removeMin() + { + int x = heap[0]; + heap[0] = heap.last(); + indices[heap[0]] = 0; + indices[x] = -1; + heap.pop(); + if (heap.size() > 1) percolateDown(0); + return x; + } + + + // Rebuild the heap from scratch, using the elements in 'ns': + void build(vec& ns) { + for (int i = 0; i < heap.size(); i++) + indices[heap[i]] = -1; + heap.clear(); + + for (int i = 0; i < ns.size(); i++){ + indices[ns[i]] = i; + heap.push(ns[i]); } + + for (int i = heap.size() / 2 - 1; i >= 0; i--) + percolateDown(i); + } + + void clear(bool dealloc = false) + { + for (int i = 0; i < heap.size(); i++) + indices[heap[i]] = -1; + heap.clear(dealloc); + } +}; + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/mtl/IntTypes.h b/packages/bee/minisat-2.0.2/mtl/IntTypes.h new file mode 100755 index 000000000..f97fbb767 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/IntTypes.h @@ -0,0 +1,82 @@ +/**************************************************************************************[IntTypes.h] +Copyright (c) 2009-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_IntTypes_h +#define Minisat_IntTypes_h + +//#ifdef __sun + // Not sure if there are newer versions that support C99 headers. The + // needed features are implemented in the headers below though: + +//# include +//# include +//# include + +#ifdef _MSC_VER + +#if _MSC_VER >= 1600 // [ +#include +#else // ] _MSC_VER >= 1600 [ + +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +#endif //] + +#else + +# include +# include + +#endif + +#include + +//================================================================================================= + +#endif diff --git a/packages/bee/minisat-2.0.2/mtl/Map.h b/packages/bee/minisat-2.0.2/mtl/Map.h new file mode 100755 index 000000000..8a82d0e28 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/Map.h @@ -0,0 +1,193 @@ +/*******************************************************************************************[Map.h] +Copyright (c) 2006-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_Map_h +#define Minisat_Map_h + +#include "mtl/IntTypes.h" +#include "mtl/Vec.h" + +namespace Minisat { + +//================================================================================================= +// Default hash/equals functions +// + +template struct Hash { uint32_t operator()(const K& k) const { return hash(k); } }; +template struct Equal { bool operator()(const K& k1, const K& k2) const { return k1 == k2; } }; + +template struct DeepHash { uint32_t operator()(const K* k) const { return hash(*k); } }; +template struct DeepEqual { bool operator()(const K* k1, const K* k2) const { return *k1 == *k2; } }; + +static inline uint32_t hash(uint32_t x){ return x; } +static inline uint32_t hash(uint64_t x){ return (uint32_t)x; } +static inline uint32_t hash(int32_t x) { return (uint32_t)x; } +static inline uint32_t hash(int64_t x) { return (uint32_t)x; } + + +//================================================================================================= +// Some primes +// + +static const int nprimes = 25; +static const int primes [nprimes] = { 31, 73, 151, 313, 643, 1291, 2593, 5233, 10501, 21013, 42073, 84181, 168451, 337219, 674701, 1349473, 2699299, 5398891, 10798093, 21596719, 43193641, 86387383, 172775299, 345550609, 691101253 }; + +//================================================================================================= +// Hash table implementation of Maps +// + +template, class E = Equal > +class Map { + public: + struct Pair { K key; D data; }; + + private: + H hash; + E equals; + + vec* table; + int cap; + int size; + + // Don't allow copying (error prone): + Map& operator = (Map& other) { assert(0); } + Map (Map& other) { assert(0); } + + bool checkCap(int new_size) const { return new_size > cap; } + + int32_t index (const K& k) const { return hash(k) % cap; } + void _insert (const K& k, const D& d) { + vec& ps = table[index(k)]; + ps.push(); ps.last().key = k; ps.last().data = d; } + + void rehash () { + const vec* old = table; + + int old_cap = cap; + int newsize = primes[0]; + for (int i = 1; newsize <= cap && i < nprimes; i++) + newsize = primes[i]; + + table = new vec[newsize]; + cap = newsize; + + for (int i = 0; i < old_cap; i++){ + for (int j = 0; j < old[i].size(); j++){ + _insert(old[i][j].key, old[i][j].data); }} + + delete [] old; + + // printf(" --- rehashing, old-cap=%d, new-cap=%d\n", cap, newsize); + } + + + public: + + Map () : table(NULL), cap(0), size(0) {} + Map (const H& h, const E& e) : hash(h), equals(e), table(NULL), cap(0), size(0){} + ~Map () { delete [] table; } + + // PRECONDITION: the key must already exist in the map. + const D& operator [] (const K& k) const + { + assert(size != 0); + const D* res = NULL; + const vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)) + res = &ps[i].data; + assert(res != NULL); + return *res; + } + + // PRECONDITION: the key must already exist in the map. + D& operator [] (const K& k) + { + assert(size != 0); + D* res = NULL; + vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)) + res = &ps[i].data; + assert(res != NULL); + return *res; + } + + // PRECONDITION: the key must *NOT* exist in the map. + void insert (const K& k, const D& d) { if (checkCap(size+1)) rehash(); _insert(k, d); size++; } + bool peek (const K& k, D& d) const { + if (size == 0) return false; + const vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)){ + d = ps[i].data; + return true; } + return false; + } + + bool has (const K& k) const { + if (size == 0) return false; + const vec& ps = table[index(k)]; + for (int i = 0; i < ps.size(); i++) + if (equals(ps[i].key, k)) + return true; + return false; + } + + // PRECONDITION: the key must exist in the map. + void remove(const K& k) { + assert(table != NULL); + vec& ps = table[index(k)]; + int j = 0; + for (; j < ps.size() && !equals(ps[j].key, k); j++); + assert(j < ps.size()); + ps[j] = ps.last(); + ps.pop(); + size--; + } + + void clear () { + cap = size = 0; + delete [] table; + table = NULL; + } + + int elems() const { return size; } + int bucket_count() const { return cap; } + + // NOTE: the hash and equality objects are not moved by this method: + void moveTo(Map& other){ + delete [] other.table; + + other.table = table; + other.cap = cap; + other.size = size; + + table = NULL; + size = cap = 0; + } + + // NOTE: given a bit more time, I could make a more C++-style iterator out of this: + const vec& bucket(int i) const { return table[i]; } +}; + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/mtl/Queue.h b/packages/bee/minisat-2.0.2/mtl/Queue.h new file mode 100755 index 000000000..17567d694 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/Queue.h @@ -0,0 +1,69 @@ +/*****************************************************************************************[Queue.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_Queue_h +#define Minisat_Queue_h + +#include "mtl/Vec.h" + +namespace Minisat { + +//================================================================================================= + +template +class Queue { + vec buf; + int first; + int end; + +public: + typedef T Key; + + Queue() : buf(1), first(0), end(0) {} + + void clear (bool dealloc = false) { buf.clear(dealloc); buf.growTo(1); first = end = 0; } + int size () const { return (end >= first) ? end - first : end - first + buf.size(); } + + const T& operator [] (int index) const { assert(index >= 0); assert(index < size()); return buf[(first + index) % buf.size()]; } + T& operator [] (int index) { assert(index >= 0); assert(index < size()); return buf[(first + index) % buf.size()]; } + + T peek () const { assert(first != end); return buf[first]; } + void pop () { assert(first != end); first++; if (first == buf.size()) first = 0; } + void insert(T elem) { // INVARIANT: buf[end] is always unused + buf[end++] = elem; + if (end == buf.size()) end = 0; + if (first == end){ // Resize: + vec tmp((buf.size()*3 + 1) >> 1); + //**/printf("queue alloc: %d elems (%.1f MB)\n", tmp.size(), tmp.size() * sizeof(T) / 1000000.0); + int i = 0; + for (int j = first; j < buf.size(); j++) tmp[i++] = buf[j]; + for (int j = 0 ; j < end ; j++) tmp[i++] = buf[j]; + first = 0; + end = buf.size(); + tmp.moveTo(buf); + } + } +}; + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/mtl/Sort.h b/packages/bee/minisat-2.0.2/mtl/Sort.h new file mode 100755 index 000000000..e9313ef86 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/Sort.h @@ -0,0 +1,98 @@ +/******************************************************************************************[Sort.h] +Copyright (c) 2003-2007, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_Sort_h +#define Minisat_Sort_h + +#include "mtl/Vec.h" + +//================================================================================================= +// Some sorting algorithms for vec's + + +namespace Minisat { + +template +struct LessThan_default { + bool operator () (T x, T y) { return x < y; } +}; + + +template +void selectionSort(T* array, int size, LessThan lt) +{ + int i, j, best_i; + T tmp; + + for (i = 0; i < size-1; i++){ + best_i = i; + for (j = i+1; j < size; j++){ + if (lt(array[j], array[best_i])) + best_i = j; + } + tmp = array[i]; array[i] = array[best_i]; array[best_i] = tmp; + } +} +template static inline void selectionSort(T* array, int size) { + selectionSort(array, size, LessThan_default()); } + +template +void sort(T* array, int size, LessThan lt) +{ + if (size <= 15) + selectionSort(array, size, lt); + + else{ + T pivot = array[size / 2]; + T tmp; + int i = -1; + int j = size; + + for(;;){ + do i++; while(lt(array[i], pivot)); + do j--; while(lt(pivot, array[j])); + + if (i >= j) break; + + tmp = array[i]; array[i] = array[j]; array[j] = tmp; + } + + sort(array , i , lt); + sort(&array[i], size-i, lt); + } +} +template static inline void sort(T* array, int size) { + sort(array, size, LessThan_default()); } + + +//================================================================================================= +// For 'vec's: + + +template void sort(vec& v, LessThan lt) { + sort((T*)v, v.size(), lt); } +template void sort(vec& v) { + sort(v, LessThan_default()); } + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/mtl/Vec.h b/packages/bee/minisat-2.0.2/mtl/Vec.h new file mode 100755 index 000000000..857742420 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/Vec.h @@ -0,0 +1,130 @@ +/*******************************************************************************************[Vec.h] +Copyright (c) 2003-2007, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_Vec_h +#define Minisat_Vec_h + +#include +#include + +#include "mtl/IntTypes.h" +#include "mtl/XAlloc.h" + +namespace Minisat { + +//================================================================================================= +// Automatically resizable arrays +// +// NOTE! Don't use this vector on datatypes that cannot be re-located in memory (with realloc) + +template +class vec { + T* data; + int sz; + int cap; + + // Don't allow copying (error prone): + vec& operator = (vec& other) { assert(0); return *this; } + vec (vec& other) { assert(0); } + + // Helpers for calculating next capacity: + static inline int imax (int x, int y) { int mask = (y-x) >> (sizeof(int)*8-1); return (x&mask) + (y&(~mask)); } + //static inline void nextCap(int& cap){ cap += ((cap >> 1) + 2) & ~1; } + static inline void nextCap(int& cap){ cap += ((cap >> 1) + 2) & ~1; } + +public: + // Constructors: + vec() : data(NULL) , sz(0) , cap(0) { } + explicit vec(int size) : data(NULL) , sz(0) , cap(0) { growTo(size); } + vec(int size, const T& pad) : data(NULL) , sz(0) , cap(0) { growTo(size, pad); } + ~vec() { clear(true); } + + // Pointer to first element: + operator T* (void) { return data; } + + // Size operations: + int size (void) const { return sz; } + void shrink (int nelems) { assert(nelems <= sz); for (int i = 0; i < nelems; i++) sz--, data[sz].~T(); } + void shrink_ (int nelems) { assert(nelems <= sz); sz -= nelems; } + int capacity (void) const { return cap; } + void capacity (int min_cap); + void growTo (int size); + void growTo (int size, const T& pad); + void clear (bool dealloc = false); + + // Stack interface: + void push (void) { if (sz == cap) capacity(sz+1); new (&data[sz]) T(); sz++; } + void push (const T& elem) { if (sz == cap) capacity(sz+1); data[sz++] = elem; } + void push_ (const T& elem) { assert(sz < cap); data[sz++] = elem; } + void pop (void) { assert(sz > 0); sz--, data[sz].~T(); } + // NOTE: it seems possible that overflow can happen in the 'sz+1' expression of 'push()', but + // in fact it can not since it requires that 'cap' is equal to INT_MAX. This in turn can not + // happen given the way capacities are calculated (below). Essentially, all capacities are + // even, but INT_MAX is odd. + + const T& last (void) const { return data[sz-1]; } + T& last (void) { return data[sz-1]; } + + // Vector interface: + const T& operator [] (int index) const { return data[index]; } + T& operator [] (int index) { return data[index]; } + + // Duplicatation (preferred instead): + void copyTo(vec& copy) const { copy.clear(); copy.growTo(sz); for (int i = 0; i < sz; i++) copy[i] = data[i]; } + void moveTo(vec& dest) { dest.clear(true); dest.data = data; dest.sz = sz; dest.cap = cap; data = NULL; sz = 0; cap = 0; } +}; + + +template +void vec::capacity(int min_cap) { + if (cap >= min_cap) return; + int add = imax((min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1); // NOTE: grow by approximately 3/2 + if (add > INT_MAX - cap || (((data = (T*)::realloc(data, (cap += add) * sizeof(T))) == NULL) && errno == ENOMEM)) + throw OutOfMemoryException(); + } + + +template +void vec::growTo(int size, const T& pad) { + if (sz >= size) return; + capacity(size); + for (int i = sz; i < size; i++) data[i] = pad; + sz = size; } + + +template +void vec::growTo(int size) { + if (sz >= size) return; + capacity(size); + for (int i = sz; i < size; i++) new (&data[i]) T(); + sz = size; } + + +template +void vec::clear(bool dealloc) { + if (data != NULL){ + for (int i = 0; i < sz; i++) data[i].~T(); + sz = 0; + if (dealloc) free(data), data = NULL, cap = 0; } } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/mtl/XAlloc.h b/packages/bee/minisat-2.0.2/mtl/XAlloc.h new file mode 100755 index 000000000..1da176028 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/XAlloc.h @@ -0,0 +1,45 @@ +/****************************************************************************************[XAlloc.h] +Copyright (c) 2009-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + + +#ifndef Minisat_XAlloc_h +#define Minisat_XAlloc_h + +#include +#include + +namespace Minisat { + +//================================================================================================= +// Simple layer on top of malloc/realloc to catch out-of-memory situtaions and provide some typing: + +class OutOfMemoryException{}; +static inline void* xrealloc(void *ptr, size_t size) +{ + void* mem = realloc(ptr, size); + if (mem == NULL && errno == ENOMEM){ + throw OutOfMemoryException(); + }else + return mem; +} + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/mtl/config.mk b/packages/bee/minisat-2.0.2/mtl/config.mk new file mode 100755 index 000000000..b5c36fc6b --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/config.mk @@ -0,0 +1,6 @@ +## +## This file is for system specific configurations. For instance, on +## some systems the path to zlib needs to be added. Example: +## +## CFLAGS += -I/usr/local/include +## LFLAGS += -L/usr/local/lib diff --git a/packages/bee/minisat-2.0.2/mtl/template.mk b/packages/bee/minisat-2.0.2/mtl/template.mk new file mode 100755 index 000000000..3f443fc38 --- /dev/null +++ b/packages/bee/minisat-2.0.2/mtl/template.mk @@ -0,0 +1,107 @@ +## +## Template makefile for Standard, Profile, Debug, Release, and Release-static versions +## +## eg: "make rs" for a statically linked release version. +## "make d" for a debug version (no optimizations). +## "make" for the standard version (optimized, but with debug information and assertions active) + +PWD = $(shell pwd) +EXEC ?= $(notdir $(PWD)) + +CSRCS = $(wildcard $(PWD)/*.cc) +DSRCS = $(foreach dir, $(DEPDIR), $(filter-out $(MROOT)/$(dir)/Main.cc, $(wildcard $(MROOT)/$(dir)/*.cc))) +CHDRS = $(wildcard $(PWD)/*.h) +COBJS = $(CSRCS:.cc=.o) $(DSRCS:.cc=.o) + +PCOBJS = $(addsuffix p, $(COBJS)) +DCOBJS = $(addsuffix d, $(COBJS)) +RCOBJS = $(addsuffix r, $(COBJS)) + + +CXX ?= g++ +CFLAGS ?= -Wall -Wno-parentheses +LFLAGS ?= -Wall + +COPTIMIZE ?= -O3 + +CFLAGS += -I$(MROOT) -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS +LFLAGS += -lz + +.PHONY : s p d r rs clean + +s: $(EXEC) +p: $(EXEC)_profile +d: $(EXEC)_debug +r: $(EXEC)_release +rs: $(EXEC)_static + +libs: lib$(LIB)_standard.a +libp: lib$(LIB)_profile.a +libd: lib$(LIB)_debug.a +libr: lib$(LIB)_release.a + +## Compile options +%.o: CFLAGS +=$(COPTIMIZE) -g -D DEBUG +%.op: CFLAGS +=$(COPTIMIZE) -pg -g -D NDEBUG +%.od: CFLAGS +=-O0 -g -D DEBUG +%.or: CFLAGS +=$(COPTIMIZE) -g -D NDEBUG + +## Link options +$(EXEC): LFLAGS += -g +$(EXEC)_profile: LFLAGS += -g -pg +$(EXEC)_debug: LFLAGS += -g +#$(EXEC)_release: LFLAGS += ... +$(EXEC)_static: LFLAGS += --static + +## Dependencies +$(EXEC): $(COBJS) +$(EXEC)_profile: $(PCOBJS) +$(EXEC)_debug: $(DCOBJS) +$(EXEC)_release: $(RCOBJS) +$(EXEC)_static: $(RCOBJS) + +lib$(LIB)_standard.a: $(filter-out */Main.o, $(COBJS)) +lib$(LIB)_profile.a: $(filter-out */Main.op, $(PCOBJS)) +lib$(LIB)_debug.a: $(filter-out */Main.od, $(DCOBJS)) +lib$(LIB)_release.a: $(filter-out */Main.or, $(RCOBJS)) + + +## Build rule +%.o %.op %.od %.or: %.cc + @echo Compiling: $(subst $(MROOT)/,,$@) + @$(CXX) $(CFLAGS) -c -o $@ $< + +## Linking rules (standard/profile/debug/release) +$(EXEC) $(EXEC)_profile $(EXEC)_debug $(EXEC)_release $(EXEC)_static: + @echo Linking: "$@ ( $(foreach f,$^,$(subst $(MROOT)/,,$f)) )" + @$(CXX) $^ $(LFLAGS) -o $@ + +## Library rules (standard/profile/debug/release) +lib$(LIB)_standard.a lib$(LIB)_profile.a lib$(LIB)_release.a lib$(LIB)_debug.a: + @echo Making library: "$@ ( $(foreach f,$^,$(subst $(MROOT)/,,$f)) )" + @$(AR) -rcsv $@ $^ + +## Library Soft Link rule: +libs libp libd libr: + @echo "Making Soft Link: $^ -> lib$(LIB).a" + @ln -sf $^ lib$(LIB).a + +## Clean rule +clean: + @rm -f $(EXEC) $(EXEC)_profile $(EXEC)_debug $(EXEC)_release $(EXEC)_static \ + $(COBJS) $(PCOBJS) $(DCOBJS) $(RCOBJS) *.core depend.mk + +## Make dependencies +depend.mk: $(CSRCS) $(CHDRS) + @echo Making dependencies + @$(CXX) $(CFLAGS) -I$(MROOT) \ + $(CSRCS) -MM | sed 's|\(.*\):|$(PWD)/\1 $(PWD)/\1r $(PWD)/\1d $(PWD)/\1p:|' > depend.mk + @for dir in $(DEPDIR); do \ + if [ -r $(MROOT)/$${dir}/depend.mk ]; then \ + echo Depends on: $${dir}; \ + cat $(MROOT)/$${dir}/depend.mk >> depend.mk; \ + fi; \ + done + +-include $(MROOT)/mtl/config.mk +-include depend.mk diff --git a/packages/bee/minisat-2.0.2/simp/Main.cc b/packages/bee/minisat-2.0.2/simp/Main.cc new file mode 100755 index 000000000..e59d73be0 --- /dev/null +++ b/packages/bee/minisat-2.0.2/simp/Main.cc @@ -0,0 +1,211 @@ +/*****************************************************************************************[Main.cc] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include + +#include +#include +#include + +#include "utils/System.h" +#include "utils/ParseUtils.h" +#include "utils/Options.h" +#include "core/Dimacs.h" +#include "simp/SimpSolver.h" + +using namespace Minisat; + +//================================================================================================= + + +void printStats(Solver& solver) +{ + double cpu_time = cpuTime(); + double mem_used = memUsedPeak(); + printf("restarts : %"PRIu64"\n", solver.starts); + printf("conflicts : %-12"PRIu64" (%.0f /sec)\n", solver.conflicts , solver.conflicts /cpu_time); + printf("decisions : %-12"PRIu64" (%4.2f %% random) (%.0f /sec)\n", solver.decisions, (float)solver.rnd_decisions*100 / (float)solver.decisions, solver.decisions /cpu_time); + printf("propagations : %-12"PRIu64" (%.0f /sec)\n", solver.propagations, solver.propagations/cpu_time); + printf("conflict literals : %-12"PRIu64" (%4.2f %% deleted)\n", solver.tot_literals, (solver.max_literals - solver.tot_literals)*100 / (double)solver.max_literals); + if (mem_used != 0) printf("Memory used : %.2f MB\n", mem_used); + printf("CPU time : %g s\n", cpu_time); +} + + +static Solver* solver; +// Terminate by notifying the solver and back out gracefully. This is mainly to have a test-case +// for this feature of the Solver as it may take longer than an immediate call to '_exit()'. +static void SIGINT_interrupt(int signum) { solver->interrupt(); } + +// Note that '_exit()' rather than 'exit()' has to be used. The reason is that 'exit()' calls +// destructors and may cause deadlocks if a malloc/free function happens to be running (these +// functions are guarded by locks for multithreaded use). +static void SIGINT_exit(int signum) { + printf("\n"); printf("*** INTERRUPTED ***\n"); + if (solver->verbosity > 0){ + printStats(*solver); + printf("\n"); printf("*** INTERRUPTED ***\n"); } + _exit(1); } + + +//================================================================================================= +// Main: + +int main(int argc, char** argv) +{ + try { + setUsageHelp("USAGE: %s [options] \n\n where input may be either in plain or gzipped DIMACS.\n"); + // printf("This is MiniSat 2.0 beta\n"); + +#if defined(__linux__) + fpu_control_t oldcw, newcw; + _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); + printf("WARNING: for repeatability, setting FPU to use double precision\n"); +#endif + // Extra options: + // + IntOption verb ("MAIN", "verb", "Verbosity level (0=silent, 1=some, 2=more).", 1, IntRange(0, 2)); + BoolOption pre ("MAIN", "pre", "Completely turn on/off any preprocessing.", true); + StringOption dimacs ("MAIN", "dimacs", "If given, stop after preprocessing and write the result to this file."); + IntOption cpu_lim("MAIN", "cpu-lim","Limit on CPU time allowed in seconds.\n", INT32_MAX, IntRange(0, INT32_MAX)); + IntOption mem_lim("MAIN", "mem-lim","Limit on memory usage in megabytes.\n", INT32_MAX, IntRange(0, INT32_MAX)); + + parseOptions(argc, argv, true); + + SimpSolver S; + double initial_time = cpuTime(); + + if (!pre) S.eliminate(true); + + S.verbosity = verb; + + solver = &S; + // Use signal handlers that forcibly quit until the solver will be able to respond to + // interrupts: + signal(SIGINT, SIGINT_exit); + signal(SIGXCPU,SIGINT_exit); + + // Set limit on CPU-time: + if (cpu_lim != INT32_MAX){ + rlimit rl; + getrlimit(RLIMIT_CPU, &rl); + if (rl.rlim_max == RLIM_INFINITY || (rlim_t)cpu_lim < rl.rlim_max){ + rl.rlim_cur = cpu_lim; + if (setrlimit(RLIMIT_CPU, &rl) == -1) + printf("WARNING! Could not set resource limit: CPU-time.\n"); + } } + + // Set limit on virtual memory: + if (mem_lim != INT32_MAX){ + rlim_t new_mem_lim = (rlim_t)mem_lim * 1024*1024; + rlimit rl; + getrlimit(RLIMIT_AS, &rl); + if (rl.rlim_max == RLIM_INFINITY || new_mem_lim < rl.rlim_max){ + rl.rlim_cur = new_mem_lim; + if (setrlimit(RLIMIT_AS, &rl) == -1) + printf("WARNING! Could not set resource limit: Virtual memory.\n"); + } } + + if (argc == 1) + printf("Reading from standard input... Use '--help' for help.\n"); + + gzFile in = (argc == 1) ? gzdopen(0, "rb") : gzopen(argv[1], "rb"); + if (in == NULL) + printf("ERROR! Could not open file: %s\n", argc == 1 ? "" : argv[1]), exit(1); + + if (S.verbosity > 0){ + printf("============================[ Problem Statistics ]=============================\n"); + printf("| |\n"); } + + parse_DIMACS(in, S); + gzclose(in); + FILE* res = (argc >= 3) ? fopen(argv[2], "wb") : NULL; + + if (S.verbosity > 0){ + printf("| Number of variables: %12d |\n", S.nVars()); + printf("| Number of clauses: %12d |\n", S.nClauses()); } + + double parsed_time = cpuTime(); + if (S.verbosity > 0) + printf("| Parse time: %12.2f s |\n", parsed_time - initial_time); + + // Change to signal-handlers that will only notify the solver and allow it to terminate + // voluntarily: + signal(SIGINT, SIGINT_interrupt); + signal(SIGXCPU,SIGINT_interrupt); + + S.eliminate(true); + double simplified_time = cpuTime(); + if (S.verbosity > 0){ + printf("| Simplification time: %12.2f s |\n", simplified_time - parsed_time); + printf("| |\n"); } + + if (!S.okay()){ + if (res != NULL) fprintf(res, "UNSAT\n"), fclose(res); + if (S.verbosity > 0){ + printf("===============================================================================\n"); + printf("Solved by simplification\n"); + printStats(S); + printf("\n"); } + printf("UNSATISFIABLE\n"); + exit(20); + } + + if (dimacs){ + if (S.verbosity > 0) + printf("==============================[ Writing DIMACS ]===============================\n"); + S.toDimacs((const char*)dimacs); + if (S.verbosity > 0) + printStats(S); + exit(0); + } + + vec dummy; + lbool ret = S.solveLimited(dummy); + + if (S.verbosity > 0){ + printStats(S); + printf("\n"); } + printf(ret == l_True ? "SATISFIABLE\n" : ret == l_False ? "UNSATISFIABLE\n" : "INDETERMINATE\n"); + if (res != NULL){ + if (ret == l_True){ + fprintf(res, "SAT\n"); + for (int i = 0; i < S.nVars(); i++) + if (S.model[i] != l_Undef) + fprintf(res, "%s%s%d", (i==0)?"":" ", (S.model[i]==l_True)?"":"-", i+1); + fprintf(res, " 0\n"); + }else if (ret == l_False) + fprintf(res, "UNSAT\n"); + else + fprintf(res, "INDET\n"); + fclose(res); + } + +#ifdef NDEBUG + exit(ret == l_True ? 10 : ret == l_False ? 20 : 0); // (faster than "return", which will invoke the destructor for 'Solver') +#else + return (ret == l_True ? 10 : ret == l_False ? 20 : 0); +#endif + } catch (OutOfMemoryException&){ + printf("===============================================================================\n"); + printf("INDETERMINATE\n"); + exit(0); + } +} diff --git a/packages/bee/minisat-2.0.2/simp/SimpSolver.cc b/packages/bee/minisat-2.0.2/simp/SimpSolver.cc new file mode 100755 index 000000000..a1dc16d3a --- /dev/null +++ b/packages/bee/minisat-2.0.2/simp/SimpSolver.cc @@ -0,0 +1,717 @@ +/***********************************************************************************[SimpSolver.cc] +Copyright (c) 2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include "mtl/Sort.h" +#include "simp/SimpSolver.h" +#include "utils/System.h" + +using namespace Minisat; + +//================================================================================================= +// Options: + + +static const char* _cat = "SIMP"; + +static BoolOption opt_use_asymm (_cat, "asymm", "Shrink clauses by asymmetric branching.", false); +static BoolOption opt_use_rcheck (_cat, "rcheck", "Check if a clause is already implied. (costly)", false); +static BoolOption opt_use_elim (_cat, "elim", "Perform variable elimination.", true); +static IntOption opt_grow (_cat, "grow", "Allow a variable elimination step to grow by a number of clauses.", 0); +static IntOption opt_clause_lim (_cat, "cl-lim", "Variables are not eliminated if it produces a resolvent with a length above this limit. -1 means no limit", 20, IntRange(-1, INT32_MAX)); +static IntOption opt_subsumption_lim (_cat, "sub-lim", "Do not check if subsumption against a clause larger than this. -1 means no limit.", 1000, IntRange(-1, INT32_MAX)); +static DoubleOption opt_simp_garbage_frac(_cat, "simp-gc-frac", "The fraction of wasted memory allowed before a garbage collection is triggered during simplification.", 0.5, DoubleRange(0, false, HUGE_VAL, false)); + + +//================================================================================================= +// Constructor/Destructor: + + +SimpSolver::SimpSolver() : + grow (opt_grow) + , clause_lim (opt_clause_lim) + , subsumption_lim (opt_subsumption_lim) + , simp_garbage_frac (opt_simp_garbage_frac) + , use_asymm (opt_use_asymm) + , use_rcheck (opt_use_rcheck) + , use_elim (opt_use_elim) + , merges (0) + , asymm_lits (0) + , eliminated_vars (0) + , elimorder (1) + , use_simplification (true) + , occurs (ClauseDeleted(ca)) + , elim_heap (ElimLt(n_occ)) + , bwdsub_assigns (0) + , n_touched (0) +{ + vec dummy(1,lit_Undef); + ca.extra_clause_field = true; // NOTE: must happen before allocating the dummy clause below. + bwdsub_tmpunit = ca.alloc(dummy); + remove_satisfied = false; +} + + +SimpSolver::~SimpSolver() +{ +} + + +Var SimpSolver::newVar(bool sign, bool dvar) { + Var v = Solver::newVar(sign, dvar); + + frozen .push((char)false); + eliminated.push((char)false); + + if (use_simplification){ + n_occ .push(0); + n_occ .push(0); + occurs .init(v); + touched .push(0); + elim_heap .insert(v); + } + return v; } + + + +lbool SimpSolver::solve_(bool do_simp, bool turn_off_simp) +{ + vec extra_frozen; + lbool result = l_True; + + do_simp &= use_simplification; + + if (do_simp){ + // Assumptions must be temporarily frozen to run variable elimination: + for (int i = 0; i < assumptions.size(); i++){ + Var v = var(assumptions[i]); + + // If an assumption has been eliminated, remember it. + assert(!isEliminated(v)); + + if (!frozen[v]){ + // Freeze and store. + setFrozen(v, true); + extra_frozen.push(v); + } } + + result = lbool(eliminate(turn_off_simp)); + } + + if (result == l_True) + result = Solver::solve_(); + else if (verbosity >= 1) + printf("===============================================================================\n"); + + if (result == l_True) + extendModel(); + + if (do_simp) + // Unfreeze the assumptions that were frozen: + for (int i = 0; i < extra_frozen.size(); i++) + setFrozen(extra_frozen[i], false); + + return result; +} + + + +bool SimpSolver::addClause_(vec& ps) +{ +#ifndef NDEBUG + for (int i = 0; i < ps.size(); i++) + assert(!isEliminated(var(ps[i]))); +#endif + + int nclauses = clauses.size(); + + if (use_rcheck && implied(ps)) + return true; + + if (!Solver::addClause_(ps)) + return false; + + if (use_simplification && clauses.size() == nclauses + 1){ + CRef cr = clauses.last(); + const Clause& c = ca[cr]; + + // NOTE: the clause is added to the queue immediately and then + // again during 'gatherTouchedClauses()'. If nothing happens + // in between, it will only be checked once. Otherwise, it may + // be checked twice unnecessarily. This is an unfortunate + // consequence of how backward subsumption is used to mimic + // forward subsumption. + subsumption_queue.insert(cr); + for (int i = 0; i < c.size(); i++){ + occurs[var(c[i])].push(cr); + n_occ[toInt(c[i])]++; + touched[var(c[i])] = 1; + n_touched++; + if (elim_heap.inHeap(var(c[i]))) + elim_heap.increase(var(c[i])); + } + } + + return true; +} + + +void SimpSolver::removeClause(CRef cr) +{ + const Clause& c = ca[cr]; + + if (use_simplification) + for (int i = 0; i < c.size(); i++){ + n_occ[toInt(c[i])]--; + updateElimHeap(var(c[i])); + occurs.smudge(var(c[i])); + } + + Solver::removeClause(cr); +} + + +bool SimpSolver::strengthenClause(CRef cr, Lit l) +{ + Clause& c = ca[cr]; + assert(decisionLevel() == 0); + assert(use_simplification); + + // FIX: this is too inefficient but would be nice to have (properly implemented) + // if (!find(subsumption_queue, &c)) + subsumption_queue.insert(cr); + + if (c.size() == 2){ + removeClause(cr); + c.strengthen(l); + }else{ + detachClause(cr, true); + c.strengthen(l); + attachClause(cr); + remove(occurs[var(l)], cr); + n_occ[toInt(l)]--; + updateElimHeap(var(l)); + } + + return c.size() == 1 ? enqueue(c[0]) && propagate() == CRef_Undef : true; +} + + +// Returns FALSE if clause is always satisfied ('out_clause' should not be used). +bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, vec& out_clause) +{ + merges++; + out_clause.clear(); + + bool ps_smallest = _ps.size() < _qs.size(); + const Clause& ps = ps_smallest ? _qs : _ps; + const Clause& qs = ps_smallest ? _ps : _qs; + + for (int i = 0; i < qs.size(); i++){ + if (var(qs[i]) != v){ + for (int j = 0; j < ps.size(); j++) + if (var(ps[j]) == var(qs[i])) + if (ps[j] == ~qs[i]) + return false; + else + goto next; + out_clause.push(qs[i]); + } + next:; + } + + for (int i = 0; i < ps.size(); i++) + if (var(ps[i]) != v) + out_clause.push(ps[i]); + + return true; +} + + +// Returns FALSE if clause is always satisfied. +bool SimpSolver::merge(const Clause& _ps, const Clause& _qs, Var v, int& size) +{ + merges++; + + bool ps_smallest = _ps.size() < _qs.size(); + const Clause& ps = ps_smallest ? _qs : _ps; + const Clause& qs = ps_smallest ? _ps : _qs; + const Lit* __ps = (const Lit*)ps; + const Lit* __qs = (const Lit*)qs; + + size = ps.size()-1; + + for (int i = 0; i < qs.size(); i++){ + if (var(__qs[i]) != v){ + for (int j = 0; j < ps.size(); j++) + if (var(__ps[j]) == var(__qs[i])) + if (__ps[j] == ~__qs[i]) + return false; + else + goto next; + size++; + } + next:; + } + + return true; +} + + +void SimpSolver::gatherTouchedClauses() +{ + if (n_touched == 0) return; + + int i,j; + for (i = j = 0; i < subsumption_queue.size(); i++) + if (ca[subsumption_queue[i]].mark() == 0) + ca[subsumption_queue[i]].mark(2); + + for (i = 0; i < touched.size(); i++) + if (touched[i]){ + const vec& cs = occurs.lookup(i); + for (j = 0; j < cs.size(); j++) + if (ca[cs[j]].mark() == 0){ + subsumption_queue.insert(cs[j]); + ca[cs[j]].mark(2); + } + touched[i] = 0; + } + + for (i = 0; i < subsumption_queue.size(); i++) + if (ca[subsumption_queue[i]].mark() == 2) + ca[subsumption_queue[i]].mark(0); + + n_touched = 0; +} + + +bool SimpSolver::implied(const vec& c) +{ + assert(decisionLevel() == 0); + + trail_lim.push(trail.size()); + for (int i = 0; i < c.size(); i++) + if (value(c[i]) == l_True){ + cancelUntil(0); + return false; + }else if (value(c[i]) != l_False){ + assert(value(c[i]) == l_Undef); + uncheckedEnqueue(~c[i]); + } + + bool result = propagate() != CRef_Undef; + cancelUntil(0); + return result; +} + + +// Backward subsumption + backward subsumption resolution +bool SimpSolver::backwardSubsumptionCheck(bool verbose) +{ + int cnt = 0; + int subsumed = 0; + int deleted_literals = 0; + assert(decisionLevel() == 0); + + while (subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()){ + + // Empty subsumption queue and return immediately on user-interrupt: + if (asynch_interrupt){ + subsumption_queue.clear(); + bwdsub_assigns = trail.size(); + break; } + + // Check top-level assignments by creating a dummy clause and placing it in the queue: + if (subsumption_queue.size() == 0 && bwdsub_assigns < trail.size()){ + Lit l = trail[bwdsub_assigns++]; + ca[bwdsub_tmpunit][0] = l; + ca[bwdsub_tmpunit].calcAbstraction(); + subsumption_queue.insert(bwdsub_tmpunit); } + + CRef cr = subsumption_queue.peek(); subsumption_queue.pop(); + Clause& c = ca[cr]; + + if (c.mark()) continue; + + if (verbose && verbosity >= 2 && cnt++ % 1000 == 0) + printf("subsumption left: %10d (%10d subsumed, %10d deleted literals)\r", subsumption_queue.size(), subsumed, deleted_literals); + + assert(c.size() > 1 || value(c[0]) == l_True); // Unit-clauses should have been propagated before this point. + + // Find best variable to scan: + Var best = var(c[0]); + for (int i = 1; i < c.size(); i++) + if (occurs[var(c[i])].size() < occurs[best].size()) + best = var(c[i]); + + // Search all candidates: + vec& _cs = occurs.lookup(best); + CRef* cs = (CRef*)_cs; + + for (int j = 0; j < _cs.size(); j++) + if (c.mark()) + break; + else if (!ca[cs[j]].mark() && cs[j] != cr && (subsumption_lim == -1 || ca[cs[j]].size() < subsumption_lim)){ + Lit l = c.subsumes(ca[cs[j]]); + + if (l == lit_Undef) + subsumed++, removeClause(cs[j]); + else if (l != lit_Error){ + deleted_literals++; + + if (!strengthenClause(cs[j], ~l)) + return false; + + // Did current candidate get deleted from cs? Then check candidate at index j again: + if (var(l) == best) + j--; + } + } + } + + return true; +} + + +bool SimpSolver::asymm(Var v, CRef cr) +{ + Clause& c = ca[cr]; + assert(decisionLevel() == 0); + + if (c.mark() || satisfied(c)) return true; + + trail_lim.push(trail.size()); + Lit l = lit_Undef; + for (int i = 0; i < c.size(); i++) + if (var(c[i]) != v && value(c[i]) != l_False) + uncheckedEnqueue(~c[i]); + else + l = c[i]; + + if (propagate() != CRef_Undef){ + cancelUntil(0); + asymm_lits++; + if (!strengthenClause(cr, l)) + return false; + }else + cancelUntil(0); + + return true; +} + + +bool SimpSolver::asymmVar(Var v) +{ + assert(use_simplification); + + const vec& cls = occurs.lookup(v); + + if (value(v) != l_Undef || cls.size() == 0) + return true; + + for (int i = 0; i < cls.size(); i++) + if (!asymm(v, cls[i])) + return false; + + return backwardSubsumptionCheck(); +} + + +static void mkElimClause(vec& elimclauses, Lit x) +{ + elimclauses.push(toInt(x)); + elimclauses.push(1); +} + + +static void mkElimClause(vec& elimclauses, Var v, Clause& c) +{ + int first = elimclauses.size(); + int v_pos = -1; + + // Copy clause to elimclauses-vector. Remember position where the + // variable 'v' occurs: + for (int i = 0; i < c.size(); i++){ + elimclauses.push(toInt(c[i])); + if (var(c[i]) == v) + v_pos = i + first; + } + assert(v_pos != -1); + + // Swap the first literal with the 'v' literal, so that the literal + // containing 'v' will occur first in the clause: + uint32_t tmp = elimclauses[v_pos]; + elimclauses[v_pos] = elimclauses[first]; + elimclauses[first] = tmp; + + // Store the length of the clause last: + elimclauses.push(c.size()); +} + + + +bool SimpSolver::eliminateVar(Var v) +{ + assert(!frozen[v]); + assert(!isEliminated(v)); + assert(value(v) == l_Undef); + + // Split the occurrences into positive and negative: + // + const vec& cls = occurs.lookup(v); + vec pos, neg; + for (int i = 0; i < cls.size(); i++) + (find(ca[cls[i]], mkLit(v)) ? pos : neg).push(cls[i]); + + // Check wether the increase in number of clauses stays within the allowed ('grow'). Moreover, no + // clause must exceed the limit on the maximal clause size (if it is set): + // + int cnt = 0; + int clause_size = 0; + + for (int i = 0; i < pos.size(); i++) + for (int j = 0; j < neg.size(); j++) + if (merge(ca[pos[i]], ca[neg[j]], v, clause_size) && + (++cnt > cls.size() + grow || (clause_lim != -1 && clause_size > clause_lim))) + return true; + + // Delete and store old clauses: + eliminated[v] = true; + setDecisionVar(v, false); + eliminated_vars++; + + if (pos.size() > neg.size()){ + for (int i = 0; i < neg.size(); i++) + mkElimClause(elimclauses, v, ca[neg[i]]); + mkElimClause(elimclauses, mkLit(v)); + }else{ + for (int i = 0; i < pos.size(); i++) + mkElimClause(elimclauses, v, ca[pos[i]]); + mkElimClause(elimclauses, ~mkLit(v)); + } + + for (int i = 0; i < cls.size(); i++) + removeClause(cls[i]); + + // Produce clauses in cross product: + vec& resolvent = add_tmp; + for (int i = 0; i < pos.size(); i++) + for (int j = 0; j < neg.size(); j++) + if (merge(ca[pos[i]], ca[neg[j]], v, resolvent) && !addClause_(resolvent)) + return false; + + // Free occurs list for this variable: + occurs[v].clear(true); + + // Free watchers lists for this variable, if possible: + if (watches[ mkLit(v)].size() == 0) watches[ mkLit(v)].clear(true); + if (watches[~mkLit(v)].size() == 0) watches[~mkLit(v)].clear(true); + + return backwardSubsumptionCheck(); +} + + +bool SimpSolver::substitute(Var v, Lit x) +{ + assert(!frozen[v]); + assert(!isEliminated(v)); + assert(value(v) == l_Undef); + + if (!ok) return false; + + eliminated[v] = true; + setDecisionVar(v, false); + const vec& cls = occurs.lookup(v); + + vec& subst_clause = add_tmp; + for (int i = 0; i < cls.size(); i++){ + Clause& c = ca[cls[i]]; + + subst_clause.clear(); + for (int j = 0; j < c.size(); j++){ + Lit p = c[j]; + subst_clause.push(var(p) == v ? x ^ sign(p) : p); + } + + removeClause(cls[i]); + + if (!addClause_(subst_clause)) + return ok = false; + } + + return true; +} + + +void SimpSolver::extendModel() +{ + int i, j; + Lit x; + + for (i = elimclauses.size()-1; i > 0; i -= j){ + for (j = elimclauses[i--]; j > 1; j--, i--) + if (modelValue(toLit(elimclauses[i])) != l_False) + goto next; + + x = toLit(elimclauses[i]); + model[var(x)] = lbool(!sign(x)); + next:; + } +} + + +bool SimpSolver::eliminate(bool turn_off_elim) +{ + if (!simplify()) + return false; + else if (!use_simplification) + return true; + + // Main simplification loop: + // + while (n_touched > 0 || bwdsub_assigns < trail.size() || elim_heap.size() > 0){ + + gatherTouchedClauses(); + // printf(" ## (time = %6.2f s) BWD-SUB: queue = %d, trail = %d\n", cpuTime(), subsumption_queue.size(), trail.size() - bwdsub_assigns); + if ((subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()) && + !backwardSubsumptionCheck(true)){ + ok = false; goto cleanup; } + + // Empty elim_heap and return immediately on user-interrupt: + if (asynch_interrupt){ + assert(bwdsub_assigns == trail.size()); + assert(subsumption_queue.size() == 0); + assert(n_touched == 0); + elim_heap.clear(); + goto cleanup; } + + // printf(" ## (time = %6.2f s) ELIM: vars = %d\n", cpuTime(), elim_heap.size()); + for (int cnt = 0; !elim_heap.empty(); cnt++){ + Var elim = elim_heap.removeMin(); + + if (asynch_interrupt) break; + + if (isEliminated(elim) || value(elim) != l_Undef) continue; + + if (verbosity >= 2 && cnt % 100 == 0) + printf("elimination left: %10d\r", elim_heap.size()); + + if (use_asymm){ + // Temporarily freeze variable. Otherwise, it would immediately end up on the queue again: + bool was_frozen = frozen[elim]; + frozen[elim] = true; + if (!asymmVar(elim)){ + ok = false; goto cleanup; } + frozen[elim] = was_frozen; } + + // At this point, the variable may have been set by assymetric branching, so check it + // again. Also, don't eliminate frozen variables: + if (use_elim && value(elim) == l_Undef && !frozen[elim] && !eliminateVar(elim)){ + ok = false; goto cleanup; } + + checkGarbage(simp_garbage_frac); + } + + assert(subsumption_queue.size() == 0); + } + cleanup: + + // If no more simplification is needed, free all simplification-related data structures: + if (turn_off_elim){ + touched .clear(true); + occurs .clear(true); + n_occ .clear(true); + elim_heap.clear(true); + subsumption_queue.clear(true); + + use_simplification = false; + remove_satisfied = true; + ca.extra_clause_field = false; + + // Force full cleanup (this is safe and desirable since it only happens once): + rebuildOrderHeap(); + garbageCollect(); + }else{ + // Cheaper cleanup: + cleanUpClauses(); // TODO: can we make 'cleanUpClauses()' not be linear in the problem size somehow? + checkGarbage(); + } + + if (verbosity >= 1 && elimclauses.size() > 0) + printf("| Eliminated clauses: %10.2f Mb |\n", + double(elimclauses.size() * sizeof(uint32_t)) / (1024*1024)); + + return ok; +} + + +void SimpSolver::cleanUpClauses() +{ + occurs.cleanAll(); + int i,j; + for (i = j = 0; i < clauses.size(); i++) + if (ca[clauses[i]].mark() == 0) + clauses[j++] = clauses[i]; + clauses.shrink(i - j); +} + + +//================================================================================================= +// Garbage Collection methods: + + +void SimpSolver::relocAll(ClauseAllocator& to) +{ + if (!use_simplification) return; + + // All occurs lists: + // + for (int i = 0; i < nVars(); i++){ + vec& cs = occurs[i]; + for (int j = 0; j < cs.size(); j++) + ca.reloc(cs[j], to); + } + + // Subsumption queue: + // + for (int i = 0; i < subsumption_queue.size(); i++) + ca.reloc(subsumption_queue[i], to); + + // Temporary clause: + // + ca.reloc(bwdsub_tmpunit, to); +} + + +void SimpSolver::garbageCollect() +{ + // Initialize the next region to a size corresponding to the estimated utilization degree. This + // is not precise but should avoid some unnecessary reallocations for the new region: + ClauseAllocator to(ca.size() - ca.wasted()); + + cleanUpClauses(); + to.extra_clause_field = ca.extra_clause_field; // NOTE: this is important to keep (or lose) the extra fields. + relocAll(to); + Solver::relocAll(to); + if (verbosity >= 2) + printf("| Garbage collection: %12d bytes => %12d bytes |\n", + ca.size()*ClauseAllocator::Unit_Size, to.size()*ClauseAllocator::Unit_Size); + to.moveTo(ca); +} diff --git a/packages/bee/minisat-2.0.2/simp/SimpSolver.h b/packages/bee/minisat-2.0.2/simp/SimpSolver.h new file mode 100755 index 000000000..49090181d --- /dev/null +++ b/packages/bee/minisat-2.0.2/simp/SimpSolver.h @@ -0,0 +1,197 @@ +/************************************************************************************[SimpSolver.h] +Copyright (c) 2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_SimpSolver_h +#define Minisat_SimpSolver_h + +#include "mtl/Queue.h" +#include "core/Solver.h" + + +namespace Minisat { + +//================================================================================================= + + +class SimpSolver : public Solver { + public: + // Constructor/Destructor: + // + SimpSolver(); + ~SimpSolver(); + + // Problem specification: + // + Var newVar (bool polarity = true, bool dvar = true); + bool addClause (const vec& ps); + bool addEmptyClause(); // Add the empty clause to the solver. + bool addClause (Lit p); // Add a unit clause to the solver. + bool addClause (Lit p, Lit q); // Add a binary clause to the solver. + bool addClause (Lit p, Lit q, Lit r); // Add a ternary clause to the solver. + bool addClause_( vec& ps); + bool substitute(Var v, Lit x); // Replace all occurences of v with x (may cause a contradiction). + + // Variable mode: + // + void setFrozen (Var v, bool b); // If a variable is frozen it will not be eliminated. + bool isEliminated(Var v) const; + + // Solving: + // + bool solve (const vec& assumps, bool do_simp = true, bool turn_off_simp = false); + lbool solveLimited(const vec& assumps, bool do_simp = true, bool turn_off_simp = false); + bool solve ( bool do_simp = true, bool turn_off_simp = false); + bool solve (Lit p , bool do_simp = true, bool turn_off_simp = false); + bool solve (Lit p, Lit q, bool do_simp = true, bool turn_off_simp = false); + bool solve (Lit p, Lit q, Lit r, bool do_simp = true, bool turn_off_simp = false); + bool eliminate (bool turn_off_elim = false); // Perform variable elimination based simplification. + + // Memory managment: + // + virtual void garbageCollect(); + + + // Generate a (possibly simplified) DIMACS file: + // +#if 0 + void toDimacs (const char* file, const vec& assumps); + void toDimacs (const char* file); + void toDimacs (const char* file, Lit p); + void toDimacs (const char* file, Lit p, Lit q); + void toDimacs (const char* file, Lit p, Lit q, Lit r); +#endif + + // Mode of operation: + // + int grow; // Allow a variable elimination step to grow by a number of clauses (default to zero). + int clause_lim; // Variables are not eliminated if it produces a resolvent with a length above this limit. + // -1 means no limit. + int subsumption_lim; // Do not check if subsumption against a clause larger than this. -1 means no limit. + double simp_garbage_frac; // A different limit for when to issue a GC during simplification (Also see 'garbage_frac'). + + bool use_asymm; // Shrink clauses by asymmetric branching. + bool use_rcheck; // Check if a clause is already implied. Prett costly, and subsumes subsumptions :) + bool use_elim; // Perform variable elimination. + + // Statistics: + // + int merges; + int asymm_lits; + int eliminated_vars; + + protected: + + // Helper structures: + // + struct ElimLt { + const vec& n_occ; + explicit ElimLt(const vec& no) : n_occ(no) {} + + // TODO: are 64-bit operations here noticably bad on 32-bit platforms? Could use a saturating + // 32-bit implementation instead then, but this will have to do for now. + uint64_t cost (Var x) const { return (uint64_t)n_occ[toInt(mkLit(x))] * (uint64_t)n_occ[toInt(~mkLit(x))]; } + bool operator()(Var x, Var y) const { return cost(x) < cost(y); } + + // TODO: investigate this order alternative more. + // bool operator()(Var x, Var y) const { + // int c_x = cost(x); + // int c_y = cost(y); + // return c_x < c_y || c_x == c_y && x < y; } + }; + + struct ClauseDeleted { + const ClauseAllocator& ca; + explicit ClauseDeleted(const ClauseAllocator& _ca) : ca(_ca) {} + bool operator()(const CRef& cr) const { return ca[cr].mark() == 1; } }; + + // Solver state: + // + int elimorder; + bool use_simplification; + vec elimclauses; + vec touched; + OccLists, ClauseDeleted> + occurs; + vec n_occ; + Heap elim_heap; + Queue subsumption_queue; + vec frozen; + vec eliminated; + int bwdsub_assigns; + int n_touched; + + // Temporaries: + // + CRef bwdsub_tmpunit; + + // Main internal methods: + // + lbool solve_ (bool do_simp = true, bool turn_off_simp = false); + bool asymm (Var v, CRef cr); + bool asymmVar (Var v); + void updateElimHeap (Var v); + void gatherTouchedClauses (); + bool merge (const Clause& _ps, const Clause& _qs, Var v, vec& out_clause); + bool merge (const Clause& _ps, const Clause& _qs, Var v, int& size); + bool backwardSubsumptionCheck (bool verbose = false); + bool eliminateVar (Var v); + void extendModel (); + + void removeClause (CRef cr); + bool strengthenClause (CRef cr, Lit l); + void cleanUpClauses (); + bool implied (const vec& c); + void relocAll (ClauseAllocator& to); +}; + + +//================================================================================================= +// Implementation of inline methods: + + +inline bool SimpSolver::isEliminated (Var v) const { return eliminated[v]; } +inline void SimpSolver::updateElimHeap(Var v) { + assert(use_simplification); + // if (!frozen[v] && !isEliminated(v) && value(v) == l_Undef) + if (elim_heap.inHeap(v) || (!frozen[v] && !isEliminated(v) && value(v) == l_Undef)) + elim_heap.update(v); } + + +inline bool SimpSolver::addClause (const vec& ps) { ps.copyTo(add_tmp); return addClause_(add_tmp); } +inline bool SimpSolver::addEmptyClause() { add_tmp.clear(); return addClause_(add_tmp); } +inline bool SimpSolver::addClause (Lit p) { add_tmp.clear(); add_tmp.push(p); return addClause_(add_tmp); } +inline bool SimpSolver::addClause (Lit p, Lit q) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); } +inline bool SimpSolver::addClause (Lit p, Lit q, Lit r) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); } +inline void SimpSolver::setFrozen (Var v, bool b) { frozen[v] = (char)b; if (use_simplification && !b) { updateElimHeap(v); } } + +inline bool SimpSolver::solve ( bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (Lit p , bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (Lit p, Lit q, bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (Lit p, Lit q, Lit r, bool do_simp, bool turn_off_simp) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_(do_simp, turn_off_simp) == l_True; } +inline bool SimpSolver::solve (const vec& assumps, bool do_simp, bool turn_off_simp){ + budgetOff(); assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp) == l_True; } + +inline lbool SimpSolver::solveLimited (const vec& assumps, bool do_simp, bool turn_off_simp){ + assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp); } + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/utils/Options.cc b/packages/bee/minisat-2.0.2/utils/Options.cc new file mode 100755 index 000000000..ec5a6e930 --- /dev/null +++ b/packages/bee/minisat-2.0.2/utils/Options.cc @@ -0,0 +1,91 @@ +/**************************************************************************************[Options.cc] +Copyright (c) 2008-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include "mtl/Sort.h" +#include "utils/Options.h" +#include "utils/ParseUtils.h" + +using namespace Minisat; + +void Minisat::parseOptions(int& argc, char** argv, bool strict) +{ + int i, j; + for (i = j = 1; i < argc; i++){ + const char* str = argv[i]; + if (match(str, "--") && match(str, Option::getHelpPrefixString()) && match(str, "help")){ + if (*str == '\0') + printUsageAndExit(argc, argv); + else if (match(str, "-verb")) + printUsageAndExit(argc, argv, true); + } else { + bool parsed_ok = false; + + for (int k = 0; !parsed_ok && k < Option::getOptionList().size(); k++){ + parsed_ok = Option::getOptionList()[k]->parse(argv[i]); + + // fprintf(stderr, "checking %d: %s against flag <%s> (%s)\n", i, argv[i], Option::getOptionList()[k]->name, parsed_ok ? "ok" : "skip"); + } + + if (!parsed_ok) + if (strict && match(argv[i], "-")) + fprintf(stderr, "ERROR! Unknown flag \"%s\". Use '--%shelp' for help.\n", argv[i], Option::getHelpPrefixString()), exit(1); + else + argv[j++] = argv[i]; + } + } + + argc -= (i - j); +} + + +void Minisat::setUsageHelp (const char* str){ Option::getUsageString() = str; } +void Minisat::setHelpPrefixStr (const char* str){ Option::getHelpPrefixString() = str; } +void Minisat::printUsageAndExit (int argc, char** argv, bool verbose) +{ + const char* usage = Option::getUsageString(); + if (usage != NULL) + fprintf(stderr, usage, argv[0]); + + sort(Option::getOptionList(), Option::OptionLt()); + + const char* prev_cat = NULL; + const char* prev_type = NULL; + + for (int i = 0; i < Option::getOptionList().size(); i++){ + const char* cat = Option::getOptionList()[i]->category; + const char* type = Option::getOptionList()[i]->type_name; + + if (cat != prev_cat) + fprintf(stderr, "\n%s OPTIONS:\n\n", cat); + else if (type != prev_type) + fprintf(stderr, "\n"); + + Option::getOptionList()[i]->help(verbose); + + prev_cat = Option::getOptionList()[i]->category; + prev_type = Option::getOptionList()[i]->type_name; + } + + fprintf(stderr, "\nHELP OPTIONS:\n\n"); + fprintf(stderr, " --%shelp Print help message.\n", Option::getHelpPrefixString()); + fprintf(stderr, " --%shelp-verb Print verbose help message.\n", Option::getHelpPrefixString()); + fprintf(stderr, "\n"); + exit(0); +} + diff --git a/packages/bee/minisat-2.0.2/utils/Options.h b/packages/bee/minisat-2.0.2/utils/Options.h new file mode 100755 index 000000000..ad2dc52a5 --- /dev/null +++ b/packages/bee/minisat-2.0.2/utils/Options.h @@ -0,0 +1,386 @@ +/***************************************************************************************[Options.h] +Copyright (c) 2008-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_Options_h +#define Minisat_Options_h + +#include +#include +#include +#include + +#include "mtl/IntTypes.h" +#include "mtl/Vec.h" +#include "utils/ParseUtils.h" + +namespace Minisat { + +//================================================================================================== +// Top-level option parse/help functions: + + +extern void parseOptions (int& argc, char** argv, bool strict = false); +extern void printUsageAndExit(int argc, char** argv, bool verbose = false); +extern void setUsageHelp (const char* str); +extern void setHelpPrefixStr (const char* str); + + +//================================================================================================== +// Options is an abstract class that gives the interface for all types options: + + +class Option +{ + protected: + const char* name; + const char* description; + const char* category; + const char* type_name; + + static vec& getOptionList () { static vec options; return options; } + static const char*& getUsageString() { static const char* usage_str; return usage_str; } + static const char*& getHelpPrefixString() { static const char* help_prefix_str = ""; return help_prefix_str; } + + struct OptionLt { + bool operator()(const Option* x, const Option* y) { + int test1 = strcmp(x->category, y->category); + return test1 < 0 || (test1 == 0 && strcmp(x->type_name, y->type_name) < 0); + } + }; + + Option(const char* name_, + const char* desc_, + const char* cate_, + const char* type_) : + name (name_) + , description(desc_) + , category (cate_) + , type_name (type_) + { + getOptionList().push(this); + } + + public: + virtual ~Option() {} + + virtual bool parse (const char* str) = 0; + virtual void help (bool verbose = false) = 0; + + friend void parseOptions (int& argc, char** argv, bool strict); + friend void printUsageAndExit (int argc, char** argv, bool verbose); + friend void setUsageHelp (const char* str); + friend void setHelpPrefixStr (const char* str); +}; + + +//================================================================================================== +// Range classes with specialization for floating types: + + +struct IntRange { + int begin; + int end; + IntRange(int b, int e) : begin(b), end(e) {} +}; + +struct Int64Range { + int64_t begin; + int64_t end; + Int64Range(int64_t b, int64_t e) : begin(b), end(e) {} +}; + +struct DoubleRange { + double begin; + double end; + bool begin_inclusive; + bool end_inclusive; + DoubleRange(double b, bool binc, double e, bool einc) : begin(b), end(e), begin_inclusive(binc), end_inclusive(einc) {} +}; + + +//================================================================================================== +// Double options: + + +class DoubleOption : public Option +{ + protected: + DoubleRange range; + double value; + + public: + DoubleOption(const char* c, const char* n, const char* d, double def = double(), DoubleRange r = DoubleRange(-HUGE_VAL, false, HUGE_VAL, false)) + : Option(n, d, c, ""), range(r), value(def) { + // FIXME: set LC_NUMERIC to "C" to make sure that strtof/strtod parses decimal point correctly. + } + + operator double (void) const { return value; } + operator double& (void) { return value; } + DoubleOption& operator=(double x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + char* end; + double tmp = strtod(span, &end); + + if (end == NULL) + return false; + else if (tmp >= range.end && (!range.end_inclusive || tmp != range.end)){ + fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name); + exit(1); + }else if (tmp <= range.begin && (!range.begin_inclusive || tmp != range.begin)){ + fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name); + exit(1); } + + value = tmp; + // fprintf(stderr, "READ VALUE: %g\n", value); + + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-12s = %-8s %c%4.2g .. %4.2g%c (default: %g)\n", + name, type_name, + range.begin_inclusive ? '[' : '(', + range.begin, + range.end, + range.end_inclusive ? ']' : ')', + value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + + +//================================================================================================== +// Int options: + + +class IntOption : public Option +{ + protected: + IntRange range; + int32_t value; + + public: + IntOption(const char* c, const char* n, const char* d, int32_t def = int32_t(), IntRange r = IntRange(INT32_MIN, INT32_MAX)) + : Option(n, d, c, ""), range(r), value(def) {} + + operator int32_t (void) const { return value; } + operator int32_t& (void) { return value; } + IntOption& operator= (int32_t x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + char* end; + int32_t tmp = strtol(span, &end, 10); + + if (end == NULL) + return false; + else if (tmp > range.end){ + fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name); + exit(1); + }else if (tmp < range.begin){ + fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name); + exit(1); } + + value = tmp; + + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-12s = %-8s [", name, type_name); + if (range.begin == INT32_MIN) + fprintf(stderr, "imin"); + else + fprintf(stderr, "%4d", range.begin); + + fprintf(stderr, " .. "); + if (range.end == INT32_MAX) + fprintf(stderr, "imax"); + else + fprintf(stderr, "%4d", range.end); + + fprintf(stderr, "] (default: %d)\n", value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + + +// Leave this out for visual C++ until Microsoft implements C99 and gets support for strtoll. +#ifndef _MSC_VER + +class Int64Option : public Option +{ + protected: + Int64Range range; + int64_t value; + + public: + Int64Option(const char* c, const char* n, const char* d, int64_t def = int64_t(), Int64Range r = Int64Range(INT64_MIN, INT64_MAX)) + : Option(n, d, c, ""), range(r), value(def) {} + + operator int64_t (void) const { return value; } + operator int64_t& (void) { return value; } + Int64Option& operator= (int64_t x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + char* end; + int64_t tmp = strtoll(span, &end, 10); + + if (end == NULL) + return false; + else if (tmp > range.end){ + fprintf(stderr, "ERROR! value <%s> is too large for option \"%s\".\n", span, name); + exit(1); + }else if (tmp < range.begin){ + fprintf(stderr, "ERROR! value <%s> is too small for option \"%s\".\n", span, name); + exit(1); } + + value = tmp; + + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-12s = %-8s [", name, type_name); + if (range.begin == INT64_MIN) + fprintf(stderr, "imin"); + else + fprintf(stderr, "%4" PRIi64, range.begin); + + fprintf(stderr, " .. "); + if (range.end == INT64_MAX) + fprintf(stderr, "imax"); + else + fprintf(stderr, "%4" PRIi64, range.end); + + fprintf(stderr, "] (default: %" PRIi64 ")\n", value); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; +#endif + +//================================================================================================== +// String option: + + +class StringOption : public Option +{ + const char* value; + public: + StringOption(const char* c, const char* n, const char* d, const char* def = NULL) + : Option(n, d, c, ""), value(def) {} + + operator const char* (void) const { return value; } + operator const char*& (void) { return value; } + StringOption& operator= (const char* x) { value = x; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (!match(span, "-") || !match(span, name) || !match(span, "=")) + return false; + + value = span; + return true; + } + + virtual void help (bool verbose = false){ + fprintf(stderr, " -%-10s = %8s\n", name, type_name); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + + +//================================================================================================== +// Bool option: + + +class BoolOption : public Option +{ + bool value; + + public: + BoolOption(const char* c, const char* n, const char* d, bool v) + : Option(n, d, c, ""), value(v) {} + + operator bool (void) const { return value; } + operator bool& (void) { return value; } + BoolOption& operator=(bool b) { value = b; return *this; } + + virtual bool parse(const char* str){ + const char* span = str; + + if (match(span, "-")){ + bool b = !match(span, "no-"); + + if (strcmp(span, name) == 0){ + value = b; + return true; } + } + + return false; + } + + virtual void help (bool verbose = false){ + + fprintf(stderr, " -%s, -no-%s", name, name); + + for (uint32_t i = 0; i < 32 - strlen(name)*2; i++) + fprintf(stderr, " "); + + fprintf(stderr, " "); + fprintf(stderr, "(default: %s)\n", value ? "on" : "off"); + if (verbose){ + fprintf(stderr, "\n %s\n", description); + fprintf(stderr, "\n"); + } + } +}; + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/utils/ParseUtils.h b/packages/bee/minisat-2.0.2/utils/ParseUtils.h new file mode 100755 index 000000000..acf476eb9 --- /dev/null +++ b/packages/bee/minisat-2.0.2/utils/ParseUtils.h @@ -0,0 +1,124 @@ +/************************************************************************************[ParseUtils.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_ParseUtils_h +#define Minisat_ParseUtils_h + +#include +#include + +//#include // comment out to make it easy to compile PL-Minisat in Windows + +namespace Minisat { + +//------------------------------------------------------------------------------------------------- +// A simple buffered character stream class: + +static const int buffer_size = 1048576; +// next code was comment out to make it easy to compile PL-Minisat in Windows +/* +class StreamBuffer { + gzFile in; + unsigned char buf[buffer_size]; + int pos; + int size; + + void assureLookahead() { + if (pos >= size) { + pos = 0; + size = gzread(in, buf, sizeof(buf)); } } + +public: + explicit StreamBuffer(gzFile i) : in(i), pos(0), size(0) { assureLookahead(); } + + int operator * () const { return (pos >= size) ? EOF : buf[pos]; } + void operator ++ () { pos++; assureLookahead(); } + int position () const { return pos; } +}; + + +//------------------------------------------------------------------------------------------------- +// End-of-file detection functions for StreamBuffer and char*: + + +static inline bool isEof(StreamBuffer& in) { return *in == EOF; } +static inline bool isEof(const char* in) { return *in == '\0'; } +*/ + + +//------------------------------------------------------------------------------------------------- +// Generic parse functions parametrized over the input-stream type. + + +template +static void skipWhitespace(B& in) { + while ((*in >= 9 && *in <= 13) || *in == 32) + ++in; } + + +template +static void skipLine(B& in) { + for (;;){ + if (isEof(in)) return; + if (*in == '\n') { ++in; return; } + ++in; } } + + +template +static int parseInt(B& in) { + int val = 0; + bool neg = false; + skipWhitespace(in); + if (*in == '-') neg = true, ++in; + else if (*in == '+') ++in; + if (*in < '0' || *in > '9') fprintf(stderr, "PARSE ERROR! Unexpected char: %c\n", *in), exit(3); + while (*in >= '0' && *in <= '9') + val = val*10 + (*in - '0'), + ++in; + return neg ? -val : val; } + + +// String matching: in case of a match the input iterator will be advanced the corresponding +// number of characters. +template +static bool match(B& in, const char* str) { + int i; + for (i = 0; str[i] != '\0'; i++) + if (in[i] != str[i]) + return false; + + in += i; + + return true; +} + +// String matching: consumes characters eagerly, but does not require random access iterator. +template +static bool eagerMatch(B& in, const char* str) { + for (; *str != '\0'; ++str, ++in) + if (*str != *in) + return false; + return true; } + + +//================================================================================================= +} + +#endif diff --git a/packages/bee/minisat-2.0.2/utils/System.cc b/packages/bee/minisat-2.0.2/utils/System.cc new file mode 100755 index 000000000..a7cf53f55 --- /dev/null +++ b/packages/bee/minisat-2.0.2/utils/System.cc @@ -0,0 +1,95 @@ +/***************************************************************************************[System.cc] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#include "utils/System.h" + +#if defined(__linux__) + +#include +#include + +using namespace Minisat; + +// TODO: split the memory reading functions into two: one for reading high-watermark of RSS, and +// one for reading the current virtual memory size. + +static inline int memReadStat(int field) +{ + char name[256]; + pid_t pid = getpid(); + int value; + + sprintf(name, "/proc/%d/statm", pid); + FILE* in = fopen(name, "rb"); + if (in == NULL) return 0; + + for (; field >= 0; field--) + if (fscanf(in, "%d", &value) != 1) + printf("ERROR! Failed to parse memory statistics from \"/proc\".\n"), exit(1); + fclose(in); + return value; +} + + +static inline int memReadPeak(void) +{ + char name[256]; + pid_t pid = getpid(); + + sprintf(name, "/proc/%d/status", pid); + FILE* in = fopen(name, "rb"); + if (in == NULL) return 0; + + // Find the correct line, beginning with "VmPeak:": + int peak_kb = 0; + while (!feof(in) && fscanf(in, "VmPeak: %d kB", &peak_kb) != 1) + while (!feof(in) && fgetc(in) != '\n') + ; + fclose(in); + + return peak_kb; +} + +double Minisat::memUsed() { return (double)memReadStat(0) * (double)getpagesize() / (1024*1024); } +double Minisat::memUsedPeak() { + double peak = memReadPeak() / 1024; + return peak == 0 ? memUsed() : peak; } + +#elif defined(__FreeBSD__) + +double Minisat::memUsed(void) { + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + return (double)ru.ru_maxrss / 1024; } +double MiniSat::memUsedPeak(void) { return memUsed(); } + + +#elif defined(__APPLE__) +#include + +double Minisat::memUsed(void) { + malloc_statistics_t t; + malloc_zone_statistics(NULL, &t); + return (double)t.max_size_in_use / (1024*1024); } + +#else +double Minisat::memUsed() { + return 0; } +#endif diff --git a/packages/bee/minisat-2.0.2/utils/System.h b/packages/bee/minisat-2.0.2/utils/System.h new file mode 100755 index 000000000..17581927a --- /dev/null +++ b/packages/bee/minisat-2.0.2/utils/System.h @@ -0,0 +1,60 @@ +/****************************************************************************************[System.h] +Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson +Copyright (c) 2007-2010, Niklas Sorensson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**************************************************************************************************/ + +#ifndef Minisat_System_h +#define Minisat_System_h + +#if defined(__linux__) +#include +#endif + +#include "mtl/IntTypes.h" + +//------------------------------------------------------------------------------------------------- + +namespace Minisat { + +static inline double cpuTime(void); // CPU-time in seconds. +extern double memUsed(); // Memory in mega bytes (returns 0 for unsupported architectures). +extern double memUsedPeak(); // Peak-memory in mega bytes (returns 0 for unsupported architectures). + +} + +//------------------------------------------------------------------------------------------------- +// Implementation of inline functions: + +#if defined(_MSC_VER) || defined(__MINGW32__) +#include + +static inline double Minisat::cpuTime(void) { return (double)clock() / CLOCKS_PER_SEC; } + +#else +#include +#include +#include + +static inline double Minisat::cpuTime(void) { + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + return (double)ru.ru_utime.tv_sec + (double)ru.ru_utime.tv_usec / 1000000; } + +#endif + +#endif diff --git a/packages/bee/satsolver.pl b/packages/bee/satsolver.pl new file mode 100644 index 000000000..20b4de4a6 --- /dev/null +++ b/packages/bee/satsolver.pl @@ -0,0 +1,366 @@ +%% The SWI-Prolog interface to SAT solver + +/* +There are four SAT solver modules available: + CryptoMinisat 2.5.1 (cryptominisat) + Minisat 2.0.2 (minisat) + Glucose 2.2 (glucose) + Glucose 4.0 (glucose4) + +Glucose 2.2 is the default SAT solver. + +To change the default SAT solver, the user should use: + :- nb_setval(satSolver_module,). +before loading 'satsolver' module. + +For example: + :- module(myApp, [...]). + :- nb_setval(satSolver_module, glucose4). + :- use_module('satsolver',[sat/1]). + +*/ + +:- module(satsolver,[ + sat/3, sat/1, + satMulti/4, + satMaxUnary/4, satMaxUnary/2, + satMinUnary/4, satMinUnary/2, + satMinBinary/4, satMinBinary/2 %%% Binary is MSB first + ]). + +satSolverLibrary(cryptominisat,'pl-crypminisat'):-!. +satSolverLibrary(minisat,'pl-minisat'):-!. +satSolverLibrary(glucose,'pl-glucose'):-!. +satSolverLibrary(glucose4,'pl-glucose4'):-!. +satSolverLibrary(Value,_):-!, throw(settings_error(satSolver_module(Value))). + +% find which SAT solver to use +:- catch( nb_getval(satSolver_module,Value), + error(existence_error(_,_),_), + Value=glucose ),!, + % translate value to library name + satSolverLibrary(Value,SATsolver), + % add predicate (used later in this code) + dynamic(useSatSolver/1),!, + assertz(useSatSolver(Value)),!, + compile_predicates([useSatSolver/1]),!, + % load SAT solver + load_foreign_library(SATsolver,install). + + +% useSatSolver('pl-crypminisat'). +% useSatSolver('pl-minisat'). +% useSatSolver('pl-glucose'). +% useSatSolver('pl-glucose4'). + +% load SAT solver +%:- useSatSolver(SATsolver), load_foreign_library(SATsolver,install). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Solve CNF %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +sat(CNF):- + sat(CNF,Solved,_),!, + Solved=1. + +sat([],1,0.0):-!. +sat([[]],0,0.0):-!. +sat(F,Solved,Time):- + statistics(cputime,StartTime), + minisat_new_solver, + minisat_add_clause([1]), % true + (addCnf2Solver(F,FVars) -> + (minisat_solve -> + minisat_assign_model([1|FVars]), + Solved = 1 + ; + Solved = 0 + ) + ; +% writeln('conflict in cnf'), + Solved=0 + ), + minisat_delete_solver, + statistics(cputime,EndTime),!, + Time is EndTime-StartTime. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Solve CNF - Multi Solutions %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +satMulti([],_,1,0.0):-!. +satMulti([[]],_,0,0.0):-!. +satMulti(F,MaxSols,SolCount,Time):- + statistics(cputime,StartTime), + minisat_new_solver, + minisat_add_clause([1]), % true + (addCnf2Solver(F,FVars) -> + satMultiModels(MaxSols,Models), + minisat_delete_solver,!, + length(Models,SolCount), + (SolCount == 0 ; assignMultiSols(Models,FVars)) + ; + minisat_delete_solver,!, +% writeln('conflict in cnf'), + SolCount=0 + ), + statistics(cputime,EndTime),!, + Time is EndTime-StartTime. + +satMultiModels(MaxSols,Models):- + MaxSols > 0,!, + (minisat_solve -> + minisat_get_model([_|Model]), + % found solution + Models=[Model|MoreModels], + MaxSols1 is MaxSols - 1, + ((MaxSols1 > 0, addClause_NotModule(Model)) -> + % need another solution + satMultiModels(MaxSols1,MoreModels) + ; + % done searching + MoreModels=[]) + ; + % no more solutions + Models=[]). +satMultiModels(_,[]):-!. + +addClause_NotModule(Model):- + negAll(Model,NoAsgn), + minisat_add_clause(NoAsgn). + +negAll([V|Vs],[NV|NVs]):-!, + NV is -(V), + negAll(Vs,NVs). +negAll([],[]). + + +assignMultiSols(Models,FVars):-!, + length(FVars,VarLen), + length(SoFar,VarLen), + assignAllCloseList(SoFar),!, + assignMultiSols(Models,SoFar,FVars). + +assignMultiSols([],SoFar,SoFar):-!. +assignMultiSols([M|Models],SoFar,Vars):-!, + addModel2Vars(M,SoFar,NVars),!, + assignMultiSols(Models,NVars,Vars). + +addModel2Vars([],[],[]). +addModel2Vars([M|Ms],[V|Vs],[[NV|V]|NVs]):- + (M>0 -> NV=1 ; NV= -1), + addModel2Vars(Ms,Vs,NVs). + +assignAllCloseList([]). +assignAllCloseList([[]|L]):-assignAllCloseList(L). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Minimize / Maximize unary number %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +satMinUnary(CNF,Unary):- + satMinUnary(CNF,Unary,Solved,_RunTime),!, + Solved=1. + +satMaxUnary(CNF,Unary):- + satMaxUnary(CNF,Unary,Solved,_RunTime),!, + Solved=1. + +satMinUnary(CNF,Unary,Solved,RunTime):- + reverseNot(Unary,RNUnary), + satMaxUnary(CNF,RNUnary,Solved,RunTime). + +satMaxUnary(CNF,Unary,Solved,Time):- + statistics(cputime,StartTime), + minisat_new_solver, + minisat_add_clause([1]), + (addCnf2Solver(CNF,Unary,FVars,MaxLits) -> + (minisat_solve -> + minisat_get_model(Model), + satMaxUnaryLoop(MaxLits,Model,FVars), + Solved = 1 + ; + Solved = 0 + ) + ; + Solved=0 + ), + minisat_delete_solver, + statistics(cputime,EndTime),!, + Time is EndTime-StartTime. + + +satMaxUnaryLoop(MaxLits,Model,FVars):-!, + ((nextMaxUnaryValue(MaxLits,NewMaxLits), minisat_solve) -> + minisat_get_model(NewModel), + satMaxUnaryLoop(NewMaxLits,NewModel,FVars) + ; + assign_model([1|FVars],Model) + ). + +nextMaxUnaryValue([X|MaxLits],NewMinLits):-!, + I is abs(X), + minisat_get_var_assignment(I,Ival), + TorF is sign(X)*sign(Ival), + (TorF == 1 -> + nextMaxUnaryValue(MaxLits,NewMinLits) + ; + add_cnf_clauses([[X]]), + NewMinLits=MaxLits + ). +nextMaxUnaryValue([],[]):-!,fail. + + +reverseNot(Xs,Ys):- + reverseNot(Xs,[],Ys). +reverseNot([X|Xs],RNXs,Ys):-!, + reverseNot(Xs,[-X|RNXs],Ys). +reverseNot([],Ys,Ys):-!. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Minimize Binary number %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +satMinBinary(CNF,Binary):- + satMinBinary(CNF,Binary,1,_). + +% Binary MSB first +satMinBinary(CNF,Binary,Solved,Time):- + statistics(cputime,StartTime), + minisat_new_solver, + minisat_add_clause([1]), + (addCnf2Solver(CNF,Binary,FVars,MinLits) -> + (minisat_solve -> + minisat_get_model(Model), + satMinBinaryLoop(MinLits,Model,FVars), + Solved = 1 + ; + Solved = 0 + ) + ; + Solved=0 + ), + minisat_delete_solver, + statistics(cputime,EndTime),!, + Time is EndTime-StartTime. + + +satMinBinaryLoop(MinLits,Model,FVars):-!, + ((nextMinBinaryValue(MinLits,NewMinLits), minisat_solve) -> + minisat_get_model(NewModel), + satMinBinaryLoop(NewMinLits,NewModel,FVars) + ; + assign_model([1|FVars],Model) + ). + +nextMinBinaryValue([X|MinLits],NewMinLits):-!, + I is abs(X), + minisat_get_var_assignment(I,Ival), + TorF is sign(X)*sign(Ival), + (TorF == 1 -> + getGroundBinary(MinLits,GroundBin), + groundVecGreatThanVec([1|GroundBin],[X|MinLits],Cnf), + add_cnf_clauses(Cnf), + NewMinLits=[X|MinLits] + ; + add_cnf_clauses([[-X]]), + nextMinBinaryValue(MinLits,NewMinLits) + ). +nextMinBinaryValue([],[]):-!,fail. + + +getGroundBinary([X|Lits],[TorF|Vals]):-!, + I is abs(X), + minisat_get_var_assignment(I,Ival), + TorF is sign(X)*sign(Ival), + getGroundBinary(Lits,Vals). +getGroundBinary([],[]):-!. + +% GroundVec > Vec +% Vec = binary number MSB first +groundVecGreatThanVec([X|GroundVec],[Y|Vec],[[-Y]|Cnf]):- + X=:= -1,!, + groundVecGreatThanVec(GroundVec,Vec,Cnf). +groundVecGreatThanVec([_X|GroundVec],[Y|Vec],Cnf):-!, + findLastOne(GroundVec,2,1,Last), + groundVecGreatThanVec(GroundVec,Vec,2,Last,[-Y],Cnf). + + +findLastOne([X|GroundVec],Indx,LastSeen,Last):- + Indx1 is Indx + 1, + (X =:= 1 -> + findLastOne(GroundVec,Indx1,Indx,Last) + ; + findLastOne(GroundVec,Indx1,LastSeen,Last) + ). +findLastOne([],_,LastSeen,LastSeen):-!. + + +groundVecGreatThanVec([Xi|GroundVec],[Yi|Vec],I,Last,Clause,Cnf):- + I1 is I + 1, + (Xi=:= -1 -> + Cnf=[[-Yi|Clause]|MCnf], + groundVecGreatThanVec(GroundVec,Vec,I1,Last,[Yi|Clause],MCnf) + ; + (I + groundVecGreatThanVec(GroundVec,Vec,I1,Last,[-Yi|Clause],Cnf) + ; + Cnf=[[-Yi|Clause]] + ) + ). +groundVecGreatThanVec([],[],_I,_Last,Clause,[Clause]):-!. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% General Aux Predicates %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +:-dynamic(keptLiterals(_)). +keptLiterals([]). + + +addCnf2Solver(Cnf,FVars):- + term_variables(Cnf,FVars),!, + \+ \+ ( bind2index(FVars,2,FN), add_cnf_clauses(Cnf), add_cnf_clauses([[FN,-FN]])). + + +addCnf2Solver(Cnf,RememberVars,FVars,DimacsVars):- + term_variables([Cnf|RememberVars],FVars),!, + \+ \+ ( bind2index(FVars,2,FN), add_cnf_clauses(Cnf), add_cnf_clauses([[FN,-FN]]), keepLiterals(RememberVars),!), + keptLiterals(DimacsVars), + keepLiterals([]),!. + +keepLiterals(KeepLiterals):- + retractall(satsolver:keptLiterals(_)), + asserta(satsolver:keptLiterals(KeepLiterals)),!. + +:- if(useSatSolver(cryptominisat)). +add_cnf_clauses([Cl|Cls]):-!, + (Cl=[x|RCl] -> + to_minisat(RCl,MiniSatCl), + minisat_add_xorclause(MiniSatCl) + ; + to_minisat(Cl,MiniSatCl), + minisat_add_clause(MiniSatCl) + ), + add_cnf_clauses(Cls). +add_cnf_clauses([]):-!. +:- else. +add_cnf_clauses([Cl|Cls]):-!, + to_minisat(Cl,MiniSatCl), + minisat_add_clause(MiniSatCl), + add_cnf_clauses(Cls). +add_cnf_clauses([]):-!. +:- endif. + +to_minisat([L|Ls],[N|Ns]) :-!, + N is L, + to_minisat(Ls,Ns). +to_minisat([],[]):-!. + +bind2index([N|Ns],N,FN) :- N1 is N+1, bind2index(Ns,N1,FN). +bind2index([],N,FN):-!, FN is N - 1. + +assign_model([],_). +assign_model([V|Vs],[N|Ns]) :- ( N<0 -> V= -1 ; V=1), assign_model(Vs,Ns). diff --git a/packages/bee/yap-interface.cc.cmake b/packages/bee/yap-interface.cc.cmake new file mode 100644 index 000000000..5a57aeba2 --- /dev/null +++ b/packages/bee/yap-interface.cc.cmake @@ -0,0 +1,259 @@ +#include +#include "Solver.h" + +namespace @Solver@ { + +#define val(i) YAP_MkIntTerm((s->model[i] != l_Undef) ? ((s->model[i]==l_True)? i+1:-1*(i+1)):0) + +Solver *s = NULL; +int seed=0; + +vec cache_slvrs; + + +extern "C" bool @solver@_default_seed() +{ + seed = YAP_IntOfTerm(YAP_ARG1); + return true; +} + + +extern "C" bool @solver@_new_solver() +{ + if (s) { + fprintf(stderr,"%% Warning: @solver@_new_solver deleted existing solver !\n"); + delete s; + s = NULL; + } + s = new Solver; + if (seed != 0) { + #if CRYPTOMINISAT + s->setSeed(seed); + #else + s->random_seed = seed; + #endif + } + return true; +} + +extern "C" bool @solver@_delete_solver() +{ + if (s) { + delete s; + s = NULL; + } else { + fprintf(stderr,"%% Warning: @solver@_delete_solver didn't had a solver to delete !\n"); + } + return true; +} + + +extern "C" bool @solver@_cache_push_solver() +{ + if (s) { + cache_slvrs.push(s); + s = NULL; + return true; + } else { + fprintf(stderr,"%% Error: @solver@_cache_push_solver failed since no active SAT solver !\n"); + return false; + } +} + + +extern "C" bool @solver@_cache_pop_solver() +{ + if (cache_slvrs.size() == 0) { +fprintf(stderr,"%% Error: @solver@_cache_pop_solver failed since no cached SAT solver !\n"); + return false; + } + + if (s) { +fprintf(stderr,"%% Warning: @solver@_cache_pop_solver deleted existing solver !\n"); + delete s; + s = NULL; + } + s = cache_slvrs.last(); + cache_slvrs.pop(); + return true; +} + + +static inline Lit pl2lit(YAP_Term t) +{ + int pl_lit_int, var; + pl_lit_int = YAP_IntOfTerm(YAP_ARG1); + var = abs(pl_lit_int)-1; + while (var >= s->nVars()) s->newVar(); + #if CRYPTOMINISAT + return Lit(var,!(pl_lit_int > 0)); + #else + return mkLit(var,!(pl_lit_int > 0)); + #endif + +} + + +extern "C" bool @solver@_add_clause() +{ + YAP_Term head; /* variable for the elements */ + YAP_Term list = YAP_ARG1; /* copy as we need to write */ + + vec lits; + + while( YAP_IsPairTerm(list)) { + head = YAP_HeadOfTerm(list); + lits.push( pl2lit(head) ); + list = YAP_TailOfTerm( list); + } + if (list != YAP_TermNil()) + return false; + + //assert(PL_get_nil(list)); + + return s->addClause(lits); +} + + +extern "C" bool @solver@_solve() { +#if CRYPTOMINISAT +lbool x=s->solve(); +return x==l_True; +#else +return s->solve(); +#endif +} + + +extern "C" bool @solver@_solve_assumptions() { +YAP_Term head; /* variable for the elements */ +YAP_Term list = YAP_ARG1; /* copy as we need to write */ + + vec lits; + + + while( YAP_IsPairTerm(list)) { + head = YAP_HeadOfTerm(list); + lits.push( pl2lit(head) ); + list = YAP_TailOfTerm( list); + } +if (list != YAP_TermNil()) + return false; + + // assert(PL_get_nil(list)); + + #if CRYPTOMINISAT + lbool rc = s->solve(); + return rc == l_True; + #else + return s->solve(); + #endif +} + + +extern "C" bool @solver@_get_var_assignment() +{ + int i; + + i = YAP_IntOfTerm(YAP_ARG1); + i--; + + if (i < s->nVars()) { + return YAP_Unify(YAP_ARG2,val(i)); + } else { + return false; + } +} + + +extern "C" bool @solver@_get_model() +{ + YAP_Term l = YAP_TermNil(); + + int i=s->nVars(); + while( --i >= 0 ) { + l = YAP_MkPairTerm( l, val(i) ); + } + + return YAP_Unify(YAP_ARG1,l); +} + + +extern "C" bool @solver@_assign_model() +{ + YAP_Term asgnList = YAP_ARG1; /* variable for the elements */ + + int indx=0; + while( YAP_IsPairTerm(asgnList) ) { + YAP_Term asgnVar = YAP_HeadOfTerm(asgnList); + if(s->model[indx]==l_True) + YAP_Unify(YAP_MkIntTerm(1),asgnVar); + else + YAP_Unify(YAP_MkIntTerm(-1),asgnVar); + indx++; + asgnList = YAP_TailOfTerm(asgnList); + } + + return true; +} + + +extern "C" bool @solver@_nvars() +{ + return YAP_Unify(YAP_ARG1,YAP_MkIntTerm(s->nVars())); +} + +} // @solver@ + + + +//============================================================================= + + + typedef struct { + const char *name; + int arity; + YAP_UserCPred f; + int opts; + } extension; + +static extension predicates[] = + { + // + // { "name", arity, function, PL_FA_ }, + // + + { "@solver@_new_solver", 0, @Solver@::@solver@_new_solver, 0 }, + { "@solver@_delete_solver", 0, @Solver@::@solver@_delete_solver, 0 }, + { "@solver@_cache_push_solver", 0, @Solver@::@solver@_cache_push_solver, 0 }, + { "@solver@_cache_pop_solver", 0, @Solver@::@solver@_cache_pop_solver, 0 }, + { "@solver@_add_clause", 1, @Solver@::@solver@_add_clause, 0 }, + { "@solver@_solve", 0, @Solver@::@solver@_solve, 0 }, + { "@solver@_solve_assumptions", 1, @Solver@::@solver@_solve_assumptions, 0 }, + { "@solver@_get_var_assignment", 2, @Solver@::@solver@_get_var_assignment, 0 }, + { "@solver@_get_model", 1, @Solver@::@solver@_get_model, 0 }, + { "@solver@_assign_model", 1, @Solver@::@solver@_assign_model, 0 }, + { "@solver@_nvars", 1, @Solver@::@solver@_nvars, 0 }, + { "@solver@_default_seed", 1, @Solver@::@solver@_default_seed, 0 }, + { nullptr, 0, nullptr, 0 } // terminating line + }; + +//----------------------------------------------------------------------------- +extern "C" bool install() +{ +extension *pt = predicates; + + fprintf(stderr,"%% Yap interface to MiniSAT v2.0.2 ... "); + + while (pt->name) { + YAP_UserCPredicate(pt->name, pt->f, pt->arity); + } + /* This is the only PL_ call allowed */ + /* before PL_initialise(). It */ + /* ensures the foreign predicates */ + /* are available before loading */ + /* Prolog code */ + + fprintf(stderr,"OK\n"); + return true; +} diff --git a/packages/gecode/6.1.1/gecode-version.txt b/packages/gecode/6.1.1/gecode-version.txt new file mode 100644 index 000000000..f3b5af39e --- /dev/null +++ b/packages/gecode/6.1.1/gecode-version.txt @@ -0,0 +1 @@ +6.1.1 diff --git a/packages/gecode/6.1.1/gecode_yap_auto_generated.yap b/packages/gecode/6.1.1/gecode_yap_auto_generated.yap new file mode 100644 index 000000000..776541ba8 --- /dev/null +++ b/packages/gecode/6.1.1/gecode_yap_auto_generated.yap @@ -0,0 +1,3685 @@ +%% -*- prolog -*- +%%============================================================================= +%% Copyright (C) 2011 by Denys Duchier +%% +%% This program is free software: you can redistribute it and/or modify it +%% under the terms of the GNU Lesser General Public License as published by the +%% Free Software Foundation, either version 3 of the License, or (at your +%% option) any later version. +%% +%% This program is distributed in the hope that it will be useful, but WITHOUT +%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +%% more details. +%% +%% You should have received a copy of the GNU Lesser General Public License +%% along with this program. If not, see . +%%============================================================================= + +is_RestartMode_('RM_NONE'). +is_RestartMode_('RM_CONSTANT'). +is_RestartMode_('RM_LINEAR'). +is_RestartMode_('RM_LUBY'). +is_RestartMode_('RM_GEOMETRIC'). + + +is_RestartMode_('RM_NONE','RM_NONE'). +is_RestartMode_('RM_CONSTANT','RM_CONSTANT'). +is_RestartMode_('RM_LINEAR','RM_LINEAR'). +is_RestartMode_('RM_LUBY','RM_LUBY'). +is_RestartMode_('RM_GEOMETRIC','RM_GEOMETRIC'). + + +is_RestartMode(X,Y) :- nonvar(X), is_RestartMode_(X,Y). +is_RestartMode(X) :- is_RestartMode_(X,_). + + +is_FloatRelType_('FRT_EQ'). +is_FloatRelType_('FRT_NQ'). +is_FloatRelType_('FRT_LQ'). +is_FloatRelType_('FRT_LE'). +is_FloatRelType_('FRT_GQ'). +is_FloatRelType_('FRT_GR'). + + +is_FloatRelType_('FRT_EQ','FRT_EQ'). +is_FloatRelType_('FRT_NQ','FRT_NQ'). +is_FloatRelType_('FRT_LQ','FRT_LQ'). +is_FloatRelType_('FRT_LE','FRT_LE'). +is_FloatRelType_('FRT_GQ','FRT_GQ'). +is_FloatRelType_('FRT_GR','FRT_GR'). + + +is_FloatRelType(X,Y) :- nonvar(X), is_FloatRelType_(X,Y). +is_FloatRelType(X) :- is_FloatRelType_(X,_). + + +is_ReifyMode_('RM_EQV'). +is_ReifyMode_('RM_IMP'). +is_ReifyMode_('RM_PMI'). + + +is_ReifyMode_('RM_EQV','RM_EQV'). +is_ReifyMode_('RM_IMP','RM_IMP'). +is_ReifyMode_('RM_PMI','RM_PMI'). + + +is_ReifyMode(X,Y) :- nonvar(X), is_ReifyMode_(X,Y). +is_ReifyMode(X) :- is_ReifyMode_(X,_). + + +is_IntRelType_('IRT_EQ'). +is_IntRelType_('IRT_NQ'). +is_IntRelType_('IRT_LQ'). +is_IntRelType_('IRT_LE'). +is_IntRelType_('IRT_GQ'). +is_IntRelType_('IRT_GR'). + + +is_IntRelType_('IRT_EQ','IRT_EQ'). +is_IntRelType_('IRT_NQ','IRT_NQ'). +is_IntRelType_('IRT_LQ','IRT_LQ'). +is_IntRelType_('IRT_LE','IRT_LE'). +is_IntRelType_('IRT_GQ','IRT_GQ'). +is_IntRelType_('IRT_GR','IRT_GR'). + + +is_IntRelType(X,Y) :- nonvar(X), is_IntRelType_(X,Y). +is_IntRelType(X) :- is_IntRelType_(X,_). + + +is_BoolOpType_('BOT_AND'). +is_BoolOpType_('BOT_OR'). +is_BoolOpType_('BOT_IMP'). +is_BoolOpType_('BOT_EQV'). +is_BoolOpType_('BOT_XOR'). + + +is_BoolOpType_('BOT_AND','BOT_AND'). +is_BoolOpType_('BOT_OR','BOT_OR'). +is_BoolOpType_('BOT_IMP','BOT_IMP'). +is_BoolOpType_('BOT_EQV','BOT_EQV'). +is_BoolOpType_('BOT_XOR','BOT_XOR'). + + +is_BoolOpType(X,Y) :- nonvar(X), is_BoolOpType_(X,Y). +is_BoolOpType(X) :- is_BoolOpType_(X,_). + + +is_IntPropLevel_('IPL_DEF'). +is_IntPropLevel_('IPL_VAL'). +is_IntPropLevel_('IPL_BND'). +is_IntPropLevel_('IPL_DOM'). +is_IntPropLevel_('IPL_BASIC'). +is_IntPropLevel_('IPL_ADVANCED'). +is_IntPropLevel_('IPL_BASIC_ADVANCED'). + + +is_IntPropLevel_('IPL_DEF','IPL_DEF'). +is_IntPropLevel_('IPL_VAL','IPL_VAL'). +is_IntPropLevel_('IPL_BND','IPL_BND'). +is_IntPropLevel_('IPL_DOM','IPL_DOM'). +is_IntPropLevel_('IPL_BASIC','IPL_BASIC'). +is_IntPropLevel_('IPL_ADVANCED','IPL_ADVANCED'). +is_IntPropLevel_('IPL_BASIC_ADVANCED','IPL_BASIC_ADVANCED'). + + +is_IntPropLevel(X,Y) :- nonvar(X), is_IntPropLevel_(X,Y). +is_IntPropLevel(X) :- is_IntPropLevel_(X,_). + + +is_TaskType_('TT_FIXP'). +is_TaskType_('TT_FIXS'). +is_TaskType_('TT_FIXE'). + + +is_TaskType_('TT_FIXP','TT_FIXP'). +is_TaskType_('TT_FIXS','TT_FIXS'). +is_TaskType_('TT_FIXE','TT_FIXE'). + + +is_TaskType(X,Y) :- nonvar(X), is_TaskType_(X,Y). +is_TaskType(X) :- is_TaskType_(X,_). + + +is_TraceEvent_('TE_INIT'). +is_TraceEvent_('TE_PRUNE'). +is_TraceEvent_('TE_FIX'). +is_TraceEvent_('TE_FAIL'). +is_TraceEvent_('TE_DONE'). +is_TraceEvent_('TE_PROPAGATE'). +is_TraceEvent_('TE_COMMIT'). + + +is_TraceEvent_('TE_INIT','TE_INIT'). +is_TraceEvent_('TE_PRUNE','TE_PRUNE'). +is_TraceEvent_('TE_FIX','TE_FIX'). +is_TraceEvent_('TE_FAIL','TE_FAIL'). +is_TraceEvent_('TE_DONE','TE_DONE'). +is_TraceEvent_('TE_PROPAGATE','TE_PROPAGATE'). +is_TraceEvent_('TE_COMMIT','TE_COMMIT'). + + +is_TraceEvent(X,Y) :- nonvar(X), is_TraceEvent_(X,Y). +is_TraceEvent(X) :- is_TraceEvent_(X,_). + + +is_SetRelType_('SRT_EQ'). +is_SetRelType_('SRT_NQ'). +is_SetRelType_('SRT_SUB'). +is_SetRelType_('SRT_SUP'). +is_SetRelType_('SRT_DISJ'). +is_SetRelType_('SRT_CMPL'). +is_SetRelType_('SRT_LQ'). +is_SetRelType_('SRT_LE'). +is_SetRelType_('SRT_GQ'). +is_SetRelType_('SRT_GR'). + + +is_SetRelType_('SRT_EQ','SRT_EQ'). +is_SetRelType_('SRT_NQ','SRT_NQ'). +is_SetRelType_('SRT_SUB','SRT_SUB'). +is_SetRelType_('SRT_SUP','SRT_SUP'). +is_SetRelType_('SRT_DISJ','SRT_DISJ'). +is_SetRelType_('SRT_CMPL','SRT_CMPL'). +is_SetRelType_('SRT_LQ','SRT_LQ'). +is_SetRelType_('SRT_LE','SRT_LE'). +is_SetRelType_('SRT_GQ','SRT_GQ'). +is_SetRelType_('SRT_GR','SRT_GR'). + + +is_SetRelType(X,Y) :- nonvar(X), is_SetRelType_(X,Y). +is_SetRelType(X) :- is_SetRelType_(X,_). + + +is_SetOpType_('SOT_UNION'). +is_SetOpType_('SOT_DUNION'). +is_SetOpType_('SOT_INTER'). +is_SetOpType_('SOT_MINUS'). + + +is_SetOpType_('SOT_UNION','SOT_UNION'). +is_SetOpType_('SOT_DUNION','SOT_DUNION'). +is_SetOpType_('SOT_INTER','SOT_INTER'). +is_SetOpType_('SOT_MINUS','SOT_MINUS'). + + +is_SetOpType(X,Y) :- nonvar(X), is_SetOpType_(X,Y). +is_SetOpType(X) :- is_SetOpType_(X,_). + + +branch(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_std_function(X1,Y1) + -> gecode_constraint_branch_1(Y0,Y1) + ; throw(error(type_error('std::function'(X1)),gecode_argument_error(branch(X0,X1),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1),arg=1)))). + +convex(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_SetVar(X1,Y1) + -> gecode_constraint_convex_2(Y0,Y1) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(convex(X0,X1),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(convex(X0,X1),arg=1)))). + +convex(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_SetVar(X1,Y1) + -> (is_SetVar(X2,Y2) + -> gecode_constraint_convex_3(Y0,Y1,Y2) + ; throw(error(type_error('SetVar'(X2)),gecode_argument_error(convex(X0,X1,X2),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(convex(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(convex(X0,X1,X2),arg=1)))). + +abs(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_abs_4(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(abs(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_abs_5(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(abs(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(abs(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(abs(X0,X1,X2),arg=1)))). + +abs(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_abs_6(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(abs(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(abs(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(abs(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(abs(X0,X1,X2,X3),arg=1)))). + +argmax(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_argmax_7(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmax(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmax(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmax(X0,X1,X2),arg=1)))). + +argmax(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_argmax_8(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_argmax_10(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=1)))). + +argmax(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_argmax_9(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> gecode_constraint_argmax_11(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=1)))). + +argmax(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_argmax_12(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=1)))). + +argmin(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_argmin_13(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmin(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmin(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmin(X0,X1,X2),arg=1)))). + +argmin(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_argmin_14(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_argmin_16(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=1)))). + +argmin(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_argmin_15(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> gecode_constraint_argmin_17(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=1)))). + +argmin(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_argmin_18(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=1)))). + +assign(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolAssign(X2,Y2) + -> gecode_constraint_assign_19(Y0,Y1,Y2) + ; throw(error(type_error('BoolAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatAssign(X2,Y2) + -> gecode_constraint_assign_21(Y0,Y1,Y2) + ; throw(error(type_error('FloatAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntAssign(X2,Y2) + -> gecode_constraint_assign_23(Y0,Y1,Y2) + ; throw(error(type_error('IntAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetAssign(X2,Y2) + -> gecode_constraint_assign_25(Y0,Y1,Y2) + ; throw(error(type_error('SetAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_BoolAssign(X2,Y2) + -> gecode_constraint_assign_27(Y0,Y1,Y2) + ; throw(error(type_error('BoolAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatAssign(X2,Y2) + -> gecode_constraint_assign_30(Y0,Y1,Y2) + ; throw(error(type_error('FloatAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntAssign(X2,Y2) + -> gecode_constraint_assign_33(Y0,Y1,Y2) + ; throw(error(type_error('IntAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetAssign(X2,Y2) + -> gecode_constraint_assign_36(Y0,Y1,Y2) + ; throw(error(type_error('SetAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(assign(X0,X1,X2),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(assign(X0,X1,X2),arg=1)))). + +assign(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolAssign(X2,Y2) + -> (is_BoolVarValPrint(X3,Y3) + -> gecode_constraint_assign_20(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolVarValPrint'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('BoolAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatAssign(X2,Y2) + -> (is_FloatVarValPrint(X3,Y3) + -> gecode_constraint_assign_22(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVarValPrint'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntAssign(X2,Y2) + -> (is_IntVarValPrint(X3,Y3) + -> gecode_constraint_assign_24(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVarValPrint'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetAssign(X2,Y2) + -> (is_SetVarValPrint(X3,Y3) + -> gecode_constraint_assign_26(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetVarValPrint'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('SetAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_BoolAssign(X2,Y2) + -> (is_BoolBranchFilter(X3,Y3) + -> gecode_constraint_assign_28(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolBranchFilter'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('BoolAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatAssign(X2,Y2) + -> (is_FloatBranchFilter(X3,Y3) + -> gecode_constraint_assign_31(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatBranchFilter'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntAssign(X2,Y2) + -> (is_IntBranchFilter(X3,Y3) + -> gecode_constraint_assign_34(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntBranchFilter'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetAssign(X2,Y2) + -> (is_SetBranchFilter(X3,Y3) + -> gecode_constraint_assign_37(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetBranchFilter'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('SetAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(assign(X0,X1,X2,X3),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(assign(X0,X1,X2,X3),arg=1)))). + +assign(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolAssign(X2,Y2) + -> (is_BoolBranchFilter(X3,Y3) + -> (is_BoolVarValPrint(X4,Y4) + -> gecode_constraint_assign_29(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('BoolVarValPrint'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('BoolBranchFilter'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('BoolAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatAssign(X2,Y2) + -> (is_FloatBranchFilter(X3,Y3) + -> (is_FloatVarValPrint(X4,Y4) + -> gecode_constraint_assign_32(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatVarValPrint'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatBranchFilter'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('FloatAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntAssign(X2,Y2) + -> (is_IntBranchFilter(X3,Y3) + -> (is_IntVarValPrint(X4,Y4) + -> gecode_constraint_assign_35(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVarValPrint'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntBranchFilter'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=3)))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetAssign(X2,Y2) + -> (is_SetBranchFilter(X3,Y3) + -> (is_SetVarValPrint(X4,Y4) + -> gecode_constraint_assign_38(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('SetVarValPrint'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('SetBranchFilter'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('SetAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=1)))). + +binpacking(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> gecode_constraint_binpacking_39(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(binpacking(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(binpacking(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(binpacking(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(binpacking(X0,X1,X2,X3),arg=1)))). + +binpacking(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_binpacking_40(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=1)))). + +branch(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolValBranch(X2,Y2) + -> gecode_constraint_branch_41(Y0,Y1,Y2) + ; throw(error(type_error('BoolValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatValBranch(X2,Y2) + -> gecode_constraint_branch_43(Y0,Y1,Y2) + ; throw(error(type_error('FloatValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntValBranch(X2,Y2) + -> gecode_constraint_branch_45(Y0,Y1,Y2) + ; throw(error(type_error('IntValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetValBranch(X2,Y2) + -> gecode_constraint_branch_47(Y0,Y1,Y2) + ; throw(error(type_error('SetValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(branch(X0,X1,X2),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2),arg=1)))). + +branch(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolValBranch(X2,Y2) + -> (is_BoolVarValPrint(X3,Y3) + -> gecode_constraint_branch_42(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolVarValPrint'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('BoolValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatValBranch(X2,Y2) + -> (is_FloatVarValPrint(X3,Y3) + -> gecode_constraint_branch_44(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVarValPrint'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntValBranch(X2,Y2) + -> (is_IntVarValPrint(X3,Y3) + -> gecode_constraint_branch_46(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVarValPrint'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetValBranch(X2,Y2) + -> (is_SetVarValPrint(X3,Y3) + -> gecode_constraint_branch_48(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetVarValPrint'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('SetValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> gecode_constraint_branch_49(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> gecode_constraint_branch_55(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3))))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> gecode_constraint_branch_61(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> gecode_constraint_branch_64(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> gecode_constraint_branch_67(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> gecode_constraint_branch_73(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> gecode_constraint_branch_79(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> gecode_constraint_branch_85(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(branch(X0,X1,X2,X3),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2,X3),arg=1)))). + +branch(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> gecode_constraint_branch_50(Y0,Y1,Y2,Y3,Y4) + ; (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_52(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> gecode_constraint_branch_56(Y0,Y1,Y2,Y3,Y4) + ; (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_58(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=3))))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> gecode_constraint_branch_62(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> gecode_constraint_branch_65(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> gecode_constraint_branch_68(Y0,Y1,Y2,Y3,Y4) + ; (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_70(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> gecode_constraint_branch_74(Y0,Y1,Y2,Y3,Y4) + ; (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_76(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_SetBranchFilter(X4,Y4) + -> gecode_constraint_branch_80(Y0,Y1,Y2,Y3,Y4) + ; (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_82(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_SetBranchFilter(X4,Y4) + -> gecode_constraint_branch_86(Y0,Y1,Y2,Y3,Y4) + ; (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_88(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=1)))). + +branch(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> (is_BoolVarValPrint(X5,Y5) + -> gecode_constraint_branch_51(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_Symmetries(X4,Y4) + -> (is_BoolBranchFilter(X5,Y5) + -> gecode_constraint_branch_53(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> (is_BoolVarValPrint(X5,Y5) + -> gecode_constraint_branch_57(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_Symmetries(X4,Y4) + -> (is_BoolBranchFilter(X5,Y5) + -> gecode_constraint_branch_59(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> (is_FloatVarValPrint(X5,Y5) + -> gecode_constraint_branch_63(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('FloatVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> (is_FloatVarValPrint(X5,Y5) + -> gecode_constraint_branch_66(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('FloatVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> (is_IntVarValPrint(X5,Y5) + -> gecode_constraint_branch_69(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_Symmetries(X4,Y4) + -> (is_IntBranchFilter(X5,Y5) + -> gecode_constraint_branch_71(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> (is_IntVarValPrint(X5,Y5) + -> gecode_constraint_branch_75(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_Symmetries(X4,Y4) + -> (is_IntBranchFilter(X5,Y5) + -> gecode_constraint_branch_77(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_SetBranchFilter(X4,Y4) + -> (is_SetVarValPrint(X5,Y5) + -> gecode_constraint_branch_81(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_Symmetries(X4,Y4) + -> (is_SetBranchFilter(X5,Y5) + -> gecode_constraint_branch_83(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_SetBranchFilter(X4,Y4) + -> (is_SetVarValPrint(X5,Y5) + -> gecode_constraint_branch_87(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_Symmetries(X4,Y4) + -> (is_SetBranchFilter(X5,Y5) + -> gecode_constraint_branch_89(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=3))))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=1)))). + +branch(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_BoolBranchFilter(X5,Y5) + -> (is_BoolVarValPrint(X6,Y6) + -> gecode_constraint_branch_54(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_BoolBranchFilter(X5,Y5) + -> (is_BoolVarValPrint(X6,Y6) + -> gecode_constraint_branch_60(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_IntBranchFilter(X5,Y5) + -> (is_IntVarValPrint(X6,Y6) + -> gecode_constraint_branch_72(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_IntBranchFilter(X5,Y5) + -> (is_IntVarValPrint(X6,Y6) + -> gecode_constraint_branch_78(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_SetBranchFilter(X5,Y5) + -> (is_SetVarValPrint(X6,Y6) + -> gecode_constraint_branch_84(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('SetVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('SetBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_SetBranchFilter(X5,Y5) + -> (is_SetVarValPrint(X6,Y6) + -> gecode_constraint_branch_90(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('SetVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('SetBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +cardinality(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_SetVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_cardinality_91(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=3)))) + ; (is_SetVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_cardinality_92(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=1)))). + +channel(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_channel_93(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> gecode_constraint_channel_95(Y0,Y1,Y2) + ; (is_IntVar(X2,Y2) + -> gecode_constraint_channel_96(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2),arg=3))))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_channel_97(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_channel_100(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(channel(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(channel(X0,X1,X2),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(channel(X0,X1,X2),arg=1)))). + +channel(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_channel_94(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(channel(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_channel_98(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(channel(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_channel_101(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(channel(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(channel(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(channel(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(channel(X0,X1,X2,X3),arg=1)))). + +channel(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_channel_99(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_channel_102(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=1)))). + +channel(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_channel_103(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=1)))). + +circuit(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_circuit_104(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=3)))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_circuit_115(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error(int(X1)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=1)))). + +circuit(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_circuit_105(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_circuit_106(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=4))))) + ; (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_circuit_108(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=1)))). + +circuit(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_circuit_107(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_circuit_109(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_IntVarArgs(X4,Y4) + -> (is_IntVar(X5,Y5) + -> gecode_constraint_circuit_110(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=1)))). + +circuit(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntVar(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_circuit_111(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +circuit(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> gecode_constraint_circuit_112(Y0,Y1) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(circuit(X0,X1),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1),arg=1)))). + +circuit(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntPropLevel(X2,Y2) + -> gecode_constraint_circuit_113(Y0,Y1,Y2) + ; throw(error(type_error('IntPropLevel'(X2)),gecode_argument_error(circuit(X0,X1,X2),arg=3)))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_circuit_114(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(circuit(X0,X1,X2),arg=3)))) + ; throw(error(type_error(int(X1)),gecode_argument_error(circuit(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2),arg=1)))). + +clause(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolOpType(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> gecode_constraint_clause_116(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_clause_118(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('BoolVarArgs'(X3)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('BoolOpType'(X1)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=1)))). + +clause(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolOpType(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_clause_117(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_clause_119(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('BoolVarArgs'(X3)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('BoolOpType'(X1)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=1)))). + +count(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_count_120(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_count_122(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_count_124(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_count_126(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntSet(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_count_128(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_count_130(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5))))) + ; (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_count_133(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4))))) + ; (is_IntSetArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_count_137(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_count_141(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_count_142(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_count_144(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=3))))))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=1)))). + +count(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_121(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_123(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_125(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_127(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntSet(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_129(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_131(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_143(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_145(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=3))))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=1)))). + +count(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> gecode_constraint_count_132(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(count(X0,X1,X2,X3),arg=4)))) + ; (is_IntSetArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_count_135(Y0,Y1,Y2,Y3) + ; (is_IntArgs(X3,Y3) + -> gecode_constraint_count_136(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(count(X0,X1,X2,X3),arg=4))))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_count_139(Y0,Y1,Y2,Y3) + ; (is_IntArgs(X3,Y3) + -> gecode_constraint_count_140(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(count(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(count(X0,X1,X2,X3),arg=3)))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(count(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(count(X0,X1,X2,X3),arg=1)))). + +count(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntSetArgs(X2,Y2) + -> gecode_constraint_count_134(Y0,Y1,Y2) + ; (is_IntVarArgs(X2,Y2) + -> gecode_constraint_count_138(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(count(X0,X1,X2),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(count(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(count(X0,X1,X2),arg=1)))). + +cumulative(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> gecode_constraint_cumulative_146(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=3)))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> gecode_constraint_cumulative_158(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error(int(X1)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=1)))). + +cumulative(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_cumulative_147(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_BoolVarArgs(X5,Y5) + -> gecode_constraint_cumulative_148(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolVarArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> gecode_constraint_cumulative_150(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=4))))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> gecode_constraint_cumulative_154(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_cumulative_159(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_BoolVarArgs(X5,Y5) + -> gecode_constraint_cumulative_160(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolVarArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> gecode_constraint_cumulative_162(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=4))))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> gecode_constraint_cumulative_166(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=3))))) + ; throw(error(type_error(int(X1)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=1)))). + +cumulative(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_BoolVarArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_149(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolVarArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_151(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_BoolVarArgs(X6,Y6) + -> gecode_constraint_cumulative_152(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=4))))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_155(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_BoolVarArgs(X6,Y6) + -> gecode_constraint_cumulative_156(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_BoolVarArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_161(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolVarArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_163(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_BoolVarArgs(X6,Y6) + -> gecode_constraint_cumulative_164(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=4))))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_167(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_BoolVarArgs(X6,Y6) + -> gecode_constraint_cumulative_168(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error(int(X1)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +cumulative(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_cumulative_153(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_cumulative_157(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=3))))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_cumulative_165(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_cumulative_169(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=3))))) + ; throw(error(type_error(int(X1)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +cumulatives(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_170(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_172(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_174(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_176(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_178(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_180(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_182(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_184(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_171(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_173(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_175(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_177(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_179(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_181(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_183(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_185(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=1)))). + +distinct(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_distinct_186(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(distinct(X0,X1,X2),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_distinct_188(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(distinct(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntPropLevel(X2,Y2) + -> gecode_constraint_distinct_191(Y0,Y1,Y2) + ; (is_int(X2,Y2) + -> gecode_constraint_distinct_192(Y0,Y1,Y2) + ; throw(error(type_error(int(X2)),gecode_argument_error(distinct(X0,X1,X2),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(distinct(X0,X1,X2),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(distinct(X0,X1,X2),arg=1)))). + +distinct(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_distinct_187(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_distinct_189(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_distinct_193(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=1)))). + +distinct(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> gecode_constraint_distinct_190(Y0,Y1) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(distinct(X0,X1),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(distinct(X0,X1),arg=1)))). + +div(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_div_194(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(div(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(div(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_div_195(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(div(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(div(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(div(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(div(X0,X1,X2,X3),arg=1)))). + +div(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_div_196(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=1)))). + +divmod(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_divmod_197(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=1)))). + +divmod(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_divmod_198(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=1)))). + +dom(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> gecode_constraint_dom_199(Y0,Y1,Y2) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatVal(X2,Y2) + -> gecode_constraint_dom_203(Y0,Y1,Y2) + ; (is_FloatVar(X2,Y2) + -> gecode_constraint_dom_205(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3))))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_dom_206(Y0,Y1,Y2) + ; (is_IntSet(X2,Y2) + -> gecode_constraint_dom_208(Y0,Y1,Y2) + ; (is_int(X2,Y2) + -> gecode_constraint_dom_212(Y0,Y1,Y2) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))))) + ; (is_SetVar(X1,Y1) + -> (is_SetVar(X2,Y2) + -> gecode_constraint_dom_226(Y0,Y1,Y2) + ; throw(error(type_error('SetVar'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> gecode_constraint_dom_227(Y0,Y1,Y2) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVal(X2,Y2) + -> gecode_constraint_dom_230(Y0,Y1,Y2) + ; (is_FloatVarArgs(X2,Y2) + -> gecode_constraint_dom_231(Y0,Y1,Y2) + ; throw(error(type_error('FloatVarArgs'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> gecode_constraint_dom_232(Y0,Y1,Y2) + ; (is_IntVarArgs(X2,Y2) + -> gecode_constraint_dom_234(Y0,Y1,Y2) + ; (is_int(X2,Y2) + -> gecode_constraint_dom_236(Y0,Y1,Y2) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarArgs(X2,Y2) + -> gecode_constraint_dom_243(Y0,Y1,Y2) + ; throw(error(type_error('SetVarArgs'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(dom(X0,X1,X2),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(dom(X0,X1,X2),arg=1)))). + +dom(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_200(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatNum(X2,Y2) + -> (is_FloatNum(X3,Y3) + -> gecode_constraint_dom_201(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatNum'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; (is_FloatVal(X2,Y2) + -> (is_Reify(X3,Y3) + -> gecode_constraint_dom_204(Y0,Y1,Y2,Y3) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVal'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3))))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_207(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; (is_IntSet(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_209(Y0,Y1,Y2,Y3) + ; (is_Reify(X3,Y3) + -> gecode_constraint_dom_210(Y0,Y1,Y2,Y3) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4))))) + ; (is_int(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_213(Y0,Y1,Y2,Y3) + ; (is_Reify(X3,Y3) + -> gecode_constraint_dom_214(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_dom_216(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))))) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))))) + ; (is_SetVar(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_IntSet(X3,Y3) + -> gecode_constraint_dom_220(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_dom_222(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_228(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatNum(X2,Y2) + -> (is_FloatNum(X3,Y3) + -> gecode_constraint_dom_229(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatNum'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatNum'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_233(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_235(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_237(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_dom_238(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_IntSet(X3,Y3) + -> gecode_constraint_dom_240(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_dom_241(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(dom(X0,X1,X2,X3),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(dom(X0,X1,X2,X3),arg=1)))). + +dom(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatNum(X2,Y2) + -> (is_FloatNum(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_dom_202(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatNum'(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('FloatNum'(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_Reify(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_dom_211(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4)))) + ; (is_int(X2,Y2) + -> (is_Reify(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_dom_215(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_dom_217(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_dom_218(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3))))) + ; (is_SetVar(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_IntSet(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_dom_221(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_dom_223(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_dom_224(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_dom_239(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3)))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_dom_242(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=2)))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=1)))). + +dom(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_dom_219(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_Reify(X5,Y5) + -> gecode_constraint_dom_225(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=1)))). + +element(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_element_244(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_element_246(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_element_248(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3),arg=4)))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_element_254(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_element_256(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_element_260(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_element_262(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(element(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(element(X0,X1,X2,X3),arg=1)))). + +element(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_245(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_247(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_249(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=4)))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_255(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_257(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_261(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_263(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=1)))). + +element(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_BoolVar(X6,Y6) + -> gecode_constraint_element_250(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_IntVar(X6,Y6) + -> gecode_constraint_element_252(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_BoolVar(X6,Y6) + -> gecode_constraint_element_258(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_IntVar(X6,Y6) + -> gecode_constraint_element_264(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +element(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_BoolVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_element_251(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; (is_IntVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_element_253(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=7))))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_BoolVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_element_259(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_IntVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_element_265(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +extensional(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_DFA(X2,Y2) + -> gecode_constraint_extensional_266(Y0,Y1,Y2) + ; throw(error(type_error('DFA'(X2)),gecode_argument_error(extensional(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_DFA(X2,Y2) + -> gecode_constraint_extensional_272(Y0,Y1,Y2) + ; throw(error(type_error('DFA'(X2)),gecode_argument_error(extensional(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(extensional(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(extensional(X0,X1,X2),arg=1)))). + +extensional(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_DFA(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_extensional_267(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=4)))) + ; (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_extensional_268(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_DFA(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_extensional_273(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=4)))) + ; (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_extensional_274(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=1)))). + +extensional(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_extensional_269(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_extensional_270(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_extensional_275(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_extensional_276(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=1)))). + +extensional(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_extensional_271(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_extensional_277(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=1)))). + +ite(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> gecode_constraint_ite_278(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('BoolVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('BoolVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=4)))) + ; (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> (is_FloatVar(X4,Y4) + -> gecode_constraint_ite_280(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_ite_281(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=4)))) + ; (is_SetVar(X2,Y2) + -> (is_SetVar(X3,Y3) + -> (is_SetVar(X4,Y4) + -> gecode_constraint_ite_283(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('SetVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('SetVar'(X2)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=3))))))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=1)))). + +ite(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_ite_279(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('BoolVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('BoolVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_ite_282(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=3))))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=1)))). + +linear(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_linear_284(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_linear_288(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(linear(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> gecode_constraint_linear_296(Y0,Y1,Y2,Y3) + ; (is_FloatVar(X3,Y3) + -> gecode_constraint_linear_298(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_linear_316(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_linear_320(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(linear(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(linear(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(linear(X0,X1,X2,X3),arg=1)))). + +linear(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_linear_285(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_linear_286(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_linear_289(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_linear_290(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(int(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3)))) + ; (is_FloatValArgs(X1,Y1) + -> (is_FloatVarArgs(X2,Y2) + -> (is_FloatRelType(X3,Y3) + -> (is_FloatVal(X4,Y4) + -> gecode_constraint_linear_292(Y0,Y1,Y2,Y3,Y4) + ; (is_FloatVar(X4,Y4) + -> gecode_constraint_linear_294(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('FloatRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('FloatVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_linear_297(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5)))) + ; (is_FloatVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_linear_299(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_linear_300(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_linear_304(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_linear_308(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_linear_312(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_linear_317(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_linear_318(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_linear_321(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_linear_322(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(int(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=2)))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=1)))). + +linear(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_287(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_291(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_FloatValArgs(X1,Y1) + -> (is_FloatVarArgs(X2,Y2) + -> (is_FloatRelType(X3,Y3) + -> (is_FloatVal(X4,Y4) + -> (is_Reify(X5,Y5) + -> gecode_constraint_linear_293(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_FloatVar(X4,Y4) + -> (is_Reify(X5,Y5) + -> gecode_constraint_linear_295(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('FloatVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('FloatRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('FloatVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_301(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_Reify(X5,Y5) + -> gecode_constraint_linear_302(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6))))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_305(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_Reify(X5,Y5) + -> gecode_constraint_linear_306(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error(int(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_309(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_Reify(X5,Y5) + -> gecode_constraint_linear_310(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6))))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_313(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_Reify(X5,Y5) + -> gecode_constraint_linear_314(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error(int(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_319(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_323(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=1)))). + +linear(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_Reify(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_linear_303(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; (is_int(X4,Y4) + -> (is_Reify(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_linear_307(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_Reify(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_linear_311(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; (is_int(X4,Y4) + -> (is_Reify(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_linear_315(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +max(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_max_324(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(max(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(max(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_max_325(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(max(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(max(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_max_329(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(max(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(max(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(max(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(max(X0,X1,X2,X3),arg=1)))). + +max(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_max_326(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=1)))). + +max(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVarArgs(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_max_327(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(max(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_max_328(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(max(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(max(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(max(X0,X1,X2),arg=1)))). + +member(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> gecode_constraint_member_330(Y0,Y1,Y2) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(member(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_member_334(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(member(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(member(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(member(X0,X1,X2),arg=1)))). + +member(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_member_331(Y0,Y1,Y2,Y3) + ; (is_Reify(X3,Y3) + -> gecode_constraint_member_332(Y0,Y1,Y2,Y3) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(member(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(member(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_member_335(Y0,Y1,Y2,Y3) + ; (is_Reify(X3,Y3) + -> gecode_constraint_member_336(Y0,Y1,Y2,Y3) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(member(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(member(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(member(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(member(X0,X1,X2,X3),arg=1)))). + +member(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_Reify(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_member_333(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_Reify(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_member_337(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=1)))). + +min(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_min_338(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(min(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(min(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_min_339(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(min(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(min(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_min_343(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(min(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(min(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(min(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(min(X0,X1,X2,X3),arg=1)))). + +min(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_min_340(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=1)))). + +min(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVarArgs(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_min_341(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(min(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_min_342(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(min(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(min(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(min(X0,X1,X2),arg=1)))). + +mod(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_mod_344(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(mod(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(mod(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(mod(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(mod(X0,X1,X2,X3),arg=1)))). + +mod(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_mod_345(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=1)))). + +mult(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_mult_346(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(mult(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(mult(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_mult_347(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(mult(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(mult(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(mult(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(mult(X0,X1,X2,X3),arg=1)))). + +mult(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_mult_348(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> gecode_constraint_nooverlap_349(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_nooverlap_350(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_BoolVarArgs(X5,Y5) + -> gecode_constraint_nooverlap_351(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolVarArgs'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_BoolVarArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_nooverlap_352(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolVarArgs'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntVarArgs(X5,Y5) + -> (is_IntVarArgs(X6,Y6) + -> gecode_constraint_nooverlap_353(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVarArgs'(X6)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntVarArgs(X5,Y5) + -> (is_IntVarArgs(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_nooverlap_354(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; (is_BoolVarArgs(X7,Y7) + -> gecode_constraint_nooverlap_355(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('BoolVarArgs'(X7)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=8))))) + ; throw(error(type_error('IntVarArgs'(X6)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntVarArgs(X5,Y5) + -> (is_IntVarArgs(X6,Y6) + -> (is_BoolVarArgs(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_nooverlap_356(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error('BoolVarArgs'(X7)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntVarArgs'(X6)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=1)))). + +nroot(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_nroot_357(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_nroot_358(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=1)))). + +nroot(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nroot_359(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=1)))). + +nvalues(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_nvalues_360(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_nvalues_362(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_nvalues_364(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_nvalues_366(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=1)))). + +nvalues(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nvalues_361(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nvalues_363(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nvalues_365(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nvalues_367(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=1)))). + +path(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVar(X5,Y5) + -> gecode_constraint_path_368(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_path_379(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error(int(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=1)))). + +path(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVar(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_path_369(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntVar(X6,Y6) + -> gecode_constraint_path_370(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=6))))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVar(X5,Y5) + -> (is_IntVar(X6,Y6) + -> gecode_constraint_path_372(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +path(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVarArgs(X5,Y5) + -> (is_IntVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_path_371(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVar(X5,Y5) + -> (is_IntVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_path_373(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; (is_IntVarArgs(X6,Y6) + -> (is_IntVar(X7,Y7) + -> gecode_constraint_path_374(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntVar'(X7)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntVarArgs'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=7))))) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +path(X0,X1,X2,X3,X4,X5,X6,X7,X8) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVar(X5,Y5) + -> (is_IntVarArgs(X6,Y6) + -> (is_IntVar(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_path_375(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error('IntVar'(X7)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntVarArgs'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=3)))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=1)))). + +path(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_path_376(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(path(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(path(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3),arg=1)))). + +path(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_path_377(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=3)))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_path_378(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error(int(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=1)))). + +pow(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_pow_380(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(pow(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(pow(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_pow_381(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(pow(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(pow(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(pow(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(pow(X0,X1,X2,X3),arg=1)))). + +pow(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_pow_382(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=1)))). + +precede(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> gecode_constraint_precede_383(Y0,Y1,Y2) + ; throw(error(type_error('IntArgs'(X2)),gecode_argument_error(precede(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(precede(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(precede(X0,X1,X2),arg=1)))). + +precede(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_precede_384(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(precede(X0,X1,X2,X3),arg=4)))) + ; (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_precede_385(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(precede(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(precede(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(precede(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(precede(X0,X1,X2,X3),arg=1)))). + +precede(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_precede_386(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=1)))). + +rel(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolOpType(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_rel_387(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_rel_389(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_rel_395(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_rel_399(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> gecode_constraint_rel_403(Y0,Y1,Y2,Y3) + ; (is_FloatVar(X3,Y3) + -> gecode_constraint_rel_405(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_rel_407(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_rel_411(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; (is_SetRelType(X2,Y2) + -> (is_SetVar(X3,Y3) + -> gecode_constraint_rel_415(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3))))) + ; (is_SetVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_rel_417(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4)))) + ; (is_SetRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_rel_419(Y0,Y1,Y2,Y3) + ; (is_SetVar(X3,Y3) + -> gecode_constraint_rel_421(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3))))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_rel_423(Y0,Y1,Y2,Y3) + ; (is_IntPropLevel(X3,Y3) + -> gecode_constraint_rel_426(Y0,Y1,Y2,Y3) + ; (is_BoolVarArgs(X3,Y3) + -> gecode_constraint_rel_427(Y0,Y1,Y2,Y3) + ; (is_IntArgs(X3,Y3) + -> gecode_constraint_rel_429(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_rel_431(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4)))))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> gecode_constraint_rel_433(Y0,Y1,Y2,Y3) + ; (is_FloatVar(X3,Y3) + -> gecode_constraint_rel_434(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> gecode_constraint_rel_435(Y0,Y1,Y2,Y3) + ; (is_IntVarArgs(X3,Y3) + -> gecode_constraint_rel_437(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_rel_440(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_rel_441(Y0,Y1,Y2,Y3) + ; (is_IntArgs(X3,Y3) + -> gecode_constraint_rel_443(Y0,Y1,Y2,Y3) + ; (is_IntVarArgs(X3,Y3) + -> gecode_constraint_rel_445(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_rel_447(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4)))))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(rel(X0,X1,X2,X3),arg=2)))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(rel(X0,X1,X2,X3),arg=1)))). + +rel(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolOpType(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_388(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_390(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_BoolVar(X1,Y1) + -> (is_BoolOpType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> gecode_constraint_rel_391(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_rel_393(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('BoolVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_396(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_rel_397(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_400(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_rel_401(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3))))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_404(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_FloatVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_406(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_408(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_rel_409(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_412(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_rel_413(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; (is_SetRelType(X2,Y2) + -> (is_SetVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_416(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3))))) + ; (is_SetVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_418(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4)))) + ; (is_SetRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_420(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_SetVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_422(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3))))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_424(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_BoolVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_428(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_430(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_432(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_436(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_438(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_442(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_444(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_446(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_448(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=1)))). + +rel(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolOpType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_392(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_394(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('BoolVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_398(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_402(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_IntVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_410(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_414(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=1)))). + +rel(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> gecode_constraint_rel_425(Y0,Y1,Y2) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> gecode_constraint_rel_439(Y0,Y1,Y2) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(rel(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(rel(X0,X1,X2),arg=1)))). + +relax(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_SetVarArgs(X1,Y1) + -> (is_SetVarArgs(X2,Y2) + -> (is_Rnd(X3,Y3) + -> (is_double(X4,Y4) + -> gecode_constraint_relax_449(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(double(X4)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Rnd'(X3)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('SetVarArgs'(X2)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=1)))). + +sequence(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_int(X5,Y5) + -> gecode_constraint_sequence_450(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error(int(X5)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntSet'(X2)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_int(X5,Y5) + -> gecode_constraint_sequence_452(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error(int(X5)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntSet'(X2)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=1)))). + +sequence(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_int(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_sequence_451(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntSet'(X2)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_int(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_sequence_453(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntSet'(X2)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +sorted(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_sorted_454(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(sorted(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sorted(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sorted(X0,X1,X2),arg=1)))). + +sorted(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_sorted_455(Y0,Y1,Y2,Y3) + ; (is_IntVarArgs(X3,Y3) + -> gecode_constraint_sorted_456(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(sorted(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(sorted(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sorted(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sorted(X0,X1,X2,X3),arg=1)))). + +sorted(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_sorted_457(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=1)))). + +sqr(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_sqr_458(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(sqr(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_sqr_459(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(sqr(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(sqr(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sqr(X0,X1,X2),arg=1)))). + +sqr(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_sqr_460(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(sqr(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(sqr(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(sqr(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sqr(X0,X1,X2,X3),arg=1)))). + +sqrt(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_sqrt_461(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(sqrt(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_sqrt_462(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(sqrt(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(sqrt(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sqrt(X0,X1,X2),arg=1)))). + +sqrt(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_sqrt_463(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(sqrt(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(sqrt(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(sqrt(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sqrt(X0,X1,X2,X3),arg=1)))). + +unary(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> gecode_constraint_unary_464(Y0,Y1,Y2) + ; throw(error(type_error('IntArgs'(X2)),gecode_argument_error(unary(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(unary(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unary(X0,X1,X2),arg=1)))). + +unary(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_unary_465(Y0,Y1,Y2,Y3) + ; (is_BoolVarArgs(X3,Y3) + -> gecode_constraint_unary_466(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolVarArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3),arg=4))))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> gecode_constraint_unary_468(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3),arg=3))))) + ; (is_TaskTypeArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> gecode_constraint_unary_472(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('TaskTypeArgs'(X1)),gecode_argument_error(unary(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unary(X0,X1,X2,X3),arg=1)))). + +unary(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_unary_467(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('BoolVarArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_unary_469(Y0,Y1,Y2,Y3,Y4) + ; (is_BoolVarArgs(X4,Y4) + -> gecode_constraint_unary_470(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('BoolVarArgs'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=3))))) + ; (is_TaskTypeArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_unary_473(Y0,Y1,Y2,Y3,Y4) + ; (is_BoolVarArgs(X4,Y4) + -> gecode_constraint_unary_474(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('BoolVarArgs'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('TaskTypeArgs'(X1)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=1)))). + +unary(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_BoolVarArgs(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_unary_471(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('BoolVarArgs'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_TaskTypeArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_BoolVarArgs(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_unary_475(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('BoolVarArgs'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('TaskTypeArgs'(X1)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=1)))). + +unshare(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> gecode_constraint_unshare_476(Y0,Y1) + ; (is_IntVarArgs(X1,Y1) + -> gecode_constraint_unshare_478(Y0,Y1) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(unshare(X0,X1),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unshare(X0,X1),arg=1)))). + +unshare(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntPropLevel(X2,Y2) + -> gecode_constraint_unshare_477(Y0,Y1,Y2) + ; throw(error(type_error('IntPropLevel'(X2)),gecode_argument_error(unshare(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntPropLevel(X2,Y2) + -> gecode_constraint_unshare_479(Y0,Y1,Y2) + ; throw(error(type_error('IntPropLevel'(X2)),gecode_argument_error(unshare(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(unshare(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unshare(X0,X1,X2),arg=1)))). + +when(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_std_function(X2,Y2) + -> gecode_constraint_when_480(Y0,Y1,Y2) + ; throw(error(type_error('std::function'(X2)),gecode_argument_error(when(X0,X1,X2),arg=3)))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(when(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(when(X0,X1,X2),arg=1)))). + +when(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_std_function(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_when_481(Y0,Y1,Y2,Y3) + ; (is_std_function(X3,Y3) + -> gecode_constraint_when_482(Y0,Y1,Y2,Y3) + ; throw(error(type_error('std::function'(X3)),gecode_argument_error(when(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('std::function'(X2)),gecode_argument_error(when(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(when(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(when(X0,X1,X2,X3),arg=1)))). + +when(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_std_function(X2,Y2) + -> (is_std_function(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_when_483(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('std::function'(X3)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('std::function'(X2)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=1)))). + diff --git a/packages/gecode/6.1.1/gecode_yap_cc_forward_auto_generated.icc b/packages/gecode/6.1.1/gecode_yap_cc_forward_auto_generated.icc new file mode 100644 index 000000000..dd1196994 --- /dev/null +++ b/packages/gecode/6.1.1/gecode_yap_cc_forward_auto_generated.icc @@ -0,0 +1,28 @@ +// -*- c++ -*- +//============================================================================= +// Copyright (C) 2011 by Denys Duchier +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published by the +// Free Software Foundation, either version 3 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +//============================================================================= + +static RestartMode gecode_RestartMode_from_term(YAP_Term); +static FloatRelType gecode_FloatRelType_from_term(YAP_Term); +static ReifyMode gecode_ReifyMode_from_term(YAP_Term); +static IntRelType gecode_IntRelType_from_term(YAP_Term); +static BoolOpType gecode_BoolOpType_from_term(YAP_Term); +static IntPropLevel gecode_IntPropLevel_from_term(YAP_Term); +static TaskType gecode_TaskType_from_term(YAP_Term); +static TraceEvent gecode_TraceEvent_from_term(YAP_Term); +static SetRelType gecode_SetRelType_from_term(YAP_Term); +static SetOpType gecode_SetOpType_from_term(YAP_Term); diff --git a/packages/gecode/6.1.1/gecode_yap_cc_impl_auto_generated.icc b/packages/gecode/6.1.1/gecode_yap_cc_impl_auto_generated.icc new file mode 100644 index 000000000..3826ebca8 --- /dev/null +++ b/packages/gecode/6.1.1/gecode_yap_cc_impl_auto_generated.icc @@ -0,0 +1,5458 @@ +// -*- c++ -*- +//============================================================================= +// Copyright (C) 2011 by Denys Duchier +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published by the +// Free Software Foundation, either version 3 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +//============================================================================= + +static YAP_Term gecode_RM_NONE; +static YAP_Term gecode_RM_CONSTANT; +static YAP_Term gecode_RM_LINEAR; +static YAP_Term gecode_RM_LUBY; +static YAP_Term gecode_RM_GEOMETRIC; + +static RestartMode gecode_RestartMode_from_term(YAP_Term X) +{ + if (X==gecode_RM_NONE) return RM_NONE; + if (X==gecode_RM_CONSTANT) return RM_CONSTANT; + if (X==gecode_RM_LINEAR) return RM_LINEAR; + if (X==gecode_RM_LUBY) return RM_LUBY; + if (X==gecode_RM_GEOMETRIC) return RM_GEOMETRIC; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_FRT_EQ; +static YAP_Term gecode_FRT_NQ; +static YAP_Term gecode_FRT_LQ; +static YAP_Term gecode_FRT_LE; +static YAP_Term gecode_FRT_GQ; +static YAP_Term gecode_FRT_GR; + +static FloatRelType gecode_FloatRelType_from_term(YAP_Term X) +{ + if (X==gecode_FRT_EQ) return FRT_EQ; + if (X==gecode_FRT_NQ) return FRT_NQ; + if (X==gecode_FRT_LQ) return FRT_LQ; + if (X==gecode_FRT_LE) return FRT_LE; + if (X==gecode_FRT_GQ) return FRT_GQ; + if (X==gecode_FRT_GR) return FRT_GR; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_RM_EQV; +static YAP_Term gecode_RM_IMP; +static YAP_Term gecode_RM_PMI; + +static ReifyMode gecode_ReifyMode_from_term(YAP_Term X) +{ + if (X==gecode_RM_EQV) return RM_EQV; + if (X==gecode_RM_IMP) return RM_IMP; + if (X==gecode_RM_PMI) return RM_PMI; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_IRT_EQ; +static YAP_Term gecode_IRT_NQ; +static YAP_Term gecode_IRT_LQ; +static YAP_Term gecode_IRT_LE; +static YAP_Term gecode_IRT_GQ; +static YAP_Term gecode_IRT_GR; + +static IntRelType gecode_IntRelType_from_term(YAP_Term X) +{ + if (X==gecode_IRT_EQ) return IRT_EQ; + if (X==gecode_IRT_NQ) return IRT_NQ; + if (X==gecode_IRT_LQ) return IRT_LQ; + if (X==gecode_IRT_LE) return IRT_LE; + if (X==gecode_IRT_GQ) return IRT_GQ; + if (X==gecode_IRT_GR) return IRT_GR; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_BOT_AND; +static YAP_Term gecode_BOT_OR; +static YAP_Term gecode_BOT_IMP; +static YAP_Term gecode_BOT_EQV; +static YAP_Term gecode_BOT_XOR; + +static BoolOpType gecode_BoolOpType_from_term(YAP_Term X) +{ + if (X==gecode_BOT_AND) return BOT_AND; + if (X==gecode_BOT_OR) return BOT_OR; + if (X==gecode_BOT_IMP) return BOT_IMP; + if (X==gecode_BOT_EQV) return BOT_EQV; + if (X==gecode_BOT_XOR) return BOT_XOR; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_IPL_DEF; +static YAP_Term gecode_IPL_VAL; +static YAP_Term gecode_IPL_BND; +static YAP_Term gecode_IPL_DOM; +static YAP_Term gecode_IPL_BASIC; +static YAP_Term gecode_IPL_ADVANCED; +static YAP_Term gecode_IPL_BASIC_ADVANCED; + +static IntPropLevel gecode_IntPropLevel_from_term(YAP_Term X) +{ + if (X==gecode_IPL_DEF) return IPL_DEF; + if (X==gecode_IPL_VAL) return IPL_VAL; + if (X==gecode_IPL_BND) return IPL_BND; + if (X==gecode_IPL_DOM) return IPL_DOM; + if (X==gecode_IPL_BASIC) return IPL_BASIC; + if (X==gecode_IPL_ADVANCED) return IPL_ADVANCED; + if (X==gecode_IPL_BASIC_ADVANCED) return IPL_BASIC_ADVANCED; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_TT_FIXP; +static YAP_Term gecode_TT_FIXS; +static YAP_Term gecode_TT_FIXE; + +static TaskType gecode_TaskType_from_term(YAP_Term X) +{ + if (X==gecode_TT_FIXP) return TT_FIXP; + if (X==gecode_TT_FIXS) return TT_FIXS; + if (X==gecode_TT_FIXE) return TT_FIXE; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_TE_INIT; +static YAP_Term gecode_TE_PRUNE; +static YAP_Term gecode_TE_FIX; +static YAP_Term gecode_TE_FAIL; +static YAP_Term gecode_TE_DONE; +static YAP_Term gecode_TE_PROPAGATE; +static YAP_Term gecode_TE_COMMIT; + +static TraceEvent gecode_TraceEvent_from_term(YAP_Term X) +{ + if (X==gecode_TE_INIT) return TE_INIT; + if (X==gecode_TE_PRUNE) return TE_PRUNE; + if (X==gecode_TE_FIX) return TE_FIX; + if (X==gecode_TE_FAIL) return TE_FAIL; + if (X==gecode_TE_DONE) return TE_DONE; + if (X==gecode_TE_PROPAGATE) return TE_PROPAGATE; + if (X==gecode_TE_COMMIT) return TE_COMMIT; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_SRT_EQ; +static YAP_Term gecode_SRT_NQ; +static YAP_Term gecode_SRT_SUB; +static YAP_Term gecode_SRT_SUP; +static YAP_Term gecode_SRT_DISJ; +static YAP_Term gecode_SRT_CMPL; +static YAP_Term gecode_SRT_LQ; +static YAP_Term gecode_SRT_LE; +static YAP_Term gecode_SRT_GQ; +static YAP_Term gecode_SRT_GR; + +static SetRelType gecode_SetRelType_from_term(YAP_Term X) +{ + if (X==gecode_SRT_EQ) return SRT_EQ; + if (X==gecode_SRT_NQ) return SRT_NQ; + if (X==gecode_SRT_SUB) return SRT_SUB; + if (X==gecode_SRT_SUP) return SRT_SUP; + if (X==gecode_SRT_DISJ) return SRT_DISJ; + if (X==gecode_SRT_CMPL) return SRT_CMPL; + if (X==gecode_SRT_LQ) return SRT_LQ; + if (X==gecode_SRT_LE) return SRT_LE; + if (X==gecode_SRT_GQ) return SRT_GQ; + if (X==gecode_SRT_GR) return SRT_GR; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_SOT_UNION; +static YAP_Term gecode_SOT_DUNION; +static YAP_Term gecode_SOT_INTER; +static YAP_Term gecode_SOT_MINUS; + +static SetOpType gecode_SetOpType_from_term(YAP_Term X) +{ + if (X==gecode_SOT_UNION) return SOT_UNION; + if (X==gecode_SOT_DUNION) return SOT_DUNION; + if (X==gecode_SOT_INTER) return SOT_INTER; + if (X==gecode_SOT_MINUS) return SOT_MINUS; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Bool gecode_constraint_branch_1(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + std::function X2 = gecode_std_function_from_term(YAP_ARG2); + branch(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_convex_2(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + convex(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_convex_3(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetVar X3 = gecode_SetVar_from_term(space,YAP_ARG3); + convex(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_abs_4(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + abs(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_abs_5(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + abs(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_abs_6(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + abs(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_7(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + argmax(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_8(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + argmax(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_10(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + argmax(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_9(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + argmax(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_11(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + argmax(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_12(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + argmax(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_13(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + argmin(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_14(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + argmin(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_16(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + argmin(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_15(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + argmin(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_17(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + argmin(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_18(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + argmin(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_19(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolAssign X3 = gecode_BoolAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_21(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatAssign X3 = gecode_FloatAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_23(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntAssign X3 = gecode_IntAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_25(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetAssign X3 = gecode_SetAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_27(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolAssign X3 = gecode_BoolAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_30(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatAssign X3 = gecode_FloatAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_33(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntAssign X3 = gecode_IntAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_36(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetAssign X3 = gecode_SetAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_20(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolAssign X3 = gecode_BoolAssign_from_term(YAP_ARG3); + BoolVarValPrint X4 = gecode_BoolVarValPrint_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_22(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatAssign X3 = gecode_FloatAssign_from_term(YAP_ARG3); + FloatVarValPrint X4 = gecode_FloatVarValPrint_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_24(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntAssign X3 = gecode_IntAssign_from_term(YAP_ARG3); + IntVarValPrint X4 = gecode_IntVarValPrint_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_26(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetAssign X3 = gecode_SetAssign_from_term(YAP_ARG3); + SetVarValPrint X4 = gecode_SetVarValPrint_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_28(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolAssign X3 = gecode_BoolAssign_from_term(YAP_ARG3); + BoolBranchFilter X4 = gecode_BoolBranchFilter_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_31(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatAssign X3 = gecode_FloatAssign_from_term(YAP_ARG3); + FloatBranchFilter X4 = gecode_FloatBranchFilter_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_34(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntAssign X3 = gecode_IntAssign_from_term(YAP_ARG3); + IntBranchFilter X4 = gecode_IntBranchFilter_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_37(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetAssign X3 = gecode_SetAssign_from_term(YAP_ARG3); + SetBranchFilter X4 = gecode_SetBranchFilter_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_29(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolAssign X3 = gecode_BoolAssign_from_term(YAP_ARG3); + BoolBranchFilter X4 = gecode_BoolBranchFilter_from_term(YAP_ARG4); + BoolVarValPrint X5 = gecode_BoolVarValPrint_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_32(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatAssign X3 = gecode_FloatAssign_from_term(YAP_ARG3); + FloatBranchFilter X4 = gecode_FloatBranchFilter_from_term(YAP_ARG4); + FloatVarValPrint X5 = gecode_FloatVarValPrint_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_35(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntAssign X3 = gecode_IntAssign_from_term(YAP_ARG3); + IntBranchFilter X4 = gecode_IntBranchFilter_from_term(YAP_ARG4); + IntVarValPrint X5 = gecode_IntVarValPrint_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_38(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetAssign X3 = gecode_SetAssign_from_term(YAP_ARG3); + SetBranchFilter X4 = gecode_SetBranchFilter_from_term(YAP_ARG4); + SetVarValPrint X5 = gecode_SetVarValPrint_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_binpacking_39(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + binpacking(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_binpacking_40(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + binpacking(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_41(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolValBranch X3 = gecode_BoolValBranch_from_term(YAP_ARG3); + branch(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_43(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatValBranch X3 = gecode_FloatValBranch_from_term(YAP_ARG3); + branch(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_45(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntValBranch X3 = gecode_IntValBranch_from_term(YAP_ARG3); + branch(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_47(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetValBranch X3 = gecode_SetValBranch_from_term(YAP_ARG3); + branch(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_42(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolValBranch X3 = gecode_BoolValBranch_from_term(YAP_ARG3); + BoolVarValPrint X4 = gecode_BoolVarValPrint_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_44(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatValBranch X3 = gecode_FloatValBranch_from_term(YAP_ARG3); + FloatVarValPrint X4 = gecode_FloatVarValPrint_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_46(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntValBranch X3 = gecode_IntValBranch_from_term(YAP_ARG3); + IntVarValPrint X4 = gecode_IntVarValPrint_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_48(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetValBranch X3 = gecode_SetValBranch_from_term(YAP_ARG3); + SetVarValPrint X4 = gecode_SetVarValPrint_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_49(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_55(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_61(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarBranch X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_64(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_67(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_73(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_79(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_85(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_50(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_52(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_56(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_58(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_62(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarBranch X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_65(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_68(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_70(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_74(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_76(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_80(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_82(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_86(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_88(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_51(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + BoolVarValPrint X6 = gecode_BoolVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_53(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + BoolBranchFilter X6 = gecode_BoolBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_57(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + BoolVarValPrint X6 = gecode_BoolVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_59(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + BoolBranchFilter X6 = gecode_BoolBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_63(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarBranch X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + FloatVarValPrint X6 = gecode_FloatVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_66(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + FloatVarValPrint X6 = gecode_FloatVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_69(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + IntVarValPrint X6 = gecode_IntVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_71(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + IntBranchFilter X6 = gecode_IntBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_75(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + IntVarValPrint X6 = gecode_IntVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_77(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + IntBranchFilter X6 = gecode_IntBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_81(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + SetVarValPrint X6 = gecode_SetVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_83(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + SetBranchFilter X6 = gecode_SetBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_87(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + SetVarValPrint X6 = gecode_SetVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_89(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + SetBranchFilter X6 = gecode_SetBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_54(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + BoolBranchFilter X6 = gecode_BoolBranchFilter_from_term(YAP_ARG6); + BoolVarValPrint X7 = gecode_BoolVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_60(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + BoolBranchFilter X6 = gecode_BoolBranchFilter_from_term(YAP_ARG6); + BoolVarValPrint X7 = gecode_BoolVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_72(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + IntBranchFilter X6 = gecode_IntBranchFilter_from_term(YAP_ARG6); + IntVarValPrint X7 = gecode_IntVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_78(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + IntBranchFilter X6 = gecode_IntBranchFilter_from_term(YAP_ARG6); + IntVarValPrint X7 = gecode_IntVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_84(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + SetBranchFilter X6 = gecode_SetBranchFilter_from_term(YAP_ARG6); + SetVarValPrint X7 = gecode_SetVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_90(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + SetBranchFilter X6 = gecode_SetBranchFilter_from_term(YAP_ARG6); + SetVarValPrint X7 = gecode_SetVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cardinality_91(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + cardinality(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_cardinality_92(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + cardinality(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_93(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_95(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_96(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_97(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_100(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_94(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + channel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_98(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + channel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_101(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + channel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_99(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + channel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_102(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + channel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_103(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + channel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_104(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + circuit(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_115(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + circuit(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_105(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + circuit(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_106(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + circuit(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_108(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + circuit(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_107(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + circuit(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_109(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + circuit(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_110(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + circuit(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_111(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + circuit(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_112(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + circuit(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_113(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntPropLevel X3 = gecode_IntPropLevel_from_term(YAP_ARG3); + circuit(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_114(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + circuit(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_clause_116(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + clause(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_clause_118(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + clause(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_clause_117(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + clause(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_clause_119(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + clause(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_120(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_122(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_124(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_126(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_128(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_130(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_133(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_137(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSetArgs X3 = gecode_IntSetArgs_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_141(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_142(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_144(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_121(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_123(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_125(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_127(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_129(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_131(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_143(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_145(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_132(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_135(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSetArgs X3 = gecode_IntSetArgs_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_136(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSetArgs X3 = gecode_IntSetArgs_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_139(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_140(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_134(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSetArgs X3 = gecode_IntSetArgs_from_term(YAP_ARG3); + count(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_138(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + count(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_146(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + cumulative(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_158(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + cumulative(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_147(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_148(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_150(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_154(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_159(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_160(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_162(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_166(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_149(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_151(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_152(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_155(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_156(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_161(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_163(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_164(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_167(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_168(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_153(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + cumulative(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_157(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + cumulative(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_165(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + cumulative(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_169(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + cumulative(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_170(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_172(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_174(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_176(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_178(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_180(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_182(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_184(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_171(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_173(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_175(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_177(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_179(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_181(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_183(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_185(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_186(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + distinct(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_188(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + distinct(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_191(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntPropLevel X3 = gecode_IntPropLevel_from_term(YAP_ARG3); + distinct(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_192(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + distinct(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_187(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + distinct(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_189(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + distinct(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_193(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + distinct(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_190(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + distinct(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_div_194(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + div(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_div_195(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + div(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_div_196(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + div(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_divmod_197(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + divmod(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_divmod_198(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + divmod(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_199(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_203(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVal X3 = gecode_FloatVal_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_205(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_206(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_208(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_212(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_226(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetVar X3 = gecode_SetVar_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_227(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_230(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVal X3 = gecode_FloatVal_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_231(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_232(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_234(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_236(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_243(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarArgs X3 = gecode_SetVarArgs_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_200(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_201(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatNum X3 = gecode_FloatNum_from_term(YAP_ARG3); + FloatNum X4 = gecode_FloatNum_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_204(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVal X3 = gecode_FloatVal_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_207(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_209(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_210(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_213(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_214(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_216(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_220(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntSet X4 = gecode_IntSet_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_222(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_228(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_229(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatNum X3 = gecode_FloatNum_from_term(YAP_ARG3); + FloatNum X4 = gecode_FloatNum_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_233(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_235(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_237(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_238(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_240(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntSet X4 = gecode_IntSet_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_241(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_202(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatNum X3 = gecode_FloatNum_from_term(YAP_ARG3); + FloatNum X4 = gecode_FloatNum_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_211(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_215(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_217(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_218(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_221(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntSet X4 = gecode_IntSet_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_223(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_224(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_239(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_242(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_219(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + dom(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_225(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + dom(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_244(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_246(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_248(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_254(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_256(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_260(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_262(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_245(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_247(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_249(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_255(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_257(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_261(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_263(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_250(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + BoolVar X7 = gecode_BoolVar_from_term(space,YAP_ARG7); + element(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_252(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + element(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_258(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + BoolVar X7 = gecode_BoolVar_from_term(space,YAP_ARG7); + element(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_264(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + element(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_251(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + BoolVar X7 = gecode_BoolVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + element(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_253(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + element(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_259(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + BoolVar X7 = gecode_BoolVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + element(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_265(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + element(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_266(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + DFA X3 = gecode_DFA_from_term(YAP_ARG3); + extensional(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_272(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + DFA X3 = gecode_DFA_from_term(YAP_ARG3); + extensional(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_267(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + DFA X3 = gecode_DFA_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + extensional(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_268(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + extensional(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_273(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + DFA X3 = gecode_DFA_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + extensional(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_274(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + extensional(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_269(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + extensional(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_270(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + extensional(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_275(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + extensional(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_276(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + extensional(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_271(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + extensional(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_277(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + extensional(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_278(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + ite(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_280(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + FloatVar X5 = gecode_FloatVar_from_term(space,YAP_ARG5); + ite(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_281(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + ite(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_283(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + SetVar X3 = gecode_SetVar_from_term(space,YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + SetVar X5 = gecode_SetVar_from_term(space,YAP_ARG5); + ite(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_279(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + ite(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_282(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + ite(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_284(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_288(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_296(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_298(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_316(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_320(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_285(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_286(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_289(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_290(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_292(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatValArgs X2 = gecode_FloatValArgs_from_term(YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + FloatRelType X4 = gecode_FloatRelType_from_term(YAP_ARG4); + FloatVal X5 = gecode_FloatVal_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_294(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatValArgs X2 = gecode_FloatValArgs_from_term(YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + FloatRelType X4 = gecode_FloatRelType_from_term(YAP_ARG4); + FloatVar X5 = gecode_FloatVar_from_term(space,YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_297(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_299(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_300(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_304(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_308(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_312(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_317(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_318(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_321(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_322(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_287(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_291(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_293(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatValArgs X2 = gecode_FloatValArgs_from_term(YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + FloatRelType X4 = gecode_FloatRelType_from_term(YAP_ARG4); + FloatVal X5 = gecode_FloatVal_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_295(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatValArgs X2 = gecode_FloatValArgs_from_term(YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + FloatRelType X4 = gecode_FloatRelType_from_term(YAP_ARG4); + FloatVar X5 = gecode_FloatVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_301(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_302(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_305(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_306(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_309(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_310(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_313(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_314(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_319(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_323(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_303(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + linear(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_307(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + linear(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_311(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + linear(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_315(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + linear(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_324(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + max(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_325(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + max(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_329(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + max(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_326(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + max(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_327(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + max(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_328(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + max(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_330(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + member(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_334(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + member(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_331(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + member(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_332(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + member(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_335(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + member(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_336(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + member(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_333(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + member(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_337(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + member(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_338(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + min(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_339(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + min(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_343(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + min(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_340(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + min(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_341(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + min(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_342(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + min(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_mod_344(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + mod(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_mod_345(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + mod(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_mult_346(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + mult(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_mult_347(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + mult(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_mult_348(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + mult(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_349(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + nooverlap(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_350(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + nooverlap(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_351(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + nooverlap(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_352(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + nooverlap(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_353(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + nooverlap(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_354(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + nooverlap(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_355(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + BoolVarArgs X8 = gecode_BoolVarArgs_from_term(space,YAP_ARG8); + nooverlap(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_356(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + BoolVarArgs X8 = gecode_BoolVarArgs_from_term(space,YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + nooverlap(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_nroot_357(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + nroot(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nroot_358(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + nroot(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nroot_359(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nroot(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_360(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + nvalues(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_362(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + nvalues(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_364(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + nvalues(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_366(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + nvalues(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_361(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nvalues(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_363(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nvalues(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_365(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nvalues(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_367(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nvalues(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_368(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + path(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_379(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + path(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_369(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + path(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_370(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + path(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_372(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + path(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_371(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + path(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_373(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + path(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_374(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + IntVar X8 = gecode_IntVar_from_term(space,YAP_ARG8); + path(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_375(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + IntVar X8 = gecode_IntVar_from_term(space,YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + path(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_376(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + path(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_377(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + path(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_378(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + path(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_pow_380(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + pow(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_pow_381(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + pow(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_pow_382(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + pow(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_precede_383(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + precede(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_precede_384(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + precede(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_precede_385(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + precede(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_precede_386(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + precede(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_387(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_389(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_395(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_399(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_403(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_405(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_407(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_411(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_415(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_417(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_419(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_421(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_423(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_426(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_427(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_429(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_431(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_433(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_434(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_435(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_437(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_440(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_441(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_443(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_445(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_447(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_388(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_390(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_391(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolOpType X3 = gecode_BoolOpType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_393(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolOpType X3 = gecode_BoolOpType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_396(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_397(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_400(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_401(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_404(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_406(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_408(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_409(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_412(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_413(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_416(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_418(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_420(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_422(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_424(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_428(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_430(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_432(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_436(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_438(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_442(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_444(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_446(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_448(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_392(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolOpType X3 = gecode_BoolOpType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_394(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolOpType X3 = gecode_BoolOpType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_398(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_402(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_410(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_414(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_425(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + rel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_439(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + rel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_relax_449(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarArgs X3 = gecode_SetVarArgs_from_term(space,YAP_ARG3); + Rnd X4 = gecode_Rnd_from_term(YAP_ARG4); + double X5 = gecode_double_from_term(YAP_ARG5); + relax(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_sequence_450(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + sequence(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_sequence_452(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + sequence(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_sequence_451(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + sequence(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_sequence_453(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + sequence(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_sorted_454(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + sorted(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sorted_455(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + sorted(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_sorted_456(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + sorted(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_sorted_457(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + sorted(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqr_458(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + sqr(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqr_459(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + sqr(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqr_460(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + sqr(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqrt_461(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + sqrt(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqrt_462(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + sqrt(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqrt_463(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + sqrt(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_464(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + unary(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_465(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + unary(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_466(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + unary(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_468(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + unary(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_472(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + TaskTypeArgs X2 = gecode_TaskTypeArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + unary(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_467(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_469(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_470(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + BoolVarArgs X5 = gecode_BoolVarArgs_from_term(space,YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_473(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + TaskTypeArgs X2 = gecode_TaskTypeArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_474(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + TaskTypeArgs X2 = gecode_TaskTypeArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + BoolVarArgs X5 = gecode_BoolVarArgs_from_term(space,YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_471(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + BoolVarArgs X5 = gecode_BoolVarArgs_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + unary(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_475(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + TaskTypeArgs X2 = gecode_TaskTypeArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + BoolVarArgs X5 = gecode_BoolVarArgs_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + unary(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_unshare_476(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + unshare(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_unshare_478(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + unshare(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_unshare_477(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntPropLevel X3 = gecode_IntPropLevel_from_term(YAP_ARG3); + unshare(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_unshare_479(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntPropLevel X3 = gecode_IntPropLevel_from_term(YAP_ARG3); + unshare(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_when_480(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + std::function X3 = gecode_std_function_from_term(YAP_ARG3); + when(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_when_481(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + std::function X3 = gecode_std_function_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + when(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_when_482(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + std::function X3 = gecode_std_function_from_term(YAP_ARG3); + std::function X4 = gecode_std_function_from_term(YAP_ARG4); + when(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_when_483(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + std::function X3 = gecode_std_function_from_term(YAP_ARG3); + std::function X4 = gecode_std_function_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + when(*space,X2,X3,X4,X5); + return TRUE; +} + diff --git a/packages/gecode/6.1.1/gecode_yap_cc_init_auto_generated.icc b/packages/gecode/6.1.1/gecode_yap_cc_init_auto_generated.icc new file mode 100644 index 000000000..7cdbb49bb --- /dev/null +++ b/packages/gecode/6.1.1/gecode_yap_cc_init_auto_generated.icc @@ -0,0 +1,679 @@ +// -*- c++ -*- +//============================================================================= +// Copyright (C) 2011 by Denys Duchier +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published by the +// Free Software Foundation, either version 3 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +//============================================================================= + +{ YAP_Atom X= YAP_LookupAtom("RM_NONE"); + gecode_RM_NONE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_CONSTANT"); + gecode_RM_CONSTANT = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_LINEAR"); + gecode_RM_LINEAR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_LUBY"); + gecode_RM_LUBY = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_GEOMETRIC"); + gecode_RM_GEOMETRIC = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("FRT_EQ"); + gecode_FRT_EQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_NQ"); + gecode_FRT_NQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_LQ"); + gecode_FRT_LQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_LE"); + gecode_FRT_LE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_GQ"); + gecode_FRT_GQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_GR"); + gecode_FRT_GR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("RM_EQV"); + gecode_RM_EQV = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_IMP"); + gecode_RM_IMP = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_PMI"); + gecode_RM_PMI = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("IRT_EQ"); + gecode_IRT_EQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_NQ"); + gecode_IRT_NQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_LQ"); + gecode_IRT_LQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_LE"); + gecode_IRT_LE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_GQ"); + gecode_IRT_GQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_GR"); + gecode_IRT_GR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("BOT_AND"); + gecode_BOT_AND = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("BOT_OR"); + gecode_BOT_OR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("BOT_IMP"); + gecode_BOT_IMP = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("BOT_EQV"); + gecode_BOT_EQV = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("BOT_XOR"); + gecode_BOT_XOR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("IPL_DEF"); + gecode_IPL_DEF = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_VAL"); + gecode_IPL_VAL = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_BND"); + gecode_IPL_BND = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_DOM"); + gecode_IPL_DOM = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_BASIC"); + gecode_IPL_BASIC = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_ADVANCED"); + gecode_IPL_ADVANCED = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_BASIC_ADVANCED"); + gecode_IPL_BASIC_ADVANCED = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("TT_FIXP"); + gecode_TT_FIXP = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TT_FIXS"); + gecode_TT_FIXS = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TT_FIXE"); + gecode_TT_FIXE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("TE_INIT"); + gecode_TE_INIT = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_PRUNE"); + gecode_TE_PRUNE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_FIX"); + gecode_TE_FIX = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_FAIL"); + gecode_TE_FAIL = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_DONE"); + gecode_TE_DONE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_PROPAGATE"); + gecode_TE_PROPAGATE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_COMMIT"); + gecode_TE_COMMIT = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("SRT_EQ"); + gecode_SRT_EQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_NQ"); + gecode_SRT_NQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_SUB"); + gecode_SRT_SUB = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_SUP"); + gecode_SRT_SUP = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_DISJ"); + gecode_SRT_DISJ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_CMPL"); + gecode_SRT_CMPL = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_LQ"); + gecode_SRT_LQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_LE"); + gecode_SRT_LE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_GQ"); + gecode_SRT_GQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_GR"); + gecode_SRT_GR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("SOT_UNION"); + gecode_SOT_UNION = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SOT_DUNION"); + gecode_SOT_DUNION = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SOT_INTER"); + gecode_SOT_INTER = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SOT_MINUS"); + gecode_SOT_MINUS = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +YAP_UserCPredicate("gecode_constraint_branch_1", gecode_constraint_branch_1, 2); +YAP_UserCPredicate("gecode_constraint_convex_2", gecode_constraint_convex_2, 2); +YAP_UserCPredicate("gecode_constraint_convex_3", gecode_constraint_convex_3, 3); +YAP_UserCPredicate("gecode_constraint_abs_4", gecode_constraint_abs_4, 3); +YAP_UserCPredicate("gecode_constraint_abs_5", gecode_constraint_abs_5, 3); +YAP_UserCPredicate("gecode_constraint_abs_6", gecode_constraint_abs_6, 4); +YAP_UserCPredicate("gecode_constraint_argmax_7", gecode_constraint_argmax_7, 3); +YAP_UserCPredicate("gecode_constraint_argmax_8", gecode_constraint_argmax_8, 4); +YAP_UserCPredicate("gecode_constraint_argmax_10", gecode_constraint_argmax_10, 4); +YAP_UserCPredicate("gecode_constraint_argmax_9", gecode_constraint_argmax_9, 5); +YAP_UserCPredicate("gecode_constraint_argmax_11", gecode_constraint_argmax_11, 5); +YAP_UserCPredicate("gecode_constraint_argmax_12", gecode_constraint_argmax_12, 6); +YAP_UserCPredicate("gecode_constraint_argmin_13", gecode_constraint_argmin_13, 3); +YAP_UserCPredicate("gecode_constraint_argmin_14", gecode_constraint_argmin_14, 4); +YAP_UserCPredicate("gecode_constraint_argmin_16", gecode_constraint_argmin_16, 4); +YAP_UserCPredicate("gecode_constraint_argmin_15", gecode_constraint_argmin_15, 5); +YAP_UserCPredicate("gecode_constraint_argmin_17", gecode_constraint_argmin_17, 5); +YAP_UserCPredicate("gecode_constraint_argmin_18", gecode_constraint_argmin_18, 6); +YAP_UserCPredicate("gecode_constraint_assign_19", gecode_constraint_assign_19, 3); +YAP_UserCPredicate("gecode_constraint_assign_21", gecode_constraint_assign_21, 3); +YAP_UserCPredicate("gecode_constraint_assign_23", gecode_constraint_assign_23, 3); +YAP_UserCPredicate("gecode_constraint_assign_25", gecode_constraint_assign_25, 3); +YAP_UserCPredicate("gecode_constraint_assign_27", gecode_constraint_assign_27, 3); +YAP_UserCPredicate("gecode_constraint_assign_30", gecode_constraint_assign_30, 3); +YAP_UserCPredicate("gecode_constraint_assign_33", gecode_constraint_assign_33, 3); +YAP_UserCPredicate("gecode_constraint_assign_36", gecode_constraint_assign_36, 3); +YAP_UserCPredicate("gecode_constraint_assign_20", gecode_constraint_assign_20, 4); +YAP_UserCPredicate("gecode_constraint_assign_22", gecode_constraint_assign_22, 4); +YAP_UserCPredicate("gecode_constraint_assign_24", gecode_constraint_assign_24, 4); +YAP_UserCPredicate("gecode_constraint_assign_26", gecode_constraint_assign_26, 4); +YAP_UserCPredicate("gecode_constraint_assign_28", gecode_constraint_assign_28, 4); +YAP_UserCPredicate("gecode_constraint_assign_31", gecode_constraint_assign_31, 4); +YAP_UserCPredicate("gecode_constraint_assign_34", gecode_constraint_assign_34, 4); +YAP_UserCPredicate("gecode_constraint_assign_37", gecode_constraint_assign_37, 4); +YAP_UserCPredicate("gecode_constraint_assign_29", gecode_constraint_assign_29, 5); +YAP_UserCPredicate("gecode_constraint_assign_32", gecode_constraint_assign_32, 5); +YAP_UserCPredicate("gecode_constraint_assign_35", gecode_constraint_assign_35, 5); +YAP_UserCPredicate("gecode_constraint_assign_38", gecode_constraint_assign_38, 5); +YAP_UserCPredicate("gecode_constraint_binpacking_39", gecode_constraint_binpacking_39, 4); +YAP_UserCPredicate("gecode_constraint_binpacking_40", gecode_constraint_binpacking_40, 5); +YAP_UserCPredicate("gecode_constraint_branch_41", gecode_constraint_branch_41, 3); +YAP_UserCPredicate("gecode_constraint_branch_43", gecode_constraint_branch_43, 3); +YAP_UserCPredicate("gecode_constraint_branch_45", gecode_constraint_branch_45, 3); +YAP_UserCPredicate("gecode_constraint_branch_47", gecode_constraint_branch_47, 3); +YAP_UserCPredicate("gecode_constraint_branch_42", gecode_constraint_branch_42, 4); +YAP_UserCPredicate("gecode_constraint_branch_44", gecode_constraint_branch_44, 4); +YAP_UserCPredicate("gecode_constraint_branch_46", gecode_constraint_branch_46, 4); +YAP_UserCPredicate("gecode_constraint_branch_48", gecode_constraint_branch_48, 4); +YAP_UserCPredicate("gecode_constraint_branch_49", gecode_constraint_branch_49, 4); +YAP_UserCPredicate("gecode_constraint_branch_55", gecode_constraint_branch_55, 4); +YAP_UserCPredicate("gecode_constraint_branch_61", gecode_constraint_branch_61, 4); +YAP_UserCPredicate("gecode_constraint_branch_64", gecode_constraint_branch_64, 4); +YAP_UserCPredicate("gecode_constraint_branch_67", gecode_constraint_branch_67, 4); +YAP_UserCPredicate("gecode_constraint_branch_73", gecode_constraint_branch_73, 4); +YAP_UserCPredicate("gecode_constraint_branch_79", gecode_constraint_branch_79, 4); +YAP_UserCPredicate("gecode_constraint_branch_85", gecode_constraint_branch_85, 4); +YAP_UserCPredicate("gecode_constraint_branch_50", gecode_constraint_branch_50, 5); +YAP_UserCPredicate("gecode_constraint_branch_52", gecode_constraint_branch_52, 5); +YAP_UserCPredicate("gecode_constraint_branch_56", gecode_constraint_branch_56, 5); +YAP_UserCPredicate("gecode_constraint_branch_58", gecode_constraint_branch_58, 5); +YAP_UserCPredicate("gecode_constraint_branch_62", gecode_constraint_branch_62, 5); +YAP_UserCPredicate("gecode_constraint_branch_65", gecode_constraint_branch_65, 5); +YAP_UserCPredicate("gecode_constraint_branch_68", gecode_constraint_branch_68, 5); +YAP_UserCPredicate("gecode_constraint_branch_70", gecode_constraint_branch_70, 5); +YAP_UserCPredicate("gecode_constraint_branch_74", gecode_constraint_branch_74, 5); +YAP_UserCPredicate("gecode_constraint_branch_76", gecode_constraint_branch_76, 5); +YAP_UserCPredicate("gecode_constraint_branch_80", gecode_constraint_branch_80, 5); +YAP_UserCPredicate("gecode_constraint_branch_82", gecode_constraint_branch_82, 5); +YAP_UserCPredicate("gecode_constraint_branch_86", gecode_constraint_branch_86, 5); +YAP_UserCPredicate("gecode_constraint_branch_88", gecode_constraint_branch_88, 5); +YAP_UserCPredicate("gecode_constraint_branch_51", gecode_constraint_branch_51, 6); +YAP_UserCPredicate("gecode_constraint_branch_53", gecode_constraint_branch_53, 6); +YAP_UserCPredicate("gecode_constraint_branch_57", gecode_constraint_branch_57, 6); +YAP_UserCPredicate("gecode_constraint_branch_59", gecode_constraint_branch_59, 6); +YAP_UserCPredicate("gecode_constraint_branch_63", gecode_constraint_branch_63, 6); +YAP_UserCPredicate("gecode_constraint_branch_66", gecode_constraint_branch_66, 6); +YAP_UserCPredicate("gecode_constraint_branch_69", gecode_constraint_branch_69, 6); +YAP_UserCPredicate("gecode_constraint_branch_71", gecode_constraint_branch_71, 6); +YAP_UserCPredicate("gecode_constraint_branch_75", gecode_constraint_branch_75, 6); +YAP_UserCPredicate("gecode_constraint_branch_77", gecode_constraint_branch_77, 6); +YAP_UserCPredicate("gecode_constraint_branch_81", gecode_constraint_branch_81, 6); +YAP_UserCPredicate("gecode_constraint_branch_83", gecode_constraint_branch_83, 6); +YAP_UserCPredicate("gecode_constraint_branch_87", gecode_constraint_branch_87, 6); +YAP_UserCPredicate("gecode_constraint_branch_89", gecode_constraint_branch_89, 6); +YAP_UserCPredicate("gecode_constraint_branch_54", gecode_constraint_branch_54, 7); +YAP_UserCPredicate("gecode_constraint_branch_60", gecode_constraint_branch_60, 7); +YAP_UserCPredicate("gecode_constraint_branch_72", gecode_constraint_branch_72, 7); +YAP_UserCPredicate("gecode_constraint_branch_78", gecode_constraint_branch_78, 7); +YAP_UserCPredicate("gecode_constraint_branch_84", gecode_constraint_branch_84, 7); +YAP_UserCPredicate("gecode_constraint_branch_90", gecode_constraint_branch_90, 7); +YAP_UserCPredicate("gecode_constraint_cardinality_91", gecode_constraint_cardinality_91, 4); +YAP_UserCPredicate("gecode_constraint_cardinality_92", gecode_constraint_cardinality_92, 4); +YAP_UserCPredicate("gecode_constraint_channel_93", gecode_constraint_channel_93, 3); +YAP_UserCPredicate("gecode_constraint_channel_95", gecode_constraint_channel_95, 3); +YAP_UserCPredicate("gecode_constraint_channel_96", gecode_constraint_channel_96, 3); +YAP_UserCPredicate("gecode_constraint_channel_97", gecode_constraint_channel_97, 3); +YAP_UserCPredicate("gecode_constraint_channel_100", gecode_constraint_channel_100, 3); +YAP_UserCPredicate("gecode_constraint_channel_94", gecode_constraint_channel_94, 4); +YAP_UserCPredicate("gecode_constraint_channel_98", gecode_constraint_channel_98, 4); +YAP_UserCPredicate("gecode_constraint_channel_101", gecode_constraint_channel_101, 4); +YAP_UserCPredicate("gecode_constraint_channel_99", gecode_constraint_channel_99, 5); +YAP_UserCPredicate("gecode_constraint_channel_102", gecode_constraint_channel_102, 5); +YAP_UserCPredicate("gecode_constraint_channel_103", gecode_constraint_channel_103, 6); +YAP_UserCPredicate("gecode_constraint_circuit_104", gecode_constraint_circuit_104, 4); +YAP_UserCPredicate("gecode_constraint_circuit_115", gecode_constraint_circuit_115, 4); +YAP_UserCPredicate("gecode_constraint_circuit_105", gecode_constraint_circuit_105, 5); +YAP_UserCPredicate("gecode_constraint_circuit_106", gecode_constraint_circuit_106, 5); +YAP_UserCPredicate("gecode_constraint_circuit_108", gecode_constraint_circuit_108, 5); +YAP_UserCPredicate("gecode_constraint_circuit_107", gecode_constraint_circuit_107, 6); +YAP_UserCPredicate("gecode_constraint_circuit_109", gecode_constraint_circuit_109, 6); +YAP_UserCPredicate("gecode_constraint_circuit_110", gecode_constraint_circuit_110, 6); +YAP_UserCPredicate("gecode_constraint_circuit_111", gecode_constraint_circuit_111, 7); +YAP_UserCPredicate("gecode_constraint_circuit_112", gecode_constraint_circuit_112, 2); +YAP_UserCPredicate("gecode_constraint_circuit_113", gecode_constraint_circuit_113, 3); +YAP_UserCPredicate("gecode_constraint_circuit_114", gecode_constraint_circuit_114, 3); +YAP_UserCPredicate("gecode_constraint_clause_116", gecode_constraint_clause_116, 5); +YAP_UserCPredicate("gecode_constraint_clause_118", gecode_constraint_clause_118, 5); +YAP_UserCPredicate("gecode_constraint_clause_117", gecode_constraint_clause_117, 6); +YAP_UserCPredicate("gecode_constraint_clause_119", gecode_constraint_clause_119, 6); +YAP_UserCPredicate("gecode_constraint_count_120", gecode_constraint_count_120, 5); +YAP_UserCPredicate("gecode_constraint_count_122", gecode_constraint_count_122, 5); +YAP_UserCPredicate("gecode_constraint_count_124", gecode_constraint_count_124, 5); +YAP_UserCPredicate("gecode_constraint_count_126", gecode_constraint_count_126, 5); +YAP_UserCPredicate("gecode_constraint_count_128", gecode_constraint_count_128, 5); +YAP_UserCPredicate("gecode_constraint_count_130", gecode_constraint_count_130, 5); +YAP_UserCPredicate("gecode_constraint_count_133", gecode_constraint_count_133, 5); +YAP_UserCPredicate("gecode_constraint_count_137", gecode_constraint_count_137, 5); +YAP_UserCPredicate("gecode_constraint_count_141", gecode_constraint_count_141, 5); +YAP_UserCPredicate("gecode_constraint_count_142", gecode_constraint_count_142, 5); +YAP_UserCPredicate("gecode_constraint_count_144", gecode_constraint_count_144, 5); +YAP_UserCPredicate("gecode_constraint_count_121", gecode_constraint_count_121, 6); +YAP_UserCPredicate("gecode_constraint_count_123", gecode_constraint_count_123, 6); +YAP_UserCPredicate("gecode_constraint_count_125", gecode_constraint_count_125, 6); +YAP_UserCPredicate("gecode_constraint_count_127", gecode_constraint_count_127, 6); +YAP_UserCPredicate("gecode_constraint_count_129", gecode_constraint_count_129, 6); +YAP_UserCPredicate("gecode_constraint_count_131", gecode_constraint_count_131, 6); +YAP_UserCPredicate("gecode_constraint_count_143", gecode_constraint_count_143, 6); +YAP_UserCPredicate("gecode_constraint_count_145", gecode_constraint_count_145, 6); +YAP_UserCPredicate("gecode_constraint_count_132", gecode_constraint_count_132, 4); +YAP_UserCPredicate("gecode_constraint_count_135", gecode_constraint_count_135, 4); +YAP_UserCPredicate("gecode_constraint_count_136", gecode_constraint_count_136, 4); +YAP_UserCPredicate("gecode_constraint_count_139", gecode_constraint_count_139, 4); +YAP_UserCPredicate("gecode_constraint_count_140", gecode_constraint_count_140, 4); +YAP_UserCPredicate("gecode_constraint_count_134", gecode_constraint_count_134, 3); +YAP_UserCPredicate("gecode_constraint_count_138", gecode_constraint_count_138, 3); +YAP_UserCPredicate("gecode_constraint_cumulative_146", gecode_constraint_cumulative_146, 5); +YAP_UserCPredicate("gecode_constraint_cumulative_158", gecode_constraint_cumulative_158, 5); +YAP_UserCPredicate("gecode_constraint_cumulative_147", gecode_constraint_cumulative_147, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_148", gecode_constraint_cumulative_148, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_150", gecode_constraint_cumulative_150, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_154", gecode_constraint_cumulative_154, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_159", gecode_constraint_cumulative_159, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_160", gecode_constraint_cumulative_160, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_162", gecode_constraint_cumulative_162, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_166", gecode_constraint_cumulative_166, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_149", gecode_constraint_cumulative_149, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_151", gecode_constraint_cumulative_151, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_152", gecode_constraint_cumulative_152, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_155", gecode_constraint_cumulative_155, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_156", gecode_constraint_cumulative_156, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_161", gecode_constraint_cumulative_161, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_163", gecode_constraint_cumulative_163, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_164", gecode_constraint_cumulative_164, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_167", gecode_constraint_cumulative_167, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_168", gecode_constraint_cumulative_168, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_153", gecode_constraint_cumulative_153, 8); +YAP_UserCPredicate("gecode_constraint_cumulative_157", gecode_constraint_cumulative_157, 8); +YAP_UserCPredicate("gecode_constraint_cumulative_165", gecode_constraint_cumulative_165, 8); +YAP_UserCPredicate("gecode_constraint_cumulative_169", gecode_constraint_cumulative_169, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_170", gecode_constraint_cumulatives_170, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_172", gecode_constraint_cumulatives_172, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_174", gecode_constraint_cumulatives_174, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_176", gecode_constraint_cumulatives_176, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_178", gecode_constraint_cumulatives_178, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_180", gecode_constraint_cumulatives_180, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_182", gecode_constraint_cumulatives_182, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_184", gecode_constraint_cumulatives_184, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_171", gecode_constraint_cumulatives_171, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_173", gecode_constraint_cumulatives_173, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_175", gecode_constraint_cumulatives_175, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_177", gecode_constraint_cumulatives_177, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_179", gecode_constraint_cumulatives_179, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_181", gecode_constraint_cumulatives_181, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_183", gecode_constraint_cumulatives_183, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_185", gecode_constraint_cumulatives_185, 9); +YAP_UserCPredicate("gecode_constraint_distinct_186", gecode_constraint_distinct_186, 3); +YAP_UserCPredicate("gecode_constraint_distinct_188", gecode_constraint_distinct_188, 3); +YAP_UserCPredicate("gecode_constraint_distinct_191", gecode_constraint_distinct_191, 3); +YAP_UserCPredicate("gecode_constraint_distinct_192", gecode_constraint_distinct_192, 3); +YAP_UserCPredicate("gecode_constraint_distinct_187", gecode_constraint_distinct_187, 4); +YAP_UserCPredicate("gecode_constraint_distinct_189", gecode_constraint_distinct_189, 4); +YAP_UserCPredicate("gecode_constraint_distinct_193", gecode_constraint_distinct_193, 4); +YAP_UserCPredicate("gecode_constraint_distinct_190", gecode_constraint_distinct_190, 2); +YAP_UserCPredicate("gecode_constraint_div_194", gecode_constraint_div_194, 4); +YAP_UserCPredicate("gecode_constraint_div_195", gecode_constraint_div_195, 4); +YAP_UserCPredicate("gecode_constraint_div_196", gecode_constraint_div_196, 5); +YAP_UserCPredicate("gecode_constraint_divmod_197", gecode_constraint_divmod_197, 5); +YAP_UserCPredicate("gecode_constraint_divmod_198", gecode_constraint_divmod_198, 6); +YAP_UserCPredicate("gecode_constraint_dom_199", gecode_constraint_dom_199, 3); +YAP_UserCPredicate("gecode_constraint_dom_203", gecode_constraint_dom_203, 3); +YAP_UserCPredicate("gecode_constraint_dom_205", gecode_constraint_dom_205, 3); +YAP_UserCPredicate("gecode_constraint_dom_206", gecode_constraint_dom_206, 3); +YAP_UserCPredicate("gecode_constraint_dom_208", gecode_constraint_dom_208, 3); +YAP_UserCPredicate("gecode_constraint_dom_212", gecode_constraint_dom_212, 3); +YAP_UserCPredicate("gecode_constraint_dom_226", gecode_constraint_dom_226, 3); +YAP_UserCPredicate("gecode_constraint_dom_227", gecode_constraint_dom_227, 3); +YAP_UserCPredicate("gecode_constraint_dom_230", gecode_constraint_dom_230, 3); +YAP_UserCPredicate("gecode_constraint_dom_231", gecode_constraint_dom_231, 3); +YAP_UserCPredicate("gecode_constraint_dom_232", gecode_constraint_dom_232, 3); +YAP_UserCPredicate("gecode_constraint_dom_234", gecode_constraint_dom_234, 3); +YAP_UserCPredicate("gecode_constraint_dom_236", gecode_constraint_dom_236, 3); +YAP_UserCPredicate("gecode_constraint_dom_243", gecode_constraint_dom_243, 3); +YAP_UserCPredicate("gecode_constraint_dom_200", gecode_constraint_dom_200, 4); +YAP_UserCPredicate("gecode_constraint_dom_201", gecode_constraint_dom_201, 4); +YAP_UserCPredicate("gecode_constraint_dom_204", gecode_constraint_dom_204, 4); +YAP_UserCPredicate("gecode_constraint_dom_207", gecode_constraint_dom_207, 4); +YAP_UserCPredicate("gecode_constraint_dom_209", gecode_constraint_dom_209, 4); +YAP_UserCPredicate("gecode_constraint_dom_210", gecode_constraint_dom_210, 4); +YAP_UserCPredicate("gecode_constraint_dom_213", gecode_constraint_dom_213, 4); +YAP_UserCPredicate("gecode_constraint_dom_214", gecode_constraint_dom_214, 4); +YAP_UserCPredicate("gecode_constraint_dom_216", gecode_constraint_dom_216, 4); +YAP_UserCPredicate("gecode_constraint_dom_220", gecode_constraint_dom_220, 4); +YAP_UserCPredicate("gecode_constraint_dom_222", gecode_constraint_dom_222, 4); +YAP_UserCPredicate("gecode_constraint_dom_228", gecode_constraint_dom_228, 4); +YAP_UserCPredicate("gecode_constraint_dom_229", gecode_constraint_dom_229, 4); +YAP_UserCPredicate("gecode_constraint_dom_233", gecode_constraint_dom_233, 4); +YAP_UserCPredicate("gecode_constraint_dom_235", gecode_constraint_dom_235, 4); +YAP_UserCPredicate("gecode_constraint_dom_237", gecode_constraint_dom_237, 4); +YAP_UserCPredicate("gecode_constraint_dom_238", gecode_constraint_dom_238, 4); +YAP_UserCPredicate("gecode_constraint_dom_240", gecode_constraint_dom_240, 4); +YAP_UserCPredicate("gecode_constraint_dom_241", gecode_constraint_dom_241, 4); +YAP_UserCPredicate("gecode_constraint_dom_202", gecode_constraint_dom_202, 5); +YAP_UserCPredicate("gecode_constraint_dom_211", gecode_constraint_dom_211, 5); +YAP_UserCPredicate("gecode_constraint_dom_215", gecode_constraint_dom_215, 5); +YAP_UserCPredicate("gecode_constraint_dom_217", gecode_constraint_dom_217, 5); +YAP_UserCPredicate("gecode_constraint_dom_218", gecode_constraint_dom_218, 5); +YAP_UserCPredicate("gecode_constraint_dom_221", gecode_constraint_dom_221, 5); +YAP_UserCPredicate("gecode_constraint_dom_223", gecode_constraint_dom_223, 5); +YAP_UserCPredicate("gecode_constraint_dom_224", gecode_constraint_dom_224, 5); +YAP_UserCPredicate("gecode_constraint_dom_239", gecode_constraint_dom_239, 5); +YAP_UserCPredicate("gecode_constraint_dom_242", gecode_constraint_dom_242, 5); +YAP_UserCPredicate("gecode_constraint_dom_219", gecode_constraint_dom_219, 6); +YAP_UserCPredicate("gecode_constraint_dom_225", gecode_constraint_dom_225, 6); +YAP_UserCPredicate("gecode_constraint_element_244", gecode_constraint_element_244, 4); +YAP_UserCPredicate("gecode_constraint_element_246", gecode_constraint_element_246, 4); +YAP_UserCPredicate("gecode_constraint_element_248", gecode_constraint_element_248, 4); +YAP_UserCPredicate("gecode_constraint_element_254", gecode_constraint_element_254, 4); +YAP_UserCPredicate("gecode_constraint_element_256", gecode_constraint_element_256, 4); +YAP_UserCPredicate("gecode_constraint_element_260", gecode_constraint_element_260, 4); +YAP_UserCPredicate("gecode_constraint_element_262", gecode_constraint_element_262, 4); +YAP_UserCPredicate("gecode_constraint_element_245", gecode_constraint_element_245, 5); +YAP_UserCPredicate("gecode_constraint_element_247", gecode_constraint_element_247, 5); +YAP_UserCPredicate("gecode_constraint_element_249", gecode_constraint_element_249, 5); +YAP_UserCPredicate("gecode_constraint_element_255", gecode_constraint_element_255, 5); +YAP_UserCPredicate("gecode_constraint_element_257", gecode_constraint_element_257, 5); +YAP_UserCPredicate("gecode_constraint_element_261", gecode_constraint_element_261, 5); +YAP_UserCPredicate("gecode_constraint_element_263", gecode_constraint_element_263, 5); +YAP_UserCPredicate("gecode_constraint_element_250", gecode_constraint_element_250, 7); +YAP_UserCPredicate("gecode_constraint_element_252", gecode_constraint_element_252, 7); +YAP_UserCPredicate("gecode_constraint_element_258", gecode_constraint_element_258, 7); +YAP_UserCPredicate("gecode_constraint_element_264", gecode_constraint_element_264, 7); +YAP_UserCPredicate("gecode_constraint_element_251", gecode_constraint_element_251, 8); +YAP_UserCPredicate("gecode_constraint_element_253", gecode_constraint_element_253, 8); +YAP_UserCPredicate("gecode_constraint_element_259", gecode_constraint_element_259, 8); +YAP_UserCPredicate("gecode_constraint_element_265", gecode_constraint_element_265, 8); +YAP_UserCPredicate("gecode_constraint_extensional_266", gecode_constraint_extensional_266, 3); +YAP_UserCPredicate("gecode_constraint_extensional_272", gecode_constraint_extensional_272, 3); +YAP_UserCPredicate("gecode_constraint_extensional_267", gecode_constraint_extensional_267, 4); +YAP_UserCPredicate("gecode_constraint_extensional_268", gecode_constraint_extensional_268, 4); +YAP_UserCPredicate("gecode_constraint_extensional_273", gecode_constraint_extensional_273, 4); +YAP_UserCPredicate("gecode_constraint_extensional_274", gecode_constraint_extensional_274, 4); +YAP_UserCPredicate("gecode_constraint_extensional_269", gecode_constraint_extensional_269, 5); +YAP_UserCPredicate("gecode_constraint_extensional_270", gecode_constraint_extensional_270, 5); +YAP_UserCPredicate("gecode_constraint_extensional_275", gecode_constraint_extensional_275, 5); +YAP_UserCPredicate("gecode_constraint_extensional_276", gecode_constraint_extensional_276, 5); +YAP_UserCPredicate("gecode_constraint_extensional_271", gecode_constraint_extensional_271, 6); +YAP_UserCPredicate("gecode_constraint_extensional_277", gecode_constraint_extensional_277, 6); +YAP_UserCPredicate("gecode_constraint_ite_278", gecode_constraint_ite_278, 5); +YAP_UserCPredicate("gecode_constraint_ite_280", gecode_constraint_ite_280, 5); +YAP_UserCPredicate("gecode_constraint_ite_281", gecode_constraint_ite_281, 5); +YAP_UserCPredicate("gecode_constraint_ite_283", gecode_constraint_ite_283, 5); +YAP_UserCPredicate("gecode_constraint_ite_279", gecode_constraint_ite_279, 6); +YAP_UserCPredicate("gecode_constraint_ite_282", gecode_constraint_ite_282, 6); +YAP_UserCPredicate("gecode_constraint_linear_284", gecode_constraint_linear_284, 4); +YAP_UserCPredicate("gecode_constraint_linear_288", gecode_constraint_linear_288, 4); +YAP_UserCPredicate("gecode_constraint_linear_296", gecode_constraint_linear_296, 4); +YAP_UserCPredicate("gecode_constraint_linear_298", gecode_constraint_linear_298, 4); +YAP_UserCPredicate("gecode_constraint_linear_316", gecode_constraint_linear_316, 4); +YAP_UserCPredicate("gecode_constraint_linear_320", gecode_constraint_linear_320, 4); +YAP_UserCPredicate("gecode_constraint_linear_285", gecode_constraint_linear_285, 5); +YAP_UserCPredicate("gecode_constraint_linear_286", gecode_constraint_linear_286, 5); +YAP_UserCPredicate("gecode_constraint_linear_289", gecode_constraint_linear_289, 5); +YAP_UserCPredicate("gecode_constraint_linear_290", gecode_constraint_linear_290, 5); +YAP_UserCPredicate("gecode_constraint_linear_292", gecode_constraint_linear_292, 5); +YAP_UserCPredicate("gecode_constraint_linear_294", gecode_constraint_linear_294, 5); +YAP_UserCPredicate("gecode_constraint_linear_297", gecode_constraint_linear_297, 5); +YAP_UserCPredicate("gecode_constraint_linear_299", gecode_constraint_linear_299, 5); +YAP_UserCPredicate("gecode_constraint_linear_300", gecode_constraint_linear_300, 5); +YAP_UserCPredicate("gecode_constraint_linear_304", gecode_constraint_linear_304, 5); +YAP_UserCPredicate("gecode_constraint_linear_308", gecode_constraint_linear_308, 5); +YAP_UserCPredicate("gecode_constraint_linear_312", gecode_constraint_linear_312, 5); +YAP_UserCPredicate("gecode_constraint_linear_317", gecode_constraint_linear_317, 5); +YAP_UserCPredicate("gecode_constraint_linear_318", gecode_constraint_linear_318, 5); +YAP_UserCPredicate("gecode_constraint_linear_321", gecode_constraint_linear_321, 5); +YAP_UserCPredicate("gecode_constraint_linear_322", gecode_constraint_linear_322, 5); +YAP_UserCPredicate("gecode_constraint_linear_287", gecode_constraint_linear_287, 6); +YAP_UserCPredicate("gecode_constraint_linear_291", gecode_constraint_linear_291, 6); +YAP_UserCPredicate("gecode_constraint_linear_293", gecode_constraint_linear_293, 6); +YAP_UserCPredicate("gecode_constraint_linear_295", gecode_constraint_linear_295, 6); +YAP_UserCPredicate("gecode_constraint_linear_301", gecode_constraint_linear_301, 6); +YAP_UserCPredicate("gecode_constraint_linear_302", gecode_constraint_linear_302, 6); +YAP_UserCPredicate("gecode_constraint_linear_305", gecode_constraint_linear_305, 6); +YAP_UserCPredicate("gecode_constraint_linear_306", gecode_constraint_linear_306, 6); +YAP_UserCPredicate("gecode_constraint_linear_309", gecode_constraint_linear_309, 6); +YAP_UserCPredicate("gecode_constraint_linear_310", gecode_constraint_linear_310, 6); +YAP_UserCPredicate("gecode_constraint_linear_313", gecode_constraint_linear_313, 6); +YAP_UserCPredicate("gecode_constraint_linear_314", gecode_constraint_linear_314, 6); +YAP_UserCPredicate("gecode_constraint_linear_319", gecode_constraint_linear_319, 6); +YAP_UserCPredicate("gecode_constraint_linear_323", gecode_constraint_linear_323, 6); +YAP_UserCPredicate("gecode_constraint_linear_303", gecode_constraint_linear_303, 7); +YAP_UserCPredicate("gecode_constraint_linear_307", gecode_constraint_linear_307, 7); +YAP_UserCPredicate("gecode_constraint_linear_311", gecode_constraint_linear_311, 7); +YAP_UserCPredicate("gecode_constraint_linear_315", gecode_constraint_linear_315, 7); +YAP_UserCPredicate("gecode_constraint_max_324", gecode_constraint_max_324, 4); +YAP_UserCPredicate("gecode_constraint_max_325", gecode_constraint_max_325, 4); +YAP_UserCPredicate("gecode_constraint_max_329", gecode_constraint_max_329, 4); +YAP_UserCPredicate("gecode_constraint_max_326", gecode_constraint_max_326, 5); +YAP_UserCPredicate("gecode_constraint_max_327", gecode_constraint_max_327, 3); +YAP_UserCPredicate("gecode_constraint_max_328", gecode_constraint_max_328, 3); +YAP_UserCPredicate("gecode_constraint_member_330", gecode_constraint_member_330, 3); +YAP_UserCPredicate("gecode_constraint_member_334", gecode_constraint_member_334, 3); +YAP_UserCPredicate("gecode_constraint_member_331", gecode_constraint_member_331, 4); +YAP_UserCPredicate("gecode_constraint_member_332", gecode_constraint_member_332, 4); +YAP_UserCPredicate("gecode_constraint_member_335", gecode_constraint_member_335, 4); +YAP_UserCPredicate("gecode_constraint_member_336", gecode_constraint_member_336, 4); +YAP_UserCPredicate("gecode_constraint_member_333", gecode_constraint_member_333, 5); +YAP_UserCPredicate("gecode_constraint_member_337", gecode_constraint_member_337, 5); +YAP_UserCPredicate("gecode_constraint_min_338", gecode_constraint_min_338, 4); +YAP_UserCPredicate("gecode_constraint_min_339", gecode_constraint_min_339, 4); +YAP_UserCPredicate("gecode_constraint_min_343", gecode_constraint_min_343, 4); +YAP_UserCPredicate("gecode_constraint_min_340", gecode_constraint_min_340, 5); +YAP_UserCPredicate("gecode_constraint_min_341", gecode_constraint_min_341, 3); +YAP_UserCPredicate("gecode_constraint_min_342", gecode_constraint_min_342, 3); +YAP_UserCPredicate("gecode_constraint_mod_344", gecode_constraint_mod_344, 4); +YAP_UserCPredicate("gecode_constraint_mod_345", gecode_constraint_mod_345, 5); +YAP_UserCPredicate("gecode_constraint_mult_346", gecode_constraint_mult_346, 4); +YAP_UserCPredicate("gecode_constraint_mult_347", gecode_constraint_mult_347, 4); +YAP_UserCPredicate("gecode_constraint_mult_348", gecode_constraint_mult_348, 5); +YAP_UserCPredicate("gecode_constraint_nooverlap_349", gecode_constraint_nooverlap_349, 5); +YAP_UserCPredicate("gecode_constraint_nooverlap_350", gecode_constraint_nooverlap_350, 6); +YAP_UserCPredicate("gecode_constraint_nooverlap_351", gecode_constraint_nooverlap_351, 6); +YAP_UserCPredicate("gecode_constraint_nooverlap_352", gecode_constraint_nooverlap_352, 7); +YAP_UserCPredicate("gecode_constraint_nooverlap_353", gecode_constraint_nooverlap_353, 7); +YAP_UserCPredicate("gecode_constraint_nooverlap_354", gecode_constraint_nooverlap_354, 8); +YAP_UserCPredicate("gecode_constraint_nooverlap_355", gecode_constraint_nooverlap_355, 8); +YAP_UserCPredicate("gecode_constraint_nooverlap_356", gecode_constraint_nooverlap_356, 9); +YAP_UserCPredicate("gecode_constraint_nroot_357", gecode_constraint_nroot_357, 4); +YAP_UserCPredicate("gecode_constraint_nroot_358", gecode_constraint_nroot_358, 4); +YAP_UserCPredicate("gecode_constraint_nroot_359", gecode_constraint_nroot_359, 5); +YAP_UserCPredicate("gecode_constraint_nvalues_360", gecode_constraint_nvalues_360, 4); +YAP_UserCPredicate("gecode_constraint_nvalues_362", gecode_constraint_nvalues_362, 4); +YAP_UserCPredicate("gecode_constraint_nvalues_364", gecode_constraint_nvalues_364, 4); +YAP_UserCPredicate("gecode_constraint_nvalues_366", gecode_constraint_nvalues_366, 4); +YAP_UserCPredicate("gecode_constraint_nvalues_361", gecode_constraint_nvalues_361, 5); +YAP_UserCPredicate("gecode_constraint_nvalues_363", gecode_constraint_nvalues_363, 5); +YAP_UserCPredicate("gecode_constraint_nvalues_365", gecode_constraint_nvalues_365, 5); +YAP_UserCPredicate("gecode_constraint_nvalues_367", gecode_constraint_nvalues_367, 5); +YAP_UserCPredicate("gecode_constraint_path_368", gecode_constraint_path_368, 6); +YAP_UserCPredicate("gecode_constraint_path_379", gecode_constraint_path_379, 6); +YAP_UserCPredicate("gecode_constraint_path_369", gecode_constraint_path_369, 7); +YAP_UserCPredicate("gecode_constraint_path_370", gecode_constraint_path_370, 7); +YAP_UserCPredicate("gecode_constraint_path_372", gecode_constraint_path_372, 7); +YAP_UserCPredicate("gecode_constraint_path_371", gecode_constraint_path_371, 8); +YAP_UserCPredicate("gecode_constraint_path_373", gecode_constraint_path_373, 8); +YAP_UserCPredicate("gecode_constraint_path_374", gecode_constraint_path_374, 8); +YAP_UserCPredicate("gecode_constraint_path_375", gecode_constraint_path_375, 9); +YAP_UserCPredicate("gecode_constraint_path_376", gecode_constraint_path_376, 4); +YAP_UserCPredicate("gecode_constraint_path_377", gecode_constraint_path_377, 5); +YAP_UserCPredicate("gecode_constraint_path_378", gecode_constraint_path_378, 5); +YAP_UserCPredicate("gecode_constraint_pow_380", gecode_constraint_pow_380, 4); +YAP_UserCPredicate("gecode_constraint_pow_381", gecode_constraint_pow_381, 4); +YAP_UserCPredicate("gecode_constraint_pow_382", gecode_constraint_pow_382, 5); +YAP_UserCPredicate("gecode_constraint_precede_383", gecode_constraint_precede_383, 3); +YAP_UserCPredicate("gecode_constraint_precede_384", gecode_constraint_precede_384, 4); +YAP_UserCPredicate("gecode_constraint_precede_385", gecode_constraint_precede_385, 4); +YAP_UserCPredicate("gecode_constraint_precede_386", gecode_constraint_precede_386, 5); +YAP_UserCPredicate("gecode_constraint_rel_387", gecode_constraint_rel_387, 4); +YAP_UserCPredicate("gecode_constraint_rel_389", gecode_constraint_rel_389, 4); +YAP_UserCPredicate("gecode_constraint_rel_395", gecode_constraint_rel_395, 4); +YAP_UserCPredicate("gecode_constraint_rel_399", gecode_constraint_rel_399, 4); +YAP_UserCPredicate("gecode_constraint_rel_403", gecode_constraint_rel_403, 4); +YAP_UserCPredicate("gecode_constraint_rel_405", gecode_constraint_rel_405, 4); +YAP_UserCPredicate("gecode_constraint_rel_407", gecode_constraint_rel_407, 4); +YAP_UserCPredicate("gecode_constraint_rel_411", gecode_constraint_rel_411, 4); +YAP_UserCPredicate("gecode_constraint_rel_415", gecode_constraint_rel_415, 4); +YAP_UserCPredicate("gecode_constraint_rel_417", gecode_constraint_rel_417, 4); +YAP_UserCPredicate("gecode_constraint_rel_419", gecode_constraint_rel_419, 4); +YAP_UserCPredicate("gecode_constraint_rel_421", gecode_constraint_rel_421, 4); +YAP_UserCPredicate("gecode_constraint_rel_423", gecode_constraint_rel_423, 4); +YAP_UserCPredicate("gecode_constraint_rel_426", gecode_constraint_rel_426, 4); +YAP_UserCPredicate("gecode_constraint_rel_427", gecode_constraint_rel_427, 4); +YAP_UserCPredicate("gecode_constraint_rel_429", gecode_constraint_rel_429, 4); +YAP_UserCPredicate("gecode_constraint_rel_431", gecode_constraint_rel_431, 4); +YAP_UserCPredicate("gecode_constraint_rel_433", gecode_constraint_rel_433, 4); +YAP_UserCPredicate("gecode_constraint_rel_434", gecode_constraint_rel_434, 4); +YAP_UserCPredicate("gecode_constraint_rel_435", gecode_constraint_rel_435, 4); +YAP_UserCPredicate("gecode_constraint_rel_437", gecode_constraint_rel_437, 4); +YAP_UserCPredicate("gecode_constraint_rel_440", gecode_constraint_rel_440, 4); +YAP_UserCPredicate("gecode_constraint_rel_441", gecode_constraint_rel_441, 4); +YAP_UserCPredicate("gecode_constraint_rel_443", gecode_constraint_rel_443, 4); +YAP_UserCPredicate("gecode_constraint_rel_445", gecode_constraint_rel_445, 4); +YAP_UserCPredicate("gecode_constraint_rel_447", gecode_constraint_rel_447, 4); +YAP_UserCPredicate("gecode_constraint_rel_388", gecode_constraint_rel_388, 5); +YAP_UserCPredicate("gecode_constraint_rel_390", gecode_constraint_rel_390, 5); +YAP_UserCPredicate("gecode_constraint_rel_391", gecode_constraint_rel_391, 5); +YAP_UserCPredicate("gecode_constraint_rel_393", gecode_constraint_rel_393, 5); +YAP_UserCPredicate("gecode_constraint_rel_396", gecode_constraint_rel_396, 5); +YAP_UserCPredicate("gecode_constraint_rel_397", gecode_constraint_rel_397, 5); +YAP_UserCPredicate("gecode_constraint_rel_400", gecode_constraint_rel_400, 5); +YAP_UserCPredicate("gecode_constraint_rel_401", gecode_constraint_rel_401, 5); +YAP_UserCPredicate("gecode_constraint_rel_404", gecode_constraint_rel_404, 5); +YAP_UserCPredicate("gecode_constraint_rel_406", gecode_constraint_rel_406, 5); +YAP_UserCPredicate("gecode_constraint_rel_408", gecode_constraint_rel_408, 5); +YAP_UserCPredicate("gecode_constraint_rel_409", gecode_constraint_rel_409, 5); +YAP_UserCPredicate("gecode_constraint_rel_412", gecode_constraint_rel_412, 5); +YAP_UserCPredicate("gecode_constraint_rel_413", gecode_constraint_rel_413, 5); +YAP_UserCPredicate("gecode_constraint_rel_416", gecode_constraint_rel_416, 5); +YAP_UserCPredicate("gecode_constraint_rel_418", gecode_constraint_rel_418, 5); +YAP_UserCPredicate("gecode_constraint_rel_420", gecode_constraint_rel_420, 5); +YAP_UserCPredicate("gecode_constraint_rel_422", gecode_constraint_rel_422, 5); +YAP_UserCPredicate("gecode_constraint_rel_424", gecode_constraint_rel_424, 5); +YAP_UserCPredicate("gecode_constraint_rel_428", gecode_constraint_rel_428, 5); +YAP_UserCPredicate("gecode_constraint_rel_430", gecode_constraint_rel_430, 5); +YAP_UserCPredicate("gecode_constraint_rel_432", gecode_constraint_rel_432, 5); +YAP_UserCPredicate("gecode_constraint_rel_436", gecode_constraint_rel_436, 5); +YAP_UserCPredicate("gecode_constraint_rel_438", gecode_constraint_rel_438, 5); +YAP_UserCPredicate("gecode_constraint_rel_442", gecode_constraint_rel_442, 5); +YAP_UserCPredicate("gecode_constraint_rel_444", gecode_constraint_rel_444, 5); +YAP_UserCPredicate("gecode_constraint_rel_446", gecode_constraint_rel_446, 5); +YAP_UserCPredicate("gecode_constraint_rel_448", gecode_constraint_rel_448, 5); +YAP_UserCPredicate("gecode_constraint_rel_392", gecode_constraint_rel_392, 6); +YAP_UserCPredicate("gecode_constraint_rel_394", gecode_constraint_rel_394, 6); +YAP_UserCPredicate("gecode_constraint_rel_398", gecode_constraint_rel_398, 6); +YAP_UserCPredicate("gecode_constraint_rel_402", gecode_constraint_rel_402, 6); +YAP_UserCPredicate("gecode_constraint_rel_410", gecode_constraint_rel_410, 6); +YAP_UserCPredicate("gecode_constraint_rel_414", gecode_constraint_rel_414, 6); +YAP_UserCPredicate("gecode_constraint_rel_425", gecode_constraint_rel_425, 3); +YAP_UserCPredicate("gecode_constraint_rel_439", gecode_constraint_rel_439, 3); +YAP_UserCPredicate("gecode_constraint_relax_449", gecode_constraint_relax_449, 5); +YAP_UserCPredicate("gecode_constraint_sequence_450", gecode_constraint_sequence_450, 6); +YAP_UserCPredicate("gecode_constraint_sequence_452", gecode_constraint_sequence_452, 6); +YAP_UserCPredicate("gecode_constraint_sequence_451", gecode_constraint_sequence_451, 7); +YAP_UserCPredicate("gecode_constraint_sequence_453", gecode_constraint_sequence_453, 7); +YAP_UserCPredicate("gecode_constraint_sorted_454", gecode_constraint_sorted_454, 3); +YAP_UserCPredicate("gecode_constraint_sorted_455", gecode_constraint_sorted_455, 4); +YAP_UserCPredicate("gecode_constraint_sorted_456", gecode_constraint_sorted_456, 4); +YAP_UserCPredicate("gecode_constraint_sorted_457", gecode_constraint_sorted_457, 5); +YAP_UserCPredicate("gecode_constraint_sqr_458", gecode_constraint_sqr_458, 3); +YAP_UserCPredicate("gecode_constraint_sqr_459", gecode_constraint_sqr_459, 3); +YAP_UserCPredicate("gecode_constraint_sqr_460", gecode_constraint_sqr_460, 4); +YAP_UserCPredicate("gecode_constraint_sqrt_461", gecode_constraint_sqrt_461, 3); +YAP_UserCPredicate("gecode_constraint_sqrt_462", gecode_constraint_sqrt_462, 3); +YAP_UserCPredicate("gecode_constraint_sqrt_463", gecode_constraint_sqrt_463, 4); +YAP_UserCPredicate("gecode_constraint_unary_464", gecode_constraint_unary_464, 3); +YAP_UserCPredicate("gecode_constraint_unary_465", gecode_constraint_unary_465, 4); +YAP_UserCPredicate("gecode_constraint_unary_466", gecode_constraint_unary_466, 4); +YAP_UserCPredicate("gecode_constraint_unary_468", gecode_constraint_unary_468, 4); +YAP_UserCPredicate("gecode_constraint_unary_472", gecode_constraint_unary_472, 4); +YAP_UserCPredicate("gecode_constraint_unary_467", gecode_constraint_unary_467, 5); +YAP_UserCPredicate("gecode_constraint_unary_469", gecode_constraint_unary_469, 5); +YAP_UserCPredicate("gecode_constraint_unary_470", gecode_constraint_unary_470, 5); +YAP_UserCPredicate("gecode_constraint_unary_473", gecode_constraint_unary_473, 5); +YAP_UserCPredicate("gecode_constraint_unary_474", gecode_constraint_unary_474, 5); +YAP_UserCPredicate("gecode_constraint_unary_471", gecode_constraint_unary_471, 6); +YAP_UserCPredicate("gecode_constraint_unary_475", gecode_constraint_unary_475, 6); +YAP_UserCPredicate("gecode_constraint_unshare_476", gecode_constraint_unshare_476, 2); +YAP_UserCPredicate("gecode_constraint_unshare_478", gecode_constraint_unshare_478, 2); +YAP_UserCPredicate("gecode_constraint_unshare_477", gecode_constraint_unshare_477, 3); +YAP_UserCPredicate("gecode_constraint_unshare_479", gecode_constraint_unshare_479, 3); +YAP_UserCPredicate("gecode_constraint_when_480", gecode_constraint_when_480, 3); +YAP_UserCPredicate("gecode_constraint_when_481", gecode_constraint_when_481, 4); +YAP_UserCPredicate("gecode_constraint_when_482", gecode_constraint_when_482, 4); +YAP_UserCPredicate("gecode_constraint_when_483", gecode_constraint_when_483, 5); diff --git a/packages/gecode/6.2.0/gecode-version.txt b/packages/gecode/6.2.0/gecode-version.txt new file mode 100644 index 000000000..6abaeb2f9 --- /dev/null +++ b/packages/gecode/6.2.0/gecode-version.txt @@ -0,0 +1 @@ +6.2.0 diff --git a/packages/gecode/6.2.0/gecode_yap_auto_generated.yap b/packages/gecode/6.2.0/gecode_yap_auto_generated.yap new file mode 100644 index 000000000..f56328b54 --- /dev/null +++ b/packages/gecode/6.2.0/gecode_yap_auto_generated.yap @@ -0,0 +1,3906 @@ +%% -*- prolog -*- +%%============================================================================= +%% Copyright (C) 2011 by Denys Duchier +%% +%% This program is free software: you can redistribute it and/or modify it +%% under the terms of the GNU Lesser General Public License as published by the +%% Free Software Foundation, either version 3 of the License, or (at your +%% option) any later version. +%% +%% This program is distributed in the hope that it will be useful, but WITHOUT +%% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +%% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +%% more details. +%% +%% You should have received a copy of the GNU Lesser General Public License +%% along with this program. If not, see . +%%============================================================================= + +is_RestartMode_('RM_NONE'). +is_RestartMode_('RM_CONSTANT'). +is_RestartMode_('RM_LINEAR'). +is_RestartMode_('RM_LUBY'). +is_RestartMode_('RM_GEOMETRIC'). + + +is_RestartMode_('RM_NONE','RM_NONE'). +is_RestartMode_('RM_CONSTANT','RM_CONSTANT'). +is_RestartMode_('RM_LINEAR','RM_LINEAR'). +is_RestartMode_('RM_LUBY','RM_LUBY'). +is_RestartMode_('RM_GEOMETRIC','RM_GEOMETRIC'). + + +is_RestartMode(X,Y) :- nonvar(X), is_RestartMode_(X,Y). +is_RestartMode(X) :- is_RestartMode_(X,_). + + +is_FloatRelType_('FRT_EQ'). +is_FloatRelType_('FRT_NQ'). +is_FloatRelType_('FRT_LQ'). +is_FloatRelType_('FRT_LE'). +is_FloatRelType_('FRT_GQ'). +is_FloatRelType_('FRT_GR'). + + +is_FloatRelType_('FRT_EQ','FRT_EQ'). +is_FloatRelType_('FRT_NQ','FRT_NQ'). +is_FloatRelType_('FRT_LQ','FRT_LQ'). +is_FloatRelType_('FRT_LE','FRT_LE'). +is_FloatRelType_('FRT_GQ','FRT_GQ'). +is_FloatRelType_('FRT_GR','FRT_GR'). + + +is_FloatRelType(X,Y) :- nonvar(X), is_FloatRelType_(X,Y). +is_FloatRelType(X) :- is_FloatRelType_(X,_). + + +is_ReifyMode_('RM_EQV'). +is_ReifyMode_('RM_IMP'). +is_ReifyMode_('RM_PMI'). + + +is_ReifyMode_('RM_EQV','RM_EQV'). +is_ReifyMode_('RM_IMP','RM_IMP'). +is_ReifyMode_('RM_PMI','RM_PMI'). + + +is_ReifyMode(X,Y) :- nonvar(X), is_ReifyMode_(X,Y). +is_ReifyMode(X) :- is_ReifyMode_(X,_). + + +is_IntRelType_('IRT_EQ'). +is_IntRelType_('IRT_NQ'). +is_IntRelType_('IRT_LQ'). +is_IntRelType_('IRT_LE'). +is_IntRelType_('IRT_GQ'). +is_IntRelType_('IRT_GR'). + + +is_IntRelType_('IRT_EQ','IRT_EQ'). +is_IntRelType_('IRT_NQ','IRT_NQ'). +is_IntRelType_('IRT_LQ','IRT_LQ'). +is_IntRelType_('IRT_LE','IRT_LE'). +is_IntRelType_('IRT_GQ','IRT_GQ'). +is_IntRelType_('IRT_GR','IRT_GR'). + + +is_IntRelType(X,Y) :- nonvar(X), is_IntRelType_(X,Y). +is_IntRelType(X) :- is_IntRelType_(X,_). + + +is_BoolOpType_('BOT_AND'). +is_BoolOpType_('BOT_OR'). +is_BoolOpType_('BOT_IMP'). +is_BoolOpType_('BOT_EQV'). +is_BoolOpType_('BOT_XOR'). + + +is_BoolOpType_('BOT_AND','BOT_AND'). +is_BoolOpType_('BOT_OR','BOT_OR'). +is_BoolOpType_('BOT_IMP','BOT_IMP'). +is_BoolOpType_('BOT_EQV','BOT_EQV'). +is_BoolOpType_('BOT_XOR','BOT_XOR'). + + +is_BoolOpType(X,Y) :- nonvar(X), is_BoolOpType_(X,Y). +is_BoolOpType(X) :- is_BoolOpType_(X,_). + + +is_IntPropLevel_('IPL_DEF'). +is_IntPropLevel_('IPL_VAL'). +is_IntPropLevel_('IPL_BND'). +is_IntPropLevel_('IPL_DOM'). +is_IntPropLevel_('IPL_BASIC'). +is_IntPropLevel_('IPL_ADVANCED'). +is_IntPropLevel_('IPL_BASIC_ADVANCED'). +is_IntPropLevel_('_IPL_BITS'). + + +is_IntPropLevel_('IPL_DEF','IPL_DEF'). +is_IntPropLevel_('IPL_VAL','IPL_VAL'). +is_IntPropLevel_('IPL_BND','IPL_BND'). +is_IntPropLevel_('IPL_DOM','IPL_DOM'). +is_IntPropLevel_('IPL_BASIC','IPL_BASIC'). +is_IntPropLevel_('IPL_ADVANCED','IPL_ADVANCED'). +is_IntPropLevel_('IPL_BASIC_ADVANCED','IPL_BASIC_ADVANCED'). +is_IntPropLevel_('_IPL_BITS','_IPL_BITS'). + + +is_IntPropLevel(X,Y) :- nonvar(X), is_IntPropLevel_(X,Y). +is_IntPropLevel(X) :- is_IntPropLevel_(X,_). + + +is_TaskType_('TT_FIXP'). +is_TaskType_('TT_FIXS'). +is_TaskType_('TT_FIXE'). + + +is_TaskType_('TT_FIXP','TT_FIXP'). +is_TaskType_('TT_FIXS','TT_FIXS'). +is_TaskType_('TT_FIXE','TT_FIXE'). + + +is_TaskType(X,Y) :- nonvar(X), is_TaskType_(X,Y). +is_TaskType(X) :- is_TaskType_(X,_). + + +is_TraceEvent_('TE_INIT'). +is_TraceEvent_('TE_PRUNE'). +is_TraceEvent_('TE_FIX'). +is_TraceEvent_('TE_FAIL'). +is_TraceEvent_('TE_DONE'). +is_TraceEvent_('TE_PROPAGATE'). +is_TraceEvent_('TE_COMMIT'). +is_TraceEvent_('TE_POST'). + + +is_TraceEvent_('TE_INIT','TE_INIT'). +is_TraceEvent_('TE_PRUNE','TE_PRUNE'). +is_TraceEvent_('TE_FIX','TE_FIX'). +is_TraceEvent_('TE_FAIL','TE_FAIL'). +is_TraceEvent_('TE_DONE','TE_DONE'). +is_TraceEvent_('TE_PROPAGATE','TE_PROPAGATE'). +is_TraceEvent_('TE_COMMIT','TE_COMMIT'). +is_TraceEvent_('TE_POST','TE_POST'). + + +is_TraceEvent(X,Y) :- nonvar(X), is_TraceEvent_(X,Y). +is_TraceEvent(X) :- is_TraceEvent_(X,_). + + +is_SetRelType_('SRT_EQ'). +is_SetRelType_('SRT_NQ'). +is_SetRelType_('SRT_SUB'). +is_SetRelType_('SRT_SUP'). +is_SetRelType_('SRT_DISJ'). +is_SetRelType_('SRT_CMPL'). +is_SetRelType_('SRT_LQ'). +is_SetRelType_('SRT_LE'). +is_SetRelType_('SRT_GQ'). +is_SetRelType_('SRT_GR'). + + +is_SetRelType_('SRT_EQ','SRT_EQ'). +is_SetRelType_('SRT_NQ','SRT_NQ'). +is_SetRelType_('SRT_SUB','SRT_SUB'). +is_SetRelType_('SRT_SUP','SRT_SUP'). +is_SetRelType_('SRT_DISJ','SRT_DISJ'). +is_SetRelType_('SRT_CMPL','SRT_CMPL'). +is_SetRelType_('SRT_LQ','SRT_LQ'). +is_SetRelType_('SRT_LE','SRT_LE'). +is_SetRelType_('SRT_GQ','SRT_GQ'). +is_SetRelType_('SRT_GR','SRT_GR'). + + +is_SetRelType(X,Y) :- nonvar(X), is_SetRelType_(X,Y). +is_SetRelType(X) :- is_SetRelType_(X,_). + + +is_SetOpType_('SOT_UNION'). +is_SetOpType_('SOT_DUNION'). +is_SetOpType_('SOT_INTER'). +is_SetOpType_('SOT_MINUS'). + + +is_SetOpType_('SOT_UNION','SOT_UNION'). +is_SetOpType_('SOT_DUNION','SOT_DUNION'). +is_SetOpType_('SOT_INTER','SOT_INTER'). +is_SetOpType_('SOT_MINUS','SOT_MINUS'). + + +is_SetOpType(X,Y) :- nonvar(X), is_SetOpType_(X,Y). +is_SetOpType(X) :- is_SetOpType_(X,_). + + +branch(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_std_function(X1,Y1) + -> gecode_constraint_branch_1(Y0,Y1) + ; throw(error(type_error('std::function'(X1)),gecode_argument_error(branch(X0,X1),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1),arg=1)))). + +convex(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_SetVar(X1,Y1) + -> gecode_constraint_convex_2(Y0,Y1) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(convex(X0,X1),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(convex(X0,X1),arg=1)))). + +convex(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_SetVar(X1,Y1) + -> (is_SetVar(X2,Y2) + -> gecode_constraint_convex_3(Y0,Y1,Y2) + ; throw(error(type_error('SetVar'(X2)),gecode_argument_error(convex(X0,X1,X2),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(convex(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(convex(X0,X1,X2),arg=1)))). + +abs(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_abs_4(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(abs(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_abs_5(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(abs(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(abs(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(abs(X0,X1,X2),arg=1)))). + +abs(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_abs_6(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(abs(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(abs(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(abs(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(abs(X0,X1,X2,X3),arg=1)))). + +argmax(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_argmax_7(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_argmax_11(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_argmax_13(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_argmax_17(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmax(X0,X1,X2,X3),arg=1)))). + +argmax(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> gecode_constraint_argmax_8(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_argmax_12(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> gecode_constraint_argmax_14(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_argmax_18(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmax(X0,X1,X2,X3,X4),arg=1)))). + +argmax(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_argmax_9(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_argmax_15(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmax(X0,X1,X2,X3,X4,X5),arg=1)))). + +argmax(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_argmax_10(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmax(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_argmax_16(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmax(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmax(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmax(X0,X1,X2),arg=1)))). + +argmin(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_argmin_19(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_argmin_23(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_argmin_25(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_argmin_29(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmin(X0,X1,X2,X3),arg=1)))). + +argmin(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> gecode_constraint_argmin_20(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_argmin_24(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> gecode_constraint_argmin_26(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_argmin_30(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmin(X0,X1,X2,X3,X4),arg=1)))). + +argmin(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_argmin_21(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_bool(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_argmin_27(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(bool(X4)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmin(X0,X1,X2,X3,X4,X5),arg=1)))). + +argmin(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_argmin_22(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmin(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_argmin_28(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(argmin(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(argmin(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(argmin(X0,X1,X2),arg=1)))). + +assign(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolAssign(X2,Y2) + -> gecode_constraint_assign_31(Y0,Y1,Y2) + ; throw(error(type_error('BoolAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatAssign(X2,Y2) + -> gecode_constraint_assign_57(Y0,Y1,Y2) + ; throw(error(type_error('FloatAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntAssign(X2,Y2) + -> gecode_constraint_assign_59(Y0,Y1,Y2) + ; throw(error(type_error('IntAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetAssign(X2,Y2) + -> gecode_constraint_assign_61(Y0,Y1,Y2) + ; throw(error(type_error('SetAssign'(X2)),gecode_argument_error(assign(X0,X1,X2),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(assign(X0,X1,X2),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(assign(X0,X1,X2),arg=1)))). + +assign(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolAssign(X2,Y2) + -> (is_BoolVarValPrint(X3,Y3) + -> gecode_constraint_assign_32(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolVarValPrint'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('BoolAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolAssign(X3,Y3) + -> gecode_constraint_assign_33(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolAssign(X3,Y3) + -> gecode_constraint_assign_36(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3))))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarBranch(X2,Y2) + -> (is_FloatAssign(X3,Y3) + -> gecode_constraint_assign_39(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; (is_FloatVarBranch(X2,Y2) + -> (is_FloatAssign(X3,Y3) + -> gecode_constraint_assign_42(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntAssign(X3,Y3) + -> gecode_constraint_assign_45(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntAssign(X3,Y3) + -> gecode_constraint_assign_48(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetAssign(X3,Y3) + -> gecode_constraint_assign_51(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetAssign(X3,Y3) + -> gecode_constraint_assign_54(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3))))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatAssign(X2,Y2) + -> (is_FloatVarValPrint(X3,Y3) + -> gecode_constraint_assign_58(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVarValPrint'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntAssign(X2,Y2) + -> (is_IntVarValPrint(X3,Y3) + -> gecode_constraint_assign_60(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVarValPrint'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetAssign(X2,Y2) + -> (is_SetVarValPrint(X3,Y3) + -> gecode_constraint_assign_62(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetVarValPrint'(X3)),gecode_argument_error(assign(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('SetAssign'(X2)),gecode_argument_error(assign(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(assign(X0,X1,X2,X3),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(assign(X0,X1,X2,X3),arg=1)))). + +assign(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolAssign(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> gecode_constraint_assign_34(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('BoolBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('BoolAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolAssign(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> gecode_constraint_assign_37(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('BoolAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=3))))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarBranch(X2,Y2) + -> (is_FloatAssign(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> gecode_constraint_assign_40(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; (is_FloatVarBranch(X2,Y2) + -> (is_FloatAssign(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> gecode_constraint_assign_43(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntAssign(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> gecode_constraint_assign_46(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntAssign(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> gecode_constraint_assign_49(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetAssign(X3,Y3) + -> (is_SetBranchFilter(X4,Y4) + -> gecode_constraint_assign_52(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('SetBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('SetAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetAssign(X3,Y3) + -> (is_SetBranchFilter(X4,Y4) + -> gecode_constraint_assign_55(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('SetBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('SetAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(assign(X0,X1,X2,X3,X4),arg=1)))). + +assign(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolAssign(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> (is_BoolVarValPrint(X5,Y5) + -> gecode_constraint_assign_35(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolVarValPrint'(X5)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('BoolBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('BoolAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolAssign(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> (is_IntVarValPrint(X5,Y5) + -> gecode_constraint_assign_38(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVarValPrint'(X5)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('BoolAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarBranch(X2,Y2) + -> (is_FloatAssign(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> (is_FloatVarValPrint(X5,Y5) + -> gecode_constraint_assign_41(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('FloatVarValPrint'(X5)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('FloatAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_FloatVarBranch(X2,Y2) + -> (is_FloatAssign(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> (is_FloatVarValPrint(X5,Y5) + -> gecode_constraint_assign_44(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('FloatVarValPrint'(X5)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('FloatAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntAssign(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> (is_IntVarValPrint(X5,Y5) + -> gecode_constraint_assign_47(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVarValPrint'(X5)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntAssign(X3,Y3) + -> (is_IntBranchFilter(X4,Y4) + -> (is_IntVarValPrint(X5,Y5) + -> gecode_constraint_assign_50(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVarValPrint'(X5)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetAssign(X3,Y3) + -> (is_SetBranchFilter(X4,Y4) + -> (is_SetVarValPrint(X5,Y5) + -> gecode_constraint_assign_53(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetVarValPrint'(X5)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('SetBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('SetAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetAssign(X3,Y3) + -> (is_SetBranchFilter(X4,Y4) + -> (is_SetVarValPrint(X5,Y5) + -> gecode_constraint_assign_56(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetVarValPrint'(X5)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('SetBranchFilter'(X4)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('SetAssign'(X3)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=3))))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(assign(X0,X1,X2,X3,X4,X5),arg=1)))). + +binpacking(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> gecode_constraint_binpacking_63(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(binpacking(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(binpacking(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(binpacking(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(binpacking(X0,X1,X2,X3),arg=1)))). + +binpacking(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_binpacking_64(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(binpacking(X0,X1,X2,X3,X4),arg=1)))). + +branch(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolValBranch(X2,Y2) + -> gecode_constraint_branch_65(Y0,Y1,Y2) + ; throw(error(type_error('BoolValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatValBranch(X2,Y2) + -> gecode_constraint_branch_109(Y0,Y1,Y2) + ; throw(error(type_error('FloatValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntValBranch(X2,Y2) + -> gecode_constraint_branch_111(Y0,Y1,Y2) + ; throw(error(type_error('IntValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetValBranch(X2,Y2) + -> gecode_constraint_branch_113(Y0,Y1,Y2) + ; throw(error(type_error('SetValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(branch(X0,X1,X2),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2),arg=1)))). + +branch(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolValBranch(X2,Y2) + -> (is_BoolVarValPrint(X3,Y3) + -> gecode_constraint_branch_66(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolVarValPrint'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('BoolValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> gecode_constraint_branch_67(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> gecode_constraint_branch_73(Y0,Y1,Y2,Y3) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3))))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> gecode_constraint_branch_79(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> gecode_constraint_branch_82(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> gecode_constraint_branch_88(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> gecode_constraint_branch_94(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> gecode_constraint_branch_100(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> gecode_constraint_branch_106(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3))))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatValBranch(X2,Y2) + -> (is_FloatVarValPrint(X3,Y3) + -> gecode_constraint_branch_110(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVarValPrint'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntValBranch(X2,Y2) + -> (is_IntVarValPrint(X3,Y3) + -> gecode_constraint_branch_112(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVarValPrint'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetValBranch(X2,Y2) + -> (is_SetVarValPrint(X3,Y3) + -> gecode_constraint_branch_114(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetVarValPrint'(X3)),gecode_argument_error(branch(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('SetValBranch'(X2)),gecode_argument_error(branch(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(branch(X0,X1,X2,X3),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2,X3),arg=1)))). + +branch(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> gecode_constraint_branch_68(Y0,Y1,Y2,Y3,Y4) + ; (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_70(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> gecode_constraint_branch_74(Y0,Y1,Y2,Y3,Y4) + ; (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_76(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=3))))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> gecode_constraint_branch_80(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> gecode_constraint_branch_83(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_85(Y0,Y1,Y2,Y3,Y4) + ; (is_IntBranchFilter(X4,Y4) + -> gecode_constraint_branch_89(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_91(Y0,Y1,Y2,Y3,Y4) + ; (is_IntBranchFilter(X4,Y4) + -> gecode_constraint_branch_95(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_97(Y0,Y1,Y2,Y3,Y4) + ; (is_SetBranchFilter(X4,Y4) + -> gecode_constraint_branch_101(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('SetBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> gecode_constraint_branch_103(Y0,Y1,Y2,Y3,Y4) + ; (is_SetBranchFilter(X4,Y4) + -> gecode_constraint_branch_107(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('SetBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2,X3,X4),arg=1)))). + +branch(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> (is_BoolVarValPrint(X5,Y5) + -> gecode_constraint_branch_69(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_Symmetries(X4,Y4) + -> (is_BoolBranchFilter(X5,Y5) + -> gecode_constraint_branch_71(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_BoolBranchFilter(X4,Y4) + -> (is_BoolVarValPrint(X5,Y5) + -> gecode_constraint_branch_75(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_Symmetries(X4,Y4) + -> (is_BoolBranchFilter(X5,Y5) + -> gecode_constraint_branch_77(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> (is_FloatVarValPrint(X5,Y5) + -> gecode_constraint_branch_81(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('FloatVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_FloatVarBranch(X2,Y2) + -> (is_FloatValBranch(X3,Y3) + -> (is_FloatBranchFilter(X4,Y4) + -> (is_FloatVarValPrint(X5,Y5) + -> gecode_constraint_branch_84(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('FloatVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('FloatBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('FloatValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_IntBranchFilter(X5,Y5) + -> gecode_constraint_branch_86(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_IntBranchFilter(X4,Y4) + -> (is_IntVarValPrint(X5,Y5) + -> gecode_constraint_branch_90(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_IntBranchFilter(X5,Y5) + -> gecode_constraint_branch_92(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_IntBranchFilter(X4,Y4) + -> (is_IntVarValPrint(X5,Y5) + -> gecode_constraint_branch_96(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_SetBranchFilter(X5,Y5) + -> gecode_constraint_branch_98(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_SetBranchFilter(X4,Y4) + -> (is_SetVarValPrint(X5,Y5) + -> gecode_constraint_branch_102(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('SetBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_SetBranchFilter(X5,Y5) + -> gecode_constraint_branch_104(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_SetBranchFilter(X4,Y4) + -> (is_SetVarValPrint(X5,Y5) + -> gecode_constraint_branch_108(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('SetVarValPrint'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('SetBranchFilter'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=3))))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5),arg=1)))). + +branch(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_BoolBranchFilter(X5,Y5) + -> (is_BoolVarValPrint(X6,Y6) + -> gecode_constraint_branch_72(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_BoolVarBranch(X2,Y2) + -> (is_BoolValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_BoolBranchFilter(X5,Y5) + -> (is_BoolVarValPrint(X6,Y6) + -> gecode_constraint_branch_78(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('BoolValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_IntBranchFilter(X5,Y5) + -> (is_IntVarValPrint(X6,Y6) + -> gecode_constraint_branch_87(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_IntVarBranch(X2,Y2) + -> (is_IntValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_IntBranchFilter(X5,Y5) + -> (is_IntVarValPrint(X6,Y6) + -> gecode_constraint_branch_93(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_SetBranchFilter(X5,Y5) + -> (is_SetVarValPrint(X6,Y6) + -> gecode_constraint_branch_99(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('SetVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('SetBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_SetVarBranch(X2,Y2) + -> (is_SetValBranch(X3,Y3) + -> (is_Symmetries(X4,Y4) + -> (is_SetBranchFilter(X5,Y5) + -> (is_SetVarValPrint(X6,Y6) + -> gecode_constraint_branch_105(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('SetVarValPrint'(X6)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('SetBranchFilter'(X5)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('Symmetries'(X4)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('SetValBranch'(X3)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TieBreak'(X2)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(branch(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +cardinality(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_SetVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_cardinality_115(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_cardinality_116(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cardinality(X0,X1,X2,X3),arg=1)))). + +channel(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_channel_117(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_channel_119(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_channel_122(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(channel(X0,X1,X2),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> gecode_constraint_channel_126(Y0,Y1,Y2) + ; (is_IntVar(X2,Y2) + -> gecode_constraint_channel_127(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2),arg=3))))) + ; throw(error(type_error('FloatVar'(X1)),gecode_argument_error(channel(X0,X1,X2),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(channel(X0,X1,X2),arg=1)))). + +channel(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_channel_118(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(channel(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_channel_120(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(channel(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_channel_123(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(channel(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(channel(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(channel(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(channel(X0,X1,X2,X3),arg=1)))). + +channel(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_channel_121(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_channel_124(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(channel(X0,X1,X2,X3,X4),arg=1)))). + +channel(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_channel_125(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(channel(X0,X1,X2,X3,X4,X5),arg=1)))). + +circuit(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_circuit_128(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_circuit_131(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=4))))) + ; (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_circuit_134(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2,X3,X4),arg=1)))). + +circuit(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_circuit_129(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntVar(X5,Y5) + -> gecode_constraint_circuit_132(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_circuit_135(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5),arg=1)))). + +circuit(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_circuit_130(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=3)))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_circuit_139(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error(int(X1)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2,X3),arg=1)))). + +circuit(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntVar(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_circuit_133(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +circuit(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> gecode_constraint_circuit_136(Y0,Y1) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(circuit(X0,X1),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1),arg=1)))). + +circuit(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntPropLevel(X2,Y2) + -> gecode_constraint_circuit_137(Y0,Y1,Y2) + ; throw(error(type_error('IntPropLevel'(X2)),gecode_argument_error(circuit(X0,X1,X2),arg=3)))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_circuit_138(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(circuit(X0,X1,X2),arg=3)))) + ; throw(error(type_error(int(X1)),gecode_argument_error(circuit(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(circuit(X0,X1,X2),arg=1)))). + +clause(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolOpType(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> gecode_constraint_clause_140(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_clause_142(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('BoolVarArgs'(X3)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('BoolOpType'(X1)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(clause(X0,X1,X2,X3,X4),arg=1)))). + +clause(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolOpType(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_clause_141(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_clause_143(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('BoolVarArgs'(X3)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('BoolOpType'(X1)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(clause(X0,X1,X2,X3,X4,X5),arg=1)))). + +count(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_count_144(Y0,Y1,Y2,Y3,Y4) + ; (is_IntVar(X4,Y4) + -> gecode_constraint_count_146(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntSetArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_count_149(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntSet(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_count_153(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_count_154(Y0,Y1,Y2,Y3,Y4) + ; (is_IntVar(X4,Y4) + -> gecode_constraint_count_156(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4))))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_count_159(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_count_162(Y0,Y1,Y2,Y3,Y4) + ; (is_IntVar(X4,Y4) + -> gecode_constraint_count_164(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_count_166(Y0,Y1,Y2,Y3,Y4) + ; (is_IntVar(X4,Y4) + -> gecode_constraint_count_168(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=3))))))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(count(X0,X1,X2,X3,X4),arg=1)))). + +count(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_145(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_147(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntSet(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_155(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_157(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_163(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_165(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_167(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_count_169(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=3))))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(count(X0,X1,X2,X3,X4,X5),arg=1)))). + +count(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntSetArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> gecode_constraint_count_148(Y0,Y1,Y2,Y3) + ; (is_IntPropLevel(X3,Y3) + -> gecode_constraint_count_151(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(count(X0,X1,X2,X3),arg=4))))) + ; (is_IntSet(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> gecode_constraint_count_152(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(count(X0,X1,X2,X3),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> gecode_constraint_count_158(Y0,Y1,Y2,Y3) + ; (is_IntPropLevel(X3,Y3) + -> gecode_constraint_count_161(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(count(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(count(X0,X1,X2,X3),arg=3)))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(count(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(count(X0,X1,X2,X3),arg=1)))). + +count(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntSetArgs(X2,Y2) + -> gecode_constraint_count_150(Y0,Y1,Y2) + ; (is_IntVarArgs(X2,Y2) + -> gecode_constraint_count_160(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(count(X0,X1,X2),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(count(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(count(X0,X1,X2),arg=1)))). + +cumulative(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_BoolVarArgs(X5,Y5) + -> gecode_constraint_cumulative_170(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_IntPropLevel(X5,Y5) + -> gecode_constraint_cumulative_173(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> gecode_constraint_cumulative_176(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=4))))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> gecode_constraint_cumulative_180(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_IntVar(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_BoolVarArgs(X5,Y5) + -> gecode_constraint_cumulative_182(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_IntPropLevel(X5,Y5) + -> gecode_constraint_cumulative_185(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> gecode_constraint_cumulative_188(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=4))))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> gecode_constraint_cumulative_192(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=3))))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5),arg=1)))). + +cumulative(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_BoolVarArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_171(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolVarArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> gecode_constraint_cumulative_174(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_177(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=4))))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> gecode_constraint_cumulative_178(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_181(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; (is_IntVar(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_BoolVarArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_183(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolVarArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> gecode_constraint_cumulative_186(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_189(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=4))))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> gecode_constraint_cumulative_190(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_IntPropLevel(X6,Y6) + -> gecode_constraint_cumulative_193(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +cumulative(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> gecode_constraint_cumulative_172(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> gecode_constraint_cumulative_184(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4),arg=1)))). + +cumulative(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_cumulative_175(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_cumulative_179(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=3))))) + ; (is_IntVar(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_cumulative_187(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; (is_TaskTypeArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_BoolVarArgs(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_cumulative_191(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVarArgs'(X6)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntArgs'(X5)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('TaskTypeArgs'(X2)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=3))))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulative(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +cumulatives(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_194(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_196(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_198(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_200(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_202(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_204(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_206(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> gecode_constraint_cumulatives_208(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_195(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_197(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_199(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_201(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_203(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_205(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_207(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; (is_IntVarArgs(X5,Y5) + -> (is_IntArgs(X6,Y6) + -> (is_bool(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_cumulatives_209(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error(bool(X7)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntArgs'(X6)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6))))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(cumulatives(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=1)))). + +distinct(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_distinct_210(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(distinct(X0,X1,X2),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_distinct_212(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(distinct(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> gecode_constraint_distinct_214(Y0,Y1,Y2) + ; (is_IntPropLevel(X2,Y2) + -> gecode_constraint_distinct_217(Y0,Y1,Y2) + ; throw(error(type_error('IntPropLevel'(X2)),gecode_argument_error(distinct(X0,X1,X2),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(distinct(X0,X1,X2),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(distinct(X0,X1,X2),arg=1)))). + +distinct(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_distinct_211(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_distinct_213(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_distinct_215(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(distinct(X0,X1,X2,X3),arg=1)))). + +distinct(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> gecode_constraint_distinct_216(Y0,Y1) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(distinct(X0,X1),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(distinct(X0,X1),arg=1)))). + +div(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_div_218(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(div(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(div(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_div_219(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(div(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(div(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(div(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(div(X0,X1,X2,X3),arg=1)))). + +div(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_div_220(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(div(X0,X1,X2,X3,X4),arg=1)))). + +divmod(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_divmod_221(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(divmod(X0,X1,X2,X3,X4),arg=1)))). + +divmod(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_divmod_222(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(divmod(X0,X1,X2,X3,X4,X5),arg=1)))). + +dom(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> gecode_constraint_dom_223(Y0,Y1,Y2) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> gecode_constraint_dom_225(Y0,Y1,Y2) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarArgs(X2,Y2) + -> gecode_constraint_dom_227(Y0,Y1,Y2) + ; (is_FloatVal(X2,Y2) + -> gecode_constraint_dom_229(Y0,Y1,Y2) + ; throw(error(type_error('FloatVal'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> gecode_constraint_dom_230(Y0,Y1,Y2) + ; (is_IntVarArgs(X2,Y2) + -> gecode_constraint_dom_232(Y0,Y1,Y2) + ; (is_int(X2,Y2) + -> gecode_constraint_dom_236(Y0,Y1,Y2) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarArgs(X2,Y2) + -> gecode_constraint_dom_238(Y0,Y1,Y2) + ; throw(error(type_error('SetVarArgs'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatVal(X2,Y2) + -> gecode_constraint_dom_244(Y0,Y1,Y2) + ; (is_FloatVar(X2,Y2) + -> gecode_constraint_dom_246(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3))))) + ; (is_IntVar(X1,Y1) + -> (is_IntSet(X2,Y2) + -> gecode_constraint_dom_247(Y0,Y1,Y2) + ; (is_int(X2,Y2) + -> gecode_constraint_dom_253(Y0,Y1,Y2) + ; (is_IntVar(X2,Y2) + -> gecode_constraint_dom_259(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))))) + ; (is_SetVar(X1,Y1) + -> (is_SetVar(X2,Y2) + -> gecode_constraint_dom_267(Y0,Y1,Y2) + ; throw(error(type_error('SetVar'(X2)),gecode_argument_error(dom(X0,X1,X2),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(dom(X0,X1,X2),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(dom(X0,X1,X2),arg=1)))). + +dom(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_224(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_226(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatNum(X2,Y2) + -> (is_FloatNum(X3,Y3) + -> gecode_constraint_dom_228(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatNum'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatNum'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_231(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_233(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_dom_234(Y0,Y1,Y2,Y3) + ; (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_237(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_IntSet(X3,Y3) + -> gecode_constraint_dom_239(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_dom_240(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatNum(X2,Y2) + -> (is_FloatNum(X3,Y3) + -> gecode_constraint_dom_242(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatNum'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; (is_FloatVal(X2,Y2) + -> (is_Reify(X3,Y3) + -> gecode_constraint_dom_245(Y0,Y1,Y2,Y3) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVal'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3))))) + ; (is_IntVar(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_248(Y0,Y1,Y2,Y3) + ; (is_Reify(X3,Y3) + -> gecode_constraint_dom_249(Y0,Y1,Y2,Y3) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4))))) + ; (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_dom_251(Y0,Y1,Y2,Y3) + ; (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_254(Y0,Y1,Y2,Y3) + ; (is_Reify(X3,Y3) + -> gecode_constraint_dom_257(Y0,Y1,Y2,Y3) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))))) + ; (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_dom_260(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))))) + ; (is_SetVar(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_IntSet(X3,Y3) + -> gecode_constraint_dom_261(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_dom_263(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(dom(X0,X1,X2,X3),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(dom(X0,X1,X2,X3),arg=1)))). + +dom(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_dom_235(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3)))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_dom_241(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatNum(X2,Y2) + -> (is_FloatNum(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_dom_243(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatNum'(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('FloatNum'(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_Reify(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_dom_250(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4)))) + ; (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_dom_252(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_dom_255(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5))))) + ; (is_Reify(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_dom_258(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3))))) + ; (is_SetVar(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_IntSet(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_dom_262(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_dom_264(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_dom_266(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=2)))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(dom(X0,X1,X2,X3,X4),arg=1)))). + +dom(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_dom_256(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_SetVar(X1,Y1) + -> (is_SetRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_Reify(X5,Y5) + -> gecode_constraint_dom_265(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(dom(X0,X1,X2,X3,X4,X5),arg=1)))). + +element(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_element_268(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_element_270(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_element_274(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_element_278(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(element(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_element_280(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_element_282(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_element_288(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(element(X0,X1,X2,X3),arg=4)))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(element(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(element(X0,X1,X2,X3),arg=1)))). + +element(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_269(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_271(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_275(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_279(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_281(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_283(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_element_289(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=4)))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(element(X0,X1,X2,X3,X4),arg=1)))). + +element(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_BoolVar(X6,Y6) + -> gecode_constraint_element_272(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('BoolVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_IntVar(X6,Y6) + -> gecode_constraint_element_276(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_BoolVar(X6,Y6) + -> gecode_constraint_element_284(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; (is_IntVar(X6,Y6) + -> gecode_constraint_element_286(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=7))))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +element(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_BoolVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_element_273(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('BoolVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_IntVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_element_277(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_int(X5,Y5) + -> (is_BoolVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_element_285(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; (is_IntVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_element_287(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=7))))) + ; throw(error(type_error(int(X5)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(element(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +extensional(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_extensional_290(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=4)))) + ; (is_DFA(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_extensional_295(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('DFA'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> gecode_constraint_extensional_296(Y0,Y1,Y2,Y3) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=4)))) + ; (is_DFA(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_extensional_301(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('DFA'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(extensional(X0,X1,X2,X3),arg=1)))). + +extensional(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_extensional_291(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_extensional_292(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_extensional_297(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_extensional_298(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(extensional(X0,X1,X2,X3,X4),arg=1)))). + +extensional(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_extensional_293(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_TupleSet(X2,Y2) + -> (is_bool(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_extensional_299(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(bool(X3)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('TupleSet'(X2)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(extensional(X0,X1,X2,X3,X4,X5),arg=1)))). + +extensional(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_DFA(X2,Y2) + -> gecode_constraint_extensional_294(Y0,Y1,Y2) + ; throw(error(type_error('DFA'(X2)),gecode_argument_error(extensional(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_DFA(X2,Y2) + -> gecode_constraint_extensional_300(Y0,Y1,Y2) + ; throw(error(type_error('DFA'(X2)),gecode_argument_error(extensional(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(extensional(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(extensional(X0,X1,X2),arg=1)))). + +ite(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> gecode_constraint_ite_302(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('BoolVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('BoolVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=4)))) + ; (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> (is_FloatVar(X4,Y4) + -> gecode_constraint_ite_304(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_ite_305(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=4)))) + ; (is_SetVar(X2,Y2) + -> (is_SetVar(X3,Y3) + -> (is_SetVar(X4,Y4) + -> gecode_constraint_ite_307(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('SetVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('SetVar'(X2)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=3))))))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(ite(X0,X1,X2,X3,X4),arg=1)))). + +ite(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_ite_303(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('BoolVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('BoolVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_ite_306(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=3))))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(ite(X0,X1,X2,X3,X4,X5),arg=1)))). + +linear(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_linear_308(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_linear_312(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> gecode_constraint_linear_320(Y0,Y1,Y2,Y3) + ; (is_FloatVar(X3,Y3) + -> gecode_constraint_linear_322(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_linear_340(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_linear_344(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(linear(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(linear(X0,X1,X2,X3),arg=1)))). + +linear(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_linear_309(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_linear_310(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_linear_313(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_linear_314(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3)))) + ; (is_FloatValArgs(X1,Y1) + -> (is_FloatVarArgs(X2,Y2) + -> (is_FloatRelType(X3,Y3) + -> (is_FloatVal(X4,Y4) + -> gecode_constraint_linear_316(Y0,Y1,Y2,Y3,Y4) + ; (is_FloatVar(X4,Y4) + -> gecode_constraint_linear_318(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('FloatVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('FloatRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('FloatVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_linear_321(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5)))) + ; (is_FloatVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_linear_323(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_linear_324(Y0,Y1,Y2,Y3,Y4) + ; (is_IntVar(X4,Y4) + -> gecode_constraint_linear_328(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> gecode_constraint_linear_332(Y0,Y1,Y2,Y3,Y4) + ; (is_IntVar(X4,Y4) + -> gecode_constraint_linear_336(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_linear_341(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_linear_342(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_linear_345(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_linear_346(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=2)))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(linear(X0,X1,X2,X3,X4),arg=1)))). + +linear(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_311(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_315(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_FloatValArgs(X1,Y1) + -> (is_FloatVarArgs(X2,Y2) + -> (is_FloatRelType(X3,Y3) + -> (is_FloatVal(X4,Y4) + -> (is_Reify(X5,Y5) + -> gecode_constraint_linear_317(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_FloatVar(X4,Y4) + -> (is_Reify(X5,Y5) + -> gecode_constraint_linear_319(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('FloatVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('FloatRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('FloatVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_325(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_Reify(X5,Y5) + -> gecode_constraint_linear_326(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6))))) + ; (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_329(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_Reify(X5,Y5) + -> gecode_constraint_linear_330(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_333(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_Reify(X5,Y5) + -> gecode_constraint_linear_334(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6))))) + ; (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_337(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_Reify(X5,Y5) + -> gecode_constraint_linear_338(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_343(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_linear_347(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=2))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5),arg=1)))). + +linear(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> (is_Reify(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_linear_327(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; (is_IntVar(X4,Y4) + -> (is_Reify(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_linear_331(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntRelType(X3,Y3) + -> (is_int(X4,Y4) + -> (is_Reify(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_linear_335(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; (is_IntVar(X4,Y4) + -> (is_Reify(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_linear_339(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('Reify'(X5)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=5))))) + ; throw(error(type_error('IntRelType'(X3)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(linear(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +max(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVarArgs(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_max_348(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(max(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_max_349(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(max(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(max(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(max(X0,X1,X2),arg=1)))). + +max(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_max_350(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(max(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(max(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_max_351(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(max(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(max(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_max_352(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(max(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(max(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(max(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(max(X0,X1,X2,X3),arg=1)))). + +max(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_max_353(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(max(X0,X1,X2,X3,X4),arg=1)))). + +member(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> gecode_constraint_member_354(Y0,Y1,Y2) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(member(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_member_358(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(member(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(member(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(member(X0,X1,X2),arg=1)))). + +member(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_member_355(Y0,Y1,Y2,Y3) + ; (is_Reify(X3,Y3) + -> gecode_constraint_member_356(Y0,Y1,Y2,Y3) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(member(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(member(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_member_359(Y0,Y1,Y2,Y3) + ; (is_Reify(X3,Y3) + -> gecode_constraint_member_360(Y0,Y1,Y2,Y3) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(member(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(member(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(member(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(member(X0,X1,X2,X3),arg=1)))). + +member(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_BoolVar(X2,Y2) + -> (is_Reify(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_member_357(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('BoolVar'(X2)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_Reify(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_member_361(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Reify'(X3)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(member(X0,X1,X2,X3,X4),arg=1)))). + +min(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVarArgs(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_min_362(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(min(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_min_363(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(min(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(min(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(min(X0,X1,X2),arg=1)))). + +min(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_min_364(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(min(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(min(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_min_365(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(min(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(min(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_min_366(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(min(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(min(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(min(X0,X1,X2,X3),arg=2)))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(min(X0,X1,X2,X3),arg=1)))). + +min(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_min_367(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(min(X0,X1,X2,X3,X4),arg=1)))). + +mod(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_mod_368(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(mod(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(mod(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(mod(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(mod(X0,X1,X2,X3),arg=1)))). + +mod(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_mod_369(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(mod(X0,X1,X2,X3,X4),arg=1)))). + +mult(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_mult_370(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(mult(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(mult(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_mult_371(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(mult(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(mult(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(mult(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(mult(X0,X1,X2,X3),arg=1)))). + +mult(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_mult_372(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(mult(X0,X1,X2,X3,X4),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_BoolVarArgs(X5,Y5) + -> gecode_constraint_nooverlap_373(Y0,Y1,Y2,Y3,Y4,Y5) + ; (is_IntPropLevel(X5,Y5) + -> gecode_constraint_nooverlap_376(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=6))))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> (is_BoolVarArgs(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_nooverlap_374(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolVarArgs'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntVarArgs(X5,Y5) + -> (is_IntVarArgs(X6,Y6) + -> gecode_constraint_nooverlap_379(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVarArgs'(X6)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntArgs(X4,Y4) + -> gecode_constraint_nooverlap_375(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntVarArgs(X5,Y5) + -> (is_IntVarArgs(X6,Y6) + -> (is_BoolVarArgs(X7,Y7) + -> gecode_constraint_nooverlap_377(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; (is_IntPropLevel(X7,Y7) + -> gecode_constraint_nooverlap_380(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=8))))) + ; throw(error(type_error('IntVarArgs'(X6)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVarArgs(X4,Y4) + -> (is_IntVarArgs(X5,Y5) + -> (is_IntVarArgs(X6,Y6) + -> (is_BoolVarArgs(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_nooverlap_378(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error('BoolVarArgs'(X7)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntVarArgs'(X6)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6)))) + ; throw(error(type_error('IntVarArgs'(X4)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nooverlap(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=1)))). + +nroot(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_nroot_381(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_nroot_382(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nroot(X0,X1,X2,X3),arg=1)))). + +nroot(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nroot_383(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nroot(X0,X1,X2,X3,X4),arg=1)))). + +nvalues(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_nvalues_384(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_nvalues_386(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_nvalues_388(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_nvalues_390(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nvalues(X0,X1,X2,X3),arg=1)))). + +nvalues(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nvalues_385(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nvalues_387(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nvalues_389(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_nvalues_391(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(nvalues(X0,X1,X2,X3,X4),arg=1)))). + +order(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_int(X4,Y4) + -> (is_BoolVar(X5,Y5) + -> gecode_constraint_order_392(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('BoolVar'(X5)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5),arg=1)))). + +order(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_int(X4,Y4) + -> (is_BoolVar(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_order_393(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('BoolVar'(X5)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5,X6),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(order(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +path(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVarArgs(X5,Y5) + -> (is_IntVar(X6,Y6) + -> gecode_constraint_path_394(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; (is_IntVar(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_path_397(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=6))))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVar(X5,Y5) + -> (is_IntVar(X6,Y6) + -> gecode_constraint_path_400(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +path(X0,X1,X2,X3,X4,X5,X6,X7) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVarArgs(X5,Y5) + -> (is_IntVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_path_395(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=7)))) + ; throw(error(type_error('IntVarArgs'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVar(X5,Y5) + -> (is_IntVarArgs(X6,Y6) + -> (is_IntVar(X7,Y7) + -> gecode_constraint_path_398(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntVar'(X7)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; (is_IntVar(X6,Y6) + -> (is_IntPropLevel(X7,Y7) + -> gecode_constraint_path_401(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7) + ; throw(error(type_error('IntPropLevel'(X7)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=8)))) + ; throw(error(type_error('IntVar'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=7))))) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=3))))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7),arg=1)))). + +path(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVar(X5,Y5) + -> gecode_constraint_path_396(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_path_405(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error(int(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5),arg=1)))). + +path(X0,X1,X2,X3,X4,X5,X6,X7,X8) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntVar(X4,Y4) + -> (is_IntVar(X5,Y5) + -> (is_IntVarArgs(X6,Y6) + -> (is_IntVar(X7,Y7) + -> (is_IntPropLevel(X8,Y8) + -> gecode_constraint_path_399(Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8) + ; throw(error(type_error('IntPropLevel'(X8)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=9)))) + ; throw(error(type_error('IntVar'(X7)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=8)))) + ; throw(error(type_error('IntVarArgs'(X6)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=7)))) + ; throw(error(type_error('IntVar'(X5)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=6)))) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=3)))) + ; throw(error(type_error('IntArgs'(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4,X5,X6,X7,X8),arg=1)))). + +path(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_path_402(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(path(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(path(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3),arg=1)))). + +path(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_path_403(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=3)))) + ; (is_int(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntVar(X4,Y4) + -> gecode_constraint_path_404(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntVar'(X4)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error(int(X1)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(path(X0,X1,X2,X3,X4),arg=1)))). + +pow(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_FloatVar(X3,Y3) + -> gecode_constraint_pow_406(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(pow(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(pow(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_pow_407(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(pow(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(pow(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(pow(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(pow(X0,X1,X2,X3),arg=1)))). + +pow(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_int(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_pow_408(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(pow(X0,X1,X2,X3,X4),arg=1)))). + +precede(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> gecode_constraint_precede_409(Y0,Y1,Y2) + ; throw(error(type_error('IntArgs'(X2)),gecode_argument_error(precede(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(precede(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(precede(X0,X1,X2),arg=1)))). + +precede(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_precede_410(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(precede(X0,X1,X2,X3),arg=4)))) + ; (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_precede_411(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(precede(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(precede(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(precede(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(precede(X0,X1,X2,X3),arg=1)))). + +precede(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_int(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_precede_412(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error(int(X2)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(precede(X0,X1,X2,X3,X4),arg=1)))). + +relax(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVarArgs(X1,Y1) + -> (is_FloatVarArgs(X2,Y2) + -> (is_Rnd(X3,Y3) + -> (is_double(X4,Y4) + -> gecode_constraint_relax_413(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(double(X4)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Rnd'(X3)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('FloatVarArgs'(X2)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=3)))) + ; (is_SetVarArgs(X1,Y1) + -> (is_SetVarArgs(X2,Y2) + -> (is_Rnd(X3,Y3) + -> (is_double(X4,Y4) + -> gecode_constraint_relax_414(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(double(X4)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('Rnd'(X3)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('SetVarArgs'(X2)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('SetVarArgs'(X1)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(relax(X0,X1,X2,X3,X4),arg=1)))). + +rel(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolOpType(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_rel_415(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_rel_417(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_rel_423(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_rel_427(Y0,Y1,Y2,Y3) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> gecode_constraint_rel_431(Y0,Y1,Y2,Y3) + ; (is_BoolVarArgs(X3,Y3) + -> gecode_constraint_rel_433(Y0,Y1,Y2,Y3) + ; (is_IntArgs(X3,Y3) + -> gecode_constraint_rel_435(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_rel_437(Y0,Y1,Y2,Y3) + ; (is_IntPropLevel(X3,Y3) + -> gecode_constraint_rel_440(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4)))))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVarArgs(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> gecode_constraint_rel_441(Y0,Y1,Y2,Y3) + ; (is_FloatVar(X3,Y3) + -> gecode_constraint_rel_442(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> gecode_constraint_rel_443(Y0,Y1,Y2,Y3) + ; (is_IntVarArgs(X3,Y3) + -> gecode_constraint_rel_445(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> gecode_constraint_rel_447(Y0,Y1,Y2,Y3) + ; (is_IntVarArgs(X3,Y3) + -> gecode_constraint_rel_449(Y0,Y1,Y2,Y3) + ; (is_int(X3,Y3) + -> gecode_constraint_rel_451(Y0,Y1,Y2,Y3) + ; (is_IntPropLevel(X3,Y3) + -> gecode_constraint_rel_454(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_rel_455(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4)))))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> gecode_constraint_rel_457(Y0,Y1,Y2,Y3) + ; (is_FloatVar(X3,Y3) + -> gecode_constraint_rel_459(Y0,Y1,Y2,Y3) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> gecode_constraint_rel_461(Y0,Y1,Y2,Y3) + ; (is_IntVar(X3,Y3) + -> gecode_constraint_rel_465(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; (is_SetRelType(X2,Y2) + -> (is_SetVar(X3,Y3) + -> gecode_constraint_rel_469(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3))))) + ; (is_SetVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_rel_471(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4)))) + ; (is_SetRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> gecode_constraint_rel_473(Y0,Y1,Y2,Y3) + ; (is_SetVar(X3,Y3) + -> gecode_constraint_rel_475(Y0,Y1,Y2,Y3) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3),arg=3))))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(rel(X0,X1,X2,X3),arg=2)))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(rel(X0,X1,X2,X3),arg=1)))). + +rel(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolOpType(X1,Y1) + -> (is_BoolVarArgs(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_416(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_418(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('BoolVarArgs'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_BoolVar(X1,Y1) + -> (is_BoolOpType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> gecode_constraint_rel_419(Y0,Y1,Y2,Y3,Y4) + ; (is_int(X4,Y4) + -> gecode_constraint_rel_421(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error(int(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('BoolVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_424(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_rel_425(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_428(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_rel_429(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3))))) + ; (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_432(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_BoolVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_434(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_436(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_438(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_444(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_446(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_448(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_450(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_452(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_456(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_FloatVar(X1,Y1) + -> (is_FloatRelType(X2,Y2) + -> (is_FloatVal(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_458(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_FloatVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_460(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('FloatVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('FloatRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_462(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_rel_463(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; (is_IntVar(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_rel_466(Y0,Y1,Y2,Y3,Y4) + ; (is_Reify(X4,Y4) + -> gecode_constraint_rel_467(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; (is_SetRelType(X2,Y2) + -> (is_SetVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_470(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3))))) + ; (is_SetVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_472(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4)))) + ; (is_SetRelType(X2,Y2) + -> (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_474(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; (is_SetVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> gecode_constraint_rel_476(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('SetVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=4))))) + ; throw(error(type_error('SetRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=3))))) + ; throw(error(type_error('SetVar'(X1)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=2))))))))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(rel(X0,X1,X2,X3,X4),arg=1)))). + +rel(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_BoolOpType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_BoolVar(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_420(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; (is_int(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_422(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5))))) + ; throw(error(type_error('BoolVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=4)))) + ; (is_IntRelType(X2,Y2) + -> (is_BoolVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_426(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_430(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=3))))) + ; (is_IntVar(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> (is_int(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_464(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; (is_IntVar(X3,Y3) + -> (is_Reify(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_rel_468(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('Reify'(X4)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVar'(X3)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=4))))) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(rel(X0,X1,X2,X3,X4,X5),arg=1)))). + +rel(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> gecode_constraint_rel_439(Y0,Y1,Y2) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntRelType(X2,Y2) + -> gecode_constraint_rel_453(Y0,Y1,Y2) + ; throw(error(type_error('IntRelType'(X2)),gecode_argument_error(rel(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(rel(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(rel(X0,X1,X2),arg=1)))). + +sequence(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_int(X5,Y5) + -> gecode_constraint_sequence_477(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error(int(X5)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntSet'(X2)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_int(X5,Y5) + -> gecode_constraint_sequence_479(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error(int(X5)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntSet'(X2)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5),arg=1)))). + +sequence(X0,X1,X2,X3,X4,X5,X6) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_int(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_sequence_478(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntSet'(X2)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntSet(X2,Y2) + -> (is_int(X3,Y3) + -> (is_int(X4,Y4) + -> (is_int(X5,Y5) + -> (is_IntPropLevel(X6,Y6) + -> gecode_constraint_sequence_480(Y0,Y1,Y2,Y3,Y4,Y5,Y6) + ; throw(error(type_error('IntPropLevel'(X6)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=7)))) + ; throw(error(type_error(int(X5)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=6)))) + ; throw(error(type_error(int(X4)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=5)))) + ; throw(error(type_error(int(X3)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=4)))) + ; throw(error(type_error('IntSet'(X2)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sequence(X0,X1,X2,X3,X4,X5,X6),arg=1)))). + +sorted(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> gecode_constraint_sorted_481(Y0,Y1,Y2,Y3) + ; (is_IntPropLevel(X3,Y3) + -> gecode_constraint_sorted_484(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(sorted(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(sorted(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sorted(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sorted(X0,X1,X2,X3),arg=1)))). + +sorted(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_sorted_482(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sorted(X0,X1,X2,X3,X4),arg=1)))). + +sorted(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> gecode_constraint_sorted_483(Y0,Y1,Y2) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(sorted(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(sorted(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sorted(X0,X1,X2),arg=1)))). + +sqr(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_sqr_485(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(sqr(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_sqr_486(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(sqr(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(sqr(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sqr(X0,X1,X2),arg=1)))). + +sqr(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_sqr_487(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(sqr(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(sqr(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(sqr(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sqr(X0,X1,X2,X3),arg=1)))). + +sqrt(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_FloatVar(X1,Y1) + -> (is_FloatVar(X2,Y2) + -> gecode_constraint_sqrt_488(Y0,Y1,Y2) + ; throw(error(type_error('FloatVar'(X2)),gecode_argument_error(sqrt(X0,X1,X2),arg=3)))) + ; (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> gecode_constraint_sqrt_489(Y0,Y1,Y2) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(sqrt(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(sqrt(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sqrt(X0,X1,X2),arg=1)))). + +sqrt(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVar(X1,Y1) + -> (is_IntVar(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_sqrt_490(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(sqrt(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVar'(X2)),gecode_argument_error(sqrt(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('IntVar'(X1)),gecode_argument_error(sqrt(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(sqrt(X0,X1,X2,X3),arg=1)))). + +unary(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> gecode_constraint_unary_491(Y0,Y1,Y2,Y3) + ; (is_IntPropLevel(X3,Y3) + -> gecode_constraint_unary_494(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntPropLevel'(X3)),gecode_argument_error(unary(X0,X1,X2,X3),arg=4))))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> gecode_constraint_unary_497(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3),arg=3))))) + ; (is_TaskTypeArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> gecode_constraint_unary_501(Y0,Y1,Y2,Y3) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('TaskTypeArgs'(X1)),gecode_argument_error(unary(X0,X1,X2,X3),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unary(X0,X1,X2,X3),arg=1)))). + +unary(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> (is_BoolVarArgs(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_unary_492(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('BoolVarArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=4)))) + ; (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_BoolVarArgs(X4,Y4) + -> gecode_constraint_unary_495(Y0,Y1,Y2,Y3,Y4) + ; (is_IntPropLevel(X4,Y4) + -> gecode_constraint_unary_498(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=3))))) + ; (is_TaskTypeArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_BoolVarArgs(X4,Y4) + -> gecode_constraint_unary_499(Y0,Y1,Y2,Y3,Y4) + ; (is_IntPropLevel(X4,Y4) + -> gecode_constraint_unary_502(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=5))))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('TaskTypeArgs'(X1)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unary(X0,X1,X2,X3,X4),arg=1)))). + +unary(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntArgs(X2,Y2) + -> gecode_constraint_unary_493(Y0,Y1,Y2) + ; throw(error(type_error('IntArgs'(X2)),gecode_argument_error(unary(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(unary(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unary(X0,X1,X2),arg=1)))). + +unary(X0,X1,X2,X3,X4,X5) :- + (is_Space_or_Clause(X0,Y0) + -> (is_IntVarArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntVarArgs(X3,Y3) + -> (is_BoolVarArgs(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_unary_496(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('BoolVarArgs'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntVarArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=3)))) + ; (is_TaskTypeArgs(X1,Y1) + -> (is_IntVarArgs(X2,Y2) + -> (is_IntArgs(X3,Y3) + -> (is_BoolVarArgs(X4,Y4) + -> (is_IntPropLevel(X5,Y5) + -> gecode_constraint_unary_500(Y0,Y1,Y2,Y3,Y4,Y5) + ; throw(error(type_error('IntPropLevel'(X5)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=6)))) + ; throw(error(type_error('BoolVarArgs'(X4)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=5)))) + ; throw(error(type_error('IntArgs'(X3)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=4)))) + ; throw(error(type_error('IntVarArgs'(X2)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=3)))) + ; throw(error(type_error('TaskTypeArgs'(X1)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unary(X0,X1,X2,X3,X4,X5),arg=1)))). + +unshare(X0,X1) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> gecode_constraint_unshare_503(Y0,Y1) + ; (is_IntVarArgs(X1,Y1) + -> gecode_constraint_unshare_505(Y0,Y1) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(unshare(X0,X1),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unshare(X0,X1),arg=1)))). + +unshare(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVarArgs(X1,Y1) + -> (is_IntPropLevel(X2,Y2) + -> gecode_constraint_unshare_504(Y0,Y1,Y2) + ; throw(error(type_error('IntPropLevel'(X2)),gecode_argument_error(unshare(X0,X1,X2),arg=3)))) + ; (is_IntVarArgs(X1,Y1) + -> (is_IntPropLevel(X2,Y2) + -> gecode_constraint_unshare_506(Y0,Y1,Y2) + ; throw(error(type_error('IntPropLevel'(X2)),gecode_argument_error(unshare(X0,X1,X2),arg=3)))) + ; throw(error(type_error('IntVarArgs'(X1)),gecode_argument_error(unshare(X0,X1,X2),arg=2))))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(unshare(X0,X1,X2),arg=1)))). + +when(X0,X1,X2) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_std_function(X2,Y2) + -> gecode_constraint_when_507(Y0,Y1,Y2) + ; throw(error(type_error('std::function'(X2)),gecode_argument_error(when(X0,X1,X2),arg=3)))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(when(X0,X1,X2),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(when(X0,X1,X2),arg=1)))). + +when(X0,X1,X2,X3) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_std_function(X2,Y2) + -> (is_IntPropLevel(X3,Y3) + -> gecode_constraint_when_508(Y0,Y1,Y2,Y3) + ; (is_std_function(X3,Y3) + -> gecode_constraint_when_509(Y0,Y1,Y2,Y3) + ; throw(error(type_error('std::function'(X3)),gecode_argument_error(when(X0,X1,X2,X3),arg=4))))) + ; throw(error(type_error('std::function'(X2)),gecode_argument_error(when(X0,X1,X2,X3),arg=3)))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(when(X0,X1,X2,X3),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(when(X0,X1,X2,X3),arg=1)))). + +when(X0,X1,X2,X3,X4) :- + (is_Space_or_Clause(X0,Y0) + -> (is_BoolVar(X1,Y1) + -> (is_std_function(X2,Y2) + -> (is_std_function(X3,Y3) + -> (is_IntPropLevel(X4,Y4) + -> gecode_constraint_when_510(Y0,Y1,Y2,Y3,Y4) + ; throw(error(type_error('IntPropLevel'(X4)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=5)))) + ; throw(error(type_error('std::function'(X3)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=4)))) + ; throw(error(type_error('std::function'(X2)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=3)))) + ; throw(error(type_error('BoolVar'(X1)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=2)))) + ; throw(error(type_error('Space'(X0)),gecode_argument_error(when(X0,X1,X2,X3,X4),arg=1)))). + diff --git a/packages/gecode/6.2.0/gecode_yap_cc_forward_auto_generated.icc b/packages/gecode/6.2.0/gecode_yap_cc_forward_auto_generated.icc new file mode 100644 index 000000000..dd1196994 --- /dev/null +++ b/packages/gecode/6.2.0/gecode_yap_cc_forward_auto_generated.icc @@ -0,0 +1,28 @@ +// -*- c++ -*- +//============================================================================= +// Copyright (C) 2011 by Denys Duchier +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published by the +// Free Software Foundation, either version 3 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +//============================================================================= + +static RestartMode gecode_RestartMode_from_term(YAP_Term); +static FloatRelType gecode_FloatRelType_from_term(YAP_Term); +static ReifyMode gecode_ReifyMode_from_term(YAP_Term); +static IntRelType gecode_IntRelType_from_term(YAP_Term); +static BoolOpType gecode_BoolOpType_from_term(YAP_Term); +static IntPropLevel gecode_IntPropLevel_from_term(YAP_Term); +static TaskType gecode_TaskType_from_term(YAP_Term); +static TraceEvent gecode_TraceEvent_from_term(YAP_Term); +static SetRelType gecode_SetRelType_from_term(YAP_Term); +static SetOpType gecode_SetOpType_from_term(YAP_Term); diff --git a/packages/gecode/6.2.0/gecode_yap_cc_impl_auto_generated.icc b/packages/gecode/6.2.0/gecode_yap_cc_impl_auto_generated.icc new file mode 100644 index 000000000..3b306cf25 --- /dev/null +++ b/packages/gecode/6.2.0/gecode_yap_cc_impl_auto_generated.icc @@ -0,0 +1,5768 @@ +// -*- c++ -*- +//============================================================================= +// Copyright (C) 2011 by Denys Duchier +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published by the +// Free Software Foundation, either version 3 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +//============================================================================= + +static YAP_Term gecode_RM_NONE; +static YAP_Term gecode_RM_CONSTANT; +static YAP_Term gecode_RM_LINEAR; +static YAP_Term gecode_RM_LUBY; +static YAP_Term gecode_RM_GEOMETRIC; + +static RestartMode gecode_RestartMode_from_term(YAP_Term X) +{ + if (X==gecode_RM_NONE) return RM_NONE; + if (X==gecode_RM_CONSTANT) return RM_CONSTANT; + if (X==gecode_RM_LINEAR) return RM_LINEAR; + if (X==gecode_RM_LUBY) return RM_LUBY; + if (X==gecode_RM_GEOMETRIC) return RM_GEOMETRIC; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_FRT_EQ; +static YAP_Term gecode_FRT_NQ; +static YAP_Term gecode_FRT_LQ; +static YAP_Term gecode_FRT_LE; +static YAP_Term gecode_FRT_GQ; +static YAP_Term gecode_FRT_GR; + +static FloatRelType gecode_FloatRelType_from_term(YAP_Term X) +{ + if (X==gecode_FRT_EQ) return FRT_EQ; + if (X==gecode_FRT_NQ) return FRT_NQ; + if (X==gecode_FRT_LQ) return FRT_LQ; + if (X==gecode_FRT_LE) return FRT_LE; + if (X==gecode_FRT_GQ) return FRT_GQ; + if (X==gecode_FRT_GR) return FRT_GR; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_RM_EQV; +static YAP_Term gecode_RM_IMP; +static YAP_Term gecode_RM_PMI; + +static ReifyMode gecode_ReifyMode_from_term(YAP_Term X) +{ + if (X==gecode_RM_EQV) return RM_EQV; + if (X==gecode_RM_IMP) return RM_IMP; + if (X==gecode_RM_PMI) return RM_PMI; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_IRT_EQ; +static YAP_Term gecode_IRT_NQ; +static YAP_Term gecode_IRT_LQ; +static YAP_Term gecode_IRT_LE; +static YAP_Term gecode_IRT_GQ; +static YAP_Term gecode_IRT_GR; + +static IntRelType gecode_IntRelType_from_term(YAP_Term X) +{ + if (X==gecode_IRT_EQ) return IRT_EQ; + if (X==gecode_IRT_NQ) return IRT_NQ; + if (X==gecode_IRT_LQ) return IRT_LQ; + if (X==gecode_IRT_LE) return IRT_LE; + if (X==gecode_IRT_GQ) return IRT_GQ; + if (X==gecode_IRT_GR) return IRT_GR; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_BOT_AND; +static YAP_Term gecode_BOT_OR; +static YAP_Term gecode_BOT_IMP; +static YAP_Term gecode_BOT_EQV; +static YAP_Term gecode_BOT_XOR; + +static BoolOpType gecode_BoolOpType_from_term(YAP_Term X) +{ + if (X==gecode_BOT_AND) return BOT_AND; + if (X==gecode_BOT_OR) return BOT_OR; + if (X==gecode_BOT_IMP) return BOT_IMP; + if (X==gecode_BOT_EQV) return BOT_EQV; + if (X==gecode_BOT_XOR) return BOT_XOR; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_IPL_DEF; +static YAP_Term gecode_IPL_VAL; +static YAP_Term gecode_IPL_BND; +static YAP_Term gecode_IPL_DOM; +static YAP_Term gecode_IPL_BASIC; +static YAP_Term gecode_IPL_ADVANCED; +static YAP_Term gecode_IPL_BASIC_ADVANCED; +static YAP_Term gecode__IPL_BITS; + +static IntPropLevel gecode_IntPropLevel_from_term(YAP_Term X) +{ + if (X==gecode_IPL_DEF) return IPL_DEF; + if (X==gecode_IPL_VAL) return IPL_VAL; + if (X==gecode_IPL_BND) return IPL_BND; + if (X==gecode_IPL_DOM) return IPL_DOM; + if (X==gecode_IPL_BASIC) return IPL_BASIC; + if (X==gecode_IPL_ADVANCED) return IPL_ADVANCED; + if (X==gecode_IPL_BASIC_ADVANCED) return IPL_BASIC_ADVANCED; + if (X==gecode__IPL_BITS) return _IPL_BITS; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_TT_FIXP; +static YAP_Term gecode_TT_FIXS; +static YAP_Term gecode_TT_FIXE; + +static TaskType gecode_TaskType_from_term(YAP_Term X) +{ + if (X==gecode_TT_FIXP) return TT_FIXP; + if (X==gecode_TT_FIXS) return TT_FIXS; + if (X==gecode_TT_FIXE) return TT_FIXE; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_TE_INIT; +static YAP_Term gecode_TE_PRUNE; +static YAP_Term gecode_TE_FIX; +static YAP_Term gecode_TE_FAIL; +static YAP_Term gecode_TE_DONE; +static YAP_Term gecode_TE_PROPAGATE; +static YAP_Term gecode_TE_COMMIT; +static YAP_Term gecode_TE_POST; + +static TraceEvent gecode_TraceEvent_from_term(YAP_Term X) +{ + if (X==gecode_TE_INIT) return TE_INIT; + if (X==gecode_TE_PRUNE) return TE_PRUNE; + if (X==gecode_TE_FIX) return TE_FIX; + if (X==gecode_TE_FAIL) return TE_FAIL; + if (X==gecode_TE_DONE) return TE_DONE; + if (X==gecode_TE_PROPAGATE) return TE_PROPAGATE; + if (X==gecode_TE_COMMIT) return TE_COMMIT; + if (X==gecode_TE_POST) return TE_POST; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_SRT_EQ; +static YAP_Term gecode_SRT_NQ; +static YAP_Term gecode_SRT_SUB; +static YAP_Term gecode_SRT_SUP; +static YAP_Term gecode_SRT_DISJ; +static YAP_Term gecode_SRT_CMPL; +static YAP_Term gecode_SRT_LQ; +static YAP_Term gecode_SRT_LE; +static YAP_Term gecode_SRT_GQ; +static YAP_Term gecode_SRT_GR; + +static SetRelType gecode_SetRelType_from_term(YAP_Term X) +{ + if (X==gecode_SRT_EQ) return SRT_EQ; + if (X==gecode_SRT_NQ) return SRT_NQ; + if (X==gecode_SRT_SUB) return SRT_SUB; + if (X==gecode_SRT_SUP) return SRT_SUP; + if (X==gecode_SRT_DISJ) return SRT_DISJ; + if (X==gecode_SRT_CMPL) return SRT_CMPL; + if (X==gecode_SRT_LQ) return SRT_LQ; + if (X==gecode_SRT_LE) return SRT_LE; + if (X==gecode_SRT_GQ) return SRT_GQ; + if (X==gecode_SRT_GR) return SRT_GR; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Term gecode_SOT_UNION; +static YAP_Term gecode_SOT_DUNION; +static YAP_Term gecode_SOT_INTER; +static YAP_Term gecode_SOT_MINUS; + +static SetOpType gecode_SetOpType_from_term(YAP_Term X) +{ + if (X==gecode_SOT_UNION) return SOT_UNION; + if (X==gecode_SOT_DUNION) return SOT_DUNION; + if (X==gecode_SOT_INTER) return SOT_INTER; + if (X==gecode_SOT_MINUS) return SOT_MINUS; + cerr << "this should never happen" << endl; exit(1); +} + +static YAP_Bool gecode_constraint_branch_1(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + std::function X2 = gecode_std_function_from_term(YAP_ARG2); + branch(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_convex_2(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + convex(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_convex_3(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetVar X3 = gecode_SetVar_from_term(space,YAP_ARG3); + convex(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_abs_4(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + abs(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_abs_5(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + abs(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_abs_6(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + abs(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_7(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + argmax(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_11(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + argmax(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_13(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + argmax(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_17(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + argmax(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_8(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + argmax(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_12(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + argmax(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_14(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + argmax(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_18(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + argmax(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_9(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + argmax(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_15(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + argmax(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_10(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + argmax(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmax_16(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + argmax(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_19(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + argmin(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_23(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + argmin(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_25(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + argmin(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_29(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + argmin(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_20(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + argmin(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_24(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + argmin(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_26(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + argmin(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_30(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + argmin(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_21(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + argmin(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_27(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + bool X5 = gecode_bool_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + argmin(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_22(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + argmin(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_argmin_28(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + argmin(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_31(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolAssign X3 = gecode_BoolAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_57(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatAssign X3 = gecode_FloatAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_59(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntAssign X3 = gecode_IntAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_61(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetAssign X3 = gecode_SetAssign_from_term(YAP_ARG3); + assign(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_32(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolAssign X3 = gecode_BoolAssign_from_term(YAP_ARG3); + BoolVarValPrint X4 = gecode_BoolVarValPrint_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_33(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolAssign X4 = gecode_BoolAssign_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_36(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolAssign X4 = gecode_BoolAssign_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_39(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarBranch X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatAssign X4 = gecode_FloatAssign_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_42(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatAssign X4 = gecode_FloatAssign_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_45(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntAssign X4 = gecode_IntAssign_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_48(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntAssign X4 = gecode_IntAssign_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_51(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetAssign X4 = gecode_SetAssign_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_54(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetAssign X4 = gecode_SetAssign_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_58(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatAssign X3 = gecode_FloatAssign_from_term(YAP_ARG3); + FloatVarValPrint X4 = gecode_FloatVarValPrint_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_60(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntAssign X3 = gecode_IntAssign_from_term(YAP_ARG3); + IntVarValPrint X4 = gecode_IntVarValPrint_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_62(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetAssign X3 = gecode_SetAssign_from_term(YAP_ARG3); + SetVarValPrint X4 = gecode_SetVarValPrint_from_term(YAP_ARG4); + assign(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_34(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolAssign X4 = gecode_BoolAssign_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_37(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolAssign X4 = gecode_BoolAssign_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_40(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarBranch X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatAssign X4 = gecode_FloatAssign_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_43(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatAssign X4 = gecode_FloatAssign_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_46(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntAssign X4 = gecode_IntAssign_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_49(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntAssign X4 = gecode_IntAssign_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_52(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetAssign X4 = gecode_SetAssign_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_55(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetAssign X4 = gecode_SetAssign_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + assign(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_35(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolAssign X4 = gecode_BoolAssign_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + BoolVarValPrint X6 = gecode_BoolVarValPrint_from_term(YAP_ARG6); + assign(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_38(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolAssign X4 = gecode_BoolAssign_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + IntVarValPrint X6 = gecode_IntVarValPrint_from_term(YAP_ARG6); + assign(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_41(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarBranch X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatAssign X4 = gecode_FloatAssign_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + FloatVarValPrint X6 = gecode_FloatVarValPrint_from_term(YAP_ARG6); + assign(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_44(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatAssign X4 = gecode_FloatAssign_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + FloatVarValPrint X6 = gecode_FloatVarValPrint_from_term(YAP_ARG6); + assign(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_47(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntAssign X4 = gecode_IntAssign_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + IntVarValPrint X6 = gecode_IntVarValPrint_from_term(YAP_ARG6); + assign(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_50(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntAssign X4 = gecode_IntAssign_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + IntVarValPrint X6 = gecode_IntVarValPrint_from_term(YAP_ARG6); + assign(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_53(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetAssign X4 = gecode_SetAssign_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + SetVarValPrint X6 = gecode_SetVarValPrint_from_term(YAP_ARG6); + assign(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_assign_56(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetAssign X4 = gecode_SetAssign_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + SetVarValPrint X6 = gecode_SetVarValPrint_from_term(YAP_ARG6); + assign(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_binpacking_63(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + binpacking(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_binpacking_64(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + binpacking(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_65(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolValBranch X3 = gecode_BoolValBranch_from_term(YAP_ARG3); + branch(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_109(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatValBranch X3 = gecode_FloatValBranch_from_term(YAP_ARG3); + branch(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_111(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntValBranch X3 = gecode_IntValBranch_from_term(YAP_ARG3); + branch(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_113(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetValBranch X3 = gecode_SetValBranch_from_term(YAP_ARG3); + branch(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_66(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolValBranch X3 = gecode_BoolValBranch_from_term(YAP_ARG3); + BoolVarValPrint X4 = gecode_BoolVarValPrint_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_67(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_73(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_79(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarBranch X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_82(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_88(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_94(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_100(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_106(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_110(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatValBranch X3 = gecode_FloatValBranch_from_term(YAP_ARG3); + FloatVarValPrint X4 = gecode_FloatVarValPrint_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_112(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntValBranch X3 = gecode_IntValBranch_from_term(YAP_ARG3); + IntVarValPrint X4 = gecode_IntVarValPrint_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_114(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetValBranch X3 = gecode_SetValBranch_from_term(YAP_ARG3); + SetVarValPrint X4 = gecode_SetVarValPrint_from_term(YAP_ARG4); + branch(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_68(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_70(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_74(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_76(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_80(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarBranch X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_83(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_85(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_89(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_91(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_95(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_97(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_101(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_103(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_107(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + branch(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_69(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + BoolVarValPrint X6 = gecode_BoolVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_71(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + BoolBranchFilter X6 = gecode_BoolBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_75(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + BoolBranchFilter X5 = gecode_BoolBranchFilter_from_term(YAP_ARG5); + BoolVarValPrint X6 = gecode_BoolVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_77(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + BoolBranchFilter X6 = gecode_BoolBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_81(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarBranch X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + FloatVarValPrint X6 = gecode_FloatVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_84(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_FloatVarBranch_from_term(YAP_ARG3); + FloatValBranch X4 = gecode_FloatValBranch_from_term(YAP_ARG4); + FloatBranchFilter X5 = gecode_FloatBranchFilter_from_term(YAP_ARG5); + FloatVarValPrint X6 = gecode_FloatVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_86(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + IntBranchFilter X6 = gecode_IntBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_90(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + IntVarValPrint X6 = gecode_IntVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_92(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + IntBranchFilter X6 = gecode_IntBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_96(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + IntBranchFilter X5 = gecode_IntBranchFilter_from_term(YAP_ARG5); + IntVarValPrint X6 = gecode_IntVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_98(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + SetBranchFilter X6 = gecode_SetBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_102(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + SetVarValPrint X6 = gecode_SetVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_104(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + SetBranchFilter X6 = gecode_SetBranchFilter_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_108(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + SetBranchFilter X5 = gecode_SetBranchFilter_from_term(YAP_ARG5); + SetVarValPrint X6 = gecode_SetVarValPrint_from_term(YAP_ARG6); + branch(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_72(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarBranch X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + BoolBranchFilter X6 = gecode_BoolBranchFilter_from_term(YAP_ARG6); + BoolVarValPrint X7 = gecode_BoolVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_78(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_BoolVarBranch_from_term(YAP_ARG3); + BoolValBranch X4 = gecode_BoolValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + BoolBranchFilter X6 = gecode_BoolBranchFilter_from_term(YAP_ARG6); + BoolVarValPrint X7 = gecode_BoolVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_87(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarBranch X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + IntBranchFilter X6 = gecode_IntBranchFilter_from_term(YAP_ARG6); + IntVarValPrint X7 = gecode_IntVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_93(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_IntVarBranch_from_term(YAP_ARG3); + IntValBranch X4 = gecode_IntValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + IntBranchFilter X6 = gecode_IntBranchFilter_from_term(YAP_ARG6); + IntVarValPrint X7 = gecode_IntVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_99(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarBranch X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + SetBranchFilter X6 = gecode_SetBranchFilter_from_term(YAP_ARG6); + SetVarValPrint X7 = gecode_SetVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_branch_105(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + TieBreak X3 = gecode_SetVarBranch_from_term(YAP_ARG3); + SetValBranch X4 = gecode_SetValBranch_from_term(YAP_ARG4); + Symmetries X5 = gecode_Symmetries_from_term(YAP_ARG5); + SetBranchFilter X6 = gecode_SetBranchFilter_from_term(YAP_ARG6); + SetVarValPrint X7 = gecode_SetVarValPrint_from_term(YAP_ARG7); + branch(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cardinality_115(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + cardinality(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_cardinality_116(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + cardinality(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_117(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_119(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_122(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_126(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_127(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + channel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_118(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + channel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_120(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + channel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_123(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + channel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_121(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + channel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_124(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + channel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_channel_125(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + channel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_128(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + circuit(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_131(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + circuit(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_134(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + circuit(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_129(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + circuit(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_132(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + circuit(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_135(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + circuit(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_130(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + circuit(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_139(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + circuit(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_133(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + circuit(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_136(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + circuit(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_137(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntPropLevel X3 = gecode_IntPropLevel_from_term(YAP_ARG3); + circuit(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_circuit_138(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + circuit(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_clause_140(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + clause(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_clause_142(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + clause(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_clause_141(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + clause(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_clause_143(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + clause(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_144(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_146(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_149(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSetArgs X3 = gecode_IntSetArgs_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_153(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_154(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_156(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_159(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_162(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_164(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_166(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_168(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + count(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_145(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_147(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_155(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_157(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_163(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_165(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_167(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_169(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + count(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_148(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSetArgs X3 = gecode_IntSetArgs_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_151(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSetArgs X3 = gecode_IntSetArgs_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_152(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_158(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_161(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + count(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_150(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSetArgs X3 = gecode_IntSetArgs_from_term(YAP_ARG3); + count(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_count_160(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + count(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_170(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_173(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_176(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_180(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_182(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_185(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_188(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_192(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + cumulative(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_171(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_174(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_177(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_178(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_181(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_183(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_186(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_189(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_190(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_193(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + cumulative(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_172(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + cumulative(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_184(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + cumulative(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_175(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + cumulative(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_179(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + cumulative(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_187(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + cumulative(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulative_191(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + TaskTypeArgs X3 = gecode_TaskTypeArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + BoolVarArgs X7 = gecode_BoolVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + cumulative(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_194(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_196(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_198(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_200(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_202(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_204(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_206(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_208(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_195(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_197(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_199(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_201(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_203(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_205(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_207(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntArgs X6 = gecode_IntArgs_from_term(YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_cumulatives_209(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntArgs X7 = gecode_IntArgs_from_term(YAP_ARG7); + bool X8 = gecode_bool_from_term(YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + cumulatives(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_210(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + distinct(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_212(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + distinct(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_214(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + distinct(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_217(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntPropLevel X3 = gecode_IntPropLevel_from_term(YAP_ARG3); + distinct(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_211(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + distinct(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_213(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + distinct(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_215(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + distinct(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_distinct_216(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + distinct(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_div_218(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + div(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_div_219(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + div(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_div_220(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + div(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_divmod_221(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + divmod(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_divmod_222(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + divmod(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_223(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_225(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_227(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_229(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVal X3 = gecode_FloatVal_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_230(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_232(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_236(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_238(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarArgs X3 = gecode_SetVarArgs_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_244(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVal X3 = gecode_FloatVal_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_246(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_247(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_253(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_259(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_267(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetVar X3 = gecode_SetVar_from_term(space,YAP_ARG3); + dom(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_224(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_226(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_228(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatNum X3 = gecode_FloatNum_from_term(YAP_ARG3); + FloatNum X4 = gecode_FloatNum_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_231(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_233(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_234(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_237(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_239(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntSet X4 = gecode_IntSet_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_240(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_242(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatNum X3 = gecode_FloatNum_from_term(YAP_ARG3); + FloatNum X4 = gecode_FloatNum_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_245(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVal X3 = gecode_FloatVal_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_248(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_249(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_251(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_254(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_257(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_260(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_261(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntSet X4 = gecode_IntSet_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_263(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + dom(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_235(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_241(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_243(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatNum X3 = gecode_FloatNum_from_term(YAP_ARG3); + FloatNum X4 = gecode_FloatNum_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_250(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_252(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_255(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_258(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_262(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntSet X4 = gecode_IntSet_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_264(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_266(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + dom(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_256(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + dom(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_dom_265(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + dom(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_268(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_270(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_274(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_278(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_280(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_282(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_288(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + element(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_269(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_271(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_275(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_279(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_281(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_283(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_289(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + element(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_272(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + BoolVar X7 = gecode_BoolVar_from_term(space,YAP_ARG7); + element(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_276(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + element(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_284(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + BoolVar X7 = gecode_BoolVar_from_term(space,YAP_ARG7); + element(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_286(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + element(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_273(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + BoolVar X7 = gecode_BoolVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + element(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_277(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + element(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_285(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + BoolVar X7 = gecode_BoolVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + element(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_element_287(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + element(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_290(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + extensional(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_295(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + DFA X3 = gecode_DFA_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + extensional(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_296(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + extensional(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_301(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + DFA X3 = gecode_DFA_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + extensional(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_291(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + extensional(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_292(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + extensional(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_297(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + extensional(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_298(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + extensional(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_293(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + extensional(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_299(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + TupleSet X3 = gecode_TupleSet_from_term(YAP_ARG3); + bool X4 = gecode_bool_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + extensional(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_294(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + DFA X3 = gecode_DFA_from_term(YAP_ARG3); + extensional(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_extensional_300(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + DFA X3 = gecode_DFA_from_term(YAP_ARG3); + extensional(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_302(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + ite(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_304(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + FloatVar X5 = gecode_FloatVar_from_term(space,YAP_ARG5); + ite(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_305(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + ite(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_307(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + SetVar X3 = gecode_SetVar_from_term(space,YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + SetVar X5 = gecode_SetVar_from_term(space,YAP_ARG5); + ite(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_303(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + ite(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_ite_306(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + ite(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_308(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_312(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_320(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_322(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_340(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_344(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + linear(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_309(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_310(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_313(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_314(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_316(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatValArgs X2 = gecode_FloatValArgs_from_term(YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + FloatRelType X4 = gecode_FloatRelType_from_term(YAP_ARG4); + FloatVal X5 = gecode_FloatVal_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_318(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatValArgs X2 = gecode_FloatValArgs_from_term(YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + FloatRelType X4 = gecode_FloatRelType_from_term(YAP_ARG4); + FloatVar X5 = gecode_FloatVar_from_term(space,YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_321(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_323(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_324(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_328(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_332(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_336(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_341(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_342(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_345(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_346(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + linear(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_311(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_315(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_317(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatValArgs X2 = gecode_FloatValArgs_from_term(YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + FloatRelType X4 = gecode_FloatRelType_from_term(YAP_ARG4); + FloatVal X5 = gecode_FloatVal_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_319(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatValArgs X2 = gecode_FloatValArgs_from_term(YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + FloatRelType X4 = gecode_FloatRelType_from_term(YAP_ARG4); + FloatVar X5 = gecode_FloatVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_325(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_326(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_329(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_330(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_333(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_334(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_337(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_338(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_343(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_347(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + linear(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_327(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + linear(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_331(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + linear(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_335(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + linear(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_linear_339(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntRelType X4 = gecode_IntRelType_from_term(YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + Reify X6 = gecode_Reify_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + linear(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_348(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + max(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_349(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + max(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_350(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + max(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_351(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + max(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_352(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + max(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_max_353(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + max(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_354(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + member(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_358(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + member(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_355(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + member(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_356(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + member(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_359(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + member(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_360(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + member(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_357(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + BoolVar X3 = gecode_BoolVar_from_term(space,YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + member(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_member_361(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + Reify X4 = gecode_Reify_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + member(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_362(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + min(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_363(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + min(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_364(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + min(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_365(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + min(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_366(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + min(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_min_367(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + min(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_mod_368(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + mod(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_mod_369(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + mod(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_mult_370(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + mult(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_mult_371(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + mult(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_mult_372(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + mult(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_373(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + nooverlap(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_376(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + nooverlap(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_374(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + BoolVarArgs X6 = gecode_BoolVarArgs_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + nooverlap(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_379(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + nooverlap(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_375(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntArgs X5 = gecode_IntArgs_from_term(YAP_ARG5); + nooverlap(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_377(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + BoolVarArgs X8 = gecode_BoolVarArgs_from_term(space,YAP_ARG8); + nooverlap(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_380(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + nooverlap(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_nooverlap_378(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVarArgs X5 = gecode_IntVarArgs_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + BoolVarArgs X8 = gecode_BoolVarArgs_from_term(space,YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + nooverlap(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_nroot_381(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + nroot(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nroot_382(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + nroot(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nroot_383(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nroot(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_384(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + nvalues(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_386(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + nvalues(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_388(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + nvalues(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_390(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + nvalues(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_385(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nvalues(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_387(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nvalues(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_389(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nvalues(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_nvalues_391(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + nvalues(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_order_392(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + BoolVar X6 = gecode_BoolVar_from_term(space,YAP_ARG6); + order(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_order_393(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + BoolVar X6 = gecode_BoolVar_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + order(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_394(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + path(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_397(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + path(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_400(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + path(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_395(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVarArgs X6 = gecode_IntVarArgs_from_term(space,YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + path(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_398(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + IntVar X8 = gecode_IntVar_from_term(space,YAP_ARG8); + path(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_401(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntVar X7 = gecode_IntVar_from_term(space,YAP_ARG7); + IntPropLevel X8 = gecode_IntPropLevel_from_term(YAP_ARG8); + path(*space,X2,X3,X4,X5,X6,X7,X8); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_396(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + path(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_405(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + path(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_399(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + IntVar X6 = gecode_IntVar_from_term(space,YAP_ARG6); + IntVarArgs X7 = gecode_IntVarArgs_from_term(space,YAP_ARG7); + IntVar X8 = gecode_IntVar_from_term(space,YAP_ARG8); + IntPropLevel X9 = gecode_IntPropLevel_from_term(YAP_ARG9); + path(*space,X2,X3,X4,X5,X6,X7,X8,X9); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_402(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + path(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_403(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + path(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_path_404(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + int X2 = gecode_int_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntVar X5 = gecode_IntVar_from_term(space,YAP_ARG5); + path(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_pow_406(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + pow(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_pow_407(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + pow(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_pow_408(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + pow(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_precede_409(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + precede(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_precede_410(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + precede(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_precede_411(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + precede(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_precede_412(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + int X3 = gecode_int_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + precede(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_relax_413(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatVarArgs X3 = gecode_FloatVarArgs_from_term(space,YAP_ARG3); + Rnd X4 = gecode_Rnd_from_term(YAP_ARG4); + double X5 = gecode_double_from_term(YAP_ARG5); + relax(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_relax_414(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVarArgs X2 = gecode_SetVarArgs_from_term(space,YAP_ARG2); + SetVarArgs X3 = gecode_SetVarArgs_from_term(space,YAP_ARG3); + Rnd X4 = gecode_Rnd_from_term(YAP_ARG4); + double X5 = gecode_double_from_term(YAP_ARG5); + relax(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_415(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_417(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_423(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_427(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_431(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_433(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_435(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_437(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_440(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_441(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_442(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVarArgs X2 = gecode_FloatVarArgs_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_443(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_445(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_447(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_449(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_451(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_454(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_455(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_457(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_459(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_461(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_465(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_469(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_471(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_473(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_475(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + rel(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_416(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_418(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolOpType X2 = gecode_BoolOpType_from_term(YAP_ARG2); + BoolVarArgs X3 = gecode_BoolVarArgs_from_term(space,YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_419(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolOpType X3 = gecode_BoolOpType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_421(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolOpType X3 = gecode_BoolOpType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_424(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_425(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_428(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_429(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_432(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_434(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_436(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_438(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_444(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_446(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntArgs X2 = gecode_IntArgs_from_term(YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_448(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_450(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_452(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_456(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_458(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVal X4 = gecode_FloatVal_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_460(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatRelType X3 = gecode_FloatRelType_from_term(YAP_ARG3); + FloatVar X4 = gecode_FloatVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_462(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_463(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_466(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_467(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_470(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_472(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_474(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_476(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + SetVar X2 = gecode_SetVar_from_term(space,YAP_ARG2); + SetRelType X3 = gecode_SetRelType_from_term(YAP_ARG3); + SetVar X4 = gecode_SetVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + rel(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_420(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolOpType X3 = gecode_BoolOpType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + BoolVar X5 = gecode_BoolVar_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_422(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + BoolOpType X3 = gecode_BoolOpType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_426(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + BoolVar X4 = gecode_BoolVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_430(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_464(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_468(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + IntVar X4 = gecode_IntVar_from_term(space,YAP_ARG4); + Reify X5 = gecode_Reify_from_term(YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + rel(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_439(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + rel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_rel_453(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntRelType X3 = gecode_IntRelType_from_term(YAP_ARG3); + rel(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sequence_477(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + sequence(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_sequence_479(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + sequence(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_sequence_478(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + sequence(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_sequence_480(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntSet X3 = gecode_IntSet_from_term(YAP_ARG3); + int X4 = gecode_int_from_term(YAP_ARG4); + int X5 = gecode_int_from_term(YAP_ARG5); + int X6 = gecode_int_from_term(YAP_ARG6); + IntPropLevel X7 = gecode_IntPropLevel_from_term(YAP_ARG7); + sequence(*space,X2,X3,X4,X5,X6,X7); + return TRUE; +} + +static YAP_Bool gecode_constraint_sorted_481(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + sorted(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_sorted_484(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + sorted(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_sorted_482(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + sorted(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_sorted_483(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + sorted(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqr_485(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + sqr(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqr_486(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + sqr(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqr_487(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + sqr(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqrt_488(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + FloatVar X2 = gecode_FloatVar_from_term(space,YAP_ARG2); + FloatVar X3 = gecode_FloatVar_from_term(space,YAP_ARG3); + sqrt(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqrt_489(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + sqrt(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_sqrt_490(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVar X2 = gecode_IntVar_from_term(space,YAP_ARG2); + IntVar X3 = gecode_IntVar_from_term(space,YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + sqrt(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_491(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + unary(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_494(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + unary(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_497(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + unary(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_501(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + TaskTypeArgs X2 = gecode_TaskTypeArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + unary(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_492(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + BoolVarArgs X4 = gecode_BoolVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_495(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + BoolVarArgs X5 = gecode_BoolVarArgs_from_term(space,YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_498(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_499(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + TaskTypeArgs X2 = gecode_TaskTypeArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + BoolVarArgs X5 = gecode_BoolVarArgs_from_term(space,YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_502(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + TaskTypeArgs X2 = gecode_TaskTypeArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + unary(*space,X2,X3,X4,X5); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_493(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntArgs X3 = gecode_IntArgs_from_term(YAP_ARG3); + unary(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_496(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntVarArgs X4 = gecode_IntVarArgs_from_term(space,YAP_ARG4); + BoolVarArgs X5 = gecode_BoolVarArgs_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + unary(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_unary_500(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + TaskTypeArgs X2 = gecode_TaskTypeArgs_from_term(YAP_ARG2); + IntVarArgs X3 = gecode_IntVarArgs_from_term(space,YAP_ARG3); + IntArgs X4 = gecode_IntArgs_from_term(YAP_ARG4); + BoolVarArgs X5 = gecode_BoolVarArgs_from_term(space,YAP_ARG5); + IntPropLevel X6 = gecode_IntPropLevel_from_term(YAP_ARG6); + unary(*space,X2,X3,X4,X5,X6); + return TRUE; +} + +static YAP_Bool gecode_constraint_unshare_503(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + unshare(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_unshare_505(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + unshare(*space,X2); + return TRUE; +} + +static YAP_Bool gecode_constraint_unshare_504(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVarArgs X2 = gecode_BoolVarArgs_from_term(space,YAP_ARG2); + IntPropLevel X3 = gecode_IntPropLevel_from_term(YAP_ARG3); + unshare(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_unshare_506(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + IntVarArgs X2 = gecode_IntVarArgs_from_term(space,YAP_ARG2); + IntPropLevel X3 = gecode_IntPropLevel_from_term(YAP_ARG3); + unshare(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_when_507(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + std::function X3 = gecode_std_function_from_term(YAP_ARG3); + when(*space,X2,X3); + return TRUE; +} + +static YAP_Bool gecode_constraint_when_508(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + std::function X3 = gecode_std_function_from_term(YAP_ARG3); + IntPropLevel X4 = gecode_IntPropLevel_from_term(YAP_ARG4); + when(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_when_509(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + std::function X3 = gecode_std_function_from_term(YAP_ARG3); + std::function X4 = gecode_std_function_from_term(YAP_ARG4); + when(*space,X2,X3,X4); + return TRUE; +} + +static YAP_Bool gecode_constraint_when_510(void) +{ + GenericSpace* space = gecode_Space_from_term(YAP_ARG1); + BoolVar X2 = gecode_BoolVar_from_term(space,YAP_ARG2); + std::function X3 = gecode_std_function_from_term(YAP_ARG3); + std::function X4 = gecode_std_function_from_term(YAP_ARG4); + IntPropLevel X5 = gecode_IntPropLevel_from_term(YAP_ARG5); + when(*space,X2,X3,X4,X5); + return TRUE; +} + diff --git a/packages/gecode/6.2.0/gecode_yap_cc_init_auto_generated.icc b/packages/gecode/6.2.0/gecode_yap_cc_init_auto_generated.icc new file mode 100644 index 000000000..b12918847 --- /dev/null +++ b/packages/gecode/6.2.0/gecode_yap_cc_init_auto_generated.icc @@ -0,0 +1,712 @@ +// -*- c++ -*- +//============================================================================= +// Copyright (C) 2011 by Denys Duchier +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License as published by the +// Free Software Foundation, either version 3 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +//============================================================================= + +{ YAP_Atom X= YAP_LookupAtom("RM_NONE"); + gecode_RM_NONE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_CONSTANT"); + gecode_RM_CONSTANT = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_LINEAR"); + gecode_RM_LINEAR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_LUBY"); + gecode_RM_LUBY = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_GEOMETRIC"); + gecode_RM_GEOMETRIC = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("FRT_EQ"); + gecode_FRT_EQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_NQ"); + gecode_FRT_NQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_LQ"); + gecode_FRT_LQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_LE"); + gecode_FRT_LE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_GQ"); + gecode_FRT_GQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("FRT_GR"); + gecode_FRT_GR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("RM_EQV"); + gecode_RM_EQV = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_IMP"); + gecode_RM_IMP = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("RM_PMI"); + gecode_RM_PMI = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("IRT_EQ"); + gecode_IRT_EQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_NQ"); + gecode_IRT_NQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_LQ"); + gecode_IRT_LQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_LE"); + gecode_IRT_LE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_GQ"); + gecode_IRT_GQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IRT_GR"); + gecode_IRT_GR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("BOT_AND"); + gecode_BOT_AND = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("BOT_OR"); + gecode_BOT_OR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("BOT_IMP"); + gecode_BOT_IMP = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("BOT_EQV"); + gecode_BOT_EQV = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("BOT_XOR"); + gecode_BOT_XOR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("IPL_DEF"); + gecode_IPL_DEF = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_VAL"); + gecode_IPL_VAL = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_BND"); + gecode_IPL_BND = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_DOM"); + gecode_IPL_DOM = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_BASIC"); + gecode_IPL_BASIC = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_ADVANCED"); + gecode_IPL_ADVANCED = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("IPL_BASIC_ADVANCED"); + gecode_IPL_BASIC_ADVANCED = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("_IPL_BITS"); + gecode__IPL_BITS = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("TT_FIXP"); + gecode_TT_FIXP = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TT_FIXS"); + gecode_TT_FIXS = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TT_FIXE"); + gecode_TT_FIXE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("TE_INIT"); + gecode_TE_INIT = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_PRUNE"); + gecode_TE_PRUNE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_FIX"); + gecode_TE_FIX = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_FAIL"); + gecode_TE_FAIL = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_DONE"); + gecode_TE_DONE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_PROPAGATE"); + gecode_TE_PROPAGATE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_COMMIT"); + gecode_TE_COMMIT = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("TE_POST"); + gecode_TE_POST = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("SRT_EQ"); + gecode_SRT_EQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_NQ"); + gecode_SRT_NQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_SUB"); + gecode_SRT_SUB = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_SUP"); + gecode_SRT_SUP = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_DISJ"); + gecode_SRT_DISJ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_CMPL"); + gecode_SRT_CMPL = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_LQ"); + gecode_SRT_LQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_LE"); + gecode_SRT_LE = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_GQ"); + gecode_SRT_GQ = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SRT_GR"); + gecode_SRT_GR = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +{ YAP_Atom X= YAP_LookupAtom("SOT_UNION"); + gecode_SOT_UNION = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SOT_DUNION"); + gecode_SOT_DUNION = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SOT_INTER"); + gecode_SOT_INTER = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } +{ YAP_Atom X= YAP_LookupAtom("SOT_MINUS"); + gecode_SOT_MINUS = YAP_MkAtomTerm(X); + YAP_AtomGetHold(X); } + +YAP_UserCPredicate("gecode_constraint_branch_1", gecode_constraint_branch_1, 2); +YAP_UserCPredicate("gecode_constraint_convex_2", gecode_constraint_convex_2, 2); +YAP_UserCPredicate("gecode_constraint_convex_3", gecode_constraint_convex_3, 3); +YAP_UserCPredicate("gecode_constraint_abs_4", gecode_constraint_abs_4, 3); +YAP_UserCPredicate("gecode_constraint_abs_5", gecode_constraint_abs_5, 3); +YAP_UserCPredicate("gecode_constraint_abs_6", gecode_constraint_abs_6, 4); +YAP_UserCPredicate("gecode_constraint_argmax_7", gecode_constraint_argmax_7, 4); +YAP_UserCPredicate("gecode_constraint_argmax_11", gecode_constraint_argmax_11, 4); +YAP_UserCPredicate("gecode_constraint_argmax_13", gecode_constraint_argmax_13, 4); +YAP_UserCPredicate("gecode_constraint_argmax_17", gecode_constraint_argmax_17, 4); +YAP_UserCPredicate("gecode_constraint_argmax_8", gecode_constraint_argmax_8, 5); +YAP_UserCPredicate("gecode_constraint_argmax_12", gecode_constraint_argmax_12, 5); +YAP_UserCPredicate("gecode_constraint_argmax_14", gecode_constraint_argmax_14, 5); +YAP_UserCPredicate("gecode_constraint_argmax_18", gecode_constraint_argmax_18, 5); +YAP_UserCPredicate("gecode_constraint_argmax_9", gecode_constraint_argmax_9, 6); +YAP_UserCPredicate("gecode_constraint_argmax_15", gecode_constraint_argmax_15, 6); +YAP_UserCPredicate("gecode_constraint_argmax_10", gecode_constraint_argmax_10, 3); +YAP_UserCPredicate("gecode_constraint_argmax_16", gecode_constraint_argmax_16, 3); +YAP_UserCPredicate("gecode_constraint_argmin_19", gecode_constraint_argmin_19, 4); +YAP_UserCPredicate("gecode_constraint_argmin_23", gecode_constraint_argmin_23, 4); +YAP_UserCPredicate("gecode_constraint_argmin_25", gecode_constraint_argmin_25, 4); +YAP_UserCPredicate("gecode_constraint_argmin_29", gecode_constraint_argmin_29, 4); +YAP_UserCPredicate("gecode_constraint_argmin_20", gecode_constraint_argmin_20, 5); +YAP_UserCPredicate("gecode_constraint_argmin_24", gecode_constraint_argmin_24, 5); +YAP_UserCPredicate("gecode_constraint_argmin_26", gecode_constraint_argmin_26, 5); +YAP_UserCPredicate("gecode_constraint_argmin_30", gecode_constraint_argmin_30, 5); +YAP_UserCPredicate("gecode_constraint_argmin_21", gecode_constraint_argmin_21, 6); +YAP_UserCPredicate("gecode_constraint_argmin_27", gecode_constraint_argmin_27, 6); +YAP_UserCPredicate("gecode_constraint_argmin_22", gecode_constraint_argmin_22, 3); +YAP_UserCPredicate("gecode_constraint_argmin_28", gecode_constraint_argmin_28, 3); +YAP_UserCPredicate("gecode_constraint_assign_31", gecode_constraint_assign_31, 3); +YAP_UserCPredicate("gecode_constraint_assign_57", gecode_constraint_assign_57, 3); +YAP_UserCPredicate("gecode_constraint_assign_59", gecode_constraint_assign_59, 3); +YAP_UserCPredicate("gecode_constraint_assign_61", gecode_constraint_assign_61, 3); +YAP_UserCPredicate("gecode_constraint_assign_32", gecode_constraint_assign_32, 4); +YAP_UserCPredicate("gecode_constraint_assign_33", gecode_constraint_assign_33, 4); +YAP_UserCPredicate("gecode_constraint_assign_36", gecode_constraint_assign_36, 4); +YAP_UserCPredicate("gecode_constraint_assign_39", gecode_constraint_assign_39, 4); +YAP_UserCPredicate("gecode_constraint_assign_42", gecode_constraint_assign_42, 4); +YAP_UserCPredicate("gecode_constraint_assign_45", gecode_constraint_assign_45, 4); +YAP_UserCPredicate("gecode_constraint_assign_48", gecode_constraint_assign_48, 4); +YAP_UserCPredicate("gecode_constraint_assign_51", gecode_constraint_assign_51, 4); +YAP_UserCPredicate("gecode_constraint_assign_54", gecode_constraint_assign_54, 4); +YAP_UserCPredicate("gecode_constraint_assign_58", gecode_constraint_assign_58, 4); +YAP_UserCPredicate("gecode_constraint_assign_60", gecode_constraint_assign_60, 4); +YAP_UserCPredicate("gecode_constraint_assign_62", gecode_constraint_assign_62, 4); +YAP_UserCPredicate("gecode_constraint_assign_34", gecode_constraint_assign_34, 5); +YAP_UserCPredicate("gecode_constraint_assign_37", gecode_constraint_assign_37, 5); +YAP_UserCPredicate("gecode_constraint_assign_40", gecode_constraint_assign_40, 5); +YAP_UserCPredicate("gecode_constraint_assign_43", gecode_constraint_assign_43, 5); +YAP_UserCPredicate("gecode_constraint_assign_46", gecode_constraint_assign_46, 5); +YAP_UserCPredicate("gecode_constraint_assign_49", gecode_constraint_assign_49, 5); +YAP_UserCPredicate("gecode_constraint_assign_52", gecode_constraint_assign_52, 5); +YAP_UserCPredicate("gecode_constraint_assign_55", gecode_constraint_assign_55, 5); +YAP_UserCPredicate("gecode_constraint_assign_35", gecode_constraint_assign_35, 6); +YAP_UserCPredicate("gecode_constraint_assign_38", gecode_constraint_assign_38, 6); +YAP_UserCPredicate("gecode_constraint_assign_41", gecode_constraint_assign_41, 6); +YAP_UserCPredicate("gecode_constraint_assign_44", gecode_constraint_assign_44, 6); +YAP_UserCPredicate("gecode_constraint_assign_47", gecode_constraint_assign_47, 6); +YAP_UserCPredicate("gecode_constraint_assign_50", gecode_constraint_assign_50, 6); +YAP_UserCPredicate("gecode_constraint_assign_53", gecode_constraint_assign_53, 6); +YAP_UserCPredicate("gecode_constraint_assign_56", gecode_constraint_assign_56, 6); +YAP_UserCPredicate("gecode_constraint_binpacking_63", gecode_constraint_binpacking_63, 4); +YAP_UserCPredicate("gecode_constraint_binpacking_64", gecode_constraint_binpacking_64, 5); +YAP_UserCPredicate("gecode_constraint_branch_65", gecode_constraint_branch_65, 3); +YAP_UserCPredicate("gecode_constraint_branch_109", gecode_constraint_branch_109, 3); +YAP_UserCPredicate("gecode_constraint_branch_111", gecode_constraint_branch_111, 3); +YAP_UserCPredicate("gecode_constraint_branch_113", gecode_constraint_branch_113, 3); +YAP_UserCPredicate("gecode_constraint_branch_66", gecode_constraint_branch_66, 4); +YAP_UserCPredicate("gecode_constraint_branch_67", gecode_constraint_branch_67, 4); +YAP_UserCPredicate("gecode_constraint_branch_73", gecode_constraint_branch_73, 4); +YAP_UserCPredicate("gecode_constraint_branch_79", gecode_constraint_branch_79, 4); +YAP_UserCPredicate("gecode_constraint_branch_82", gecode_constraint_branch_82, 4); +YAP_UserCPredicate("gecode_constraint_branch_88", gecode_constraint_branch_88, 4); +YAP_UserCPredicate("gecode_constraint_branch_94", gecode_constraint_branch_94, 4); +YAP_UserCPredicate("gecode_constraint_branch_100", gecode_constraint_branch_100, 4); +YAP_UserCPredicate("gecode_constraint_branch_106", gecode_constraint_branch_106, 4); +YAP_UserCPredicate("gecode_constraint_branch_110", gecode_constraint_branch_110, 4); +YAP_UserCPredicate("gecode_constraint_branch_112", gecode_constraint_branch_112, 4); +YAP_UserCPredicate("gecode_constraint_branch_114", gecode_constraint_branch_114, 4); +YAP_UserCPredicate("gecode_constraint_branch_68", gecode_constraint_branch_68, 5); +YAP_UserCPredicate("gecode_constraint_branch_70", gecode_constraint_branch_70, 5); +YAP_UserCPredicate("gecode_constraint_branch_74", gecode_constraint_branch_74, 5); +YAP_UserCPredicate("gecode_constraint_branch_76", gecode_constraint_branch_76, 5); +YAP_UserCPredicate("gecode_constraint_branch_80", gecode_constraint_branch_80, 5); +YAP_UserCPredicate("gecode_constraint_branch_83", gecode_constraint_branch_83, 5); +YAP_UserCPredicate("gecode_constraint_branch_85", gecode_constraint_branch_85, 5); +YAP_UserCPredicate("gecode_constraint_branch_89", gecode_constraint_branch_89, 5); +YAP_UserCPredicate("gecode_constraint_branch_91", gecode_constraint_branch_91, 5); +YAP_UserCPredicate("gecode_constraint_branch_95", gecode_constraint_branch_95, 5); +YAP_UserCPredicate("gecode_constraint_branch_97", gecode_constraint_branch_97, 5); +YAP_UserCPredicate("gecode_constraint_branch_101", gecode_constraint_branch_101, 5); +YAP_UserCPredicate("gecode_constraint_branch_103", gecode_constraint_branch_103, 5); +YAP_UserCPredicate("gecode_constraint_branch_107", gecode_constraint_branch_107, 5); +YAP_UserCPredicate("gecode_constraint_branch_69", gecode_constraint_branch_69, 6); +YAP_UserCPredicate("gecode_constraint_branch_71", gecode_constraint_branch_71, 6); +YAP_UserCPredicate("gecode_constraint_branch_75", gecode_constraint_branch_75, 6); +YAP_UserCPredicate("gecode_constraint_branch_77", gecode_constraint_branch_77, 6); +YAP_UserCPredicate("gecode_constraint_branch_81", gecode_constraint_branch_81, 6); +YAP_UserCPredicate("gecode_constraint_branch_84", gecode_constraint_branch_84, 6); +YAP_UserCPredicate("gecode_constraint_branch_86", gecode_constraint_branch_86, 6); +YAP_UserCPredicate("gecode_constraint_branch_90", gecode_constraint_branch_90, 6); +YAP_UserCPredicate("gecode_constraint_branch_92", gecode_constraint_branch_92, 6); +YAP_UserCPredicate("gecode_constraint_branch_96", gecode_constraint_branch_96, 6); +YAP_UserCPredicate("gecode_constraint_branch_98", gecode_constraint_branch_98, 6); +YAP_UserCPredicate("gecode_constraint_branch_102", gecode_constraint_branch_102, 6); +YAP_UserCPredicate("gecode_constraint_branch_104", gecode_constraint_branch_104, 6); +YAP_UserCPredicate("gecode_constraint_branch_108", gecode_constraint_branch_108, 6); +YAP_UserCPredicate("gecode_constraint_branch_72", gecode_constraint_branch_72, 7); +YAP_UserCPredicate("gecode_constraint_branch_78", gecode_constraint_branch_78, 7); +YAP_UserCPredicate("gecode_constraint_branch_87", gecode_constraint_branch_87, 7); +YAP_UserCPredicate("gecode_constraint_branch_93", gecode_constraint_branch_93, 7); +YAP_UserCPredicate("gecode_constraint_branch_99", gecode_constraint_branch_99, 7); +YAP_UserCPredicate("gecode_constraint_branch_105", gecode_constraint_branch_105, 7); +YAP_UserCPredicate("gecode_constraint_cardinality_115", gecode_constraint_cardinality_115, 4); +YAP_UserCPredicate("gecode_constraint_cardinality_116", gecode_constraint_cardinality_116, 4); +YAP_UserCPredicate("gecode_constraint_channel_117", gecode_constraint_channel_117, 3); +YAP_UserCPredicate("gecode_constraint_channel_119", gecode_constraint_channel_119, 3); +YAP_UserCPredicate("gecode_constraint_channel_122", gecode_constraint_channel_122, 3); +YAP_UserCPredicate("gecode_constraint_channel_126", gecode_constraint_channel_126, 3); +YAP_UserCPredicate("gecode_constraint_channel_127", gecode_constraint_channel_127, 3); +YAP_UserCPredicate("gecode_constraint_channel_118", gecode_constraint_channel_118, 4); +YAP_UserCPredicate("gecode_constraint_channel_120", gecode_constraint_channel_120, 4); +YAP_UserCPredicate("gecode_constraint_channel_123", gecode_constraint_channel_123, 4); +YAP_UserCPredicate("gecode_constraint_channel_121", gecode_constraint_channel_121, 5); +YAP_UserCPredicate("gecode_constraint_channel_124", gecode_constraint_channel_124, 5); +YAP_UserCPredicate("gecode_constraint_channel_125", gecode_constraint_channel_125, 6); +YAP_UserCPredicate("gecode_constraint_circuit_128", gecode_constraint_circuit_128, 5); +YAP_UserCPredicate("gecode_constraint_circuit_131", gecode_constraint_circuit_131, 5); +YAP_UserCPredicate("gecode_constraint_circuit_134", gecode_constraint_circuit_134, 5); +YAP_UserCPredicate("gecode_constraint_circuit_129", gecode_constraint_circuit_129, 6); +YAP_UserCPredicate("gecode_constraint_circuit_132", gecode_constraint_circuit_132, 6); +YAP_UserCPredicate("gecode_constraint_circuit_135", gecode_constraint_circuit_135, 6); +YAP_UserCPredicate("gecode_constraint_circuit_130", gecode_constraint_circuit_130, 4); +YAP_UserCPredicate("gecode_constraint_circuit_139", gecode_constraint_circuit_139, 4); +YAP_UserCPredicate("gecode_constraint_circuit_133", gecode_constraint_circuit_133, 7); +YAP_UserCPredicate("gecode_constraint_circuit_136", gecode_constraint_circuit_136, 2); +YAP_UserCPredicate("gecode_constraint_circuit_137", gecode_constraint_circuit_137, 3); +YAP_UserCPredicate("gecode_constraint_circuit_138", gecode_constraint_circuit_138, 3); +YAP_UserCPredicate("gecode_constraint_clause_140", gecode_constraint_clause_140, 5); +YAP_UserCPredicate("gecode_constraint_clause_142", gecode_constraint_clause_142, 5); +YAP_UserCPredicate("gecode_constraint_clause_141", gecode_constraint_clause_141, 6); +YAP_UserCPredicate("gecode_constraint_clause_143", gecode_constraint_clause_143, 6); +YAP_UserCPredicate("gecode_constraint_count_144", gecode_constraint_count_144, 5); +YAP_UserCPredicate("gecode_constraint_count_146", gecode_constraint_count_146, 5); +YAP_UserCPredicate("gecode_constraint_count_149", gecode_constraint_count_149, 5); +YAP_UserCPredicate("gecode_constraint_count_153", gecode_constraint_count_153, 5); +YAP_UserCPredicate("gecode_constraint_count_154", gecode_constraint_count_154, 5); +YAP_UserCPredicate("gecode_constraint_count_156", gecode_constraint_count_156, 5); +YAP_UserCPredicate("gecode_constraint_count_159", gecode_constraint_count_159, 5); +YAP_UserCPredicate("gecode_constraint_count_162", gecode_constraint_count_162, 5); +YAP_UserCPredicate("gecode_constraint_count_164", gecode_constraint_count_164, 5); +YAP_UserCPredicate("gecode_constraint_count_166", gecode_constraint_count_166, 5); +YAP_UserCPredicate("gecode_constraint_count_168", gecode_constraint_count_168, 5); +YAP_UserCPredicate("gecode_constraint_count_145", gecode_constraint_count_145, 6); +YAP_UserCPredicate("gecode_constraint_count_147", gecode_constraint_count_147, 6); +YAP_UserCPredicate("gecode_constraint_count_155", gecode_constraint_count_155, 6); +YAP_UserCPredicate("gecode_constraint_count_157", gecode_constraint_count_157, 6); +YAP_UserCPredicate("gecode_constraint_count_163", gecode_constraint_count_163, 6); +YAP_UserCPredicate("gecode_constraint_count_165", gecode_constraint_count_165, 6); +YAP_UserCPredicate("gecode_constraint_count_167", gecode_constraint_count_167, 6); +YAP_UserCPredicate("gecode_constraint_count_169", gecode_constraint_count_169, 6); +YAP_UserCPredicate("gecode_constraint_count_148", gecode_constraint_count_148, 4); +YAP_UserCPredicate("gecode_constraint_count_151", gecode_constraint_count_151, 4); +YAP_UserCPredicate("gecode_constraint_count_152", gecode_constraint_count_152, 4); +YAP_UserCPredicate("gecode_constraint_count_158", gecode_constraint_count_158, 4); +YAP_UserCPredicate("gecode_constraint_count_161", gecode_constraint_count_161, 4); +YAP_UserCPredicate("gecode_constraint_count_150", gecode_constraint_count_150, 3); +YAP_UserCPredicate("gecode_constraint_count_160", gecode_constraint_count_160, 3); +YAP_UserCPredicate("gecode_constraint_cumulative_170", gecode_constraint_cumulative_170, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_173", gecode_constraint_cumulative_173, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_176", gecode_constraint_cumulative_176, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_180", gecode_constraint_cumulative_180, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_182", gecode_constraint_cumulative_182, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_185", gecode_constraint_cumulative_185, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_188", gecode_constraint_cumulative_188, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_192", gecode_constraint_cumulative_192, 6); +YAP_UserCPredicate("gecode_constraint_cumulative_171", gecode_constraint_cumulative_171, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_174", gecode_constraint_cumulative_174, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_177", gecode_constraint_cumulative_177, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_178", gecode_constraint_cumulative_178, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_181", gecode_constraint_cumulative_181, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_183", gecode_constraint_cumulative_183, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_186", gecode_constraint_cumulative_186, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_189", gecode_constraint_cumulative_189, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_190", gecode_constraint_cumulative_190, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_193", gecode_constraint_cumulative_193, 7); +YAP_UserCPredicate("gecode_constraint_cumulative_172", gecode_constraint_cumulative_172, 5); +YAP_UserCPredicate("gecode_constraint_cumulative_184", gecode_constraint_cumulative_184, 5); +YAP_UserCPredicate("gecode_constraint_cumulative_175", gecode_constraint_cumulative_175, 8); +YAP_UserCPredicate("gecode_constraint_cumulative_179", gecode_constraint_cumulative_179, 8); +YAP_UserCPredicate("gecode_constraint_cumulative_187", gecode_constraint_cumulative_187, 8); +YAP_UserCPredicate("gecode_constraint_cumulative_191", gecode_constraint_cumulative_191, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_194", gecode_constraint_cumulatives_194, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_196", gecode_constraint_cumulatives_196, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_198", gecode_constraint_cumulatives_198, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_200", gecode_constraint_cumulatives_200, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_202", gecode_constraint_cumulatives_202, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_204", gecode_constraint_cumulatives_204, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_206", gecode_constraint_cumulatives_206, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_208", gecode_constraint_cumulatives_208, 8); +YAP_UserCPredicate("gecode_constraint_cumulatives_195", gecode_constraint_cumulatives_195, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_197", gecode_constraint_cumulatives_197, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_199", gecode_constraint_cumulatives_199, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_201", gecode_constraint_cumulatives_201, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_203", gecode_constraint_cumulatives_203, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_205", gecode_constraint_cumulatives_205, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_207", gecode_constraint_cumulatives_207, 9); +YAP_UserCPredicate("gecode_constraint_cumulatives_209", gecode_constraint_cumulatives_209, 9); +YAP_UserCPredicate("gecode_constraint_distinct_210", gecode_constraint_distinct_210, 3); +YAP_UserCPredicate("gecode_constraint_distinct_212", gecode_constraint_distinct_212, 3); +YAP_UserCPredicate("gecode_constraint_distinct_214", gecode_constraint_distinct_214, 3); +YAP_UserCPredicate("gecode_constraint_distinct_217", gecode_constraint_distinct_217, 3); +YAP_UserCPredicate("gecode_constraint_distinct_211", gecode_constraint_distinct_211, 4); +YAP_UserCPredicate("gecode_constraint_distinct_213", gecode_constraint_distinct_213, 4); +YAP_UserCPredicate("gecode_constraint_distinct_215", gecode_constraint_distinct_215, 4); +YAP_UserCPredicate("gecode_constraint_distinct_216", gecode_constraint_distinct_216, 2); +YAP_UserCPredicate("gecode_constraint_div_218", gecode_constraint_div_218, 4); +YAP_UserCPredicate("gecode_constraint_div_219", gecode_constraint_div_219, 4); +YAP_UserCPredicate("gecode_constraint_div_220", gecode_constraint_div_220, 5); +YAP_UserCPredicate("gecode_constraint_divmod_221", gecode_constraint_divmod_221, 5); +YAP_UserCPredicate("gecode_constraint_divmod_222", gecode_constraint_divmod_222, 6); +YAP_UserCPredicate("gecode_constraint_dom_223", gecode_constraint_dom_223, 3); +YAP_UserCPredicate("gecode_constraint_dom_225", gecode_constraint_dom_225, 3); +YAP_UserCPredicate("gecode_constraint_dom_227", gecode_constraint_dom_227, 3); +YAP_UserCPredicate("gecode_constraint_dom_229", gecode_constraint_dom_229, 3); +YAP_UserCPredicate("gecode_constraint_dom_230", gecode_constraint_dom_230, 3); +YAP_UserCPredicate("gecode_constraint_dom_232", gecode_constraint_dom_232, 3); +YAP_UserCPredicate("gecode_constraint_dom_236", gecode_constraint_dom_236, 3); +YAP_UserCPredicate("gecode_constraint_dom_238", gecode_constraint_dom_238, 3); +YAP_UserCPredicate("gecode_constraint_dom_244", gecode_constraint_dom_244, 3); +YAP_UserCPredicate("gecode_constraint_dom_246", gecode_constraint_dom_246, 3); +YAP_UserCPredicate("gecode_constraint_dom_247", gecode_constraint_dom_247, 3); +YAP_UserCPredicate("gecode_constraint_dom_253", gecode_constraint_dom_253, 3); +YAP_UserCPredicate("gecode_constraint_dom_259", gecode_constraint_dom_259, 3); +YAP_UserCPredicate("gecode_constraint_dom_267", gecode_constraint_dom_267, 3); +YAP_UserCPredicate("gecode_constraint_dom_224", gecode_constraint_dom_224, 4); +YAP_UserCPredicate("gecode_constraint_dom_226", gecode_constraint_dom_226, 4); +YAP_UserCPredicate("gecode_constraint_dom_228", gecode_constraint_dom_228, 4); +YAP_UserCPredicate("gecode_constraint_dom_231", gecode_constraint_dom_231, 4); +YAP_UserCPredicate("gecode_constraint_dom_233", gecode_constraint_dom_233, 4); +YAP_UserCPredicate("gecode_constraint_dom_234", gecode_constraint_dom_234, 4); +YAP_UserCPredicate("gecode_constraint_dom_237", gecode_constraint_dom_237, 4); +YAP_UserCPredicate("gecode_constraint_dom_239", gecode_constraint_dom_239, 4); +YAP_UserCPredicate("gecode_constraint_dom_240", gecode_constraint_dom_240, 4); +YAP_UserCPredicate("gecode_constraint_dom_242", gecode_constraint_dom_242, 4); +YAP_UserCPredicate("gecode_constraint_dom_245", gecode_constraint_dom_245, 4); +YAP_UserCPredicate("gecode_constraint_dom_248", gecode_constraint_dom_248, 4); +YAP_UserCPredicate("gecode_constraint_dom_249", gecode_constraint_dom_249, 4); +YAP_UserCPredicate("gecode_constraint_dom_251", gecode_constraint_dom_251, 4); +YAP_UserCPredicate("gecode_constraint_dom_254", gecode_constraint_dom_254, 4); +YAP_UserCPredicate("gecode_constraint_dom_257", gecode_constraint_dom_257, 4); +YAP_UserCPredicate("gecode_constraint_dom_260", gecode_constraint_dom_260, 4); +YAP_UserCPredicate("gecode_constraint_dom_261", gecode_constraint_dom_261, 4); +YAP_UserCPredicate("gecode_constraint_dom_263", gecode_constraint_dom_263, 4); +YAP_UserCPredicate("gecode_constraint_dom_235", gecode_constraint_dom_235, 5); +YAP_UserCPredicate("gecode_constraint_dom_241", gecode_constraint_dom_241, 5); +YAP_UserCPredicate("gecode_constraint_dom_243", gecode_constraint_dom_243, 5); +YAP_UserCPredicate("gecode_constraint_dom_250", gecode_constraint_dom_250, 5); +YAP_UserCPredicate("gecode_constraint_dom_252", gecode_constraint_dom_252, 5); +YAP_UserCPredicate("gecode_constraint_dom_255", gecode_constraint_dom_255, 5); +YAP_UserCPredicate("gecode_constraint_dom_258", gecode_constraint_dom_258, 5); +YAP_UserCPredicate("gecode_constraint_dom_262", gecode_constraint_dom_262, 5); +YAP_UserCPredicate("gecode_constraint_dom_264", gecode_constraint_dom_264, 5); +YAP_UserCPredicate("gecode_constraint_dom_266", gecode_constraint_dom_266, 5); +YAP_UserCPredicate("gecode_constraint_dom_256", gecode_constraint_dom_256, 6); +YAP_UserCPredicate("gecode_constraint_dom_265", gecode_constraint_dom_265, 6); +YAP_UserCPredicate("gecode_constraint_element_268", gecode_constraint_element_268, 4); +YAP_UserCPredicate("gecode_constraint_element_270", gecode_constraint_element_270, 4); +YAP_UserCPredicate("gecode_constraint_element_274", gecode_constraint_element_274, 4); +YAP_UserCPredicate("gecode_constraint_element_278", gecode_constraint_element_278, 4); +YAP_UserCPredicate("gecode_constraint_element_280", gecode_constraint_element_280, 4); +YAP_UserCPredicate("gecode_constraint_element_282", gecode_constraint_element_282, 4); +YAP_UserCPredicate("gecode_constraint_element_288", gecode_constraint_element_288, 4); +YAP_UserCPredicate("gecode_constraint_element_269", gecode_constraint_element_269, 5); +YAP_UserCPredicate("gecode_constraint_element_271", gecode_constraint_element_271, 5); +YAP_UserCPredicate("gecode_constraint_element_275", gecode_constraint_element_275, 5); +YAP_UserCPredicate("gecode_constraint_element_279", gecode_constraint_element_279, 5); +YAP_UserCPredicate("gecode_constraint_element_281", gecode_constraint_element_281, 5); +YAP_UserCPredicate("gecode_constraint_element_283", gecode_constraint_element_283, 5); +YAP_UserCPredicate("gecode_constraint_element_289", gecode_constraint_element_289, 5); +YAP_UserCPredicate("gecode_constraint_element_272", gecode_constraint_element_272, 7); +YAP_UserCPredicate("gecode_constraint_element_276", gecode_constraint_element_276, 7); +YAP_UserCPredicate("gecode_constraint_element_284", gecode_constraint_element_284, 7); +YAP_UserCPredicate("gecode_constraint_element_286", gecode_constraint_element_286, 7); +YAP_UserCPredicate("gecode_constraint_element_273", gecode_constraint_element_273, 8); +YAP_UserCPredicate("gecode_constraint_element_277", gecode_constraint_element_277, 8); +YAP_UserCPredicate("gecode_constraint_element_285", gecode_constraint_element_285, 8); +YAP_UserCPredicate("gecode_constraint_element_287", gecode_constraint_element_287, 8); +YAP_UserCPredicate("gecode_constraint_extensional_290", gecode_constraint_extensional_290, 4); +YAP_UserCPredicate("gecode_constraint_extensional_295", gecode_constraint_extensional_295, 4); +YAP_UserCPredicate("gecode_constraint_extensional_296", gecode_constraint_extensional_296, 4); +YAP_UserCPredicate("gecode_constraint_extensional_301", gecode_constraint_extensional_301, 4); +YAP_UserCPredicate("gecode_constraint_extensional_291", gecode_constraint_extensional_291, 5); +YAP_UserCPredicate("gecode_constraint_extensional_292", gecode_constraint_extensional_292, 5); +YAP_UserCPredicate("gecode_constraint_extensional_297", gecode_constraint_extensional_297, 5); +YAP_UserCPredicate("gecode_constraint_extensional_298", gecode_constraint_extensional_298, 5); +YAP_UserCPredicate("gecode_constraint_extensional_293", gecode_constraint_extensional_293, 6); +YAP_UserCPredicate("gecode_constraint_extensional_299", gecode_constraint_extensional_299, 6); +YAP_UserCPredicate("gecode_constraint_extensional_294", gecode_constraint_extensional_294, 3); +YAP_UserCPredicate("gecode_constraint_extensional_300", gecode_constraint_extensional_300, 3); +YAP_UserCPredicate("gecode_constraint_ite_302", gecode_constraint_ite_302, 5); +YAP_UserCPredicate("gecode_constraint_ite_304", gecode_constraint_ite_304, 5); +YAP_UserCPredicate("gecode_constraint_ite_305", gecode_constraint_ite_305, 5); +YAP_UserCPredicate("gecode_constraint_ite_307", gecode_constraint_ite_307, 5); +YAP_UserCPredicate("gecode_constraint_ite_303", gecode_constraint_ite_303, 6); +YAP_UserCPredicate("gecode_constraint_ite_306", gecode_constraint_ite_306, 6); +YAP_UserCPredicate("gecode_constraint_linear_308", gecode_constraint_linear_308, 4); +YAP_UserCPredicate("gecode_constraint_linear_312", gecode_constraint_linear_312, 4); +YAP_UserCPredicate("gecode_constraint_linear_320", gecode_constraint_linear_320, 4); +YAP_UserCPredicate("gecode_constraint_linear_322", gecode_constraint_linear_322, 4); +YAP_UserCPredicate("gecode_constraint_linear_340", gecode_constraint_linear_340, 4); +YAP_UserCPredicate("gecode_constraint_linear_344", gecode_constraint_linear_344, 4); +YAP_UserCPredicate("gecode_constraint_linear_309", gecode_constraint_linear_309, 5); +YAP_UserCPredicate("gecode_constraint_linear_310", gecode_constraint_linear_310, 5); +YAP_UserCPredicate("gecode_constraint_linear_313", gecode_constraint_linear_313, 5); +YAP_UserCPredicate("gecode_constraint_linear_314", gecode_constraint_linear_314, 5); +YAP_UserCPredicate("gecode_constraint_linear_316", gecode_constraint_linear_316, 5); +YAP_UserCPredicate("gecode_constraint_linear_318", gecode_constraint_linear_318, 5); +YAP_UserCPredicate("gecode_constraint_linear_321", gecode_constraint_linear_321, 5); +YAP_UserCPredicate("gecode_constraint_linear_323", gecode_constraint_linear_323, 5); +YAP_UserCPredicate("gecode_constraint_linear_324", gecode_constraint_linear_324, 5); +YAP_UserCPredicate("gecode_constraint_linear_328", gecode_constraint_linear_328, 5); +YAP_UserCPredicate("gecode_constraint_linear_332", gecode_constraint_linear_332, 5); +YAP_UserCPredicate("gecode_constraint_linear_336", gecode_constraint_linear_336, 5); +YAP_UserCPredicate("gecode_constraint_linear_341", gecode_constraint_linear_341, 5); +YAP_UserCPredicate("gecode_constraint_linear_342", gecode_constraint_linear_342, 5); +YAP_UserCPredicate("gecode_constraint_linear_345", gecode_constraint_linear_345, 5); +YAP_UserCPredicate("gecode_constraint_linear_346", gecode_constraint_linear_346, 5); +YAP_UserCPredicate("gecode_constraint_linear_311", gecode_constraint_linear_311, 6); +YAP_UserCPredicate("gecode_constraint_linear_315", gecode_constraint_linear_315, 6); +YAP_UserCPredicate("gecode_constraint_linear_317", gecode_constraint_linear_317, 6); +YAP_UserCPredicate("gecode_constraint_linear_319", gecode_constraint_linear_319, 6); +YAP_UserCPredicate("gecode_constraint_linear_325", gecode_constraint_linear_325, 6); +YAP_UserCPredicate("gecode_constraint_linear_326", gecode_constraint_linear_326, 6); +YAP_UserCPredicate("gecode_constraint_linear_329", gecode_constraint_linear_329, 6); +YAP_UserCPredicate("gecode_constraint_linear_330", gecode_constraint_linear_330, 6); +YAP_UserCPredicate("gecode_constraint_linear_333", gecode_constraint_linear_333, 6); +YAP_UserCPredicate("gecode_constraint_linear_334", gecode_constraint_linear_334, 6); +YAP_UserCPredicate("gecode_constraint_linear_337", gecode_constraint_linear_337, 6); +YAP_UserCPredicate("gecode_constraint_linear_338", gecode_constraint_linear_338, 6); +YAP_UserCPredicate("gecode_constraint_linear_343", gecode_constraint_linear_343, 6); +YAP_UserCPredicate("gecode_constraint_linear_347", gecode_constraint_linear_347, 6); +YAP_UserCPredicate("gecode_constraint_linear_327", gecode_constraint_linear_327, 7); +YAP_UserCPredicate("gecode_constraint_linear_331", gecode_constraint_linear_331, 7); +YAP_UserCPredicate("gecode_constraint_linear_335", gecode_constraint_linear_335, 7); +YAP_UserCPredicate("gecode_constraint_linear_339", gecode_constraint_linear_339, 7); +YAP_UserCPredicate("gecode_constraint_max_348", gecode_constraint_max_348, 3); +YAP_UserCPredicate("gecode_constraint_max_349", gecode_constraint_max_349, 3); +YAP_UserCPredicate("gecode_constraint_max_350", gecode_constraint_max_350, 4); +YAP_UserCPredicate("gecode_constraint_max_351", gecode_constraint_max_351, 4); +YAP_UserCPredicate("gecode_constraint_max_352", gecode_constraint_max_352, 4); +YAP_UserCPredicate("gecode_constraint_max_353", gecode_constraint_max_353, 5); +YAP_UserCPredicate("gecode_constraint_member_354", gecode_constraint_member_354, 3); +YAP_UserCPredicate("gecode_constraint_member_358", gecode_constraint_member_358, 3); +YAP_UserCPredicate("gecode_constraint_member_355", gecode_constraint_member_355, 4); +YAP_UserCPredicate("gecode_constraint_member_356", gecode_constraint_member_356, 4); +YAP_UserCPredicate("gecode_constraint_member_359", gecode_constraint_member_359, 4); +YAP_UserCPredicate("gecode_constraint_member_360", gecode_constraint_member_360, 4); +YAP_UserCPredicate("gecode_constraint_member_357", gecode_constraint_member_357, 5); +YAP_UserCPredicate("gecode_constraint_member_361", gecode_constraint_member_361, 5); +YAP_UserCPredicate("gecode_constraint_min_362", gecode_constraint_min_362, 3); +YAP_UserCPredicate("gecode_constraint_min_363", gecode_constraint_min_363, 3); +YAP_UserCPredicate("gecode_constraint_min_364", gecode_constraint_min_364, 4); +YAP_UserCPredicate("gecode_constraint_min_365", gecode_constraint_min_365, 4); +YAP_UserCPredicate("gecode_constraint_min_366", gecode_constraint_min_366, 4); +YAP_UserCPredicate("gecode_constraint_min_367", gecode_constraint_min_367, 5); +YAP_UserCPredicate("gecode_constraint_mod_368", gecode_constraint_mod_368, 4); +YAP_UserCPredicate("gecode_constraint_mod_369", gecode_constraint_mod_369, 5); +YAP_UserCPredicate("gecode_constraint_mult_370", gecode_constraint_mult_370, 4); +YAP_UserCPredicate("gecode_constraint_mult_371", gecode_constraint_mult_371, 4); +YAP_UserCPredicate("gecode_constraint_mult_372", gecode_constraint_mult_372, 5); +YAP_UserCPredicate("gecode_constraint_nooverlap_373", gecode_constraint_nooverlap_373, 6); +YAP_UserCPredicate("gecode_constraint_nooverlap_376", gecode_constraint_nooverlap_376, 6); +YAP_UserCPredicate("gecode_constraint_nooverlap_374", gecode_constraint_nooverlap_374, 7); +YAP_UserCPredicate("gecode_constraint_nooverlap_379", gecode_constraint_nooverlap_379, 7); +YAP_UserCPredicate("gecode_constraint_nooverlap_375", gecode_constraint_nooverlap_375, 5); +YAP_UserCPredicate("gecode_constraint_nooverlap_377", gecode_constraint_nooverlap_377, 8); +YAP_UserCPredicate("gecode_constraint_nooverlap_380", gecode_constraint_nooverlap_380, 8); +YAP_UserCPredicate("gecode_constraint_nooverlap_378", gecode_constraint_nooverlap_378, 9); +YAP_UserCPredicate("gecode_constraint_nroot_381", gecode_constraint_nroot_381, 4); +YAP_UserCPredicate("gecode_constraint_nroot_382", gecode_constraint_nroot_382, 4); +YAP_UserCPredicate("gecode_constraint_nroot_383", gecode_constraint_nroot_383, 5); +YAP_UserCPredicate("gecode_constraint_nvalues_384", gecode_constraint_nvalues_384, 4); +YAP_UserCPredicate("gecode_constraint_nvalues_386", gecode_constraint_nvalues_386, 4); +YAP_UserCPredicate("gecode_constraint_nvalues_388", gecode_constraint_nvalues_388, 4); +YAP_UserCPredicate("gecode_constraint_nvalues_390", gecode_constraint_nvalues_390, 4); +YAP_UserCPredicate("gecode_constraint_nvalues_385", gecode_constraint_nvalues_385, 5); +YAP_UserCPredicate("gecode_constraint_nvalues_387", gecode_constraint_nvalues_387, 5); +YAP_UserCPredicate("gecode_constraint_nvalues_389", gecode_constraint_nvalues_389, 5); +YAP_UserCPredicate("gecode_constraint_nvalues_391", gecode_constraint_nvalues_391, 5); +YAP_UserCPredicate("gecode_constraint_order_392", gecode_constraint_order_392, 6); +YAP_UserCPredicate("gecode_constraint_order_393", gecode_constraint_order_393, 7); +YAP_UserCPredicate("gecode_constraint_path_394", gecode_constraint_path_394, 7); +YAP_UserCPredicate("gecode_constraint_path_397", gecode_constraint_path_397, 7); +YAP_UserCPredicate("gecode_constraint_path_400", gecode_constraint_path_400, 7); +YAP_UserCPredicate("gecode_constraint_path_395", gecode_constraint_path_395, 8); +YAP_UserCPredicate("gecode_constraint_path_398", gecode_constraint_path_398, 8); +YAP_UserCPredicate("gecode_constraint_path_401", gecode_constraint_path_401, 8); +YAP_UserCPredicate("gecode_constraint_path_396", gecode_constraint_path_396, 6); +YAP_UserCPredicate("gecode_constraint_path_405", gecode_constraint_path_405, 6); +YAP_UserCPredicate("gecode_constraint_path_399", gecode_constraint_path_399, 9); +YAP_UserCPredicate("gecode_constraint_path_402", gecode_constraint_path_402, 4); +YAP_UserCPredicate("gecode_constraint_path_403", gecode_constraint_path_403, 5); +YAP_UserCPredicate("gecode_constraint_path_404", gecode_constraint_path_404, 5); +YAP_UserCPredicate("gecode_constraint_pow_406", gecode_constraint_pow_406, 4); +YAP_UserCPredicate("gecode_constraint_pow_407", gecode_constraint_pow_407, 4); +YAP_UserCPredicate("gecode_constraint_pow_408", gecode_constraint_pow_408, 5); +YAP_UserCPredicate("gecode_constraint_precede_409", gecode_constraint_precede_409, 3); +YAP_UserCPredicate("gecode_constraint_precede_410", gecode_constraint_precede_410, 4); +YAP_UserCPredicate("gecode_constraint_precede_411", gecode_constraint_precede_411, 4); +YAP_UserCPredicate("gecode_constraint_precede_412", gecode_constraint_precede_412, 5); +YAP_UserCPredicate("gecode_constraint_relax_413", gecode_constraint_relax_413, 5); +YAP_UserCPredicate("gecode_constraint_relax_414", gecode_constraint_relax_414, 5); +YAP_UserCPredicate("gecode_constraint_rel_415", gecode_constraint_rel_415, 4); +YAP_UserCPredicate("gecode_constraint_rel_417", gecode_constraint_rel_417, 4); +YAP_UserCPredicate("gecode_constraint_rel_423", gecode_constraint_rel_423, 4); +YAP_UserCPredicate("gecode_constraint_rel_427", gecode_constraint_rel_427, 4); +YAP_UserCPredicate("gecode_constraint_rel_431", gecode_constraint_rel_431, 4); +YAP_UserCPredicate("gecode_constraint_rel_433", gecode_constraint_rel_433, 4); +YAP_UserCPredicate("gecode_constraint_rel_435", gecode_constraint_rel_435, 4); +YAP_UserCPredicate("gecode_constraint_rel_437", gecode_constraint_rel_437, 4); +YAP_UserCPredicate("gecode_constraint_rel_440", gecode_constraint_rel_440, 4); +YAP_UserCPredicate("gecode_constraint_rel_441", gecode_constraint_rel_441, 4); +YAP_UserCPredicate("gecode_constraint_rel_442", gecode_constraint_rel_442, 4); +YAP_UserCPredicate("gecode_constraint_rel_443", gecode_constraint_rel_443, 4); +YAP_UserCPredicate("gecode_constraint_rel_445", gecode_constraint_rel_445, 4); +YAP_UserCPredicate("gecode_constraint_rel_447", gecode_constraint_rel_447, 4); +YAP_UserCPredicate("gecode_constraint_rel_449", gecode_constraint_rel_449, 4); +YAP_UserCPredicate("gecode_constraint_rel_451", gecode_constraint_rel_451, 4); +YAP_UserCPredicate("gecode_constraint_rel_454", gecode_constraint_rel_454, 4); +YAP_UserCPredicate("gecode_constraint_rel_455", gecode_constraint_rel_455, 4); +YAP_UserCPredicate("gecode_constraint_rel_457", gecode_constraint_rel_457, 4); +YAP_UserCPredicate("gecode_constraint_rel_459", gecode_constraint_rel_459, 4); +YAP_UserCPredicate("gecode_constraint_rel_461", gecode_constraint_rel_461, 4); +YAP_UserCPredicate("gecode_constraint_rel_465", gecode_constraint_rel_465, 4); +YAP_UserCPredicate("gecode_constraint_rel_469", gecode_constraint_rel_469, 4); +YAP_UserCPredicate("gecode_constraint_rel_471", gecode_constraint_rel_471, 4); +YAP_UserCPredicate("gecode_constraint_rel_473", gecode_constraint_rel_473, 4); +YAP_UserCPredicate("gecode_constraint_rel_475", gecode_constraint_rel_475, 4); +YAP_UserCPredicate("gecode_constraint_rel_416", gecode_constraint_rel_416, 5); +YAP_UserCPredicate("gecode_constraint_rel_418", gecode_constraint_rel_418, 5); +YAP_UserCPredicate("gecode_constraint_rel_419", gecode_constraint_rel_419, 5); +YAP_UserCPredicate("gecode_constraint_rel_421", gecode_constraint_rel_421, 5); +YAP_UserCPredicate("gecode_constraint_rel_424", gecode_constraint_rel_424, 5); +YAP_UserCPredicate("gecode_constraint_rel_425", gecode_constraint_rel_425, 5); +YAP_UserCPredicate("gecode_constraint_rel_428", gecode_constraint_rel_428, 5); +YAP_UserCPredicate("gecode_constraint_rel_429", gecode_constraint_rel_429, 5); +YAP_UserCPredicate("gecode_constraint_rel_432", gecode_constraint_rel_432, 5); +YAP_UserCPredicate("gecode_constraint_rel_434", gecode_constraint_rel_434, 5); +YAP_UserCPredicate("gecode_constraint_rel_436", gecode_constraint_rel_436, 5); +YAP_UserCPredicate("gecode_constraint_rel_438", gecode_constraint_rel_438, 5); +YAP_UserCPredicate("gecode_constraint_rel_444", gecode_constraint_rel_444, 5); +YAP_UserCPredicate("gecode_constraint_rel_446", gecode_constraint_rel_446, 5); +YAP_UserCPredicate("gecode_constraint_rel_448", gecode_constraint_rel_448, 5); +YAP_UserCPredicate("gecode_constraint_rel_450", gecode_constraint_rel_450, 5); +YAP_UserCPredicate("gecode_constraint_rel_452", gecode_constraint_rel_452, 5); +YAP_UserCPredicate("gecode_constraint_rel_456", gecode_constraint_rel_456, 5); +YAP_UserCPredicate("gecode_constraint_rel_458", gecode_constraint_rel_458, 5); +YAP_UserCPredicate("gecode_constraint_rel_460", gecode_constraint_rel_460, 5); +YAP_UserCPredicate("gecode_constraint_rel_462", gecode_constraint_rel_462, 5); +YAP_UserCPredicate("gecode_constraint_rel_463", gecode_constraint_rel_463, 5); +YAP_UserCPredicate("gecode_constraint_rel_466", gecode_constraint_rel_466, 5); +YAP_UserCPredicate("gecode_constraint_rel_467", gecode_constraint_rel_467, 5); +YAP_UserCPredicate("gecode_constraint_rel_470", gecode_constraint_rel_470, 5); +YAP_UserCPredicate("gecode_constraint_rel_472", gecode_constraint_rel_472, 5); +YAP_UserCPredicate("gecode_constraint_rel_474", gecode_constraint_rel_474, 5); +YAP_UserCPredicate("gecode_constraint_rel_476", gecode_constraint_rel_476, 5); +YAP_UserCPredicate("gecode_constraint_rel_420", gecode_constraint_rel_420, 6); +YAP_UserCPredicate("gecode_constraint_rel_422", gecode_constraint_rel_422, 6); +YAP_UserCPredicate("gecode_constraint_rel_426", gecode_constraint_rel_426, 6); +YAP_UserCPredicate("gecode_constraint_rel_430", gecode_constraint_rel_430, 6); +YAP_UserCPredicate("gecode_constraint_rel_464", gecode_constraint_rel_464, 6); +YAP_UserCPredicate("gecode_constraint_rel_468", gecode_constraint_rel_468, 6); +YAP_UserCPredicate("gecode_constraint_rel_439", gecode_constraint_rel_439, 3); +YAP_UserCPredicate("gecode_constraint_rel_453", gecode_constraint_rel_453, 3); +YAP_UserCPredicate("gecode_constraint_sequence_477", gecode_constraint_sequence_477, 6); +YAP_UserCPredicate("gecode_constraint_sequence_479", gecode_constraint_sequence_479, 6); +YAP_UserCPredicate("gecode_constraint_sequence_478", gecode_constraint_sequence_478, 7); +YAP_UserCPredicate("gecode_constraint_sequence_480", gecode_constraint_sequence_480, 7); +YAP_UserCPredicate("gecode_constraint_sorted_481", gecode_constraint_sorted_481, 4); +YAP_UserCPredicate("gecode_constraint_sorted_484", gecode_constraint_sorted_484, 4); +YAP_UserCPredicate("gecode_constraint_sorted_482", gecode_constraint_sorted_482, 5); +YAP_UserCPredicate("gecode_constraint_sorted_483", gecode_constraint_sorted_483, 3); +YAP_UserCPredicate("gecode_constraint_sqr_485", gecode_constraint_sqr_485, 3); +YAP_UserCPredicate("gecode_constraint_sqr_486", gecode_constraint_sqr_486, 3); +YAP_UserCPredicate("gecode_constraint_sqr_487", gecode_constraint_sqr_487, 4); +YAP_UserCPredicate("gecode_constraint_sqrt_488", gecode_constraint_sqrt_488, 3); +YAP_UserCPredicate("gecode_constraint_sqrt_489", gecode_constraint_sqrt_489, 3); +YAP_UserCPredicate("gecode_constraint_sqrt_490", gecode_constraint_sqrt_490, 4); +YAP_UserCPredicate("gecode_constraint_unary_491", gecode_constraint_unary_491, 4); +YAP_UserCPredicate("gecode_constraint_unary_494", gecode_constraint_unary_494, 4); +YAP_UserCPredicate("gecode_constraint_unary_497", gecode_constraint_unary_497, 4); +YAP_UserCPredicate("gecode_constraint_unary_501", gecode_constraint_unary_501, 4); +YAP_UserCPredicate("gecode_constraint_unary_492", gecode_constraint_unary_492, 5); +YAP_UserCPredicate("gecode_constraint_unary_495", gecode_constraint_unary_495, 5); +YAP_UserCPredicate("gecode_constraint_unary_498", gecode_constraint_unary_498, 5); +YAP_UserCPredicate("gecode_constraint_unary_499", gecode_constraint_unary_499, 5); +YAP_UserCPredicate("gecode_constraint_unary_502", gecode_constraint_unary_502, 5); +YAP_UserCPredicate("gecode_constraint_unary_493", gecode_constraint_unary_493, 3); +YAP_UserCPredicate("gecode_constraint_unary_496", gecode_constraint_unary_496, 6); +YAP_UserCPredicate("gecode_constraint_unary_500", gecode_constraint_unary_500, 6); +YAP_UserCPredicate("gecode_constraint_unshare_503", gecode_constraint_unshare_503, 2); +YAP_UserCPredicate("gecode_constraint_unshare_505", gecode_constraint_unshare_505, 2); +YAP_UserCPredicate("gecode_constraint_unshare_504", gecode_constraint_unshare_504, 3); +YAP_UserCPredicate("gecode_constraint_unshare_506", gecode_constraint_unshare_506, 3); +YAP_UserCPredicate("gecode_constraint_when_507", gecode_constraint_when_507, 3); +YAP_UserCPredicate("gecode_constraint_when_508", gecode_constraint_when_508, 4); +YAP_UserCPredicate("gecode_constraint_when_509", gecode_constraint_when_509, 4); +YAP_UserCPredicate("gecode_constraint_when_510", gecode_constraint_when_510, 5); diff --git a/packages/gecode/clpfd.yap b/packages/gecode/clpfd.yap index a5a683113..4b5f77691 100644 --- a/packages/gecode/clpfd.yap +++ b/packages/gecode/clpfd.yap @@ -9,7 +9,7 @@ in a more CLP like style. It requires ~~~~~{.prolog} :- use_module(library(gecode/clpfd)). ~~~~~ -Several example programs are available with the distribution. +Several example programs are available with the distributionv. Integer variables are declared as: @@ -72,6 +72,7 @@ Constraints supported are: (#\/)/2, (#/\)/2, in/2 , + fd_in/2 , ins/2, boolvar/1, boolvars/1, @@ -80,7 +81,7 @@ Constraints supported are: all_distinct/2, maximize/1, minimize/1, - sum/3, + sum/3, fd_sum/3, lex_chain/1, minimum/2, min/2, @@ -95,7 +96,8 @@ Constraints supported are: in_dfa/2, in_dfa/4, /* tuples_in/2, */ - labeling/2 /*, + labeling/2, + bool_labeling/2 /*, label/1, indomain/1, serialized/2, @@ -232,6 +234,7 @@ The product of constant _Cs_ by _Vs_ must be in relation :- reexport(library(matrix), [(<==)/2, op(800, xfx, '<=='), op(700, xfx, in), + op(700, xfx, fd_in), op(700, xfx, ins), op(450, xfx, ..), % should bind more tightly than \/ op(710, xfx, of), @@ -258,13 +261,13 @@ constraint( (_ #<==> _) ). constraint( (_ #==> _) ). constraint( (_ #<== _) ). constraint( (_ #\/ _) ). -constraint( (_ #/\ _) ). -constraint( in(_, _) ). %2, +constraint( fd_in(_, _) ). %2, constraint( ins(_, _) ). %2, constraint( all_different(_) ). %1, constraint( all_distinct(_) ). %1, constraint( all_distinct(_,_) ). %1, constraint( sum(_, _, _) ). %3, +constraint( fd_sum(_, _, _) ). %3, constraint( scalar_product(_, _, _, _) ). %4, constraint( min(_, _) ). %2, constraint( minimum(_, _) ). %2, @@ -290,19 +293,25 @@ constraint( zcompare(_, _, _) ). %3, constraint( chain(_, _) ). %2, constraint( element(_, _) ). %2, constraint( fd_var(_) ). %1, -constraint( fd_inf(_, _) ). %2, +sconstraint( fd_inf(_, _) ). %2, constraint( fd_sup(_, _) ). %2, constraint( fd_size(_, _) ). %2, constraint( fd_dom(_, _) ). %2 constraint( clause(_, _, _, _) ). %2 -process_constraints((B0,B1), (NB0, NB1), Env) :- - process_constraints(B0, NB0, Env), - process_constraints(B1, NB1, Env). -process_constraints(B, B, env(_Space)) :- +process_constraints(V, V, _Env, _) :- + var(V), !. +process_constraints((B0,B1), (NB0, NB1), Env, L) :- + process_constraints(B0, NB0, Env, L), + process_constraints(B1, NB1, Env,L). +process_constraints(labeling(A,B),labeling(A, B), env(_Space),true) :- + !. +process_constraints(bool_labeling(A,B),bool_labeling(A, B), env(_Space),true) :- + !. +process_constraints(B, B, env(_Space),_) :- constraint(B), !. -process_constraints(B, B, _Env). +process_constraints(B, B, _Env,_). % process_constraint(B, NB, Space). ( A #= B) :- @@ -385,6 +394,8 @@ sum( L, Op, V) :- check(L, NL), check(V, NV), post( rel(sum(NL), Op, NV), Env, _). +fd_sum( L, Op, V) :- + sum( L, Op, V). ( ( A #<==> VBool )) :- get_home(Space-Map), check(A, NA), @@ -444,6 +455,13 @@ sum( L, Op, V) :- check(B, NB), m(X, NX, NA, NB, Map), NX := intvar(Space, NA, NB). +( X fd_in A..B) :- + var(X), + get_home(Space-Map), + check(A, NA), + check(B, NB), + m(X, NX, NA, NB, Map), + NX := intvar(Space, NA, NB). ( Xs ins A..B) :- get_home(Space-Map), check(A, NA), @@ -535,23 +553,39 @@ clause( or, Ps, Ns, V ) :- check(V, NV), post(clause( 'BOT_OR', NPs, NNs, NV), Env, _ ). -labeling(Opts, Xs) :- +bool_labeling(Opts, Xs) :- get_home(Space-Map), - foldl2( processs_lab_opt, Opts, 'INT_VAR_SIZE_MIN', BranchVar, 'INT_VAL_MIN', BranchVal), + foldl2( process_bool_lab_opt, Opts, 'BOOL_VAR_DEGREE_MIN', BranchVar, 'BOOL_VAL_MIN', BranchVal), term_variables(Xs, Vs), check( Vs, X1s ), ( X1s == [] -> true ; maplist(ll(Map), X1s, NXs), Space += branch(NXs, BranchVar, BranchVal) ). -processs_lab_opt(leftmost, _, 'INT_VAR_NONE', BranchVal, BranchVal). -processs_lab_opt(min, _, 'INT_VAR_SIZE_MIN', BranchVal, BranchVal). -processs_lab_opt(max, _, 'INT_VAR_SIZE_MAX', BranchVal, BranchVal). -processs_lab_opt(ff, _, 'INT_VAR_DEGREE_MIN', BranchVal, BranchVal). -processs_lab_opt(min_step, BranchVar, BranchVar, _, 'INT_VAL_MIN'). -processs_lab_opt(max_step, BranchVar, BranchVar, _, 'INT_VAL_MIN'). -processs_lab_opt(bisect, BranchVar, BranchVar, _, 'INT_VAL_MED'). -processs_lab_opt(enum, BranchVar, BranchVar, _, 'INT_VALUES_MIN'). +process_bool_lab_opt(leftmost, _, 'BOOL_VAR_NONE', BranchVal, BranchVal). +process_bool_lab_opt(min, _, 'BOOL_VAR_DEGREE_MIN', BranchVal, BranchVal). +process_bool_lab_opt(max, _, 'BOOL_VAR_DEGREE_MAX', BranchVal, BranchVal). +process_bool_lab_opt(min_step, BranchVar, BranchVar, _, 'BOOL_VAL_MIN'). +process_bool_lab_opt(max_step, BranchVar, BranchVar, _, 'BOOL_VAL_MIN'). +process_bool_lab_opt(enum, BranchVar, BranchVar, _, 'BOOL_VALUES_MIN'). + +labeling(Opts, Xs) :- + get_home(Space-Map), + foldl2( process_lab_opt, Opts, 'INT_VAR_SIZE_MIN', BranchVar, 'INT_VAL_MIN', BranchVal), + term_variables(Xs, Vs), + check( Vs, X1s ), + ( X1s == [] -> true ; + maplist(ll(Map), X1s, NXs), + Space += branch(NXs, BranchVar, BranchVal) ). + +process_lab_opt(leftmost, _, 'INT_VAR_NONE', BranchVal, BranchVal). +process_lab_opt(min, _, 'INT_VAR_SIZE_MIN', BranchVal, BranchVal). +process_lab_opt(max, _, 'INT_VAR_SIZE_MAX', BranchVal, BranchVal). +process_lab_opt(ff, _, 'INT_VAR_DEGREE_MIN', BranchVal, BranchVal). +process_lab_opt(min_step, BranchVar, BranchVar, _, 'INT_VAL_MIN'). +process_lab_opt(max_step, BranchVar, BranchVar, _, 'INT_VAL_MIN'). +process_lab_opt(bisect, BranchVar, BranchVar, _, 'INT_VAL_MED'). +process_lab_opt(enum, BranchVar, BranchVar, _, 'INT_VALUES_MIN'). maximize(V) :- @@ -570,7 +604,6 @@ extensional_constraint( Tuples, TupleSet) :- dfa( S0, Transitions, Finals, DFA) :- DFA := dfa( S0, Transitions, Finals ). - check(V, NV) :- ( var(V) -> V = NV ; number(V) -> V = NV ; @@ -580,6 +613,9 @@ check(V, NV) :- V = '$matrix'(_, _, _, _, C) -> C =.. [_|L], maplist(check, L, NV) ; V = A+B -> check(A,NA), check(B, NB), NV = NB+NA ; V = A-B -> check(A,NA), check(B, NB), NV = NB-NA ; + V = A/\B -> check(A,NA), check(B, NB), NV = NB/\NA ; + V = A\/B -> check(A,NA), check(B, NB), NV = NB\/NA ; + V fd_in A..B, var(V) -> check(A,NA), check(B, NB), NV fd_in NB..NA ; arith(V, _) -> V =.. [C|L], maplist(check, L, NL), NV =.. [C|NL] ; constraint(V) -> V =.. [C|L], maplist(check, L, NL), NV =.. [C|NL] ). @@ -663,9 +699,37 @@ post( rel( sum(Foreach, Cond), Op, Out), Space-Map, Reify):- !, Space += linear(Cs, IL, GOP, IOut); Space += linear(Cs, IL, GOP, IOut, Reify) ). +post( rel( sum(L0), Op, Out), Space-Map, Reify):- +!, + selectlist(var,L0,L,LC), + sumlist(LC,0), + ( var(Out) -> l(Out, IOut, Map) ; integer(Out) -> IOut = Out ; equality(Out, NOut, Space-Map), l(NOut, IOut, Map) ), + maplist(ll(Map), [Out|L], [IOut|IL] ), + gecode_arith_op( Op, GOP ), + (L = [] -> true ; + var(Reify) -> + Space += linear(Cs, IL, GOP, IOut); + Space += linear(Cs, IL, GOP, IOut, Reify) + ). post( rel(A1+A2, Op, B), Space-Map, Reify):- - ( nonvar(B) ; B = _ + _ ; B = _-_), !, + var( B ), !, + linearize(A1+A2, 1, As, [], CAs, [], 0, A0, Space-Map), + l(B, B0, Map), + gecode_arith_op( Op, GOP ), + (var(Reify) -> + ( checklist(is_one, CAs) -> + Space += linear(As, GOP, B0); + Space += linear(CAs, As, GOP, B0) + ) + ; + ( checklist(is_one, CAs) -> + Space += linear(As, GOP, B0, Reify); + Space += linear(CAs, As, GOP, B0, Reify) + ) + ). +post( rel(A1+A2, Op, B), Space-Map, Reify):- + ( B = _ + _ ; B = _-_), !, linearize(A1+A2, 1, As, Bs, CAs, CBs, 0, A0, Space-Map), linearize(B, -1, Bs, [], CBs, [], A0, B0, Space-Map), gecode_arith_op( Op, GOP ), @@ -682,7 +746,24 @@ post( rel(A1+A2, Op, B), Space-Map, Reify):- ). post( rel(A1-A2, Op, B), Space-Map, Reify):- - ( nonvar(B) ; B = _ + _ ; B = _-_), !, + ( var(B) ), !, + linearize(A1-A2, 1, As, [], CAs, [], 0, A0, Space-Map), + l(B, B0, Map), + gecode_arith_op( Op, GOP ), + (var(Reify) -> + ( checklist(is_one, CAs) -> + Space += linear(As, GOP, B0); + Space += linear(CAs, As, GOP, B0) + ) + ; + ( checklist(is_one, CAs) -> + Space += linear(As, GOP, B0, Reify); + Space += linear(CAs, As, GOP, B0, Reify) + ) + ). + +post( rel(A1-A2, Op, B), Space-Map, Reify):- + ( B = _ + _ ; B = _-_), !, linearize(A1-A2, 1, As, Bs, CAs, CBs, 0, A0, Space-Map), linearize(B, -1, Bs, [], CBs, [], A0, B0, Space-Map), gecode_arith_op( Op, GOP ), @@ -716,6 +797,15 @@ post( rel(A, Op, B), Space-Map, Reify):- equality(B, B1, Space-Map), out_c(Name, VA1, B1, Op, Space-Map, Reify). +post( rel(A1 \/ A2, Ope, B), Space-Map, Reify):- + !, + equality(A1, NA1, Space-Map), + in_c(NA1, VA1, Space-Map), + equality(A2, NA2, Space-Map), + in_c(NA2, VA2, Space-Map), + equality(B, B1, Space-Map), + out_c('\\/', VA1, VA2, B1, Op, Space-Map, Reify). + post( rel(A, Op, B), Space-Map, Reify):- arith(A, Name), A =.. [_Op,A1,A2], !, @@ -832,24 +922,36 @@ linearize(V, C, [A|As], As, [C|CAs], CAs, I, I, _-Map) :- var(V), !, l(V, A, Map). linearize(A+B, C, As, Bs, CAs, CBs, I, IF, Env) :- + !, + linearize(A, C, As, A1s, CAs, CA1s, I, I1, Env), + linearize(B, C, A1s, Bs, CA1s, CBs, I1, IF, Env). +linearize([], _C, As, As, CAs, CAs, I, I, _) :- + !. +linearize([A|B], C, As, Bs, CAs, CBs, I, IF, Env) :- + !, linearize(A, C, As, A1s, CAs, CA1s, I, I1, Env), linearize(B, C, A1s, Bs, CA1s, CBs, I1, IF, Env). linearize(A-B, C, As, Bs, CAs, CBs, I, IF, Env) :- + !, NC is -C, linearize(A, C, As, A1s, CAs, CA1s, I, I1, Env), linearize(B, NC, A1s, Bs, CA1s, CBs, I1, IF, Env). linearize(A, C, As, As, CAs, CAs, I, IF, _) :- + !, integer(A), !, IF is I-C*A. linearize(A, C, As, As, CAs, CAs, I, IF, _) :- + !, ground(A), catch( (B is eval(A)), _, fail ), !, IF is I-C*B. linearize(C1*B, C, As, Bs, CAs, CBs, I, IF, Env) :- + !, integer(C1), !, NC is C*C1, linearize(B, NC, As, Bs, CAs, CBs, I, IF, Env). linearize(B*C1, C, As, Bs, CAs, CBs, I, IF, Env) :- + !, integer(C1), !, NC is C*C1, linearize(B, NC, As, Bs, CAs, CBs, I, IF, Env). @@ -859,8 +961,6 @@ linearize(AC, C, [A|Bs], Bs, [C|CBs], CBs, I, I, Env) :- Env = _-Map, l(V, A, Map). -arith('/\\'(_,_), (/\)). -arith('\\/'(_,_), (\/)). arith('=>'(_,_), (=>)). arith('<=>'(_,_), (<=>)). arith(xor(_,_), xor). @@ -869,6 +969,7 @@ arith(min(_), min). arith(max(_), max). arith(min(_,_), min). arith(max(_,_), max). +arith((_ - _), minus). arith((_ * _), times). arith((_ / _), div). arith(sum(_), sum). @@ -995,7 +1096,8 @@ out_c(Name, A1, A2, B, Op, Space-Map, Reify) :- ). % X*Y #= Cin[..] out_c(Name, A1, A2, B, (#=), Space-Map, Reify) :- - var(Reify), +Name \= '\\/', + var(Reify), l(B, IB, Map), !, l(A1, IA1, Map), l(A2, IA2, Map), @@ -1208,7 +1310,8 @@ in_c_l(Env, V, IV) :- in_c(V, IV, Env). user:term_expansion( ( H :- B), (H :- (gecode_clpfd:init_gecode(Space, Me), NB, gecode_clpfd:close_gecode(Space, Vs, Me)) ) ) :- - process_constraints(B, NB, Env), + process_constraints(B, NB, Env, Labeling), + nonvar(Labeling), term_variables(H, Vs), nonvar( Env ), !, Env = env( Space ). @@ -1266,6 +1369,11 @@ attr_unify_hook(v(IV1,_,_), Y) :- % Translate attributes from this module to residual goals + +attribute_goals(X) --> + { get_attr(X, gecode_clpfd, v(_,0,1)) }, + !, + [boolvar(X)]. attribute_goals(X) --> { get_attr(X, gecode_clpfd, v(_,A,B)) }, [X in A..B]. diff --git a/packages/gecode/dev/extractor/Makefile b/packages/gecode/dev/extractor/Makefile index 0221be9e2..42dba97c5 100644 --- a/packages/gecode/dev/extractor/Makefile +++ b/packages/gecode/dev/extractor/Makefile @@ -1,5 +1,4 @@ GECODEDIR := $(shell g++ $(CPPFLAGS) $(CXXFLAGS) -H -E gecodedir.hh 2>&1 >/dev/null | grep gecode/kernel.hh | awk '{print $$2}' | sed 's|/kernel.hh||') -GECODEDIR=/usr/include/gecode GECODECONFIG := $(GECODEDIR)/support/config.hpp GECODEVERSION := $(shell cat $(GECODECONFIG) | egrep '\' | awk '{print $$3}' | sed 's/"//g') PROTOTYPES = ../gecode-prototypes-$(GECODEVERSION).hh diff --git a/packages/gecode/gecode6_yap_hand_written.yap b/packages/gecode/gecode6_yap_hand_written.yap index b61f5027a..c7a5f3d87 100644 --- a/packages/gecode/gecode6_yap_hand_written.yap +++ b/packages/gecode/gecode6_yap_hand_written.yap @@ -288,7 +288,7 @@ is_IntVar_('IntVar'(I,K),N) :- nb_getval(gecode_space_use_keep_index,B), (B=true -> N=K ; N=I). is_FloatVar_('FloatVar'(I,K),N) :- - integer(I), + integer(I), integer(K), nb_getval(gecode_space_use_keep_index,B), (B=true -> N=K ; N=I). @@ -479,6 +479,30 @@ is_IntVarBranch_(X, X) :- is_IntVarBranch(X,Y) :- nonvar(X), is_IntVarBranch_(X,Y). is_IntVarBranch(X) :- is_IntVarBranch(X,_). +%% Var and Val Branching changed in Gecode 4 to be done as a set of functions, +%%% not as an enum. + +is_BoolVarBranch_('BOOL_VAR_NONE'). +is_BoolVarBranch_('BOOL_VAR_RND'(_)). +%is_BoolVarBranch_('BOOL_VAR_MERIT_MIN'(_)). +%is_BoolVarBranch_('BOOL_VAR_MERIT_MAX'(_)). +is_BoolVarBranch_('BOOL_VAR_DEGREE_MIN'). +is_BoolVarBranch_('BOOL_VAR_DEGREE_MAX'). +is_BoolVarBranch_('BOOL_VAR_MAX_MIN'). +is_BoolVarBranch_('BOOL_VAR_MAX_MAX'). +is_BoolVarBranch_('BOOL_VAR_AFC_MIN'(_)). +is_BoolVarBranch_('BOOL_VAR_AFC_MAX'(_)). +is_BoolVarBranch_('BOOL_VAR_ACTION_MIN'(_)). +is_BoolVarBranch_('BOOL_VAR_ACTION_MAX'(_)). +is_BoolVarBranch_('BOOL_VAR_CHB_MIN'(_)). +is_BoolVarBranch_('BOOL_VAR_CHB_MAX'(_)). + +is_BoolVarBranch_(X, X) :- + is_BoolVarBranch_(X). + +is_BoolVarBranch(X,Y) :- nonvar(X), is_BoolVarBranch_(X,Y). +is_BoolVarBranch(X) :- is_BoolVarBranch(X,_). + is_SetVarBranch_('SET_VAR_NONE'). is_SetVarBranch_('SET_VAR_RND'(_)). is_SetVarBranch_('SET_VAR_MERIT_MIN'(_)). @@ -557,6 +581,16 @@ is_IntValBranch_(X,X) :- is_IntValBranch_(X). is_IntValBranch(X,Y) :- nonvar(X), is_IntValBranch_(X,Y). is_IntValBranch(X) :- is_IntValBranch(X,_). +is_BoolValBranch_('BOOL_VAL_RND'(_)). +is_BoolValBranch_('BOOL_VAL'(_,_)). +is_BoolValBranch_('BOOL_VAL_MIN'). +is_BoolValBranch_('BOOL_VAL_MAX'). + +is_BoolValBranch_(X,X) :- is_BoolValBranch_(X). + +is_BoolValBranch(X,Y) :- nonvar(X), is_BoolValBranch_(X,Y). +is_BoolValBranch(X) :- is_BoolValBranch(X,_). + is_SetValBranch_('SET_VAL_RND_INC'(_)). is_SetValBranch_('SET_VAL_RND_EXC'(_)). is_SetValBranch_('SET_VAL'(_,_)). diff --git a/packages/python/pl2pl.c b/packages/python/pl2pl.c index b9661f772..b982bb652 100644 --- a/packages/python/pl2pl.c +++ b/packages/python/pl2pl.c @@ -114,7 +114,8 @@ static foreign_t array_to_python_view(term_t addr, term_t type, term_t szt, static foreign_t prolog_list_to_python_list(term_t plist, term_t pyt, term_t tlen) { size_t sz, i; - PyErr_Clear(); + +PyErr_Clear(); PyObject *pyl = term_to_python(pyt, true, NULL, true); term_t targ = PL_new_term_ref(); @@ -135,10 +136,10 @@ static foreign_t prolog_list_to_python_list(term_t plist, term_t pyt, term_t tle PyList_SET_ITEM(pyl, i, t); } if (PL_is_variable(tlen)) { - PL_unify_int64(tlen, sz); -} else { -python_assign(tlen, PyLong_FromUnsignedLong(sz), NULL); -} + PL_unify_int64(tlen, sz); + } else { + python_assign(tlen, PyLong_FromUnsignedLong(sz), NULL); + } pyErrorAndReturn( true); } diff --git a/packages/python/py2pl.c b/packages/python/py2pl.c index da5a44476..27e89e81c 100644 --- a/packages/python/py2pl.c +++ b/packages/python/py2pl.c @@ -76,15 +76,15 @@ static Term python_to_term__(PyObject *pVal) { t[1] = MkFloatTerm(PyComplex_ImagAsDouble(pVal)); return Yap_MkApplTerm(FunctorI, 2, t); -} -else if (PyUnicode_Check(pVal)) { + } + else if (PyUnicode_Check(pVal)) { #if PY_MAJOR_VERSION < 3 - size_t sz = PyUnicode_GetSize(pVal) + 1; - wchar_t *s = malloc(sizeof(wchar_t) * sz); - sz = PyUnicode_AsWideChar((PyUnicodeObject *)pVal, a, sz - 1); - free(ptr); + size_t sz = PyUnicode_GetSize(pVal) + 1; + wchar_t *s = malloc(sizeof(wchar_t) * sz); + sz = PyUnicode_AsWideChar((PyUnicodeObject *)pVal, a, sz - 1); + free(ptr); #else - const char *s = PyUnicode_AsUTF8(pVal); + const char *s = PyUnicode_AsUTF8(pVal); #endif #if 0 if (false && Yap_AtomInUse(s)) @@ -92,72 +92,72 @@ else if (PyUnicode_Check(pVal)) { else #endif if (pyStringToString) - return MkStringTerm(s); + return MkStringTerm(s); else return MkAtomTerm(Yap_LookupAtom(s)); -} -else if (PyByteArray_Check(pVal)) { - return MkStringTerm(PyByteArray_AsString(pVal)); + } + else if (PyByteArray_Check(pVal)) { + return MkStringTerm(PyByteArray_AsString(pVal)); #if PY_MAJOR_VERSION < 3 -} -else if (PyString_Check(pVal)) { - return MkStringTerm(PyString_AsString(pVal)); + } + else if (PyString_Check(pVal)) { + return MkStringTerm(PyString_AsString(pVal)); #endif -} -else if (PyTuple_Check(pVal)) { - Py_ssize_t sz = PyTuple_Size(pVal); - const char *s; - s = Py_TYPE(pVal)->tp_name; - if (s == NULL) - s = "t"; - if (sz == 0) { + } + else if (PyTuple_Check(pVal)) { + Py_ssize_t sz = PyTuple_Size(pVal); + const char *s; + s = Py_TYPE(pVal)->tp_name; + if (s == NULL) + s = "t"; + if (sz == 0) { return MkAtomTerm(YAP_LookupAtom(Py_TYPE(pVal)->tp_name)); -} -else { - Functor f = Yap_MkFunctor(Yap_LookupAtom(s), sz); - Term t = Yap_MkNewApplTerm(f, sz); - long i; - CELL *ptr = RepAppl(t) + 1; - for (i = 0; i < sz; i++) { - PyObject *p = PyTuple_GetItem(pVal, i); - if (p == NULL) { - PyErr_Clear(); - return false; } - *ptr++ = python_to_term__(p); + else { + Functor f = Yap_MkFunctor(Yap_LookupAtom(s), sz); + Term t = Yap_MkNewApplTerm(f, sz); + long i; + CELL *ptr = RepAppl(t) + 1; + for (i = 0; i < sz; i++) { + PyObject *p = PyTuple_GetItem(pVal, i); + if (p == NULL) { + PyErr_Clear(); + return false; + } + *ptr++ = python_to_term__(p); + } + return t; + } + // PL_reset_term_refs(to); + // fputs(" ||*** ",stderr); Yap_DebugPlWrite(YAP_GetFromSlot(t)); fputs(" + // ||***\n",stderr); } - return t; -} -// PL_reset_term_refs(to); -// fputs(" ||*** ",stderr); Yap_DebugPlWrite(YAP_GetFromSlot(t)); fputs(" -// ||***\n",stderr); -} -else if (PyList_Check(pVal)) { - Py_ssize_t i, sz = PyList_GET_SIZE(pVal); - if (sz == 0) - return repr_term(pVal); - Term t = TermNil; - for (i = sz; i > 0; ) { - -- i; - PyObject *p = PyList_GetItem(pVal, i); - if (p == NULL) { - PyErr_Clear(); - return false; - } - if (!python_to_term__(p)) - return false; + else if (PyList_Check(pVal)) { + Py_ssize_t i, sz = PyList_GET_SIZE(pVal); + if (sz == 0) + return repr_term(pVal); + Term t = TermNil; + for (i = sz; i > 0; ) { + -- i; + PyObject *p = PyList_GetItem(pVal, i); + if (p == NULL) { + PyErr_Clear(); + return false; + } + if (!python_to_term__(p)) + return false; - t = MkPairTerm(python_to_term__(p), t); + t = MkPairTerm(python_to_term__(p), t); + } + return t; } - return t; -} -else if (PyDict_Check(pVal)) { - Py_ssize_t pos = 0, tot = PyDict_Size(pVal); - PyObject *key, *value; - Term f, *opt = &f, t, to; - if (tot == 0) - return MkAtomTerm( Yap_LookupAtom("{}")); - while (PyDict_Next(pVal, &pos, &key, &value)) { + else if (PyDict_Check(pVal)) { + Py_ssize_t pos = 0, tot = PyDict_Size(pVal); + PyObject *key, *value; + Term f, *opt = &f, t, to; + if (tot == 0) + return MkAtomTerm( Yap_LookupAtom("{}")); + while (PyDict_Next(pVal, &pos, &key, &value)) { Term t0[2]; t0[0] = python_to_term__(key); t0[1] = python_to_term__(value); @@ -169,9 +169,9 @@ else if (PyDict_Check(pVal)) { *opt = t; opt = pt+1; } else { - if (pos == 0) { - return repr_term(pVal); - } + if (pos == 0) { + return repr_term(pVal); + } *opt = to; break; @@ -179,7 +179,7 @@ else if (PyDict_Check(pVal)) { } return Yap_MkApplTerm(FunctorBraces, 1, &f); } - return repr_term(pVal); + return repr_term(pVal); } @@ -197,11 +197,13 @@ X_API YAP_Term pythonToYAP(PyObject *pVal) { /* fputs("***>>\n", stderr); */ if (pVal == NULL) Yap_ThrowError(SYSTEM_ERROR_INTERNAL, 0, NULL); + yhandle_t h0 = Yap_CurrentHandle(); Term t = python_to_term__(pVal); /* fputs("<< *** ", stderr); */ /* Yap_DebugPlWrite(t); */ /* fputs(" ***\n", stderr); */ // Py_DECREF(pVal); + Yap_CloseHandles(h0); return t; } @@ -225,13 +227,18 @@ PyObject *py_Local, *py_Global; *python_assign. */ bool python_assign(term_t t, PyObject *exp, PyObject *context) { - PyErr_Print(); + bool rc = true; + PyErr_Print(); + term_t inp = Yap_CurrentHandle(); context = find_obj(context, t, false); // Yap_DebugPlWriteln(yt); switch (PL_term_type(t)) { case PL_VARIABLE: { if (context == NULL) // prevent a.V= N*N[N-1] - return python_to_term(exp, t); + PL_reset_term_refs(inp); + + rc = python_to_term(exp, t); + break; } case PL_STRING: { @@ -240,24 +247,34 @@ bool python_assign(term_t t, PyObject *exp, PyObject *context) { PL_get_string_chars(t, &s,&l); if (!context) context = py_Main; - if (PyObject_SetAttrString(context, s, exp) == 0) - return true; - PyErr_Print(); - return false; + if (PyObject_SetAttrString(context, s, exp) == 0) { + PL_reset_term_refs(inp); + ; + rc = true; + } else { + PyErr_Print(); + PL_reset_term_refs(inp); + rc = false; + } + break; } case PL_ATOM: { char *s = NULL; PL_get_atom_chars(t, &s); if (!context) context = py_Main; - if (PyObject_SetAttrString(context, s, exp) == 0) - return true; - return false; + if (PyObject_SetAttrString(context, s, exp) == 0){ + rc = true; + } else { + rc = false; + } + break; } case PL_INTEGER: case PL_FLOAT: // domain or type erro? - return false; + rc = false; + break; default: { term_t tail = PL_new_term_ref(), arg = PL_new_term_ref(); size_t len, i; @@ -271,90 +288,96 @@ bool python_assign(term_t t, PyObject *exp, PyObject *context) { for (i = 0; i < len; i++) { PyObject *p; if (!PL_get_list(t, arg, t)) { - PL_reset_term_refs(tail); p = Py_None; - } - if ((p = PySequence_GetItem(exp, i)) == NULL) - p = Py_None; - if (!python_assign(arg, p, context)) { - PL_reset_term_refs(tail); + rc = false; + } else { + if ((p = PySequence_GetItem(exp, i)) == NULL) + p = Py_None; + rc = rc && python_assign(arg, p, context); } } + } else { + while(PL_is_pair(t)) { + context = find_obj(context, t, false); + } + rc = python_assign(t, exp, context); } + } else { functor_t fun; if (!PL_get_functor(t, &fun)) { - PL_reset_term_refs(tail); - return false; + rc = false; } if (fun == FUNCTOR_sqbrackets2) { // tail is the object o if (!PL_get_arg(2, t, tail)) { - PL_reset_term_refs(tail); - return false; - } - PyObject *o = term_to_python(tail, true, context, false); - // t now refers to the index - if (!PL_get_arg(1, t, t) || !PL_get_list(t, t, tail) || - !PL_get_nil(tail)) { - PL_reset_term_refs(tail); - return false; - } - PyObject *i = term_to_python(t, true, NULL, false); - // check numeric - if (PySequence_Check(o) && PyLong_Check(i)) { - long int j; - j = PyLong_AsLong(i); - return PySequence_SetItem(o, j, exp) == 0; - } + rc = false; + } else { + PyObject *o = term_to_python(tail, true, context, false); + // t now refers to the index + if (!PL_get_arg(1, t, t) || !PL_get_list(t, t, tail) || + !PL_get_nil(tail)) { + rc = false; + } else { + PyObject *i = term_to_python(t, true, NULL, false); + // check numeric + if (PySequence_Check(o) && PyLong_Check(i)) { + long int j; + j = PyLong_AsLong(i); + rc = PySequence_SetItem(o, j, exp) == 0; + } #if PY_MAJOR_VERSION < 3 - if (PySequence_Check(o) && PyInt_Check(i)) { - long int j; - j = PyInt_AsLong(i); - return PySequence_SetItem(o, i, exp) == 0; - } + if (PySequence_Check(o) && PyInt_Check(i)) { + long int j; + j = PyInt_AsLong(i); + szzb rc = PySequence_SetItem(o, i, exp) == 0; + } else #endif - if (PyDict_Check(o)) { - if (PyDict_SetItem(o, i, exp) == 0) { - return true; - } - } - if (PyObject_SetAttr(o, i, exp) == 0) { - return true; - } + if (PyDict_Check(o)) { + if (PyDict_SetItem(o, i, exp) == 0) { + PL_reset_term_refs(inp); + ; + rc = true; + } + } + if (PyObject_SetAttr(o, i, exp) == 0) { + PL_reset_term_refs(inp); + ; + rc = true; + } + } + } } else { + atom_t s; int n, i; PL_get_name_arity(t, &s, &n); PyObject *o = term_to_python(t, true, context, true); - PyErr_Print(); + PyErr_Print(); if (PySequence_Check(o) && PySequence_Length(o) == n) { for (i = 1; i <= n; i++) { PyObject *p; if (!PL_get_arg(i, t, arg)) { - PL_reset_term_refs(tail); - o = false; + o = NULL; p = Py_None; } if ((p = PySequence_GetItem(exp, i - 1)) == NULL) p = Py_None; - else if (!python_assign(arg, p, NULL)) { - PL_reset_term_refs(tail); - o = NULL; - } else { - PyErr_Print(); - } + rc = python_assign(arg, p, NULL); + } - return true; } } } - PL_reset_term_refs(tail); } - PyErr_Print(); - return NULL; } + + PyErr_Print(); + PL_reset_term_refs(inp); + + + return rc; } diff --git a/packages/python/py4yap.h b/packages/python/py4yap.h index bae0be539..b2fc28a8d 100644 --- a/packages/python/py4yap.h +++ b/packages/python/py4yap.h @@ -23,10 +23,14 @@ #undef _XOPEN_SOURCE // python does its own thing #endif + +#undef _POSIX_C_SOURCE + #include #include + #include #ifdef HAVE_STAT #undef HAVE_STATa @@ -95,7 +99,7 @@ extern PyObject *py_Sys; extern X_API bool python_in_python; extern bool pyStringToString; -extern bool python_release_GIL(term_t gstate); +extern bool python_release_GIL(term_t gstate); extern term_t python_acquire_GIL(void); static inline Py_ssize_t get_p_int(PyObject *o, Py_ssize_t def) { @@ -201,22 +205,21 @@ extern PyObject *YEC(PyObject *c,PyObject *a ,PyObject *d , int line, const char extern void YEM(const char *ex, int line, const char *file, const char *code); extern void pyErrorHandler__(int line, const char *file, const char *code); -#define pyErrorHandler() \ - { \ - if (PyErr_Occurred()) { \ +#define PyStart() PyErr_Clear() + + +#define pyErrorHandler() if (PyErr_Occurred()) { \ pyErrorHandler__(__LINE__, __FILE__, __FUNCTION__); \ } \ - } + #define pyErrorAndReturn(x) \ - { \ if (PyErr_Occurred()) { \ pyErrorHandler__(__LINE__, __FILE__, __FUNCTION__); \ } \ - return (x); \ - } + return (x) + // #define pyErrorAndReturn( x, y ) return x - extern PyObject *compound_to_pyeval(term_t t, PyObject *context, bool cvt); extern PyObject *compound_to_pytree(term_t t, PyObject *context, bool cvt); diff --git a/packages/python/pybips.c b/packages/python/pybips.c index 18a26bea8..117877d30 100644 --- a/packages/python/pybips.c +++ b/packages/python/pybips.c @@ -112,12 +112,12 @@ find_obj(PyObject *ob, term_t l, bool eval) { YAP_Term hd, yt; py_Context = NULL; - yt = YAP_GetFromSlot(l); // Yap_DebugPlWriteln(yt); - while (YAP_IsPairTerm(yt)) { + if (l == 0) + return Py_None; + while (YAP_IsPairTerm((yt = YAP_GetFromSlot(l)))) { hd = YAP_HeadOfTerm(yt); - yt = YAP_TailOfTerm(yt); - YAP_PutInSlot(l, yt); + Yap_PutInHandle(l, YAP_TailOfTerm(yt)); ob = yap_to_python(hd, true, ob, false); if (!ob) { return Py_None; diff --git a/packages/python/pypreds.c b/packages/python/pypreds.c index 4c5cfc381..e4353430d 100644 --- a/packages/python/pypreds.c +++ b/packages/python/pypreds.c @@ -20,6 +20,7 @@ void pyErrorHandler__(int line, const char *file, const char *code) { static foreign_t python_len(term_t tobj, term_t tf) { Py_ssize_t len; PyObject *o; + PyStart(); o = term_to_python(tobj, true, NULL, true); if (o == NULL) { @@ -32,13 +33,14 @@ static foreign_t python_len(term_t tobj, term_t tf) { static foreign_t python_represent( term_t name, term_t tobj) { term_t stackp = python_acquire_GIL(); PyObject *e; + PyStart(); e = term_to_python(tobj, false, NULL, false); if (e == NULL) { python_release_GIL(stackp); pyErrorAndReturn(false); } - bool b = python_assign(name, e, NULL); + foreign_t b = python_assign(name, e, NULL); python_release_GIL(stackp); pyErrorAndReturn(b); } @@ -53,6 +55,7 @@ static foreign_t python_clear_errors(void) { static foreign_t python_dir(term_t tobj, term_t tf) { PyObject *dir; PyObject *o; + PyStart(); o = term_to_python(tobj, true, NULL, true); if (o == NULL) { @@ -70,6 +73,7 @@ static foreign_t python_index(term_t tobj, term_t tindex, term_t val) { PyObject *i; PyObject *o; PyObject *f; + PyStart(); o = term_to_python(tobj, true, NULL, true); if (o == NULL) { @@ -96,6 +100,7 @@ static foreign_t python_index(term_t tobj, term_t tindex, term_t val) { static foreign_t python_is(term_t tobj, term_t tf) { PyObject *o; + PyStart(); term_t lim = python_acquire_GIL(); @@ -112,13 +117,13 @@ static foreign_t python_is(term_t tobj, term_t tf) { } static foreign_t python_proc(term_t tobj) { + PyStart(); PyObject *o; - term_t lim = python_acquire_GIL(); o = term_to_python(tobj, true, NULL, true); python_release_GIL(lim); - bool rc = o != NULL; + foreign_t rc = o != NULL; pyErrorAndReturn(rc); } @@ -134,9 +139,7 @@ static foreign_t python_slice(term_t parent, term_t indx, term_t tobj) { p = term_to_python(parent, true, NULL, true); // Exp if (!pI || !p) { - { - pyErrorAndReturn(false); - } + pyErrorAndReturn(false); } else if ((pF = PySequence_GetSlice(p, 0, 0)) == NULL) { PyErr_Print(); { pyErrorAndReturn(false); } @@ -153,6 +156,7 @@ static foreign_t python_slice(term_t parent, term_t indx, term_t tobj) { static foreign_t python_apply(term_t tin, term_t targs, term_t keywds, term_t tf) { + PyStart(); PyObject *pF; PyObject *pArgs, *pKeywords; PyObject *pValue; @@ -162,7 +166,6 @@ static foreign_t python_apply(term_t tin, term_t targs, term_t keywds, term_t targ = PL_new_term_ref(); pF = term_to_python(tin, true, NULL, true); - PyErr_Clear(); if (pF == NULL) { { pyErrorAndReturn(false); @@ -237,6 +240,7 @@ static foreign_t python_apply(term_t tin, term_t targs, term_t keywds, } static foreign_t assign_python(term_t exp, term_t name) { + PyStart(); term_t stackp = python_acquire_GIL(); PyObject *e = term_to_python(exp, true, NULL, true); @@ -244,7 +248,7 @@ static foreign_t assign_python(term_t exp, term_t name) { python_release_GIL(stackp); pyErrorAndReturn(false); } - bool b = python_assign(name, e, NULL); + foreign_t b = python_assign(name, e, NULL); python_release_GIL(stackp); pyErrorAndReturn(b); } @@ -269,7 +273,7 @@ static foreign_t python_string_to(term_t f) { } static foreign_t python_builtin_eval(term_t caller, term_t dict, term_t out) { - PyErr_Clear(); + PyStart(); PyObject *pI, *pArgs, *pOut; PyObject *env; atom_t name; @@ -331,7 +335,7 @@ static foreign_t python_builtin_eval(term_t caller, term_t dict, term_t out) { } static foreign_t python_access(term_t obj, term_t f, term_t out) { - PyErr_Clear(); + PyStart(); PyObject *o = term_to_python(obj, true, NULL, true), *pValue, *pArgs, *pF; atom_t name; char *s = NULL; @@ -400,7 +404,7 @@ static foreign_t python_field(term_t parent, term_t att, term_t tobj) { atom_t name; char *s; int arity; - + PyStart(); if (!PL_get_name_arity(att, &name, &arity)) { { pyErrorAndReturn(false); @@ -448,14 +452,14 @@ static foreign_t python_field(term_t parent, term_t att, term_t tobj) { static foreign_t python_main_module(term_t mod) { { foreign_t rc; - PyErr_Clear(); + PyStart(); rc = address_to_term(py_Main, mod); pyErrorAndReturn(rc); } } static foreign_t python_function(term_t tobj) { - PyErr_Clear(); + PyStart(); PyObject *obj = term_to_python(tobj, true, NULL, true); foreign_t rc = PyFunction_Check(obj); @@ -465,7 +469,7 @@ static foreign_t python_function(term_t tobj) { foreign_t python_builtin(term_t out) { { foreign_t rc; - PyErr_Clear(); + PyStart(); rc = address_to_term(py_Builtin, out); pyErrorAndReturn(rc); } @@ -476,7 +480,7 @@ static foreign_t python_run_file(term_t file) { size_t len; char si[256]; s = si; - PyErr_Clear(); + PyStart(); if (PL_get_nchars(file, &len, &s, CVT_ALL | CVT_EXCEPTION)) { #if PY_MAJOR_VERSION < 3 PyObject *PyFileObject = PyFile_FromString(si, "r"); @@ -499,11 +503,11 @@ extern PyThreadState *YAP_save; static foreign_t python_run_command(term_t cmd) { char *s; - bool rc = false; + foreign_t rc = false; size_t len; char si[256]; - PyErr_Clear(); + PyStart(); s = si; if (PL_get_nchars(cmd, &len, &s, CVT_ALL | CVT_EXCEPTION)) { PyRun_SimpleString(s); @@ -519,7 +523,7 @@ static foreign_t python_run_script(term_t cmd, term_t fun) { PyObject *pArgs = NULL, *pValue; char *s; - PyErr_Clear(); + PyStart(); s = si; if (PL_get_nchars(cmd, &len, &s, CVT_ALL | CVT_EXCEPTION) && (s = sf) != NULL && @@ -571,7 +575,7 @@ static foreign_t python_run_script(term_t cmd, term_t fun) { static foreign_t python_export(term_t t, term_t pl) { foreign_t rc = false; - PyErr_Clear(); + PyStart(); if (PL_is_functor(t, FUNCTOR_pointer1)) { void *ptr; term_t targ = PL_new_term_ref(); @@ -600,7 +604,8 @@ static foreign_t python_export(term_t t, term_t pl) { */ static int python_import(term_t mname, term_t mod) { PyObject *pName; - bool do_as = false; + foreign_t do_as = false; + PyStart(); char s0[MAXPATHLEN], *s = s0; s[0] = '\0'; @@ -673,7 +678,7 @@ static int python_import(term_t mname, term_t mod) { static foreign_t python_to_rhs(term_t inp, term_t t) { PyObject *pVal; - PyErr_Clear(); + PyStart(); pVal = term_to_python(inp, true, NULL, true); if (pVal == NULL) pyErrorAndReturn(false); @@ -681,7 +686,7 @@ static foreign_t python_to_rhs(term_t inp, term_t t) { } // static PyThreadState *_saveP = NULL; -static bool _threaded = true; +static foreign_t _threaded = true; /* static YAP_Int @@ -707,7 +712,7 @@ PyThreadState *tstate; static YAP_Int p_python_threaded(void) { - PyErr_Clear(); + PyStart(); // PyEval_ReleaseThread(tstate); // _threaded = true; // _locked = 0; @@ -730,7 +735,6 @@ term_t python_acquire_GIL(void) { PL_put_integer(curSlot, gstatei++); return curSlot; } - bool python_release_GIL(term_t curBlock) { int gstateix; gstatei--; diff --git a/packages/real/build.yap4r b/packages/real/build.yap4r new file mode 100755 index 000000000..4f99c14d3 --- /dev/null +++ b/packages/real/build.yap4r @@ -0,0 +1,14 @@ +rm -f */*/*.o */*/*.so yap4r/src/RCppExports.Cpp +R CMD REMOVE yap4r +R --no-save << EOF +library(Rcpp) +compileAttributes("yap4r") +compileAttributes("yap4r") +EOF +R CMD INSTALL yap4r +R CMD check yap4r +R --no-save << eof +library(yap4r) +y <- new(yap4r) +y$q("is",[3,6]) +eof diff --git a/packages/real/real.c b/packages/real/real.c index d0d4706ae..0f7c3d7e5 100644 --- a/packages/real/real.c +++ b/packages/real/real.c @@ -1,4 +1,3 @@ - /** * @file real.c * @date Sat May 19 13:44:04 2018 diff --git a/packages/real/real.pl b/packages/real/real.pl index 8e8905676..c39a7fcc2 100755 --- a/packages/real/real.pl +++ b/packages/real/real.pl @@ -956,7 +956,7 @@ prolog:message( r_root ) --> eval_text( Text ) :- - atomic_to_term( Text, Goal, VarNames ), + atomic_to_term( Text, Goal, _VarNames ), call(user:Goal). :- at_halt(halt_r). diff --git a/packages/real/yap4r/R/zzz.R b/packages/real/yap4r/R/zzz.R index 803a717a4..a39cdd146 100644 --- a/packages/real/yap4r/R/zzz.R +++ b/packages/real/yap4r/R/zzz.R @@ -8,5 +8,6 @@ ## For R 2.15.1 and later this also works. Note that calling loadModule() triggers ## a load action, so this does not have to be placed in .onLoad() or evalqOnLoad(). + loadModule("yap4r", TRUE) diff --git a/packages/real/yap4r/src/Makevars.in b/packages/real/yap4r/src/Makevars.in index 18c55bee1..c22fda795 100644 --- a/packages/real/yap4r/src/Makevars.in +++ b/packages/real/yap4r/src/Makevars.in @@ -1,5 +1,5 @@ -PKG_LIBS=-Wl,-rpath=${YAP_LIBDIR} -Wl,-rpath=${YAP_DLLDIR} \ - -L${YAP_LIBDIR} -L${YAP_DLLDIR} -lreal -lYAP++ -lYap +PKG_LIBS=${CMAKE_SHARED_LINKER_FLAGS} #-Wl,-rpath=${YAP_LIBDIR} -Wl,-rpath=${YAP_DLLDIR} \ + #-L${YAP_LIBDIR} -L${YAP_DLLDIR} -lreal -lYAP++ -lYap PKG_CXXFLAGS=-I${YAP_SOURCE_DIR}/CXX -I${YAP_BINARY_DIR}\ -I${YAP_SOURCE_DIR}/include -I${YAP_SOURCE_DIR}/H\ -I${YAP_SOURCE_DIR}/OPTYap -I${YAP_SOURCE_DIR}/os\ diff --git a/packages/real/yap4r/src/RcppExports.cpp b/packages/real/yap4r/src/RcppExports.cpp index 02ffefcff..7ca50efcd 100644 --- a/packages/real/yap4r/src/RcppExports.cpp +++ b/packages/real/yap4r/src/RcppExports.cpp @@ -6,10 +6,10 @@ using namespace Rcpp; -RcppExport SEXP _rcpp_module_boot_mod_yap4r(); +RcppExport SEXP _rcpp_module_boot_yap4r(); static const R_CallMethodDef CallEntries[] = { - {"_rcpp_module_boot_mod_yap4r", (DL_FUNC) &_rcpp_module_boot_mod_yap4r, 0}, + {"_rcpp_module_boot_yap4r", (DL_FUNC) &_rcpp_module_boot_yap4r, 0}, {NULL, NULL, 0} }; diff --git a/packages/real/yap4r/src/symbols.rds b/packages/real/yap4r/src/symbols.rds new file mode 100644 index 000000000..5587e3cef Binary files /dev/null and b/packages/real/yap4r/src/symbols.rds differ diff --git a/packages/real/yap4r/src/yap4r.cpp b/packages/real/yap4r/src/yap4r.cpp index e0f3ed133..ca0264ce3 100644 --- a/packages/real/yap4r/src/yap4r.cpp +++ b/packages/real/yap4r/src/yap4r.cpp @@ -12,7 +12,7 @@ using namespace Rcpp; -class yap4r { +class yap4r { YAPEngine *yap; YAPQuery *q; @@ -38,27 +38,15 @@ yap4r::yap4r() { yap = new YAPEngine(yargs); }; -bool yap4r::query(std::string p_name, GenericVector sexps, - std::string p_module) { +bool yap4r::query(std::string query) { if (q) { q->close(); q = nullptr; } yhandle_t t; arity_t arity; - if (sexps.isNULL()) { - YAPTerm qt = YAPAtomTerm(p_name.c_str()); q = new YAPQuery(qt); t = qt.handle(); - } else { - arity = sexps.length(); - std::vector args = std::vector(); - yhandle_t sls = Yap_NewHandles(sexps.length()); - for (int i = 0; i < sexps.length(); i++) { - if (!sexp_to_pl(sls + i, sexps[i])) - return false; - args.push_back(YAPTerm(Yap_GetFromSlot(sls + i))); - } YAPFunctor f = YAPFunctor(p_name.c_str(), arity); YAPAtomTerm mod = YAPAtomTerm(p_module.c_str()); t = YAPApplTerm(p_name.c_str(), args.data()).handle(); @@ -76,6 +64,7 @@ bool yap4r::query(std::string p_name, GenericVector sexps, return rc; } + bool yap4r::run(SEXP l) { yhandle_t yh = Yap_InitHandle(MkVarTerm()); if (!sexp_to_pl(yh, l)) @@ -129,15 +118,16 @@ SEXP yap4r::peek(int i) { return term_to_sexp(Yap_InitSlot(Yap_XREGS[i]), false); } -RCPP_MODULE(mod_yap4r) { +RCPP_MODULE(yap4r) { class_("yap4r") .constructor("create an object encapsulating a Prolog engine") - .method("query", &yap4r::query, "create an active query within the engine") + .method("query", &yap4r::query, "create an active query within the enginefrom text") .method("more", &yap4r::more, "ask for an extra solution") .method("done", &yap4r::done, "terminate the query") .method("eval_text", &yap4r::eval_text, "terminate the query") .method("run", &yap4r::run, "terminate the query") .method("compile", &yap4r::compile, "compile the file") .method("library", &yap4r::library, "compile the library") - .method("peek", &yap4r::peek, "load arg[i] into R"); + .method("peek", &yap4r::peek, "load arg[i] into R") + ; } diff --git a/packages/swi-minisat2/C/CMakeLists.txt b/packages/swi-minisat2/C/CMakeLists.txt deleted file mode 100644 index 455a145d3..000000000 --- a/packages/swi-minisat2/C/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ - -#cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) - - set ( MINISAT2_HEADERS -Alg.h -BasicHeap.h -BoxedVec.h -Heap.h -Map.h -Queue.h -Solver.h -SolverTypes.h -Sort.h -Vec.h -) - -set ( MINISAT2_SOURCES -Solver.C -pl-minisat.C -) - - - INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR} - ) - - add_library(minisat2 ${MINISAT2_SOURCES} ${MINISAT2_HEADERS} ) - - set_target_properties (minisat2 PROPERTIES OUTPUT_NAME pl-minisat) - set_target_properties (minisat2 PROPERTIES PREFIX "") - - - if(DEFINED YAP_MAJOR_VERSION) - TARGET_LINK_LIBRARIES(minisat2 - libYap - ) - else() - ADD_LIBRARY(minisat2 SHARED ${MINISAT2_SOURCES} ) - endif() - - #set_property(TARGET minisat2 PROPERTY CXX_STANDARD 11) - #set_property(TARGET minisat2 PROPERTY CXX_STANDARD_REQUIRED ON) - - install ( - TARGETS minisat2 - RUNTIME DESTINATION ${CMAKE_INSTALL_BIINDIR} - ARCHIVE DESTINATION ${YAP_INSTALL_LIBDIR} - LIBRARY DESTINATION ${YAP_INSTALL_LIBDIR} - ) - - diff --git a/packages/swi-minisat2/C/Makefile.in b/packages/swi-minisat2/C/Makefile.in deleted file mode 100644 index 7469cadb2..000000000 --- a/packages/swi-minisat2/C/Makefile.in +++ /dev/null @@ -1,96 +0,0 @@ -# -# default base directory for YAP installation -# (EROOT for architecture-dependent files) -# -GCC=@GCC@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -ROOTDIR = $(prefix) -EROOTDIR = @exec_prefix@ -abs_top_builddir = @abs_top_builddir@ -# -# where the binary should be -# -BINDIR = $(EROOTDIR)/bin -# -# where YAP should look for libraries -# -LIBDIR=@libdir@ -YAPLIBDIR=@libdir@/Yap -# -# -DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 -CC=@CC@ -CXX=@CXX@ -CXXFLAGS= @SHLIB_CXXFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../../.. -I$(srcdir)/../../../os -I$(srcdir)/../../../include @CPPFLAGS@ -LDFLAGS=@LDFLAGS@ -# -# -# You shouldn't need to change what follows. -# -INSTALL=@INSTALL@ -INSTALL_DATA=@INSTALL_DATA@ -INSTALL_PROGRAM=@INSTALL_PROGRAM@ -SHELL=/bin/sh -RANLIB=@RANLIB@ -srcdir=@srcdir@ -SO=@SO@ -#4.1VPATH=@srcdir@:@srcdir@/OPTYap -CWD=$(PWD) -# - -HEADERS= \ - $(srcdir)/Alg.h \ - $(srcdir)/BasicHeap.h \ - $(srcdir)/BoxedVec.h \ - $(srcdir)/Heap.h \ - $(srcdir)/Map.h \ - $(srcdir)/Queue.h \ - $(srcdir)/Solver.h \ - $(srcdir)/SolverTypes.h \ - $(srcdir)/Sort.h \ - $(srcdir)/Vec.h -C_SOURCES=$(srcdir)/pl-minisat.C $(srcdir)/Solver.C - -OBJS = \ - Solver.o \ - pl-minisat.o - -SOBJS=pl-minisat.@SO@ - -#in some systems we just create a single object, in others we need to -# create a libray - -all: $(SOBJS) - -# default rule -Solver.o : $(srcdir)/Solver.C - $(CXX) -c $(CXXFLAGS) $(srcdir)/Solver.C -o Solver.o - -pl-minisat.o : $(srcdir)/pl-minisat.C - $(CXX) -c $(CXXFLAGS) $(srcdir)/pl-minisat.C -o pl-minisat.o - -@DO_SECOND_LD@pl-minisat.@SO@: $(OBJS) -@DO_SECOND_LD@ @SHLIB_CXX_LD@ $(LDFLAGS) -o pl-minisat.@SO@ $(OBJS) @EXTRA_LIBS_FOR_SWIDLLS@ - -install: all - $(INSTALL_PROGRAM) $(SOBJS) $(DESTDIR)$(YAPLIBDIR) - -install-examples: - -clean: - rm -f *.o *~ $(OBJS) $(SOBJS) *.BAK - -distclean: - rm -f Makefile $(OBJS) - - -depend: $(HEADERS) $(C_SOURCES) - -@if test "$(GCC)" = yes; then\ - $(CC) -MM -MG $(CFLAGS) -I$(srcdir) -I$(srcdir)/../../../include -I$(srcdir)/../../../H $(C_SOURCES) >> Makefile;\ - else\ - makedepend -f - -- $(CFLAGS) -I$(srcdir)/../../../H -I$(srcdir)/../../../include -- $(C_SOURCES) |\ - sed 's|.*/\([^:]*\):|\1:|' >> Makefile ;\ - fi - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/packages/swi-minisat2/C/Solver.C b/packages/swi-minisat2/C/Solver.C deleted file mode 100644 index 4b61c6de6..000000000 --- a/packages/swi-minisat2/C/Solver.C +++ /dev/null @@ -1,791 +0,0 @@ -/****************************************************************************************[Solver.C] -MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or -substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -**************************************************************************************************/ - -#include "Solver.h" -#include "Sort.h" -#include -#include - - -//================================================================================================= -// Constructor/Destructor: - - -Solver::Solver() : - - // Parameters: (formerly in 'SearchParams') - var_decay(1 / 0.95), clause_decay(1 / 0.999), random_var_freq(0.02) - , restart_first(100), restart_inc(1.5), learntsize_factor((double)1/(double)3), learntsize_inc(1.1) - - // More parameters: - // - , expensive_ccmin (true) - , polarity_mode (polarity_false) - , verbosity (0) - - // Statistics: (formerly in 'SolverStats') - // - , starts(0), decisions(0), rnd_decisions(0), propagations(0), conflicts(0) - , clauses_literals(0), learnts_literals(0), max_literals(0), tot_literals(0) - - //*************** - , allMinVarsAssigned(false) - //*************** - - , ok (true) - , cla_inc (1) - , var_inc (1) - , qhead (0) - , simpDB_assigns (-1) - , simpDB_props (0) - , order_heap (VarOrderLt(activity)) - , random_seed (91648253) - , progress_estimate(0) - , remove_satisfied (true) -{} - - -Solver::~Solver() -{ - for (int i = 0; i < learnts.size(); i++) std::free(learnts[i]); - for (int i = 0; i < clauses.size(); i++) std::free(clauses[i]); -} - - -//================================================================================================= -// Minor methods: - - -// Creates a new SAT variable in the solver. If 'decision_var' is cleared, variable will not be -// used as a decision variable (NOTE! This has effects on the meaning of a SATISFIABLE result). -// -Var Solver::newVar(bool sign, bool dvar) -{ - int v = nVars(); - watches .push(); // (list for positive literal) - watches .push(); // (list for negative literal) - reason .push(NULL); - assigns .push(toInt(l_Undef)); - level .push(-1); - activity .push(0); - seen .push(0); - - polarity .push((char)sign); - decision_var.push((char)dvar); - - insertVarOrder(v); - return v; -} - - - -bool Solver::addClause(vec& ps) -{ - assert(decisionLevel() == 0); - - if (!ok) - return false; - else{ - // Check if clause is satisfied and remove false/duplicate literals: - sort(ps); - Lit p; int i, j; - for (i = j = 0, p = lit_Undef; i < ps.size(); i++) - if (value(ps[i]) == l_True || ps[i] == ~p) - return true; - else if (value(ps[i]) != l_False && ps[i] != p) - ps[j++] = p = ps[i]; - ps.shrink(i - j); - } - - if (ps.size() == 0) - return ok = false; - else if (ps.size() == 1){ - assert(value(ps[0]) == l_Undef); - uncheckedEnqueue(ps[0]); - return ok = (propagate() == NULL); - }else{ - Clause* c = Clause_new(ps, false); - clauses.push(c); - attachClause(*c); - } - - return true; -} - - -//**************** -bool Solver::setminVars(vec& ps) -{ - minVars.clear(); - for (int i=0; i < ps.size(); i++){ - minVars.push(ps[i]); - } - allMinVarsAssigned = false; - - return true; -} -//**************** - - -void Solver::attachClause(Clause& c) { - assert(c.size() > 1); - watches[toInt(~c[0])].push(&c); - watches[toInt(~c[1])].push(&c); - if (c.learnt()) learnts_literals += c.size(); - else clauses_literals += c.size(); } - - -void Solver::detachClause(Clause& c) { - assert(c.size() > 1); - assert(find(watches[toInt(~c[0])], &c)); - assert(find(watches[toInt(~c[1])], &c)); - remove(watches[toInt(~c[0])], &c); - remove(watches[toInt(~c[1])], &c); - if (c.learnt()) learnts_literals -= c.size(); - else clauses_literals -= c.size(); } - - -void Solver::removeClause(Clause& c) { - detachClause(c); - std::free(&c); } - - -bool Solver::satisfied(const Clause& c) const { - for (int i = 0; i < c.size(); i++) - if (value(c[i]) == l_True) - return true; - return false; } - - -// Revert to the state at given level (keeping all assignment at 'level' but not beyond). -// -void Solver::cancelUntil(int level) { - if (decisionLevel() > level){ - for (int c = trail.size()-1; c >= trail_lim[level]; c--){ - Var x = var(trail[c]); - assigns[x] = toInt(l_Undef); - insertVarOrder(x); } - qhead = trail_lim[level]; - trail.shrink(trail.size() - trail_lim[level]); - trail_lim.shrink(trail_lim.size() - level); - } - - //************************** - if (lastMinVarDL > level){ - allMinVarsAssigned = false; - } - //************************** -} - - -//================================================================================================= -// Major methods: - - -Lit Solver::pickBranchLit(int polarity_mode, double random_var_freq) -{ - Var next = var_Undef; - - // Random decision: - if (drand(random_seed) < random_var_freq && !order_heap.empty()){ - next = order_heap[irand(random_seed,order_heap.size())]; - if (toLbool(assigns[next]) == l_Undef && decision_var[next]) - rnd_decisions++; } - - // Activity based decision: - while (next == var_Undef || toLbool(assigns[next]) != l_Undef || !decision_var[next]) - if (order_heap.empty()){ - next = var_Undef; - break; - }else - next = order_heap.removeMin(); - - bool sign = false; - switch (polarity_mode){ - case polarity_true: sign = false; break; - case polarity_false: sign = true; break; - case polarity_user: sign = polarity[next]; break; - case polarity_rnd: sign = irand(random_seed, 2); break; - default: assert(false); } - - return next == var_Undef ? lit_Undef : Lit(next, sign); -} - - -/*_________________________________________________________________________________________________ -| -| analyze : (confl : Clause*) (out_learnt : vec&) (out_btlevel : int&) -> [void] -| -| Description: -| Analyze conflict and produce a reason clause. -| -| Pre-conditions: -| * 'out_learnt' is assumed to be cleared. -| * Current decision level must be greater than root level. -| -| Post-conditions: -| * 'out_learnt[0]' is the asserting literal at level 'out_btlevel'. -| -| Effect: -| Will undo part of the trail, upto but not beyond the assumption of the current decision level. -|________________________________________________________________________________________________@*/ -void Solver::analyze(Clause* confl, vec& out_learnt, int& out_btlevel) -{ - int pathC = 0; - Lit p = lit_Undef; - - // Generate conflict clause: - // - out_learnt.push(); // (leave room for the asserting literal) - int index = trail.size() - 1; - out_btlevel = 0; - - do{ - assert(confl != NULL); // (otherwise should be UIP) - Clause& c = *confl; - - if (c.learnt()) - claBumpActivity(c); - - for (int j = (p == lit_Undef) ? 0 : 1; j < c.size(); j++){ - Lit q = c[j]; - - if (!seen[var(q)] && level[var(q)] > 0){ - varBumpActivity(var(q)); - seen[var(q)] = 1; - if (level[var(q)] >= decisionLevel()) - pathC++; - else{ - out_learnt.push(q); - if (level[var(q)] > out_btlevel) - out_btlevel = level[var(q)]; - } - } - } - - // Select next clause to look at: - while (!seen[var(trail[index--])]); - p = trail[index+1]; - confl = reason[var(p)]; - seen[var(p)] = 0; - pathC--; - - }while (pathC > 0); - out_learnt[0] = ~p; - - // Simplify conflict clause: - // - int i, j; - if (expensive_ccmin){ - uint32_t abstract_level = 0; - for (i = 1; i < out_learnt.size(); i++) - abstract_level |= abstractLevel(var(out_learnt[i])); // (maintain an abstraction of levels involved in conflict) - - out_learnt.copyTo(analyze_toclear); - for (i = j = 1; i < out_learnt.size(); i++) - if (reason[var(out_learnt[i])] == NULL || !litRedundant(out_learnt[i], abstract_level)) - out_learnt[j++] = out_learnt[i]; - }else{ - out_learnt.copyTo(analyze_toclear); - for (i = j = 1; i < out_learnt.size(); i++){ - Clause& c = *reason[var(out_learnt[i])]; - for (int k = 1; k < c.size(); k++) - if (!seen[var(c[k])] && level[var(c[k])] > 0){ - out_learnt[j++] = out_learnt[i]; - break; } - } - } - max_literals += out_learnt.size(); - out_learnt.shrink(i - j); - tot_literals += out_learnt.size(); - - // Find correct backtrack level: - // - if (out_learnt.size() == 1) - out_btlevel = 0; - else{ - int max_i = 1; - for (int i = 2; i < out_learnt.size(); i++) - if (level[var(out_learnt[i])] > level[var(out_learnt[max_i])]) - max_i = i; - Lit p = out_learnt[max_i]; - out_learnt[max_i] = out_learnt[1]; - out_learnt[1] = p; - out_btlevel = level[var(p)]; - } - - - for (int j = 0; j < analyze_toclear.size(); j++) seen[var(analyze_toclear[j])] = 0; // ('seen[]' is now cleared) -} - - -// Check if 'p' can be removed. 'abstract_levels' is used to abort early if the algorithm is -// visiting literals at levels that cannot be removed later. -bool Solver::litRedundant(Lit p, uint32_t abstract_levels) -{ - analyze_stack.clear(); analyze_stack.push(p); - int top = analyze_toclear.size(); - while (analyze_stack.size() > 0){ - assert(reason[var(analyze_stack.last())] != NULL); - Clause& c = *reason[var(analyze_stack.last())]; analyze_stack.pop(); - - for (int i = 1; i < c.size(); i++){ - Lit p = c[i]; - if (!seen[var(p)] && level[var(p)] > 0){ - if (reason[var(p)] != NULL && (abstractLevel(var(p)) & abstract_levels) != 0){ - seen[var(p)] = 1; - analyze_stack.push(p); - analyze_toclear.push(p); - }else{ - for (int j = top; j < analyze_toclear.size(); j++) - seen[var(analyze_toclear[j])] = 0; - analyze_toclear.shrink(analyze_toclear.size() - top); - return false; - } - } - } - } - - return true; -} - - -/*_________________________________________________________________________________________________ -| -| analyzeFinal : (p : Lit) -> [void] -| -| Description: -| Specialized analysis procedure to express the final conflict in terms of assumptions. -| Calculates the (possibly empty) set of assumptions that led to the assignment of 'p', and -| stores the result in 'out_conflict'. -|________________________________________________________________________________________________@*/ -void Solver::analyzeFinal(Lit p, vec& out_conflict) -{ - out_conflict.clear(); - out_conflict.push(p); - - if (decisionLevel() == 0) - return; - - seen[var(p)] = 1; - - for (int i = trail.size()-1; i >= trail_lim[0]; i--){ - Var x = var(trail[i]); - if (seen[x]){ - if (reason[x] == NULL){ - assert(level[x] > 0); - out_conflict.push(~trail[i]); - }else{ - Clause& c = *reason[x]; - for (int j = 1; j < c.size(); j++) - if (level[var(c[j])] > 0) - seen[var(c[j])] = 1; - } - seen[x] = 0; - } - } - - seen[var(p)] = 0; -} - - -void Solver::uncheckedEnqueue(Lit p, Clause* from) -{ - assert(value(p) == l_Undef); - assigns [var(p)] = toInt(lbool(!sign(p))); // <<== abstract but not uttermost effecient - level [var(p)] = decisionLevel(); - reason [var(p)] = from; - trail.push(p); -} - - -/*_________________________________________________________________________________________________ -| -| propagate : [void] -> [Clause*] -| -| Description: -| Propagates all enqueued facts. If a conflict arises, the conflicting clause is returned, -| otherwise NULL. -| -| Post-conditions: -| * the propagation queue is empty, even if there was a conflict. -|________________________________________________________________________________________________@*/ -Clause* Solver::propagate() -{ - Clause* confl = NULL; - int num_props = 0; - - while (qhead < trail.size()){ - Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate. - vec& ws = watches[toInt(p)]; - Clause **i, **j, **end; - num_props++; - - for (i = j = (Clause**)ws, end = i + ws.size(); i != end;){ - Clause& c = **i++; - - // Make sure the false literal is data[1]: - Lit false_lit = ~p; - if (c[0] == false_lit) - c[0] = c[1], c[1] = false_lit; - - assert(c[1] == false_lit); - - // If 0th watch is true, then clause is already satisfied. - Lit first = c[0]; - if (value(first) == l_True){ - *j++ = &c; - }else{ - // Look for new watch: - for (int k = 2; k < c.size(); k++) - if (value(c[k]) != l_False){ - c[1] = c[k]; c[k] = false_lit; - watches[toInt(~c[1])].push(&c); - goto FoundWatch; } - - // Did not find watch -- clause is unit under assignment: - *j++ = &c; - if (value(first) == l_False){ - confl = &c; - qhead = trail.size(); - // Copy the remaining watches: - while (i < end) - *j++ = *i++; - }else - uncheckedEnqueue(first, &c); - } - FoundWatch:; - } - ws.shrink(i - j); - } - propagations += num_props; - simpDB_props -= num_props; - - return confl; -} - -/*_________________________________________________________________________________________________ -| -| reduceDB : () -> [void] -| -| Description: -| Remove half of the learnt clauses, minus the clauses locked by the current assignment. Locked -| clauses are clauses that are reason to some assignment. Binary clauses are never removed. -|________________________________________________________________________________________________@*/ -struct reduceDB_lt { bool operator () (Clause* x, Clause* y) { return x->size() > 2 && (y->size() == 2 || x->activity() < y->activity()); } }; -void Solver::reduceDB() -{ - int i, j; - double extra_lim = cla_inc / learnts.size(); // Remove any clause below this activity - - sort(learnts, reduceDB_lt()); - for (i = j = 0; i < learnts.size() / 2; i++){ - if (learnts[i]->size() > 2 && !locked(*learnts[i])) - removeClause(*learnts[i]); - else - learnts[j++] = learnts[i]; - } - for (; i < learnts.size(); i++){ - if (learnts[i]->size() > 2 && !locked(*learnts[i]) && learnts[i]->activity() < extra_lim) - removeClause(*learnts[i]); - else - learnts[j++] = learnts[i]; - } - learnts.shrink(i - j); -} - - -void Solver::removeSatisfied(vec& cs) -{ - int i,j; - for (i = j = 0; i < cs.size(); i++){ - if (satisfied(*cs[i])) - removeClause(*cs[i]); - else - cs[j++] = cs[i]; - } - cs.shrink(i - j); -} - - -/*_________________________________________________________________________________________________ -| -| simplify : [void] -> [bool] -| -| Description: -| Simplify the clause database according to the current top-level assigment. Currently, the only -| thing done here is the removal of satisfied clauses, but more things can be put here. -|________________________________________________________________________________________________@*/ -bool Solver::simplify() -{ - assert(decisionLevel() == 0); - - if (!ok || propagate() != NULL) - return ok = false; - - if (nAssigns() == simpDB_assigns || (simpDB_props > 0)) - return true; - - // Remove satisfied clauses: - removeSatisfied(learnts); - if (remove_satisfied) // Can be turned off. - removeSatisfied(clauses); - - // Remove fixed variables from the variable heap: - order_heap.filter(VarFilter(*this)); - - simpDB_assigns = nAssigns(); - simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now) - - return true; -} - - -/*_________________________________________________________________________________________________ -| -| search : (nof_conflicts : int) (nof_learnts : int) (params : const SearchParams&) -> [lbool] -| -| Description: -| Search for a model the specified number of conflicts, keeping the number of learnt clauses -| below the provided limit. NOTE! Use negative value for 'nof_conflicts' or 'nof_learnts' to -| indicate infinity. -| -| Output: -| 'l_True' if a partial assigment that is consistent with respect to the clauseset is found. If -| all variables are decision variables, this means that the clause set is satisfiable. 'l_False' -| if the clause set is unsatisfiable. 'l_Undef' if the bound on number of conflicts is reached. -|________________________________________________________________________________________________@*/ -lbool Solver::search(int nof_conflicts, int nof_learnts) -{ - assert(ok); - int backtrack_level; - int conflictC = 0; - vec learnt_clause; - - starts++; - - // bool first = true; - - for (;;){ - Clause* confl = propagate(); - if (confl != NULL){ - // CONFLICT - conflicts++; conflictC++; - if (decisionLevel() == 0) return l_False; - - // first = false; - - learnt_clause.clear(); - analyze(confl, learnt_clause, backtrack_level); - cancelUntil(backtrack_level); - assert(value(learnt_clause[0]) == l_Undef); - - if (learnt_clause.size() == 1){ - uncheckedEnqueue(learnt_clause[0]); - }else{ - Clause* c = Clause_new(learnt_clause, true); - learnts.push(c); - attachClause(*c); - claBumpActivity(*c); - uncheckedEnqueue(learnt_clause[0], c); - } - - varDecayActivity(); - claDecayActivity(); - - }else{ - // NO CONFLICT - - if (nof_conflicts >= 0 && conflictC >= nof_conflicts){ - // Reached bound on number of conflicts: - progress_estimate = progressEstimate(); - cancelUntil(0); - return l_Undef; } - - // Simplify the set of problem clauses: - if (decisionLevel() == 0 && !simplify()) - return l_False; - - if (nof_learnts >= 0 && learnts.size()-nAssigns() >= nof_learnts) - // Reduce the set of learnt clauses: - reduceDB(); - - Lit next = lit_Undef; - while (decisionLevel() < assumptions.size()){ - // Perform user provided assumption: - Lit p = assumptions[decisionLevel()]; - if (value(p) == l_True){ - // Dummy decision level: - newDecisionLevel(); - }else if (value(p) == l_False){ - analyzeFinal(~p, conflict); - return l_False; - }else{ - next = p; - break; - } - } - - - //************************** - if (next == lit_Undef){ - // New variable decision: - decisions++; - - if (!allMinVarsAssigned){ - for (int i=0; i& assumps) -{ - model.clear(); - conflict.clear(); - - allMinVarsAssigned = false; - - if (!ok) return false; - - assumps.copyTo(assumptions); - - double nof_conflicts = restart_first; - double nof_learnts = nClauses() * learntsize_factor; - lbool status = l_Undef; - - if (verbosity >= 1){ - reportf("============================[ Search Statistics ]==============================\n"); - reportf("| Conflicts | ORIGINAL | LEARNT | Progress |\n"); - reportf("| | Vars Clauses Literals | Limit Clauses Lit/Cl | |\n"); - reportf("===============================================================================\n"); - } - - // Search: - while (status == l_Undef){ - if (verbosity >= 1) - reportf("| %9d | %7d %8d %8d | %8d %8d %6.0f | %6.3f %% |\n", (int)conflicts, order_heap.size(), nClauses(), (int)clauses_literals, (int)nof_learnts, nLearnts(), (double)learnts_literals/nLearnts(), progress_estimate*100), fflush(stdout); - status = search((int)nof_conflicts, (int)nof_learnts); - nof_conflicts *= restart_inc; - nof_learnts *= learntsize_inc; - } - - if (verbosity >= 1) - reportf("===============================================================================\n"); - - - if (status == l_True){ - // Extend & copy model: - model.growTo(nVars()); - for (int i = 0; i < nVars(); i++) model[i] = value(i); -#ifndef NDEBUG - verifyModel(); -#endif - }else{ - assert(status == l_False); - if (conflict.size() == 0) - ok = false; - } - - cancelUntil(0); - return status == l_True; -} - - - - -void Solver::verifyModel() -{ - bool failed = false; - for (int i = 0; i < clauses.size(); i++){ - assert(clauses[i]->mark() == 0); - Clause& c = *clauses[i]; - for (int j = 0; j < c.size(); j++) - if (modelValue(c[j]) == l_True) - goto next; - - reportf("unsatisfied clause: "); - printClause(*clauses[i]); - reportf("\n"); - failed = true; - next:; - } - - assert(!failed); - - // reportf("Verified %d original clauses.\n", clauses.size()); -} - - -void Solver::checkLiteralCount() -{ - // Check that sizes are calculated correctly: - int cnt = 0; - for (int i = 0; i < clauses.size(); i++) - if (clauses[i]->mark() == 0) - cnt += clauses[i]->size(); - - if ((int)clauses_literals != cnt){ - fprintf(stderr, "literal count: %d, real value = %d\n", (int)clauses_literals, cnt); - assert((int)clauses_literals == cnt); - } -} diff --git a/packages/swi-minisat2/C/Solver.h b/packages/swi-minisat2/C/Solver.h deleted file mode 100644 index fc41a7e0b..000000000 --- a/packages/swi-minisat2/C/Solver.h +++ /dev/null @@ -1,311 +0,0 @@ -/****************************************************************************************[Solver.h] -MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or -substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -**************************************************************************************************/ - -#ifndef Solver_h -#define Solver_h - -#include - -#include "Vec.h" -#include "Heap.h" -#include "Alg.h" - -#include "SolverTypes.h" - - -//================================================================================================= -// Solver -- the main class: - - -class Solver { -public: - - // Constructor/Destructor: - // - Solver(); - ~Solver(); - - // Problem specification: - // - Var newVar (bool polarity = true, bool dvar = true); // Add a new variable with parameters specifying variable mode. - bool addClause (vec& ps); // Add a clause to the solver. NOTE! 'ps' may be shrunk by this method! - bool setminVars(vec& ps); - - // Solving: - // - bool simplify (); // Removes already satisfied clauses. - bool solve (const vec& assumps); // Search for a model that respects a given set of assumptions. - bool solve (); // Search without assumptions. - bool okay () const; // FALSE means solver is in a conflicting state - - // Variable mode: - // - void setPolarity (Var v, bool b); // Declare which polarity the decision heuristic should use for a variable. Requires mode 'polarity_user'. - void setDecisionVar (Var v, bool b); // Declare if a variable should be eligible for selection in the decision heuristic. - - // Read state: - // - lbool value (Var x) const; // The current value of a variable. - lbool value (Lit p) const; // The current value of a literal. - lbool modelValue (Lit p) const; // The value of a literal in the last model. The last call to solve must have been satisfiable. - int nAssigns () const; // The current number of assigned literals. - int nClauses () const; // The current number of original clauses. - int nLearnts () const; // The current number of learnt clauses. - int nVars () const; // The current number of variables. - - // Extra results: (read-only member variable) - // - vec model; // If problem is satisfiable, this vector contains the model (if any). - vec conflict; // If problem is unsatisfiable (possibly under assumptions), - // this vector represent the final conflict clause expressed in the assumptions. - - // Mode of operation: - // - double var_decay; // Inverse of the variable activity decay factor. (default 1 / 0.95) - double clause_decay; // Inverse of the clause activity decay factor. (1 / 0.999) - double random_var_freq; // The frequency with which the decision heuristic tries to choose a random variable. (default 0.02) - int restart_first; // The initial restart limit. (default 100) - double restart_inc; // The factor with which the restart limit is multiplied in each restart. (default 1.5) - double learntsize_factor; // The intitial limit for learnt clauses is a factor of the original clauses. (default 1 / 3) - double learntsize_inc; // The limit for learnt clauses is multiplied with this factor each restart. (default 1.1) - bool expensive_ccmin; // Controls conflict clause minimization. (default TRUE) - int polarity_mode; // Controls which polarity the decision heuristic chooses. See enum below for allowed modes. (default polarity_false) - int verbosity; // Verbosity level. 0=silent, 1=some progress report (default 0) - - enum { polarity_true = 0, polarity_false = 1, polarity_user = 2, polarity_rnd = 3 }; - - // Statistics: (read-only member variable) - // - uint64_t starts, decisions, rnd_decisions, propagations, conflicts; - uint64_t clauses_literals, learnts_literals, max_literals, tot_literals; - -protected: - - // Helper structures: - // - struct VarOrderLt { - const vec& activity; - bool operator () (Var x, Var y) const { return activity[x] > activity[y]; } - VarOrderLt(const vec& act) : activity(act) { } - }; - - friend class VarFilter; - struct VarFilter { - const Solver& s; - VarFilter(const Solver& _s) : s(_s) {} - bool operator()(Var v) const { return toLbool(s.assigns[v]) == l_Undef && s.decision_var[v]; } - }; - - // Solver state: - // - - //**************** - bool allMinVarsAssigned; - int lastMinVarDL; - vec minVars; - //**************** - - - bool ok; // If FALSE, the constraints are already unsatisfiable. No part of the solver state may be used! - vec clauses; // List of problem clauses. - vec learnts; // List of learnt clauses. - double cla_inc; // Amount to bump next clause with. - vec activity; // A heuristic measurement of the activity of a variable. - double var_inc; // Amount to bump next variable with. - vec > watches; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true). - vec assigns; // The current assignments (lbool:s stored as char:s). - vec polarity; // The preferred polarity of each variable. - vec decision_var; // Declares if a variable is eligible for selection in the decision heuristic. - vec trail; // Assignment stack; stores all assigments made in the order they were made. - vec trail_lim; // Separator indices for different decision levels in 'trail'. - vec reason; // 'reason[var]' is the clause that implied the variables current value, or 'NULL' if none. - vec level; // 'level[var]' contains the level at which the assignment was made. - int qhead; // Head of queue (as index into the trail -- no more explicit propagation queue in MiniSat). - int simpDB_assigns; // Number of top-level assignments since last execution of 'simplify()'. - int64_t simpDB_props; // Remaining number of propagations that must be made before next execution of 'simplify()'. - vec assumptions; // Current set of assumptions provided to solve by the user. - Heap order_heap; // A priority queue of variables ordered with respect to the variable activity. - double random_seed; // Used by the random variable selection. - double progress_estimate;// Set by 'search()'. - bool remove_satisfied; // Indicates whether possibly inefficient linear scan for satisfied clauses should be performed in 'simplify'. - - // Temporaries (to reduce allocation overhead). Each variable is prefixed by the method in which it is - // used, exept 'seen' wich is used in several places. - // - vec seen; - vec analyze_stack; - vec analyze_toclear; - vec add_tmp; - - // Main internal methods: - // - void insertVarOrder (Var x); // Insert a variable in the decision order priority queue. - Lit pickBranchLit (int polarity_mode, double random_var_freq); // Return the next decision variable. - void newDecisionLevel (); // Begins a new decision level. - void uncheckedEnqueue (Lit p, Clause* from = NULL); // Enqueue a literal. Assumes value of literal is undefined. - bool enqueue (Lit p, Clause* from = NULL); // Test if fact 'p' contradicts current state, enqueue otherwise. - Clause* propagate (); // Perform unit propagation. Returns possibly conflicting clause. - void cancelUntil (int level); // Backtrack until a certain level. - void analyze (Clause* confl, vec& out_learnt, int& out_btlevel); // (bt = backtrack) - void analyzeFinal (Lit p, vec& out_conflict); // COULD THIS BE IMPLEMENTED BY THE ORDINARIY "analyze" BY SOME REASONABLE GENERALIZATION? - bool litRedundant (Lit p, uint32_t abstract_levels); // (helper method for 'analyze()') - lbool search (int nof_conflicts, int nof_learnts); // Search for a given number of conflicts. - void reduceDB (); // Reduce the set of learnt clauses. - void removeSatisfied (vec& cs); // Shrink 'cs' to contain only non-satisfied clauses. - - // Maintaining Variable/Clause activity: - // - void varDecayActivity (); // Decay all variables with the specified factor. Implemented by increasing the 'bump' value instead. - void varBumpActivity (Var v); // Increase a variable with the current 'bump' value. - void claDecayActivity (); // Decay all clauses with the specified factor. Implemented by increasing the 'bump' value instead. - void claBumpActivity (Clause& c); // Increase a clause with the current 'bump' value. - - // Operations on clauses: - // - void attachClause (Clause& c); // Attach a clause to watcher lists. - void detachClause (Clause& c); // Detach a clause to watcher lists. - void removeClause (Clause& c); // Detach and free a clause. - bool locked (const Clause& c) const; // Returns TRUE if a clause is a reason for some implication in the current state. - bool satisfied (const Clause& c) const; // Returns TRUE if a clause is satisfied in the current state. - - // Misc: - // - int decisionLevel () const; // Gives the current decisionlevel. - uint32_t abstractLevel (Var x) const; // Used to represent an abstraction of sets of decision levels. - double progressEstimate () const; // DELETE THIS ?? IT'S NOT VERY USEFUL ... - - // Debug: - void printLit (Lit l); - template - void printClause (const C& c); - void verifyModel (); - void checkLiteralCount(); - - // Static helpers: - // - - // Returns a random float 0 <= x < 1. Seed must never be 0. - static inline double drand(double& seed) { - seed *= 1389796; - int q = (int)(seed / 2147483647); - seed -= (double)q * 2147483647; - return seed / 2147483647; } - - // Returns a random integer 0 <= x < size. Seed must never be 0. - static inline int irand(double& seed, int size) { - return (int)(drand(seed) * size); } -}; - - -//================================================================================================= -// Implementation of inline methods: - - -inline void Solver::insertVarOrder(Var x) { - if (!order_heap.inHeap(x) && decision_var[x]) order_heap.insert(x); } - -inline void Solver::varDecayActivity() { var_inc *= var_decay; } -inline void Solver::varBumpActivity(Var v) { - if ( (activity[v] += var_inc) > 1e100 ) { - // Rescale: - for (int i = 0; i < nVars(); i++) - activity[i] *= 1e-100; - var_inc *= 1e-100; } - - // Update order_heap with respect to new activity: - if (order_heap.inHeap(v)) - order_heap.decrease(v); } - -inline void Solver::claDecayActivity() { cla_inc *= clause_decay; } -inline void Solver::claBumpActivity (Clause& c) { - if ( (c.activity() += cla_inc) > 1e20 ) { - // Rescale: - for (int i = 0; i < learnts.size(); i++) - learnts[i]->activity() *= 1e-20; - cla_inc *= 1e-20; } } - -inline bool Solver::enqueue (Lit p, Clause* from) { return value(p) != l_Undef ? value(p) != l_False : (uncheckedEnqueue(p, from), true); } -inline bool Solver::locked (const Clause& c) const { return reason[var(c[0])] == &c && value(c[0]) == l_True; } -inline void Solver::newDecisionLevel() { trail_lim.push(trail.size()); } - -inline int Solver::decisionLevel () const { return trail_lim.size(); } -inline uint32_t Solver::abstractLevel (Var x) const { return 1 << (level[x] & 31); } -inline lbool Solver::value (Var x) const { return toLbool(assigns[x]); } -inline lbool Solver::value (Lit p) const { return toLbool(assigns[var(p)]) ^ sign(p); } -inline lbool Solver::modelValue (Lit p) const { return model[var(p)] ^ sign(p); } -inline int Solver::nAssigns () const { return trail.size(); } -inline int Solver::nClauses () const { return clauses.size(); } -inline int Solver::nLearnts () const { return learnts.size(); } -inline int Solver::nVars () const { return assigns.size(); } -inline void Solver::setPolarity (Var v, bool b) { polarity [v] = (char)b; } -inline void Solver::setDecisionVar(Var v, bool b) { decision_var[v] = (char)b; if (b) { insertVarOrder(v); } } -inline bool Solver::solve () { vec tmp; return solve(tmp); } -inline bool Solver::okay () const { return ok; } - - - -//================================================================================================= -// Debug + etc: - - -#define reportf(...) ( fflush(stdout), fprintf(stderr, __VA_ARGS__), fflush(stderr) ) - -static inline void logLit(FILE* f, Lit l) -{ - fprintf(f, "%sx%d", sign(l) ? "~" : "", var(l)+1); -} - -static inline void logLits(FILE* f, const vec& ls) -{ - fprintf(f, "[ "); - if (ls.size() > 0){ - logLit(f, ls[0]); - for (int i = 1; i < ls.size(); i++){ - fprintf(f, ", "); - logLit(f, ls[i]); - } - } - fprintf(f, "] "); -} - -static inline const char* showBool(bool b) { return b ? "true" : "false"; } - - -// Just like 'assert()' but expression will be evaluated in the release version as well. -static inline void check(bool expr) { assert(expr); } - - -inline void Solver::printLit(Lit l) -{ - reportf("%s%d:%c", sign(l) ? "-" : "", var(l)+1, value(l) == l_True ? '1' : (value(l) == l_False ? '0' : 'X')); -} - - -template -inline void Solver::printClause(const C& c) -{ - for (int i = 0; i < c.size(); i++){ - printLit(c[i]); - fprintf(stderr, " "); - } -} - - -//================================================================================================= -#endif diff --git a/packages/swi-minisat2/C/SolverTypes.h b/packages/swi-minisat2/C/SolverTypes.h deleted file mode 100644 index 567e57f1d..000000000 --- a/packages/swi-minisat2/C/SolverTypes.h +++ /dev/null @@ -1,199 +0,0 @@ -/***********************************************************************************[SolverTypes.h] -MiniSat -- Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or -substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -**************************************************************************************************/ - - -#ifndef SolverTypes_h -#define SolverTypes_h - -#include -#include - -//================================================================================================= -// Variables, literals, lifted booleans, clauses: - - -// NOTE! Variables are just integers. No abstraction here. They should be chosen from 0..N, -// so that they can be used as array indices. - -typedef int Var; -#define var_Undef (-1) - - -class Lit { - int x; - public: - Lit() : x(2*var_Undef) { } // (lit_Undef) - explicit Lit(Var var, bool sign = false) : x((var+var) + (int)sign) { } - - // Don't use these for constructing/deconstructing literals. Use the normal constructors instead. - friend int toInt (Lit p); // Guarantees small, positive integers suitable for array indexing. - friend Lit toLit (int i); // Inverse of 'toInt()' - friend Lit operator ~(Lit p); - friend bool sign (Lit p); - friend int var (Lit p); - friend Lit unsign (Lit p); - friend Lit id (Lit p, bool sgn); - - bool operator == (Lit p) const { return x == p.x; } - bool operator != (Lit p) const { return x != p.x; } - bool operator < (Lit p) const { return x < p.x; } // '<' guarantees that p, ~p are adjacent in the ordering. -}; - -inline int toInt (Lit p) { return p.x; } -inline Lit toLit (int i) { Lit p; p.x = i; return p; } -inline Lit operator ~(Lit p) { Lit q; q.x = p.x ^ 1; return q; } -inline bool sign (Lit p) { return p.x & 1; } -inline int var (Lit p) { return p.x >> 1; } -inline Lit unsign (Lit p) { Lit q; q.x = p.x & ~1; return q; } -inline Lit id (Lit p, bool sgn) { Lit q; q.x = p.x ^ (int)sgn; return q; } - -const Lit lit_Undef(var_Undef, false); // }- Useful special constants. -const Lit lit_Error(var_Undef, true ); // } - - -//================================================================================================= -// Lifted booleans: - - -class lbool { - char value; - explicit lbool(int v) : value(v) { } - -public: - lbool() : value(0) { } - lbool(bool x) : value((int)x*2-1) { } - int toInt(void) const { return value; } - - bool operator == (lbool b) const { return value == b.value; } - bool operator != (lbool b) const { return value != b.value; } - lbool operator ^ (bool b) const { return b ? lbool(-value) : lbool(value); } - - friend int toInt (lbool l); - friend lbool toLbool(int v); -}; -inline int toInt (lbool l) { return l.toInt(); } -inline lbool toLbool(int v) { return lbool(v); } - -const lbool l_True = toLbool( 1); -const lbool l_False = toLbool(-1); -const lbool l_Undef = toLbool( 0); - -//================================================================================================= -// Clause -- a simple class for representing a clause: - - -class Clause { - uint32_t size_etc; - union { float act; uint32_t abst; } extra; - Lit data[0]; - -public: - void calcAbstraction() { - uint32_t abstraction = 0; - for (int i = 0; i < size(); i++) - abstraction |= 1 << (var(data[i]) & 31); - extra.abst = abstraction; } - - // NOTE: This constructor cannot be used directly (doesn't allocate enough memory). - template - Clause(const V& ps, bool learnt) { - size_etc = (ps.size() << 3) | (uint32_t)learnt; - for (int i = 0; i < ps.size(); i++) data[i] = ps[i]; - if (learnt) extra.act = 0; else calcAbstraction(); } - - // -- use this function instead: - template - friend Clause* Clause_new(const V& ps, bool learnt); - - int size () const { return size_etc >> 3; } - void shrink (int i) { assert(i <= size()); size_etc = (((size_etc >> 3) - i) << 3) | (size_etc & 7); } - void pop () { shrink(1); } - bool learnt () const { return size_etc & 1; } - uint32_t mark () const { return (size_etc >> 1) & 3; } - void mark (uint32_t m) { size_etc = (size_etc & ~6) | ((m & 3) << 1); } - const Lit& last () const { return data[size()-1]; } - - // NOTE: somewhat unsafe to change the clause in-place! Must manually call 'calcAbstraction' afterwards for - // subsumption operations to behave correctly. - Lit& operator [] (int i) { return data[i]; } - Lit operator [] (int i) const { return data[i]; } - operator const Lit* (void) const { return data; } - - float& activity () { return extra.act; } - uint32_t abstraction () const { return extra.abst; } - - Lit subsumes (const Clause& other) const; - void strengthen (Lit p); -}; - - -template -Clause* Clause_new(const V& ps, bool learnt) { - assert(sizeof(Lit) == sizeof(uint32_t)); - assert(sizeof(float) == sizeof(uint32_t)); - void* mem = std::malloc(sizeof(Clause) + sizeof(uint32_t)*(ps.size())); - return new (mem) Clause(ps, learnt); } -/*_________________________________________________________________________________________________ -| -| subsumes : (other : const Clause&) -> Lit -| -| Description: -| Checks if clause subsumes 'other', and at the same time, if it can be used to simplify 'other' -| by subsumption resolution. -| -| Result: -| lit_Error - No subsumption or simplification -| lit_Undef - Clause subsumes 'other' -| p - The literal p can be deleted from 'other' -|________________________________________________________________________________________________@*/ -inline Lit Clause::subsumes(const Clause& other) const -{ - if (other.size() < size() || (extra.abst & ~other.extra.abst) != 0) - return lit_Error; - - Lit ret = lit_Undef; - const Lit* c = (const Lit*)(*this); - const Lit* d = (const Lit*)other; - - for (int i = 0; i < size(); i++) { - // search for c[i] or ~c[i] - for (int j = 0; j < other.size(); j++) - if (c[i] == d[j]) - goto ok; - else if (ret == lit_Undef && c[i] == ~d[j]){ - ret = c[i]; - goto ok; - } - - // did not find it - return lit_Error; - ok:; - } - - return ret; -} - - -inline void Clause::strengthen(Lit p) -{ - remove(*this, p); - calcAbstraction(); -} - -#endif diff --git a/packages/swi-minisat2/C/pl-minisat.C b/packages/swi-minisat2/C/pl-minisat.C deleted file mode 100644 index dca924705..000000000 --- a/packages/swi-minisat2/C/pl-minisat.C +++ /dev/null @@ -1,175 +0,0 @@ -//#include -#include -#include -#include - -#include "Solver.h" - -#define val(i) ((s->model[i] != l_Undef) ? ((s->model[i]==l_True)? i+1:-1*(i+1)):0) - -Solver *s = NULL; - - -extern "C" foreign_t minisat_new_solver() -{ - s = new Solver; - PL_succeed; -} - - -extern "C" foreign_t minisat_delete_solver() -{ - if (s) { - delete s; - s = NULL; - } - PL_succeed; -} - -static inline Lit pl2lit(term_t pl_literal) -{ - int pl_lit_int, var; - PL_get_integer(pl_literal,&pl_lit_int); - var = abs(pl_lit_int)-1; - while (var >= s->nVars()) s->newVar(); - return (pl_lit_int > 0) ? Lit(var) : ~Lit(var); -} - - -extern "C" foreign_t minisat_set_minvars(term_t l) -{ - term_t head = PL_new_term_ref(); /* variable for the elements */ - term_t list = PL_copy_term_ref(l); /* copy as we need to write */ - - vec lits; - - while( PL_get_list(list, head, list) ) { - lits.push( pl2lit(head) ); - } - - assert(PL_get_nil(list)); - - if (s->setminVars(lits)) PL_succeed; else PL_fail; -} - -extern "C" foreign_t minisat_add_clause(term_t l) -{ - term_t head = PL_new_term_ref(); /* variable for the elements */ - term_t list = PL_copy_term_ref(l); /* copy as we need to write */ - - vec lits; - - while( PL_get_list(list, head, list) ) { - lits.push( pl2lit(head) ); - } - - assert(PL_get_nil(list)); - - if (s->addClause(lits)) PL_succeed; else PL_fail; -} - - -extern "C" foreign_t minisat_solve(term_t assum) { - - term_t head = PL_new_term_ref(); /* variable for the elements */ - term_t list = PL_copy_term_ref(assum); /* copy as we need to write */ - - vec assumptions; - - while( PL_get_list(list, head, list) ) { - assumptions.push( pl2lit(head) ); - } - - if (s->solve(assumptions)) PL_succeed; else PL_fail; -} - - -extern "C" foreign_t minisat_get_var_assignment(term_t var, term_t res) -{ - int i; - - PL_get_integer(var,&i); - i--; - - if (i < s->nVars()) { - term_t a = PL_new_term_ref(); /* variable for the elements */ - PL_put_integer(a, val(i)); - return PL_unify(a,res); - } else { - PL_fail; - } -} - -extern "C" foreign_t minisat_nvars(term_t res) -{ - term_t a = PL_new_term_ref(); /* variable for the elements */ - PL_put_integer(a, s->nVars()); - return PL_unify(a,res); -} - - - - - - - - -//============================================================================= -static const PL_extension predicates[] = - { - // - // { "name", arity, function, PL_FA_ }, - // - - { "minisat_new_solver", 0, (void*)minisat_new_solver, 0 }, - { "minisat_delete_solver", 0, (void*)minisat_delete_solver, 0 }, - { "minisat_add_clause", 1, (void*)minisat_add_clause, 0 }, - { "minisat_solve", 1, (void*)minisat_solve, 0 }, - { "minisat_get_var_assignment", 2, (void*)minisat_get_var_assignment, 0 }, - { "minisat_nvars", 1, (void*)minisat_nvars, 0 }, - { NULL, 0, NULL, 0 } // terminating line - }; - -//----------------------------------------------------------------------------- -extern "C" install_t install() -{ - //Sdprintf("%% SWI-Prolog interface to MiniSat"); - //Sdprintf(" - built on "); - //Sdprintf(__DATE__); - //Sdprintf(", "); - //Sdprintf(__TIME__); - //Sdprintf(" ... "); - PL_register_extensions(predicates); /* This is the only PL_ call allowed */ - /* before PL_initialise(). It */ - /* ensures the foreign predicates */ - /* are available before loading */ - /* Prolog code */ - - //Sdprintf("OK\n"); -} - -//----------------------------------------------------------------------------- -// This part is for compiling into a standalone executable - -#ifdef READLINE -static void install_readline(int argc, char**argv) -{ - PL_install_readline(); -} -#endif - -int main(int argc, char **argv) -{ - -#ifdef READLINE - PL_initialise_hook(install_readline); -#endif - - install(); - if ( !PL_initialise(argc, argv) ) - PL_halt(1); - - PL_halt(PL_toplevel() ? 0 : 1); - - return 0; -} diff --git a/packages/swi-minisat2/CMakeLists.txt b/packages/swi-minisat2/CMakeLists.txt deleted file mode 100644 index b39ad2491..000000000 --- a/packages/swi-minisat2/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ - -set (PROGRAMS - cnf.pl - minisat.pl - ) - -set (EXAMPLE_PROGRAMS - examples/adder.pl - examples/pearl_examples.pl - ) - -install(FILES - ${PROGRAMS} - DESTINATION ${YAP_INSTALL_DATADIR} - ) - -add_subDIRECTORY (C) - diff --git a/packages/swi-minisat2/Makefile.in b/packages/swi-minisat2/Makefile.in deleted file mode 100644 index 1131ac9b2..000000000 --- a/packages/swi-minisat2/Makefile.in +++ /dev/null @@ -1,51 +0,0 @@ -# -# default base directory for YAP installation -# -# -ROOTDIR = @prefix@ -# -# where the binary should be -# -BINDIR = $(ROOTDIR)/bin -# -# where YAP should look for binary libraries -# -LIBDIR=@libdir@ -YAPLIBDIR=@libdir@/Yap -# -# where YAP should look for architecture-independent Prolog libraries -# -SHAREDIR=$(ROOTDIR)/share -# -# -# You shouldn't need to change what follows. -# -INSTALL=@INSTALL@ -INSTALL_DATA=@INSTALL_DATA@ -INSTALL_PROGRAM=@INSTALL_PROGRAM@ -srcdir=@srcdir@ -YAP_EXTRAS=@YAP_EXTRAS@ - -PROGRAMS= \ - $(srcdir)/cnf.pl \ - $(srcdir)/minisat.pl - -EXAMPLE_PROGRAMS= \ - $(srcdir)/examples/adder.pl \ - $(srcdir)/examples/pearl_examples.pl - -all: - -install: $(PROGRAMS) install-examples - mkdir -p $(DESTDIR)$(SHAREDIR)/Yap - mkdir -p $(DESTDIR)$(SHAREDIR)/doc/Yap/packages/examples/minisat - for p in $(PROGRAMS); do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/Yap; done - for p in $(EXAMPLE_PROGRAMS); do $(INSTALL_DATA) $$p $(DESTDIR)$(SHAREDIR)/doc/Yap/packages/examples/minisat; done - -install-examples: - -clean: - -distclean: - rm Makefile - diff --git a/packages/swi-minisat2/README b/packages/swi-minisat2/README deleted file mode 100644 index 110f81236..000000000 --- a/packages/swi-minisat2/README +++ /dev/null @@ -1,8 +0,0 @@ -You need to put the file swi-minisat2.tgz in a directory where you want -the solver and the interface and then do: - -% tar zxvf swi-minisat2.tgz -% ./configure.sh -% make -% make clean - diff --git a/packages/swi-minisat2/README.YAP b/packages/swi-minisat2/README.YAP deleted file mode 100644 index 27a2d12c6..000000000 --- a/packages/swi-minisat2/README.YAP +++ /dev/null @@ -1,13 +0,0 @@ -This is the minisat package as described in - -Michael Codish, Vitaly Lagoon, Peter J. Stuckey: Logic programming -with satisfiability. TPLP 8(1): 121-128 (2008) - -We thank the authors for kindly allowing us to use this package in YAP. - -Please check the examples in $install/share/Yap/minisat/examples and -the TPLP paper to understand how the system can be used. - -Last, please contact yap-users AT sf.net for any bugs first, as they -may have been caused by the YAP port. - diff --git a/packages/swi-minisat2/cnf.pl b/packages/swi-minisat2/cnf.pl deleted file mode 100644 index b2e10e78e..000000000 --- a/packages/swi-minisat2/cnf.pl +++ /dev/null @@ -1,100 +0,0 @@ -%%============================================================================ -%% CNF.pl -%% Convertor of Boolean formulae to CNF -%% Copyright (c) 2006, Michael Codish, Vitaly Lagoon, and Peter J. Stuckey -%% -%% Permission is hereby granted, free of charge, to any person obtaining a -%% copy of this software and associated documentation files (the -%% "Software"), to deal in the Software without restriction, including -%% without limitation the rights to use, copy, modify, merge, publish, -%% distribute, sublicense, and/or sell copies of the Software, and to -%% permit persons to whom the Software is furnished to do so, subject to -%% the following conditions: -%% -%% The above copyright notice and this permission notice shall be included -%% in all copies or substantial portions of the Software. -%% -%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -%% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -%% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -%% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -%% LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -%% OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -%% WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -:- module(cnf,[cnf/2,cnf_dl/2]). - -cnf(F,Cnf) :- cnf_dl(F,Cnf-[]). - -cnf_dl(F,[[B]|Cnf1]-Cnf2) :- iff(F,+,B,Cnf2,Cnf1). - - -iff(V,_,B,Acc,Cnf) :- var(V), !, V=B, Cnf=Acc. -iff(1,_,B,Acc,Cnf) :- !, B=1, Cnf=Acc. -iff(0,_,B,Acc,Cnf) :- !, B=0, Cnf=Acc. - -iff(-X,+,B,Acc,Cnf) :- !, iff(X,-,BX,Acc,Cnf), neglit(BX,B). -iff(-X,-,B,Acc,Cnf) :- !, iff(X,+,BX,Acc,Cnf), neglit(BX,B). -iff(-X,*,B,Acc,Cnf) :- !, iff(X,*,BX,Acc,Cnf), neglit(BX,B). - -iff((X+Y),Polarity,B,Acc,Cnf) :- !, - iff(X,Polarity,BX,Acc,AccX), - iff(Y,Polarity,BY,AccX,AccXY), - ( - Polarity == + -> Cnf = [[-B,BX,BY]|AccXY] - ; - Polarity == - -> Cnf = [[B,-BX],[B,-BY]|AccXY] - ; - Cnf = [[-B,BX,BY], [B,-BX], [B,-BY] | AccXY] - ). - -iff((X*Y),Polarity,B,Acc,Cnf) :- !, - iff(X,Polarity,BX,Acc,AccX), - iff(Y,Polarity,BY,AccX,AccXY), - ( - Polarity == + -> Cnf = [[-B,BX],[-B,BY]|AccXY] - ; - Polarity == - -> Cnf = [[B,-BX,-BY]|AccXY] - ; - Cnf = [[B,-BX,-BY], [-B,BX], [-B,BY] | AccXY] - ). - -iff((X==Y),Polarity,B,Acc,Cnf) :- !, - iff(X,*,BX,Acc,AccX), - iff(Y,*,BY,AccX,AccXY), - ( - Polarity == + -> Cnf = [[-BX,BY,-B],[BX,-BY,-B] | AccXY] - ; - Polarity == - -> Cnf = [[-BX,-BY,B],[BX,BY,B] | AccXY] - ; - Cnf = [[-BX,BY,-B],[BX,-BY,-B],[-BX,-BY,B],[BX,BY,B] | AccXY] - ). - -iff((xor(X, Y)),Polarity,B,Acc,Cnf) :- !, - iff(X,*,BX,Acc,AccX), - iff(Y,*,BY,AccX,AccXY), - ( - Polarity == + -> Cnf = [[-BX,-BY,-B],[BX,BY,-B] | AccXY] - ; - Polarity == - -> Cnf = [[-BX,BY,B],[BX,-BY,B] | AccXY] - ; - Cnf = [[-BX,BY,B],[BX,-BY,B],[-BX,-BY,-B],[BX,BY,-B] | AccXY] - ). - -iff((X->Y;Z),Polarity,B,Acc,Cnf) :- !, - iff(X,*,BX,Acc,AccX), - iff(Y,Polarity,BY,AccX,AccXY), - iff(Z,Polarity,BZ,AccXY,AccXYZ), - ( - Polarity == + -> Cnf = [[-BX,BY,-B],[BX,BZ,-B],[BY,BZ,-B]|AccXYZ] - ; - Polarity == - -> Cnf = [[-BX,-BY,B],[BX,-BZ,B],[-BY,-BZ,B]|AccXYZ] - ; - Cnf = [[-BX,BY,-B], [BX,BZ,-B], [BY,BZ,-B], - [-BX,-BY,B], [BX,-BZ,B], [-BY,-BZ,B] | AccXYZ] - ). - -neglit(V,-V) :- var(V), !. -neglit(-V,V). -neglit(0,1). -neglit(1,0). diff --git a/packages/swi-minisat2/examples/adder.pl b/packages/swi-minisat2/examples/adder.pl deleted file mode 100644 index 058e02dce..000000000 --- a/packages/swi-minisat2/examples/adder.pl +++ /dev/null @@ -1,23 +0,0 @@ -:- module(adder,[sum/3]). - -sum([B],[S],(S==B)). -sum([B1,B2|Bs],Sum,F1*F2*F3) :- - split([B1,B2|Bs],Xs,Ys), - sum(Xs,S1,F1), sum(Ys,S2,F2),add(S1,S2,Sum,F3). - -split([],[],[]). -split([X],[X],[0]). -split([X,Y|XYs],[X|Xs],[Y|Ys]) :- split(XYs,Xs,Ys). - -add([X|Xs],[Y|Ys],[Z|Zs],(Z==SumXY)*Sum) :- - halfadder(X,Y,SumXY,CarryXY), - adder(Xs,Ys,CarryXY,Zs,Sum). - -adder([],[],Carry,[Z],Z==Carry). -adder([X|Xs],[Y|Ys],Carry,[Z|Zs],(Z==SumXY)*Rest) :- - fulladder(X,Y,Carry,SumXY,CarryXY), - adder(Xs,Ys,CarryXY,Zs,Rest). - -fulladder(X, Y, C, (X xor Y xor C), (C->(X+Y);(X*Y)) ). -halfadder(X, Y, (X xor Y), X*Y ). - diff --git a/packages/swi-minisat2/examples/pearl_examples.pl b/packages/swi-minisat2/examples/pearl_examples.pl deleted file mode 100644 index 0655e7876..000000000 --- a/packages/swi-minisat2/examples/pearl_examples.pl +++ /dev/null @@ -1,54 +0,0 @@ - -:- use_module(library(cnf)). -:- use_module(library(minisat)). -:- use_module(adder). - -%% Example, pg3 -%% -%% ?- cnf(X==Y,Cnf). -%% Cnf = [[T], [-X, Y, -T], [X, -Y, -T]] -%% ?- cnf((X*Y)+(-X*Z),Cnf). -%% Cnf = [[T], [-T, T1, T2], [-T2, -X], -%% [-T2, Z], [-T1, X], [-T1, Y]] - - -%% Example, pg4 -%% -%% ?- sum([X+Y,X*Y,X==Y,X xor Y],[S1,S2,S3],Psi). -%% Psi = (T1==X+Y)*(T2==(X==Y))*(T3==T1 xor T2)*(T4==T1*T2)*(T5==X*Y)* -%% (T6==X xor Y)*(T7==T5 xor T6)* (T8==T5*T6)*(S1==T3 xor T7)* -%% (S2==T4 xor T8 xor (T3*T7))* (S3==(T3*T7->T4+T8;T4*T8)) - - -%% Examples, pg6 -%% -%% ?- cnf(X==Y,Cnf), solve(Cnf). -%% X=0, Y=0 -%% -%% ?- cnf(X==Y,Cnf), sat(Cnf). -%% Yes -%% -%% ?- sum([X+Y,X*Y,X==Y,X xor Y],Sum,F), cnf(F,Cnf), solve(Cnf). -%% X = 0, Y = 0 -%% Sum = [1, 0, 0] -%% -%% ?- sum([X+Y,X*Y,X==Y,X xor Y],[0,1,0],F), cnf(F,Cnf), solve(Cnf). -%% X = 0, Y = 1 -%% -%% ?- sum([X+Y,X*Y,X==Y,X xor Y],Sum,F), cnf(F,Cnf), -%% maximize(Sum,Cnf), solve(Cnf). -%% Sum=[1,1,0] -%% X=1, Y=1 - - -%% Figure 3, pg 6 -%% -%% partialMaxSat(+,+). -partialMaxSat(Phi,Psi) :- - sum(Psi,Max,SumPsi), cnf(Phi*SumPsi,Cnf), - maximize(Max,Cnf), solve(Cnf). - -%% Example, pg 7 -%% -%% ?- partialMaxSat(X+Y,[X*Y,X==Y,X xor Y,-X+Y, -X, -Y, X]). -%% X = 1, Y = 1 diff --git a/packages/swi-minisat2/minisat.pl b/packages/swi-minisat2/minisat.pl deleted file mode 100644 index 386f70c22..000000000 --- a/packages/swi-minisat2/minisat.pl +++ /dev/null @@ -1,361 +0,0 @@ -%%============================================================================ -%% The SWI-Prolog interface to MiniSat SAT solver -%% http://www.cs.chalmers.se/Cs/Research/FormalMethods/MiniSat/MiniSat.html -%% -%% Copyright (c) 2006, Michael Codish, Vitaly Lagoon, and Peter J. Stuckey -%% -%% Permission is hereby granted, free of charge, to any person obtaining a -%% copy of this software and associated documentation files (the -%% "Software"), to deal in the Software without restriction, including -%% without limitation the rights to use, copy, modify, merge, publish, -%% distribute, sublicense, and/or sell copies of the Software, and to -%% permit persons to whom the Software is furnished to do so, subject to -%% the following conditions: -%% -%% The above copyright notice and this permission notice shall be included -%% in all copies or substantial portions of the Software. -%% -%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -%% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -%% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -%% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -%% LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -%% OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -%% WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -:- module(minisat,[ - solve/1, - sat/1, - sat_init/0, - sat_deinit/0, - sat_add_clauses/3, - sat_solve/1, - - minimize/2, - maximize/2, - minimize_v1/2, - maximize_v1/2, - minimize_v2/2, - maximize_v2/2, - minimize_v3/2, - maximize_v3/2 -]). - -:- use_module(library(shlib)). - -:- use_module(library(lists)). - -:- load_foreign_library('pl-minisat',install). - -:- dynamic tmp/1. - - - -%% -%% -sat_init :- - minisat_new_solver, % - create the new solve - minisat_add_clause([-1]), % - add zero - minisat_add_clause([2]). % - add one - -%% -%% -sat_deinit :- - minisat_delete_solver. - - - -%% -%% -sat_add_clauses(Cs, Vs, MiniSat_Vs) :- - term_variables(Cs,CsVars), - \+ \+ ( - bind2index(CsVars), - add_cnf_clauses(Cs), - asserta(tmp(Vs)) - ), - retract(tmp(MiniSat_Vs)). - -add_cnf_clauses([]). -add_cnf_clauses([Cl|Cls]) :- - to_minisat(Cl,MiniSatCl), - minisat_add_clause(MiniSatCl), - add_cnf_clauses(Cls). - -to_minisat([],[]). -to_minisat([L|Ls],[N|Ns]) :- - minisat_aux(L,N), - to_minisat(Ls,Ns). - -minisat_aux(0,1) :- !. -minisat_aux(1,2) :- !. -minisat_aux(-(1),1) :- !. -minisat_aux(-(0),2) :- !. -minisat_aux(N,NN) :- NN is N. - - -bind2index(Vs) :- - minisat_nvars(N), - N1 is N+1, - bind2index_aux(Vs,N1). - -bind2index_aux([],_N). -bind2index_aux([V|Ns],N) :- - var(V), - !, - V=N, - N1 is N+1, bind2index_aux(Ns,N1). -bind2index_aux([V|Ns],N) :- - integer(V), - bind2index_aux(Ns,N). - -%% -%% -sat_solve(As) :- - to_minisat(As,MINISAT_As), - minisat_solve(MINISAT_As). - - -%% -%% -sat_get_values([],[]). -sat_get_values([SAT_V|SVs],[PL_V|PL_Vs]) :- - minisat_get_var_assignment(SAT_V,N), - ( N<0 -> PL_V=0 ; PL_V=1), - sat_get_values(SVs,PL_Vs). - - - - -%% -%% sat(+CNF): succeds if CNF is satisfaiable, it does not bind the variables in CNF -%% - -sat(CNF) :- - sat_init, - sat_add_clauses(CNF,_,_), - sat_solve([]), - sat_deinit, - !. -sat(_CNF) :- - sat_deinit, - !, - fail. - - -%% -%% solve(+CNF): like CNF/1 but bind the variables of CNF to the solution -%% -solve(CNF) :- - sat_init, - term_variables(CNF,CNF_Vs), - sat_add_clauses(CNF,CNF_Vs,SAT_Vs), - sat_solve([]), - sat_get_values(SAT_Vs,CNF_Vs), - sat_deinit, - !. -solve(_) :- - sat_deinit, - !, - fail. - - -%% -%% -%% -minimize(Vec,CNF) :- minimize_v1(Vec,CNF). -maximize(Vec,CNF) :- maximize_v1(Vec,CNF). - - -%% -%% -minimize_v1(Vec,CNF) :- - minimize_v1_aux(Vec,CNF), - sat(CNF). - -minimize_v1_aux([],_CNF). -minimize_v1_aux([B|Bs],CNF) :- - minimize_v1_aux(Bs,CNF), - ( (B=0, sat(CNF)) -> true ; B=1 ). - - -%% -%% -maximize_v1(Vec,CNF) :- - maximize_v1_aux(Vec,CNF), - sat(CNF). - -maximize_v1_aux([],_CNF). -maximize_v1_aux([B|Bs],CNF) :- - maximize_v1_aux(Bs,CNF), - ( (B=1, sat(CNF)) -> true ; B=0 ). - - - - -%% -%% -minimize_v2(Vec,CNF) :- - retractall(tmp(_)), - reverse(Vec,Vec_MSB), - term_variables(CNF,CNF_Vars), - sat_init, - sat_add_clauses(CNF,[Vec_MSB,CNF_Vars],[Vec_MSB_SVars,CNF_SVars]), - minimize_v2_loop(Vec_MSB_SVars), - sat_get_values(CNF_SVars,CNF_Vars), - sat_deinit, - !. - -minimize_v2_loop([]) :- - sat_solve([]). -minimize_v2_loop([V|Vs]) :- - ( sat_solve([-V]) -> - eliminate_prefix(Vs,0,New_Vs) - ; - sat_add_clauses([[V]],_,_), - New_Vs=Vs - ), - minimize_v2_loop(New_Vs). - - - -%% -%% -maximize_v2(Vec,CNF) :- - reverse(Vec,Vec_MSB), - term_variables(CNF,CNF_Vars), - sat_init, - sat_add_clauses(CNF,[Vec_MSB,CNF_Vars],[Vec_MSB_SVars,CNF_SVars]), - maximize_v2_loop(Vec_MSB_SVars), - sat_get_values(CNF_SVars,CNF_Vars), - sat_deinit, - !. - -maximize_v2_loop([]) :- - sat_solve([]). -maximize_v2_loop([V|Vs]) :- - ( sat_solve([V]) -> - eliminate_prefix(Vs,1,New_Vs) - ; - sat_add_clauses([[V]],_,_), - New_Vs=Vs - ), - maximize_v2_loop(New_Vs). - - - - - -%% -%% -minimize_v3(Vec,CNF) :- - retractall(tmp(_)), - term_variables(CNF,CNF_Vars), - sat_init, - sat_add_clauses(CNF,[Vec,CNF_Vars],[Vec_SVars,CNF_SVars]), - sat_solve([]), - sat_get_values(Vec_SVars,Curr_Min), - sat_get_values(CNF_SVars,Curr_Sol), - minimize_v3_loop(Vec_SVars,CNF_SVars,Curr_Min,Curr_Sol,Vec,CNF_Vars), - minisat_delete_solver, - !. - -minimize_v3_loop(Vec,CNF_SVars,Last_Min,_Last_Sol,Final_Min,Final_Sol) :- - xs_gt_ys(Last_Min,Vec,CNF-[]), - sat_add_clauses(CNF,_,_), - sat_solve([]), - sat_get_values(Vec,Curr_Min), - sat_get_values(CNF_SVars,Curr_Sol), - !, - minimize_v3_loop(Vec,CNF_SVars,Curr_Min,Curr_Sol,Final_Min,Final_Sol). -minimize_v3_loop(_Vec,_CNF_SVars,Final_Min,Final_Sol,Final_Min,Final_Sol) :- - !. - - - -%% -%% -maximize_v3(Vec,CNF) :- - retractall(tmp(_)), - term_variables(CNF,CNF_Vars), - sat_init, - sat_add_clauses(CNF,[Vec,CNF_Vars],[Vec_SVars,CNF_SVars]), - sat_solve([]), - sat_get_values(Vec_SVars,Curr_Max), - sat_get_values(CNF_SVars,Curr_Sol), - maximize_v3_loop(Vec_SVars,CNF_SVars,Curr_Max,Curr_Sol,Vec,CNF_Vars), - minisat_delete_solver, - !. - -maximize_v3_loop(Vec,CNF_SVars,Last_Max,_Last_Sol,Final_Max,Final_Sol) :- - xs_gt_ys(Vec,Last_Max,CNF-[]), - sat_add_clauses(CNF,_,_), - sat_solve([]), - sat_get_values(Vec,Curr_Max), - sat_get_values(CNF_SVars,Curr_Sol), - !, - maximize_v3_loop(Vec,CNF_SVars,Curr_Max,Curr_Sol,Final_Max,Final_Sol). -maximize_v3_loop(_Vec,_CNF_SVars,Final_Max,Final_Sol,Final_Max,Final_Sol) :- - !. - - - - -%% -%% -eliminate_prefix([],_Bit,[]) :- !. -eliminate_prefix([V|Vs],Bit,New_Vs) :- - sat_get_values([V],[VVal]), - VVal = Bit, - ( Bit = 0 -> sat_add_clauses([[-V]],_,_) ; sat_add_clauses([[V]],_,_) ), - !, - eliminate_prefix(Vs,Bit,New_Vs). -eliminate_prefix(Vs,Vs). - - - -%% -%% -% B == (Xs = Ys) -xs_eq_ys([X],[Y],B,Cnf1-Cnf2) :- - !, - eq(X,Y,B,Cnf1-Cnf2). -xs_eq_ys([X|Xs],[Y|Ys],B,Cnf1-Cnf4) :- - eq(X,Y,B1,Cnf1-Cnf2), - xs_eq_ys(Xs,Ys,B2,Cnf2-Cnf3), - and(B1,B2,B,Cnf3-Cnf4). - -%% -xs_gt_ys(Xs,Ys,[[B]|Cnf1]-Cnf2) :- - xs_gt_ys(Xs,Ys,B,Cnf1-Cnf2). - -%% -%% -xs_gt_ys([X],[Y],B,Cnf1-Cnf2) :- !, - gt(X,Y,B,Cnf1-Cnf2). -xs_gt_ys(Xs,Ys,B, Cnf1-Cnf6) :- - split(Xs,LoXs,HiXs), - split(Ys,LoYs,HiYs), - xs_gt_ys(HiXs,HiYs,B1,Cnf1-Cnf2), - xs_eq_ys(HiXs,HiYs,B2,Cnf2-Cnf3), - xs_gt_ys(LoXs,LoYs,B3,Cnf3-Cnf4), - and(B2,B3,Tmp, Cnf4-Cnf5), - or(B1,Tmp,B,Cnf5-Cnf6). - -% Z == X > Y (equivalently Z == X * -Y) -gt(X,Y,Z,[[Z,-X,Y],[-Z,X],[-Z,-Y]|Cnf]-Cnf). - -% Z == (X == Y) -eq(X,Y,Z, [[-Z,-X,Y],[-Z,X,-Y], - [Z,X,Y],[Z,-X,-Y] | Cnf]-Cnf). - -% Z == X or Y -or(X,Y,Z, [[Z,-X],[Z,-Y],[-Z,X,Y] | Cnf]-Cnf). - -% Z == X and Y -and(X,Y,Z, [[Z,X,Y],[-Z,X],[-Z,Y] | Cnf]-Cnf). - -% -split(Xs,As,Bs) :- - length(Xs,N), M is N // 2, - length(As,M), append(As,Bs,Xs). diff --git a/pl/absf.yap b/pl/absf.yap index f9c809da6..e35ffb55b 100755 --- a/pl/absf.yap +++ b/pl/absf.yap @@ -345,6 +345,7 @@ prolog_file_name(File, PrologFileName) :- path(Path) :- findall(X,'$in_path'(X),Path). + '$in_path'(X) :- recorded('$path',Path,_), atom_codes(Path,S), diff --git a/pl/dbload.yap b/pl/dbload.yap index 75cd96d99..7cceb32f4 100644 --- a/pl/dbload.yap +++ b/pl/dbload.yap @@ -91,7 +91,7 @@ check_dbload_stream(R, M0) :- ). dbload_count(T0, M0) :- - gemodule(T0,M0,T,M), + '$yap_strip_module'(M0:T0,M,T), functor(T,Na,Arity), % dbload_check_term(T), ( @@ -105,10 +105,6 @@ dbload_count(T0, M0) :- nb_setval(NaAr,1) ). -get_module(M1:T0,_,T,M) :- !, - get_module(T0, M1, T , M). -get_module(T,M,T,M). - load_facts :- !, % yap_flag(exo_compilation, on), !. @@ -116,7 +112,7 @@ load_facts :- load_facts :- retract(dbloading(Na,Arity,M,T,NaAr,_)), nb_getval(NaAr,Size), - dbload_get_space(T, M, Size, Handle), + prolog:'$dbload_get_space'(T, M, Size, Handle), assertz(dbloading(Na,Arity,M,T,NaAr,Handle)), nb_setval(NaAr,0), fail. @@ -137,13 +133,13 @@ dbload_add_facts(R, M) :- ). dbload_add_fact(T0, M0) :- - get_module(T0,M0,T,M), + '$yap_strip_module'(M0:T0,M,T), functor(T,Na,Arity), dbloading(Na,Arity,M,_,NaAr,Handle), nb_getval(NaAr,I0), I is I0+1, nb_setval(NaAr,I), - dbassert(T,Handle,I0). + prolog:'$dbassert'(T,Handle,I0). load_exofacts :- retract(dbloading(Na,Arity,M,T,NaAr,_)), @@ -174,7 +170,7 @@ protected_exodb_add_fact(R, M) :- ). exodb_add_fact(T0, M0) :- - get_module(T0,M0,T,M), + '$yap_strip_module'(T0,M0,T,M), functor(T,Na,Arity), dbloading(Na,Arity,M,_,NaAr,Handle), nb_getval(NaAr,I0), diff --git a/pl/debug.yap b/pl/debug.yap index 1f3deecce..cf5992193 100644 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -1,4 +1,3 @@ - /**********************************************************************a*** * * * YAP Prolog * @@ -15,11 +14,9 @@ * comments: YAP debugger * * * *************************************************************************/ - - -:- system_module( '$_debug', [], ['$trace_query'/4, - '$init_debugger'/0, - '$skipeol'/1]). +:- system_module('$_debug', + [], + ['$trace_query'/4, '$init_debugger'/0, '$skipeol'/1]). @@ -299,28 +296,10 @@ be lost. * @param _Mod_:_Goal_ is the goal to be examined. * @return `call(Goal)` */ -'$trace'(Mod:G) :- - '$creep_is_off'(Mod:G,_GN0), - !, - '$execute_nonstop'(G,Mod). +%%! The first case matches system_predicates or zip '$trace'(Mod:G) :- '$$save_by'(CP), - '$trace_query'(G, Mod, CP, G, EG), - gated_call( - '$debugger_io', - EG, - E, - '$continue_debugging'(E) - ). - - -'$continue_debugging'(exit) :- !, '$creep'. -'$continue_debugging'(answer) :- !, '$creep'. -'$continue_debugging'(fail) :- !, '$creep'. -'$continue_debugging'(_). - - - + '$trace_query'(G, Mod, CP, _G). '$trace'(Mod:G, A1) :- @@ -412,95 +391,133 @@ be lost. '$trace_meta_call'( G, M, CP ) :- - '$trace_query'(G, M, CP, G, EG ), - call(EG). + '$trace_query'(G, M, CP, _G ). %% @pred '$trace_query'( +G, +M, +CP, +Expanded) % % debug a complex query % -'$trace_query'(V, M, _CP, _, call(M:V)) :- - var(V), !. -'$trace_query'(!, _, CP, _, '$$cut_by'(CP)) :- - !. -'$trace_query'('$cut_by'(M), _, _, _, '$$cut_by'(M)) :- - !. -'$trace_query'('$$cut_by'(M), _, _, _, '$$cut_by'(M)) :- - !. -'$trace_query'(true, _, _, _, true) :- !. -'$trace_query'(fail, _, _, _, '$trace'(fail)) :- !. -'$trace_query'(M:G, _, CP,S, Expanded) :- +'$trace_query'(V, M, _CP, _) :- + var(V), !, call(M:V). +'$trace_query'(!, _, CP, _) :- + !, '$$cut_by'(CP). +'$trace_query'('$cut_by'(M), _, _, _) :- + !, '$$cut_by'(M). +'$trace_query'('$$cut_by'(M), _, _, _) :- + !, '$$cut_by'(M). +'$trace_query'(M:G, _, CP,S) :- !, '$yap_strip_module'(M:G, M0, G0), - '$trace_query'(G0, M0, CP,S, Expanded ). -'$trace_query'((A,B), M, CP, S, (EA,EB)) :- !, - '$trace_query'(A, M, CP, S, EA), - '$trace_query'(B, M, CP, S, EB). -'$trace_query'((A->B), M, CP, S, (EA->EB)) :- !, - '$trace_query'(A, M, CP, S, EA), - '$trace_query'(B, M, CP, S, EB). -'$trace_query'((A;B), M, CP, S, (EA;EB)) :- !, - '$trace_query'(A, M, CP, S, EA), - '$trace_query'(B, M, CP, S, EB). -'$trace_query'((A|B), M, CP, S, (EA|EB)) :- !, - '$trace_query'(A, M, CP, S, EA), - '$trace_query'(B, M, CP, S, EB). -'$trace_query'((\+ A), M, CP, S, (\+ EA)) :- !, - '$trace_query'(A, M, CP, S, EA). -'$trace_query'(G, M, _CP, _, ( + '$trace_query'(G0, M0, CP,S ). +'$trace_query'((A,B), M, CP, S) :- !, + '$trace_query'(A, M, CP, S), + '$trace_query'(B, M, CP, S). +'$trace_query'((A->B), M, CP, S) :- !, + '$trace_query'(A, M, CP, S) -> + '$trace_query'(B, M, CP, S). +'$trace_query'((A;B), M, CP, S) :- !, + '$trace_query'(A, M, CP, S); + '$trace_query'(B, M, CP, S). +'$trace_query'((A|B), M, CP, S) :- !, + '$trace_query'(A, M, CP, S); + '$trace_query'(B, M, CP, S). +'$trace_query'((\+ A), M, CP, S) :- !, + '$trace_query'(A, M, CP, S). +'$trace_query'(G, M,_CP,S) :- + '$is_metapredicate'(G, prolog), + !, + '$debugger_expand_meta_call'(M:G, [], G1), + strip_module(M:G1, MF, NG), + % spy a literal + '$id_goal'(L), + catch( + '$trace_goal'(NG, MF, L, S), + E, + '$TraceError'(E, G, M, L, S) + ). +'$trace_query'(G, M, _CP, H) :- % spy a literal '$id_goal'(L), catch( '$trace_goal'(G, M, L, H), E, '$TraceError'(E, G, M, L, H) - ))). + ). + %% @pred $trace_goal( +Goal, +Module, +CallId, +CallInfo) %% -%% Actuallb sy debugs a +%% Actually debugs a %% goal! -'$trace_goal'(G, M, GoalNumber, _H) :- - '$creep_is_off'(M:G,GoalNumber), - !, - '$execute_nonstop'(G,M). -'$trace_goal'(G, M, _GoalNumber, _H) :- - '$undefined'(G, M), - !, - '$undefp'([M|G], _ ). -% meta system -'$trace_goal'(G, M, GoalNumber, H) :- - '$is_metapredicate'(G, prolog), - !, - '$debugger_expand_meta_call'(M:G, [], G1), - strip_module(G1, MF, NG), - gated_call( - '$enter_trace'(GoalNumber, G, M, H), - '$execute_nonstop'(NG,MF), - Port, - '$trace_port'(Port, GoalNumber, G, M, true, H) - ). -% system_ -'$trace_goal'(G, M, GoalNumber, H) :- +'$trace_goal'(G,M, _GoalNumber, _H) :- ( - '$is_opaque_predicate'(G, M) + '$is_private'(G, M) ; - 'strip_module'(M:G, prolog, _NG) + current_prolog_flag(debug,false) ), !, + gated_call( + '$start_user_code', + % try creeping + '$execute_nonstop'(G,M), + Port, + '$reenter_debugger'(Port) + ). +'$trace_goal'(G,M, GoalNumber, H) :- + '$enter_trace'(GoalNumber, G, M, H), + '$creep_is_off'(M:G, GoalNumber), + !, + gated_call( + '$start_user_code', + % try creeping + '$execute_nonstop'(G,M), + Port, + '$trace_port_'( Port, GoalNumber, G, M, H) + ). +'$trace_goal'(G,M, GoalNumber, H) :- + '$is_source'(G,M), + !, + '$current_choice_point'(CP), + %clause generator: it controls fail, redo gated_call( - '$enter_trace'(GoalNumber, G, M, H), - '$execute_nonstop'(G,M), + true, + clause(M:G, B), + Port0, + '$trace_port'(pred,Port0, GoalNumber, G, M, H) + ), + gated_call( + true,% source mode + '$trace'(B,M,CP,H), Port, - '$trace_port'(Port, GoalNumber, G, M, true, H) + ( + '$trace_port'(clause,Port, GoalNumber, G, M, H) + ) + ). +'$trace_goal'(G,M, GoalNumber, H) :- + !, + '$current_choice_point'(CP), + %clause generator: it controls fail, redo + gated_call( + true, + '$static_clause'(G,M,_,Ref), + Port0, + '$trace_port'(pred,Port0, GoalNumber, G, M, H) + ), + gated_call( + '$start_user_code', + % source mode + '$creep_clause'(G,M,Ref,CP), + Port, + '$trace_port'(clause, Port, GoalNumber, G, M, H) ). '$trace_goal'(G, M, GoalNumber, H) :- - gated_call( - '$enter_trace'(GoalNumber, G, M, H), - '$debug'( GoalNumber, G, M, H), - Port, - '$trace_port'(Port, GoalNumber, G, M, true, H) - ). + '$undefined'(G,M), + !, + '$undefp'([M|G], G1), + strip_module(G1, MF, NG), + '$trace_goal'(NG,MF, GoalNumber, H). + +% system_ /** @@ -514,22 +531,12 @@ be lost. * */ '$enter_trace'(L, G, Module, Info) :- - /* get goal no. */ - ( var(L) -> - '__NB_getval__'('$spy_gn',L,fail), - /* bump it */ - L1 is L+1, - /* and save it globaly */ - '__NB_setval__'('$spy_gn',L1) - ; - true - ), + '$id_goal'(L), /* get goal no. */ /* get goal list */ '__NB_getval__'('$spy_glist',History,History=[]), H = [Info|History], Info = info(L,Module,G,_Retry,_Det,_HasFoundAnswers), - b_setval('$spy_glist',H), - /* and update it */ + b_setval('$spy_glist',H), /* and update it */ '$port'(call,G,Module,L,deterministic, Info). '$id_goal'(L) :- @@ -542,33 +549,6 @@ be lost. '__NB_setval__'('$spy_gn',L1). '$id_goal'(_L). -/** - * @pred '$enter_trace'(+L, 0:G, +Module, +Info) - * - * call goal: setup the diferrent cases - * - zip, just run through - * - source, call an interpreter - * - compiled code: try black magic. - * - * @parameter _Module_:_G_ - * @parameter _GoalNumber_ identifies the active goal - * @parameter _Info_ describes the goal - * - */ - -'$debug'(_, G, M, _H) :- - '__NB_getval__'('$debug_status',state(zip,_Border,Spy,_Trace), fail), - ( Spy == stop -> \+ '$pred_being_spied'(G,M) ; true ), - !, - '$execute_nonstop'( G, M ). -'$debug'(GoalNumber, G, M, Info) :- - '$is_source'(G,M), - !, - '$trace_go'(GoalNumber, G, M, Info). -'$debug'(GoalNumber, G, M, Info) :- - '$creep_step'(GoalNumber, G, M, Info). - - /** * @pred '$trace_go'(+L, 0:G, +Module, +Info) * @@ -582,63 +562,44 @@ be lost. * @parameter _Info_ describes the goal * */ -'$trace_go'(GoalNumber, G, M, Info) :- - X=marker(_,M,G), - '$$save_by'(CP), - clause(M:G, Cl, _), - '$retry_clause'(GoalNumber, G, M, Info, X), - '$trace_query'(Cl, M, CP, Cl, ECl), - '$execute0'(ECl,M). +'$trace_port'(_, _, _GoalNumber, _G, _Module, _Info) :- + '$stop_creeping'(_), + fail. -'$creep_step'(GoalNumber, G, M, Info) :- - X=marker(_,M,G), - '$$save_by'(CP), - '$static_clause'(G,M,_,Ref), - '$retry_clause'(GoalNumber, G, M, Info, X), - '$creep', - '$execute_clause'(G,M,Ref,CP). - -'$retry_clause'(_GoalNumber, _G, _M, _Info, MarkerV) :- - arg(1, MarkerV, V), - var(V), +'$trace_port'(pred, fail, GoalNumber, G, Module, Info) :- + !, + '$trace_port_'(fail, GoalNumber, G, Module, Info). +'$trace_port'(pred, call, GoalNumber, G, Module, Info) :- + !, + '$trace_port_'(call, GoalNumber, G, Module, Info). +'$trace_port'(pred, redo, GoalNumber, G, Module, Info) :- !, - nb_setarg(1,MarkerV, visited). -'$retry_clause'(GoalNumber, G, Module, Info, _X) :- '$trace_port_'(redo, GoalNumber, G, Module, Info). +'$trace_port'(pred, _Port, _GoalNumber, _G, _Module, _Info). + -'$trace_port'(Port, GoalNumber, G, Module, _CalledFromDebugger, Info) :- - '$stop_creeping'(_) , - current_prolog_flag(debug, true), - '__NB_getval__'('$debug_status',state(Skip,Border,_,Trace), fail), - ( Skip == creep -> true; - '$stop_creeping'(_) , - '$id_goal'(GoalNumber), - GoalNumber =< Border), +'$trace_port'(clause, call, _GoalNumber, _G, _Module, _Info). +'$trace_port'(clause, fail, _GoalNumber, _G, _Module, _Info) :- + fail. +'$trace_port'(clause, Port, GoalNumber, G, Module, Info) :- !, - '__NB_setval__'('$debug_status', state(creep, 0, stop,Trace)), '$trace_port_'(Port, GoalNumber, G, Module, Info). -'$trace_port'(_Port, _GoalNumber, _G, _Module, _CalledFromDebugger, _Info). '$trace_port_'(call, GoalNumber, G, Module, Info) :- '$port'(call,G,Module,GoalNumber,deterministic, Info). '$trace_port_'(exit, GoalNumber, G, Module, Info) :- - nb_setarg(6, Info, true), '$port'(exit,G,Module,GoalNumber,deterministic, Info). '$trace_port_'(answer, GoalNumber, G, Module, Info) :- '$port'(exit,G,Module,GoalNumber,nondeterministic, Info). '$trace_port_'(redo, GoalNumber, G, Module, Info) :- - '$stop_creeping'(_ ), '$port'(redo,G,Module,GoalNumber,nondeterministic, Info). /* inform user_error */ '$trace_port_'(fail, GoalNumber, G, Module, Info) :- - '$stop_creeping'(_ ), '$port'(fail,G,Module,GoalNumber,deterministic, Info). /* inform user_error */ '$trace_port_'(! ,_GoalNumber,_G,_Module,_Imfo) :- /* inform user_error */ !. '$trace_port_'(exception(E), GoalNumber, G, Module, Info) :- - '$stop_creeping'(_ ), '$TraceError'(E, GoalNumber, G, Module, Info). '$trace_port_'(external_exception(E), GoalNumber, G, Module, Info) :- - '$stop_creeping'(_ ), '$TraceError'(E, GoalNumber, G, Module, Info). @@ -705,7 +666,7 @@ be lost. '$port'(_P, _G, _M,GoalNumber,_Determinic, _Info ) :- %%> leap '__NB_getval__'('$debug_status',state(leap,Border,_,_), fail), - GoalNumber > Border, + GoalNumber < Border, !. '$port'(P,G,Module,L,Deterministic, Info) :- % at this point we are done with leap or skip @@ -714,7 +675,7 @@ be lost. ( '$unleashed'(P) -> '$action'('\n',P,L,G,Module,Info), - put_code(debugger_output, 10) + nl(debugger_output) ; write(debugger_output,' ? '), '$clear_input'(debugger_input), @@ -762,14 +723,10 @@ be lost. '__NB_getval__'('$trace',Trace,fail), '__NB_setval__'('$debug_status', state(creep, 0, stop, Trace)). '$action'(!,_,_,_,_,_) :- !, % ! 'g execute - read(debugger_input, G), + read(debugger_input, G), % don't allow yourself to be caught by creep. - current_prolog_flag(debug, OldDeb), - set_prolog_flag(debug, false), ignore( G ), - % at this point we are done with leap or skip - set_prolog_flag(debug, OldDeb), -% skip( debugger_input, 10), % ' + skip( debugger_input, 10), % ' fail. '$action'(<,_,_,_,_,_) :- !, % <'Depth '$new_deb_depth', @@ -788,7 +745,6 @@ be lost. fail. '$action'(a,_,_,_,_,_) :- !, % 'a abort skip( debugger_input, 10), - '$stop_creeping'(_), nodebug, abort. '$action'(b,_,_,_,_,_) :- !, % 'b break diff --git a/pl/signals.yap b/pl/signals.yap index f9b9603be..215697084 100644 --- a/pl/signals.yap +++ b/pl/signals.yap @@ -181,8 +181,8 @@ '$trace'(Mod:G). '$no_creep_call'('$execute_clause'(G,Mod,Ref,CP),_) :- !, - '$enable_debugging', - '$execute_clause'(G,Mod,Ref,CP). + '$enable_debugging', + '$execute_clause'(G,Mod,Ref,CP). '$no_creep_call'('$execute_nonstop'(G, M),_) :- !, '$enable_debugging', '$execute_nonstop'(G, M). @@ -295,18 +295,18 @@ read_sig. % % % make thes predicates non-traceable. % -:- '$set_no_trace'(current_choicepoint(_DCP), yap_hacks). -:- '$set_no_trace'('$current_choice_point'(_DCP), _). -:- '$set_no_trace'('$$cut_by'(_DCP), prolog). -:- '$set_no_trace'(true, yap_hacks). -:- '$set_no_trace'(true, prolog). -:- '$set_no_trace'('$call'(_,_,_,_), prolog). -:- '$set_no_trace'('$execute_nonstop'(_,_), prolog). -:- '$set_no_trace'('$execute_clause'(_,_,_,_), prolog). -:- '$set_no_trace'('$restore_regs'(_,_), prolog). -:- '$set_no_trace'('$undefp'(_,_), prolog). -:- '$set_no_trace'('$Error'(_), prolog). -:- '$set_no_trace'('$LoopError'(_,_), prolog). -:- '$set_no_trace'('$TraceError'(_,_,_,_,_), prolog). +:- '$set_private'(current_choicepoint(_DCP), yap_hacks). +:- '$set_private'('$current_choice_point'(_DCP), _). +:- '$set_private'('$$cut_by'(_DCP), prolog). +:- '$set_private'(true, yap_hacks). +:- '$set_private'(true, prolog). +:- '$set_private'('$call'(_,_,_,_), prolog). +:- '$set_private'('$execute_nonstop'(_,_), prolog). +:- '$set_private'('$execute_clause'(_,_,_,_), prolog). +:- '$set_private'('$restore_regs'(_,_), prolog). +:- '$set_private'('$undefp'(_,_), prolog). +:- '$set_private'('$Error'(_), prolog). +:- '$set_private'('$LoopError'(_,_), prolog). +:- '$set_private'('$TraceError'(_,_,_,_,_), prolog). %%! @} diff --git a/pl/spy.yap b/pl/spy.yap index cb3149008..a6b734db5 100644 --- a/pl/spy.yap +++ b/pl/spy.yap @@ -60,18 +60,7 @@ mode and the existing spy-points, when the debugger is on. :- op(900,fx,[spy,nospy]). -'$init_debugger' :- - '__NB_getval__'('$trace', _, fail), !. -'$init_debugger' :- - '$debugger_input', - '__NB_setval__'('$trace',off), - '__NB_setval__'('$if_skip_mode',no_skip), - '__NB_setval__'('$spy_glist',[]), - '__NB_setval__'('$spy_gn',1), - '__NB_setval__'('$debug_state', state(zip,0,stop,off)). - - - % First part : setting and reseting spy points +% First part : setting and reseting spy points % $suspy does most of the work '$suspy'(V,S,M) :- var(V) , !, @@ -211,22 +200,20 @@ nospyall. debug :- '$init_debugger', ( '__NB_getval__'('$spy_gn',_, fail) -> true ; '__NB_setval__'('$spy_gn',1) ), - '$start_debugging'(on), + set_prolog_flag(debug,true), + '$start_user_code', print_message(informational,debug(debug)). -'$start_debugging'(Mode) :- - (Mode == on -> - set_prolog_flag(debug, true) - ; - set_prolog_flag(debug, false) - ), - '__NB_getval__'('$trace',Trace, fail), - ( Trace == on -> Creep = crep; Creep = zip ), - '__NB_setval__'('$debug_state',state(Creep,0,stop,Trace) ). +'$start_user_code' :- + yap_flag(debug, Can), + '__NB_setval__'(debug, Can), + '__NB_getval__'('$trace',Trace, fail), + ( Trace == on -> Creep = creep; Creep = zip ), + '__NB_setval__'('$debug_state',state(Creep,0,stop,Trace) ). nodebug :- - '$init_debugger', set_prolog_flag(debug, false), + '$init_debugger', '__NB_setval__'('$trace',off), print_message(informational,debug(off)). @@ -243,13 +230,10 @@ Switches on the debugger and enters tracing mode. */ trace :- - '$init_debugger', - fail. -trace :- - '__NB_setval__'('$trace',on), - '$start_debugging'(on), print_message(informational,debug(trace)), - '$creep'. + set_prolog_flag(debug,true), + '__NB_setval__'('$trace',on), + '$init_debugger'. /** @pred notrace @@ -393,51 +377,154 @@ notrace(G) :- fail ). -'$disable_debugging_on_port'(retry) :- +'$creep_at_port'(retry) :- + '__NB_getval__'(debug, true, fail), + '__NB_getval__'('$trace',Trace,fail), + Trace = on, !, '$enable_debugging'. -'$disable_debugging_on_port'(_Port) :- - '$disable_debugging'. - - - -% enable creeping -'$enable_debugging':- - current_prolog_flag(debug, false), !. -'$enable_debugging' :- +'$creep_at_port'(fail) :- + '__NB_getval__'(debug, true, fail), '__NB_getval__'('$trace',Trace,fail), - nb_setval('$debug_status', state(creep, 0, stop,Trace)), - Trace = on, !, - '$creep'. -'$enable_debugging'. + Trace = on, + !, + '$enable_debugging'. -'$trace_on' :- - '__NB_getval__'('$debug_status', state(_Creep, GN, Spy,_), fail), - '__NB_setval__'('$trace',on), - nb_setval('$debug_status', state(creep, GN, Spy, on)). +'$init_debugger' :- + '$debugger_io', + '$init_debugger_trace', + '__NB_setval__'('$if_skip_mode',no_skip), + '__NB_setval__'('$spy_glist',[]), + '__NB_setval__'('$spy_gn',1). + +'$init_debugger_trace' :- + '__NB_getval__'('$trace',on,fail), + !, + nb_setval('$debug_status', state(creep, 0, stop, on)). +'$init_debugger_trace' :- + '__NB_setval__'('$trace',off), + nb_setval('$debug_status', state(zip, 0, stop, off)). -'$trace_off' :- - '__NB_getval__'('$debug_status', state(_Creep, GN, Spy), fail), - '__NB_setval__'('$trace',off), - nb_setval('$debug_status', state(zip, GN, Spy,off)). +%% @pred $enter_debugging(G,Mod,CP,G0,NG) +%% +%% Internal predicate called by top-level; +%% enable creeping on a goal by just switching execution to debugger. +%% +'$enter_debugging'(G,Mod,_CP,_G0,_NG) :- + '$creepcalls'(G,Mod), + !. +'$enter_debugging'(G,_Mod,_CP,_G0,G). -'$creep_is_off'(_,_) :- - current_prolog_flag(debug, false), !. -'$creep_is_off'(Module:G, GN0) :- - '__NB_getval__'('$debug_status',state(zip, GN, Spy,_), fail), - ( - +'$enter_debugging'(G,Mod,GN) :- + current_prolog_flag( debug, Deb ), + '__NB_set_value__'( debug, Deb ), + ( Deb = false + -> + true + ; + '$creep_is_on_at_entry'(G,Mod,GN) + -> + '$creep' + ; + true + ). + +'$exit_debugger'(Mod:G, GN) :- + current_prolog_flag( debug, Deb ), + '__NB_set_value__'( debug, Deb ), + ( Deb = false + -> + true + ; + '$creep_is_on_at_entry'(G,Mod,GN) + -> + '$creep' + ; + true + ). + +%% we're coming back from external code to a debugger call. +%% +'$reenter_debugger'(fail) :- + '$re_enter_creep_mode'. +'$reenter_debugger'(_) :- + '__NB_setval__'(debug, false). + +% what to do when you exit the debugger. +'$continue_debugging'(exit) :- + !, + '$re_enter_creep_mode'. +'$continue_debugging'(answer) :- + !, + '$re_enter_creep_mode'. +'$continue_debugging'(fail) :- + !, + '$re_enter_creep_mode', + fail. +'$continue_debugging'(redo) :- + !, + '$re_enter_creep_mode', + fail. +'$continue_debugging'(_). + +'$enable_debugging' :- + '$re_enter_creep_mode'. + + +%% @pred $re_enter_creep_mode1 +%% +%% Internal predicate called when exiting through a port; +%% enable creeping on the next goal. +%% +'$re_enter_creep_mode' :- + current_prolog_flag( debug, Deb ), + '__NB_setval__'( debug, Deb ). + + +'$creep_is_off'(Module:G, GoalNo) :- + ( + current_prolog_flag( debug, false ) + -> true + ; + '$system_predicate'(G,Module) + -> true + ; + '$is_private'(G,Module) + -> true + ; + '__NB_getval__'('$debug_status',state(zip, GN, Spy,_), fail) + -> + true + ; '$pred_being_spied'(G,Module) -> Spy == ignore ; - var(GN0) + var(GN) -> - true + false ; - GN > GN0 - ). + GN > GoalNo + ). +'$creep_is_on_at_entry'(G,M,_GoalNo) :- + \+ '$system_predicate'(G,M), + '__NB_getval__'('$debug_status',state(Step, _GN, Spy,_), fail), + ( + Step \= zip + ; + Spy == stop, + '$pred_being_spied'(G,M) + ). + +'$trace_on' :- + '__NB_getval__'('$debug_status', state(_Creep, GN, Spy,Trace), fail), + nb_setval('$trace',on), + nb_setval('$debug_status', state(creep, GN, Spy, Trace)). + +'$trace_off' :- +'__NB_getval__'('$debug_status', state(_Creep, GN, Spy, Trace),fail), +nb_setval('$debug_status', state(zip, GN, Spy,Trace)). /* diff --git a/pl/top.yap b/pl/top.yap index 0367deaea..117b4cd2a 100644 --- a/pl/top.yap +++ b/pl/top.yap @@ -13,25 +13,23 @@ * @{ * */ - - :- '$system_meta_predicates'([ - gated_call(0,0,?,0), - catch(0,?,0), - log_event(+,:)]). +:- '$system_meta_predicates'([gated_call(0, 0, ?, 0), catch(0, ?, 0), log_event(+, :)]). % @pred live % % start a Prolog engine. live :- repeat, - yap_flag(verbose,normal), - current_source_module(Module,Module), - ( Module==user -> - true % '$compile_mode'(_,0) - ; - format(user_error,'[~w]~n', [Module]) + yap_flag(verbose, normal), + current_source_module(Module, Module), + ( Module==user + -> true % '$compile_mode'(_,0) + ; format(user_error, '[~w]~n', [Module]) ), - '$system_catch'('$enter_top_level',Module,Error,'$Error'(Error)). + '$system_catch'('$enter_top_level', + Module, + Error, + '$Error'(Error)). % Start file for yap @@ -46,64 +44,65 @@ live :- /* main execution loop */ '$read_toplevel'(Goal, Bindings, Pos) :- - '$prompt', - catch(read_term(user_input, - Goal, - [variable_names(Bindings), syntax_errors(dec10), term_position(Pos)]), - E, '$handle_toplevel_error'( E) ). + '$prompt', + catch(read_term(user_input, + Goal, + + [ variable_names(Bindings), + syntax_errors(dec10), + term_position(Pos) + ]), + E, + '$handle_toplevel_error'(E)). -'$handle_toplevel_error'( syntax_error(_)) :- - !, - fail. -'$handle_toplevel_error'( error(io_error(read,user_input),_)) :- - !. +'$handle_toplevel_error'(syntax_error(_)) :- + !, + fail. +'$handle_toplevel_error'(error(io_error(read, user_input), _)) :- + !. '$handle_toplevel_error'(_, E) :- - throw(E). + throw(E). % reset alarms when entering top-level. '$enter_top_level' :- - '$alarm'(0, 0, _, _), - fail. + '$alarm'(0, 0, _, _), + fail. '$enter_top_level' :- - '$clean_up_dead_clauses', - fail. + '$clean_up_dead_clauses', + fail. '$enter_top_level' :- - get_value('$top_level_goal',GA), GA \= [], !, - set_value('$top_level_goal',[]), - '$run_atom_goal'(GA), - fail. + get_value('$top_level_goal', GA), + GA\=[], + !, + set_value('$top_level_goal', []), + '$run_atom_goal'(GA), + fail. '$enter_top_level' :- flush_output, - '$run_toplevel_hooks', - prompt1(' ?- '), - '$read_toplevel'(Command,Varnames,Pos), - nb_setval('$spy_gn',1), - % stop at spy-points if debugging is on. - nb_setval('$debug_run',off), - nb_setval('$debug_jump',off), - '__NB_setval__'('$trace',off), - nb_setval('$debug_status', state(zip, 0, stop,off)), - '$command'(Command,Varnames,Pos,top), - current_prolog_flag(break_level, BreakLevel), - ( - BreakLevel \= 0 - -> - true - ; - '$pred_exists'(halt(_), user) - -> - halt(0) - ; - '$halt'(0) - ). + '$run_toplevel_hooks', + prompt1(' ?- '), + '$read_toplevel'(Command, Varnames, Pos), + '$init_debugger', + '$command'(Command, Varnames, Pos, top), + current_prolog_flag(break_level, BreakLevel), + ( BreakLevel\=0 + -> true + ; '$pred_exists'(halt(_), user) + -> halt(0) + ; '$halt'(0) + ). + '$erase_sets' :- - eraseall('$'), - eraseall('$$set'), - eraseall('$$one'), - eraseall('$reconsulted'), fail. -'$erase_sets' :- \+ recorded('$path',_,_), recorda('$path',[],_). + eraseall($), + eraseall('$$set'), + eraseall('$$one'), + eraseall('$reconsulted'), + fail. +'$erase_sets' :- + \+ recorded('$path', _, _), + recorda('$path', [], _). '$erase_sets'. '$start_corouts' :- @@ -176,7 +175,7 @@ live :- '$expand_term'(T,top,O). '$expand_term'(T,Con,O) :- - catch( '$expand_term0'(T,Con,O), _,( '$disable_debugging', fail) ), + catch( '$expand_term0'(T,Con,O), _,( '$reenter_debugger'(exit), fail) ), !. '$expand_term0'(T,consult,O) :- @@ -389,7 +388,7 @@ live :- '$do_another'(C) :- ( C=:= ";" -> - skip(user_input,10), % + skip(user_input,10), % '$add_nl_outside_console', fail ; @@ -444,10 +443,12 @@ write_query_answer( Bindings ) :- '$purge_dontcares'([],[]). '$purge_dontcares'([Name=_|Vs],NVs) :- - atom_codes(Name, [C|_]), C is "_", !, - '$purge_dontcares'(Vs,NVs). + atom_codes(Name, [C|_]), + C is "_", + !, + '$purge_dontcares'(Vs,NVs). '$purge_dontcares'([V|Vs],[V|NVs]) :- - '$purge_dontcares'(Vs,NVs). + '$purge_dontcares'(Vs,NVs). '$prep_answer_var_by_var'([], L, L). @@ -576,21 +577,10 @@ write_query_answer( Bindings ) :- '$call'(G, CP, G, M). '$user_call'(G, CP, G0, M) :- - gated_call( - '$enable_debugging', - '$call'(G, CP, G0, M), - Port, - '$disable_debugging_on_port'(Port) - ). - + '$trace_query'(G, M, CP, G0). '$user_call'(G, M) :- - gated_call( - '$enable_debugging', - M:G, - Port, - '$disable_debugging_on_port'(Port) - ). + '$trace'(M:G). '$cut_by'(CP) :- '$$cut_by'(CP). @@ -694,7 +684,7 @@ write_query_answer( Bindings ) :- % ( % '$is_metapredicate'(G,CurMod) % -> -% '$disable_debugging', +% '$reenter_debugger'(exit)', % ( '$expand_meta_call'(CurMod:G, [], NG) -> true ; true ), % '$enable_debugging' % ; @@ -773,8 +763,6 @@ Command = (H --> B) -> '$boot_clause'( Command, _ ) :- format(user_error, ' ~w failed.~n', [Command]). - - '$enter_command'(Stream, Mod, Status) :- prompt1(': '), prompt(_,' '), Options = [module(Mod), syntax_errors(dec10),variable_names(Vars), term_position(Pos)], diff --git a/pl/undefined.yap b/pl/undefined.yap index ff751dc69..193b3a613 100644 --- a/pl/undefined.yap +++ b/pl/undefined.yap @@ -133,7 +133,7 @@ undefined_query(G0, M0, Cut) :- % we found an import, and call again % we have user code in the unknown_predicate % we fail, output a message, and just generate an exception. -'$undefp'([M0|G0],ok) :- +'$undefp'([M0|G0],_) :- '$search_undef'(M0:G0, M:G), '$trace'(M:G).