unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Daniel Skarda <0rfelyus@ucw.cz>
Subject: Bug in soft ports
Date: Mon, 30 Dec 2002 01:09:43 +0100	[thread overview]
Message-ID: <m0ptrk74fs.fsf@hobitin.ucw.cz> (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


                 reply	other threads:[~2002-12-30  0:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m0ptrk74fs.fsf@hobitin.ucw.cz \
    --to=0rfelyus@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).