From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: need: scm_from_{utf8,latin1}_{string,symbol,keyword} Date: Wed, 08 Sep 2010 21:20:55 +0200 Message-ID: References: <877hiy3iwn.fsf@gnu.org> <231469.37791.qm@web37905.mail.mud.yahoo.com> <87zkvtv5qc.fsf@gnu.org> <124542.89753.qm@web37904.mail.mud.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1283974188 3706 80.91.229.12 (8 Sep 2010 19:29:48 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Sep 2010 19:29:48 +0000 (UTC) Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , guile-devel@gnu.org To: Mike Gran Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Sep 08 21:29:47 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OtQL3-0000bT-NY for guile-devel@m.gmane.org; Wed, 08 Sep 2010 21:29:47 +0200 Original-Received: from localhost ([127.0.0.1]:53401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtQL0-00062E-3y for guile-devel@m.gmane.org; Wed, 08 Sep 2010 15:29:42 -0400 Original-Received: from [140.186.70.92] (port=36143 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtQGD-0003Lv-Hg for guile-devel@gnu.org; Wed, 08 Sep 2010 15:24:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OtQ9W-0001tm-J5 for guile-devel@gnu.org; Wed, 08 Sep 2010 15:17:52 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:34207 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OtQ9W-0001ti-Gd; Wed, 08 Sep 2010 15:17:50 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 05A96D495B; Wed, 8 Sep 2010 15:17:50 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=aodU4f5sk5kAHTovUsEWS2yg+lI=; b=calsaP Rfm1+5rT6SeHe6WJ5p78bJK91n2K5xd5zJIUZfNQicPI5voO97ze9AJG/EKuPaOP qjtahpAtSXiLQlH4U1kZACGRTcqWhBKHRkRJwG8GpgQwmgWrNTD3Wml/HVvXAIFf 427GM4vJcRB4Xj565sKxmpXKUuk2WYrkisPKs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=IrlKP9B0mZ4GuBJR4JeFbcp+AQh5LrWv v5h2XgoSSVawz5eeRIgTXzVr7kJjwXV6OJFR+HP/xlmFx7WkW+XCA4G/hYmWRRFd /mC7cp8RvFfc5jKozE244utCZA9W63jN9vrCzgDtoI8WwsrFYnxbeyJWRCrGOT9W 2lgkg+rB1n0= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id D76EFD495A; Wed, 8 Sep 2010 15:17:47 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [79.156.65.247]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 0310CD4954; Wed, 8 Sep 2010 15:17:44 -0400 (EDT) In-Reply-To: <124542.89753.qm@web37904.mail.mud.yahoo.com> (Mike Gran's message of "Tue, 7 Sep 2010 20:26:06 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: C4030E42-BB7D-11DF-8F6D-030CEE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10897 Archived-At: Hi Mike, On Wed 08 Sep 2010 05:26, Mike Gran writes: > Perhaps something like the attached? Yes that's fantastic. I only have a couple of comments. > +@deftypefn {C function} char *scm_to_stringn (SCM str, size_t *lenp, const char *encoding, scm_t_string_failed_conversion_handler handler) How do you feel about scm_to_encoded_stringn as a name? Also scm_from_encoded_stringn. > +If @var{lenp} is NULL, this function will return a null-terminated C > +string. It will thrown an error if the string contains a null > +character. Will scm_to_stringn return a null-terminated string if LENP is not null? > +Since Latin-1 encodings are common, the following two functions are > +provided. > + > +@deftypefn {C function} SCM scm_from_iso88591_stringn (const char *str, size_t len) Ooh, my hands... can we call this one scm_from_latin1_stringn? And the _to_ variant obviously. > +This function may be implemented as a macro. I think it's best to implement these as functions. The overhead is minimal, and this gives us more deprecation flexibility in the future should something be wrong with these functions. What do you think? Andy -- http://wingolog.org/