BAS: Editor and shell commands are now configurable

This commit is contained in:
Gregory Nutt 2014-11-24 08:41:04 -06:00
parent 249ae54510
commit 053162a7c5
3 changed files with 19 additions and 4 deletions

View File

@ -72,5 +72,19 @@ config INTERPRETER_BAS_HAVE_FTRUNCATE
---help---
NuttX does not currently support the ftruncate interface
config EXAMPLES_BAS_SHELL
bool "Shell support"
default n
depends on ARCH_HAVE_VFORK && EXPERIMENTAL
---help---
Support execution of shell commands from BASIC.
config EXAMPLES_BAS_EDITOR
bool "Editor support"
default n
depends on EXAMPLES_BAS_SHELL && ARCH_HAVE_VFORK && EXPERIMENTAL
---help---
Support execution of an editor from BASIC.
endif

View File

@ -184,5 +184,6 @@
#define BADFORMAT RUNTIME+19,_("Syntax error in print format")
#define OUTOFMEMORY RUNTIME+20,_("Out of memory")
#define RESTRICTED RUNTIME+21,_("Restricted")
#define NOTAVAILABLE RUNTIME+22,_("Feature not available")
#endif /* __APPS_EXAMPLES_BAS_BAS_ERROR_H */

View File

@ -1070,7 +1070,7 @@ struct Value *stmt_DOcondition(struct Value *value)
struct Value *stmt_EDIT(struct Value *value)
{
#ifdef CONFIG_ARCH_HAVE_VFORK
#if defined(CONFIG_EXAMPLES_BAS_EDITOR) && defined(CONFIG_EXAMPLES_BAS_SHELL) && defined(CONFIG_ARCH_HAVE_VFORK)
long int line;
struct Pc statementpc = g_pc;
int status;
@ -1268,7 +1268,7 @@ struct Value *stmt_EDIT(struct Value *value)
return (struct Value *)0;
#else
return Value_new_ERROR(value, FORKFAILED, strerror(ENOSYS));
return Value_new_ERROR(value, NOTAVAILABLE, strerror(ENOSYS));
#endif
}
@ -5680,7 +5680,7 @@ struct Value *stmt_SELECTCASE(struct Value *value)
struct Value *stmt_SHELL(struct Value *value)
{
#ifdef CONFIG_ARCH_HAVE_VFORK
#if defined(CONFIG_EXAMPLES_BAS_SHELL) && defined(CONFIG_ARCH_HAVE_VFORK)
pid_t pid;
int status;
@ -5779,7 +5779,7 @@ struct Value *stmt_SHELL(struct Value *value)
return (struct Value *)0;
#else
return Value_new_ERROR(value, FORKFAILED, strerror(ENOSYS));
return Value_new_ERROR(value, NOTAVAILABLE, strerror(ENOSYS));
#endif
}