* Changes to the C interface
+** The struct scm_cell has been renamed to scm_t_cell
+
+This is in accordance to Guile's naming scheme for types. Note that
+the name scm_cell is now used for a function that allocates and
+initializes a new cell (see below).
+
** New functions for memory management
A new set of functions for memory management has been added since the
** SCM_NEWCELL and SCM_NEWCELL2 have been deprecated.
-Use the new functions scm_alloc_cell and scm_alloc_double_cell
-instead. The old macros had problems because with them allocation and
-initialization was separated and the GC could sometimes observe half
-initialized cells. Only careful coding by the user of SCM_NEWCELL and
-SCM_NEWCELL2 could make this safe and efficient.
+Use the new functions scm_cell and scm_double_cell instead. The old macros
+had problems because with them allocation and initialization was separated and
+the GC could sometimes observe half initialized cells. Only careful coding by
+the user of SCM_NEWCELL and SCM_NEWCELL2 could make this safe and efficient.
Changes since Guile 1.4:
+2002-03-01 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
+ * api.txt, data-rep.texi: Renamed the struct scm_cell to
+ scm_t_cell.
+
+ * data-rep.texi: Renamed scm_alloc_cell to scm_cell and
+ scm_alloc_double_cell to scm_double_cell.
+
2002-03-01 Marius Vollmer <mvo@zagadka.ping.de>
* scheme-memory.texi (Upgrading from scm_must_malloc et al): New
Non immediate objects
=====================
-- (scm_cell *) SCM2PTR (SCM x) (FIXME:: this name should be changed)
-- SCM PTR2SCM (scm_cell * x) (FIXME:: this name should be changed)
+- (scm_t_cell *) SCM2PTR (SCM x) (FIXME:: this name should be changed)
+- SCM PTR2SCM (scm_t_cell * x) (FIXME:: this name should be changed)
A scheme object of type SCM that does not fullfill the SCM_IMP predicate holds
an encoded reference to a heap cell. This reference can be decoded to a C
Note that it is also possible to transform a non immediate SCM value by using
SCM_UNPACK into a scm_bits_t variable. Hower, the result of SCM_UNPACK may
-not be used as a pointer to a scm_cell: Only SCM2PTR is guaranteed to
+not be used as a pointer to a scm_t_cell: Only SCM2PTR is guaranteed to
transform a SCM object into a valid pointer to a heap cell. Also, it is not
allowed to apply PTR2SCM to anything that is not a valid pointer to a heap
cell.
Summary:
* Only use SCM2PTR for SCM values for which SCM_IMP is false!
-* Don't use '(scm_cell*) SCM_UNPACK (x)'! Use 'SCM2PTR (x)' instead!
+* Don't use '(scm_t_cell*) SCM_UNPACK (x)'! Use 'SCM2PTR (x)' instead!
* Don't use PTR2SCM for anything but a cell pointer!
@c essay @sp 10
@c essay @comment The title is printed in a large font.
@c essay @title Data Representation in Guile
-@c essay @subtitle $Id: data-rep.texi,v 1.4 2002-02-28 20:58:50 mvo Exp $
+@c essay @subtitle $Id: data-rep.texi,v 1.5 2002-03-01 00:19:20 dirk Exp $
@c essay @subtitle For use with Guile @value{VERSION}
@c essay @author Jim Blandy
@c essay @author Free Software Foundation
@code{SCM} value is done using the @code{PTR2SCM} macro.
@c (FIXME:: this name should be changed)
-@deftypefn Macro (scm_cell *) SCM2PTR (SCM @var{x})
+@deftypefn Macro (scm_t_cell *) SCM2PTR (SCM @var{x})
Extract and return the heap cell pointer from a non-immediate @code{SCM}
object @var{x}.
@end deftypefn
@c (FIXME:: this name should be changed)
-@deftypefn Macro SCM PTR2SCM (scm_cell * @var{x})
+@deftypefn Macro SCM PTR2SCM (scm_t_cell * @var{x})
Return a @code{SCM} value that encodes a reference to the heap cell
pointer @var{x}.
@end deftypefn
Note that it is also possible to transform a non-immediate @code{SCM}
value by using @code{SCM_UNPACK} into a @code{scm_t_bits} variable.
However, the result of @code{SCM_UNPACK} may not be used as a pointer to
-a @code{scm_cell}: only @code{SCM2PTR} is guaranteed to transform a
+a @code{scm_t_cell}: only @code{SCM2PTR} is guaranteed to transform a
@code{SCM} object into a valid pointer to a heap cell. Also, it is not
allowed to apply @code{PTR2SCM} to anything that is not a valid pointer
to a heap cell.
Only use @code{SCM2PTR} on @code{SCM} values for which @code{SCM_IMP} is
false!
@item
-Don't use @code{(scm_cell *) SCM_UNPACK (@var{x})}! Use @code{SCM2PTR
+Don't use @code{(scm_t_cell *) SCM_UNPACK (@var{x})}! Use @code{SCM2PTR
(@var{x})} instead!
@item
Don't use @code{PTR2SCM} for anything but a cell pointer!
If you just want to allocate pairs, use @code{scm_cons}.
-@deftypefn Function SCM scm_alloc_cell (scm_t_bits word_0, scm_t_bits word_1)
+@deftypefn Function SCM scm_cell (scm_t_bits word_0, scm_t_bits word_1)
Allocate a new cell, initialize the two slots with @var{word_0} and
@var{word_1}, and return it.
@code{SCM_UNPACK}.
@end deftypefn
-@deftypefn Function SCM scm_alloc_double_cell (scm_t_bits word_0, scm_t_bits word_1, scm_t_bits word_2, scm_t_bits word_3)
-Like @code{scm_alloc_cell}, but allocates a double cell with four
+@deftypefn Function SCM scm_double_cell (scm_t_bits word_0, scm_t_bits word_1, scm_t_bits word_2, scm_t_bits word_3)
+Like @code{scm_cell}, but allocates a double cell with four
slots.
@end deftypefn
+2002-03-01 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
+ * gc.c (SCM_HEAP_SEG_SIZE, CELL_UP, CELL_DN, NEXT_DATA_CELL,
+ init_heap_seg, alloc_some_heap), gc.h (struct scm_cell, struct
+ scm_t_cell, SCM_CELLPTR, SCM_GC_CARD_SIZE,
+ SCM_GC_IN_CARD_HEADERP), tags.h (SCM_CELLP): Renamed the struct
+ scm_cell and all its uses to scm_t_cell in accordance to Guile's
+ naming scheme for types.
+
+ * alist.c (scm_acons), convert.i.c (CTYPES2UVECT,
+ CTYPES2UVECT_OPTIONAL), coop-threads.c (scm_call_with_new_thread,
+ scm_spawn_thread), debug.c (scm_make_debugobj), environments.c
+ (scm_make_environment), eval.c (scm_closure), fports.c
+ (scm_fdes_to_port), gc.c (scm_deprecated_newcell,
+ scm_deprecated_newcell2), inline.h (scm_alloc_cell, scm_cell),
+ list.c (SCM_I_CONS), numbers.c (scm_i_mkbig), pairs.c (scm_cons),
+ ports.c (scm_void_port), procs.c (scm_c_make_subr, scm_makcclo),
+ smob.c (scm_make_smob), smob.h (SCM_NEWSMOB), strings.c
+ (scm_take_str, scm_allocate_string), strports.c (scm_mkstrport),
+ unif.c (scm_make_uve), variable.c (make_variable), vectors.c
+ (scm_c_make_vector), vports.c (scm_make_soft_port): Renamed
+ scm_alloc_cell to scm_cell.
+
+ * environments.c (core_environments_observe), gc.c
+ (scm_deprecated_newcell2), goops.c (wrap_init, scm_wrap_object),
+ inline.h (scm_alloc_double_cell, scm_double_cell), num2float.i.c
+ (FLOAT2NUM), numbers.c (scm_make_real), procs.c
+ (scm_make_procedure_with_setter), smob.h (SCM_NEWSMOB2,
+ SCM_NEWSMOB3), struct.c (scm_make_struct, scm_make_vtable_vtable),
+ symbols.c (scm_mem2symbol, scm_mem2uninterned_symbol), weaks.c
+ (allocate_weak_vector): Renamed scm_alloc_double_cell to
+ scm_double_cell.
+
2002-02-27 Stefan Jahn <stefan@lkcc.org>
* convert.i.c, convert.c: Better range checking.
"function is @emph{not} destructive; @var{alist} is not modified.")
#define FUNC_NAME s_scm_acons
{
- return scm_alloc_cell (SCM_UNPACK (scm_alloc_cell (SCM_UNPACK (key),
- SCM_UNPACK (value))),
- SCM_UNPACK (alist));
+ return scm_cell (SCM_UNPACK (scm_cell (SCM_UNPACK (key),
+ SCM_UNPACK (value))),
+ SCM_UNPACK (alist));
}
#undef FUNC_NAME
n > 0 && n <= SCM_UVECTOR_MAX_LENGTH);
v = scm_gc_malloc (n * sizeof (CTYPE), "uvect");
memcpy (v, data, n * sizeof (CTYPE));
- return scm_alloc_cell (SCM_MAKE_UVECTOR_TAG (n, UVECTTYPE), (scm_t_bits) v);
+ return scm_cell (SCM_MAKE_UVECTOR_TAG (n, UVECTTYPE), (scm_t_bits) v);
}
#undef FUNC_NAME
n > 0 && n <= SCM_UVECTOR_MAX_LENGTH);
v = scm_gc_malloc (n * sizeof (unsigned CTYPE) * n, "uvect");
memcpy (v, data, n * sizeof (unsigned CTYPE));
- return scm_alloc_cell (SCM_MAKE_UVECTOR_TAG (n, UVECTTYPE_OPTIONAL),
- (scm_t_bits) v);
+ return scm_cell (SCM_MAKE_UVECTOR_TAG (n, UVECTTYPE_OPTIONAL),
+ (scm_t_bits) v);
}
#undef FUNC_NAME
#endif /* UVECTTYPE_OPTIONAL */
/* Allocate thread locals. */
root = scm_make_root (scm_root->handle);
/* Make thread. */
- thread = scm_alloc_cell (scm_tc16_thread, 0);
+ thread = scm_cell (scm_tc16_thread, 0);
SCM_DEFER_INTS;
argl = scm_cons (thread, argl);
/* Note that we couldn't pass a pointer to argl as data since the
/* Allocate thread locals. */
root = scm_make_root (scm_root->handle);
/* Make thread. */
- thread = scm_alloc_cell (scm_tc16_thread, 0);
+ thread = scm_cell (scm_tc16_thread, 0);
SCM_DEFER_INTS;
data->u.thread = thread;
SCM
scm_make_debugobj (scm_t_debug_frame *frame)
{
- return scm_alloc_cell (scm_tc16_debugobj, (scm_t_bits) frame);
+ return scm_cell (scm_tc16_debugobj, (scm_t_bits) frame);
}
\f
SCM
scm_make_environment (void *type)
{
- return scm_alloc_cell (scm_tc16_environment, (scm_t_bits) type);
+ return scm_cell (scm_tc16_environment, (scm_t_bits) type);
}
static SCM
core_environments_observe (SCM env, scm_environment_observer proc, SCM data, int weak_p)
{
- SCM observer;
-
- observer = scm_alloc_double_cell (scm_tc16_observer,
- SCM_UNPACK (env),
- SCM_UNPACK (data),
- (scm_t_bits) proc);
+ SCM observer = scm_double_cell (scm_tc16_observer,
+ SCM_UNPACK (env),
+ SCM_UNPACK (data),
+ (scm_t_bits) proc);
if (!weak_p)
{
{
SCM z;
SCM closcar = scm_cons (code, SCM_EOL);
- z = scm_alloc_cell (SCM_UNPACK (closcar) + scm_tc3_closure,
- (scm_t_bits) env);
+ z = scm_cell (SCM_UNPACK (closcar) + scm_tc3_closure, (scm_t_bits) env);
scm_remember_upto_here (closcar);
return z;
}
SCM_MISC_ERROR ("requested file mode not available on fdes", SCM_EOL);
}
- port = scm_alloc_cell (scm_tc16_fport, 0);
+ port = scm_cell (scm_tc16_fport, 0);
SCM_DEFER_INTS;
pt = scm_add_to_port_table (port);
SCM_SETPTAB_ENTRY (port, pt);
# define SCM_HEAP_SEG_SIZE 32768L
#else
# ifdef sequent
-# define SCM_HEAP_SEG_SIZE (7000L * sizeof (scm_cell))
+# define SCM_HEAP_SEG_SIZE (7000L * sizeof (scm_t_cell))
# else
-# define SCM_HEAP_SEG_SIZE (16384L * sizeof (scm_cell))
+# define SCM_HEAP_SEG_SIZE (16384L * sizeof (scm_t_cell))
# endif
#endif
/* Make heap grow with factor 1.5 */
#define SCM_INIT_MALLOC_LIMIT 100000
#define SCM_MTRIGGER_HYSTERESIS (SCM_INIT_MALLOC_LIMIT/10)
-/* CELL_UP and CELL_DN are used by scm_init_heap_seg to find (scm_cell * span)
+/* CELL_UP and CELL_DN are used by scm_init_heap_seg to find (scm_t_cell * span)
aligned inner bounds for allocated storage */
#ifdef PROT386
# define CELL_UP(p, span) (SCM_CELLPTR)(~(span) & ((long)(p)+(span)))
# define CELL_DN(p, span) (SCM_CELLPTR)(~(span) & (long)(p))
# else
-# define CELL_UP(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & ((long)(p)+sizeof(scm_cell)*(span)-1L))
-# define CELL_DN(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & (long)(p))
+# define CELL_UP(p, span) (SCM_CELLPTR)(~(sizeof(scm_t_cell)*(span)-1L) & ((long)(p)+sizeof(scm_t_cell)*(span)-1L))
+# define CELL_DN(p, span) (SCM_CELLPTR)(~(sizeof(scm_t_cell)*(span)-1L) & (long)(p))
# endif /* UNICOS */
#endif /* PROT386 */
-#define DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_cell) - 1) & SCM_UNPACK (x)) == 0)
+#define DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0)
#define ALIGNMENT_SLACK(freelist) (SCM_GC_CARD_SIZE - 1)
#define CLUSTER_SIZE_IN_BYTES(freelist) \
#define NEXT_DATA_CELL(ptr, span) \
do { \
- scm_cell *nxt__ = CELL_UP ((char *) (ptr) + 1, (span)); \
+ scm_t_cell *nxt__ = CELL_UP ((char *) (ptr) + 1, (span)); \
(ptr) = (SCM_GC_IN_CARD_HEADERP (nxt__) ? \
CELL_UP (SCM_GC_CELL_CARD (nxt__) + SCM_GC_CARD_N_HEADER_CELLS, span) \
: nxt__); \
NEXT_DATA_CELL (ptr, span);
while (ptr < seg_end)
{
- scm_cell *nxt = ptr;
- scm_cell *prv = NULL;
- scm_cell *last_card = NULL;
+ scm_t_cell *nxt = ptr;
+ scm_t_cell *prv = NULL;
+ scm_t_cell *last_card = NULL;
int n_data_cells = (SCM_GC_CARD_N_DATA_CELLS / span) * SCM_CARDS_PER_CLUSTER - 1;
NEXT_DATA_CELL(nxt, span);
while (n_data_cells--)
{
- scm_cell *card = SCM_GC_CELL_CARD (ptr);
+ scm_t_cell *card = SCM_GC_CELL_CARD (ptr);
SCM scmptr = PTR2SCM (ptr);
nxt = ptr;
NEXT_DATA_CELL (nxt, span);
/* sanity check */
{
- scm_cell *ref = seg_end;
+ scm_t_cell *ref = seg_end;
NEXT_DATA_CELL (ref, span);
if (ref != ptr)
/* [cmm] looks like the segment size doesn't divide cleanly by
#endif
if (len < min_cells)
len = min_cells + freelist->cluster_size;
- len *= sizeof (scm_cell);
+ len *= sizeof (scm_t_cell);
/* force new sampling */
freelist->collected = LONG_MAX;
}
scm_deprecated_newcell (void)
{
scm_c_issue_deprecation_warning
- ("SCM_NEWCELL is deprecated. Use `scm_alloc_cell' instead.\n");
+ ("SCM_NEWCELL is deprecated. Use `scm_cell' instead.\n");
- return scm_alloc_cell (scm_tc16_allocated, 0);
+ return scm_cell (scm_tc16_allocated, 0);
}
SCM
scm_deprecated_newcell2 (void)
{
scm_c_issue_deprecation_warning
- ("SCM_NEWCELL2 is deprecated. Use `scm_alloc_double_cell' instead.\n");
+ ("SCM_NEWCELL2 is deprecated. Use `scm_double_cell' instead.\n");
- return scm_alloc_double_cell (scm_tc16_allocated, 0, 0, 0);
+ return scm_double_cell (scm_tc16_allocated, 0, 0, 0);
}
#endif /* SCM_ENABLE_DEPRECATED == 1 */
\f
-typedef struct scm_cell
+typedef struct scm_t_cell
{
scm_t_bits word_0;
scm_t_bits word_1;
-} scm_cell;
+} scm_t_cell;
/* SCM_CELLPTR is a pointer to a cons cell which may be compared or
* differenced.
*/
-typedef scm_cell * SCM_CELLPTR;
+typedef scm_t_cell * SCM_CELLPTR;
/* Cray machines have pointers that are incremented once for each word,
* rather than each byte, the 3 most significant bits encode the byte
* within the word. The following macros deal with this by storing the
* native Cray pointers like the ones that looks like scm expects. This
- * is done for any pointers that might appear in the car of a scm_cell,
+ * is done for any pointers that might appear in the car of a scm_t_cell,
* pointers to scm_vector elts, functions, &c are not munged.
*/
#ifdef _UNICOS
#define SCM_GC_CARD_N_HEADER_CELLS 1
#define SCM_GC_CARD_N_CELLS 256
-#define SCM_GC_CARD_SIZE (SCM_GC_CARD_N_CELLS * sizeof (scm_cell))
+#define SCM_GC_CARD_SIZE (SCM_GC_CARD_N_CELLS * sizeof (scm_t_cell))
#define SCM_GC_CARD_N_DATA_CELLS (SCM_GC_CARD_N_CELLS - SCM_GC_CARD_N_HEADER_CELLS)
#define SCM_GC_CARD_BVEC_SIZE_IN_LIMBS \
((SCM_GC_CARD_N_CELLS + SCM_C_BVEC_LIMB_BITS - 1) / SCM_C_BVEC_LIMB_BITS)
#define SCM_GC_IN_CARD_HEADERP(x) \
- SCM_PTR_LT ((scm_cell *) (x), SCM_GC_CELL_CARD (x) + SCM_GC_CARD_N_HEADER_CELLS)
+ SCM_PTR_LT ((scm_t_cell *) (x), SCM_GC_CELL_CARD (x) + SCM_GC_CARD_N_HEADER_CELLS)
#define SCM_GC_CARD_BVEC(card) ((scm_t_c_bvec_limb *) ((card)->word_0))
#define SCM_GC_SET_CARD_BVEC(card, bvec) \
static SCM
makvect (char *m, size_t len, int type)
{
- return scm_alloc_cell (SCM_MAKE_UVECTOR_TAG (len, type), (scm_t_bits) m);
+ return scm_cell (SCM_MAKE_UVECTOR_TAG (len, type), (scm_t_bits) m);
}
SCM
for (i = 0; i < n; i++)
m[i] = SCM_GOOPS_UNBOUND;
- return scm_alloc_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (class))
- | scm_tc3_struct),
- (scm_t_bits) m, 0, 0);
+ return scm_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (class))
+ | scm_tc3_struct),
+ (scm_t_bits) m, 0, 0);
}
SCM_DEFINE (scm_sys_allocate_instance, "%allocate-instance", 2, 0, 0,
SCM
scm_wrap_object (SCM class, void *data)
{
- return scm_alloc_double_cell (SCM_UNPACK (SCM_CDR (class)) | scm_tc3_struct,
- (scm_t_bits) data,
- 0, 0);
+ return scm_double_cell (SCM_UNPACK (SCM_CDR (class)) | scm_tc3_struct,
+ (scm_t_bits) data,
+ 0, 0);
}
SCM scm_components;
#ifdef HAVE_INLINE
static inline SCM
-scm_alloc_cell (scm_t_bits car, scm_t_bits cdr)
+scm_cell (scm_t_bits car, scm_t_bits cdr)
{
SCM z;
}
static inline SCM
-scm_alloc_double_cell (scm_t_bits car, scm_t_bits cbr,
- scm_t_bits ccr, scm_t_bits cdr)
+scm_double_cell (scm_t_bits car, scm_t_bits cbr,
+ scm_t_bits ccr, scm_t_bits cdr)
{
SCM z;
#else /* !HAVE_INLINE */
-SCM_API SCM scm_alloc_cell (scm_t_bits car, scm_t_bits cdr);
-SCM_API SCM scm_alloc_double_cell (scm_t_bits car, scm_t_bits cbr,
- scm_t_bits ccr, scm_t_bits cdr);
+SCM_API SCM scm_cell (scm_t_bits car, scm_t_bits cdr);
+SCM_API SCM scm_double_cell (scm_t_bits car, scm_t_bits cbr,
+ scm_t_bits ccr, scm_t_bits cdr);
#endif
#define SCM_I_CONS(cell,x,y) \
do { \
- cell = scm_alloc_cell ((scm_t_bits)x, (scm_t_bits)y); \
+ cell = scm_cell ((scm_t_bits)x, (scm_t_bits)y); \
} while (0)
SCM
FLOAT2NUM (FTYPE n)
{
SCM z;
- z = scm_alloc_double_cell (scm_tc16_real, 0, 0, 0);
+ z = scm_double_cell (scm_tc16_real, 0, 0, 0);
SCM_REAL_VALUE (z) = n;
return z;
}
base = scm_gc_malloc (nlen * sizeof (SCM_BIGDIG), s_bignum);
- v = scm_alloc_cell (SCM_MAKE_BIGNUM_TAG (nlen, sign), (scm_t_bits) base);
+ v = scm_cell (SCM_MAKE_BIGNUM_TAG (nlen, sign), (scm_t_bits) base);
return v;
}
scm_make_real (double x)
{
SCM z;
- z = scm_alloc_double_cell (scm_tc16_real, 0, 0, 0);
+ z = scm_double_cell (scm_tc16_real, 0, 0, 0);
SCM_REAL_VALUE (z) = x;
return z;
}
"sense of @code{eq?}) from every previously existing object.")
#define FUNC_NAME s_scm_cons
{
- return scm_alloc_cell (SCM_UNPACK (x), SCM_UNPACK (y));
+ return scm_cell (SCM_UNPACK (x), SCM_UNPACK (y));
}
#undef FUNC_NAME
SCM answer;
scm_t_port * pt;
- answer = scm_alloc_cell (scm_tc16_void_port, 0);
+ answer = scm_cell (scm_tc16_void_port, 0);
SCM_DEFER_INTS;
mode_bits = scm_mode_bits (mode_str);
pt = scm_add_to_port_table (answer);
}
entry = scm_subr_table_size;
- z = scm_alloc_cell ((entry << 8) + type, (scm_t_bits) fcn);
+ z = scm_cell ((entry << 8) + type, (scm_t_bits) fcn);
scm_subr_table[entry].handle = z;
scm_subr_table[entry].name = scm_str2symbol (name);
scm_subr_table[entry].generic = 0;
for (i = 0; i < len; ++i)
base [i] = SCM_UNPACK (SCM_UNSPECIFIED);
- s = scm_alloc_cell (SCM_MAKE_CCLO_TAG (len), (scm_t_bits) base);
+ s = scm_cell (SCM_MAKE_CCLO_TAG (len), (scm_t_bits) base);
SCM_SET_CCLO_SUBR (s, proc);
return s;
}
{
SCM_VALIDATE_PROC (1, procedure);
SCM_VALIDATE_PROC (2, setter);
- return scm_alloc_double_cell (scm_tc7_pws,
- SCM_UNPACK (procedure),
- SCM_UNPACK (setter), 0);
+ return scm_double_cell (scm_tc7_pws,
+ SCM_UNPACK (procedure),
+ SCM_UNPACK (setter), 0);
}
#undef FUNC_NAME
scm_t_bits data = (size > 0
? (scm_t_bits) scm_gc_malloc (size, SCM_SMOBNAME (n))
: 0);
- return scm_alloc_cell (tc, data);
+ return scm_cell (tc, data);
}
\f
#define SCM_NEWSMOB(z, tc, data) \
do { \
- z = scm_alloc_cell ((tc), (scm_t_bits) (data)); \
+ z = scm_cell ((tc), (scm_t_bits) (data)); \
} while (0)
#define SCM_RETURN_NEWSMOB(tc, data) \
#define SCM_NEWSMOB2(z, tc, data1, data2) \
do { \
- z = scm_alloc_double_cell ((tc), (scm_t_bits)(data1), \
- (scm_t_bits)(data2), 0); \
+ z = scm_double_cell ((tc), (scm_t_bits)(data1), (scm_t_bits)(data2), 0); \
} while (0)
#define SCM_RETURN_NEWSMOB2(tc, data1, data2) \
#define SCM_NEWSMOB3(z, tc, data1, data2, data3) \
do { \
- z = scm_alloc_double_cell ((tc), (scm_t_bits)(data1), \
- (scm_t_bits)(data2), (scm_t_bits)(data3)); \
+ z = scm_double_cell ((tc), (scm_t_bits)(data1), \
+ (scm_t_bits)(data2), (scm_t_bits)(data3)); \
} while (0)
#define SCM_RETURN_NEWSMOB3(tc, data1, data2, data3) \
SCM_ASSERT_RANGE (2, scm_ulong2num (len), len <= SCM_STRING_MAX_LENGTH);
- answer = scm_alloc_cell (SCM_MAKE_STRING_TAG (len), (scm_t_bits) s);
+ answer = scm_cell (SCM_MAKE_STRING_TAG (len), (scm_t_bits) s);
scm_gc_register_collectable_memory (s, len+1, "string");
return answer;
mem = (char *) scm_gc_malloc (len + 1, "string");
mem[len] = 0;
- s = scm_alloc_cell (SCM_MAKE_STRING_TAG (len), (scm_t_bits) mem);
+ s = scm_cell (SCM_MAKE_STRING_TAG (len), (scm_t_bits) mem);
return s;
}
scm_out_of_range (caller, pos);
if (!((modes & SCM_WRTNG) || (modes & SCM_RDNG)))
scm_misc_error ("scm_mkstrport", "port must read or write", SCM_EOL);
- z = scm_alloc_cell (scm_tc16_strport, 0);
+ z = scm_cell (scm_tc16_strport, 0);
SCM_DEFER_INTS;
pt = scm_add_to_port_table (z);
SCM_SET_CELL_TYPE (z, scm_tc16_strport | modes);
data = scm_alloc_struct (basic_size + tail_elts,
scm_struct_n_extra_words,
"struct");
- handle = scm_alloc_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (vtable))
- + scm_tc3_struct),
- (scm_t_bits) data, 0, 0);
+ handle = scm_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (vtable))
+ + scm_tc3_struct),
+ (scm_t_bits) data, 0, 0);
scm_struct_init (handle, layout, data, tail_elts, init);
SCM_ALLOW_INTS;
return handle;
data = scm_alloc_struct (basic_size + tail_elts,
scm_struct_n_extra_words,
"struct");
- handle = scm_alloc_double_cell ((scm_t_bits) data + scm_tc3_struct,
- (scm_t_bits) data, 0, 0);
+ handle = scm_double_cell ((scm_t_bits) data + scm_tc3_struct,
+ (scm_t_bits) data, 0, 0);
data [scm_vtable_index_layout] = SCM_UNPACK (layout);
scm_struct_init (handle, layout, data, tail_elts, scm_cons (layout, init));
SCM_ALLOW_INTS;
SCM cell;
SCM slot;
- symbol = scm_alloc_double_cell (SCM_MAKE_SYMBOL_TAG (len),
- (scm_t_bits) scm_gc_strndup (name, len,
- "symbol"),
- raw_hash,
- SCM_UNPACK (scm_cons (SCM_BOOL_F,
- SCM_EOL)));
+ symbol = scm_double_cell (SCM_MAKE_SYMBOL_TAG (len),
+ (scm_t_bits) scm_gc_strndup (name, len,
+ "symbol"),
+ raw_hash,
+ SCM_UNPACK (scm_cons (SCM_BOOL_F, SCM_EOL)));
slot = SCM_VELTS (symbols) [hash];
cell = scm_cons (symbol, SCM_UNDEFINED);
size_t raw_hash = (scm_string_hash ((const unsigned char *) name, len)/2
+ SCM_T_BITS_MAX/2 + 1);
- return scm_alloc_double_cell (SCM_MAKE_SYMBOL_TAG (len),
- (scm_t_bits) scm_gc_strndup (name, len,
- "symbol"),
- raw_hash,
- SCM_UNPACK (scm_cons (SCM_BOOL_F,
- SCM_EOL)));
+ return scm_double_cell (SCM_MAKE_SYMBOL_TAG (len),
+ (scm_t_bits) scm_gc_strndup (name, len,
+ "symbol"),
+ raw_hash,
+ SCM_UNPACK (scm_cons (SCM_BOOL_F, SCM_EOL)));
}
SCM
#if (SCM_ENABLE_DEPRECATED == 1)
-#define SCM_CELLP(x) (((sizeof (scm_cell) - 1) & SCM_UNPACK (x)) == 0)
+#define SCM_CELLP(x) (((sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0)
#define SCM_NCELLP(x) (!SCM_CELLP (x))
#endif
SCM_ASSERT_RANGE (1,
scm_long2num (k), k <= SCM_BITVECTOR_MAX_LENGTH);
i = sizeof (long) * ((k + SCM_LONG_BIT - 1) / SCM_LONG_BIT);
- v = scm_alloc_cell (SCM_MAKE_BITVECTOR_TAG (k),
- (scm_t_bits) scm_gc_malloc (i, "vector"));
+ v = scm_cell (SCM_MAKE_BITVECTOR_TAG (k),
+ (scm_t_bits) scm_gc_malloc (i, "vector"));
}
else
- v = scm_alloc_cell (SCM_MAKE_BITVECTOR_TAG (0), 0);
+ v = scm_cell (SCM_MAKE_BITVECTOR_TAG (0), 0);
return v;
}
else if (SCM_CHARP (prot) && (SCM_CHAR (prot) == '\0'))
SCM_ASSERT_RANGE (1, scm_long2num (k), k <= SCM_UVECTOR_MAX_LENGTH);
- return scm_alloc_cell (SCM_MAKE_UVECTOR_TAG (k, type),
- (scm_t_bits) scm_gc_malloc (i, "vector"));
+ return scm_cell (SCM_MAKE_UVECTOR_TAG (k, type),
+ (scm_t_bits) scm_gc_malloc (i, "vector"));
}
#undef FUNC_NAME
static SCM
make_variable (SCM init)
{
- return scm_alloc_cell (scm_tc7_variable, SCM_UNPACK (init));
+ return scm_cell (scm_tc7_variable, SCM_UNPACK (init));
}
SCM_DEFINE (scm_make_variable, "make-variable", 1, 0, 0,
else
base = NULL;
- v = scm_alloc_cell (SCM_MAKE_VECTOR_TAG (k, scm_tc7_vector),
- (scm_t_bits) base);
+ v = scm_cell (SCM_MAKE_VECTOR_TAG (k, scm_tc7_vector), (scm_t_bits) base);
scm_remember_upto_here_1 (fill);
return v;
SCM z;
SCM_VALIDATE_VECTOR_LEN (1,pv,5);
SCM_VALIDATE_STRING (2, modes);
- z = scm_alloc_cell (scm_tc16_sfport, 0);
+ z = scm_cell (scm_tc16_sfport, 0);
SCM_DEFER_INTS;
pt = scm_add_to_port_table (z);
scm_port_non_buffer (pt);
base = scm_gc_malloc (c_size * sizeof (scm_t_bits), "weak vector");
for (j = 0; j != c_size; ++j)
base[j] = SCM_UNPACK (fill);
- v = scm_alloc_double_cell (SCM_MAKE_VECTOR_TAG (c_size,
- scm_tc7_wvect),
- (scm_t_bits) base,
- type,
- SCM_UNPACK (SCM_EOL));
+ v = scm_double_cell (SCM_MAKE_VECTOR_TAG (c_size, scm_tc7_wvect),
+ (scm_t_bits) base,
+ type,
+ SCM_UNPACK (SCM_EOL));
scm_remember_upto_here_1 (fill);
}
else
{
- v = scm_alloc_double_cell (SCM_MAKE_VECTOR_TAG (0,
- scm_tc7_wvect),
- (scm_t_bits) NULL,
- type,
- SCM_UNPACK (SCM_EOL));
+ v = scm_double_cell (SCM_MAKE_VECTOR_TAG (0, scm_tc7_wvect),
+ (scm_t_bits) NULL,
+ type,
+ SCM_UNPACK (SCM_EOL));
}
return v;