Cyclone Scheme  0.28.0

◆ make_utf8_string

#define make_utf8_string (   data,
  cs,
 
)
Value:
{ int len = strlen(s); \
cs.hdr.mark = gc_color_red; \
cs.hdr.grayed = 0; \
cs.hdr.immutable = 0; \
cs.tag = string_tag; \
cs.num_cp = Cyc_utf8_count_code_points((uint8_t *)s); \
if (cs.num_cp < 0) { \
Cyc_rt_raise_msg(data, "Invalid UTF-8 characters in string"); \
} \
cs.len = len; \
cs.str = alloca(sizeof(char) * (len + 1)); \
memcpy(cs.str, s, len + 1);}

Create a new string in the nursery

gc_color_red
#define gc_color_red
Definition: types.h:297
string_type::num_cp
int num_cp
Definition: types.h:936
string_type::str
char * str
Definition: types.h:938
string_type
The string type.
Definition: types.h:933
string_tag
@ string_tag
Definition: types.h:67
Cyc_utf8_count_code_points
int Cyc_utf8_count_code_points(uint8_t *s)
Count the number of code points in a string. Based on example code from Bjoern Hoehrmann.
Definition: runtime.c:8082