From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.bugs Subject: Re: guile 1.9.0 scm_read_hash_extend gc trouble Date: Sun, 21 Jun 2009 16:56:48 +0100 Message-ID: <87skhtpolb.fsf@arudy.ossau.uklinux.net> References: <20090621120823.M97037@ccrma.Stanford.EDU> <873a9tr46q.fsf@arudy.ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1245599857 12873 80.91.229.12 (21 Jun 2009 15:57:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Jun 2009 15:57:37 +0000 (UTC) Cc: bug-guile@gnu.org To: "Bill Schottstaedt" Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Jun 21 17:57:34 2009 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MIPQC-00037P-R7 for guile-bugs@m.gmane.org; Sun, 21 Jun 2009 17:57:33 +0200 Original-Received: from localhost ([127.0.0.1]:39329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIPQB-0004PL-W4 for guile-bugs@m.gmane.org; Sun, 21 Jun 2009 11:57:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MIPQ7-0004Oi-0M for bug-guile@gnu.org; Sun, 21 Jun 2009 11:57:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MIPQ2-0004MF-8S for bug-guile@gnu.org; Sun, 21 Jun 2009 11:57:26 -0400 Original-Received: from [199.232.76.173] (port=53886 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIPQ1-0004M6-U6 for bug-guile@gnu.org; Sun, 21 Jun 2009 11:57:21 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:45395) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MIPQ1-0006z8-Bt for bug-guile@gnu.org; Sun, 21 Jun 2009 11:57:21 -0400 Original-Received: from arudy (host86-152-99-133.range86-152.btcentralplus.com [86.152.99.133]) by mail3.uklinux.net (Postfix) with ESMTP id B8E5B1F7669; Sun, 21 Jun 2009 16:57:19 +0100 (BST) Original-Received: from arudy.ossau.uklinux.net (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id E3D1638021; Sun, 21 Jun 2009 16:56:48 +0100 (BST) In-Reply-To: <873a9tr46q.fsf@arudy.ossau.uklinux.net> (Neil Jerram's message of "Sun\, 21 Jun 2009 16\:34\:37 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:4233 Archived-At: --=-=-= Neil Jerram writes: > "Bill Schottstaedt" 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 --=-=-= Content-Type: text/x-csrc Content-Disposition: inline; filename=bill.c #include 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: */ --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=bill.scm #| ;;; a test |# --=-=-=--