diff --git a/NEWS b/NEWS index dca5b9aee..dd1d5df83 100644 --- a/NEWS +++ b/NEWS @@ -257,7 +257,8 @@ Use these instead of SCM_SETLENGTH SCM_VECTOR_BASE, SCM_UVECTOR_BASE, SCM_BITVECTOR_BASE, SCM_COMPLEX_MEM, SCM_ARRAY_MEM -Use these instead of SCM_CHARS or SCM_VELTS. +Use these instead of SCM_CHARS, SCM_UCHARS, SCM_ROCHARS, SCM_ROUCHARS or +SCM_VELTS. ** New macros: SCM_SET_BIGNUM_BASE, SCM_SET_STRING_CHARS, SCM_SET_SYMBOL_CHARS, SCM_SET_UVECTOR_BASE, SCM_SET_BITVECTOR_BASE, diff --git a/libguile/ChangeLog b/libguile/ChangeLog index f3d90c0f5..f45b998c8 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,12 @@ +2000-11-28 Dirk Herrmann + + * struct.c (scm_struct_ref, scm_struct_set_x), symbols.c + (scm_intern_obarray_soft), symbols.h (SCM_ROUCHARS): Eliminate + use of SCM_SYMBOL_UCHARS by using chars instead of unsigned + chars. + + (SCM_SYMBOL_UCHARS): Removed. + 2000-11-26 Gary Houston * reimplementation of values, call-with-values as primitives: diff --git a/libguile/struct.c b/libguile/struct.c index e6e0c5ec6..56de9c5c0 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -566,8 +566,8 @@ SCM_DEFINE (scm_struct_ref, "struct-ref", 2, 0, 0, SCM layout; int p; scm_bits_t n_fields; - unsigned char * fields_desc; - unsigned char field_type = 0; + char * fields_desc; + char field_type = 0; SCM_VALIDATE_STRUCT (1,handle); @@ -577,14 +577,14 @@ SCM_DEFINE (scm_struct_ref, "struct-ref", 2, 0, 0, data = SCM_STRUCT_DATA (handle); p = SCM_INUM (pos); - fields_desc = SCM_SYMBOL_UCHARS (layout); + fields_desc = SCM_SYMBOL_CHARS (layout); n_fields = data[scm_struct_i_n_words]; SCM_ASSERT_RANGE(1,pos, p < n_fields); if (p * 2 < SCM_SYMBOL_LENGTH (layout)) { - unsigned char ref; + char ref; field_type = fields_desc[p * 2]; ref = fields_desc[p * 2 + 1]; if ((ref != 'r') && (ref != 'w')) @@ -644,8 +644,8 @@ SCM_DEFINE (scm_struct_set_x, "struct-set!", 3, 0, 0, SCM layout; int p; int n_fields; - unsigned char * fields_desc; - unsigned char field_type = 0; + char * fields_desc; + char field_type = 0; SCM_VALIDATE_STRUCT (1,handle); SCM_VALIDATE_INUM (2,pos); @@ -654,14 +654,14 @@ SCM_DEFINE (scm_struct_set_x, "struct-set!", 3, 0, 0, data = SCM_STRUCT_DATA (handle); p = SCM_INUM (pos); - fields_desc = SCM_SYMBOL_UCHARS (layout); + fields_desc = SCM_SYMBOL_CHARS (layout); n_fields = data[scm_struct_i_n_words]; SCM_ASSERT_RANGE (1,pos, p < n_fields); if (p * 2 < SCM_SYMBOL_LENGTH (layout)) { - unsigned char set_x; + char set_x; field_type = fields_desc[p * 2]; set_x = fields_desc [p * 2 + 1]; if (set_x != 'w') diff --git a/libguile/symbols.c b/libguile/symbols.c index f3bd4a500..e4add2728 100644 --- a/libguile/symbols.c +++ b/libguile/symbols.c @@ -262,13 +262,13 @@ 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_SYMBOL_UCHARS (z); + char *tmp = SCM_SYMBOL_CHARS (z); if (SCM_SYMBOL_HASH (z) != raw_hash) goto trynext; if (SCM_SYMBOL_LENGTH (z) != len) goto trynext; for (i = len; i--;) - if (((unsigned char *) name)[i] != tmp[i]) + if (name[i] != tmp[i]) goto trynext; { SCM_REALLOW_INTS; diff --git a/libguile/symbols.h b/libguile/symbols.h index db846f2c7..2ce698652 100644 --- a/libguile/symbols.h +++ b/libguile/symbols.h @@ -56,12 +56,13 @@ extern int scm_symhash_dim; * SCM_SYMBOL_CHARS(SYM) is the address of the first character of SYM's name. */ -#define SCM_SYMBOLP(x) (SCM_NIMP (x) && (SCM_TYP7 (x) == scm_tc7_symbol)) -#define SCM_SYMBOL_UCHARS(x) ((unsigned char *) (SCM_CELL_WORD_1 (x))) -#define SCM_SYMBOL_CHARS(x) ((char *) (SCM_CELL_WORD_1 (x))) -#define SCM_SET_SYMBOL_CHARS(s, c) (SCM_SET_CELL_WORD_1 ((s), (c))) -#define SCM_SYMBOL_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8) +#define SCM_SYMBOLP(x) (SCM_NIMP (x) && (SCM_TYP7 (x) == scm_tc7_symbol)) +#define SCM_SYMBOL_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8) #define SCM_SET_SYMBOL_LENGTH(s, l) (SCM_SET_CELL_WORD_0 ((s), ((l) << 8) + scm_tc7_symbol)) +#define SCM_SYMBOL_CHARS(x) ((char *) (SCM_CELL_WORD_1 (x))) +#define SCM_SET_SYMBOL_CHARS(s, c) (SCM_SET_CELL_WORD_1 ((s), (c))) +#define SCM_SYMBOL_HASH(X) ((unsigned long) SCM_CELL_WORD_2 (X)) +#define SCM_SET_SYMBOL_HASH(X, v) (SCM_SET_CELL_WORD_2 ((X), (v))) #define SCM_PROP_SLOTS(X) (SCM_CELL_WORD_3 (X)) #define SCM_SET_PROP_SLOTS(X, v) (SCM_SET_CELL_WORD_3 ((X), (v))) @@ -69,8 +70,6 @@ extern int scm_symhash_dim; #define SCM_SET_SYMBOL_FUNC(X, v) (SCM_SETCAR (SCM_CELL_WORD_3 (X), (v))) #define SCM_SYMBOL_PROPS(X) (SCM_CDR (SCM_CELL_WORD_3 (X))) #define SCM_SET_SYMBOL_PROPS(X, v) (SCM_SETCDR (SCM_CELL_WORD_3 (X), (v))) -#define SCM_SYMBOL_HASH(X) (SCM_CELL_WORD_2 (X)) -#define SCM_SET_SYMBOL_HASH(X, v) (SCM_SET_CELL_WORD_2 ((X), (v))) @@ -132,7 +131,7 @@ extern void scm_init_symbols (void); ? (SCM_INUM (SCM_CADR (x)) + SCM_STRING_UCHARS (SCM_CDDR (x))) \ : ((SCM_TYP7 (x) == scm_tc7_string) \ ? SCM_STRING_UCHARS (x) \ - : SCM_SYMBOL_UCHARS (x))) + : (unsigned char *) SCM_SYMBOL_CHARS (x))) #define SCM_SUBSTRP(x) (SCM_NIMP (x) && (SCM_TYP7 (x) == scm_tc7_substring)) #define SCM_COERCE_SUBSTR(x) SCM_STRING_COERCE_0TERMINATION_X (x) #define scm_strhash(str, len, n) (scm_string_hash ((str), (len)) % (n))