unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: bug-guile@gnu.org
Subject: Re: guile 1.9.0 scm_read_hash_extend gc trouble
Date: Mon, 22 Jun 2009 10:50:07 +0200	[thread overview]
Message-ID: <878wjkejpc.fsf@ambire.localdomain> (raw)
In-Reply-To: <20090621120823.M97037@ccrma.Stanford.EDU> (Bill Schottstaedt's message of "Sun, 21 Jun 2009 05:10:09 -0700")

() "Bill Schottstaedt" <bil@ccrma.Stanford.EDU>
() Sun, 21 Jun 2009 05:10:09 -0700

   code to implement #|..|# block comment processing triggers either a
   glibc memory complaint or a segfault.

FWIW, below is the implementation from Guile 1.4.1.118 (not yet released).
It handles nesting (per R6RS, i believe) and a weird lookahead case.

thi

_____________________________________________________________
/* Skip #|...|# block comments.  */

static void
skip_hashpipe_block_comment (SCM port)
{
#define FUNC_NAME s_scm_read
  int c;
  bool pipep = false;
  int oline = SCM_LINUM (port);
  int ocol = SCM_COL (port);

  for (;;)
    {
      if (EOF == (c = GETC ()))
      toosoon:
        {
          char buf[149];

          snprintf (buf, 149, "%s\n%s:%d:%d: (starting here)",
                    "unterminated `#| ... |#' comment",
                    c_port_filename (port),
                    1 + oline, ocol - 1);
          BADNESS (0, buf);
        }

      if (pipep && '#' == c)
        return;

      /* Handle nested comments.  */
    retry:
      if ('#' == c)
        {
          if (EOF == (c = GETC ()))
            goto toosoon;
          if ('|' == c)
            {
              skip_hashpipe_block_comment (port);
              pipep = false;
            }
          else
            /* Don't get fooled by ##|...|# (ugh).  */
            goto retry;
        }

      pipep = ('|' == c);
    }
#undef FUNC_NAME
}




      parent reply	other threads:[~2009-06-22  8:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-21 12:10 guile 1.9.0 scm_read_hash_extend gc trouble Bill Schottstaedt
2009-06-21 15:34 ` Neil Jerram
2009-06-21 15:56   ` Neil Jerram
2009-06-22 17:23     ` Bill Schottstaedt
2009-06-22 23:25       ` Neil Jerram
2009-06-23 19:18         ` Bill Schottstaedt
2009-06-23 23:07           ` Ludovic Courtès
2009-06-27 21:53             ` Neil Jerram
2009-06-27 23:42               ` Ludovic Courtès
2009-06-29 15:02                 ` Ludovic Courtès
2009-06-29 19:18                   ` Neil Jerram
2009-06-24 10:19         ` Bill Schottstaedt
2009-06-22  8:50 ` Thien-Thi Nguyen [this message]

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=878wjkejpc.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=bug-guile@gnu.org \
    /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).