Commit d77666c0 authored by sergio's avatar sergio Committed by Terry Ellison
Browse files

trailing spaces cleanup (#2659)

parent d7583040
...@@ -22,7 +22,7 @@ endif ...@@ -22,7 +22,7 @@ endif
# makefile at its root level - these are then overridden # makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein # for a subtree within the makefile rooted therein
# #
#DEFINES += #DEFINES +=
############################################################# #############################################################
# Recursion Magic - Don't touch this!! # Recursion Magic - Don't touch this!!
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#define _C_LOCALE_H_ #define _C_LOCALE_H_
#include <locale.h> #include <locale.h>
#if 0 #if 0
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
double floor(double x) double floor(double x)
{ {
return (double) (x < 0.f ? ((int) x == x ? x : (((int) x) - 1)) : ((int) x)); return (double) (x < 0.f ? ((int) x == x ? x : (((int) x) - 1)) : ((int) x));
} }
#define MAXEXP 2031 /* (MAX_EXP * 16) - 1 */ #define MAXEXP 2031 /* (MAX_EXP * 16) - 1 */
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
typedef char * va_list; typedef char * va_list;
#define _INTSIZEOF(n) ((sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1)) #define _INTSIZEOF(n) ((sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1))
#define va_start(ap,v) (ap = (va_list)&v + _INTSIZEOF(v)) #define va_start(ap,v) (ap = (va_list)&v + _INTSIZEOF(v))
#define va_arg(ap,t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) #define va_arg(ap,t) (*(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)))
......
...@@ -5,7 +5,7 @@ typedef signed int ptrdiff_t; ...@@ -5,7 +5,7 @@ typedef signed int ptrdiff_t;
#if !defined(offsetof) #if !defined(offsetof)
#define offsetof(s, m) (size_t)&(((s *)0)->m) #define offsetof(s, m) (size_t)&(((s *)0)->m)
#endif #endif
#if !defined(__size_t) #if !defined(__size_t)
#define __size_t 1 #define __size_t 1
......
...@@ -261,7 +261,7 @@ typedef unsigned __int64 uintmax_t; ...@@ -261,7 +261,7 @@ typedef unsigned __int64 uintmax_t;
using ::std::uintptr_t; using ::std::uintptr_t;
using ::std::intmax_t; using ::std::intmax_t;
using ::std::uintmax_t; using ::std::uintmax_t;
#endif #endif
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif #endif
......
...@@ -69,7 +69,7 @@ int c_stderr = 1001; ...@@ -69,7 +69,7 @@ int c_stderr = 1001;
/* /*
* Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se) * Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se)
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
...@@ -119,7 +119,7 @@ strichr(char *p, int c) ...@@ -119,7 +119,7 @@ strichr(char *p, int c)
/* /*
* Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se) * Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se)
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
...@@ -193,7 +193,7 @@ str_fmt(char *p, int size, int fmt) ...@@ -193,7 +193,7 @@ str_fmt(char *p, int size, int fmt)
/* /*
* Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se) * Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se)
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
...@@ -239,7 +239,7 @@ strtoupper(char *p) ...@@ -239,7 +239,7 @@ strtoupper(char *p)
/* /*
* Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se) * Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se)
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
...@@ -367,7 +367,7 @@ _atob (u_quad_t *vp, char *p, int base) ...@@ -367,7 +367,7 @@ _atob (u_quad_t *vp, char *p, int base)
} }
/* /*
* atob(vp,p,base) * atob(vp,p,base)
* converts p to binary result in vp, rtn 1 on success * converts p to binary result in vp, rtn 1 on success
*/ */
int int
...@@ -386,7 +386,7 @@ atob(u_int32_t *vp, char *p, int base) ...@@ -386,7 +386,7 @@ atob(u_int32_t *vp, char *p, int base)
/* /*
* llatob(vp,p,base) * llatob(vp,p,base)
* converts p to binary result in vp, rtn 1 on success * converts p to binary result in vp, rtn 1 on success
*/ */
int int
...@@ -399,7 +399,7 @@ llatob(u_quad_t *vp, char *p, int base) ...@@ -399,7 +399,7 @@ llatob(u_quad_t *vp, char *p, int base)
/* /*
* char *btoa(dst,value,base) * char *btoa(dst,value,base)
* converts value to ascii, result in dst * converts value to ascii, result in dst
*/ */
char * char *
...@@ -445,7 +445,7 @@ btoa(char *dst, u_int value, int base) ...@@ -445,7 +445,7 @@ btoa(char *dst, u_int value, int base)
} }
/* /*
* char *btoa(dst,value,base) * char *btoa(dst,value,base)
* converts value to ascii, result in dst * converts value to ascii, result in dst
*/ */
char * char *
...@@ -491,8 +491,8 @@ llbtoa(char *dst, u_quad_t value, int base) ...@@ -491,8 +491,8 @@ llbtoa(char *dst, u_quad_t value, int base)
} }
/* /*
* gethex(vp,p,n) * gethex(vp,p,n)
* convert n hex digits from p to binary, result in vp, * convert n hex digits from p to binary, result in vp,
* rtn 1 on success * rtn 1 on success
*/ */
int int
...@@ -525,7 +525,7 @@ gethex(int32_t *vp, char *p, int n) ...@@ -525,7 +525,7 @@ gethex(int32_t *vp, char *p, int n)
/* /*
* Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se) * Copyright (c) 2000-2002 Opsycon AB (www.opsycon.se)
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
...@@ -565,7 +565,7 @@ gethex(int32_t *vp, char *p, int n) ...@@ -565,7 +565,7 @@ gethex(int32_t *vp, char *p, int n)
/* /*
* int vsprintf(d,s,ap) * int vsprintf(d,s,ap)
*/ */
int int
vsprintf (char *d, const char *s, va_list ap) vsprintf (char *d, const char *s, va_list ap)
{ {
const char *t; const char *t;
...@@ -703,7 +703,7 @@ void dtoa (char *dbuf, rtype arg, int fmtch, int width, int prec); ...@@ -703,7 +703,7 @@ void dtoa (char *dbuf, rtype arg, int fmtch, int width, int prec);
} }
*d = 0; *d = 0;
return (d - dst); return (d - dst);
} }
#ifdef FLOATINGPT #ifdef FLOATINGPT
/* /*
...@@ -761,7 +761,7 @@ extern double modf(double, double *); ...@@ -761,7 +761,7 @@ extern double modf(double, double *);
static int cvt (rtype arg, int prec, char *signp, int fmtch, static int cvt (rtype arg, int prec, char *signp, int fmtch,
char *startp, char *endp); char *startp, char *endp);
static char *c_round (double fract, int *exp, char *start, char *end, static char *c_round (double fract, int *exp, char *start, char *end,
char ch, char *signp); char ch, char *signp);
static char *exponent(char *p, int exp, int fmtch); static char *exponent(char *p, int exp, int fmtch);
...@@ -801,7 +801,7 @@ void dtoa (char *dbuf, rtype arg, int fmtch, int width, int prec) ...@@ -801,7 +801,7 @@ void dtoa (char *dbuf, rtype arg, int fmtch, int width, int prec)
if( !_finite(arg) ) { if( !_finite(arg) ) {
if( _isNan(arg) ) if( _isNan(arg) )
strcpy (dbuf, "NaN"); strcpy (dbuf, "NaN");
else if( arg < 0) else if( arg < 0)
strcpy (dbuf, "-Infinity"); strcpy (dbuf, "-Infinity");
else else
strcpy (dbuf, "Infinity"); strcpy (dbuf, "Infinity");
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* @(#)printf.c 8.1 (Berkeley) 6/11/93 * @(#)printf.c 8.1 (Berkeley) 6/11/93
*/ */
// This version uses almost no stack, and does not suffer from buffer // This version uses almost no stack, and does not suffer from buffer
// overflows. The downside is that it does not implement a wide range // overflows. The downside is that it does not implement a wide range
// of formatting characters. // of formatting characters.
...@@ -157,7 +157,7 @@ kprintn(void (*put)(const char), uint32_t ul, int base, int width, char padchar) ...@@ -157,7 +157,7 @@ kprintn(void (*put)(const char), uint32_t ul, int base, int width, char padchar)
do { do {
*p++ = "0123456789abcdef"[ul % base]; *p++ = "0123456789abcdef"[ul % base];
} while (ul /= base); } while (ul /= base);
while (p - buf < width--) { while (p - buf < width--) {
put(padchar); put(padchar);
} }
......
...@@ -213,7 +213,7 @@ LUA_API void lua_replace (lua_State *L, int idx) { ...@@ -213,7 +213,7 @@ LUA_API void lua_replace (lua_State *L, int idx) {
if (!func) if (!func)
luaG_runerror(L, "attempt to set environment on lightfunction"); luaG_runerror(L, "attempt to set environment on lightfunction");
else { else {
api_check(L, ttistable(L->top - 1)); api_check(L, ttistable(L->top - 1));
func->c.env = hvalue(L->top - 1); func->c.env = hvalue(L->top - 1);
luaC_barrier(L, func, L->top - 1); luaC_barrier(L, func, L->top - 1);
} }
...@@ -411,7 +411,7 @@ LUA_API const void *lua_topointer (lua_State *L, int idx) { ...@@ -411,7 +411,7 @@ LUA_API const void *lua_topointer (lua_State *L, int idx) {
case LUA_TUSERDATA: case LUA_TUSERDATA:
case LUA_TLIGHTUSERDATA: case LUA_TLIGHTUSERDATA:
return lua_touserdata(L, idx); return lua_touserdata(L, idx);
case LUA_TROTABLE: case LUA_TROTABLE:
return rvalue(o); return rvalue(o);
case LUA_TLIGHTFUNCTION: case LUA_TLIGHTFUNCTION:
return fvalue(o); return fvalue(o);
...@@ -585,7 +585,7 @@ LUA_API void lua_rawget (lua_State *L, int idx) { ...@@ -585,7 +585,7 @@ LUA_API void lua_rawget (lua_State *L, int idx) {
t = index2adr(L, idx); t = index2adr(L, idx);
api_check(L, ttistable(t) || ttisrotable(t)); api_check(L, ttistable(t) || ttisrotable(t));
res = ttistable(t) ? luaH_get(hvalue(t), L->top - 1) : luaH_get_ro(rvalue(t), L->top - 1); res = ttistable(t) ? luaH_get(hvalue(t), L->top - 1) : luaH_get_ro(rvalue(t), L->top - 1);
setobj2s(L, L->top - 1, res); setobj2s(L, L->top - 1, res);
lua_unlock(L); lua_unlock(L);
} }
...@@ -625,7 +625,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { ...@@ -625,7 +625,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) {
break; break;
case LUA_TROTABLE: case LUA_TROTABLE:
mt = (Table*)luaR_getmeta(rvalue(obj)); mt = (Table*)luaR_getmeta(rvalue(obj));
break; break;
default: default:
mt = G(L)->mt[ttype(obj)]; mt = G(L)->mt[ttype(obj)];
break; break;
...@@ -813,7 +813,7 @@ LUA_API int lua_setfenv (lua_State *L, int idx) { ...@@ -813,7 +813,7 @@ LUA_API int lua_setfenv (lua_State *L, int idx) {
#define checkresults(L,na,nr) \ #define checkresults(L,na,nr) \
api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)))
LUA_API void lua_call (lua_State *L, int nargs, int nresults) { LUA_API void lua_call (lua_State *L, int nargs, int nresults) {
StkId func; StkId func;
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#define LUA_USELIGHTFUNCTIONS 1 #define LUA_USELIGHTFUNCTIONS 1
//#define DEBUG_ALLOCATOR //#define DEBUG_ALLOCATOR
#ifdef DEBUG_ALLOCATOR #ifdef DEBUG_ALLOCATOR
#ifdef LUA_CROSS_COMPILER #ifdef LUA_CROSS_COMPILER
static void break_hook(void) {} static void break_hook(void) {}
#define ASSERT(s) if (!(s)) {break_hook();} #define ASSERT(s) if (!(s)) {break_hook();}
...@@ -86,7 +86,7 @@ typedef struct Memcontrol { /* memory-allocator control variables */ ...@@ -86,7 +86,7 @@ typedef struct Memcontrol { /* memory-allocator control variables */
static Memcontrol mc = {NULL,0,0,0,32768*64}; static Memcontrol mc = {NULL,0,0,0,32768*64};
static size_t marker[2] = {0,0}; static size_t marker[2] = {0,0};
static void scanBlocks (void) { static void scanBlocks (void) {
MemHeader *p = mc.start; MemHeader *p = mc.start;
int i; int i;
char s,e; char s,e;
...@@ -99,7 +99,7 @@ static void scanBlocks (void) { ...@@ -99,7 +99,7 @@ static void scanBlocks (void) {
} }
} }
static int checkBlocks (void) { static int checkBlocks (void) {
MemHeader *p = mc.start; MemHeader *p = mc.start;
while(p) { while(p) {
if (memcmp(p->mark, marker, MARKSIZE) || if (memcmp(p->mark, marker, MARKSIZE) ||
...@@ -157,7 +157,7 @@ void *debug_realloc (void *b, size_t oldsize, size_t size) { ...@@ -157,7 +157,7 @@ void *debug_realloc (void *b, size_t oldsize, size_t size) {
size_t commonsize = (oldsize < size) ? oldsize : size; size_t commonsize = (oldsize < size) ? oldsize : size;
size_t realsize = sizeof(MemHeader) + size + MARKSIZE; size_t realsize = sizeof(MemHeader) + size + MARKSIZE;
newblock = cast(MemHeader *, c_malloc(realsize)); /* alloc a new block */ newblock = cast(MemHeader *, c_malloc(realsize)); /* alloc a new block */
if (newblock == NULL) if (newblock == NULL)
return NULL; /* really out of memory? */ return NULL; /* really out of memory? */
if (block) { if (block) {
memcpy(newblock + 1, block + 1, commonsize); /* copy old contents */ memcpy(newblock + 1, block + 1, commonsize); /* copy old contents */
...@@ -167,7 +167,7 @@ void *debug_realloc (void *b, size_t oldsize, size_t size) { ...@@ -167,7 +167,7 @@ void *debug_realloc (void *b, size_t oldsize, size_t size) {
if (size > commonsize) if (size > commonsize)
fillmem(cast(char *, newblock + 1) + commonsize, size - commonsize); fillmem(cast(char *, newblock + 1) + commonsize, size - commonsize);
/* initialize marks after block */ /* initialize marks after block */
memset(newblock->mark, MARK, MARKSIZE); memset(newblock->mark, MARK, MARKSIZE);
newblock->size = size; newblock->size = size;
newblock->next = mc.start; newblock->next = mc.start;
mc.start = newblock; mc.start = newblock;
...@@ -315,7 +315,7 @@ LUALIB_API void luaL_checkanyfunction (lua_State *L, int narg) { ...@@ -315,7 +315,7 @@ LUALIB_API void luaL_checkanyfunction (lua_State *L, int narg) {
if (lua_type(L, narg) != LUA_TFUNCTION && lua_type(L, narg) != LUA_TLIGHTFUNCTION) { if (lua_type(L, narg) != LUA_TFUNCTION && lua_type(L, narg) != LUA_TLIGHTFUNCTION) {
const char *msg = lua_pushfstring(L, "function or lightfunction expected, got %s", const char *msg = lua_pushfstring(L, "function or lightfunction expected, got %s",
luaL_typename(L, narg)); luaL_typename(L, narg));
luaL_argerror(L, narg, msg); luaL_argerror(L, narg, msg);
} }
} }
...@@ -323,7 +323,7 @@ LUALIB_API void luaL_checkanytable (lua_State *L, int narg) { ...@@ -323,7 +323,7 @@ LUALIB_API void luaL_checkanytable (lua_State *L, int narg) {
if (lua_type(L, narg) != LUA_TTABLE && lua_type(L, narg) != LUA_TROTABLE) { if (lua_type(L, narg) != LUA_TTABLE && lua_type(L, narg) != LUA_TROTABLE) {
const char *msg = lua_pushfstring(L, "table or rotable expected, got %s", const char *msg = lua_pushfstring(L, "table or rotable expected, got %s",
luaL_typename(L, narg)); luaL_typename(L, narg));
luaL_argerror(L, narg, msg); luaL_argerror(L, narg, msg);
} }
} }
...@@ -412,11 +412,11 @@ LUALIB_API void (luaL_register) (lua_State *L, const char *libname, ...@@ -412,11 +412,11 @@ LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
LUALIB_API void (luaL_register_light) (lua_State *L, const char *libname, LUALIB_API void (luaL_register_light) (lua_State *L, const char *libname,
const luaL_Reg *l) { const luaL_Reg *l) {
#if LUA_OPTIMIZE_MEMORY > 0 #if LUA_OPTIMIZE_MEMORY > 0
luaI_openlib(L, libname, l, 0, LUA_USELIGHTFUNCTIONS); luaI_openlib(L, libname, l, 0, LUA_USELIGHTFUNCTIONS);
#else #else
luaI_openlib(L, libname, l, 0, LUA_USECCLOSURES); luaI_openlib(L, libname, l, 0, LUA_USECCLOSURES);
#endif #endif
} }
static int libsize (const luaL_Reg *l) { static int libsize (const luaL_Reg *l) {
...@@ -922,7 +922,7 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { ...@@ -922,7 +922,7 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
void *nptr; void *nptr;
if (nsize == 0) { if (nsize == 0) {
#ifdef DEBUG_ALLOCATOR #ifdef DEBUG_ALLOCATOR
return (void *)this_realloc(ptr, osize, nsize); return (void *)this_realloc(ptr, osize, nsize);
#else #else
c_free(ptr); c_free(ptr);
...@@ -952,7 +952,7 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { ...@@ -952,7 +952,7 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
} }
LUALIB_API void luaL_assertfail(const char *file, int line, const char *message) { LUALIB_API void luaL_assertfail(const char *file, int line, const char *message) {
dbg_printf("ASSERT@%s(%d): %s\n", file, line, message); dbg_printf("ASSERT@%s(%d): %s\n", file, line, message);
#if defined(LUA_CROSS_COMPILER) #if defined(LUA_CROSS_COMPILER)
exit(1); exit(1);
#endif #endif
...@@ -962,11 +962,11 @@ LUALIB_API void luaL_assertfail(const char *file, int line, const char *message) ...@@ -962,11 +962,11 @@ LUALIB_API void luaL_assertfail(const char *file, int line, const char *message)
/* /*
* This is a simple stub used by lua_assert() if DEVELOPMENT_USE_GDB is defined. * This is a simple stub used by lua_assert() if DEVELOPMENT_USE_GDB is defined.
* Instead of crashing out with an assert error, this hook starts the GDB remote * Instead of crashing out with an assert error, this hook starts the GDB remote
* stub if not already running and then issues a break. The rationale here is * stub if not already running and then issues a break. The rationale here is
* that when testing the developer might be using screen/PuTTY to work interactively * that when testing the developer might be using screen/PuTTY to work interactively
* with the Lua Interpreter via UART0. However if an assert triggers, then there * with the Lua Interpreter via UART0. However if an assert triggers, then there
* is the option to exit the interactive session and start the Xtensa remote GDB * is the option to exit the interactive session and start the Xtensa remote GDB
* which will then sync up with the remote GDB client to allow forensics of the error. * which will then sync up with the remote GDB client to allow forensics of the error.
*/ */
extern void gdbstub_init(void); extern void gdbstub_init(void);
......
...@@ -47,7 +47,7 @@ LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, ...@@ -47,7 +47,7 @@ LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
LUALIB_API void (luaL_register) (lua_State *L, const char *libname, LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
const luaL_Reg *l); const luaL_Reg *l);
LUALIB_API void (luaL_register_light) (lua_State *L, const char *libname, LUALIB_API void (luaL_register_light) (lua_State *L, const char *libname,
const luaL_Reg *l); const luaL_Reg *l);
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
......
...@@ -468,7 +468,7 @@ extern const luaR_entry lua_rotable_base[]; ...@@ -468,7 +468,7 @@ extern const luaR_entry lua_rotable_base[];
/* /*
* ESP builds use specific linker directives to marshal all ROTable declarations * ESP builds use specific linker directives to marshal all ROTable declarations
* into a single ROTable in the PSECT ".lua_rotable". * into a single ROTable in the PSECT ".lua_rotable".
* *
* This is not practical on Posix builds using a standard link so for cross * This is not practical on Posix builds using a standard link so for cross
* compiler builds, separate ROTables are used for the base functions and library * compiler builds, separate ROTables are used for the base functions and library
...@@ -479,7 +479,7 @@ extern const luaR_entry lua_rotable_base[]; ...@@ -479,7 +479,7 @@ extern const luaR_entry lua_rotable_base[];
#define BASE_ROTABLE base_func_map #define BASE_ROTABLE base_func_map
#define LOCK_IN_ROTABLE #define LOCK_IN_ROTABLE
static const LUA_REG_TYPE base_func_meta[] = { static const LUA_REG_TYPE base_func_meta[] = {
LROT_TABENTRY(__index, lua_rotable_base), LROT_TABENTRY(__index, lua_rotable_base),
LROT_END}; LROT_END};
#else #else
#define BASE_ROTABLE lua_rotable_base #define BASE_ROTABLE lua_rotable_base
...@@ -487,32 +487,32 @@ static const LUA_REG_TYPE base_func_meta[] = { ...@@ -487,32 +487,32 @@ static const LUA_REG_TYPE base_func_meta[] = {
#endif #endif
static const LUA_REG_TYPE LOCK_IN_ROTABLE base_func_map[] = { static const LUA_REG_TYPE LOCK_IN_ROTABLE base_func_map[] = {
LROT_FUNCENTRY(assert, luaB_assert), LROT_FUNCENTRY(assert, luaB_assert),
LROT_FUNCENTRY(collectgarbage, luaB_collectgarbage), LROT_FUNCENTRY(collectgarbage, luaB_collectgarbage),
LROT_FUNCENTRY(dofile, luaB_dofile), LROT_FUNCENTRY(dofile, luaB_dofile),
LROT_FUNCENTRY(error, luaB_error), LROT_FUNCENTRY(error, luaB_error),
LROT_FUNCENTRY(gcinfo, luaB_gcinfo), LROT_FUNCENTRY(gcinfo, luaB_gcinfo),
LROT_FUNCENTRY(getfenv, luaB_getfenv), LROT_FUNCENTRY(getfenv, luaB_getfenv),
LROT_FUNCENTRY(getmetatable, luaB_getmetatable), LROT_FUNCENTRY(getmetatable, luaB_getmetatable),
LROT_FUNCENTRY(loadfile, luaB_loadfile), LROT_FUNCENTRY(loadfile, luaB_loadfile),
LROT_FUNCENTRY(load, luaB_load), LROT_FUNCENTRY(load, luaB_load),
LROT_FUNCENTRY(loadstring, luaB_loadstring), LROT_FUNCENTRY(loadstring, luaB_loadstring),
LROT_FUNCENTRY(next, luaB_next), LROT_FUNCENTRY(next, luaB_next),
LROT_FUNCENTRY(pcall, luaB_pcall), LROT_FUNCENTRY(pcall, luaB_pcall),
LROT_FUNCENTRY(print, luaB_print), LROT_FUNCENTRY(print, luaB_print),
LROT_FUNCENTRY(rawequal, luaB_rawequal), LROT_FUNCENTRY(rawequal, luaB_rawequal),
LROT_FUNCENTRY(rawget, luaB_rawget), LROT_FUNCENTRY(rawget, luaB_rawget),
LROT_FUNCENTRY(rawset, luaB_rawset), LROT_FUNCENTRY(rawset, luaB_rawset),
LROT_FUNCENTRY(select, luaB_select), LROT_FUNCENTRY(select, luaB_select),
LROT_FUNCENTRY(setfenv, luaB_setfenv), LROT_FUNCENTRY(setfenv, luaB_setfenv),
LROT_FUNCENTRY(setmetatable, luaB_setmetatable), LROT_FUNCENTRY(setmetatable, luaB_setmetatable),
LROT_FUNCENTRY(tonumber, luaB_tonumber), LROT_FUNCENTRY(tonumber, luaB_tonumber),
LROT_FUNCENTRY(tostring, luaB_tostring), LROT_FUNCENTRY(tostring, luaB_tostring),
LROT_FUNCENTRY(type, luaB_type), LROT_FUNCENTRY(type, luaB_type),
LROT_FUNCENTRY(unpack, luaB_unpack), LROT_FUNCENTRY(unpack, luaB_unpack),
LROT_FUNCENTRY(xpcall, luaB_xpcall) LROT_FUNCENTRY(xpcall, luaB_xpcall)
#ifdef LUA_CROSS_COMPILER #ifdef LUA_CROSS_COMPILER
,LROT_TABENTRY(__metatable, base_func_meta), ,LROT_TABENTRY(__metatable, base_func_meta),
LROT_END LROT_END
#endif #endif
}; };
......
...@@ -37,8 +37,8 @@ static int db_getstrings (lua_State *L) { ...@@ -37,8 +37,8 @@ static int db_getstrings (lua_State *L) {
if (G(L)->ROstrt.hash == NULL) if (G(L)->ROstrt.hash == NULL)
return 0; return 0;
tb = &G(L)->ROstrt; tb = &G(L)->ROstrt;
} }
else else
#endif #endif
tb = &G(L)->strt; tb = &G(L)->strt;
lua_settop(L, 0); lua_settop(L, 0);
...@@ -54,7 +54,7 @@ static int db_getstrings (lua_State *L) { ...@@ -54,7 +54,7 @@ static int db_getstrings (lua_State *L) {
lua_getfield(L, LUA_GLOBALSINDEX, "table"); lua_getfield(L, LUA_GLOBALSINDEX, "table");
lua_getfield(L, -1, "sort"); /* look up table.sort function */ lua_getfield(L, -1, "sort"); /* look up table.sort function */
lua_replace(L, -2); /* dump the table table */ lua_replace(L, -2); /* dump the table table */
lua_pushvalue(L, -2); /* duplicate the strt_copy ref */ lua_pushvalue(L, -2); /* duplicate the strt_copy ref */
lua_call(L, 1, 0); /* table.sort(strt_copy) */ lua_call(L, 1, 0); /* table.sort(strt_copy) */
return 1; return 1;
} }
...@@ -176,7 +176,7 @@ static int db_getinfo (lua_State *L) { ...@@ -176,7 +176,7 @@ static int db_getinfo (lua_State *L) {
treatstackoption(L, L1, "func"); treatstackoption(L, L1, "func");
return 1; /* return table */ return 1; /* return table */
} }
static int db_getlocal (lua_State *L) { static int db_getlocal (lua_State *L) {
int arg; int arg;
......
...@@ -384,7 +384,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) { ...@@ -384,7 +384,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) {
** The arguments are on the stack, right after the function. ** The arguments are on the stack, right after the function.
** When returns, all the results are on the stack, starting at the original ** When returns, all the results are on the stack, starting at the original
** function position. ** function position.
*/ */
void luaD_call (lua_State *L, StkId func, int nResults) { void luaD_call (lua_State *L, StkId func, int nResults) {
if (++L->nCcalls >= LUAI_MAXCCALLS) { if (++L->nCcalls >= LUAI_MAXCCALLS) {
if (L->nCcalls == LUAI_MAXCCALLS) if (L->nCcalls == LUAI_MAXCCALLS)
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include "c_types.h" #include "c_types.h"
void legc_set_mode(lua_State *L, int mode, int limit) { void legc_set_mode(lua_State *L, int mode, int limit) {
global_State *g = G(L); global_State *g = G(L);
g->egcmode = mode; g->egcmode = mode;
g->memlimit = limit; g->memlimit = limit;
} }
......
...@@ -247,7 +247,7 @@ LUALIB_API int luaN_reload_reboot (lua_State *L) { ...@@ -247,7 +247,7 @@ LUALIB_API int luaN_reload_reboot (lua_State *L) {
flashErase(0,-1); flashErase(0,-1);
} }
NODE_ERR(msg); NODE_ERR(msg);
while (1) {} // Force WDT as the ROM software_reset() doesn't seem to work while (1) {} // Force WDT as the ROM software_reset() doesn't seem to work
return 0; return 0;
} }
...@@ -505,7 +505,7 @@ static int loadLFS (lua_State *L) { ...@@ -505,7 +505,7 @@ static int loadLFS (lua_State *L) {
/* Allocate the out buffers */ /* Allocate the out buffers */
for(i = 0; i <= WRITE_BLOCKS; i++) for(i = 0; i <= WRITE_BLOCKS; i++)
out->block[i] = luaM_new(L, outBlock); out->block[i] = luaM_new(L, outBlock);
/* first inflate pass */ /* first inflate pass */
if (uzlib_inflate (get_byte, put_byte, recall_byte, if (uzlib_inflate (get_byte, put_byte, recall_byte,
in->len, &crc, &in->inflate_state) < 0) in->len, &crc, &in->inflate_state) < 0)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define FLASH_FORMAT_MASK 0xF00 #define FLASH_FORMAT_MASK 0xF00
#ifdef LUA_PACK_TVALUES #ifdef LUA_PACK_TVALUES
#ifdef LUA_NUMBER_INTEGRAL #ifdef LUA_NUMBER_INTEGRAL
#error "LUA_PACK_TVALUES is only valid for Floating point builds" #error "LUA_PACK_TVALUES is only valid for Floating point builds"
#endif #endif
# define FLASH_SIG_B2 0x04 # define FLASH_SIG_B2 0x04
#else #else
......
...@@ -175,7 +175,7 @@ static int traversetable (global_State *g, Table *h) { ...@@ -175,7 +175,7 @@ static int traversetable (global_State *g, Table *h) {
markobject(g, h->metatable); markobject(g, h->metatable);
mode = gfasttm(g, h->metatable, TM_MODE); mode = gfasttm(g, h->metatable, TM_MODE);
} }
if (mode && ttisstring(mode)) { /* is there a weak mode? */ if (mode && ttisstring(mode)) { /* is there a weak mode? */
weakkey = (c_strchr(svalue(mode), 'k') != NULL); weakkey = (c_strchr(svalue(mode), 'k') != NULL);
weakvalue = (c_strchr(svalue(mode), 'v') != NULL); weakvalue = (c_strchr(svalue(mode), 'v') != NULL);
......
...@@ -20,33 +20,33 @@ ...@@ -20,33 +20,33 @@
# error "NodeMCU modules must be built with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)" # error "NodeMCU modules must be built with LTR enabled (MIN_OPT_LEVEL=2 and LUA_OPTIMIZE_MEMORY=2)"
#endif #endif
extern const luaR_entry strlib[], tab_funcs[], dblib[], extern const luaR_entry strlib[], tab_funcs[], dblib[],
co_funcs[], math_map[], syslib[]; co_funcs[], math_map[], syslib[];
extern const luaR_entry syslib[], io_funcs[]; // Only used on cross-compile builds extern const luaR_entry syslib[], io_funcs[]; // Only used on cross-compile builds
/* /*
* The NodeMCU Lua initalisation has been adapted to use linker-based module * The NodeMCU Lua initalisation has been adapted to use linker-based module
* registration. This uses a PSECT naming convention to allow the lib and rotab * registration. This uses a PSECT naming convention to allow the lib and rotab
* entries to be collected by the linker into consoliated tables. The linker * entries to be collected by the linker into consoliated tables. The linker
* defines lua_libs_base and lua_rotable_base. * defines lua_libs_base and lua_rotable_base.
* *
* This is not practical on Posix builds which use a standard loader declaration * This is not practical on Posix builds which use a standard loader declaration
* so for cross compiler builds, separate ROTables are used for the base functions * so for cross compiler builds, separate ROTables are used for the base functions
* and library ROTables, with the latter chained from the former using its __index * and library ROTables, with the latter chained from the former using its __index
* meta-method. In this case all library ROTables are defined here, avoiding the * meta-method. In this case all library ROTables are defined here, avoiding the
* need for linker magic is avoided on host builds. * need for linker magic is avoided on host builds.
*/ */
#if defined(LUA_CROSS_COMPILER) #if defined(LUA_CROSS_COMPILER)
#define LUA_ROTABLES lua_rotable_base #define LUA_ROTABLES lua_rotable_base
#define LUA_LIBS lua_libs_base #define LUA_LIBS lua_libs_base
#else /* declare Xtensa toolchain linker defined constants */ #else /* declare Xtensa toolchain linker defined constants */
extern const luaL_Reg lua_libs_base[]; extern const luaL_Reg lua_libs_base[];
extern const luaR_entry lua_rotable_base[]; extern const luaR_entry lua_rotable_base[];
#define LUA_ROTABLES lua_rotable_core #define LUA_ROTABLES lua_rotable_core
#define LUA_LIBS lua_libs_core #define LUA_LIBS lua_libs_core
#endif #endif
static const LOCK_IN_SECTION(libs) luaL_reg LUA_LIBS[] = { static const LOCK_IN_SECTION(libs) luaL_reg LUA_LIBS[] = {
{"", luaopen_base}, {"", luaopen_base},
{LUA_LOADLIBNAME, luaopen_package}, {LUA_LOADLIBNAME, luaopen_package},
......
...@@ -104,7 +104,7 @@ typedef lu_int32 Instruction; ...@@ -104,7 +104,7 @@ typedef lu_int32 Instruction;
#ifndef lua_lock #ifndef lua_lock
#define lua_lock(L) ((void) 0) #define lua_lock(L) ((void) 0)
#define lua_unlock(L) ((void) 0) #define lua_unlock(L) ((void) 0)
#endif #endif
...@@ -115,7 +115,7 @@ typedef lu_int32 Instruction; ...@@ -115,7 +115,7 @@ typedef lu_int32 Instruction;
/* /*
** macro to control inclusion of some hard tests on stack reallocation ** macro to control inclusion of some hard tests on stack reallocation
*/ */
#ifndef HARDSTACKTESTS #ifndef HARDSTACKTESTS
#define condhardstacktests(x) ((void)0) #define condhardstacktests(x) ((void)0)
#else #else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment