1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 12:20:26 +02:00

* Deprecated SCM_LENGTH_MAX.

This commit is contained in:
Dirk Herrmann 2000-11-23 15:26:24 +00:00
parent 6a0476fd11
commit 5b9eb8ae16
6 changed files with 32 additions and 17 deletions

7
NEWS
View file

@ -237,6 +237,10 @@ collector has set this variable. But, this is an implementation detail that
may change. Further, scm_gc_heap_lock is not set throughout gc, thus the use
of this variable is (and has been) not fully safe anyway.
** New macros: SCM_BITVECTOR_MAX_LENGTH, SCM_UVECTOR_MAX_LENGTH
Use these instead of SCM_LENGTH_MAX.
** New macros: SCM_CONTINUATION_LENGTH, SCM_CCLO_LENGTH, SCM_STACK_LENGTH,
SCM_STRING_LENGTH, SCM_SYMBOL_LENGTH, SCM_UVECTOR_LENGTH,
SCM_BITVECTOR_LENGTH, SCM_VECTOR_LENGTH.
@ -276,7 +280,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_SETCHARS
SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX
Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
Use scm_memory_error instead of SCM_NALLOC.
@ -294,6 +298,7 @@ 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.
Use a type specific length macro instead of SCM_LENGTH_MAX.
** Removed function: scm_struct_init

View file

@ -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_SETCHARS
SCM_ROCHARS, SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX
- remove scm_vector_set_length_x
- remove function scm_call_catching_errors
(replaced by catch functions from throw.[ch])

View file

@ -1,4 +1,19 @@
2000-11-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
2000-11-23 Dirk Herrmann <D.Herrmann@tu-bs.de>
* symbols.h (SCM_LENGTH_MAX): Deprecated.
* unif.c (scm_make_uve): Use SCM_BITVECTOR_MAX_LENGTH and
SCM_UVECTOR_MAX_LENGTH instead of SCM_LENGTH_MAX. Postpone length
checks for strings and vectors to their constructors. Eliminate
redundant SCM_IMP test.
(scm_dimensions_to_uniform_array): Postpone length checks to
scm_make_uve.
* unif.h (SCM_BITVECTOR_MAX_LENGTH, SCM_UVECTOR_MAX_LENGTH):
Added.
2000-11-23 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

View file

@ -63,8 +63,6 @@ extern int scm_symhash_dim;
#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_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)))
@ -119,6 +117,7 @@ extern void scm_init_symbols (void);
#define SCM_SLOPPY_SUBSTRP(x) (SCM_SUBSTRP (x))
#define SCM_SUBSTR_STR(x) (SCM_CDDR (x))
#define SCM_SUBSTR_OFFSET(x) (SCM_CADR (x))
#define SCM_LENGTH_MAX (0xffffffL)
#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_ROSTRINGP(x) (SCM_NIMP(x) && ((SCM_TYP7S(x)==scm_tc7_string) \

View file

@ -158,13 +158,12 @@ scm_make_uve (long k, SCM prot)
SCM v;
long i, type;
SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_LENGTH_MAX);
if (SCM_EQ_P (prot, SCM_BOOL_T))
{
SCM_NEWCELL (v);
if (k > 0)
{
SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_BITVECTOR_MAX_LENGTH);
i = sizeof (long) * ((k + SCM_LONG_BIT - 1) / SCM_LONG_BIT);
SCM_SET_BITVECTOR_BASE (v, (char *) scm_must_malloc (i, "vector"));
SCM_SET_BITVECTOR_LENGTH (v, k);
@ -216,8 +215,7 @@ scm_make_uve (long k, SCM prot)
return scm_make_vector (SCM_MAKINUM (k), SCM_UNDEFINED);
}
}
else
if (SCM_IMP (prot) || !SCM_INEXACTP (prot))
else if (!SCM_INEXACTP (prot))
/* Huge non-unif vectors are NOT supported. */
/* no special scm_vector */
return scm_make_vector (SCM_MAKINUM (k), SCM_UNDEFINED);
@ -237,6 +235,8 @@ scm_make_uve (long k, SCM prot)
type = scm_tc7_dvect;
}
SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_UVECTOR_MAX_LENGTH);
SCM_NEWCELL (v);
SCM_DEFER_INTS;
SCM_SET_UVECTOR_BASE (v, (char *) scm_must_malloc (i ? i : 1, "vector"));
@ -581,11 +581,7 @@ SCM_DEFINE (scm_dimensions_to_uniform_array, "dimensions->uniform-array", 2, 1,
SCM ra;
if (SCM_INUMP (dims))
{
SCM answer;
SCM_ASSERT_RANGE (1, dims, SCM_INUM (dims) <= SCM_LENGTH_MAX);
answer = scm_make_uve (SCM_INUM (dims), prot);
SCM answer = scm_make_uve (SCM_INUM (dims), prot);
if (!SCM_UNBNDP (fill))
scm_array_fill_x (answer, fill);
else if (SCM_SYMBOLP (prot))
@ -607,8 +603,6 @@ SCM_DEFINE (scm_dimensions_to_uniform_array, "dimensions->uniform-array", 2, 1,
rlen = (s[k].ubnd - s[k].lbnd + 1) * s[k].inc;
}
SCM_ASSERT_RANGE (1, dims, rlen <= SCM_LENGTH_MAX);
SCM_ARRAY_V (ra) = scm_make_uve (rlen, prot);
if (!SCM_UNBNDP (fill))

View file

@ -88,12 +88,14 @@ extern long scm_tc16_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_MAX_LENGTH (0xffffffL)
#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_MAX_LENGTH (0xffffffL)
#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))