From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: Re: bug in srfi-13 Date: Sun, 18 Apr 2004 10:22:00 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87u0ziqgnr.fsf@zip.com.au> References: <16498.53673.93666.636797@localhost.localdomain> <87brluhwrb.fsf@zip.com.au> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1082247935 8813 80.91.224.253 (18 Apr 2004 00:25:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 18 Apr 2004 00:25:35 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Apr 18 02:25:26 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BF07i-0003mo-00 for ; Sun, 18 Apr 2004 02:25:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BF061-0001lX-E8 for guile-devel@m.gmane.org; Sat, 17 Apr 2004 20:23:41 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BF057-0001jV-OS for guile-devel@gnu.org; Sat, 17 Apr 2004 20:22:45 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BF04b-0001W5-OG for guile-devel@gnu.org; Sat, 17 Apr 2004 20:22:44 -0400 Original-Received: from [61.8.0.85] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BF04X-0001VI-6C for guile-devel@gnu.org; Sat, 17 Apr 2004 20:22:09 -0400 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87]) by mailout2.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id i3I0M75v028969 for ; Sun, 18 Apr 2004 10:22:07 +1000 Original-Received: from localhost (ppp25C7.dyn.pacific.net.au [61.8.37.199]) by mailproxy2.pacific.net.au (8.12.3/8.12.3/Debian-6.6) with ESMTP id i3I0M5HV016586 for ; Sun, 18 Apr 2004 10:22:06 +1000 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1BF04O-00085C-00; Sun, 18 Apr 2004 10:22:00 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never In-Reply-To: <87brluhwrb.fsf@zip.com.au> (Kevin Ryde's message of "Thu, 15 Apr 2004 11:10:00 +1000") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3608 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3608 --=-=-= I'd be thinking of something like this for char-upcase etc, * chars.c (scm_char_upcase, scm_char_downcase, scm_c_upcase, scm_c_downcase): Use ctype.h toupper and tolower. This will be useful in 8-bit locales, and ensures consistency with char-upper-case? and char-lower-case? which already use ctype.h. (scm_c_upcase_table, scm_c_downcase_table, scm_lowers, scm_uppers): Remove. * chars.c, chars.h, init.c (scm_tables_prehistory): Remove. This would be for 1.6 too, the dodigness between using and not using ctype.h is the same there. --=-=-= Content-Disposition: inline; filename=chars.c.toupper.diff --- chars.c.~1.35.~ 2004-04-15 10:58:00.000000000 +1000 +++ chars.c 2004-04-18 10:18:19.000000000 +1000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1998, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998, 2000, 2001, 2004 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,6 +19,7 @@ #include +#include #include "libguile/_scm.h" #include "libguile/validate.h" @@ -260,7 +261,7 @@ #define FUNC_NAME s_scm_char_upcase { SCM_VALIDATE_CHAR (1, chr); - return SCM_MAKE_CHAR(scm_c_upcase (SCM_CHAR(chr))); + return SCM_MAKE_CHAR (toupper (SCM_CHAR (chr))); } #undef FUNC_NAME @@ -271,7 +272,7 @@ #define FUNC_NAME s_scm_char_downcase { SCM_VALIDATE_CHAR (1, chr); - return SCM_MAKE_CHAR(scm_c_downcase (SCM_CHAR(chr))); + return SCM_MAKE_CHAR (tolower (SCM_CHAR(chr))); } #undef FUNC_NAME @@ -279,25 +280,6 @@ -static unsigned char scm_c_upcase_table[SCM_CHAR_CODE_LIMIT]; -static unsigned char scm_c_downcase_table[SCM_CHAR_CODE_LIMIT]; -static const unsigned char scm_lowers[] = "abcdefghijklmnopqrstuvwxyz"; -static const unsigned char scm_uppers[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - - -void -scm_tables_prehistory () -{ - int i; - for (i = 0; i < SCM_CHAR_CODE_LIMIT; i++) - scm_c_upcase_table[i] = scm_c_downcase_table[i] = i; - for (i = 0; i < (int) (sizeof scm_lowers / sizeof (scm_lowers[0])); i++) - { - scm_c_upcase_table[scm_lowers[i]] = scm_uppers[i]; - scm_c_downcase_table[scm_uppers[i]] = scm_lowers[i]; - } -} - /* TODO: change name to scm_i_.. ? --hwn */ @@ -306,8 +288,8 @@ int scm_c_upcase (unsigned int c) { - if (c < sizeof (scm_c_upcase_table)) - return scm_c_upcase_table[c]; + if (c <= UCHAR_MAX) + return toupper (c); else return c; } @@ -316,8 +298,8 @@ int scm_c_downcase (unsigned int c) { - if (c < sizeof (scm_c_downcase_table)) - return scm_c_downcase_table[c]; + if (c <= UCHAR_MAX) + return tolower (c); else return c; } --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel --=-=-=--