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

View File

@ -16,6 +16,7 @@
<h2>Yap-5.1.0:</h2> <h2>Yap-5.1.0:</h2>
<ul> <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: profiler should not talk about hidden predicates or idb entries. </li>
<li> FIXED: recentg change in setof could bind argument (obs <li> FIXED: recentg change in setof could bind argument (obs
Jude Shavlik). </li> Jude Shavlik). </li>