diff options
author | Keith Packard <keithp@keithp.com> | 2018-01-06 17:29:10 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2018-01-06 17:31:43 -0800 |
commit | 16061947d4376b41e596d87f97ec53ec29d17644 (patch) | |
tree | f7ad08f8810b0ea78cf282048eacb46d441a2ee1 /src/scheme/ao_scheme_rep.c | |
parent | 39df849f0717d92a7d5bdf8aa5904bd4db1b467f (diff) |
altos/scheme: Add ports. Split scheme code up.
And lots of other changes, including freeing unreferenced atoms.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/scheme/ao_scheme_rep.c')
-rw-r--r-- | src/scheme/ao_scheme_rep.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/scheme/ao_scheme_rep.c b/src/scheme/ao_scheme_rep.c index b35ba5b8..49ab0559 100644 --- a/src/scheme/ao_scheme_rep.c +++ b/src/scheme/ao_scheme_rep.c @@ -15,13 +15,15 @@ #include "ao_scheme.h" ao_poly -ao_scheme_read_eval_print(void) +ao_scheme_read_eval_print(FILE *read_file, FILE *write_file, bool interactive) { ao_poly in, out = AO_SCHEME_NIL; ao_scheme_exception = 0; for(;;) { - in = ao_scheme_read(); + if (interactive) + fputs("> ", write_file); + in = ao_scheme_read(read_file); if (in == _ao_scheme_atom_eof) break; out = ao_scheme_eval(in); @@ -30,8 +32,10 @@ ao_scheme_read_eval_print(void) break; ao_scheme_exception = 0; } else { - ao_scheme_poly_write(out, true); - putchar ('\n'); + if (write_file) { + ao_scheme_poly_write(write_file, out, true); + putc('\n', write_file); + } } } return out; |