With these two changes, the readline function can be used by other
code.
Signed-off-by: Keith Packard <keithp@keithp.com>
ao_put_string(__code char *s);
void
ao_put_string(__code char *s);
void
+ao_cmd_readline(void);
+
+char
__pdata char ao_cmd_lex_c;
__pdata enum ao_cmd_status ao_cmd_status;
__pdata char ao_cmd_lex_c;
__pdata enum ao_cmd_status ao_cmd_status;
+#define AO_CMD_LEN 48
+#endif
-static __xdata char cmd_line[CMD_LEN];
+static __xdata char cmd_line[AO_CMD_LEN];
static __pdata uint8_t cmd_len;
static __pdata uint8_t cmd_i;
static __pdata uint8_t cmd_len;
static __pdata uint8_t cmd_i;
ao_put_string ("\010 \010");
}
ao_put_string ("\010 \010");
}
-static void
-readline(void)
+void
+ao_cmd_readline(void)
- if (cmd_len >= CMD_LEN - 2)
+ if (cmd_len >= AO_CMD_LEN - 2)
continue;
cmd_line[cmd_len++] = c;
if (ao_echo())
continue;
cmd_line[cmd_len++] = c;
if (ao_echo())
ao_cmd_lex(void)
{
ao_cmd_lex_c = '\n';
if (cmd_i < cmd_len)
ao_cmd_lex_c = cmd_line[cmd_i++];
ao_cmd_lex(void)
{
ao_cmd_lex_c = '\n';
if (cmd_i < cmd_len)
ao_cmd_lex_c = cmd_line[cmd_i++];
void (*__xdata func)(void);
for (;;) {
void (*__xdata func)(void);
for (;;) {
ao_cmd_lex();
ao_cmd_white();
c = ao_cmd_lex_c;
ao_cmd_lex();
ao_cmd_white();
c = ao_cmd_lex_c;