* bug in srfi-13
@ 2004-04-06 15:50 Han-Wen Nienhuys
2004-04-06 16:13 ` Han-Wen Nienhuys
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Han-Wen Nienhuys @ 2004-04-06 15:50 UTC (permalink / raw)
test.scm:
(use-modules (srfi srfi-13))
(string-map
(lambda (chr) (display (list " " (char->integer chr))) chr)
"ö")
=>
byrd:~/usr/src/lilypond$ guile test.scm
( 16777155)( 16777142)
after bugfix:
byrd:~/usr/src/lilypond$ guile test.scm
( 195)( 182)
there is still something broken in this function. For reasons beyond
my comprehension, the SCM_VALIDATE_SUBSTRING_SPEC_COPY macro has the
side effect of assigning to cstart and cend, and doing so wrongly.
May I suggest that future SCM_VALIDATE_*_ macros be renamed, for
example from
SCM_VALIDATE_COPY
to
SCM_VALIDATED_COPY
The latter implies that the macro does have a side effect.
Also, the naming of scm_{up,down}case functions was wrong; it should
be scm_c_{up,down}case. I have changed this. I leave to Marius to
decide whether a backward compatibility must be maintained.
I am still puzzled why <ctype.h> isn't used.
--
Han-Wen Nienhuys | hanwen@xs4all.nl | http://www.xs4all.nl/~hanwen
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug in srfi-13
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
2 siblings, 0 replies; 8+ messages in thread
From: Han-Wen Nienhuys @ 2004-04-06 16:13 UTC (permalink / raw)
hanwen@xs4all.nl writes:
>
> after bugfix:
>
> byrd:~/usr/src/lilypond$ guile test.scm
> ( 195)( 182)
>
> there is still something broken in this function. For reasons beyond
> my comprehension, the SCM_VALIDATE_SUBSTRING_SPEC_COPY macro has the
> side effect of assigning to cstart and cend, and doing so wrongly.
>
I retract this. Emacs expands the o with dieresis to two bytes
characters; my bad.
--
Han-Wen Nienhuys | hanwen@xs4all.nl | http://www.xs4all.nl/~hanwen
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in srfi-13
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
2 siblings, 0 replies; 8+ messages in thread
From: Kevin Ryde @ 2004-04-15 0:37 UTC (permalink / raw)
Cc: guile-devel
Han-Wen Nienhuys <hanwen@xs4all.nl> writes:
>
> after bugfix:
>
> byrd:~/usr/src/lilypond$ guile test.scm
> ( 195)( 182)
That fix might be a candidate for the 1.6 branch too.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in srfi-13
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
2 siblings, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2004-04-15 1:10 UTC (permalink / raw)
Cc: guile-devel
Han-Wen Nienhuys <hanwen@xs4all.nl> writes:
>
> I am still puzzled why <ctype.h> isn't used.
It looks a bit suss that char-upcase and char-downcase should do their
own thing, but char-upper-case? and char-lower-case? use ctype.h.
There's probably some good scope for inconsistency there in an 8-bit
locale.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in srfi-13
2004-04-15 1:10 ` Kevin Ryde
@ 2004-04-18 0:22 ` Kevin Ryde
2004-04-24 22:05 ` Kevin Ryde
2004-05-11 19:15 ` Marius Vollmer
0 siblings, 2 replies; 8+ messages in thread
From: Kevin Ryde @ 2004-04-18 0:22 UTC (permalink / raw)
[-- 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in srfi-13
2004-04-18 0:22 ` Kevin Ryde
@ 2004-04-24 22:05 ` Kevin Ryde
2004-04-24 22:58 ` Marius Vollmer
2004-05-11 19:15 ` Marius Vollmer
1 sibling, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2004-04-24 22:05 UTC (permalink / raw)
I wrote:
>
> * chars.c (scm_char_upcase, ...
I applied this to the head, but the boss of 1.6 can say about there.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in srfi-13
2004-04-24 22:05 ` Kevin Ryde
@ 2004-04-24 22:58 ` Marius Vollmer
0 siblings, 0 replies; 8+ messages in thread
From: Marius Vollmer @ 2004-04-24 22:58 UTC (permalink / raw)
Kevin Ryde <user42@zip.com.au> writes:
> I applied this to the head, but the boss of 1.6 can say about there.
Yes, please apply this to 1.6 as well. Thanks!
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: bug in srfi-13
2004-04-18 0:22 ` Kevin Ryde
2004-04-24 22:05 ` Kevin Ryde
@ 2004-05-11 19:15 ` Marius Vollmer
1 sibling, 0 replies; 8+ messages in thread
From: Marius Vollmer @ 2004-05-11 19:15 UTC (permalink / raw)
Kevin Ryde <user42@zip.com.au> writes:
> This would be for 1.6 too, the dodigness between using and not using
> ctype.h is the same there.
Yes, well done. Thanks!
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-05-11 19:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2004-04-24 22:05 ` Kevin Ryde
2004-04-24 22:58 ` Marius Vollmer
2004-05-11 19:15 ` Marius Vollmer
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).