diff --git a/interpreters/bas/Kconfig b/interpreters/bas/Kconfig index 27c67ac70..844aaa1eb 100644 --- a/interpreters/bas/Kconfig +++ b/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/interpreters/bas/bas_error.h b/interpreters/bas/bas_error.h index a39801ac6..328eeb081 100644 --- a/interpreters/bas/bas_error.h +++ b/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/interpreters/bas/bas_statement.c b/interpreters/bas/bas_statement.c index 08bf46c65..051d66295 100644 --- a/interpreters/bas/bas_statement.c +++ b/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 }