Cyclone Scheme  0.9
#define alloc_string (   _data,
  _s,
  _len,
  _num_cp 
)
Value:
if (_len >= MAX_STACK_OBJ) { \
int heap_grown; \
_s = gc_alloc(((gc_thread_data *)data)->heap, \
sizeof(string_type) + _len + 1, \
boolean_f, /* OK to populate manually over here */ \
(gc_thread_data *)data, \
&heap_grown); \
((string_type *) _s)->hdr.mark = ((gc_thread_data *)data)->gc_alloc_color; \
((string_type *) _s)->hdr.grayed = 0; \
((string_type *) _s)->tag = string_tag; \
((string_type *) _s)->len = _len; \
((string_type *) _s)->num_cp = _num_cp; \
((string_type *) _s)->str = (((char *)_s) + sizeof(string_type)); \
} else { \
_s = alloca(sizeof(string_type)); \
((string_type *)_s)->hdr.mark = gc_color_red; \
((string_type *)_s)->hdr.grayed = 0; \
((string_type *)_s)->tag = string_tag; \
((string_type *)_s)->len = _len; \
((string_type *)_s)->num_cp = _num_cp; \
((string_type *)_s)->str = alloca(sizeof(char) * (_len + 1)); \
}
Definition: types.h:290
#define gc_color_red
Definition: types.h:265
Definition: types.h:56
const object boolean_f
Definition: runtime.c:307
The string type.
Definition: types.h:809
void * gc_alloc(gc_heap_root *h, size_t size, char *obj, gc_thread_data *thd, int *heap_grown)
Allocate memory on the heap for an object.
Definition: gc.c:1319
#define MAX_STACK_OBJ
Definition: types.h:450

Allocate a new string, either on the stack or heap depending upon size