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

This commit is contained in:
Vítor Santos Costa 2010-10-29 14:43:30 +01:00
commit d1a0cfe21a

View File

@ -1937,7 +1937,7 @@ p_number_chars(void)
return FALSE; return FALSE;
} }
} }
if (IsNonVarTerm(t1) && IsVarTerm(t)) { if (IsNonVarTerm(t1) && !Yap_IsGroundTerm(t)) {
Term NewT; Term NewT;
if (!IsNumTerm(t1)) { if (!IsNumTerm(t1)) {
Yap_Error(TYPE_ERROR_NUMBER, t1, "number_chars/2"); Yap_Error(TYPE_ERROR_NUMBER, t1, "number_chars/2");
@ -1973,7 +1973,7 @@ p_number_chars(void)
return(FALSE); return(FALSE);
} }
if (!IsPairTerm(t) && t != TermNil) { if (!IsPairTerm(t) && t != TermNil) {
Yap_Error(TYPE_ERROR_LIST, t, "number_chars/2"); Yap_Error(TYPE_ERROR_LIST, ARG2, "number_chars/2");
return(FALSE); return(FALSE);
} }
s = String; s = String;
@ -2031,6 +2031,8 @@ p_number_chars(void)
} else if (IsAtomTerm(Head) && !has_ints) { } else if (IsAtomTerm(Head) && !has_ints) {
has_atoms = TRUE; has_atoms = TRUE;
is = RepAtom(AtomOfTerm(Head))->StrOfAE; is = RepAtom(AtomOfTerm(Head))->StrOfAE;
if (is[0] == '\0')
goto next_in_loop;
if (is[1] != '\0') { if (is[1] != '\0') {
Yap_Error(TYPE_ERROR_CHARACTER,Head,"number_chars/2"); Yap_Error(TYPE_ERROR_CHARACTER,Head,"number_chars/2");
return FALSE; return FALSE;
@ -2057,12 +2059,13 @@ p_number_chars(void)
String = nString; String = nString;
} }
*s++ = ch; *s++ = ch;
next_in_loop:
t = TailOfTerm(t); t = TailOfTerm(t);
if (IsVarTerm(t)) { if (IsVarTerm(t)) {
Yap_Error(INSTANTIATION_ERROR,t,"number_chars/2"); Yap_Error(INSTANTIATION_ERROR,t,"number_chars/2");
return(FALSE); return(FALSE);
} else if (!IsPairTerm(t) && t != TermNil) { } else if (!IsPairTerm(t) && t != TermNil) {
Yap_Error(TYPE_ERROR_LIST,t,"number_chars/2"); Yap_Error(TYPE_ERROR_LIST,ARG2,"number_chars/2");
return(FALSE); return(FALSE);
} }
} }
@ -2131,7 +2134,7 @@ p_number_atom(void)
return(FALSE); return(FALSE);
} }
if (!IsAtomTerm(t)) { if (!IsAtomTerm(t)) {
Yap_Error(TYPE_ERROR_LIST, t, "number_atom/2"); Yap_Error(TYPE_ERROR_ATOM, t, "number_atom/2");
return(FALSE); return(FALSE);
} }
s = RepAtom(AtomOfTerm(t))->StrOfAE; s = RepAtom(AtomOfTerm(t))->StrOfAE;
@ -2159,7 +2162,7 @@ p_number_codes(void)
return FALSE; return FALSE;
} }
} }
if (IsNonVarTerm(t1) && IsVarTerm(t)) { if (IsNonVarTerm(t1) && !Yap_IsGroundTerm(t)) {
if (IsIntTerm(t1)) { if (IsIntTerm(t1)) {
sprintf(String, Int_FORMAT, IntOfTerm(t1)); sprintf(String, Int_FORMAT, IntOfTerm(t1));
} else if (IsFloatTerm(t1)) { } else if (IsFloatTerm(t1)) {
@ -2187,7 +2190,7 @@ p_number_codes(void)
Yap_Error(INSTANTIATION_ERROR, t, "number_codes/2"); Yap_Error(INSTANTIATION_ERROR, t, "number_codes/2");
} }
if (!IsPairTerm(t) && t != TermNil) { if (!IsPairTerm(t) && t != TermNil) {
Yap_Error(TYPE_ERROR_LIST, t, "number_codes/2"); Yap_Error(TYPE_ERROR_LIST, ARG2, "number_codes/2");
return(FALSE); return(FALSE);
} }
s = String; /* alloc temp space on Trail */ s = String; /* alloc temp space on Trail */
@ -2223,7 +2226,7 @@ p_number_codes(void)
Yap_Error(INSTANTIATION_ERROR,t,"number_codes/2"); Yap_Error(INSTANTIATION_ERROR,t,"number_codes/2");
return(FALSE); return(FALSE);
} else if (!IsPairTerm(t) && t != TermNil) { } else if (!IsPairTerm(t) && t != TermNil) {
Yap_Error(TYPE_ERROR_LIST, t, "number_codes/2"); Yap_Error(TYPE_ERROR_LIST, ARG2, "number_codes/2");
return(FALSE); return(FALSE);
} }
} }