From b446d9657cad0ff45f6f65c774d82cb9f2f65088 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 6 Jan 2018 18:11:19 -0800 Subject: [PATCH] altos/lambdakey-v1.0: Switch back to command buffered input Instead of just reading from stdin with no echo or editing. Signed-off-by: Keith Packard --- src/lambdakey-v1.0/ao_lambdakey.c | 2 +- src/lambdakey-v1.0/ao_scheme_os.h | 8 ++------ src/scheme/ao_scheme_read.c | 6 +++++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lambdakey-v1.0/ao_lambdakey.c b/src/lambdakey-v1.0/ao_lambdakey.c index 2bd626f1..f1a2aa38 100644 --- a/src/lambdakey-v1.0/ao_lambdakey.c +++ b/src/lambdakey-v1.0/ao_lambdakey.c @@ -16,7 +16,7 @@ #include static void scheme_cmd() { - ao_scheme_read_eval_print(stdin, stdout, true); + ao_scheme_read_eval_print(stdin, stdout, false); } static const struct ao_cmds blink_cmds[] = { diff --git a/src/lambdakey-v1.0/ao_scheme_os.h b/src/lambdakey-v1.0/ao_scheme_os.h index 5641b476..6a2ab819 100644 --- a/src/lambdakey-v1.0/ao_scheme_os.h +++ b/src/lambdakey-v1.0/ao_scheme_os.h @@ -30,7 +30,7 @@ #endif static inline int -ao_scheme_getc() { +_ao_scheme_getc() { static uint8_t at_eol; int c; @@ -44,11 +44,7 @@ ao_scheme_getc() { return c; } -static inline void -ao_scheme_os_flush(void) -{ - flush(); -} +#define ao_scheme_getc(f) ({ (void) (f); _ao_scheme_getc(); }) static inline void ao_scheme_abort(void) diff --git a/src/scheme/ao_scheme_read.c b/src/scheme/ao_scheme_read.c index a26965f2..f9630d39 100644 --- a/src/scheme/ao_scheme_read.c +++ b/src/scheme/ao_scheme_read.c @@ -150,6 +150,10 @@ static const uint16_t lex_classes[128] = { static int lex_unget_c; +#ifndef ao_scheme_getc +#define ao_scheme_getc(f) getc(f) +#endif + static inline int lex_get(FILE *in) { @@ -158,7 +162,7 @@ lex_get(FILE *in) c = lex_unget_c; lex_unget_c = 0; } else { - c = getc(in); + c = ao_scheme_getc(in); } return c; } -- 2.30.2