Merge ../yap-6.2
This commit is contained in:
commit
cee293fe3a
14
C/scanner.c
14
C/scanner.c
@ -602,8 +602,12 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted
|
|||||||
has_overflow = TRUE;
|
has_overflow = TRUE;
|
||||||
ch = Nxtch(inp_stream);
|
ch = Nxtch(inp_stream);
|
||||||
}
|
}
|
||||||
if (might_be_float && ch == '.') {
|
if (might_be_float && ( ch == '.' || ch == 'e' || ch == 'E')) {
|
||||||
{
|
if (yap_flags[STRICT_ISO_FLAG] && (ch == 'e' || ch == 'E')) {
|
||||||
|
Yap_ErrorMessage = "Float format not allowed in ISO mode";
|
||||||
|
return TermNil;
|
||||||
|
}
|
||||||
|
if (ch == '.') {
|
||||||
if (--max_size == 0) {
|
if (--max_size == 0) {
|
||||||
Yap_ErrorMessage = "Number Too Long";
|
Yap_ErrorMessage = "Number Too Long";
|
||||||
return TermNil;
|
return TermNil;
|
||||||
@ -628,10 +632,14 @@ get_num(int *chp, int *chbuffp, int inp_stream, int (*Nxtch) (int), int (*Quoted
|
|||||||
}
|
}
|
||||||
while (chtype(ch = Nxtch(inp_stream)) == NU);
|
while (chtype(ch = Nxtch(inp_stream)) == NU);
|
||||||
}
|
}
|
||||||
if (ch == 'e') {
|
if (ch == 'e' || ch == 'E') {
|
||||||
char *sp0 = sp;
|
char *sp0 = sp;
|
||||||
char cbuff = ch;
|
char cbuff = ch;
|
||||||
|
|
||||||
|
if (yap_flags[STRICT_ISO_FLAG] && ch == 'E') {
|
||||||
|
Yap_ErrorMessage = "Float format not allowed in ISO mode";
|
||||||
|
return TermNil;
|
||||||
|
}
|
||||||
if (--max_size == 0) {
|
if (--max_size == 0) {
|
||||||
Yap_ErrorMessage = "Number Too Long";
|
Yap_ErrorMessage = "Number Too Long";
|
||||||
return TermNil;
|
return TermNil;
|
||||||
|
34
C/write.c
34
C/write.c
@ -79,8 +79,8 @@ STATIC_PROTO(void wrputs, (char *, wrf));
|
|||||||
STATIC_PROTO(void wrputf, (Float, wrf));
|
STATIC_PROTO(void wrputf, (Float, wrf));
|
||||||
STATIC_PROTO(void wrputref, (CODEADDR, int, wrf));
|
STATIC_PROTO(void wrputref, (CODEADDR, int, wrf));
|
||||||
STATIC_PROTO(int legalAtom, (unsigned char *));
|
STATIC_PROTO(int legalAtom, (unsigned char *));
|
||||||
STATIC_PROTO(int LeftOpToProtect, (Atom, int));
|
/*STATIC_PROTO(int LeftOpToProtect, (Atom, int));
|
||||||
STATIC_PROTO(int RightOpToProtect, (Atom, int));
|
STATIC_PROTO(int RightOpToProtect, (Atom, int));*/
|
||||||
STATIC_PROTO(wtype AtomIsSymbols, (unsigned char *));
|
STATIC_PROTO(wtype AtomIsSymbols, (unsigned char *));
|
||||||
STATIC_PROTO(void putAtom, (Atom, int, wrf));
|
STATIC_PROTO(void putAtom, (Atom, int, wrf));
|
||||||
STATIC_PROTO(void writeTerm, (Term, int, int, int, struct write_globs *, struct rewind_term *));
|
STATIC_PROTO(void writeTerm, (Term, int, int, int, struct write_globs *, struct rewind_term *));
|
||||||
@ -213,6 +213,7 @@ wrputf(Float f, wrf writewch) /* writes a float */
|
|||||||
|
|
||||||
{
|
{
|
||||||
char s[256], *pt = s, ch;
|
char s[256], *pt = s, ch;
|
||||||
|
int found_dot = FALSE, found_exp = FALSE;
|
||||||
|
|
||||||
#if HAVE_ISNAN || defined(__WIN32)
|
#if HAVE_ISNAN || defined(__WIN32)
|
||||||
if (isnan(f)) {
|
if (isnan(f)) {
|
||||||
@ -247,14 +248,31 @@ wrputf(Float f, wrf writewch) /* writes a float */
|
|||||||
sprintf(s, RepAtom(AtomFloatFormat)->StrOfAE, f);
|
sprintf(s, RepAtom(AtomFloatFormat)->StrOfAE, f);
|
||||||
while (*pt == ' ')
|
while (*pt == ' ')
|
||||||
pt++;
|
pt++;
|
||||||
wrputs(pt, writewch);
|
if (*pt == '-') {
|
||||||
if (*pt == '-') pt++;
|
wrputc('-', writewch);
|
||||||
while ((ch = *pt) != '\0') {
|
|
||||||
if (ch < '0' || ch > '9')
|
|
||||||
return;
|
|
||||||
pt++;
|
pt++;
|
||||||
}
|
}
|
||||||
wrputs(".0", writewch);
|
while ((ch = *pt) != '\0') {
|
||||||
|
switch (ch) {
|
||||||
|
case '.':
|
||||||
|
found_dot = TRUE;
|
||||||
|
wrputc('.', writewch);
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
case 'E':
|
||||||
|
if (!found_dot) {
|
||||||
|
found_dot = TRUE;
|
||||||
|
wrputs(".0", writewch);
|
||||||
|
}
|
||||||
|
found_exp = TRUE;
|
||||||
|
default:
|
||||||
|
wrputc(ch, writewch);
|
||||||
|
}
|
||||||
|
pt++;
|
||||||
|
}
|
||||||
|
if (!found_dot) {
|
||||||
|
wrputs(".0", writewch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -237,6 +237,6 @@ all(T,G,S) :-
|
|||||||
|
|
||||||
'$partial_list_or_list'(V) :- var(V), !.
|
'$partial_list_or_list'(V) :- var(V), !.
|
||||||
'$partial_list_or_list'([]) :- !.
|
'$partial_list_or_list'([]) :- !.
|
||||||
'$partial_list_or_list'([_|B]) :- !
|
'$partial_list_or_list'([_|B]) :- !,
|
||||||
'$partial_list_or_list'(B).
|
'$partial_list_or_list'(B).
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user