From: Kevin Ryde <user42@zip.com.au>
Subject: Re: bug in srfi-13
Date: Sun, 18 Apr 2004 10:22:00 +1000 [thread overview]
Message-ID: <87u0ziqgnr.fsf@zip.com.au> (raw)
In-Reply-To: <87brluhwrb.fsf@zip.com.au> (Kevin Ryde's message of "Thu, 15 Apr 2004 11:10:00 +1000")
[-- Attachment #1: Type: text/plain, Size: 595 bytes --]
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.
[-- Attachment #2: chars.c.toupper.diff --]
[-- Type: text/plain, Size: 2120 bytes --]
--- 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 @@
\f
#include <ctype.h>
+#include <limits.h>
#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;
}
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2004-04-18 0:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-06 15:50 bug in srfi-13 Han-Wen Nienhuys
2004-04-06 16:13 ` Han-Wen Nienhuys
2004-04-15 0:37 ` Kevin Ryde
2004-04-15 1:10 ` Kevin Ryde
2004-04-18 0:22 ` Kevin Ryde [this message]
2004-04-24 22:05 ` Kevin Ryde
2004-04-24 22:58 ` Marius Vollmer
2004-05-11 19:15 ` Marius Vollmer
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=87u0ziqgnr.fsf@zip.com.au \
--to=user42@zip.com.au \
/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).