diff options
author | Andy Wingo <wingo@pobox.com> | 2012-01-09 17:24:57 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2012-01-09 17:50:56 +0100 |
commit | b2637c985ce93bc15e0378b8120d04a98ebdd212 (patch) | |
tree | bde14a0e946c1a9e165284b75e91d17b6dca5aa1 /libguile/arrays.h | |
parent | 017eb4a6be938c50df7fe6a27ca38486e75e02d5 (diff) | |
download | guile-b2637c985ce93bc15e0378b8120d04a98ebdd212.tar.gz |
allocate a tc7 to arrays
* libguile/tags.h (scm_tc7_array): Allocate a tag for arrays.
* libguile/arrays.h (SCM_I_ARRAYP): Change to use scm_tc7_array. The
previous definition was not externally usable because scm_i_tc16_array
was internal.
(scm_i_print_array): Declare, though internally.
* libguile/arrays.c (scm_i_make_array): Use scm_cell with the tc7
instead of NEWSMOB.
(scm_i_print_array): Make not static.
(SCM_ARRAY_IMPLEMENTATION): Adapt.
(scm_init_arrays): Remove array smob declaration.
* libguile/eq.c (scm_equal_p): Refactor to put the string, pointer, and
bytevector cases in the switch. Add a case for arrays.
* libguile/goops.c: Add <array> declarations.
* libguile/print.c (iprin1): Call scm_i_print_array as needed.
* libguile/evalext.c (scm_self_evaluating_p): Add a case for arrays.
Diffstat (limited to 'libguile/arrays.h')
-rw-r--r-- | libguile/arrays.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libguile/arrays.h b/libguile/arrays.h index 9b14d4e36..5ea604d6a 100644 --- a/libguile/arrays.h +++ b/libguile/arrays.h @@ -59,21 +59,20 @@ typedef struct scm_i_t_array unsigned long base; } scm_i_t_array; -SCM_INTERNAL scm_t_bits scm_i_tc16_array; - #define SCM_I_ARRAY_FLAG_CONTIGUOUS (1 << 0) -#define SCM_I_ARRAYP(a) SCM_TYP16_PREDICATE (scm_i_tc16_array, a) -#define SCM_I_ARRAY_NDIM(x) ((size_t) (SCM_SMOB_FLAGS (x)>>1)) -#define SCM_I_ARRAY_CONTP(x) (SCM_SMOB_FLAGS(x) & SCM_I_ARRAY_FLAG_CONTIGUOUS) +#define SCM_I_ARRAYP(a) SCM_TYP16_PREDICATE (scm_tc7_array, a) +#define SCM_I_ARRAY_NDIM(x) ((size_t) (SCM_CELL_WORD_0 (x)>>17)) +#define SCM_I_ARRAY_CONTP(x) (SCM_CELL_WORD_0 (x) & (SCM_I_ARRAY_FLAG_CONTIGUOUS << 16)) -#define SCM_I_ARRAY_MEM(a) ((scm_i_t_array *) SCM_SMOB_DATA_1 (a)) +#define SCM_I_ARRAY_MEM(a) ((scm_i_t_array *) SCM_CELL_WORD_1 (a)) #define SCM_I_ARRAY_V(a) (SCM_I_ARRAY_MEM (a)->v) #define SCM_I_ARRAY_BASE(a) (SCM_I_ARRAY_MEM (a)->base) #define SCM_I_ARRAY_DIMS(a) \ ((scm_t_array_dim *)((char *) SCM_I_ARRAY_MEM (a) + sizeof (scm_i_t_array))) SCM_INTERNAL SCM scm_i_make_array (int ndim); +SCM_INTERNAL int scm_i_print_array (SCM array, SCM port, scm_print_state *pstate); SCM_INTERNAL SCM scm_i_read_array (SCM port, int c); SCM_INTERNAL void scm_init_arrays (void); |