fix no output

This commit is contained in:
Vitor Santos Costa 2016-08-15 14:50:58 -05:00
parent 2595555982
commit fccf3d9f6f

View File

@ -401,6 +401,7 @@ static int format_print_str(Int sno, Int size, Int has_size, Term args,
while (*pt && (!has_size || size > 0)) {
utf8proc_int32_t ch;
pt += get_utf8(pt, -1, &ch);
f_putc(sno, ch);
}
} else {
while (!has_size || size > 0) {
@ -508,6 +509,7 @@ static Int doformat(volatile Term otail, volatile Term oargs,
format_info finfo;
Term fmod = CurrentModule;
bool alloc_fstr = false;
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (GLOBAL_Stream[sno0].status & InMemory_Stream_f) {
old_handler = GLOBAL_Stream[sno].u.mem_string.error_handler;
@ -596,10 +598,7 @@ static Int doformat(volatile Term otail, volatile Term oargs,
finfo.lstart = 0;
if (true || !(GLOBAL_Stream[sno].status & InMemory_Stream_f))
sno = Yap_OpenBufWriteStream(PASS_REGS1);
if (sno < 0)
return false;
f_putc = GLOBAL_Stream[sno0].stream_wputc;
if (sno == -1) {
if (sno < 0) {
if (!alloc_fstr)
fstr = NULL;
if (mytargs == targs) {
@ -608,6 +607,7 @@ static Int doformat(volatile Term otail, volatile Term oargs,
format_clean_up(sno, sno0, &finfo, fstr, targs);
return false;
}
f_putc = GLOBAL_Stream[sno0].stream_wputc;
while ((fptr += get_utf8(fptr, -1, &ch)) && ch) {
Term t = TermNil;
int has_repeats = false;