[uim-commit] r1275 - branches/r5rs/sigscheme

kzk at freedesktop.org kzk at freedesktop.org
Mon Aug 22 17:58:54 EST 2005


Author: kzk
Date: 2005-08-22 00:58:51 -0700 (Mon, 22 Aug 2005)
New Revision: 1275

Modified:
   branches/r5rs/sigscheme/datas.c
   branches/r5rs/sigscheme/debug.c
   branches/r5rs/sigscheme/eval.c
   branches/r5rs/sigscheme/operations-srfi1.c
   branches/r5rs/sigscheme/operations.c
   branches/r5rs/sigscheme/read.c
   branches/r5rs/sigscheme/sigscheme.c
   branches/r5rs/sigscheme/sigscheme.h
   branches/r5rs/sigscheme/sigschemetype.h
Log:
* change "switch" indent
* rename "ScmOp_SRFI_1_*" to "ScmOp_SRFI1_*"
* abolish SCM_UNSPECIFIED
* rename "ScmOp_*_to_*" to "ScmOp_*2*"

* sigscheme/operations-srfi1.c
  - rename "ScmOp_SRFI_1_*" to "ScmOp_SRFI1_*"

* sigscheme/sigscheme.h
* sigscheme/sigscheme.c
  - rename "ScmOp_SRFI_1_*" to "ScmOp_SRFI1_*"
  - rename "ScmOp_*_to_*" to "ScmOp_*2*"
  - abolish SCM_UNSPECIFIED

* sigscheme/sigschemetype.h
  - abolish SCM_UNSPECIFIED
  - abolish SCM_TRUEP

* sigscheme/read.c
* sigscheme/operations.c
* sigscheme/debug.c
* sigscheme/eval.c
* sigscheme/datas.c
  - change "switch" indent
  - abolish SCM_UNSPECIFIED


Modified: branches/r5rs/sigscheme/datas.c
===================================================================
--- branches/r5rs/sigscheme/datas.c	2005-08-22 06:10:51 UTC (rev 1274)
+++ branches/r5rs/sigscheme/datas.c	2005-08-22 07:58:51 UTC (rev 1275)
@@ -74,7 +74,7 @@
 #ifndef posix_memalign
 /*
  * Cited from manpage of posix_memalign(3) of glibc:
- * 
+ *
  * CONFORMING TO
  *     The  function  valloc()  appeared in 3.0 BSD. It is documented as being
  *     obsolete in BSD 4.3, and as legacy in SUSv2. It  no  longer  occurs  in
@@ -252,7 +252,7 @@
     /* allocate heap */
     heap = (ScmObj)malloc_aligned(sizeof(ScmObjInternal) * HEAP_SIZE);
     (*heaps)[num_heap - 1] = heap;
-    
+
     /* link in order */
     for (cell=heap; cell-heap < HEAP_SIZE; cell++) {
         SCM_SETFREECELL(cell);
@@ -308,7 +308,7 @@
     gc_preprocess();
     gc_mark();
     gc_sweep();
-    
+
     /* we cannot sweep the object, so let's add new heap */
     if (SCM_NULLP(scm_freelist)) {
 #if DEBUG_GC
@@ -341,22 +341,27 @@
         obj = SCM_CDR(obj);
         goto mark_loop;
         break;
+
     case ScmSymbol:
         mark_obj(SCM_SYMBOL_VCELL(obj));
         break;
+
     case ScmClosure:
         mark_obj(SCM_CLOSURE_EXP(obj));
         obj = SCM_CLOSURE_ENV(obj);
         goto mark_loop;
         break;
+
     case ScmValuePacket:
         obj = SCM_VALUEPACKET_VALUES(obj);
         goto mark_loop;
+
     case ScmVector:
         for (i = 0; i < SCM_VECTOR_LEN(obj); i++) {
             mark_obj(SCM_VECTOR_VEC(obj)[i]);
         }
         break;
+
     default:
         break;
     }
@@ -415,7 +420,7 @@
 {
     int i = 0;
     ScmObj obj = SCM_NIL;
-    
+
     /* mark stack */
     for (i = 0; i < n; i++) {
         obj = start[i];
@@ -468,7 +473,7 @@
     setjmp(save_regs_buf);
     gc_mark_locations((ScmObj*)save_regs_buf,
                       (ScmObj*)(((char*)save_regs_buf) + sizeof(save_regs_buf)));
-    
+
     gc_mark_protected_obj();
     gc_mark_locations(stack_start_pointer, &obj);
     gc_mark_symbol_hash();
@@ -485,40 +490,42 @@
     case ScmFreeCell:
     case ScmEtc:
         break;
+
     case ScmChar:
         if (SCM_CHAR_CH(obj)) free(SCM_CHAR_CH(obj));
         break;
+
     case ScmString:
         if (SCM_STRING_STR(obj)) free(SCM_STRING_STR(obj));
         break;
+
     case ScmVector:
         if (SCM_VECTOR_VEC(obj)) free(SCM_VECTOR_VEC(obj));
         break;
+
     case ScmSymbol:
         if (SCM_SYMBOL_NAME(obj)) free(SCM_SYMBOL_NAME(obj));
         break;
+
     case ScmPort:
-    {
+        /* handle each port type */
         switch (SCM_PORTINFO_PORTTYPE(obj)) {
         case PORT_FILE:
-            if (SCM_PORTINFO_FILENAME(obj))
-                free(SCM_PORTINFO_FILENAME(obj));
+            if (SCM_PORTINFO_FILENAME(obj)) free(SCM_PORTINFO_FILENAME(obj));
             break;
         case PORT_STRING:
-            if (SCM_PORTINFO_STR(obj))
-                free(SCM_PORTINFO_STR(obj));
+            if (SCM_PORTINFO_STR(obj)) free(SCM_PORTINFO_STR(obj));
             break;
-        default:
-            break;
         }
-        
-        if (SCM_PORT_PORTINFO(obj))
-            free(SCM_PORT_PORTINFO(obj));
+        /* free port info */
+        if (SCM_PORT_PORTINFO(obj)) free(SCM_PORT_PORTINFO(obj));
         break;
-    }
+
     case ScmContinuation:
+        /* free continuation info */
         if (SCM_CONTINUATION_CONTINFO(obj)) free(SCM_CONTINUATION_CONTINFO(obj));
         break;
+
     default:
         break;
     }
@@ -535,7 +542,7 @@
     /* iterate heaps */
     for (i = 0; i < scm_heap_num; i++) {
         corrected_obj_num = 0;
-        
+
         /* iterate in heap */
         for (j = 0; j < SCM_HEAP_SIZE; j++) {
             obj = &scm_heaps[i][j];
@@ -550,7 +557,7 @@
                 corrected_obj_num++;
             }
         }
-        
+
 #if DEBUG_GC
         printf("scm[%d] sweeped = %d\n", i, corrected_obj_num);
 #endif
@@ -693,7 +700,7 @@
 {
     ScmObj obj = SCM_NIL;
     SCM_NEW_OBJ_INTERNAL(obj);
-    
+
     SCM_SETVECTOR(obj);
     SCM_SETVECTOR_VEC(obj, vec);
     SCM_SETVECTOR_LEN(obj, len);
@@ -717,7 +724,7 @@
     pinfo->info.file_port.line = 0;
     pinfo->ungottenchar = 0;
     SCM_SETPORT_PORTINFO(obj, pinfo);
-    
+
     return obj;
 }
 
@@ -736,7 +743,7 @@
     pinfo->info.str_port.str_current = pinfo->info.str_port.port_str;
     pinfo->ungottenchar = 0;
     SCM_SETPORT_PORTINFO(obj, pinfo);
-    
+
     return obj;
 }
 
@@ -804,7 +811,6 @@
     symbol_hash = (ScmObj*)malloc(sizeof(ScmObj) * NAMEHASH_SIZE);
     for (i = 0; i < NAMEHASH_SIZE; i++) {
         symbol_hash[i] = SCM_NIL;
-    
     }
 }
 

Modified: branches/r5rs/sigscheme/debug.c
===================================================================
--- branches/r5rs/sigscheme/debug.c	2005-08-22 06:10:51 UTC (rev 1274)
+++ branches/r5rs/sigscheme/debug.c	2005-08-22 07:58:51 UTC (rev 1275)
@@ -150,7 +150,6 @@
     case ScmFreeCell:
         SigScm_Error("You cannot print ScmFreeCell, may be GC bug.\n");
         break;
-
     case ScmCPointer:
         fprintf(f, "#<c_pointer %p>", SCM_C_POINTER_DATA(obj));
         break;
@@ -328,8 +327,6 @@
         fprintf(f, "#<unquote_splicing>");
     else if (EQ(obj, SCM_UNBOUND))
         fprintf(f, "#<unbound>");
-    else if (EQ(obj, SCM_UNSPECIFIED))
-        fprintf(f, "#<unspecified>");
     else if (EQ(obj, SCM_UNDEF))
         fprintf(f, "#<undef>");
 }

Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c	2005-08-22 06:10:51 UTC (rev 1274)
+++ branches/r5rs/sigscheme/eval.c	2005-08-22 07:58:51 UTC (rev 1275)
@@ -485,12 +485,13 @@
             obj = SCM_CAR(SCM_CDR(obj));
             continuation_thrown_obj = ScmOp_eval(obj, env);
             longjmp(SCM_CONTINUATION_JMPENV(tmp), 1);
+            break;
         }
-        break;
         case ScmEtc:
-            SigScm_ErrorObj("invalid application: ", obj);
+        {
+            SigScm_ErrorObj("eval : invalid application: ", obj);
+        }
         default:
-            /* What? */
             SigScm_ErrorObj("eval : What type of function? ", arg);
         }
     }
@@ -1117,7 +1118,7 @@
         }
     }
 
-    return SCM_UNSPECIFIED;
+    return SCM_UNDEF;
 }
 
 ScmObj ScmExp_case(ScmObj arg, ScmObj *envp, int *tail_flag)
@@ -1148,7 +1149,7 @@
         }
     }
 
-    return SCM_UNSPECIFIED;
+    return SCM_UNDEF;
 }
 
 ScmObj ScmExp_and(ScmObj arg, ScmObj *envp, int *tail_flag)

Modified: branches/r5rs/sigscheme/operations-srfi1.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi1.c	2005-08-22 06:10:51 UTC (rev 1274)
+++ branches/r5rs/sigscheme/operations-srfi1.c	2005-08-22 07:58:51 UTC (rev 1275)
@@ -77,12 +77,12 @@
 /*==============================================================================
   SRFI1 : The procedures : Constructors
 ==============================================================================*/
-ScmObj ScmOp_SRFI_1_xcons(ScmObj a, ScmObj b)
+ScmObj ScmOp_SRFI1_xcons(ScmObj a, ScmObj b)
 {
     return Scm_NewCons(b, a);
 }
 
-ScmObj ScmOp_SRFI_1_cons_star(ScmObj obj, ScmObj env)
+ScmObj ScmOp_SRFI1_cons_star(ScmObj obj, ScmObj env)
 {
     ScmObj tail_cons = SCM_NIL;
     ScmObj prev_tail = obj;
@@ -102,7 +102,7 @@
     return obj;
 }
 
-ScmObj ScmOp_SRFI_1_make_list(ScmObj args, ScmObj env)
+ScmObj ScmOp_SRFI1_make_list(ScmObj args, ScmObj env)
 {
     ScmObj fill  = SCM_NIL;
     ScmObj head  = SCM_NIL;
@@ -133,7 +133,7 @@
     return head;
 }
 
-ScmObj ScmOp_SRFI_1_list_tabulate(ScmObj args, ScmObj env)
+ScmObj ScmOp_SRFI1_list_tabulate(ScmObj args, ScmObj env)
 {
     ScmObj scm_n = SCM_CAR(args);
     ScmObj proc  = SCM_NIL;
@@ -170,7 +170,7 @@
     return head;
 }
 
-ScmObj ScmOp_SRFI_1_list_copy(ScmObj list)
+ScmObj ScmOp_SRFI1_list_copy(ScmObj list)
 {
     ScmObj head = SCM_NIL;
     ScmObj tail = SCM_NIL;
@@ -184,7 +184,7 @@
 
         /* further copy */
         if (SCM_CONSP(obj))
-            obj = ScmOp_SRFI_1_list_copy(obj);
+            obj = ScmOp_SRFI1_list_copy(obj);
 
         /* then create new cons */
         obj = Scm_NewCons(obj, SCM_NIL);
@@ -200,7 +200,7 @@
     return head;
 }
 
-ScmObj ScmOp_SRFI_1_circular_list(ScmObj list, ScmObj env)
+ScmObj ScmOp_SRFI1_circular_list(ScmObj list, ScmObj env)
 {
     ScmObj tailcons = SCM_NIL;
 
@@ -213,7 +213,7 @@
     return list;
 }
 
-ScmObj ScmOp_SRFI_1_iota(ScmObj args, ScmObj env)
+ScmObj ScmOp_SRFI1_iota(ScmObj args, ScmObj env)
 {
     ScmObj scm_count = SCM_NIL;
     ScmObj scm_start = SCM_NIL;

Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c	2005-08-22 06:10:51 UTC (rev 1274)
+++ branches/r5rs/sigscheme/operations.c	2005-08-22 07:58:51 UTC (rev 1275)
@@ -88,10 +88,12 @@
         /* both numbers, are numerically equal */
         if ((SCM_INT_VALUE(obj1) == SCM_INT_VALUE(obj2))) return SCM_TRUE;
         break;
+
     case ScmChar:
         /* chars and are the same character according to the char=? */
         if (EQ(ScmOp_char_equal(obj1, obj2), SCM_TRUE)) return SCM_TRUE;
         break;
+
     case ScmSymbol:  /* equivalent symbols must already be true on eq? */
     case ScmCons:
     case ScmVector:
@@ -101,9 +103,9 @@
     case ScmPort:
     case ScmContinuation:
     case ScmValuePacket:
-        break;
     case ScmEtc:
         break;
+
     case ScmFreeCell:
         SigScm_Error("eqv? : cannnot compare freecell, gc broken?\n");
         break;
@@ -187,17 +189,29 @@
 
     case ScmSymbol:  /* equivalent symbols must already be true on eq? */
         break;
+
+    /* ScmFunc, ScmClosure, ScmPort, ScmContinuation comparison is not unspecified in R5RS */
     case ScmFunc:
+        SigScm_ErrorObj("equal? : cannot compare function : ", Scm_NewCons(obj1, obj2));
+        break;
     case ScmClosure:
+        SigScm_ErrorObj("equal? : cannot compare function : ", Scm_NewCons(obj1, obj2));
+        break;
     case ScmPort:
+        SigScm_ErrorObj("equal? : cannot compare function : ", Scm_NewCons(obj1, obj2));
+        break;
     case ScmContinuation:
-        return SCM_UNSPECIFIED;
+        SigScm_ErrorObj("equal? : cannot compare function : ", Scm_NewCons(obj1, obj2));
+        break;
+
     case ScmValuePacket:
         if (EQ(SCM_VALUEPACKET_VALUES(obj1), SCM_VALUEPACKET_VALUES(obj2)))
             return SCM_TRUE;
         break;
+
     case ScmEtc:
         break;
+
     case ScmFreeCell:
         SigScm_Error("equal? : cannnot compare freecell, gc broken?\n");
         break;
@@ -206,6 +220,7 @@
         if (SCM_C_POINTER_DATA(obj1) == SCM_C_POINTER_DATA(obj2))
             return SCM_TRUE;
         break;
+
     case ScmCFuncPointer:
         if (SCM_C_FUNCPOINTER_FUNC(obj1) == SCM_C_FUNCPOINTER_FUNC(obj2))
             return SCM_TRUE;
@@ -651,7 +666,7 @@
 /*==============================================================================
   R5RS : 6.2 Numbers : 6.2.6 Numerical input and output
 ==============================================================================*/
-ScmObj ScmOp_number_to_string (ScmObj args, ScmObj env)
+ScmObj ScmOp_number2string (ScmObj args, ScmObj env)
 {
   char buf[sizeof(int)*CHAR_BIT + 1];
   char *p;
@@ -708,7 +723,7 @@
 }
 
 /* TODO : support radix */
-ScmObj ScmOp_string_to_number(ScmObj string)
+ScmObj ScmOp_string2number(ScmObj string)
 {
     char  *str = NULL;
     char  *p   = NULL;
@@ -807,7 +822,7 @@
     else
         SigScm_ErrorObj("set-car! : pair required but got ", pair);
 
-    return SCM_UNSPECIFIED;
+    return SCM_TRUE;
 }
 
 ScmObj ScmOp_setcdr(ScmObj pair, ScmObj cdr)
@@ -817,7 +832,7 @@
     else
         SigScm_ErrorObj("set-cdr! : pair required but got ", pair);
 
-    return SCM_UNSPECIFIED;
+    return SCM_TRUE;
 }
 
 ScmObj ScmOp_caar(ScmObj pair)
@@ -1192,7 +1207,7 @@
     return (SCM_SYMBOLP(obj)) ? SCM_TRUE : SCM_FALSE;
 }
 
-ScmObj ScmOp_symbol_to_string(ScmObj obj)
+ScmObj ScmOp_symbol2string(ScmObj obj)
 {
     if (!SCM_SYMBOLP(obj))
         SigScm_ErrorObj("symbol->string: symbol required, but got ", obj);
@@ -1200,7 +1215,7 @@
     return Scm_NewStringCopying(SCM_SYMBOL_NAME(obj));
 }
 
-ScmObj ScmOp_string_to_symbol(ScmObj str)
+ScmObj ScmOp_string2symbol(ScmObj str)
 {
     if(!SCM_STRINGP(str))
         SigScm_ErrorObj("string->symbol: string required, but got ", str);
@@ -1391,7 +1406,7 @@
 
 ScmObj ScmOp_string(ScmObj arg, ScmObj env)
 {
-    return ScmOp_list_to_string(arg);
+    return ScmOp_list2string(arg);
 }
 
 ScmObj ScmOp_string_length(ScmObj str)
@@ -1473,7 +1488,7 @@
 
     SCM_SETSTRING_STR(str, new_str);
 
-    return SCM_UNSPECIFIED;
+    return str;
 }
 
 ScmObj ScmOp_string_equal(ScmObj str1, ScmObj str2)
@@ -1559,7 +1574,7 @@
     return Scm_NewString_With_StrLen(new_str, total_len);
 }
 
-ScmObj ScmOp_string_to_list(ScmObj string)
+ScmObj ScmOp_string2list(ScmObj string)
 {
     char *string_str = NULL;
     int   str_len    = 0;
@@ -1599,7 +1614,7 @@
     return head;
 }
 
-ScmObj ScmOp_list_to_string(ScmObj list)
+ScmObj ScmOp_list2string(ScmObj list)
 {
     int total_size = 0;
     ScmObj chars   = SCM_NIL;
@@ -1671,7 +1686,7 @@
 
     SCM_SETSTRING_STR(string, new_str);
 
-    return SCM_UNSPECIFIED;
+    return string;
 }
 
 /*==============================================================================
@@ -1698,7 +1713,7 @@
     vec = (ScmObj*)malloc(sizeof(ScmObj) * c_k);
 
     /* fill vector */
-    fill = SCM_UNSPECIFIED;
+    fill = SCM_UNDEF;
     if (!SCM_NULLP(SCM_CDR(arg)) && !SCM_NULLP(SCM_CAR(SCM_CDR(arg))))
         fill = SCM_CAR(SCM_CDR(arg));
 
@@ -1752,10 +1767,10 @@
 
     SCM_SETVECTOR_REF(vec, scm_k, obj);
 
-    return SCM_UNSPECIFIED;
+    return vec;
 }
 
-ScmObj ScmOp_vector_to_list(ScmObj vec)
+ScmObj ScmOp_vector2list(ScmObj vec)
 {
     ScmObj *v    = NULL;
     ScmObj  prev = NULL;
@@ -1787,7 +1802,7 @@
     return head;
 }
 
-ScmObj ScmOp_list_to_vector(ScmObj list)
+ScmObj ScmOp_list2vector(ScmObj list)
 {
     ScmObj  scm_len = SCM_NIL;
     ScmObj *v       = NULL;
@@ -1822,7 +1837,7 @@
         SCM_VECTOR_VEC(vec)[i] = fill;
     }
 
-    return SCM_UNSPECIFIED;
+    return vec;
 }
 
 /*=======================================
@@ -1871,7 +1886,7 @@
     }
 
     /* 1proc and many args case */
-    arg_vector = ScmOp_list_to_vector(SCM_CDR(map_arg));
+    arg_vector = ScmOp_list2vector(SCM_CDR(map_arg));
     vector_len = SCM_VECTOR_LEN(arg_vector);
     while (1) {
         /* create arg */
@@ -1908,7 +1923,7 @@
 {
     ScmOp_map(arg, env);
 
-    return SCM_UNSPECIFIED;
+    return SCM_UNDEF;
 }
 
 ScmObj ScmOp_force(ScmObj arg, ScmObj env)

Modified: branches/r5rs/sigscheme/read.c
===================================================================
--- branches/r5rs/sigscheme/read.c	2005-08-22 06:10:51 UTC (rev 1274)
+++ branches/r5rs/sigscheme/read.c	2005-08-22 07:58:51 UTC (rev 1275)
@@ -180,44 +180,39 @@
         case '`':
             return read_quote(port, SCM_QUASIQUOTE);
         case ',':
-            {
-                SCM_PORT_GETC(port, c1);
-                if (c1 == EOF) {
-                    SigScm_Error("EOF in unquote\n");
-                } else if (c1 == '@') {
-                    return read_quote(port, SCM_UNQUOTE_SPLICING);
-                } else {
-                    SCM_PORT_UNGETC(port, c1);
-                    return read_quote(port, SCM_UNQUOTE);
-                }
+            SCM_PORT_GETC(port, c1);
+            if (c1 == EOF) {
+                SigScm_Error("EOF in unquote\n");
+            } else if (c1 == '@') {
+                return read_quote(port, SCM_UNQUOTE_SPLICING);
+            } else {
+                SCM_PORT_UNGETC(port, c1);
+                return read_quote(port, SCM_UNQUOTE);
             }
+            break;
         case '#':
-            {
-                SCM_PORT_GETC(port, c1);
-                switch (c1) {
-                case 't': case 'T':
-                    return SCM_TRUE;
-                case 'f': case 'F':
-                    return SCM_FALSE;
-                case '(':
-                    return ScmOp_list_to_vector(read_list(port, ')'));
-                case '\\':
-                    return read_char(port);
-                case EOF:
-                    SigScm_Error("end in #\n");
-                default:
-                    SigScm_Error("Unsupported # : %c\n", c1);
-                }
+            SCM_PORT_GETC(port, c1);
+            switch (c1) {
+            case 't': case 'T':
+                return SCM_TRUE;
+            case 'f': case 'F':
+                return SCM_FALSE;
+            case '(':
+                return ScmOp_list2vector(read_list(port, ')'));
+            case '\\':
+                return read_char(port);
+            case EOF:
+                SigScm_Error("end in #\n");
+            default:
+                SigScm_Error("Unsupported # : %c\n", c1);
             }
             break;
-
         /* Error sequence */
         case ')':
             SigScm_Error("invalid close parenthesis\n");
             break;
         case EOF:
             return SCM_EOF;
-
         default:
             SCM_PORT_UNGETC(port, c);
             return read_symbol(port);
@@ -350,37 +345,32 @@
         case EOF:
             SigScm_Error("EOF in the string\n");
             break;
+
         case '\"':
-            {
-                stringbuf[stringlen] = '\0';
-                return Scm_NewStringCopying(stringbuf);
-            }
-        case '\\':
-            {
-                /*
-                 * (R5RS) 6.3.5 String
-                 * A double quote can be written inside a string only by
-                 * escaping it with a backslash (\).
-                 */
-                SCM_PORT_GETC(port, c);
-                switch (c) {
-                case '\"': stringbuf[stringlen] = c;    break;
-                case 'n':  stringbuf[stringlen] = '\n'; break;
-                case 'r':  stringbuf[stringlen] = '\r'; break;
-                case 'f':  stringbuf[stringlen] = '\f'; break;
-                case 't':  stringbuf[stringlen] = '\t'; break;
-                default:
-                    stringbuf[stringlen] = '\\';
-                    stringbuf[++stringlen] = c;
-                    break;
-                }
-                stringlen++;
+            stringbuf[stringlen] = '\0';
+            return Scm_NewStringCopying(stringbuf);
 
-#if DEBUG_PARSER
-                printf("read_string following \\ : c = %c\n", c);
-#endif
+        case '\\':
+            /*
+             * (R5RS) 6.3.5 String
+             * A double quote can be written inside a string only by
+             * escaping it with a backslash (\).
+             */
+            SCM_PORT_GETC(port, c);
+            switch (c) {
+            case '\"': stringbuf[stringlen] = c;    break;
+            case 'n':  stringbuf[stringlen] = '\n'; break;
+            case 'r':  stringbuf[stringlen] = '\r'; break;
+            case 'f':  stringbuf[stringlen] = '\f'; break;
+            case 't':  stringbuf[stringlen] = '\t'; break;
+            default:
+                stringbuf[stringlen] = '\\';
+                stringbuf[++stringlen] = c;
+                break;
             }
+            stringlen++;
             break;
+
         default:
             stringbuf[stringlen] = c;
             stringlen++;
@@ -474,18 +464,15 @@
 #endif
 
         switch (c) {
-        case EOF: /*
-                   * don't became an error for handling c-eval.
-                   * Scm_eval_c_string("some-symbol");
-                   */
-        case ' ':
-        case '(':  case ')':  case ';':
+        case EOF: /* don't became an error for handling c-eval, like Scm_eval_c_string("some-symbol"); */
+        case ' ':  case '(':  case ')':  case ';':
         case '\n': case '\t': case '\"': case '\'':
             SCM_PORT_UNGETC(port, c);
             stringbuf[stringlen] = '\0';
             dst = (char *)malloc(strlen(stringbuf) + 1);
             strcpy(dst, stringbuf);
             return dst;
+
         default:
             stringbuf[stringlen] = (char)c;
             stringlen++;
@@ -521,6 +508,7 @@
                 stringlen++;
                 break;
             }
+            /* doesn't break */
         case '\n': case '\t':
             SCM_PORT_UNGETC(port, c);
             stringbuf[stringlen] = '\0';

Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c	2005-08-22 06:10:51 UTC (rev 1274)
+++ branches/r5rs/sigscheme/sigscheme.c	2005-08-22 07:58:51 UTC (rev 1275)
@@ -59,10 +59,10 @@
 
 ScmObj SigScm_nil, SigScm_true, SigScm_false, SigScm_eof;
 ScmObj SigScm_quote, SigScm_quasiquote, SigScm_unquote, SigScm_unquote_splicing;
-ScmObj SigScm_unbound, SigScm_unspecified, SigScm_undef;
+ScmObj SigScm_unbound, SigScm_undef;
 ScmObjInternal SigScm_nil_impl, SigScm_true_impl, SigScm_false_impl, SigScm_eof_impl;
 ScmObjInternal SigScm_quote_impl, SigScm_quasiquote_impl, SigScm_unquote_impl, SigScm_unquote_splicing_impl;
-ScmObjInternal SigScm_unbound_impl, SigScm_unspecified_impl, SigScm_undef_impl;
+ScmObjInternal SigScm_unbound_impl, SigScm_undef_impl;
 
 extern ScmObj continuation_thrown_obj, letrec_env;
 
@@ -86,8 +86,7 @@
     SCM_NEW_ETC(SigScm_false,            SigScm_false_impl,            3);
     SCM_NEW_ETC(SigScm_eof,              SigScm_eof_impl,              4);
     SCM_NEW_ETC(SigScm_unbound,          SigScm_unbound_impl,          9);
-    SCM_NEW_ETC(SigScm_unspecified,      SigScm_unspecified_impl,      10);
-    SCM_NEW_ETC(SigScm_undef,            SigScm_undef_impl,            11);
+    SCM_NEW_ETC(SigScm_undef,            SigScm_undef_impl,            10);
     /*=======================================================================
       Externed Variable Initialization
     =======================================================================*/
@@ -166,8 +165,8 @@
     Scm_RegisterFunc2("quotient"             , ScmOp_quotient);
     Scm_RegisterFunc2("modulo"               , ScmOp_modulo);
     Scm_RegisterFunc2("remainder"            , ScmOp_remainder);
-    Scm_RegisterFuncL("number->string"       , ScmOp_number_to_string);
-    Scm_RegisterFunc1("string->number"       , ScmOp_string_to_number);
+    Scm_RegisterFuncL("number->string"       , ScmOp_number2string);
+    Scm_RegisterFunc1("string->number"       , ScmOp_string2number);
     Scm_RegisterFunc1("not"                  , ScmOp_not);
     Scm_RegisterFunc1("boolean?"             , ScmOp_booleanp);
     Scm_RegisterFunc1("pair?"                , ScmOp_pairp);
@@ -219,8 +218,8 @@
     Scm_RegisterFunc2("assv"                 , ScmOp_assv);
     Scm_RegisterFunc2("assoc"                , ScmOp_assoc);
     Scm_RegisterFunc1("symbol?"              , ScmOp_symbolp);
-    Scm_RegisterFunc1("symbol->string"       , ScmOp_symbol_to_string);
-    Scm_RegisterFunc1("string->symbol"       , ScmOp_string_to_symbol);
+    Scm_RegisterFunc1("symbol->string"       , ScmOp_symbol2string);
+    Scm_RegisterFunc1("string->symbol"       , ScmOp_string2symbol);
     Scm_RegisterFunc1("char?"                , ScmOp_charp);
     Scm_RegisterFunc2("char=?"               , ScmOp_char_equal);
     Scm_RegisterFunc1("char-alphabetic?"     , ScmOp_char_alphabeticp);
@@ -239,8 +238,8 @@
     Scm_RegisterFunc2("string=?"             , ScmOp_string_equal);
     Scm_RegisterFunc3("substring"            , ScmOp_string_substring);
     Scm_RegisterFuncL("string-append"        , ScmOp_string_append);
-    Scm_RegisterFunc1("string->list"         , ScmOp_string_to_list);
-    Scm_RegisterFunc1("list->string"         , ScmOp_list_to_string);
+    Scm_RegisterFunc1("string->list"         , ScmOp_string2list);
+    Scm_RegisterFunc1("list->string"         , ScmOp_list2string);
     Scm_RegisterFunc1("string-copy"          , ScmOp_string_copy);
     Scm_RegisterFunc2("string-fill!"         , ScmOp_string_fill);
     Scm_RegisterFunc1("vector?"              , ScmOp_vectorp);
@@ -249,8 +248,8 @@
     Scm_RegisterFunc1("vector-length"        , ScmOp_vector_length);
     Scm_RegisterFunc2("vector-ref"           , ScmOp_vector_ref);
     Scm_RegisterFunc3("vector-set!"          , ScmOp_vector_set);
-    Scm_RegisterFunc1("vector->list"         , ScmOp_vector_to_list);
-    Scm_RegisterFunc1("list->vector"         , ScmOp_list_to_vector);
+    Scm_RegisterFunc1("vector->list"         , ScmOp_vector2list);
+    Scm_RegisterFunc1("list->vector"         , ScmOp_list2vector);
     Scm_RegisterFunc2("vector-fill!"         , ScmOp_vector_fill);
     Scm_RegisterFunc1("procedure?"           , ScmOp_procedurep);
     Scm_RegisterFuncL("map"                  , ScmOp_map);

Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2005-08-22 06:10:51 UTC (rev 1274)
+++ branches/r5rs/sigscheme/sigscheme.h	2005-08-22 07:58:51 UTC (rev 1275)
@@ -228,8 +228,8 @@
 ScmObj ScmOp_quotient(ScmObj n1, ScmObj n2);
 ScmObj ScmOp_modulo(ScmObj n1, ScmObj n2);
 ScmObj ScmOp_remainder(ScmObj n1, ScmObj n2);
-ScmObj ScmOp_number_to_string(ScmObj args, ScmObj env);
-ScmObj ScmOp_string_to_number(ScmObj string);
+ScmObj ScmOp_number2string(ScmObj args, ScmObj env);
+ScmObj ScmOp_string2number(ScmObj string);
 ScmObj ScmOp_not(ScmObj obj);
 ScmObj ScmOp_booleanp(ScmObj obj);
 ScmObj ScmOp_pairp(ScmObj obj);
@@ -281,8 +281,8 @@
 ScmObj ScmOp_assv(ScmObj obj, ScmObj alist);
 ScmObj ScmOp_assoc(ScmObj obj, ScmObj alist);
 ScmObj ScmOp_symbolp(ScmObj obj);
-ScmObj ScmOp_symbol_to_string(ScmObj obj);
-ScmObj ScmOp_string_to_symbol(ScmObj str);
+ScmObj ScmOp_symbol2string(ScmObj obj);
+ScmObj ScmOp_string2symbol(ScmObj str);
 
 ScmObj ScmOp_charp(ScmObj obj);
 ScmObj ScmOp_char_equal(ScmObj ch1, ScmObj ch2);
@@ -305,8 +305,8 @@
 /* TODO : many comparing functions around string is unimplemented */
 ScmObj ScmOp_string_substring(ScmObj str, ScmObj start, ScmObj end);
 ScmObj ScmOp_string_append(ScmObj arg, ScmObj env);
-ScmObj ScmOp_string_to_list(ScmObj string);
-ScmObj ScmOp_list_to_string(ScmObj list);
+ScmObj ScmOp_string2list(ScmObj string);
+ScmObj ScmOp_list2string(ScmObj list);
 ScmObj ScmOp_string_copy(ScmObj string);
 ScmObj ScmOp_string_fill(ScmObj string, ScmObj ch);
 
@@ -316,8 +316,8 @@
 ScmObj ScmOp_vector_length(ScmObj vector);
 ScmObj ScmOp_vector_ref(ScmObj vec, ScmObj k);
 ScmObj ScmOp_vector_set(ScmObj vec, ScmObj k, ScmObj obj);
-ScmObj ScmOp_vector_to_list(ScmObj vec);
-ScmObj ScmOp_list_to_vector(ScmObj list);
+ScmObj ScmOp_vector2list(ScmObj vec);
+ScmObj ScmOp_list2vector(ScmObj list);
 ScmObj ScmOp_vector_fill(ScmObj vec, ScmObj fill);
 ScmObj ScmOp_procedurep(ScmObj obj);
 ScmObj ScmOp_map(ScmObj arg, ScmObj env);
@@ -386,13 +386,13 @@
 void SigScm_DisplayToPort(ScmObj port, ScmObj obj);
 
 #if USE_SRFI1
-ScmObj ScmOp_SRFI_1_xcons(ScmObj a, ScmObj b);
-ScmObj ScmOp_SRFI_1_cons_star(ScmObj obj, ScmObj env);
-ScmObj ScmOp_SRFI_1_make_list(ScmObj obj, ScmObj env);
-ScmObj ScmOp_SRFI_1_list_tabulate(ScmObj arg, ScmObj env);
-ScmObj ScmOp_SRFI_1_list_copy(ScmObj list);
-ScmObj ScmOp_SRFI_1_circular_list(ScmObj list, ScmObj env);
-ScmObj ScmOp_SRFI_1_iota(ScmObj args, ScmObj env);
+ScmObj ScmOp_SRFI1_xcons(ScmObj a, ScmObj b);
+ScmObj ScmOp_SRFI1_cons_star(ScmObj obj, ScmObj env);
+ScmObj ScmOp_SRFI1_make_list(ScmObj obj, ScmObj env);
+ScmObj ScmOp_SRFI1_list_tabulate(ScmObj arg, ScmObj env);
+ScmObj ScmOp_SRFI1_list_copy(ScmObj list);
+ScmObj ScmOp_SRFI1_circular_list(ScmObj list, ScmObj env);
+ScmObj ScmOp_SRFI1_iota(ScmObj args, ScmObj env);
 #endif
 #if USE_SRFI8
 ScmObj ScmOp_SRFI_8_receive(ScmObj args, ScmObj *envp, int *tail_flag);

Modified: branches/r5rs/sigscheme/sigschemetype.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype.h	2005-08-22 06:10:51 UTC (rev 1274)
+++ branches/r5rs/sigscheme/sigschemetype.h	2005-08-22 07:58:51 UTC (rev 1275)
@@ -373,7 +373,7 @@
 
 extern ScmObj SigScm_nil, SigScm_true, SigScm_false, SigScm_eof;
 extern ScmObj SigScm_quote, SigScm_quasiquote, SigScm_unquote, SigScm_unquote_splicing;
-extern ScmObj SigScm_unbound, SigScm_unspecified, SigScm_undef;
+extern ScmObj SigScm_unbound, SigScm_undef;
 
 #define SCM_NIL              SigScm_nil
 #define SCM_TRUE             SigScm_true
@@ -384,7 +384,6 @@
 #define SCM_UNQUOTE          SigScm_unquote
 #define SCM_UNQUOTE_SPLICING SigScm_unquote_splicing
 #define SCM_UNBOUND          SigScm_unbound
-#define SCM_UNSPECIFIED      SigScm_unspecified
 #define SCM_UNDEF            SigScm_undef
 
 #define EQ(a, b) ((a) == (b))
@@ -393,7 +392,6 @@
 #define SCM_EQ(a, b)  (EQ((a), (b)))
 #define SCM_NEQ(a, b) (NEQ((a), (b)))
 #define SCM_NULLP(a)  (EQ((a), SCM_NIL))
-#define SCM_TRUEP(a)  (EQ((a), SCM_TRUE))
 #define SCM_FALSEP(a) (EQ((a), SCM_FALSE))
 #define SCM_EOFP(a)   (EQ((a), SCM_EOF))
 



More information about the uim-commit mailing list