guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in soft ports


From: Daniel Skarda
Subject: Bug in soft ports
Date: Mon, 30 Dec 2002 01:09:43 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/20.7 (i386-debian-linux-gnu)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]