[uim-commit] r2661 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Dec 20 03:59:05 PST 2005
Author: yamaken
Date: 2005-12-20 03:59:00 -0800 (Tue, 20 Dec 2005)
New Revision: 2661
Modified:
branches/r5rs/sigscheme/eval.c
branches/r5rs/sigscheme/operations.c
branches/r5rs/sigscheme/print.c
branches/r5rs/sigscheme/storage-compact.h
branches/r5rs/sigscheme/storage-fatty.h
branches/r5rs/sigscheme/test-compact.c
Log:
* sigscheme/storage-fatty.h
- (SCM_VECTOR_CREF, SCM_VECTOR_SET_CREF, SCM_VECTOR_REF,
SCM_VECTOR_SET_REF, SCM_VECTOR_CHECK_IDX): Removed
* sigscheme/storage-compact.h
- (SCM_VECTOR_CREF, SCM_VECTOR_SET_CREF, SCM_VECTOR_REF,
SCM_VECTOR_SET_REF, SCM_VECTOR_CHECK_IDX): Removed
- (SCM_SAL_VECTOR_VALID_INDEXP): New macro
* sigscheme/test-compact.c
- (scm_check_vector): Follow the removal
* sigscheme/operations.c
- (scm_p_equalp, scm_p_vector_ref, scm_p_vector_setd): Ditto
* sigscheme/eval.c
- (TRV_GET_OBJ): Ditto
* sigscheme/print.c
- (write_ss_scan): Ditto
Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c 2005-12-20 09:09:16 UTC (rev 2660)
+++ branches/r5rs/sigscheme/eval.c 2005-12-20 11:59:00 UTC (rev 2661)
@@ -722,7 +722,7 @@
(_t).u.vec.index = 0, \
(_t).u.vec.growth = 0, \
(_t).trans = vectran)
-#define TRV_GET_OBJ(_t) (SCM_VECTOR_CREF((_t).u.vec.src, (_t).u.vec.index))
+#define TRV_GET_OBJ(_t) (SCM_VECTOR_VEC((_t).u.vec.src)[(_t).u.vec.index])
#define TRV_NEXT(_t) (++(_t).u.vec.index)
#define TRV_ENDP(_t) (SCM_VECTOR_LEN((_t).u.vec.src) <= (_t).u.vec.index)
#define TRV_EXTRACT(_t) (TRV_CALL((_t), TR_MSG_EXTRACT, SCM_INVALID))
Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c 2005-12-20 09:09:16 UTC (rev 2660)
+++ branches/r5rs/sigscheme/operations.c 2005-12-20 11:59:00 UTC (rev 2661)
@@ -167,8 +167,8 @@
return SCM_FALSE;
for (i = 0; i < SCM_VECTOR_LEN(obj1); i++) {
- elm1 = SCM_VECTOR_CREF(obj1, i);
- elm2 = SCM_VECTOR_CREF(obj2, i);
+ elm1 = SCM_VECTOR_VEC(obj1)[i];
+ elm2 = SCM_VECTOR_VEC(obj2)[i];
if (!EQ(elm1, elm2)
&& (SCM_TYPE(elm1) != SCM_TYPE(elm2)
|| FALSEP(scm_p_equalp(elm1, elm2))))
@@ -1602,31 +1602,35 @@
ScmObj
scm_p_vector_ref(ScmObj vec, ScmObj scm_k)
{
+ int k;
DECLARE_FUNCTION("vector-ref", procedure_fixed_2);
ASSERT_VECTORP(vec);
ASSERT_INTP(scm_k);
- /* sanity check */
- if (SCM_INT_VALUE(scm_k) < 0 || SCM_VECTOR_LEN(vec) <= SCM_INT_VALUE(scm_k))
+ k = SCM_INT_VALUE(scm_k);
+
+ if (!SCM_VECTOR_VALID_INDEXP(vec, k))
ERR_OBJ("index out of range", scm_k);
- return SCM_VECTOR_REF(vec, scm_k);
+ return SCM_VECTOR_VEC(vec)[k];
}
ScmObj
scm_p_vector_setd(ScmObj vec, ScmObj scm_k, ScmObj obj)
{
+ int k;
DECLARE_FUNCTION("vector-set!", procedure_fixed_3);
ASSERT_VECTORP(vec);
ASSERT_INTP(scm_k);
- /* sanity check */
- if (SCM_INT_VALUE(scm_k) < 0 || SCM_VECTOR_LEN(vec) <= SCM_INT_VALUE(scm_k))
+ k = SCM_INT_VALUE(scm_k);
+
+ if (!SCM_VECTOR_VALID_INDEXP(vec, k))
ERR_OBJ("index out of range", scm_k);
- SCM_VECTOR_SET_REF(vec, scm_k, obj);
+ SCM_VECTOR_VEC(vec)[k] = obj;
return SCM_UNDEF;
}
Modified: branches/r5rs/sigscheme/print.c
===================================================================
--- branches/r5rs/sigscheme/print.c 2005-12-20 09:09:16 UTC (rev 2660)
+++ branches/r5rs/sigscheme/print.c 2005-12-20 11:59:00 UTC (rev 2661)
@@ -614,7 +614,7 @@
case ScmVector:
for (i=0; i < SCM_VECTOR_LEN(obj); i++)
- write_ss_scan(SCM_VECTOR_CREF(obj, i), ctx);
+ write_ss_scan(SCM_VECTOR_VEC(obj)[i], ctx);
break;
default:
Modified: branches/r5rs/sigscheme/storage-compact.h
===================================================================
--- branches/r5rs/sigscheme/storage-compact.h 2005-12-20 09:09:16 UTC (rev 2660)
+++ branches/r5rs/sigscheme/storage-compact.h 2005-12-20 11:59:00 UTC (rev 2661)
@@ -760,14 +760,8 @@
SCM_OTHERS_SET_CAR_VAL((a), (val))
#define SCM_SAL_VECTOR_SET_LEN(a, val) \
SCM_OTHERS_SET_CDR_VAL((a), VECTOR, (val))
-/* backward compatibility */
-#define SCM_VECTOR_CREF(a, idx) (SCM_VECTOR_VEC(a)[idx])
-#define SCM_VECTOR_SET_CREF(a, idx, b) (SCM_VECTOR_CREF((a), (idx)) = (b))
-#define SCM_VECTOR_REF(a, idx) (SCM_VECTOR_CREF((a), SCM_INT_VALUE(idx)))
-#define SCM_VECTOR_SET_REF(a, idx, b) (SCM_VECTOR_REF((a), (idx)) = (b))
-#define SCM_VECTOR_CHECK_IDX(a, idx) ()
+#define SCM_SAL_VECTOR_VALID_INDEXP(o, i) (0 <= (i) && (i) < SCM_VECTOR_LEN(o))
-
/*
* ValuePacket
*/
Modified: branches/r5rs/sigscheme/storage-fatty.h
===================================================================
--- branches/r5rs/sigscheme/storage-fatty.h 2005-12-20 09:09:16 UTC (rev 2660)
+++ branches/r5rs/sigscheme/storage-fatty.h 2005-12-20 11:59:00 UTC (rev 2661)
@@ -244,12 +244,6 @@
#define SCM_SAL_VECTOR_LEN(a) (SCM_AS_VECTOR(a)->obj.vector.len)
#define SCM_SAL_VECTOR_SET_LEN(a, len) (SCM_VECTOR_LEN(a) = (len))
#define SCM_SAL_VECTOR_VALID_INDEXP(o, i) (0 <= (i) && (i) < SCM_VECTOR_LEN(o))
-/* backward compatibility */
-#define SCM_VECTOR_CREF(a, idx) (SCM_VECTOR_VEC(a)[idx])
-#define SCM_VECTOR_SET_CREF(a, idx, b) (SCM_VECTOR_CREF((a), (idx)) = (b))
-#define SCM_VECTOR_REF(a, idx) (SCM_VECTOR_CREF((a), SCM_INT_VALUE(idx)))
-#define SCM_VECTOR_SET_REF(a, idx, b) (SCM_VECTOR_REF((a), (idx)) = (b))
-#define SCM_VECTOR_CHECK_IDX(a, idx) ()
#define SCM_SAL_PORTP(a) (SCM_TYPE(a) == ScmPort)
#define SCM_SAL_ENTYPE_PORT(a) (SCM_ENTYPE((a), ScmPort))
Modified: branches/r5rs/sigscheme/test-compact.c
===================================================================
--- branches/r5rs/sigscheme/test-compact.c 2005-12-20 09:09:16 UTC (rev 2660)
+++ branches/r5rs/sigscheme/test-compact.c 2005-12-20 11:59:00 UTC (rev 2661)
@@ -501,15 +501,15 @@
check_type(ScmVector, obj);
SCM_ASSERT(SCM_VECTOR_LEN(obj) == len);
- SCM_VECTOR_SET_CREF(obj, 0, scm_check_int(11));
+ SCM_VECTOR_VEC(obj)[0] = scm_check_int(11);
check_type(ScmVector, obj);
- SCM_ASSERT(SCM_INTP(SCM_VECTOR_CREF(obj, 0)));
- SCM_ASSERT(SCM_INT_VALUE(SCM_VECTOR_CREF(obj, 0)) == 11);
+ SCM_ASSERT(SCM_INTP(SCM_VECTOR_VEC(obj)[0]));
+ SCM_ASSERT(SCM_INT_VALUE(SCM_VECTOR_VEC(obj)[0]) == 11);
- SCM_VECTOR_SET_CREF(obj, 0, scm_check_int(3));
+ SCM_VECTOR_VEC(obj)[0] = scm_check_int(3);
check_type(ScmVector, obj);
- SCM_ASSERT(SCM_INTP(SCM_VECTOR_CREF(obj, 0)));
- SCM_ASSERT(SCM_INT_VALUE(SCM_VECTOR_CREF(obj, 0)) == 3);
+ SCM_ASSERT(SCM_INTP(SCM_VECTOR_VEC(obj)[0]));
+ SCM_ASSERT(SCM_INT_VALUE(SCM_VECTOR_VEC(obj)[0]) == 3);
/* marked state */
SCM_DO_MARK(obj);
@@ -525,15 +525,15 @@
check_type(ScmVector, obj);
SCM_ASSERT(SCM_VECTOR_LEN(obj) == len);
- SCM_VECTOR_SET_CREF(obj, 0, scm_check_int(11));
+ SCM_VECTOR_VEC(obj)[0] = scm_check_int(11);
check_type(ScmVector, obj);
- SCM_ASSERT(SCM_INTP(SCM_VECTOR_CREF(obj, 0)));
- SCM_ASSERT(SCM_INT_VALUE(SCM_VECTOR_CREF(obj, 0)) == 11);
+ SCM_ASSERT(SCM_INTP(SCM_VECTOR_VEC(obj)[0]));
+ SCM_ASSERT(SCM_INT_VALUE(SCM_VECTOR_VEC(obj)[0]) == 11);
- SCM_VECTOR_SET_CREF(obj, 0, scm_check_int(3));
+ SCM_VECTOR_VEC(obj)[0] = scm_check_int(3);
check_type(ScmVector, obj);
- SCM_ASSERT(SCM_INTP(SCM_VECTOR_CREF(obj, 0)));
- SCM_ASSERT(SCM_INT_VALUE(SCM_VECTOR_CREF(obj, 0)) == 3);
+ SCM_ASSERT(SCM_INTP(SCM_VECTOR_VEC(obj)[0]));
+ SCM_ASSERT(SCM_INT_VALUE(SCM_VECTOR_VEC(obj)[0]) == 3);
return obj;
}
More information about the uim-commit
mailing list