more format fixes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1450 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2005-11-10 01:55:12 +00:00
parent 1088b6cf0f
commit edbebec3c8
2 changed files with 16 additions and 6 deletions

View File

@ -3797,12 +3797,15 @@ format_has_tabs(const char *seq)
while ((ch = *seq++)) {
if (ch == '~') {
ch = *seq++;
if (ch == 'p' || ch == '@') {
return TRUE;
}
if (ch == '*') {
ch = *seq++;
} else {
while (ch >= '0' && ch <= '9') ch = *seq++;
}
if (ch == 't' || ch == '|' || ch == '@' || ch == '+') {
if (ch == 't' || ch == '|' || ch == '+') {
return TRUE;
}
if (!ch)
@ -4052,12 +4055,13 @@ format(volatile Term otail, volatile Term oargs, int sno)
goto do_instantiation_error;
if (!IsIntegerTerm(t))
goto do_type_int_error;
if (!has_repeats) {
if (!has_repeats && ch == 'd') {
Yap_plwrite (t, f_putc, Handle_vars_f|To_heap_f);
FormatInfo = &finfo;
} else {
Int siz, dec = IntegerOfTerm(t), i, div = 1;
Int siz, dec, i, div = 1;
dec = IntegerOfTerm(t);
/*
* The guys at Quintus have probably
* read too much Cobol!
@ -4090,11 +4094,16 @@ format(volatile Term otail, volatile Term oargs, int sno)
f_putc(sno, (int)((dec/div)+'0'));
output_done = TRUE;
siz--;
dec = dec%div;
dec %= div;
}
if (repeats) {
f_putc(sno, (int) '.');
}
f_putc(sno, (int) '.');
}
Yap_plwrite (MkIntegerTerm(dec), f_putc, Handle_vars_f|To_heap_f);
for (;siz>0;siz--,dec%=div) {
div /= 10;
f_putc(sno, (int)((dec/div)+'0'));
}
FormatInfo = &finfo;
break;
case 'r':

View File

@ -16,6 +16,7 @@
<h2>Yap-5.1.0:</h2>
<ul>
<li> FIXED: format's ~d and ~D were broken (obs Jude Shavlik). </li>
<li> FIXED: profiler should not talk about hidden predicates or idb entries. </li>
<li> FIXED: recentg change in setof could bind argument (obs
Jude Shavlik). </li>