More global variable name changes for NuttX coding standards compatibility. Make sure that g_bas_end is initially false
This commit is contained in:
parent
021de85bfe
commit
6e013e76fc
@ -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
|
||||
|
@ -59,6 +59,12 @@
|
||||
#ifndef __APPS_EXAMPLES_BAS_BAS_H
|
||||
#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
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user