From 6e013e76fc4730514206af073f000afc640a72db Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 8 Nov 2014 11:23:13 -0600 Subject: [PATCH] More global variable name changes for NuttX coding standards compatibility. Make sure that g_bas_end is initially false --- interpreters/bas/bas.c | 18 ++++++++++-------- interpreters/bas/bas.h | 14 ++++++++++---- interpreters/bas/global.c | 20 ++++++++++---------- interpreters/bas/main.c | 7 ++++--- interpreters/bas/statement.c | 4 ++-- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/interpreters/bas/bas.c b/interpreters/bas/bas.c index 89b8716f9..2260a5077 100644 --- a/interpreters/bas/bas.c +++ b/interpreters/bas/bas.c @@ -65,6 +65,10 @@ #include #include #include + +#include +#include +#include #include #include #include @@ -72,8 +76,6 @@ #include #include #include -#include -#include #include #include @@ -149,10 +151,10 @@ static int g_run_restricted; * Public Data ****************************************************************************/ -int bas_argc; -char *bas_argv0; -char **bas_argv; -int bas_end; +int g_bas_argc; +char *g_bas_argv0; +char **g_bas_argv; +bool g_bas_end; /**************************************************************************** * Private Function Prototypes @@ -2445,10 +2447,10 @@ void bas_interpreter(void) { runline(line + 1); Token_destroy(line); - if (FS_istty(STDCHANNEL) && bas_end > 0) + if (FS_istty(STDCHANNEL) && g_bas_end) { FS_putChars(STDCHANNEL, _("END program\n")); - bas_end = 0; + g_bas_end = false; } } else diff --git a/interpreters/bas/bas.h b/interpreters/bas/bas.h index 970e949d6..bf1700a96 100644 --- a/interpreters/bas/bas.h +++ b/interpreters/bas/bas.h @@ -59,6 +59,12 @@ #ifndef __APPS_EXAMPLES_BAS_BAS_H #define __APPS_EXAMPLES_BAS_BAS_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -70,10 +76,10 @@ * Public Data ****************************************************************************/ -extern int bas_argc; -extern char *bas_argv0; -extern char **bas_argv; -extern int bas_end; +extern int g_bas_argc; +extern char *g_bas_argv0; +extern char **g_bas_argv; +extern bool g_bas_end; /**************************************************************************** * Public Function Prototypes diff --git a/interpreters/bas/global.c b/interpreters/bas/global.c index f32b7159b..9d7e1d504 100644 --- a/interpreters/bas/global.c +++ b/interpreters/bas/global.c @@ -600,14 +600,14 @@ static struct Value *fn_command(struct Value *v, struct Auto *stack) int i; Value_new_STRING(v); - for (i = 0; i < bas_argc; ++i) + for (i = 0; i < g_bas_argc; ++i) { if (i) { String_appendChar(&v->u.string, ' '); } - String_appendChars(&v->u.string, bas_argv[i]); + String_appendChars(&v->u.string, g_bas_argv[i]); } return v; @@ -626,14 +626,14 @@ static struct Value *fn_commandi(struct Value *v, struct Auto *stack) Value_new_STRING(v); if (a == 0) { - if (bas_argv0 != (char *)0) + if (g_bas_argv0 != (char *)0) { - String_appendChars(&v->u.string, bas_argv0); + String_appendChars(&v->u.string, g_bas_argv0); } } - else if (a <= bas_argc) + else if (a <= g_bas_argc) { - String_appendChars(&v->u.string, bas_argv[a - 1]); + String_appendChars(&v->u.string, g_bas_argv[a - 1]); } return v; @@ -653,14 +653,14 @@ static struct Value *fn_commandd(struct Value *v, struct Auto *stack) Value_new_STRING(v); if (a == 0) { - if (bas_argv0 != (char *)0) + if (g_bas_argv0 != (char *)0) { - String_appendChars(&v->u.string, bas_argv0); + String_appendChars(&v->u.string, g_bas_argv0); } } - else if (a <= bas_argc) + else if (a <= g_bas_argc) { - String_appendChars(&v->u.string, bas_argv[a - 1]); + String_appendChars(&v->u.string, g_bas_argv[a - 1]); } return v; diff --git a/interpreters/bas/main.c b/interpreters/bas/main.c index 2cb9bc9c5..c772119eb 100644 --- a/interpreters/bas/main.c +++ b/interpreters/bas/main.c @@ -177,9 +177,10 @@ int bas_main(int argc, char *argv[]) exit(2); } - bas_argc = argc - optind; - bas_argv = &argv[optind]; - bas_argv0 = runFile; + g_bas_argc = argc - optind; + g_bas_argv = &argv[optind]; + g_bas_argv0 = runFile; + g_bas_end = false; bas_init(backslash_colon, restricted, uppercase, lpfd); if (runFile) diff --git a/interpreters/bas/statement.c b/interpreters/bas/statement.c index 8ecfd1d79..f8aa0fa0d 100644 --- a/interpreters/bas/statement.c +++ b/interpreters/bas/statement.c @@ -1315,8 +1315,8 @@ struct Value *stmt_END(struct Value *value) { if (g_pass == INTERPRET) { - g_pc = g_pc.token->u.endpc; - bas_end = 1; + g_pc = g_pc.token->u.endpc; + g_bas_end = true; } if (g_pass == DECLARE || g_pass == COMPILE)