[uim-commit] r1393 - in branches/r5rs/sigscheme: . test
kzk at freedesktop.org
kzk at freedesktop.org
Sun Sep 4 07:27:55 EST 2005
Author: kzk
Date: 2005-09-03 14:27:52 -0700 (Sat, 03 Sep 2005)
New Revision: 1393
Modified:
branches/r5rs/sigscheme/operations.c
branches/r5rs/sigscheme/read.c
branches/r5rs/sigscheme/test/test-string.scm
Log:
* sigscheme/read.c
- (read_string): more informational debug message
- (read_char_sequence)
: more informational debug message
: pass through first '\n','\r','\f','\t'
* sigscheme/operations.c
- (ScmOp_list2string): handle #\\ case
* sigscheme/test/test-string.scm
- add forgotten )
Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c 2005-09-03 20:56:50 UTC (rev 1392)
+++ branches/r5rs/sigscheme/operations.c 2005-09-03 21:27:52 UTC (rev 1393)
@@ -1633,10 +1633,12 @@
ScmObj ScmOp_list2string(ScmObj list)
{
+ int len = 0;
int total_size = 0;
ScmObj chars = SCM_NULL;
ScmObj obj = SCM_NULL;
char *new_str = NULL;
+ char *ch = NULL;
char *p = NULL;
if (FALSEP(ScmOp_listp(list)))
@@ -1661,9 +1663,15 @@
p = new_str;
for (chars = list; !NULLP(chars); chars = CDR(chars)) {
obj = CAR(chars);
+ ch = SCM_CHAR_VALUE(obj);
+ len = strlen(SCM_CHAR_VALUE(obj));
- strcpy(p, SCM_CHAR_VALUE(obj));
- p += strlen(SCM_CHAR_VALUE(obj));
+ /* handle #\\ case */
+ if (len == 1 && ch[0] == '\\')
+ ch = "\\\\";
+
+ strcpy(p, ch);
+ p += len;
}
return Scm_NewString(new_str);
Modified: branches/r5rs/sigscheme/read.c
===================================================================
--- branches/r5rs/sigscheme/read.c 2005-09-03 20:56:50 UTC (rev 1392)
+++ branches/r5rs/sigscheme/read.c 2005-09-03 21:27:52 UTC (rev 1393)
@@ -338,7 +338,8 @@
switch (c) {
case EOF:
- SigScm_Error("EOF in the string\n");
+ stringbuf[stringlen] = '\0';
+ SigScm_Error("EOF in the string : str = %s\n", stringbuf);
break;
case '\"':
@@ -463,18 +464,19 @@
switch (c) {
case EOF:
- SigScm_Error("EOF in the char sequence.\n");
+ stringbuf[stringlen] = '\0';
+ SigScm_Error("EOF in the char sequence : char = %s\n", stringbuf);
break;
- case ' ': case '\"': case '\'':
- case '(': case ')': case ';':
+ case ' ': case '\"': case '\'':
+ case '(': case ')': case ';':
+ case '\n': case '\r': case '\f': case '\t':
/* pass through first char */
if (stringlen == 0) {
stringbuf[stringlen++] = (char)c;
break;
}
- /* doesn't break */
- case '\n': case '\t':
+ /* return buf */
SCM_PORT_UNGETC(port, c);
stringbuf[stringlen] = '\0';
dst = (char *)malloc(strlen(stringbuf) + 1);
Modified: branches/r5rs/sigscheme/test/test-string.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-string.scm 2005-09-03 20:56:50 UTC (rev 1392)
+++ branches/r5rs/sigscheme/test/test-string.scm 2005-09-03 21:27:52 UTC (rev 1393)
@@ -66,7 +66,7 @@
(assert-equal? "list->string check" "\\" (list->string '(#\\)))
(assert-equal? "list->string check" "\t" (list->string '(#\ )))
(assert-equal? "list->string check" "\n" (list->string '(#\
-))
+)))
;; string-fill!
(assert "alphabet string-fill! check" (string=? "jjjjj" (begin
More information about the uim-commit
mailing list