summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2000-09-26 22:15:13 +0000
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2000-09-26 22:15:13 +0000
commit322ac0c5ccbeee968e3bd5b44398a5921b2fa311 (patch)
tree149f8083a36a5c98e602a639513af596f1414814
parent405aaef9327daf0d07c507a18914e856db6bbc43 (diff)
downloadguile-322ac0c5ccbeee968e3bd5b44398a5921b2fa311.tar.gz
* Eliminated all calls to SCM_UCHARS.
-rw-r--r--libguile/strings.c8
-rw-r--r--libguile/strop.c43
-rw-r--r--libguile/strports.c2
-rw-r--r--libguile/symbols.c10
-rw-r--r--libguile/symbols.h2
-rw-r--r--libguile/unif.c10
6 files changed, 30 insertions, 45 deletions
diff --git a/libguile/strings.c b/libguile/strings.c
index 872cdc33b..7174d5c84 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -109,7 +109,7 @@ SCM_DEFINE (scm_string, "string", 0, 0, 1,
}
{
- unsigned char *data = SCM_UCHARS (result);
+ unsigned char *data = SCM_STRING_UCHARS (result);
while (SCM_NNULLP (chrs))
{
@@ -226,7 +226,7 @@ SCM_DEFINE (scm_make_string, "make-string", 1, 1, 0,
{
SCM_VALIDATE_CHAR (2,chr);
{
- unsigned char *dst = SCM_UCHARS (res);
+ unsigned char *dst = SCM_STRING_UCHARS (res);
char c = SCM_CHAR (chr);
memset (dst, c, i);
@@ -270,7 +270,7 @@ SCM_DEFINE (scm_string_set_x, "string-set!", 3, 0, 0,
SCM_VALIDATE_RWSTRING (1,str);
SCM_VALIDATE_INUM_RANGE (2,k,0,SCM_LENGTH(str));
SCM_VALIDATE_CHAR (3,chr);
- SCM_UCHARS (str)[SCM_INUM (k)] = SCM_CHAR (chr);
+ SCM_STRING_UCHARS (str)[SCM_INUM (k)] = SCM_CHAR (chr);
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
@@ -320,7 +320,7 @@ SCM_DEFINE (scm_string_append, "string-append", 0, 0, 1,
i += SCM_ROLENGTH (s);
}
res = scm_makstr (i, 0);
- data = SCM_UCHARS (res);
+ data = SCM_STRING_UCHARS (res);
for (l = args;SCM_NIMP (l);l = SCM_CDR (l)) {
s = SCM_CAR (l);
for (i = 0;i<SCM_ROLENGTH (s);i++) *data++ = SCM_ROUCHARS (s)[i];
diff --git a/libguile/strop.c b/libguile/strop.c
index 4c40c7d36..49302167c 100644
--- a/libguile/strop.c
+++ b/libguile/strop.c
@@ -375,21 +375,13 @@ SCM_DEFINE (scm_string_upcase_x, "string-upcase!", 1, 0, 0,
"@end example")
#define FUNC_NAME s_scm_string_upcase_x
{
- register long k;
- register unsigned char *cs;
- SCM_ASRTGO (SCM_NIMP (v), badarg1);
- k = SCM_LENGTH (v);
- switch SCM_TYP7
- (v)
- {
- case scm_tc7_string:
- cs = SCM_UCHARS (v);
- while (k--)
- cs[k] = scm_upcase(cs[k]);
- break;
- default:
- badarg1:SCM_WTA (1,v);
- }
+ unsigned long k;
+
+ SCM_VALIDATE_STRING (1, v);
+
+ for (k = 0; k < SCM_LENGTH (v); ++k)
+ SCM_STRING_UCHARS (v) [k] = scm_upcase (SCM_STRING_UCHARS (v) [k]);
+
return v;
}
#undef FUNC_NAME
@@ -417,20 +409,13 @@ SCM_DEFINE (scm_string_downcase_x, "string-downcase!", 1, 0, 0,
"@end example")
#define FUNC_NAME s_scm_string_downcase_x
{
- register long k;
- register unsigned char *cs;
- SCM_ASRTGO (SCM_NIMP (v), badarg1);
- k = SCM_LENGTH (v);
- switch (SCM_TYP7(v))
- {
- case scm_tc7_string:
- cs = SCM_UCHARS (v);
- while (k--)
- cs[k] = scm_downcase(cs[k]);
- break;
- default:
- badarg1:SCM_WTA (1,v);
- }
+ unsigned long k;
+
+ SCM_VALIDATE_STRING (1, v);
+
+ for (k = 0; k < SCM_LENGTH (v); ++k)
+ SCM_STRING_UCHARS (v) [k] = scm_downcase (SCM_STRING_UCHARS (v) [k]);
+
return v;
}
#undef FUNC_NAME
diff --git a/libguile/strports.c b/libguile/strports.c
index 026c5cdae..fb736cc83 100644
--- a/libguile/strports.c
+++ b/libguile/strports.c
@@ -106,7 +106,7 @@ st_resize_port (scm_port *pt, off_t new_size)
/* reset buffer in case reallocation moved the string. */
{
- pt->read_buf = pt->write_buf = SCM_UCHARS (stream);
+ pt->read_buf = pt->write_buf = SCM_STRING_UCHARS (stream);
pt->read_pos = pt->write_pos = pt->write_buf + index;
pt->write_end = pt->write_buf + pt->write_buf_size;
pt->read_end = pt->read_buf + pt->read_buf_size;
diff --git a/libguile/symbols.c b/libguile/symbols.c
index 956400d9b..0e477f9fb 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_UCHARS (sym), SCM_LENGTH (sym)) % scm_symhash_dim;
+ = scm_string_hash (SCM_SYMBOL_UCHARS (sym), SCM_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_UCHARS (sym), SCM_LENGTH (sym)) % SCM_LENGTH (obarray);
+ = scm_string_hash (SCM_SYMBOL_UCHARS (sym), SCM_LENGTH (sym)) % SCM_LENGTH (obarray);
SCM_REDEFER_INTS;
for (lsym = SCM_VELTS (obarray)[hash];
SCM_NIMP (lsym);
@@ -264,7 +264,7 @@ scm_intern_obarray_soft (const char *name,scm_sizet len,SCM obarray,unsigned int
scm_sizet i;
SCM a = SCM_CAR (lsym);
SCM z = SCM_CAR (a);
- unsigned char *tmp = SCM_UCHARS (z);
+ unsigned char *tmp = SCM_SYMBOL_UCHARS (z);
if (SCM_LENGTH (z) != len)
goto trynext;
for (i = len; i--;)
@@ -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_UCHARS (s), SCM_LENGTH (s)) % SCM_LENGTH (o);
+ hval = scm_string_hash (SCM_SYMBOL_UCHARS (s), SCM_LENGTH (s)) % SCM_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_UCHARS (s), SCM_LENGTH (s)) % SCM_LENGTH (o);
+ hval = scm_string_hash (SCM_SYMBOL_UCHARS (s), SCM_LENGTH (s)) % SCM_LENGTH (o);
SCM_DEFER_INTS;
{
SCM lsym_follow;
diff --git a/libguile/symbols.h b/libguile/symbols.h
index b9aab4b4a..d974a506b 100644
--- a/libguile/symbols.h
+++ b/libguile/symbols.h
@@ -64,7 +64,6 @@ extern int scm_symhash_dim;
#define SCM_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8)
#define SCM_SETLENGTH(x, v, t) (SCM_SET_CELL_WORD_0 ((x), ((v) << 8) + (t)))
-#define SCM_UCHARS(x) ((unsigned char *) (SCM_CELL_WORD_1 (x)))
#define SCM_SETCHARS(x, v) (SCM_SET_CELL_WORD_1 ((x), (scm_bits_t) (v)))
#define SCM_PROP_SLOTS(X) (SCM_CELL_WORD_3 (X))
@@ -137,6 +136,7 @@ extern void scm_init_symbols (void);
#if (SCM_DEBUG_DEPRECATED == 0)
#define SCM_CHARS(x) ((char *) (SCM_CELL_WORD_1 (x)))
+#define SCM_UCHARS(x) ((unsigned char *) (SCM_CELL_WORD_1 (x)))
#define SCM_SLOPPY_SUBSTRP(x) (SCM_SUBSTRP (x))
#define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n))
diff --git a/libguile/unif.c b/libguile/unif.c
index 32df60237..738270aa6 100644
--- a/libguile/unif.c
+++ b/libguile/unif.c
@@ -1138,7 +1138,7 @@ SCM_DEFINE (scm_uniform_vector_ref, "uniform-vector-ref", 2, 0, 0,
else
return SCM_BOOL_F;
case scm_tc7_string:
- return SCM_MAKE_CHAR (SCM_UCHARS (v)[pos]);
+ return SCM_MAKE_CHAR (SCM_STRING_UCHARS (v)[pos]);
case scm_tc7_byvect:
return SCM_MAKINUM (((char *) SCM_UVECTOR_BASE (v))[pos]);
case scm_tc7_uvect:
@@ -1183,7 +1183,7 @@ scm_cvref (SCM v, scm_sizet pos, SCM last)
else
return SCM_BOOL_F;
case scm_tc7_string:
- return SCM_MAKE_CHAR (SCM_UCHARS (v)[pos]);
+ return SCM_MAKE_CHAR (SCM_STRING_UCHARS (v)[pos]);
case scm_tc7_byvect:
return SCM_MAKINUM (((char *) SCM_UVECTOR_BASE (v))[pos]);
case scm_tc7_uvect:
@@ -1294,7 +1294,7 @@ SCM_DEFINE (scm_array_set_x, "array-set!", 2, 0, 1,
break;
case scm_tc7_string:
SCM_ASRTGO (SCM_CHARP (obj), badobj);
- SCM_UCHARS (v)[pos] = SCM_CHAR (obj);
+ SCM_STRING_UCHARS (v)[pos] = SCM_CHAR (obj);
break;
case scm_tc7_byvect:
if (SCM_CHARP (obj))
@@ -2301,12 +2301,12 @@ tail:
break;
case scm_tc7_string:
if (n-- > 0)
- scm_iprin1 (SCM_MAKE_CHAR (SCM_UCHARS (ra)[j]), port, pstate);
+ scm_iprin1 (SCM_MAKE_CHAR (SCM_STRING_UCHARS (ra)[j]), port, pstate);
if (SCM_WRITINGP (pstate))
for (j += inc; n-- > 0; j += inc)
{
scm_putc (' ', port);
- scm_iprin1 (SCM_MAKE_CHAR (SCM_UCHARS (ra)[j]), port, pstate);
+ scm_iprin1 (SCM_MAKE_CHAR (SCM_STRING_UCHARS (ra)[j]), port, pstate);
}
else
for (j += inc; n-- > 0; j += inc)