unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: "Bill Schottstaedt" <bil@ccrma.Stanford.EDU>
Cc: bug-guile@gnu.org
Subject: Re: guile 1.9.0 scm_read_hash_extend gc trouble
Date: Sun, 21 Jun 2009 16:56:48 +0100	[thread overview]
Message-ID: <87skhtpolb.fsf@arudy.ossau.uklinux.net> (raw)
In-Reply-To: <873a9tr46q.fsf@arudy.ossau.uklinux.net> (Neil Jerram's message of "Sun\, 21 Jun 2009 16\:34\:37 +0100")

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

Neil Jerram <neil@ossau.uklinux.net> writes:

> "Bill Schottstaedt" <bil@ccrma.Stanford.EDU> writes:
>
>> static SCM g_skip_block_comment(SCM ch, SCM port)
> [...]
>> Then call scm_read_hash_extend with "|" to activate it.
>
> How do you wrap g_skip_block_comment to get a suitable argument for
> scm_read_hash_extend () ?

I had a go using scm_c_make_subr ().  But with the attached program
and test input (and current Git HEAD) I can't reproduce the seg fault
that you described.  Can you spot some way in which what you are doing
is different to this?

Regards,
        Neil


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bill.c --]
[-- Type: text/x-csrc, Size: 826 bytes --]


#include <libguile.h>

static SCM g_skip_block_comment(SCM ch, SCM port)
{
  int bang_seen = 0;
  while (1)
    {
      int c;
      c = scm_getc(port);
      if (c == EOF)
	{
	  fprintf(stderr, "unterminated `#| ... |#' comment");
	  return(SCM_BOOL_F);
	}
      if (c == '|')
	bang_seen = 1;
      else 
	{
	  if ((c == '#') && (bang_seen))
	    return(SCM_BOOL_F);
	  else bang_seen = 0;
	}
    }
  return(SCM_BOOL_F);
}

void inner_main (void *closure, int argc, char **argv)
{
  scm_read_hash_extend (scm_integer_to_char (scm_from_char ('|')),
			scm_c_make_subr ("skip-comment",
					 scm_tc7_subr_2,
					 g_skip_block_comment));
  scm_shell (argc, argv);
}

int main (int argc, char **argv)
{
  scm_boot_guile (argc, argv, inner_main, NULL);
}

/*
  Local variables:
  compile-command: "gcc bill.c -o bill"
  End:
*/

[-- Attachment #3: bill.scm --]
[-- Type: application/octet-stream, Size: 17 bytes --]

#|
;;; a test
|#

  reply	other threads:[~2009-06-21 15:56 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 [this message]
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

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=87skhtpolb.fsf@arudy.ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=bil@ccrma.Stanford.EDU \
    --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).