Serene Runtime 1.0.0
C runtime for the Serene programming language
Loading...
Searching...
No Matches
print.h
Go to the documentation of this file.
1/* -*- C -*-
2 * Serene programming language
3 * Copyright (C) 2019-2026 Sameer Rahmani <[email protected]>
4 *
5 * This library is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 */
15#pragma once
16
17#include <stdio.h>
18
19#include "serene/rt/core.h"
20
21typedef struct srn_context_t srn_context_t;
22
23/// Print a value to `out` in its S-expression form. Atoms round-trip with the
24/// reader; compounds without a public iterator (VMap) print as opaque
25/// placeholders for now.
26[[gnu::nonnull(1, 2, 3)]]
27void srn_value_print(FILE *out, srn_context_t *ctx, const srn_value_t *v);
28
29/// Same as srn_value_print followed by '\n'.
30[[gnu::nonnull(1, 2, 3)]]
31void srn_value_println(FILE *out, srn_context_t *ctx, const srn_value_t *v);
32
33/// Print a syntax node to `out` in its S-expression form. Numbers are
34/// emitted from their stored raw text (no formatting normalization). Maps
35/// print as `{k v k v}` because the syntax-level container is a flat seq.
36[[gnu::nonnull(1, 2, 3)]]
37void srn_syntax_print(FILE *out, srn_context_t *ctx, const srn_syntax_t *s);
38
39/// Same as srn_syntax_print followed by '\n'.
40[[gnu::nonnull(1, 2, 3)]]
41void srn_syntax_println(FILE *out, srn_context_t *ctx, const srn_syntax_t *s);
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.
Definition print.c:97
void srn_syntax_println(FILE *out, srn_context_t *ctx, const srn_syntax_t *s)
Same as srn_syntax_print followed by ' '.
Definition print.c:304
void srn_value_println(FILE *out, srn_context_t *ctx, const srn_value_t *v)
Same as srn_value_print followed by ' '.
Definition print.c:186
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.
Definition print.c:241