34 for (
size_t i = 0; i < s->
len; i++) {
60static inline void write_bytes(FILE *out,
const uint8_t *buf,
size_t len) {
62 (void)fwrite(buf, 1, len, out);
83 for (
size_t i = 0; i < s->
inner.
len; i++) {
88 if (r.maybe_error !=
nullptr) {
89 fputs(
"#<seq-error>", out);
114 (void)fprintf(out,
"%" PRId64,
AS_I64(v));
119 (void)fprintf(out,
"%.17g",
AS_F64(v));
158 (void)fprintf(out,
"#<map size=%zu>", m->
inner.
len);
163 fputs(
"#<closure>", out);
168 (void)fprintf(out,
"#<error tag=%d", (
int)e->
tag);
169 if (e->
msg !=
nullptr) {
170 (void)fprintf(out,
" %s", e->
msg);
177 fputs(
"#<quote>", out);
181 fputs(
"#<unknown>", out);
197 for (
const char *p = s; *p !=
'\0'; p++) {
215 fputc((
int)(
unsigned char)*p, out);
227 for (
size_t i = 0; i < body->
len; i++) {
232 if (r.maybe_error !=
nullptr) {
233 fputs(
"#<seq-error>", out);
290 (void)fprintf(out,
"#<error tag=%d", (
int)e->
tag);
291 if (e->
msg !=
nullptr) {
292 (void)fprintf(out,
" %s", e->
msg);
299 fputs(
"#<unknown>", out);
#define AS_LIST(value_ref)
#define AS_F64(value_ref)
#define AS_SYMBOL(value_ref)
@ VError
VError should be last.
#define AS_STRING(value_ref)
#define AS_I64(value_ref)
@ SError
SError should be last.
#define AS_MAP(value_ref)
#define AS_SEQ(value_ref)
#define AS_ERROR(value_ref)
#define AS_KEYWORD(value_ref)
void srn_value_print(FILE *out, srn_context_t *ctx, const srn_value_t *v)
Print a value to out in its S-expression form.
static void print_list(FILE *out, srn_context_t *ctx, const srn_value_t *v)
static void print_seq(FILE *out, srn_context_t *ctx, const srn_value_t *v)
void srn_syntax_println(FILE *out, srn_context_t *ctx, const srn_syntax_t *s)
Same as srn_syntax_print followed by ' '.
void srn_value_println(FILE *out, srn_context_t *ctx, const srn_value_t *v)
Same as srn_value_print followed by ' '.
static void print_quoted_string(FILE *out, const char *s)
void srn_syntax_print(FILE *out, srn_context_t *ctx, const srn_syntax_t *s)
Print a syntax node to out in its S-expression form.
static void print_string_payload(FILE *out, const srn_string_t *s)
static void print_seq_body(FILE *out, srn_context_t *ctx, const seq_t *body, char open, char close)
static void write_bytes(FILE *out, const uint8_t *buf, size_t len)
seq_lookup_result_t seq_get(const srn_context_t *ctx, const seq_t *seq, size_t n)
Negative index is not supported.
This is an implementation of bit - partitioned, persistent, immutable sequence For more information,...
size_t len
Number of key/value pairs in the map.
size_t len
logical length.
A list is a singly linked sequence of values.
Since all the values are immutable and persistent.
A persistent, immutable map.
A persistent, immutable, indexed sequence.
uint8_t buffer[]
The buffer that holds the WTF8 sequence.
size_t len
length of the WTF-8 sequence in bytes
union srn_syntax_t::@333325137367112222275110336355257173264057161216 as
IMPORTANT NOTE: The size of this union should never be larger than a word.
struct srn_syntax_t * quote
const char * symbol
For syntax only, we represent numbers as a strings,.
#define PANIC_IF_NULL(ptr)