From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.user Subject: Re: SCM to C string Date: Fri, 21 Jun 2002 10:22:51 -0500 Sender: guile-user-admin@gnu.org Message-ID: <87hejwy7uc.fsf@raven.i.defaultvalue.org> References: <15634.15737.829121.207133@mriya.ua> <20020620170454.A15966@kiwi.pyrotechnics.com> <15634.21160.467000.233520@mriya.ua> <15634.43198.855187.617275@mriya.ua> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1024673116 26730 127.0.0.1 (21 Jun 2002 15:25:16 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 21 Jun 2002 15:25:16 +0000 (UTC) Cc: guile-user@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17LQHk-0006x1-00 for ; Fri, 21 Jun 2002 17:25:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17LQGz-0002Lp-00; Fri, 21 Jun 2002 11:24:29 -0400 Original-Received: from dsl-209-87-109-2.constant.com ([209.87.109.2] helo=defaultvalue.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17LQFQ-0002Gw-00 for ; Fri, 21 Jun 2002 11:22:53 -0400 Original-Received: from raven.i.defaultvalue.org (raven.i.defaultvalue.org [192.168.1.7]) by defaultvalue.org (Postfix) with ESMTP id 2F042DCD; Fri, 21 Jun 2002 10:22:52 -0500 (CDT) Original-Received: by raven.i.defaultvalue.org (Postfix, from userid 1000) id 83E72DA5; Fri, 21 Jun 2002 10:22:51 -0500 (CDT) Original-To: Viktor Pavlenko In-Reply-To: <15634.43198.855187.617275@mriya.ua> (Viktor Pavlenko's message of "Fri, 21 Jun 2002 00:17:02 -0400") Original-Lines: 43 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-pc-linux-gnu) Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:628 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:628 Viktor Pavlenko writes: > I hurried with the reply... It _is_ described in the `Guile Reference > Manual' by Mark Galassi but it's not in libguile/*.h headers. It's not > in a snapshot version either. Neither I can find others like > scm_c_symbol2str or scm_symbol2str (I'm trying to use scm_ functions > you see). Functions are being added to the scm_ interface as we prepare to eventually deprecate the gh_ interface, so those functions may exist in 1.5.X or CVS HEAD, but not in your version (1.4.X?). > Please advise how to deal with this mess^h^h^h^hpuzzle. Well, for now, you can use the equivalent gh_ functions if you're running 1.4.X, and instead of scm_object_to_string, you could use scm_simple_format. Something like the following perhaps (though you may need to translate some of the scm_ functions to their equivalent gh_ functions). You may also need better error checking: char * objtostr (SCM obj) { char *result; size_t length; SCM fmt = scm_makfrom0str("~S"); SCM scmstr = scm_simple_format(SCM_BOOL_F, fmt, SCM_LIST_1(obj)); length = SCM_STRING_LENGTH(scmstr); result = malloc(length + 1); if (!result) die... memcpy (result, SCM_STRING_CHARS (scmstr), length) result[length] = '\0'; return result; } -- Rob Browning rlb @defaultvalue.org, @linuxdevel.com, and @debian.org Previously @cs.utexas.edu GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user