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

This commit is contained in:
Vitor Santos Costa 2010-10-11 14:46:53 +01:00
commit fae29012a9
3 changed files with 19 additions and 8 deletions

View File

@ -567,6 +567,8 @@ a_cmp(Term t1, Term t2)
#ifdef USE_GMP #ifdef USE_GMP
} else if (IsBigIntTerm(t1)) { } else if (IsBigIntTerm(t1)) {
{ {
t2 = Yap_Eval(t2);
if (IsIntegerTerm(t2)) { if (IsIntegerTerm(t2)) {
return Yap_gmp_cmp_big_int(t1, IntegerOfTerm(t2)); return Yap_gmp_cmp_big_int(t1, IntegerOfTerm(t2));
} else if (IsFloatTerm(t2)) { } else if (IsFloatTerm(t2)) {

View File

@ -635,19 +635,23 @@ CleanLUIndex(LogUpdIndex *idx, int recurse)
static void static void
CleanSIndex(StaticIndex *idx, int recurse) CleanSIndex(StaticIndex *idx, int recurse)
{ {
idx->ClPred = PtoPredAdjust(idx->ClPred); beginning:
if (idx->SiblingIndex) { if (!(idx->ClFlags & SwitchTableMask)) {
idx->SiblingIndex = SIndexAdjust(idx->SiblingIndex); restore_opcodes(idx->ClCode, NULL);
if (recurse)
CleanSIndex(idx->SiblingIndex, TRUE);
} }
idx->ClPred = PtoPredAdjust(idx->ClPred);
if (idx->ChildIndex) { if (idx->ChildIndex) {
idx->ChildIndex = SIndexAdjust(idx->ChildIndex); idx->ChildIndex = SIndexAdjust(idx->ChildIndex);
if (recurse) if (recurse)
CleanSIndex(idx->ChildIndex, TRUE); CleanSIndex(idx->ChildIndex, TRUE);
} }
if (!(idx->ClFlags & SwitchTableMask)) { if (idx->SiblingIndex) {
restore_opcodes(idx->ClCode, NULL); idx->SiblingIndex = SIndexAdjust(idx->SiblingIndex);
/* use loop to avoid recursion with very complex indices */
if (recurse) {
idx = idx->SiblingIndex;
goto beginning;
}
} }
} }

View File

@ -652,7 +652,7 @@ c_db_odbc_row(void) {
if (!strcmp(AtomName(AtomOfTerm(type)),"integer")) if (!strcmp(AtomName(AtomOfTerm(type)),"integer"))
{ {
if (!Yap_unify(head, MkIntegerTerm(atoi(bind_value)))) if (!Yap_unify(head, MkIntegerTerm(atol(bind_value))))
continue; continue;
} }
else if (!strcmp(AtomName(AtomOfTerm(type)),"real")) else if (!strcmp(AtomName(AtomOfTerm(type)),"real"))
@ -697,6 +697,11 @@ c_db_odbc_number_of_fields_in_query(void) {
return FALSE; return FALSE;
if (!Yap_unify(arg_fields, MkIntegerTerm(number_cols))){ if (!Yap_unify(arg_fields, MkIntegerTerm(number_cols))){
if (!SQLCLOSECURSOR(hstmt,"db_number_of_fields_in_query"))
return FALSE;
if (!SQLFREESTMT(hstmt,SQL_CLOSE, "db_number_of_fields_in_query"))
return FALSE;
return FALSE; return FALSE;
} }