diff options
-rw-r--r-- | libguile/ChangeLog | 11 | ||||
-rw-r--r-- | libguile/numbers.c | 6 | ||||
-rw-r--r-- | libguile/vectors.c | 11 |
3 files changed, 22 insertions, 6 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog index c3c13dfe9..4f61dbcce 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,5 +1,16 @@ 2000-09-26 Dirk Herrmann <D.Herrmann@tu-bs.de> + * numbers.c (scm_adjbig): Use SCM_BDIGITS instead of SCM_CHARS. + + (big2str, scm_bigprint): Use SCM_STRING_CHARS instead of + SCM_CHARS. + + * vectors.c (scm_vector_set_length_x): Distinguish between + strings, scheme vectors and uniform vectors, thus getting rid of + references to SCM_CHARS. (The code still needs improvement.) + +2000-09-26 Dirk Herrmann <D.Herrmann@tu-bs.de> + * eval.c (scm_m_letrec1, SCM_CEVAL, SCM_APPLY): Use SCM_STRING_U?CHARS or SCM_SYMBOL_U?CHARS instead of SCM_U?CHARS. diff --git a/libguile/numbers.c b/libguile/numbers.c index 590e46cca..c997a4852 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -1363,7 +1363,7 @@ scm_adjbig (SCM b, scm_sizet nlen) { SCM_BIGDIG *digits = ((SCM_BIGDIG *) - scm_must_realloc ((char *) SCM_CHARS (b), + scm_must_realloc ((char *) SCM_BDIGITS (b), (long) (SCM_NUMDIGS (b) * sizeof (SCM_BIGDIG)), (long) (nsiz * sizeof (SCM_BIGDIG)), s_bignum)); @@ -2179,7 +2179,7 @@ big2str (SCM b, unsigned int radix) scm_sizet ch; /* jeh */ SCM_BIGDIG radpow = 1, radmod = 0; SCM ss = scm_makstr ((long) j, 0); - char *s = SCM_CHARS (ss), c; + char *s = SCM_STRING_CHARS (ss), c; while ((long) radpow * radix < SCM_BIGRAD) { radpow *= radix; @@ -2271,7 +2271,7 @@ scm_bigprint (SCM exp, SCM port, scm_print_state *pstate) { #ifdef SCM_BIGDIG exp = big2str (exp, (unsigned int) 10); - scm_lfwrite (SCM_CHARS (exp), (scm_sizet) SCM_LENGTH (exp), port); + scm_lfwrite (SCM_STRING_CHARS (exp), (scm_sizet) SCM_LENGTH (exp), port); #else scm_ipruk ("bignum", exp, port); #endif diff --git a/libguile/vectors.c b/libguile/vectors.c index f066f92b2..eeca93439 100644 --- a/libguile/vectors.c +++ b/libguile/vectors.c @@ -71,6 +71,7 @@ scm_vector_set_length_x (SCM vect, SCM len) long l; scm_sizet siz; scm_sizet sz; + char *base; l = SCM_INUM (len); SCM_ASRTGO (SCM_NIMP (vect), badarg1); @@ -81,7 +82,9 @@ scm_vector_set_length_x (SCM vect, SCM len) l = (l + SCM_LONG_BIT - 1) / SCM_LONG_BIT; } sz = scm_uniform_element_size (vect); - if (sz == 0) + if (sz != 0) + base = SCM_UVECTOR_BASE (vect); + else #endif switch (SCM_TYP7 (vect)) { @@ -90,12 +93,14 @@ scm_vector_set_length_x (SCM vect, SCM len) case scm_tc7_string: SCM_ASRTGO (!SCM_EQ_P (vect, scm_nullstr), badarg1); sz = sizeof (char); + base = SCM_STRING_CHARS (vect); l++; break; case scm_tc7_vector: case scm_tc7_wvect: SCM_ASRTGO (!SCM_EQ_P (vect, scm_nullvect), badarg1); sz = sizeof (SCM); + base = (char *) SCM_VECTOR_BASE (vect); break; } SCM_ASSERT (SCM_INUMP (len), len, SCM_ARG2, s_vector_set_length_x); @@ -107,7 +112,7 @@ scm_vector_set_length_x (SCM vect, SCM len) SCM_REDEFER_INTS; SCM_SETCHARS (vect, ((char *) - scm_must_realloc (SCM_CHARS (vect), + scm_must_realloc (base, (long) SCM_LENGTH (vect) * sz, (long) siz, s_vector_set_length_x))); @@ -118,7 +123,7 @@ scm_vector_set_length_x (SCM vect, SCM len) SCM_VELTS (vect)[--l] = SCM_UNSPECIFIED; } else if (SCM_STRINGP (vect)) - SCM_CHARS (vect)[l - 1] = 0; + SCM_STRING_CHARS (vect)[l - 1] = 0; SCM_SETLENGTH (vect, SCM_INUM (len), SCM_TYP7 (vect)); SCM_REALLOW_INTS; return vect; |