[uim-commit] r2208 - branches/r5rs/sigscheme
kzk at freedesktop.org
kzk at freedesktop.org
Mon Nov 21 11:52:12 PST 2005
Author: kzk
Date: 2005-11-21 11:52:04 -0800 (Mon, 21 Nov 2005)
New Revision: 2208
Modified:
branches/r5rs/sigscheme/read.c
Log:
* sigscheme/read.c
- (read_char): more strict for hexadecimal char form
Modified: branches/r5rs/sigscheme/read.c
===================================================================
--- branches/r5rs/sigscheme/read.c 2005-11-21 19:05:55 UTC (rev 2207)
+++ branches/r5rs/sigscheme/read.c 2005-11-21 19:52:04 UTC (rev 2208)
@@ -336,13 +336,15 @@
CDBG((SCM_DBG_PARSER, "read_char : ch = %s", ch));
- /* check #\x0F style character (defined in R6RS) */
- if (ch && ch[0] == 'x' && strlen(ch) > 1) {
- /* FIXME: only supports ASCII */
+ /* check #\x<x><x> style character where <x> is a hexadecimal
+ * digit and the sequence of two <x>s forms a hexadecimal
+ * number between 0 and #xFF(defined in R6RS) */
+ if (ch && ch[0] == 'x' && 1 < strlen(ch)) {
+ if (strlen(ch) != 3)
+ SigScm_Error("invalid hexadecimal character form. should be #\\x<x><x>\n");
ch[0] = (char)strtol(ch + 1, &first_nondigit, 16);
- if (*first_nondigit) {
- SigScm_Error("invalid character form\n");
- }
+ if (*first_nondigit)
+ SigScm_Error("invalid hexadecimal character form. should be #\\x<x><x>\n");
ch[1] = '\0';
} else {
/* check special sequence */
More information about the uim-commit
mailing list