BAS: Another function is closer to the NuttX coding style
This commit is contained in:
parent
15d7d85c19
commit
ac331fc76f
@ -39,12 +39,8 @@ include $(APPDIR)/Make.defs
|
||||
|
||||
# BAS Library
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_INTERPRETERS_BAS),y)
|
||||
|
||||
CSRCS += auto.c bas.c fs.c global.c main.c program.c str.c token.c value.c
|
||||
ASRCS =
|
||||
CSRCS = auto.c bas.c fs.c global.c main.c program.c str.c token.c value.c
|
||||
CSRCS += var.c
|
||||
|
||||
DEPPATH = --dep-path .
|
||||
@ -54,8 +50,6 @@ ifeq ($(WINTOOL),y)
|
||||
INCDIROPT = -w
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
@ -118,6 +112,4 @@ distclean: clean
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* apps/examples/interpreters/bas/value.c
|
||||
* apps/examples/interpreters/bas/fs.c
|
||||
* BASIC file system interface.
|
||||
*
|
||||
* Copyright (c) 1999-2014 Michael Haardt
|
||||
@ -78,8 +78,6 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <nuttx/ascii.h>
|
||||
|
||||
#include "fs.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -281,68 +279,32 @@ static int edit(int chn, int onl)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check for the backspace charactor */
|
||||
|
||||
if (ch == ASCII_BS)
|
||||
{
|
||||
if (f->inCapacity)
|
||||
{
|
||||
#ifdef CONFIG_INTERPREPTER_BAS_VT100
|
||||
/* REVISIT: Use VT100 commands to erase: Move cursor back and erase to the end of the line */
|
||||
/* REVISIT: Use VT100 commands to erase */
|
||||
#warning Missing Logic
|
||||
#else
|
||||
/* Use backspace to erase */
|
||||
|
||||
if (f->inBuf[f->inCapacity - 1] >= '\0' &&
|
||||
f->inBuf[f->inCapacity - 1] < ' ')
|
||||
{
|
||||
FS_putChars(chn, "\b\b \b\b");
|
||||
}
|
||||
else
|
||||
{
|
||||
FS_putChars(chn, "\b \b");
|
||||
}
|
||||
#endif
|
||||
--f->inCapacity;
|
||||
}
|
||||
}
|
||||
|
||||
/* Is there space for another character in the buffer? */
|
||||
|
||||
else if ((f->inCapacity + 1) < sizeof(f->inBuf))
|
||||
if ((f->inCapacity + 1) < sizeof(f->inBuf))
|
||||
{
|
||||
/* Yes.. Was this a new line character? */
|
||||
|
||||
if (ch != '\n')
|
||||
{
|
||||
/* No.. was this an ASCII control character? */
|
||||
|
||||
if (ch >= '\0' && ch < ' ')
|
||||
{
|
||||
/* Yes.. Echo control characters as escape sequences */
|
||||
|
||||
FS_putChar(chn, '^');
|
||||
FS_putChar(chn, ch ? (ch + 'a' - 1) : '@');
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No.. Just echo the character */
|
||||
|
||||
FS_putChar(chn, ch);
|
||||
}
|
||||
}
|
||||
|
||||
/* Should we echo newline characters? */
|
||||
|
||||
else if (onl)
|
||||
{
|
||||
FS_putChar(chn, '\n');
|
||||
}
|
||||
|
||||
/* Put the raw character into the buffer in any event */
|
||||
|
||||
f->inBuf[f->inCapacity++] = ch;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
while (ch != '\n');
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user