summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS9
-rw-r--r--RELEASE2
-rw-r--r--libguile/ChangeLog15
-rw-r--r--libguile/gh_data.c2
-rw-r--r--libguile/numbers.c5
-rw-r--r--libguile/numbers.h1
-rw-r--r--libguile/strings.c4
-rw-r--r--libguile/strings.h1
-rw-r--r--libguile/symbols.c4
-rw-r--r--libguile/symbols.h4
-rw-r--r--libguile/unif.c6
-rw-r--r--libguile/unif.h2
-rw-r--r--libguile/vectors.c2
-rw-r--r--libguile/vectors.h1
14 files changed, 42 insertions, 16 deletions
diff --git a/NEWS b/NEWS
index 0df20a281..70442dea5 100644
--- a/NEWS
+++ b/NEWS
@@ -255,6 +255,12 @@ SCM_ARRAY_MEM
Use these instead of SCM_CHARS 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,
+SCM_SET_VECTOR_BASE
+
+Use these instead of SCM_SETCHARS.
+
** New macro: SCM_BITVECTOR_P
** New macro: SCM_STRING_COERCE_0TERMINATION_X
@@ -270,7 +276,7 @@ SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY,
SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH,
SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS,
-SCM_ROUCHARS, SCM_SETLENGTH
+SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS
Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
Use scm_memory_error instead of SCM_NALLOC.
@@ -287,6 +293,7 @@ Use SCM_VALIDATE_STRING instead of SCM_VALIDATE_RWSTRING.
Use SCM_STRING_CHARS instead of SCM_ROCHARS.
Use SCM_STRING_UCHARS instead of SCM_ROUCHARS.
Use a type specific setter macro instead of SCM_SETLENGTH.
+Use a type specific setter macro instead of SCM_SETCHARS.
** Removed function: scm_struct_init
diff --git a/RELEASE b/RELEASE
index 81fa9281d..6c1360325 100644
--- a/RELEASE
+++ b/RELEASE
@@ -50,7 +50,7 @@ In release 1.6:
SCM_VALIDATE_ROSTRING_COPY, SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH,
SCM_LENGTH, SCM_HUGE_LENGTH, SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET,
SCM_COERCE_SUBSTR, SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING,
- SCM_ROCHARS, SCM_ROUCHARS, SCM_SETLENGTH
+ SCM_ROCHARS, SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS
- remove scm_vector_set_length_x
- remove function scm_call_catching_errors
(replaced by catch functions from throw.[ch])
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 5d47dbfb5..3743abeb7 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,5 +1,20 @@
2000-11-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
+ * gh_data.c (makvect), numbers.c (scm_mkbig, scm_adjbig),
+ strings.c (scm_makstr, scm_take_str), symbols.c
+ (scm_intern_obarray_soft, scm_sysintern0_no_module_lookup), unif.c
+ (scm_make_uve), vectors.c (scm_make_vector): Use appropriate
+ SCM_SET_<type>_(CHARS|BASE) macro instead of SCM_SETCHARS.
+
+ * numbers.h (SCM_SET_BIGNUM_BASE), strings.h
+ (SCM_SET_STRING_CHARS), symbols.h (SCM_SET_SYMBOL_CHARS), unif.h
+ (SCM_SET_UVECTOR_BASE, SCM_SET_BITVECTOR_BASE), vectors.h
+ (SCM_SET_VECTOR_BASE): Added.
+
+ * symbols.c (SCM_SETCHARS): Deprecated.
+
+2000-11-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
* gc.c (scm_gc_sweep), unif.c (scm_make_uve): Don't allocate or
free memory for empty bitvectors.
diff --git a/libguile/gh_data.c b/libguile/gh_data.c
index c16526bcf..91403c363 100644
--- a/libguile/gh_data.c
+++ b/libguile/gh_data.c
@@ -169,7 +169,7 @@ makvect (char* m, int len, int type)
SCM ans;
SCM_NEWCELL (ans);
SCM_DEFER_INTS;
- SCM_SETCHARS (ans, m);
+ SCM_SET_UVECTOR_BASE (ans, m);
SCM_SET_UVECTOR_LENGTH (ans, len, type);
SCM_ALLOW_INTS;
return ans;
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 588c4a0e5..022c34cd9 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -1323,8 +1323,7 @@ scm_mkbig (scm_sizet nlen, int sign)
SCM_NEWCELL (v);
SCM_DEFER_INTS;
- SCM_SETCHARS (v, scm_must_malloc ((long) (nlen * sizeof (SCM_BIGDIG)),
- s_bignum));
+ SCM_SET_BIGNUM_BASE (v, scm_must_malloc (nlen * sizeof (SCM_BIGDIG), s_bignum));
SCM_SETNUMDIGS (v, nlen, sign);
SCM_ALLOW_INTS;
return v;
@@ -1366,7 +1365,7 @@ scm_adjbig (SCM b, scm_sizet nlen)
(long) (SCM_NUMDIGS (b) * sizeof (SCM_BIGDIG)),
(long) (nsiz * sizeof (SCM_BIGDIG)), s_bignum));
- SCM_SETCHARS (b, digits);
+ SCM_SET_BIGNUM_BASE (b, digits);
SCM_SETNUMDIGS (b, nsiz, SCM_BIGSIGN (b));
}
SCM_ALLOW_INTS;
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 2dc879ca4..6a78c5910 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -179,6 +179,7 @@
#define SCM_BIGSIZEFIELD 17
#define SCM_BIGSIGN(x) (SCM_CELL_WORD_0 (x) & SCM_BIGSIGNFLAG)
#define SCM_BDIGITS(x) ((SCM_BIGDIG *) (SCM_CELL_WORD_1 (x)))
+#define SCM_SET_BIGNUM_BASE(n, b) (SCM_SET_CELL_WORD_1 ((n), (b)))
#define SCM_NUMDIGS(x) ((scm_sizet) (SCM_CELL_WORD_0 (x) >> SCM_BIGSIZEFIELD))
#define SCM_SETNUMDIGS(x, v, sign) \
SCM_SET_CELL_WORD_0 (x, \
diff --git a/libguile/strings.c b/libguile/strings.c
index 470b3206f..677a1d4bd 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -132,7 +132,7 @@ scm_makstr (long len, int dummy)
mem[len] = 0;
SCM_NEWCELL (s);
- SCM_SETCHARS (s, mem);
+ SCM_SET_STRING_CHARS (s, mem);
SCM_SET_STRING_LENGTH (s, len);
return s;
@@ -170,7 +170,7 @@ scm_take_str (char *s, int len)
SCM_DEFER_INTS;
SCM_SET_STRING_LENGTH (answer, len);
scm_done_malloc (len + 1);
- SCM_SETCHARS (answer, s);
+ SCM_SET_STRING_CHARS (answer, s);
SCM_ALLOW_INTS;
return answer;
}
diff --git a/libguile/strings.h b/libguile/strings.h
index b19707af9..53a6e2ba9 100644
--- a/libguile/strings.h
+++ b/libguile/strings.h
@@ -56,6 +56,7 @@
#define SCM_STRING_UCHARS(x) ((unsigned char *) (SCM_CELL_WORD_1 (x)))
#define SCM_STRING_CHARS(x) ((char *) (SCM_CELL_WORD_1 (x)))
#endif
+#define SCM_SET_STRING_CHARS(s, c) (SCM_SET_CELL_WORD_1 ((s), (c)))
#define SCM_STRING_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8)
#define SCM_SET_STRING_LENGTH(s, l) (SCM_SET_CELL_WORD_0 ((s), ((l) << 8) + scm_tc7_string))
diff --git a/libguile/symbols.c b/libguile/symbols.c
index 074573100..f3bd4a500 100644
--- a/libguile/symbols.c
+++ b/libguile/symbols.c
@@ -291,7 +291,7 @@ scm_intern_obarray_soft (const char *name,scm_sizet len,SCM obarray,unsigned int
}
SCM_NEWCELL2 (lsym);
- SCM_SETCHARS (lsym, duplicate_string (name, len));
+ SCM_SET_SYMBOL_CHARS (lsym, duplicate_string (name, len));
SCM_SET_SYMBOL_HASH (lsym, raw_hash);
SCM_SET_PROP_SLOTS (lsym, scm_cons (SCM_BOOL_F, SCM_EOL));
SCM_SET_SYMBOL_LENGTH (lsym, (long) len);
@@ -366,7 +366,7 @@ scm_sysintern0_no_module_lookup (const char *name)
scm_sizet hash = raw_hash % scm_symhash_dim;
SCM_NEWCELL2 (lsym);
- SCM_SETCHARS (lsym, name);
+ SCM_SET_SYMBOL_CHARS (lsym, name);
SCM_SET_SYMBOL_HASH (lsym, raw_hash);
SCM_SET_PROP_SLOTS (lsym, scm_cons (SCM_BOOL_F, SCM_EOL));
SCM_SET_SYMBOL_LENGTH (lsym, (long) len);
diff --git a/libguile/symbols.h b/libguile/symbols.h
index 2e32a422f..949a28a81 100644
--- a/libguile/symbols.h
+++ b/libguile/symbols.h
@@ -59,13 +59,12 @@ extern int scm_symhash_dim;
#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_SET_SYMBOL_LENGTH(s, l) (SCM_SET_CELL_WORD_0 ((s), ((l) << 8) + scm_tc7_symbol))
#define SCM_LENGTH_MAX (0xffffffL)
-#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))
#define SCM_SET_PROP_SLOTS(X, v) (SCM_SET_CELL_WORD_3 ((X), (v)))
#define SCM_SYMBOL_FUNC(X) (SCM_CAR (SCM_CELL_WORD_3 (X)))
@@ -116,6 +115,7 @@ extern void scm_init_symbols (void);
#define SCM_CHARS(x) ((char *) (SCM_CELL_WORD_1 (x)))
#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_SLOPPY_SUBSTRP(x) (SCM_SUBSTRP (x))
#define SCM_SUBSTR_STR(x) (SCM_CDDR (x))
#define SCM_SUBSTR_OFFSET(x) (SCM_CADR (x))
diff --git a/libguile/unif.c b/libguile/unif.c
index 77f9e7a42..9af99a038 100644
--- a/libguile/unif.c
+++ b/libguile/unif.c
@@ -166,12 +166,12 @@ scm_make_uve (long k, SCM prot)
if (k > 0)
{
i = sizeof (long) * ((k + SCM_LONG_BIT - 1) / SCM_LONG_BIT);
- SCM_SETCHARS (v, (char *) scm_must_malloc (i, "vector"));
+ SCM_SET_BITVECTOR_BASE (v, (char *) scm_must_malloc (i, "vector"));
SCM_SET_BITVECTOR_LENGTH (v, k);
}
else
{
- SCM_SETCHARS (v, 0);
+ SCM_SET_BITVECTOR_BASE (v, 0);
SCM_SET_BITVECTOR_LENGTH (v, 0);
}
return v;
@@ -239,7 +239,7 @@ scm_make_uve (long k, SCM prot)
SCM_NEWCELL (v);
SCM_DEFER_INTS;
- SCM_SETCHARS (v, (char *) scm_must_malloc (i ? i : 1, "vector"));
+ SCM_SET_UVECTOR_BASE (v, (char *) scm_must_malloc (i ? i : 1, "vector"));
SCM_SET_UVECTOR_LENGTH (v, k, type);
SCM_ALLOW_INTS;
return v;
diff --git a/libguile/unif.h b/libguile/unif.h
index 4a859ce23..3ac772d6f 100644
--- a/libguile/unif.h
+++ b/libguile/unif.h
@@ -87,11 +87,13 @@ extern long scm_tc16_array;
#define SCM_ARRAY_DIMS(a) ((scm_array_dim *)((char *) SCM_ARRAY_MEM (a) + sizeof (scm_array)))
#define SCM_UVECTOR_BASE(x) ((void *) (SCM_CELL_WORD_1 (x)))
+#define SCM_SET_UVECTOR_BASE(v, b) (SCM_SET_CELL_WORD_1 ((v), (b)))
#define SCM_UVECTOR_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8)
#define SCM_SET_UVECTOR_LENGTH(v, l, t) (SCM_SET_CELL_WORD_0 ((v), ((l) << 8) + (t)))
#define SCM_BITVECTOR_P(x) (!SCM_IMP (x) && (SCM_TYP7 (x) == scm_tc7_bvect))
#define SCM_BITVECTOR_BASE(x) ((void *) (SCM_CELL_WORD_1 (x)))
+#define SCM_SET_BITVECTOR_BASE(v, b) (SCM_SET_CELL_WORD_1 ((v), (b)))
#define SCM_BITVECTOR_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8)
#define SCM_SET_BITVECTOR_LENGTH(v, l) (SCM_SET_CELL_WORD_0 ((v), ((l) << 8) + scm_tc7_bvect))
diff --git a/libguile/vectors.c b/libguile/vectors.c
index f4225c754..3848a8bbb 100644
--- a/libguile/vectors.c
+++ b/libguile/vectors.c
@@ -292,7 +292,7 @@ SCM_DEFINE (scm_make_vector, "make-vector", 1, 1, 0,
for (j = 0; j != i; ++j)
velts[j] = SCM_UNPACK (fill);
- SCM_SETCHARS (v, velts);
+ SCM_SET_VECTOR_BASE (v, velts);
SCM_SET_VECTOR_LENGTH (v, i, scm_tc7_vector);
}
SCM_ALLOW_INTS;
diff --git a/libguile/vectors.h b/libguile/vectors.h
index 3d64a1b91..69616f0ca 100644
--- a/libguile/vectors.h
+++ b/libguile/vectors.h
@@ -53,6 +53,7 @@
#define SCM_VECTORP(x) (SCM_NIMP (x) && (SCM_TYP7S (x) == scm_tc7_vector))
#define SCM_VECTOR_BASE(x) ((scm_bits_t *) SCM_CELL_WORD_1 (x))
+#define SCM_SET_VECTOR_BASE(v, b) (SCM_SET_CELL_WORD_1 ((v), (b)))
#define SCM_VECTOR_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8)
#define SCM_SET_VECTOR_LENGTH(v, l, t) (SCM_SET_CELL_WORD_0 ((v), ((l) << 8) + (t)))