Cyclone Scheme  0.9
#define make_utf8_string (   data,
  cs,
 
)
Value:
{ int len = strlen(s); \
cs.hdr.mark = gc_color_red; \
cs.hdr.grayed = 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);}
int num_cp
Definition: types.h:812
#define gc_color_red
Definition: types.h:265
Definition: types.h:56
void Cyc_rt_raise_msg(void *data, const char *err)
Definition: runtime.c:579
char * str
Definition: types.h:814
The string type.
Definition: types.h:809
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:7202

Create a new string in the nursery