diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-08 11:23:13 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-08 11:23:13 -0600 |
commit | 8d574280b36ca70b32c3643c02652da52b669dd7 (patch) | |
tree | dd7dd9cc989f6b9c5b7197a77512f4571a983f95 /apps/interpreters | |
parent | d909d585495165363e6c6f5f45c2a7c37a1d6624 (diff) | |
download | px4-nuttx-8d574280b36ca70b32c3643c02652da52b669dd7.tar.gz px4-nuttx-8d574280b36ca70b32c3643c02652da52b669dd7.tar.bz2 px4-nuttx-8d574280b36ca70b32c3643c02652da52b669dd7.zip |
More global variable name changes for NuttX coding standards compatibility. Make sure that g_bas_end is initially false
Diffstat (limited to 'apps/interpreters')
-rw-r--r-- | apps/interpreters/bas/bas.c | 18 | ||||
-rw-r--r-- | apps/interpreters/bas/bas.h | 14 | ||||
-rw-r--r-- | apps/interpreters/bas/global.c | 20 | ||||
-rw-r--r-- | apps/interpreters/bas/main.c | 7 | ||||
-rw-r--r-- | apps/interpreters/bas/statement.c | 4 |
5 files changed, 36 insertions, 27 deletions
diff --git a/apps/interpreters/bas/bas.c b/apps/interpreters/bas/bas.c index 89b8716f9..2260a5077 100644 --- a/apps/interpreters/bas/bas.c +++ b/apps/interpreters/bas/bas.c @@ -65,6 +65,10 @@ #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> + +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> #include <assert.h> #include <ctype.h> #include <errno.h> @@ -72,8 +76,6 @@ #include <limits.h> #include <math.h> #include <string.h> -#include <stdlib.h> -#include <stdio.h> #include <time.h> #include <unistd.h> @@ -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/apps/interpreters/bas/bas.h b/apps/interpreters/bas/bas.h index 970e949d6..bf1700a96 100644 --- a/apps/interpreters/bas/bas.h +++ b/apps/interpreters/bas/bas.h @@ -60,6 +60,12 @@ #define __APPS_EXAMPLES_BAS_BAS_H /**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <stdbool.h> + +/**************************************************************************** * 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/apps/interpreters/bas/global.c b/apps/interpreters/bas/global.c index f32b7159b..9d7e1d504 100644 --- a/apps/interpreters/bas/global.c +++ b/apps/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/apps/interpreters/bas/main.c b/apps/interpreters/bas/main.c index 2cb9bc9c5..c772119eb 100644 --- a/apps/interpreters/bas/main.c +++ b/apps/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/apps/interpreters/bas/statement.c b/apps/interpreters/bas/statement.c index 8ecfd1d79..f8aa0fa0d 100644 --- a/apps/interpreters/bas/statement.c +++ b/apps/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) |