From 39d25ce64a888d84a743d2fd514e822cc4484797 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 24 Nov 2014 08:41:04 -0600 Subject: BAS: Editor and shell commands are now configurable --- apps/interpreters/bas/Kconfig | 14 ++++++++++++++ apps/interpreters/bas/bas_error.h | 1 + apps/interpreters/bas/bas_statement.c | 8 ++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/apps/interpreters/bas/Kconfig b/apps/interpreters/bas/Kconfig index 27c67ac70..844aaa1eb 100644 --- a/apps/interpreters/bas/Kconfig +++ b/apps/interpreters/bas/Kconfig @@ -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 diff --git a/apps/interpreters/bas/bas_error.h b/apps/interpreters/bas/bas_error.h index a39801ac6..328eeb081 100644 --- a/apps/interpreters/bas/bas_error.h +++ b/apps/interpreters/bas/bas_error.h @@ -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 */ diff --git a/apps/interpreters/bas/bas_statement.c b/apps/interpreters/bas/bas_statement.c index 08bf46c65..051d66295 100644 --- a/apps/interpreters/bas/bas_statement.c +++ b/apps/interpreters/bas/bas_statement.c @@ -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 } -- cgit v1.2.3