1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

* More references to SCM_CHARS removed.

This commit is contained in:
Dirk Herrmann 2000-09-26 19:40:10 +00:00
parent 3db4adfced
commit 9eb364fccb
3 changed files with 22 additions and 6 deletions

View file

@ -1,3 +1,14 @@
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

View file

@ -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

View file

@ -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;