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

trailing spaces cleanup (#2659)

parent d7583040
...@@ -341,7 +341,7 @@ const LUA_REG_TYPE math_map[] = { ...@@ -341,7 +341,7 @@ const LUA_REG_TYPE math_map[] = {
{LSTRKEY("floor"), LFUNCVAL(math_floor)}, {LSTRKEY("floor"), LFUNCVAL(math_floor)},
// {LSTRKEY("fmod"), LFUNCVAL(math_fmod)}, // {LSTRKEY("fmod"), LFUNCVAL(math_fmod)},
#if LUA_OPTIMIZE_MEMORY > 0 && defined(LUA_COMPAT_MOD) #if LUA_OPTIMIZE_MEMORY > 0 && defined(LUA_COMPAT_MOD)
// {LSTRKEY("mod"), LFUNCVAL(math_fmod)}, // {LSTRKEY("mod"), LFUNCVAL(math_fmod)},
#endif #endif
// {LSTRKEY("frexp"), LFUNCVAL(math_frexp)}, // {LSTRKEY("frexp"), LFUNCVAL(math_frexp)},
// {LSTRKEY("ldexp"), LFUNCVAL(math_ldexp)}, // {LSTRKEY("ldexp"), LFUNCVAL(math_ldexp)},
......
...@@ -522,7 +522,7 @@ static int ll_require (lua_State *L) { ...@@ -522,7 +522,7 @@ static int ll_require (lua_State *L) {
** 'module' function ** 'module' function
** ======================================================= ** =======================================================
*/ */
static void setfenv (lua_State *L) { static void setfenv (lua_State *L) {
lua_Debug ar; lua_Debug ar;
...@@ -672,7 +672,7 @@ LUALIB_API int luaopen_package (lua_State *L) { ...@@ -672,7 +672,7 @@ LUALIB_API int luaopen_package (lua_State *L) {
#endif #endif
/* create `package' table */ /* create `package' table */
luaL_register_light(L, LUA_LOADLIBNAME, pk_funcs); luaL_register_light(L, LUA_LOADLIBNAME, pk_funcs);
#if defined(LUA_COMPAT_LOADLIB) #if defined(LUA_COMPAT_LOADLIB)
lua_getfield(L, -1, "loadlib"); lua_getfield(L, -1, "loadlib");
lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");
#endif #endif
......
...@@ -70,7 +70,7 @@ int luaO_log2 (unsigned int x) { ...@@ -70,7 +70,7 @@ int luaO_log2 (unsigned int x) {
#else #else
/* Use Normalization Shift Amount Unsigned: 0x1=>31 up to 0xffffffff =>0 /* Use Normalization Shift Amount Unsigned: 0x1=>31 up to 0xffffffff =>0
* See Xtensa Instruction Set Architecture (ISA) Refman P 462 */ * See Xtensa Instruction Set Architecture (ISA) Refman P 462 */
asm volatile ("nsau %0, %1;" :"=r"(x) : "r"(x)); asm volatile ("nsau %0, %1;" :"=r"(x) : "r"(x));
return 31 - x; return 31 - x;
#endif #endif
} }
...@@ -103,11 +103,11 @@ int luaO_str2d (const char *s, lua_Number *result) { ...@@ -103,11 +103,11 @@ int luaO_str2d (const char *s, lua_Number *result) {
*result = lua_str2number(s, &endptr); *result = lua_str2number(s, &endptr);
if (endptr == s) return 0; /* conversion failed */ if (endptr == s) return 0; /* conversion failed */
if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */
#if defined(LUA_CROSS_COMPILER) #if defined(LUA_CROSS_COMPILER)
{ {
long lres = strtoul(s, &endptr, 16); long lres = strtoul(s, &endptr, 16);
#if INT_MAX != 2147483647L #if INT_MAX != 2147483647L
if (lres & ~0xffffffffL) if (lres & ~0xffffffffL)
*result = cast_num(-1); *result = cast_num(-1);
else if (lres & 0x80000000L) else if (lres & 0x80000000L)
*result = cast_num(lres | ~0x7fffffffL); *result = cast_num(lres | ~0x7fffffffL);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define NUM_TAGS (LAST_TAG+1) #define NUM_TAGS (LAST_TAG+1)
#define READONLYMASK (1<<7) /* denormalised bitmask for READONLYBIT and */ #define READONLYMASK (1<<7) /* denormalised bitmask for READONLYBIT and */
#ifdef LUA_FLASH_STORE #ifdef LUA_FLASH_STORE
#define LFSMASK (1<<6) /* LFSBIT to avoid include proliferation */ #define LFSMASK (1<<6) /* LFSBIT to avoid include proliferation */
#endif #endif
...@@ -38,13 +38,13 @@ ...@@ -38,13 +38,13 @@
/* /*
** force aligned access to critical fields in Flash-based structures ** force aligned access to critical fields in Flash-based structures
** wo is the offset of aligned word in bytes 0,4,8,.. ** wo is the offset of aligned word in bytes 0,4,8,..
** bo is the field within the word in bits 0..31 ** bo is the field within the word in bits 0..31
*/ */
#define GET_BYTE_FN(name,t,wo,bo) \ #define GET_BYTE_FN(name,t,wo,bo) \
static inline lu_byte get ## name(void *o) { \ static inline lu_byte get ## name(void *o) { \
lu_byte res; /* extract named field */ \ lu_byte res; /* extract named field */ \
asm ("l32i %0, %1, " #wo "; extui %0, %0, " #bo ", 8;" : "=r"(res) : "r"(o) : );\ asm ("l32i %0, %1, " #wo "; extui %0, %0, " #bo ", 8;" : "=r"(res) : "r"(o) : );\
return res; } return res; }
#else #else
#define GET_BYTE_FN(name,t,wo,bo) \ #define GET_BYTE_FN(name,t,wo,bo) \
static inline lu_byte get ## name(void *o) { return ((t *)o)->name; } static inline lu_byte get ## name(void *o) { return ((t *)o)->name; }
...@@ -70,7 +70,7 @@ typedef struct GCheader { ...@@ -70,7 +70,7 @@ typedef struct GCheader {
/* /*
** Word aligned inline access functions for the CommonHeader tt and marked fields. ** Word aligned inline access functions for the CommonHeader tt and marked fields.
** Note that these MUST be consistent with the CommonHeader definition above. Arg ** Note that these MUST be consistent with the CommonHeader definition above. Arg
** 3 is a word offset (4 bytes in this case) and arg 4 the bit offset in the word. ** 3 is a word offset (4 bytes in this case) and arg 4 the bit offset in the word.
*/ */
GET_BYTE_FN(tt,GCheader,4,0) GET_BYTE_FN(tt,GCheader,4,0)
...@@ -249,7 +249,7 @@ typedef union TString { ...@@ -249,7 +249,7 @@ typedef union TString {
} tsv; } tsv;
} TString; } TString;
#ifdef LUA_CROSS_COMPILER #ifdef LUA_CROSS_COMPILER
#define isreadonly(o) (0) #define isreadonly(o) (0)
#else #else
#define isreadonly(o) ((o).marked & READONLYMASK) #define isreadonly(o) ((o).marked & READONLYMASK)
......
...@@ -186,8 +186,8 @@ OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ ...@@ -186,8 +186,8 @@ OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */
OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */
OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */
OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ OP_TEST,/* A C if not (R(A) <=> C) then pc++ */
OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */
...@@ -197,8 +197,8 @@ OP_FORLOOP,/* A sBx R(A)+=R(A+2); ...@@ -197,8 +197,8 @@ OP_FORLOOP,/* A sBx R(A)+=R(A+2);
if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/ if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/
OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */ OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */
OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */ if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */
OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */
OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/
...@@ -240,7 +240,7 @@ OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ ...@@ -240,7 +240,7 @@ OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */
** bits 4-5: B arg mode ** bits 4-5: B arg mode
** bit 6: instruction set register A ** bit 6: instruction set register A
** bit 7: operator is a test ** bit 7: operator is a test
*/ */
enum OpArgMask { enum OpArgMask {
OpArgN, /* argument is not used */ OpArgN, /* argument is not used */
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#undef LNILVAL #undef LNILVAL
#undef LREGISTER #undef LREGISTER
#if LUA_OPTIMIZE_MEMORY >=1 #if LUA_OPTIMIZE_MEMORY >=1
#define LUA_REG_TYPE luaR_entry #define LUA_REG_TYPE luaR_entry
#define LSTRKEY LRO_STRKEY #define LSTRKEY LRO_STRKEY
#define LNUMKEY LRO_NUMKEY #define LNUMKEY LRO_NUMKEY
......
...@@ -45,7 +45,7 @@ typedef struct luaR_entry { ...@@ -45,7 +45,7 @@ typedef struct luaR_entry {
/* /*
* The current ROTable implmentation is a vector of luaR_entry terminated by a * The current ROTable implmentation is a vector of luaR_entry terminated by a
* nil record. The convention is to use ROtable * to refer to the entire vector * nil record. The convention is to use ROtable * to refer to the entire vector
* as a logical ROTable. * as a logical ROTable.
*/ */
typedef const struct luaR_entry ROTable; typedef const struct luaR_entry ROTable;
...@@ -57,9 +57,9 @@ void* luaR_getmeta(ROTable *tab); ...@@ -57,9 +57,9 @@ void* luaR_getmeta(ROTable *tab);
int luaR_isrotable(void *p); int luaR_isrotable(void *p);
/* /*
* Set inRO check depending on platform. Note that this implementation needs * Set inRO check depending on platform. Note that this implementation needs
* to work on both the host (luac.cross) and ESP targets. The luac.cross * to work on both the host (luac.cross) and ESP targets. The luac.cross
* VM is used for the -e option, and is primarily used to be able to debug * VM is used for the -e option, and is primarily used to be able to debug
* VM changes on the more developer-friendly hot gdb environment. * VM changes on the more developer-friendly hot gdb environment.
*/ */
#if defined(LUA_CROSS_COMPILER) #if defined(LUA_CROSS_COMPILER)
...@@ -68,7 +68,7 @@ int luaR_isrotable(void *p); ...@@ -68,7 +68,7 @@ int luaR_isrotable(void *p);
#define _RODATA_END __end__ #define _RODATA_END __end__
#else #else
#define _RODATA_END _edata #define _RODATA_END _edata
#endif #endif
extern const char _RODATA_END[]; extern const char _RODATA_END[];
#define IN_RODATA_AREA(p) (((const char *)(p)) < _RODATA_END) #define IN_RODATA_AREA(p) (((const char *)(p)) < _RODATA_END)
......
...@@ -35,7 +35,7 @@ typedef struct LG { ...@@ -35,7 +35,7 @@ typedef struct LG {
lua_State l; lua_State l;
global_State g; global_State g;
} LG; } LG;
static void stack_init (lua_State *L1, lua_State *L) { static void stack_init (lua_State *L1, lua_State *L) {
...@@ -224,7 +224,7 @@ extern lua_State *luaL_newstate (void); ...@@ -224,7 +224,7 @@ extern lua_State *luaL_newstate (void);
static lua_State *lua_crtstate; static lua_State *lua_crtstate;
lua_State *lua_open(void) { lua_State *lua_open(void) {
lua_crtstate = luaL_newstate(); lua_crtstate = luaL_newstate();
return lua_crtstate; return lua_crtstate;
} }
...@@ -232,12 +232,12 @@ lua_State *lua_getstate(void) { ...@@ -232,12 +232,12 @@ lua_State *lua_getstate(void) {
return lua_crtstate; return lua_crtstate;
} }
LUA_API void lua_close (lua_State *L) { LUA_API void lua_close (lua_State *L) {
#ifndef LUA_CROSS_COMPILER #ifndef LUA_CROSS_COMPILER
lua_sethook( L, NULL, 0, 0 ); lua_sethook( L, NULL, 0, 0 );
lua_crtstate = NULL; lua_crtstate = NULL;
lua_pushnil( L ); lua_pushnil( L );
// lua_rawseti( L, LUA_REGISTRYINDEX, LUA_INT_HANDLER_KEY ); // lua_rawseti( L, LUA_REGISTRYINDEX, LUA_INT_HANDLER_KEY );
#endif #endif
L = G(L)->mainthread; /* only the main thread can be closed */ L = G(L)->mainthread; /* only the main thread can be closed */
lua_lock(L); lua_lock(L);
luaF_close(L, L->stack); /* close all upvalues for this thread */ luaF_close(L, L->stack); /* close all upvalues for this thread */
......
...@@ -81,7 +81,7 @@ static TString *newlstr (lua_State *L, const char *str, size_t l, ...@@ -81,7 +81,7 @@ static TString *newlstr (lua_State *L, const char *str, size_t l,
} }
static int lua_is_ptr_in_ro_area(const char *p) { static int lua_is_ptr_in_ro_area(const char *p) {
#ifdef LUA_CROSS_COMPILER #ifdef LUA_CROSS_COMPILER
return 0; // TStrings are never in RO in luac.cross return 0; // TStrings are never in RO in luac.cross
#else #else
return IN_RODATA_AREA(p); return IN_RODATA_AREA(p);
...@@ -90,7 +90,7 @@ static int lua_is_ptr_in_ro_area(const char *p) { ...@@ -90,7 +90,7 @@ static int lua_is_ptr_in_ro_area(const char *p) {
/* /*
* The string algorithm has been modified to be LFS-friendly. The previous eLua * The string algorithm has been modified to be LFS-friendly. The previous eLua
* algo used the address of the string was in flash and the string was >4 bytes * algo used the address of the string was in flash and the string was >4 bytes
* This creates miminal savings and prevents the use of LFS based strings * This creates miminal savings and prevents the use of LFS based strings
*/ */
...@@ -119,7 +119,7 @@ LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { ...@@ -119,7 +119,7 @@ LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
*/ */
if (G(L)->ROstrt.hash) { if (G(L)->ROstrt.hash) {
for (o = G(L)->ROstrt.hash[lmod(h, G(L)->ROstrt.size)]; for (o = G(L)->ROstrt.hash[lmod(h, G(L)->ROstrt.size)];
o != NULL; o != NULL;
o = o->gch.next) { o = o->gch.next) {
TString *ts = rawgco2ts(o); TString *ts = rawgco2ts(o);
if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) {
......
...@@ -633,7 +633,7 @@ static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, ...@@ -633,7 +633,7 @@ static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
lua_pushlstring(L, s, e - s); /* keep original text */ lua_pushlstring(L, s, e - s); /* keep original text */
} }
else if (!lua_isstring(L, -1)) else if (!lua_isstring(L, -1))
luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1));
luaL_addvalue(b); /* add result to accumulator */ luaL_addvalue(b); /* add result to accumulator */
} }
...@@ -786,7 +786,7 @@ static int str_format (lua_State *L) { ...@@ -786,7 +786,7 @@ static int str_format (lua_State *L) {
c_sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); c_sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
break; break;
} }
#if !defined LUA_NUMBER_INTEGRAL #if !defined LUA_NUMBER_INTEGRAL
case 'e': case 'E': case 'f': case 'e': case 'E': case 'f':
case 'g': case 'G': { case 'g': case 'G': {
c_sprintf(buff, form, (double)luaL_checknumber(L, arg)); c_sprintf(buff, form, (double)luaL_checknumber(L, arg));
...@@ -884,7 +884,7 @@ LUALIB_API int luaopen_string (lua_State *L) { ...@@ -884,7 +884,7 @@ LUALIB_API int luaopen_string (lua_State *L) {
lua_pushrotable(L, (void*)strlib); lua_pushrotable(L, (void*)strlib);
lua_setmetatable(L, -2); lua_setmetatable(L, -2);
lua_pop(L,1); lua_pop(L,1);
return 0; return 0;
#endif #endif
} }
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) #define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t))))
#define hashstr(t,str) hashpow2(t, (str)->tsv.hash) #define hashstr(t,str) hashpow2(t, (str)->tsv.hash)
#define hashboolean(t,p) hashpow2(t, p) #define hashboolean(t,p) hashpow2(t, p)
...@@ -330,7 +330,7 @@ static Node *find_prev_node(Node *mp, Node *next) { ...@@ -330,7 +330,7 @@ static Node *find_prev_node(Node *mp, Node *next) {
** first, check whether the moving node's main position is free. If not, check whether ** first, check whether the moving node's main position is free. If not, check whether
** colliding node is in its main position or not: if it is not, move colliding ** colliding node is in its main position or not: if it is not, move colliding
** node to an empty place and put moving node in its main position; otherwise ** node to an empty place and put moving node in its main position; otherwise
** (colliding node is in its main position), moving node goes to an empty position. ** (colliding node is in its main position), moving node goes to an empty position.
*/ */
static int move_node (lua_State *L, Table *t, Node *node) { static int move_node (lua_State *L, Table *t, Node *node) {
Node *mp = mainposition(t, key2tval(node)); Node *mp = mainposition(t, key2tval(node));
...@@ -520,11 +520,11 @@ void luaH_free (lua_State *L, Table *t) { ...@@ -520,11 +520,11 @@ void luaH_free (lua_State *L, Table *t) {
/* /*
** inserts a new key into a hash table; first, check whether key's main ** inserts a new key into a hash table; first, check whether key's main
** position is free. If not, check whether colliding node is in its main ** position is free. If not, check whether colliding node is in its main
** position or not: if it is not, move colliding node to an empty place and ** position or not: if it is not, move colliding node to an empty place and
** put new key in its main position; otherwise (colliding node is in its main ** put new key in its main position; otherwise (colliding node is in its main
** position), new key goes to an empty position. ** position), new key goes to an empty position.
*/ */
static TValue *newkey (lua_State *L, Table *t, const TValue *key) { static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
Node *mp = mainposition(t, key); Node *mp = mainposition(t, key);
...@@ -599,7 +599,7 @@ const TValue *luaH_getstr (Table *t, TString *key) { ...@@ -599,7 +599,7 @@ const TValue *luaH_getstr (Table *t, TString *key) {
} }
/* same thing for rotables */ /* same thing for rotables */
const TValue *luaH_getstr_ro (void *t, TString *key) { const TValue *luaH_getstr_ro (void *t, TString *key) {
if (!t || key->tsv.len>LUA_MAX_ROTABLE_NAME) if (!t || key->tsv.len>LUA_MAX_ROTABLE_NAME)
return luaO_nilobject; return luaO_nilobject;
return luaR_findentry(t, key, NULL); return luaR_findentry(t, key, NULL);
...@@ -740,7 +740,7 @@ int luaH_getn (Table *t) { ...@@ -740,7 +740,7 @@ int luaH_getn (Table *t) {
/* same thing for rotables */ /* same thing for rotables */
int luaH_getn_ro (void *t) { int luaH_getn_ro (void *t) {
int i = 1, len=0; int i = 1, len=0;
while(luaR_findentryN(t, i ++, NULL)) while(luaR_findentryN(t, i ++, NULL))
len ++; len ++;
return len; return len;
......
...@@ -54,17 +54,17 @@ const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { ...@@ -54,17 +54,17 @@ const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
lua_assert(event <= TM_EQ); lua_assert(event <= TM_EQ);
if (luaR_isrotable(events)) { if (luaR_isrotable(events)) {
tm = luaH_getstr_ro(events, ename); tm = luaH_getstr_ro(events, ename);
if (ttisnil(tm)) { /* no tag method? */ if (ttisnil(tm)) { /* no tag method? */
return NULL; return NULL;
} }
} else { } else {
tm = luaH_getstr(events, ename); tm = luaH_getstr(events, ename);
if (ttisnil(tm)) { /* no tag method? */ if (ttisnil(tm)) { /* no tag method? */
events->flags |= cast_byte(1u<<event); /* cache this fact */ events->flags |= cast_byte(1u<<event); /* cache this fact */
return NULL; return NULL;
} }
} }
return tm; return tm;
} }
......
...@@ -336,7 +336,7 @@ int lua_put_line(const char *s, size_t l) { ...@@ -336,7 +336,7 @@ int lua_put_line(const char *s, size_t l) {
void lua_handle_input (bool force) void lua_handle_input (bool force)
{ {
while (gLoad.L && (force || readline (&gLoad))) { while (gLoad.L && (force || readline (&gLoad))) {
NODE_DBG("Handle Input: first=%u, pos=%u, len=%u, actual=%u, line=%s\n", gLoad.firstline, NODE_DBG("Handle Input: first=%u, pos=%u, len=%u, actual=%u, line=%s\n", gLoad.firstline,
gLoad.line_position, gLoad.len, c_strlen(gLoad.line), gLoad.line); gLoad.line_position, gLoad.len, c_strlen(gLoad.line), gLoad.line);
dojob (&gLoad); dojob (&gLoad);
...@@ -356,7 +356,7 @@ static void dojob(lua_Load *load){ ...@@ -356,7 +356,7 @@ static void dojob(lua_Load *load){
const char *oldprogname = progname; const char *oldprogname = progname;
progname = NULL; progname = NULL;
do{ do{
if(load->done == 1){ if(load->done == 1){
l = c_strlen(b); l = c_strlen(b);
...@@ -453,7 +453,7 @@ static bool readline(lua_Load *load){ ...@@ -453,7 +453,7 @@ static bool readline(lua_Load *load){
// else if (ch == 0x04) // else if (ch == 0x04)
// { // {
// if (load->line_position == 0) // if (load->line_position == 0)
// // No input which makes lua interpreter close // // No input which makes lua interpreter close
// donejob(load); // donejob(load);
// else // else
// continue; // continue;
...@@ -484,7 +484,7 @@ static bool readline(lua_Load *load){ ...@@ -484,7 +484,7 @@ static bool readline(lua_Load *load){
// { // {
// continue; // continue;
// } // }
/* echo */ /* echo */
if(uart0_echo) uart_putc(ch); if(uart0_echo) uart_putc(ch);
...@@ -510,7 +510,7 @@ static bool readline(lua_Load *load){ ...@@ -510,7 +510,7 @@ static bool readline(lua_Load *load){
ch = 0; ch = 0;
} }
if( (load->line_position > 0) && (!run_input) && (need_len==0) && (end_char<0) ) if( (load->line_position > 0) && (!run_input) && (need_len==0) && (end_char<0) )
{ {
uart_on_data_cb(load->line, load->line_position); uart_on_data_cb(load->line, load->line_position);
......
# #
# This Make file is called from the core Makefile hierarchy with is a hierarchical # This Make file is called from the core Makefile hierarchy with is a hierarchical
# make wwhich uses parent callbacks to implement inheritance. However is luac_cross # make wwhich uses parent callbacks to implement inheritance. However is luac_cross
# build stands outside this and uses the host toolchain to implement a separate # build stands outside this and uses the host toolchain to implement a separate
# host build of the luac.cross image. # host build of the luac.cross image.
# #
.NOTPARALLEL: .NOTPARALLEL:
......
...@@ -43,21 +43,21 @@ typedef unsigned int uint; ...@@ -43,21 +43,21 @@ typedef unsigned int uint;
* *
* The start address of the Lua Flash Store (LFS) is build-dependent, and the cross * The start address of the Lua Flash Store (LFS) is build-dependent, and the cross
* compiler '-a' option allows the developer to fix the LFS at a defined flash memory * compiler '-a' option allows the developer to fix the LFS at a defined flash memory
* address. Alternatively and by default the cross compilation adopts a position * address. Alternatively and by default the cross compilation adopts a position
* independent image format, which permits the on-device image loader to load the LFS * independent image format, which permits the on-device image loader to load the LFS
* image at an appropriate base within the flash address space. As all objects in the * image at an appropriate base within the flash address space. As all objects in the
* LFS can be treated as multiples of 4-byte words, also all address fields are both * LFS can be treated as multiples of 4-byte words, also all address fields are both
* word aligned, and any address references within the LFS are also word-aligned. * word aligned, and any address references within the LFS are also word-aligned.
* *
* This version adds gzip compression of the generated LFS image for more efficient * This version adds gzip compression of the generated LFS image for more efficient
* over-the-air (OTA) transfer, so the method of tagging address words has been * over-the-air (OTA) transfer, so the method of tagging address words has been
* replaced by a scheme which achieves better compression: an additional bitmap * replaced by a scheme which achieves better compression: an additional bitmap
* has been added to the image, with each bit corresponding to a word in the image * has been added to the image, with each bit corresponding to a word in the image
* and set if the corresponding work is an address. The addresses are stored as * and set if the corresponding work is an address. The addresses are stored as
* signed relative word offsets. * signed relative word offsets.
* *
* The unloader is documented in lflash.c Note that his relocation process is * The unloader is documented in lflash.c Note that his relocation process is
* skipped for absolute addressed images (which are identified by the * skipped for absolute addressed images (which are identified by the
* FLASH_SIG_ABSOLUTE bit setting in the flash signature). * FLASH_SIG_ABSOLUTE bit setting in the flash signature).
* *
* The flash image has a standard header detailed in lflash.h * The flash image has a standard header detailed in lflash.h
...@@ -102,14 +102,14 @@ static uint curOffset = 0; ...@@ -102,14 +102,14 @@ static uint curOffset = 0;
* The flashAddrTag is a bit array, one bit per flashImage word denoting * The flashAddrTag is a bit array, one bit per flashImage word denoting
* whether the corresponding word is a relative address. The defines * whether the corresponding word is a relative address. The defines
* are access methods for this bit array. * are access methods for this bit array.
*/ */
static uint flashImage[LUA_MAX_FLASH_SIZE + LUA_MAX_FLASH_SIZE/32]; static uint flashImage[LUA_MAX_FLASH_SIZE + LUA_MAX_FLASH_SIZE/32];
static uint *flashAddrTag = flashImage + LUA_MAX_FLASH_SIZE; static uint *flashAddrTag = flashImage + LUA_MAX_FLASH_SIZE;
#define _TW(v) (v)>>5 #define _TW(v) (v)>>5
#define _TB(v) (1<<((v)&0x1F)) #define _TB(v) (1<<((v)&0x1F))
#define setFlashAddrTag(v) flashAddrTag[_TW(v)] |= _TB(v) #define setFlashAddrTag(v) flashAddrTag[_TW(v)] |= _TB(v)
#define getFlashAddrTag(v) ((flashAddrTag[_TW(v)]&_TB(v)) != 0) #define getFlashAddrTag(v) ((flashAddrTag[_TW(v)]&_TB(v)) != 0)
#define fatal luac_fatal #define fatal luac_fatal
extern void __attribute__((noreturn)) luac_fatal(const char* message); extern void __attribute__((noreturn)) luac_fatal(const char* message);
...@@ -395,8 +395,8 @@ static void *functionToFlash(lua_State* L, const Proto* orig) { ...@@ -395,8 +395,8 @@ static void *functionToFlash(lua_State* L, const Proto* orig) {
return cast(void *, flashCopy(L, 1, PROTO_COPY_MASK, &f)); return cast(void *, flashCopy(L, 1, PROTO_COPY_MASK, &f));
} }
uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w, uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w,
void* data, int strip, void* data, int strip,
lu_int32 address, lu_int32 maxSize) { lu_int32 address, lu_int32 maxSize) {
// parameter strip is ignored for now // parameter strip is ignored for now
FlashHeader *fh = cast(FlashHeader *, flashAlloc(L, sizeof(FlashHeader))); FlashHeader *fh = cast(FlashHeader *, flashAlloc(L, sizeof(FlashHeader)));
...@@ -405,7 +405,7 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w, ...@@ -405,7 +405,7 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w,
scanProtoStrings(L, main); scanProtoStrings(L, main);
createROstrt(L, fh); createROstrt(L, fh);
toFlashAddr(L, fh->mainProto, functionToFlash(L, main)); toFlashAddr(L, fh->mainProto, functionToFlash(L, main));
fh->flash_sig = FLASH_SIG + (address ? FLASH_SIG_ABSOLUTE : 0); fh->flash_sig = FLASH_SIG + (address ? FLASH_SIG_ABSOLUTE : 0);
fh->flash_size = curOffset*WORDSIZE; fh->flash_size = curOffset*WORDSIZE;
if (fh->flash_size>maxSize) { if (fh->flash_size>maxSize) {
...@@ -413,7 +413,7 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w, ...@@ -413,7 +413,7 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w,
} }
if (address) { /* in absolute mode convert addresses to mapped address */ if (address) { /* in absolute mode convert addresses to mapped address */
for (i = 0 ; i < curOffset; i++) for (i = 0 ; i < curOffset; i++)
if (getFlashAddrTag(i)) if (getFlashAddrTag(i))
flashImage[i] = 4*flashImage[i] + address; flashImage[i] = 4*flashImage[i] + address;
lua_unlock(L); lua_unlock(L);
status = w(L, flashImage, fh->flash_size, data); status = w(L, flashImage, fh->flash_size, data);
...@@ -424,22 +424,22 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w, ...@@ -424,22 +424,22 @@ uint dumpToFlashImage (lua_State* L, const Proto *main, lua_Writer w,
*/ */
uint oLen; uint oLen;
uint8_t *oBuf; uint8_t *oBuf;
int bmLen = sizeof(uint)*((curOffset+31)/32); /* 32 flags to a word */ int bmLen = sizeof(uint)*((curOffset+31)/32); /* 32 flags to a word */
memmove(flashImage+curOffset, flashAddrTag, bmLen); memmove(flashImage+curOffset, flashAddrTag, bmLen);
status = uzlib_compress (&oBuf, &oLen, status = uzlib_compress (&oBuf, &oLen,
(const uint8_t *)flashImage, bmLen+fh->flash_size); (const uint8_t *)flashImage, bmLen+fh->flash_size);
if (status != UZLIB_OK) { if (status != UZLIB_OK) {
luac_fatal("Out of memory during image compression"); luac_fatal("Out of memory during image compression");
} }
lua_unlock(L); lua_unlock(L);
#if 0 #if 0
status = w(L, flashImage, bmLen+fh->flash_size, data); status = w(L, flashImage, bmLen+fh->flash_size, data);
#else #else
status = w(L, oBuf, oLen, data); status = w(L, oBuf, oLen, data);
free(oBuf); free(oBuf);
#endif #endif
} }
lua_lock(L); lua_lock(L);
return status; return status;
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
/* "Pseudo-random" keys for the registry */ /* "Pseudo-random" keys for the registry */
static const size_t liolib_keys[] = { static const size_t liolib_keys[] = {
(size_t)&luaL_callmeta, (size_t)&luaL_callmeta,
(size_t)&luaL_typerror, (size_t)&luaL_typerror,
(size_t)&luaL_argerror (size_t)&luaL_argerror
}; };
...@@ -485,7 +485,7 @@ LUALIB_API int luaopen_io(lua_State *L) { ...@@ -485,7 +485,7 @@ LUALIB_API int luaopen_io(lua_State *L) {
luaL_register_light(L, LUA_IOLIBNAME, io_base); luaL_register_light(L, LUA_IOLIBNAME, io_base);
lua_pushvalue(L, -1); lua_pushvalue(L, -1);
lua_setmetatable(L, -2); lua_setmetatable(L, -2);
lua_pushliteral(L, "__index"); lua_pushliteral(L, "__index");
lua_pushrotable(L, (void *)iolib_funcs); lua_pushrotable(L, (void *)iolib_funcs);
lua_rawset(L, -3); lua_rawset(L, -3);
......
...@@ -72,7 +72,7 @@ static void usage(const char* message) ...@@ -72,7 +72,7 @@ static void usage(const char* message)
" -e name execute a lua source file\n" " -e name execute a lua source file\n"
" -f output a flash image file\n" " -f output a flash image file\n"
" -a addr generate an absolute, rather than position independent flash image file\n" " -a addr generate an absolute, rather than position independent flash image file\n"
" -i generate lookup combination master (default with option -f)\n" " -i generate lookup combination master (default with option -f)\n"
" -m size maximum LFS image in bytes\n" " -m size maximum LFS image in bytes\n"
" -p parse only\n" " -p parse only\n"
" -s strip debug information\n" " -s strip debug information\n"
...@@ -106,7 +106,7 @@ static int doargs(int argc, char* argv[]) ...@@ -106,7 +106,7 @@ static int doargs(int argc, char* argv[])
else if (IS("-e")) /* execute a lua source file file */ else if (IS("-e")) /* execute a lua source file file */
{ {
execute=argv[++i]; execute=argv[++i];
if (execute ==NULL || *execute==0 || *execute=='-' ) if (execute ==NULL || *execute==0 || *execute=='-' )
usage(LUA_QL("-e") " needs argument"); usage(LUA_QL("-e") " needs argument");
} }
else if (IS("-f")) /* Flash image file */ else if (IS("-f")) /* Flash image file */
...@@ -140,7 +140,7 @@ static int doargs(int argc, char* argv[]) ...@@ -140,7 +140,7 @@ static int doargs(int argc, char* argv[])
} }
else if (IS("-p")) /* parse only */ else if (IS("-p")) /* parse only */
dumping=0; dumping=0;
else if (IS("-s")) /* strip debug information */ else if (IS("-s")) /* strip debug information */
stripping=1; stripping=1;
else if (IS("-v")) /* show version */ else if (IS("-v")) /* show version */
...@@ -164,7 +164,7 @@ static int doargs(int argc, char* argv[]) ...@@ -164,7 +164,7 @@ static int doargs(int argc, char* argv[])
#define toproto(L,i) (clvalue(L->top+(i))->l.p) #define toproto(L,i) (clvalue(L->top+(i))->l.p)
static TString *corename(lua_State *L, const TString *filename) static TString *corename(lua_State *L, const TString *filename)
{ {
const char *fn = getstr(filename)+1; const char *fn = getstr(filename)+1;
const char *s = strrchr(fn, '/'); const char *s = strrchr(fn, '/');
...@@ -173,13 +173,13 @@ static TString *corename(lua_State *L, const TString *filename) ...@@ -173,13 +173,13 @@ static TString *corename(lua_State *L, const TString *filename)
const char *e = strchr(s, '.'); const char *e = strchr(s, '.');
int l = e ? e - s: strlen(s); int l = e ? e - s: strlen(s);
return l ? luaS_newlstr (L, s, l) : luaS_new(L, fn); return l ? luaS_newlstr (L, s, l) : luaS_new(L, fn);
} }
/* /*
* If the luac command line includes multiple files or has the -f option * If the luac command line includes multiple files or has the -f option
* then luac generates a main function to reference all sub-main prototypes. * then luac generates a main function to reference all sub-main prototypes.
* This is one of two types: * This is one of two types:
* Type 0 The standard luac combination main * Type 0 The standard luac combination main
* Type 1 A lookup wrapper that facilitates indexing into the generated protos * Type 1 A lookup wrapper that facilitates indexing into the generated protos
*/ */
static const Proto* combine(lua_State* L, int n, int type) static const Proto* combine(lua_State* L, int n, int type)
{ {
...@@ -194,14 +194,14 @@ static const Proto* combine(lua_State* L, int n, int type) ...@@ -194,14 +194,14 @@ static const Proto* combine(lua_State* L, int n, int type)
f->source=luaS_newliteral(L,"=(" PROGNAME ")"); f->source=luaS_newliteral(L,"=(" PROGNAME ")");
f->p=luaM_newvector(L,n,Proto*); f->p=luaM_newvector(L,n,Proto*);
f->sizep=n; f->sizep=n;
for (i=0; i<n; i++) for (i=0; i<n; i++)
f->p[i]=toproto(L,i-n-1); f->p[i]=toproto(L,i-n-1);
pc=0; pc=0;
if (type == 0) { if (type == 0) {
/* /*
* Type 0 is as per the standard luac, which is just a main routine which * Type 0 is as per the standard luac, which is just a main routine which
* invokes all of the compiled functions sequentially. This is fine if * invokes all of the compiled functions sequentially. This is fine if
* they are self registering modules, but useless otherwise. * they are self registering modules, but useless otherwise.
*/ */
f->numparams = 0; f->numparams = 0;
...@@ -218,7 +218,7 @@ static const Proto* combine(lua_State* L, int n, int type) ...@@ -218,7 +218,7 @@ static const Proto* combine(lua_State* L, int n, int type)
*pc++ = CREATE_ABC(OP_RETURN,0,1,0); *pc++ = CREATE_ABC(OP_RETURN,0,1,0);
} else { } else {
/* /*
* The Type 1 main() is a lookup which takes a single argument, the name to * The Type 1 main() is a lookup which takes a single argument, the name to
* be resolved. If this matches root name of one of the compiled files then * be resolved. If this matches root name of one of the compiled files then
* a closure to this file main is returned. Otherwise the Unixtime of the * a closure to this file main is returned. Otherwise the Unixtime of the
* compile and the list of root names is returned. * compile and the list of root names is returned.
...@@ -235,11 +235,11 @@ static const Proto* combine(lua_State* L, int n, int type) ...@@ -235,11 +235,11 @@ static const Proto* combine(lua_State* L, int n, int type)
f->sizelocvars = 0; f->sizelocvars = 0;
f->code = luaM_newvector(L, f->sizecode , Instruction); f->code = luaM_newvector(L, f->sizecode , Instruction);
f->k = luaM_newvector(L,f->sizek,TValue); f->k = luaM_newvector(L,f->sizek,TValue);
for (i=0, pc = f->code; i<n; i++) for (i=0, pc = f->code; i<n; i++)
{ {
/* if arg1 == FnameA then return function (...) -- funcA -- end end */ /* if arg1 == FnameA then return function (...) -- funcA -- end end */
setsvalue2n(L,f->k+i,corename(L, f->p[i]->source)); setsvalue2n(L,f->k+i,corename(L, f->p[i]->source));
*pc++ = CREATE_ABC(OP_EQ,0,0,RKASK(i)); *pc++ = CREATE_ABC(OP_EQ,0,0,RKASK(i));
*pc++ = CREATE_ABx(OP_JMP,0,MAXARG_sBx+2); *pc++ = CREATE_ABx(OP_JMP,0,MAXARG_sBx+2);
*pc++ = CREATE_ABx(OP_CLOSURE,1,i); *pc++ = CREATE_ABx(OP_CLOSURE,1,i);
*pc++ = CREATE_ABC(OP_RETURN,1,2,0); *pc++ = CREATE_ABC(OP_RETURN,1,2,0);
...@@ -248,10 +248,10 @@ static const Proto* combine(lua_State* L, int n, int type) ...@@ -248,10 +248,10 @@ static const Proto* combine(lua_State* L, int n, int type)
setnvalue(f->k+n, (lua_Number) time(NULL)); setnvalue(f->k+n, (lua_Number) time(NULL));
*pc++ = CREATE_ABx(OP_LOADK,1,n); *pc++ = CREATE_ABx(OP_LOADK,1,n);
*pc++ = CREATE_ABC(OP_NEWTABLE,2,luaO_int2fb(i),0); *pc++ = CREATE_ABC(OP_NEWTABLE,2,luaO_int2fb(i),0);
for (i=0; i<n; i++) for (i=0; i<n; i++)
*pc++ = CREATE_ABx(OP_LOADK,i+3,i); *pc++ = CREATE_ABx(OP_LOADK,i+3,i);
*pc++ = CREATE_ABC(OP_SETLIST,2,i,1); *pc++ = CREATE_ABC(OP_SETLIST,2,i,1);
*pc++ = CREATE_ABC(OP_RETURN,1,3,0); *pc++ = CREATE_ABC(OP_RETURN,1,3,0);
*pc++ = CREATE_ABC(OP_RETURN,0,1,0); *pc++ = CREATE_ABC(OP_RETURN,0,1,0);
} }
...@@ -272,8 +272,8 @@ struct Smain { ...@@ -272,8 +272,8 @@ struct Smain {
char** argv; char** argv;
}; };
extern uint dumpToFlashImage (lua_State* L,const Proto *main, lua_Writer w, extern uint dumpToFlashImage (lua_State* L,const Proto *main, lua_Writer w,
void* data, int strip, void* data, int strip,
lu_int32 address, lu_int32 maxSize); lu_int32 address, lu_int32 maxSize);
static int pmain(lua_State* L) static int pmain(lua_State* L)
...@@ -290,7 +290,7 @@ static int pmain(lua_State* L) ...@@ -290,7 +290,7 @@ static int pmain(lua_State* L)
luaL_openlibs(L); luaL_openlibs(L);
lua_pushstring(L, execute); lua_pushstring(L, execute);
if (lua_pcall(L, 1, 1, 0)) fatal(lua_tostring(L,-1)); if (lua_pcall(L, 1, 1, 0)) fatal(lua_tostring(L,-1));
if (!lua_isfunction(L, -1)) if (!lua_isfunction(L, -1))
{ {
lua_pop(L,1); lua_pop(L,1);
if(argc == 0) return 0; if(argc == 0) return 0;
...@@ -310,13 +310,13 @@ static int pmain(lua_State* L) ...@@ -310,13 +310,13 @@ static int pmain(lua_State* L)
FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); FILE* D= (output==NULL) ? stdout : fopen(output,"wb");
if (D==NULL) cannot("open"); if (D==NULL) cannot("open");
lua_lock(L); lua_lock(L);
if (flash) if (flash)
{ {
result=dumpToFlashImage(L,f,writer, D, stripping, address, maxSize); result=dumpToFlashImage(L,f,writer, D, stripping, address, maxSize);
} else } else
{ {
result=luaU_dump_crosscompile(L,f,writer,D,stripping,target); result=luaU_dump_crosscompile(L,f,writer,D,stripping,target);
} }
lua_unlock(L); lua_unlock(L);
if (result==LUA_ERR_CC_INTOVERFLOW) fatal("value too big or small for target integer type"); if (result==LUA_ERR_CC_INTOVERFLOW) fatal("value too big or small for target integer type");
if (result==LUA_ERR_CC_NOTINTEGER) fatal("target lua_Number is integral but fractional value found"); if (result==LUA_ERR_CC_NOTINTEGER) fatal("target lua_Number is integral but fractional value found");
...@@ -330,7 +330,7 @@ int main(int argc, char* argv[]) ...@@ -330,7 +330,7 @@ int main(int argc, char* argv[])
{ {
lua_State* L; lua_State* L;
struct Smain s; struct Smain s;
int test=1; int test=1;
target.little_endian=*(char*)&test; target.little_endian=*(char*)&test;
target.sizeof_int=sizeof(int); target.sizeof_int=sizeof(int);
......
...@@ -298,7 +298,7 @@ else ...@@ -298,7 +298,7 @@ else
** CHANGE it if you need longer lines. ** CHANGE it if you need longer lines.
*/ */
#define LUA_MAXINPUT 256 #define LUA_MAXINPUT 256
/* /*
@@ lua_readline defines how to show a prompt and then read a line from @@ lua_readline defines how to show a prompt and then read a line from
...@@ -558,7 +558,7 @@ extern int readline4lua(const char *prompt, char *buffer, int length); ...@@ -558,7 +558,7 @@ extern int readline4lua(const char *prompt, char *buffer, int length);
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
** Attention: This value should probably not be set higher than 1K. ** Attention: This value should probably not be set higher than 1K.
** The size has direct impact on the C stack size needed be auxlib functions. ** The size has direct impact on the C stack size needed be auxlib functions.
** For example: If set to 4K a call to string.gsub will need more than ** For example: If set to 4K a call to string.gsub will need more than
** 5k C stack space. ** 5k C stack space.
*/ */
#define LUAL_BUFFERSIZE 256 #define LUAL_BUFFERSIZE 256
...@@ -579,10 +579,10 @@ extern int readline4lua(const char *prompt, char *buffer, int length); ...@@ -579,10 +579,10 @@ extern int readline4lua(const char *prompt, char *buffer, int length);
/* Define LUA_NUMBER_INTEGRAL to produce a system that uses no /* Define LUA_NUMBER_INTEGRAL to produce a system that uses no
floating point operations by changing the type of Lua numbers from floating point operations by changing the type of Lua numbers from
double to long. It implements division and modulus so that double to long. It implements division and modulus so that
x == (x / y) * y + x % y.
x == (x / y) * y + x % y.
The exponentiation function returns zero for negative exponents. The exponentiation function returns zero for negative exponents.
Defining LUA_NUMBER_INTEGRAL also removes the difftime function, Defining LUA_NUMBER_INTEGRAL also removes the difftime function,
and the math module should not be used. The string.format function and the math module should not be used. The string.format function
......
...@@ -41,7 +41,7 @@ LUALIB_API int (luaopen_package) (lua_State *L); ...@@ -41,7 +41,7 @@ LUALIB_API int (luaopen_package) (lua_State *L);
/* open all previous libraries */ /* open all previous libraries */
LUALIB_API void (luaL_openlibs) (lua_State *L); LUALIB_API void (luaL_openlibs) (lua_State *L);
......
############################################################# #############################################################
# Required variables for each makefile # Required variables for each makefile
# Discard this section from all parent makefiles # Discard this section from all parent makefiles
# Expected variables (with automatic defaults): # Expected variables (with automatic defaults):
# CSRCS (all "C" files in the dir) # CSRCS (all "C" files in the dir)
# SUBDIRS (all subdirs with a Makefile) # SUBDIRS (all subdirs with a Makefile)
# GEN_LIBS - list of libs to be generated () # GEN_LIBS - list of libs to be generated ()
# GEN_IMAGES - list of images to be generated () # GEN_IMAGES - list of images to be generated ()
# COMPONENTS_xxx - a list of libs/objs in the form # COMPONENTS_xxx - a list of libs/objs in the form
# subdir/lib to be extracted and rolled up into # subdir/lib to be extracted and rolled up into
# a generated lib/image xxx.a () # a generated lib/image xxx.a ()
# #
ifndef PDIR ifndef PDIR
UP_EXTRACT_DIR = .. UP_EXTRACT_DIR = ..
GEN_LIBS = liblwip.a GEN_LIBS = liblwip.a
COMPONENTS_liblwip = api/liblwipapi.a \ COMPONENTS_liblwip = api/liblwipapi.a \
app/liblwipapp.a \ app/liblwipapp.a \
core/liblwipcore.a \ core/liblwipcore.a \
core/ipv4/liblwipipv4.a \ core/ipv4/liblwipipv4.a \
netif/liblwipnetif.a netif/liblwipnetif.a
endif endif
############################################################# #############################################################
# Configuration i.e. compile options etc. # Configuration i.e. compile options etc.
# Target specific stuff (defines etc.) goes in here! # Target specific stuff (defines etc.) goes in here!
# Generally values applying to a tree are captured in the # Generally values applying to a tree are captured in the
# 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!!
# #
# Each subtree potentially has an include directory # Each subtree potentially has an include directory
# corresponding to the common APIs applicable to modules # corresponding to the common APIs applicable to modules
# rooted at that subtree. Accordingly, the INCLUDE PATH # rooted at that subtree. Accordingly, the INCLUDE PATH
# of a module can only contain the include directories up # of a module can only contain the include directories up
# its parent path, and not its siblings # its parent path, and not its siblings
# #
# Required for each makefile to inherit from the parent # Required for each makefile to inherit from the parent
# #
INCLUDES := $(INCLUDES) -I $(PDIR)include INCLUDES := $(INCLUDES) -I $(PDIR)include
INCLUDES += -I ./ INCLUDES += -I ./
PDIR := ../$(PDIR) PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile sinclude $(PDIR)Makefile
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