make number_chars and atom_chars SWI/ISO compatible by default.
This commit is contained in:
parent
61eb299ba5
commit
f4e734da34
2
C/init.c
2
C/init.c
@ -967,7 +967,7 @@ InitFlags(void)
|
||||
yap_flags[YAP_MIN_INTEGER_FLAG] = (Int)(((CELL)1 << (sizeof(Int)*8-1)));
|
||||
yap_flags[CHAR_CONVERSION_FLAG] = 1;
|
||||
yap_flags[YAP_DOUBLE_QUOTES_FLAG] = 1;
|
||||
yap_flags[YAP_TO_CHARS_FLAG] = QUINTUS_TO_CHARS;
|
||||
yap_flags[YAP_TO_CHARS_FLAG] = ISO_TO_CHARS;
|
||||
yap_flags[LANGUAGE_MODE_FLAG] = 0;
|
||||
yap_flags[STRICT_ISO_FLAG] = FALSE;
|
||||
yap_flags[SOURCE_MODE_FLAG] = FALSE;
|
||||
|
34
C/stdpreds.c
34
C/stdpreds.c
@ -1905,6 +1905,20 @@ gen_syntax_error(Atom InpAtom, char *s)
|
||||
return(Yap_MkApplTerm(FunctorSyntaxError,7,ts));
|
||||
}
|
||||
|
||||
static Term
|
||||
gen_syntax_type_error(void)
|
||||
{
|
||||
Term ts[7], ti[2];
|
||||
ti[0] = ARG1;
|
||||
ti[1] = ARG2;
|
||||
ts[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("number_chars"),2),2,ti);
|
||||
ts[1] = ts[4] = ts[5] = MkIntTerm(0);
|
||||
ts[2] = MkAtomTerm(AtomExpectedNumber);
|
||||
ts[3] = TermNil;
|
||||
ts[6] = ARG2;
|
||||
return(Yap_MkApplTerm(FunctorSyntaxError,7,ts));
|
||||
}
|
||||
|
||||
static Int
|
||||
p_number_chars(void)
|
||||
{
|
||||
@ -1969,15 +1983,15 @@ p_number_chars(void)
|
||||
register Int i;
|
||||
Head = HeadOfTerm(t);
|
||||
if (IsVarTerm(Head)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,Head,"number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
} else if (!IsIntTerm(Head)) {
|
||||
Yap_Error(REPRESENTATION_ERROR_CHARACTER_CODE,Head,"number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
i = IntOfTerm(Head);
|
||||
if (i < 0 || i > 255) {
|
||||
Yap_Error(REPRESENTATION_ERROR_CHARACTER_CODE,Head,"number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (s+1024 > (char *)AuxSp) {
|
||||
@ -1993,10 +2007,10 @@ p_number_chars(void)
|
||||
*s++ = i;
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,t,"number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
} else if (!IsPairTerm(t) && t != TermNil) {
|
||||
Yap_Error(TYPE_ERROR_LIST, t, "number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
@ -2008,15 +2022,15 @@ p_number_chars(void)
|
||||
|
||||
Head = HeadOfTerm(t);
|
||||
if (IsVarTerm(Head)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,Head,"number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
} else if (!IsAtomTerm(Head)) {
|
||||
Yap_Error(TYPE_ERROR_CHARACTER,Head,"number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
is = RepAtom(AtomOfTerm(Head))->StrOfAE;
|
||||
if (is[1] != '\0') {
|
||||
Yap_Error(TYPE_ERROR_CHARACTER,Head,"number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (s+1 == (char *)AuxSp) {
|
||||
@ -2031,10 +2045,10 @@ p_number_chars(void)
|
||||
*s++ = is[0];
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,t,"number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
} else if (!IsPairTerm(t) && t != TermNil) {
|
||||
Yap_Error(TYPE_ERROR_LIST, t, "number_chars/2");
|
||||
Yap_Error(SYNTAX_ERROR,gen_syntax_type_error(),"number_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user