diff options
author | Keith Packard <keithp@keithp.com> | 2018-01-08 13:46:17 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2018-01-08 13:46:17 -0800 |
commit | 4b52fc6eea9a478cb3dd42dcd32c92838df39734 (patch) | |
tree | 28c5594e42896b7a191539b7c21563e92f73e1da /src/scheme/ao_scheme_string.c | |
parent | f8a967959b2f5ca3486ab3422f30fe4ad4ba17a8 (diff) |
altos/scheme: Allow unicode in lexer
This just passes any bytes with the high bit set through the system so
programs can include UTF-8 in strings and symbols. What the heck.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/scheme/ao_scheme_string.c')
-rw-r--r-- | src/scheme/ao_scheme_string.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/scheme/ao_scheme_string.c b/src/scheme/ao_scheme_string.c index c49e1e32..2c6d0960 100644 --- a/src/scheme/ao_scheme_string.c +++ b/src/scheme/ao_scheme_string.c @@ -47,6 +47,8 @@ ao_scheme_string_alloc(int len) { struct ao_scheme_string *s; + if (len < 0) + return NULL; s = ao_scheme_alloc(len + 2); if (!s) return NULL; @@ -182,8 +184,8 @@ ao_scheme_string_write(FILE *out, ao_poly p, bool write) fputs("\\\\", out); break; default: - if (c < ' ') - fprintf(out, "\\%03o", c); + if ((uint8_t) c < ' ') + fprintf(out, "\\%03o", (uint8_t) c); else putc(c, out); break; |