summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/ChangeLog17
-rw-r--r--libguile/filesys.c34
-rw-r--r--libguile/gh_data.c36
-rw-r--r--libguile/posix.c8
-rw-r--r--libguile/regex-posix.c4
-rw-r--r--libguile/stime.c7
-rw-r--r--libguile/symbols.c24
-rw-r--r--libguile/validate.h4
8 files changed, 75 insertions, 59 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 8c1232e0b..567403fa3 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,5 +1,22 @@
2000-10-09 Dirk Herrmann <D.Herrmann@tu-bs.de>
+ * filesys.c (fill_select_type, retrieve_select_type, scm_select),
+ gh_data.c (gh_set_substr, gh_scm2chars, gh_scm2shorts,
+ gh_scm2longs, gh_scm2floats, gh_scm2doubles, gh_symbol2newstr),
+ stime.c (bdtime2c), symbols.c (scm_sym2vcell, scm_sym2ovcell_soft,
+ scm_intern_obarray_soft, scm_symbol_to_string, scm_intern_symbol,
+ scm_unintern_symbol, copy_and_prune_obarray, scm_builtin_bindings,
+ scm_builtin_weak_bindings), validate.h (SCM_VALIDATE_VECTOR_LEN):
+ Replace SCM_LENGTH with the appropriate SCM_<type>_LENGTH macro.
+
+ * filesys.c (scm_dirname, scm_basename), gh_data.c (gh_scm2newstr,
+ gh_get_substr), posix.c (scm_putenv), regex-posix.c
+ (scm_regexp_exec), stime.c (setzone), symbols.c
+ (scm_string_to_symbol): Don't accept symbols as input parameters
+ any more.
+
+2000-10-09 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
* continuations.c (scm_make_cont, copy_stack_and_call,
scm_dynthrow), environments.c (obarray_enter, obarray_replace,
obarray_retrieve, obarray_remove, obarray_remove_all,
diff --git a/libguile/filesys.c b/libguile/filesys.c
index 4a2c67659..4f282d438 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -879,7 +879,7 @@ fill_select_type (SELECT_TYPE *set, SCM *ports_ready, SCM list_or_vec, int pos)
if (SCM_VECTORP (list_or_vec))
{
- int i = SCM_LENGTH (list_or_vec);
+ int i = SCM_VECTOR_LENGTH (list_or_vec);
SCM *ve = SCM_VELTS (list_or_vec);
while (--i >= 0)
@@ -940,7 +940,7 @@ retrieve_select_type (SELECT_TYPE *set, SCM ports_ready, SCM list_or_vec)
if (SCM_VECTORP (list_or_vec))
{
- int i = SCM_LENGTH (list_or_vec);
+ int i = SCM_VECTOR_LENGTH (list_or_vec);
SCM *ve = SCM_VELTS (list_or_vec);
while (--i >= 0)
@@ -1009,7 +1009,7 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
if (SCM_VECTORP (reads))
{
- read_count = SCM_LENGTH (reads);
+ read_count = SCM_VECTOR_LENGTH (reads);
}
else
{
@@ -1018,7 +1018,7 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
}
if (SCM_VECTORP (writes))
{
- write_count = SCM_LENGTH (writes);
+ write_count = SCM_VECTOR_LENGTH (writes);
}
else
{
@@ -1027,7 +1027,7 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
}
if (SCM_VECTORP (excepts))
{
- except_count = SCM_LENGTH (excepts);
+ except_count = SCM_VECTOR_LENGTH (excepts);
}
else
{
@@ -1330,10 +1330,14 @@ SCM_DEFINE (scm_dirname, "dirname", 1, 0, 0,
#define FUNC_NAME s_scm_dirname
{
char *s;
- int i, len;
- SCM_VALIDATE_ROSTRING (1,filename);
+ long int i;
+ unsigned long int len;
+
+ SCM_VALIDATE_STRING (1,filename);
+
s = SCM_ROCHARS (filename);
- len = SCM_LENGTH (filename);
+ len = SCM_STRING_LENGTH (filename);
+
i = len - 1;
while (i >= 0 && s[i] == '/') --i;
while (i >= 0 && s[i] != '/') --i;
@@ -1357,21 +1361,19 @@ SCM_DEFINE (scm_basename, "basename", 1, 1, 0,
{
char *f, *s = 0;
int i, j, len, end;
- SCM_VALIDATE_ROSTRING (1,filename);
- SCM_ASSERT (SCM_UNBNDP (suffix)
- || (SCM_ROSTRINGP (suffix)),
- suffix,
- SCM_ARG2,
- FUNC_NAME);
+
+ SCM_VALIDATE_STRING (1,filename);
f = SCM_ROCHARS (filename);
+ len = SCM_STRING_LENGTH (filename);
+
if (SCM_UNBNDP (suffix))
j = -1;
else
{
+ SCM_VALIDATE_STRING (2, suffix);
s = SCM_ROCHARS (suffix);
- j = SCM_LENGTH (suffix) - 1;
+ j = SCM_STRING_LENGTH (suffix) - 1;
}
- len = SCM_LENGTH (filename);
i = len - 1;
while (i >= 0 && f[i] == '/') --i;
end = i;
diff --git a/libguile/gh_data.c b/libguile/gh_data.c
index 5987ae7f6..9972f96e6 100644
--- a/libguile/gh_data.c
+++ b/libguile/gh_data.c
@@ -117,7 +117,7 @@ gh_set_substr (char *src, SCM dst, int start, int len)
"gh_set_substr");
dst_ptr = SCM_STRING_CHARS (dst);
- dst_len = SCM_LENGTH (dst);
+ dst_len = SCM_STRING_LENGTH (dst);
SCM_ASSERT (len >= 0 && (unsigned) len <= dst_len,
dst, SCM_ARG4, "gh_set_substr");
@@ -277,7 +277,7 @@ gh_scm2chars (SCM obj, char *m)
{
case scm_tc7_vector:
case scm_tc7_wvect:
- n = SCM_LENGTH (obj);
+ n = SCM_VECTOR_LENGTH (obj);
for (i = 0; i < n; ++i)
{
val = SCM_VELTS (obj)[i];
@@ -325,7 +325,7 @@ gh_scm2shorts (SCM obj, short *m)
{
case scm_tc7_vector:
case scm_tc7_wvect:
- n = SCM_LENGTH (obj);
+ n = SCM_VECTOR_LENGTH (obj);
for (i = 0; i < n; ++i)
{
val = SCM_VELTS (obj)[i];
@@ -345,7 +345,7 @@ gh_scm2shorts (SCM obj, short *m)
break;
#ifdef HAVE_ARRAYS
case scm_tc7_svect:
- n = SCM_LENGTH (obj);
+ n = SCM_UVECTOR_LENGTH (obj);
if (m == 0)
m = (short *) malloc (n * sizeof (short));
memcpy (m, SCM_VELTS (obj), n * sizeof (short));
@@ -370,7 +370,7 @@ gh_scm2longs (SCM obj, long *m)
{
case scm_tc7_vector:
case scm_tc7_wvect:
- n = SCM_LENGTH (obj);
+ n = SCM_VECTOR_LENGTH (obj);
for (i = 0; i < n; ++i)
{
val = SCM_VELTS (obj)[i];
@@ -388,7 +388,7 @@ gh_scm2longs (SCM obj, long *m)
#ifdef HAVE_ARRAYS
case scm_tc7_ivect:
case scm_tc7_uvect:
- n = SCM_LENGTH (obj);
+ n = SCM_UVECTOR_LENGTH (obj);
if (m == 0)
m = (long *) malloc (n * sizeof (long));
memcpy (m, SCM_VELTS (obj), n * sizeof (long));
@@ -413,7 +413,7 @@ gh_scm2floats (SCM obj, float *m)
{
case scm_tc7_vector:
case scm_tc7_wvect:
- n = SCM_LENGTH (obj);
+ n = SCM_VECTOR_LENGTH (obj);
for (i = 0; i < n; ++i)
{
val = SCM_VELTS (obj)[i];
@@ -436,14 +436,14 @@ gh_scm2floats (SCM obj, float *m)
break;
#ifdef HAVE_ARRAYS
case scm_tc7_fvect:
- n = SCM_LENGTH (obj);
+ n = SCM_UVECTOR_LENGTH (obj);
if (m == 0)
m = (float *) malloc (n * sizeof (float));
memcpy (m, (float *) SCM_VELTS (obj), n * sizeof (float));
break;
case scm_tc7_dvect:
- n = SCM_LENGTH (obj);
+ n = SCM_UVECTOR_LENGTH (obj);
if (m == 0)
m = (float*) malloc (n * sizeof (float));
for (i = 0; i < n; ++i)
@@ -469,7 +469,7 @@ gh_scm2doubles (SCM obj, double *m)
{
case scm_tc7_vector:
case scm_tc7_wvect:
- n = SCM_LENGTH (obj);
+ n = SCM_VECTOR_LENGTH (obj);
for (i = 0; i < n; ++i)
{
val = SCM_VELTS (obj)[i];
@@ -492,7 +492,7 @@ gh_scm2doubles (SCM obj, double *m)
break;
#ifdef HAVE_ARRAYS
case scm_tc7_fvect:
- n = SCM_LENGTH (obj);
+ n = SCM_UVECTOR_LENGTH (obj);
if (m == 0)
m = (double *) malloc (n * sizeof (double));
for (i = 0; i < n; ++i)
@@ -500,7 +500,7 @@ gh_scm2doubles (SCM obj, double *m)
break;
case scm_tc7_dvect:
- n = SCM_LENGTH (obj);
+ n = SCM_UVECTOR_LENGTH (obj);
if (m == 0)
m = (double*) malloc (n * sizeof (double));
memcpy (m, SCM_VELTS (obj), n * sizeof (double));
@@ -532,13 +532,12 @@ gh_scm2newstr (SCM str, int *lenp)
char *ret_str;
int len;
- SCM_ASSERT (SCM_ROSTRINGP (str), str, SCM_ARG3,
- "gh_scm2newstr");
+ SCM_ASSERT (SCM_STRINGP (str), str, SCM_ARG3, "gh_scm2newstr");
/* protect str from GC while we copy off its data */
scm_protect_object (str);
- len = SCM_LENGTH (str);
+ len = SCM_STRING_LENGTH (str);
ret_str = (char *) scm_must_malloc ((len + 1) * sizeof (char),
"gh_scm2newstr");
@@ -569,11 +568,10 @@ void
gh_get_substr (SCM src, char *dst, int start, int len)
{
int src_len, effective_length;
- SCM_ASSERT (SCM_ROSTRINGP (src), src, SCM_ARG3,
- "gh_get_substr");
+ SCM_ASSERT (SCM_STRINGP (src), src, SCM_ARG3, "gh_get_substr");
scm_protect_object (src);
- src_len = SCM_LENGTH (src);
+ src_len = SCM_STRING_LENGTH (src);
effective_length = (len < src_len) ? len : src_len;
memcpy (dst + start, SCM_ROCHARS (src), effective_length * sizeof (char));
/* FIXME: must signal an error if len > src_len */
@@ -600,7 +598,7 @@ gh_symbol2newstr (SCM sym, int *lenp)
/* protect str from GC while we copy off its data */
scm_protect_object (sym);
- len = SCM_LENGTH (sym);
+ len = SCM_SYMBOL_LENGTH (sym);
ret_str = (char *) scm_must_malloc ((len + 1) * sizeof (char),
"gh_symbol2newstr");
diff --git a/libguile/posix.c b/libguile/posix.c
index 2d9d98038..309fa7ab6 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1134,13 +1134,13 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
int rv;
char *ptr;
- SCM_VALIDATE_ROSTRING (1,str);
+ SCM_VALIDATE_STRING (1, str);
/* must make a new copy to be left in the environment, safe from gc. */
- ptr = malloc (SCM_LENGTH (str) + 1);
+ ptr = malloc (SCM_STRING_LENGTH (str) + 1);
if (ptr == NULL)
SCM_MEMORY_ERROR;
- strncpy (ptr, SCM_ROCHARS (str), SCM_LENGTH (str));
- ptr[SCM_LENGTH(str)] = 0;
+ strncpy (ptr, SCM_ROCHARS (str), SCM_STRING_LENGTH (str));
+ ptr[SCM_STRING_LENGTH (str)] = 0;
rv = putenv (ptr);
if (rv < 0)
SCM_SYSERROR;
diff --git a/libguile/regex-posix.c b/libguile/regex-posix.c
index bf941c568..d706bd6ba 100644
--- a/libguile/regex-posix.c
+++ b/libguile/regex-posix.c
@@ -232,9 +232,9 @@ SCM_DEFINE (scm_regexp_exec, "regexp-exec", 2, 2, 0,
SCM mvec = SCM_BOOL_F;
SCM_VALIDATE_RGXP (1,rx);
- SCM_VALIDATE_ROSTRING (2,str);
+ SCM_VALIDATE_STRING (2,str);
SCM_VALIDATE_INUM_DEF_COPY (3,start,0,offset);
- SCM_ASSERT_RANGE (3,start,offset >= 0 && (unsigned) offset <= SCM_LENGTH (str));
+ SCM_ASSERT_RANGE (3,start, offset >= 0 && offset <= SCM_STRING_LENGTH (str));
if (SCM_UNBNDP (flags))
flags = SCM_INUM0;
SCM_VALIDATE_INUM (4,flags);
diff --git a/libguile/stime.c b/libguile/stime.c
index b10e7278c..6e99a008c 100644
--- a/libguile/stime.c
+++ b/libguile/stime.c
@@ -306,10 +306,9 @@ setzone (SCM zone, int pos, const char *subr)
static char *tmpenv[2];
char *buf;
- SCM_ASSERT (SCM_ROSTRINGP (zone), zone, pos, subr);
+ SCM_ASSERT (SCM_STRINGP (zone), zone, pos, subr);
SCM_COERCE_SUBSTR (zone);
- buf = scm_must_malloc (SCM_LENGTH (zone) + sizeof (tzvar) + 1,
- subr);
+ buf = scm_must_malloc (SCM_STRING_LENGTH (zone) + sizeof (tzvar) + 1, subr);
sprintf (buf, "%s=%s", tzvar, SCM_ROCHARS (zone));
oldenv = environ;
tmpenv[0] = buf;
@@ -437,7 +436,7 @@ bdtime2c (SCM sbd_time, struct tm *lt, int pos, const char *subr)
int i;
SCM_ASSERT (SCM_VECTORP (sbd_time)
- && SCM_LENGTH (sbd_time) == 11,
+ && SCM_VECTOR_LENGTH (sbd_time) == 11,
sbd_time, pos, subr);
velts = SCM_VELTS (sbd_time);
for (i = 0; i < 10; i++)
diff --git a/libguile/symbols.c b/libguile/symbols.c
index 0e477f9fb..e40f4278a 100644
--- a/libguile/symbols.c
+++ b/libguile/symbols.c
@@ -144,7 +144,7 @@ scm_sym2vcell (SCM sym, SCM thunk, SCM definep)
SCM * lsymp;
SCM z;
scm_sizet hash
- = scm_string_hash (SCM_SYMBOL_UCHARS (sym), SCM_LENGTH (sym)) % scm_symhash_dim;
+ = scm_string_hash (SCM_SYMBOL_UCHARS (sym), SCM_SYMBOL_LENGTH (sym)) % scm_symhash_dim;
SCM_DEFER_INTS;
for (lsym = SCM_VELTS (scm_symhash)[hash]; SCM_NIMP (lsym); lsym = SCM_CDR (lsym))
@@ -189,7 +189,7 @@ scm_sym2ovcell_soft (SCM sym, SCM obarray)
{
SCM lsym, z;
scm_sizet hash
- = scm_string_hash (SCM_SYMBOL_UCHARS (sym), SCM_LENGTH (sym)) % SCM_LENGTH (obarray);
+ = scm_string_hash (SCM_SYMBOL_UCHARS (sym), SCM_SYMBOL_LENGTH (sym)) % SCM_VECTOR_LENGTH (obarray);
SCM_REDEFER_INTS;
for (lsym = SCM_VELTS (obarray)[hash];
SCM_NIMP (lsym);
@@ -256,7 +256,7 @@ scm_intern_obarray_soft (const char *name,scm_sizet len,SCM obarray,unsigned int
goto uninterned_symbol;
}
- hash = raw_hash % SCM_LENGTH (obarray);
+ hash = raw_hash % SCM_VECTOR_LENGTH (obarray);
retry_new_obarray:
for (lsym = SCM_VELTS (obarray)[hash]; SCM_NIMP (lsym); lsym = SCM_CDR (lsym))
@@ -265,7 +265,7 @@ scm_intern_obarray_soft (const char *name,scm_sizet len,SCM obarray,unsigned int
SCM a = SCM_CAR (lsym);
SCM z = SCM_CAR (a);
unsigned char *tmp = SCM_SYMBOL_UCHARS (z);
- if (SCM_LENGTH (z) != len)
+ if (SCM_SYMBOL_LENGTH (z) != len)
goto trynext;
for (i = len; i--;)
if (((unsigned char *) name)[i] != tmp[i])
@@ -460,7 +460,7 @@ SCM_DEFINE (scm_symbol_to_string, "symbol->string", 1, 0, 0,
#define FUNC_NAME s_scm_symbol_to_string
{
SCM_VALIDATE_SYMBOL (1, s);
- return scm_makfromstr (SCM_SYMBOL_CHARS (s), SCM_LENGTH (s), 0);
+ return scm_makfromstr (SCM_SYMBOL_CHARS (s), SCM_SYMBOL_LENGTH (s), 0);
}
#undef FUNC_NAME
@@ -497,8 +497,8 @@ SCM_DEFINE (scm_string_to_symbol, "string->symbol", 1, 0, 0,
SCM vcell;
SCM answer;
- SCM_VALIDATE_ROSTRING (1,s);
- vcell = scm_intern(SCM_ROCHARS(s), (scm_sizet)SCM_LENGTH(s));
+ SCM_VALIDATE_STRING (1,s);
+ vcell = scm_intern (SCM_ROCHARS (s), SCM_STRING_LENGTH (s));
answer = SCM_CAR (vcell);
return answer;
}
@@ -557,7 +557,7 @@ SCM_DEFINE (scm_intern_symbol, "intern-symbol", 2, 0, 0,
if (SCM_FALSEP (o))
o = scm_symhash;
SCM_VALIDATE_VECTOR (1,o);
- hval = scm_string_hash (SCM_SYMBOL_UCHARS (s), SCM_LENGTH (s)) % SCM_LENGTH (o);
+ hval = scm_string_hash (SCM_SYMBOL_UCHARS (s), SCM_SYMBOL_LENGTH (s)) % SCM_VECTOR_LENGTH (o);
/* If the symbol is already interned, simply return. */
SCM_REDEFER_INTS;
{
@@ -594,7 +594,7 @@ SCM_DEFINE (scm_unintern_symbol, "unintern-symbol", 2, 0, 0,
if (SCM_FALSEP (o))
o = scm_symhash;
SCM_VALIDATE_VECTOR (1,o);
- hval = scm_string_hash (SCM_SYMBOL_UCHARS (s), SCM_LENGTH (s)) % SCM_LENGTH (o);
+ hval = scm_string_hash (SCM_SYMBOL_UCHARS (s), SCM_SYMBOL_LENGTH (s)) % SCM_VECTOR_LENGTH (o);
SCM_DEFER_INTS;
{
SCM lsym_follow;
@@ -764,7 +764,7 @@ static void
copy_and_prune_obarray (SCM from, SCM to)
{
int i;
- int length = SCM_LENGTH (from);
+ int length = SCM_VECTOR_LENGTH (from);
for (i = 0; i < length; ++i)
{
SCM head = SCM_VELTS (from)[i]; /* GC protection */
@@ -791,7 +791,7 @@ SCM_DEFINE (scm_builtin_bindings, "builtin-bindings", 0, 0, 0,
"unbound symbols.")
#define FUNC_NAME s_scm_builtin_bindings
{
- int length = SCM_LENGTH (scm_symhash);
+ int length = SCM_VECTOR_LENGTH (scm_symhash);
SCM obarray = scm_make_vector (SCM_MAKINUM (length), SCM_EOL);
copy_and_prune_obarray (scm_symhash, obarray);
return obarray;
@@ -804,7 +804,7 @@ SCM_DEFINE (scm_builtin_weak_bindings, "builtin-weak-bindings", 0, 0, 0,
"")
#define FUNC_NAME s_scm_builtin_weak_bindings
{
- int length = SCM_LENGTH (scm_weak_symhash);
+ int length = SCM_VECTOR_LENGTH (scm_weak_symhash);
SCM obarray = scm_make_doubly_weak_hash_table (SCM_MAKINUM (length));
copy_and_prune_obarray (scm_weak_symhash, obarray);
return obarray;
diff --git a/libguile/validate.h b/libguile/validate.h
index c07b04fb4..76277a43d 100644
--- a/libguile/validate.h
+++ b/libguile/validate.h
@@ -1,4 +1,4 @@
-/* $Id: validate.h,v 1.16 2000-09-26 21:53:49 dirk Exp $ */
+/* $Id: validate.h,v 1.17 2000-10-09 16:27:24 dirk Exp $ */
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@@ -413,7 +413,7 @@
#define SCM_VALIDATE_VECTOR_LEN(pos, v, len) \
do { \
- SCM_ASSERT (SCM_VECTORP (v) && len == SCM_LENGTH (v), v, pos, FUNC_NAME); \
+ SCM_ASSERT (SCM_VECTORP (v) && len == SCM_VECTOR_LENGTH (v), v, pos, FUNC_NAME); \
} while (0)
#endif