Remove dependencies on environ, fstat, GETTEXt, TERMCAP, ncurse, syscfg
This commit is contained in:
parent
abf3770bb2
commit
3b4976559e
@ -35,25 +35,5 @@ config INTERPRETERS_BAS
|
|||||||
|
|
||||||
if INTERPRETERS_BAS
|
if INTERPRETERS_BAS
|
||||||
|
|
||||||
config INTERPRETER_BAS_HAVE_ENVIRON
|
|
||||||
bool
|
|
||||||
default n
|
|
||||||
depends on EXPERIMENTAL
|
|
||||||
---help---
|
|
||||||
NuttX does not support the environ variable
|
|
||||||
|
|
||||||
config INTERPRETER_BAS_HAVE_FSTAT
|
|
||||||
bool
|
|
||||||
default n
|
|
||||||
depends on EXPERIMENTAL
|
|
||||||
---help---
|
|
||||||
NuttX does not support the fstat() function
|
|
||||||
|
|
||||||
config INTERPRETER_BAS_HAVE_SYSCFG
|
|
||||||
bool
|
|
||||||
default n
|
|
||||||
depends on EXPERIMENTAL
|
|
||||||
---help---
|
|
||||||
NuttX does not support the syscfg() function
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -65,12 +65,6 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
# include <libintl.h>
|
|
||||||
# define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
# define _(String) String
|
|
||||||
#endif
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -81,6 +75,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define INCREASE_STACK 16
|
#define INCREASE_STACK 16
|
||||||
|
#define _(String) String
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
|
@ -11,12 +11,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
# include <libintl.h>
|
|
||||||
# define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
# define _(String) String
|
|
||||||
#endif
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -41,9 +35,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define DIRECTMODE (pc.line== -1)
|
#define DIRECTMODE (pc.line== -1)
|
||||||
#ifndef __GNUC__
|
#define _(String) String
|
||||||
# define inline
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
@ -1862,10 +1854,6 @@ more:
|
|||||||
|
|
||||||
void bas_init(int backslash_colon, int restricted, int uppercase, int lpfd)
|
void bas_init(int backslash_colon, int restricted, int uppercase, int lpfd)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
bindtextdomain("bas", LOCALEDIR);
|
|
||||||
textdomain("bas");
|
|
||||||
#endif
|
|
||||||
stack.begindata.line = -1;
|
stack.begindata.line = -1;
|
||||||
Token_init(backslash_colon, uppercase);
|
Token_init(backslash_colon, uppercase);
|
||||||
Global_new(&globals);
|
Global_new(&globals);
|
||||||
|
@ -5,12 +5,6 @@
|
|||||||
/* The package name. */
|
/* The package name. */
|
||||||
#define PACKAGE "bas"
|
#define PACKAGE "bas"
|
||||||
|
|
||||||
/* Should we need to include termcap.h? */
|
|
||||||
/* #undef HAVE_TERMCAP_H */
|
|
||||||
|
|
||||||
/* Should we need to include curses.h? */
|
|
||||||
/* #undef HAVE_CURSES_H */
|
|
||||||
|
|
||||||
/* Is there a tgmath.h? */
|
/* Is there a tgmath.h? */
|
||||||
/* #undef HAVE_TGMATH_H */
|
/* #undef HAVE_TGMATH_H */
|
||||||
|
|
||||||
@ -30,8 +24,5 @@
|
|||||||
/* #undef _FILE_OFFSET_BITS */
|
/* #undef _FILE_OFFSET_BITS */
|
||||||
/* #undef _LARGE_FILES */
|
/* #undef _LARGE_FILES */
|
||||||
|
|
||||||
/* Define if you have the msgfmt(1) program and the gettext(3) function. */
|
|
||||||
/* #undef HAVE_GETTEXT */
|
|
||||||
|
|
||||||
/* Define if timeouts do not work in your termios (broken termios). */
|
/* Define if timeouts do not work in your termios (broken termios). */
|
||||||
/* #undef USE_SELECT */
|
/* #undef USE_SELECT */
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
#ifndef ERROR_H
|
#ifndef ERROR_H
|
||||||
#define ERROR_H
|
#define ERROR_H
|
||||||
|
|
||||||
//#include "config.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
#include <libintl.h>
|
|
||||||
#define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
#define _(String) String
|
#define _(String) String
|
||||||
#endif
|
|
||||||
|
|
||||||
#define STATIC 100
|
#define STATIC 100
|
||||||
|
|
||||||
|
@ -67,21 +67,9 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef CONFIG_INTERPRETER_BAS_HAVE_FSTAT
|
|
||||||
# include <sys/stat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
# include <libintl.h>
|
|
||||||
# define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
# define _(String) String
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -89,12 +77,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef HAVE_TERMCAP_H
|
|
||||||
# include <termcap.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_CURSES_H
|
|
||||||
# include <curses.h>
|
|
||||||
#endif
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
@ -106,6 +88,8 @@
|
|||||||
#define LINEWIDTH 80
|
#define LINEWIDTH 80
|
||||||
#define COLWIDTH 14
|
#define COLWIDTH 14
|
||||||
|
|
||||||
|
#define _(String) String
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -1532,12 +1516,8 @@ long int FS_loc(int chn)
|
|||||||
|
|
||||||
long int FS_lof(int chn)
|
long int FS_lof(int chn)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_INTERPRETER_BAS_HAVE_FSTAT
|
|
||||||
struct stat buf;
|
|
||||||
#else
|
|
||||||
off_t curpos;
|
off_t curpos;
|
||||||
off_t endpos;
|
off_t endpos;
|
||||||
#endif
|
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (opened(chn, -1) == -1)
|
if (opened(chn, -1) == -1)
|
||||||
@ -1565,16 +1545,6 @@ long int FS_lof(int chn)
|
|||||||
assert(fd != -1);
|
assert(fd != -1);
|
||||||
|
|
||||||
/* Get the size of the file */
|
/* Get the size of the file */
|
||||||
|
|
||||||
#ifdef CONFIG_INTERPRETER_BAS_HAVE_FSTAT
|
|
||||||
if (fstat(fd, &buf) == -1)
|
|
||||||
{
|
|
||||||
FS_errmsg = strerror(errno);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (long int)(buf.st_size / file[chn]->recLength);
|
|
||||||
#else
|
|
||||||
/* Save the current file position */
|
/* Save the current file position */
|
||||||
|
|
||||||
curpos = lseek(fd, 0, SEEK_CUR);
|
curpos = lseek(fd, 0, SEEK_CUR);
|
||||||
@ -1603,7 +1573,6 @@ long int FS_lof(int chn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (long int)(endpos / file[chn]->recLength);
|
return (long int)(endpos / file[chn]->recLength);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long int FS_recLength(int chn)
|
long int FS_recLength(int chn)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Global variables and functions. */
|
/* Global variables and functions. */
|
||||||
/* #includes */ /*{{{C}}}*//*{{{*/
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@ -7,12 +7,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
#include <libintl.h>
|
|
||||||
#define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
#define _(String) String
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -35,14 +29,12 @@
|
|||||||
#endif
|
#endif
|
||||||
/*}}}*/
|
/*}}}*/
|
||||||
|
|
||||||
#ifdef CONFIG_INTERPRETER_BAS_HAVE_ENVIRON
|
|
||||||
extern char **environ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef RAND_MAX
|
#ifndef RAND_MAX
|
||||||
# define RAND_MAX 32767
|
# define RAND_MAX 32767
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _(String) String
|
||||||
|
|
||||||
static int wildcardmatch(const char *a, const char *pattern) /*{{{*/
|
static int wildcardmatch(const char *a, const char *pattern) /*{{{*/
|
||||||
{
|
{
|
||||||
while (*pattern)
|
while (*pattern)
|
||||||
@ -1340,11 +1332,7 @@ static struct Value *fn_tan(struct Value *v, struct Auto *stack) /*{{{*/
|
|||||||
/*}}}*/
|
/*}}}*/
|
||||||
static struct Value *fn_timei(struct Value *v, struct Auto *stack) /*{{{*/
|
static struct Value *fn_timei(struct Value *v, struct Auto *stack) /*{{{*/
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_INTERPRETER_BAS_HAVE_SYSCFG
|
|
||||||
return Value_new_INTEGER(v,(unsigned long)(clock_systimer()/(sysconf(_SC_CLK_TCK)/100.0)));
|
|
||||||
#else
|
|
||||||
return Value_new_INTEGER(v,(unsigned long)(clock_systimer()/(CLK_TCK/100.0)));
|
return Value_new_INTEGER(v,(unsigned long)(clock_systimer()/(CLK_TCK/100.0)));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/*}}}*/
|
/*}}}*/
|
||||||
static struct Value *fn_times(struct Value *v, struct Auto *stack) /*{{{*/
|
static struct Value *fn_times(struct Value *v, struct Auto *stack) /*{{{*/
|
||||||
|
@ -65,18 +65,18 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
# include <libintl.h>
|
|
||||||
# define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
# define _(String) String
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "bas.h"
|
#include "bas.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define _(String) String
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -96,11 +96,6 @@ int bas_main(int argc, char *argv[])
|
|||||||
int restricted = 0;
|
int restricted = 0;
|
||||||
int lpfd;
|
int lpfd;
|
||||||
|
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
bindtextdomain("bas", LOCALEDIR);
|
|
||||||
textdomain("bas");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* parse arguments */
|
/* parse arguments */
|
||||||
|
|
||||||
while ((o = getopt(argc, argv, ":bl:ruVh")) != EOF)
|
while ((o = getopt(argc, argv, ":bl:ruVh")) != EOF)
|
||||||
|
@ -65,12 +65,6 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
# include <libintl.h>
|
|
||||||
# define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
# define _(String) String
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -80,6 +74,12 @@
|
|||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define _(String) String
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
#include <libintl.h>
|
|
||||||
#define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
#define _(String) String
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "statement.h"
|
#include "statement.h"
|
||||||
|
|
||||||
|
#define _(String) String
|
||||||
|
|
||||||
struct Value *stmt_CALL(struct Value *value)
|
struct Value *stmt_CALL(struct Value *value)
|
||||||
{
|
{
|
||||||
++pc.token;
|
++pc.token;
|
||||||
|
@ -66,27 +66,8 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
# include <libintl.h>
|
|
||||||
# define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
# define _(String) String
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/* Buggy on some systems */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
# ifdef HAVE_TGMATH_H
|
|
||||||
# include <tgmath.h>
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
extern long int lrint(double x);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -95,6 +76,18 @@ extern long int lrint(double x);
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define _(String) String
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
extern long int lrint(double x);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -5,18 +5,18 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#ifdef HAVE_GETTEXT
|
|
||||||
# include <libintl.h>
|
|
||||||
# define _(String) gettext(String)
|
|
||||||
#else
|
|
||||||
# define _(String) String
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define _(String) String
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user