summaryrefslogtreecommitdiff
path: root/src/scheme/ao_scheme_string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scheme/ao_scheme_string.c')
-rw-r--r--src/scheme/ao_scheme_string.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/src/scheme/ao_scheme_string.c b/src/scheme/ao_scheme_string.c
index e18a8e85..b00ef276 100644
--- a/src/scheme/ao_scheme_string.c
+++ b/src/scheme/ao_scheme_string.c
@@ -173,42 +173,36 @@ ao_scheme_string_unpack(struct ao_scheme_string *a)
}
void
-ao_scheme_string_write(ao_poly p)
+ao_scheme_string_write(ao_poly p, bool write)
{
struct ao_scheme_string *s = ao_scheme_poly_string(p);
char *sval = s->val;
char c;
- putchar('"');
- while ((c = *sval++)) {
- switch (c) {
- case '\n':
- printf ("\\n");
- break;
- case '\r':
- printf ("\\r");
- break;
- case '\t':
- printf ("\\t");
- break;
- default:
- if (c < ' ')
- printf("\\%03o", c);
- else
- putchar(c);
- break;
+ if (write) {
+ putchar('"');
+ while ((c = *sval++)) {
+ switch (c) {
+ case '\n':
+ printf ("\\n");
+ break;
+ case '\r':
+ printf ("\\r");
+ break;
+ case '\t':
+ printf ("\\t");
+ break;
+ default:
+ if (c < ' ')
+ printf("\\%03o", c);
+ else
+ putchar(c);
+ break;
+ }
}
+ putchar('"');
+ } else {
+ while ((c = *sval++))
+ putchar(c);
}
- putchar('"');
-}
-
-void
-ao_scheme_string_display(ao_poly p)
-{
- struct ao_scheme_string *s = ao_scheme_poly_string(p);
- char *sval = s->val;
- char c;
-
- while ((c = *sval++))
- putchar(c);
}