unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Bug in soft ports
@ 2002-12-30  0:09 Daniel Skarda
  0 siblings, 0 replies; only message in thread
From: Daniel Skarda @ 2002-12-30  0:09 UTC (permalink / raw)


Hello,

  today I tried soft ports (as an experiment I wrote a soft port which indents
output - (make-indent-port port start-column max-column) creates something like
indenting pipe :-)

  During development of my enhanced port I hit a barrier - I think I found
a bug in soft ports. Even thought I (force-output my-port), sometimes I have not
got any output. Let's examine function sf_flush from vports.c:

static void
sf_flush (SCM port)
{
  scm_t_port *pt = SCM_PTAB_ENTRY (port);
  SCM stream = SCM_PACK (pt->stream);

  if (pt->write_pos > pt->write_buf)
    {
      /* write the byte. */
      scm_call_1 (SCM_VELTS (stream)[0], SCM_MAKE_CHAR (*pt->write_buf));
      pt->write_pos = pt->write_buf;
  
      /* flush the output.  */
      {
	SCM f = SCM_VELTS (stream)[2];

	if (!SCM_FALSEP (f))
	  scm_call_0 (f);
      }
    }
}

  When the write buffer is empty, soft port never calls flush function. In my
opinion scm_call_0 should be called _before_ first "if", because (at least in
my code) flush can create some output and write to buffer.

  Does anybody remember any reason for current strange behaviour of soft ports
during flush?

0.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-30  0:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-30  0:09 Bug in soft ports Daniel Skarda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).