Subject: bug#10616: flush procedure for soft ports isn't called

From: Ian Price <[email-masked]>
Date: Fri, 27 Jan 2012 06:27:47 +0000

Ian Price <[email-masked]> writes:

> Yak, this example is a horrible one, since force-output doesn't return
> the return value of the procedure anyway, but if you try replacing it
> with (lambda () (throw 'wontthrow)), and you'll see it doesn't error
>
> In sf_flush in libguile/vports.c, there is a test
>   if (pt->write_pos > pt->write_buf)
> which some printf debugging tells me is never true, in fact, those
> values never change, no matter how much I write to the port. Some food
> for thought while I grapple with how the ports code is supposed to work.

OK, so as I understand it, this is supposed to check if there has been a
write to the port. And the buffer will have at most one character in it
because it is set up that way in scm_port_non_buffer.

I notice that sf_write doesn't update this buffer, but instead just
calls the write procedure directly. In that case, it makes sense that
the value isn't changing, and therefore maybe I should just change
sf_flush into a wrapper for the flush procedure?

-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"