Commit bf3463d0 authored by zeroday's avatar zeroday
Browse files

Merge pull request #75 from nodemcu/dev095

Dev095
parents 0a3702f8 729603fa
......@@ -54,7 +54,7 @@ static void chunk (LexState *ls);
static void expr (LexState *ls, expdesc *v);
static void ICACHE_FLASH_ATTR anchor_token (LexState *ls) {
static void anchor_token (LexState *ls) {
if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) {
TString *ts = ls->t.seminfo.ts;
luaX_newstring(ls, getstr(ts), ts->tsv.len);
......@@ -62,13 +62,13 @@ static void ICACHE_FLASH_ATTR anchor_token (LexState *ls) {
}
static void ICACHE_FLASH_ATTR error_expected (LexState *ls, int token) {
static void error_expected (LexState *ls, int token) {
luaX_syntaxerror(ls,
luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token)));
}
static void ICACHE_FLASH_ATTR errorlimit (FuncState *fs, int limit, const char *what) {
static void errorlimit (FuncState *fs, int limit, const char *what) {
const char *msg = (fs->f->linedefined == 0) ?
luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) :
luaO_pushfstring(fs->L, "function at line %d has more than %d %s",
......@@ -77,7 +77,7 @@ static void ICACHE_FLASH_ATTR errorlimit (FuncState *fs, int limit, const char *
}
static int ICACHE_FLASH_ATTR testnext (LexState *ls, int c) {
static int testnext (LexState *ls, int c) {
if (ls->t.token == c) {
luaX_next(ls);
return 1;
......@@ -86,12 +86,12 @@ static int ICACHE_FLASH_ATTR testnext (LexState *ls, int c) {
}
static void ICACHE_FLASH_ATTR check (LexState *ls, int c) {
static void check (LexState *ls, int c) {
if (ls->t.token != c)
error_expected(ls, c);
}
static void ICACHE_FLASH_ATTR checknext (LexState *ls, int c) {
static void checknext (LexState *ls, int c) {
check(ls, c);
luaX_next(ls);
}
......@@ -101,7 +101,7 @@ static void ICACHE_FLASH_ATTR checknext (LexState *ls, int c) {
static void ICACHE_FLASH_ATTR check_match (LexState *ls, int what, int who, int where) {
static void check_match (LexState *ls, int what, int who, int where) {
if (!testnext(ls, what)) {
if (where == ls->linenumber)
error_expected(ls, what);
......@@ -114,7 +114,7 @@ static void ICACHE_FLASH_ATTR check_match (LexState *ls, int what, int who, int
}
static TString *ICACHE_FLASH_ATTR str_checkname (LexState *ls) {
static TString *str_checkname (LexState *ls) {
TString *ts;
check(ls, TK_NAME);
ts = ls->t.seminfo.ts;
......@@ -123,24 +123,24 @@ static TString *ICACHE_FLASH_ATTR str_checkname (LexState *ls) {
}
static void ICACHE_FLASH_ATTR init_exp (expdesc *e, expkind k, int i) {
static void init_exp (expdesc *e, expkind k, int i) {
e->f = e->t = NO_JUMP;
e->k = k;
e->u.s.info = i;
}
static void ICACHE_FLASH_ATTR codestring (LexState *ls, expdesc *e, TString *s) {
static void codestring (LexState *ls, expdesc *e, TString *s) {
init_exp(e, VK, luaK_stringK(ls->fs, s));
}
static void ICACHE_FLASH_ATTR checkname(LexState *ls, expdesc *e) {
static void checkname(LexState *ls, expdesc *e) {
codestring(ls, e, str_checkname(ls));
}
static int ICACHE_FLASH_ATTR registerlocalvar (LexState *ls, TString *varname) {
static int registerlocalvar (LexState *ls, TString *varname) {
FuncState *fs = ls->fs;
Proto *f = fs->f;
int oldsize = f->sizelocvars;
......@@ -157,14 +157,14 @@ static int ICACHE_FLASH_ATTR registerlocalvar (LexState *ls, TString *varname) {
new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n)
static void ICACHE_FLASH_ATTR new_localvar (LexState *ls, TString *name, int n) {
static void new_localvar (LexState *ls, TString *name, int n) {
FuncState *fs = ls->fs;
luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables");
fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name));
}
static void ICACHE_FLASH_ATTR adjustlocalvars (LexState *ls, int nvars) {
static void adjustlocalvars (LexState *ls, int nvars) {
FuncState *fs = ls->fs;
fs->nactvar = cast_byte(fs->nactvar + nvars);
for (; nvars; nvars--) {
......@@ -173,14 +173,14 @@ static void ICACHE_FLASH_ATTR adjustlocalvars (LexState *ls, int nvars) {
}
static void ICACHE_FLASH_ATTR removevars (LexState *ls, int tolevel) {
static void removevars (LexState *ls, int tolevel) {
FuncState *fs = ls->fs;
while (fs->nactvar > tolevel)
getlocvar(fs, --fs->nactvar).endpc = fs->pc;
}
static int ICACHE_FLASH_ATTR indexupvalue (FuncState *fs, TString *name, expdesc *v) {
static int indexupvalue (FuncState *fs, TString *name, expdesc *v) {
int i;
Proto *f = fs->f;
int oldsize = f->sizeupvalues;
......@@ -204,7 +204,7 @@ static int ICACHE_FLASH_ATTR indexupvalue (FuncState *fs, TString *name, expdesc
}
static int ICACHE_FLASH_ATTR searchvar (FuncState *fs, TString *n) {
static int searchvar (FuncState *fs, TString *n) {
int i;
for (i=fs->nactvar-1; i >= 0; i--) {
if (n == getlocvar(fs, i).varname)
......@@ -214,14 +214,14 @@ static int ICACHE_FLASH_ATTR searchvar (FuncState *fs, TString *n) {
}
static void ICACHE_FLASH_ATTR markupval (FuncState *fs, int level) {
static void markupval (FuncState *fs, int level) {
BlockCnt *bl = fs->bl;
while (bl && bl->nactvar > level) bl = bl->previous;
if (bl) bl->upval = 1;
}
static int ICACHE_FLASH_ATTR singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {
static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {
if (fs == NULL) { /* no more levels? */
init_exp(var, VGLOBAL, NO_REG); /* default is global variable */
return VGLOBAL;
......@@ -245,7 +245,7 @@ static int ICACHE_FLASH_ATTR singlevaraux (FuncState *fs, TString *n, expdesc *v
}
static void ICACHE_FLASH_ATTR singlevar (LexState *ls, expdesc *var) {
static void singlevar (LexState *ls, expdesc *var) {
TString *varname = str_checkname(ls);
FuncState *fs = ls->fs;
if (singlevaraux(fs, varname, var, 1) == VGLOBAL)
......@@ -253,7 +253,7 @@ static void ICACHE_FLASH_ATTR singlevar (LexState *ls, expdesc *var) {
}
static void ICACHE_FLASH_ATTR adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {
static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {
FuncState *fs = ls->fs;
int extra = nvars - nexps;
if (hasmultret(e->k)) {
......@@ -273,7 +273,7 @@ static void ICACHE_FLASH_ATTR adjust_assign (LexState *ls, int nvars, int nexps,
}
static void ICACHE_FLASH_ATTR enterlevel (LexState *ls) {
static void enterlevel (LexState *ls) {
if (++ls->L->nCcalls > LUAI_MAXCCALLS)
luaX_lexerror(ls, "chunk has too many syntax levels", 0);
}
......@@ -282,7 +282,7 @@ static void ICACHE_FLASH_ATTR enterlevel (LexState *ls) {
#define leavelevel(ls) ((ls)->L->nCcalls--)
static void ICACHE_FLASH_ATTR enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) {
static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) {
bl->breaklist = NO_JUMP;
bl->isbreakable = isbreakable;
bl->nactvar = fs->nactvar;
......@@ -293,7 +293,7 @@ static void ICACHE_FLASH_ATTR enterblock (FuncState *fs, BlockCnt *bl, lu_byte i
}
static void ICACHE_FLASH_ATTR leaveblock (FuncState *fs) {
static void leaveblock (FuncState *fs) {
BlockCnt *bl = fs->bl;
fs->bl = bl->previous;
removevars(fs->ls, bl->nactvar);
......@@ -307,7 +307,7 @@ static void ICACHE_FLASH_ATTR leaveblock (FuncState *fs) {
}
static void ICACHE_FLASH_ATTR pushclosure (LexState *ls, FuncState *func, expdesc *v) {
static void pushclosure (LexState *ls, FuncState *func, expdesc *v) {
FuncState *fs = ls->fs;
Proto *f = fs->f;
int oldsize = f->sizep;
......@@ -325,7 +325,7 @@ static void ICACHE_FLASH_ATTR pushclosure (LexState *ls, FuncState *func, expdes
}
static void ICACHE_FLASH_ATTR open_func (LexState *ls, FuncState *fs) {
static void open_func (LexState *ls, FuncState *fs) {
lua_State *L = ls->L;
Proto *f = luaF_newproto(L);
fs->f = f;
......@@ -353,7 +353,7 @@ static void ICACHE_FLASH_ATTR open_func (LexState *ls, FuncState *fs) {
}
static void ICACHE_FLASH_ATTR close_func (LexState *ls) {
static void close_func (LexState *ls) {
lua_State *L = ls->L;
FuncState *fs = ls->fs;
Proto *f = fs->f;
......@@ -380,7 +380,7 @@ static void ICACHE_FLASH_ATTR close_func (LexState *ls) {
}
Proto *ICACHE_FLASH_ATTR luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
struct LexState lexstate;
struct FuncState funcstate;
TString *tname = luaS_new(L, name);
......@@ -408,7 +408,7 @@ Proto *ICACHE_FLASH_ATTR luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const
/*============================================================*/
static void ICACHE_FLASH_ATTR field (LexState *ls, expdesc *v) {
static void field (LexState *ls, expdesc *v) {
/* field -> ['.' | ':'] NAME */
FuncState *fs = ls->fs;
expdesc key;
......@@ -419,7 +419,7 @@ static void ICACHE_FLASH_ATTR field (LexState *ls, expdesc *v) {
}
static void ICACHE_FLASH_ATTR yindex (LexState *ls, expdesc *v) {
static void yindex (LexState *ls, expdesc *v) {
/* index -> '[' expr ']' */
luaX_next(ls); /* skip the '[' */
expr(ls, v);
......@@ -444,7 +444,7 @@ struct ConsControl {
};
static void ICACHE_FLASH_ATTR recfield (LexState *ls, struct ConsControl *cc) {
static void recfield (LexState *ls, struct ConsControl *cc) {
/* recfield -> (NAME | `['exp1`]') = exp1 */
FuncState *fs = ls->fs;
int reg = ls->fs->freereg;
......@@ -465,7 +465,7 @@ static void ICACHE_FLASH_ATTR recfield (LexState *ls, struct ConsControl *cc) {
}
static void ICACHE_FLASH_ATTR closelistfield (FuncState *fs, struct ConsControl *cc) {
static void closelistfield (FuncState *fs, struct ConsControl *cc) {
if (cc->v.k == VVOID) return; /* there is no list item */
luaK_exp2nextreg(fs, &cc->v);
cc->v.k = VVOID;
......@@ -476,7 +476,7 @@ static void ICACHE_FLASH_ATTR closelistfield (FuncState *fs, struct ConsControl
}
static void ICACHE_FLASH_ATTR lastlistfield (FuncState *fs, struct ConsControl *cc) {
static void lastlistfield (FuncState *fs, struct ConsControl *cc) {
if (cc->tostore == 0) return;
if (hasmultret(cc->v.k)) {
luaK_setmultret(fs, &cc->v);
......@@ -491,7 +491,7 @@ static void ICACHE_FLASH_ATTR lastlistfield (FuncState *fs, struct ConsControl *
}
static void ICACHE_FLASH_ATTR listfield (LexState *ls, struct ConsControl *cc) {
static void listfield (LexState *ls, struct ConsControl *cc) {
expr(ls, &cc->v);
luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor");
cc->na++;
......@@ -499,7 +499,7 @@ static void ICACHE_FLASH_ATTR listfield (LexState *ls, struct ConsControl *cc) {
}
static void ICACHE_FLASH_ATTR constructor (LexState *ls, expdesc *t) {
static void constructor (LexState *ls, expdesc *t) {
/* constructor -> ?? */
FuncState *fs = ls->fs;
int line = ls->linenumber;
......@@ -544,7 +544,7 @@ static void ICACHE_FLASH_ATTR constructor (LexState *ls, expdesc *t) {
static void ICACHE_FLASH_ATTR parlist (LexState *ls) {
static void parlist (LexState *ls) {
/* parlist -> [ param { `,' param } ] */
FuncState *fs = ls->fs;
Proto *f = fs->f;
......@@ -577,7 +577,7 @@ static void ICACHE_FLASH_ATTR parlist (LexState *ls) {
}
static void ICACHE_FLASH_ATTR body (LexState *ls, expdesc *e, int needself, int line) {
static void body (LexState *ls, expdesc *e, int needself, int line) {
/* body -> `(' parlist `)' chunk END */
FuncState new_fs;
open_func(ls, &new_fs);
......@@ -597,7 +597,7 @@ static void ICACHE_FLASH_ATTR body (LexState *ls, expdesc *e, int needself, int
}
static int ICACHE_FLASH_ATTR explist1 (LexState *ls, expdesc *v) {
static int explist1 (LexState *ls, expdesc *v) {
/* explist1 -> expr { `,' expr } */
int n = 1; /* at least one expression */
expr(ls, v);
......@@ -610,7 +610,7 @@ static int ICACHE_FLASH_ATTR explist1 (LexState *ls, expdesc *v) {
}
static void ICACHE_FLASH_ATTR funcargs (LexState *ls, expdesc *f) {
static void funcargs (LexState *ls, expdesc *f) {
FuncState *fs = ls->fs;
expdesc args;
int base, nparams;
......@@ -668,7 +668,7 @@ static void ICACHE_FLASH_ATTR funcargs (LexState *ls, expdesc *f) {
*/
static void ICACHE_FLASH_ATTR prefixexp (LexState *ls, expdesc *v) {
static void prefixexp (LexState *ls, expdesc *v) {
/* prefixexp -> NAME | '(' expr ')' */
switch (ls->t.token) {
case '(': {
......@@ -691,7 +691,7 @@ static void ICACHE_FLASH_ATTR prefixexp (LexState *ls, expdesc *v) {
}
static void ICACHE_FLASH_ATTR primaryexp (LexState *ls, expdesc *v) {
static void primaryexp (LexState *ls, expdesc *v) {
/* primaryexp ->
prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */
FuncState *fs = ls->fs;
......@@ -728,7 +728,7 @@ static void ICACHE_FLASH_ATTR primaryexp (LexState *ls, expdesc *v) {
}
static void ICACHE_FLASH_ATTR simpleexp (LexState *ls, expdesc *v) {
static void simpleexp (LexState *ls, expdesc *v) {
/* simpleexp -> NUMBER | STRING | NIL | true | false | ... |
constructor | FUNCTION body | primaryexp */
switch (ls->t.token) {
......@@ -779,7 +779,7 @@ static void ICACHE_FLASH_ATTR simpleexp (LexState *ls, expdesc *v) {
}
static UnOpr ICACHE_FLASH_ATTR getunopr (int op) {
static UnOpr getunopr (int op) {
switch (op) {
case TK_NOT: return OPR_NOT;
case '-': return OPR_MINUS;
......@@ -789,7 +789,7 @@ static UnOpr ICACHE_FLASH_ATTR getunopr (int op) {
}
static BinOpr ICACHE_FLASH_ATTR getbinopr (int op) {
static BinOpr getbinopr (int op) {
switch (op) {
case '+': return OPR_ADD;
case '-': return OPR_SUB;
......@@ -829,7 +829,7 @@ static const struct {
** subexpr -> (simpleexp | unop subexpr) { binop subexpr }
** where `binop' is any binary operator with a priority higher than `limit'
*/
static BinOpr ICACHE_FLASH_ATTR subexpr (LexState *ls, expdesc *v, unsigned int limit) {
static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) {
BinOpr op;
UnOpr uop;
enterlevel(ls);
......@@ -857,7 +857,7 @@ static BinOpr ICACHE_FLASH_ATTR subexpr (LexState *ls, expdesc *v, unsigned int
}
static void ICACHE_FLASH_ATTR expr (LexState *ls, expdesc *v) {
static void expr (LexState *ls, expdesc *v) {
subexpr(ls, v, 0);
}
......@@ -872,7 +872,7 @@ static void ICACHE_FLASH_ATTR expr (LexState *ls, expdesc *v) {
*/
static int ICACHE_FLASH_ATTR block_follow (int token) {
static int block_follow (int token) {
switch (token) {
case TK_ELSE: case TK_ELSEIF: case TK_END:
case TK_UNTIL: case TK_EOS:
......@@ -882,7 +882,7 @@ static int ICACHE_FLASH_ATTR block_follow (int token) {
}
static void ICACHE_FLASH_ATTR block (LexState *ls) {
static void block (LexState *ls) {
/* block -> chunk */
FuncState *fs = ls->fs;
BlockCnt *pbl = (BlockCnt*)luaM_malloc(ls->L,sizeof(BlockCnt));
......@@ -910,7 +910,7 @@ struct LHS_assign {
** local value in a safe place and use this safe copy in the previous
** assignment.
*/
static void ICACHE_FLASH_ATTR check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) {
static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) {
FuncState *fs = ls->fs;
int extra = fs->freereg; /* eventual position to save local variable */
int conflict = 0;
......@@ -933,7 +933,7 @@ static void ICACHE_FLASH_ATTR check_conflict (LexState *ls, struct LHS_assign *l
}
static void ICACHE_FLASH_ATTR assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
expdesc e;
check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED,
"syntax error");
......@@ -967,7 +967,7 @@ static void ICACHE_FLASH_ATTR assignment (LexState *ls, struct LHS_assign *lh, i
}
static int ICACHE_FLASH_ATTR cond (LexState *ls) {
static int cond (LexState *ls) {
/* cond -> exp */
expdesc v;
expr(ls, &v); /* read condition */
......@@ -977,7 +977,7 @@ static int ICACHE_FLASH_ATTR cond (LexState *ls) {
}
static void ICACHE_FLASH_ATTR breakstat (LexState *ls) {
static void breakstat (LexState *ls) {
FuncState *fs = ls->fs;
BlockCnt *bl = fs->bl;
int upval = 0;
......@@ -993,7 +993,7 @@ static void ICACHE_FLASH_ATTR breakstat (LexState *ls) {
}
static void ICACHE_FLASH_ATTR whilestat (LexState *ls, int line) {
static void whilestat (LexState *ls, int line) {
/* whilestat -> WHILE cond DO block END */
FuncState *fs = ls->fs;
int whileinit;
......@@ -1012,7 +1012,7 @@ static void ICACHE_FLASH_ATTR whilestat (LexState *ls, int line) {
}
static void ICACHE_FLASH_ATTR repeatstat (LexState *ls, int line) {
static void repeatstat (LexState *ls, int line) {
/* repeatstat -> REPEAT block UNTIL cond */
int condexit;
FuncState *fs = ls->fs;
......@@ -1038,7 +1038,7 @@ static void ICACHE_FLASH_ATTR repeatstat (LexState *ls, int line) {
}
static int ICACHE_FLASH_ATTR exp1 (LexState *ls) {
static int exp1 (LexState *ls) {
expdesc e;
int k;
expr(ls, &e);
......@@ -1048,7 +1048,7 @@ static int ICACHE_FLASH_ATTR exp1 (LexState *ls) {
}
static void ICACHE_FLASH_ATTR forbody (LexState *ls, int base, int line, int nvars, int isnum) {
static void forbody (LexState *ls, int base, int line, int nvars, int isnum) {
/* forbody -> DO block */
BlockCnt *pbl = (BlockCnt*)luaM_malloc(ls->L,sizeof(BlockCnt));
FuncState *fs = ls->fs;
......@@ -1070,7 +1070,7 @@ static void ICACHE_FLASH_ATTR forbody (LexState *ls, int base, int line, int nva
}
static void ICACHE_FLASH_ATTR fornum (LexState *ls, TString *varname, int line) {
static void fornum (LexState *ls, TString *varname, int line) {
/* fornum -> NAME = exp1,exp1[,exp1] forbody */
FuncState *fs = ls->fs;
int base = fs->freereg;
......@@ -1092,7 +1092,7 @@ static void ICACHE_FLASH_ATTR fornum (LexState *ls, TString *varname, int line)
}
static void ICACHE_FLASH_ATTR forlist (LexState *ls, TString *indexname) {
static void forlist (LexState *ls, TString *indexname) {
/* forlist -> NAME {,NAME} IN explist1 forbody */
FuncState *fs = ls->fs;
expdesc e;
......@@ -1115,7 +1115,7 @@ static void ICACHE_FLASH_ATTR forlist (LexState *ls, TString *indexname) {
}
static void ICACHE_FLASH_ATTR forstat (LexState *ls, int line) {
static void forstat (LexState *ls, int line) {
/* forstat -> FOR (fornum | forlist) END */
FuncState *fs = ls->fs;
TString *varname;
......@@ -1133,7 +1133,7 @@ static void ICACHE_FLASH_ATTR forstat (LexState *ls, int line) {
}
static int ICACHE_FLASH_ATTR test_then_block (LexState *ls) {
static int test_then_block (LexState *ls) {
/* test_then_block -> [IF | ELSEIF] cond THEN block */
int condexit;
luaX_next(ls); /* skip IF or ELSEIF */
......@@ -1144,7 +1144,7 @@ static int ICACHE_FLASH_ATTR test_then_block (LexState *ls) {
}
static void ICACHE_FLASH_ATTR ifstat (LexState *ls, int line) {
static void ifstat (LexState *ls, int line) {
/* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */
FuncState *fs = ls->fs;
int flist;
......@@ -1168,7 +1168,7 @@ static void ICACHE_FLASH_ATTR ifstat (LexState *ls, int line) {
}
static void ICACHE_FLASH_ATTR localfunc (LexState *ls) {
static void localfunc (LexState *ls) {
expdesc v, b;
FuncState *fs = ls->fs;
new_localvar(ls, str_checkname(ls), 0);
......@@ -1182,7 +1182,7 @@ static void ICACHE_FLASH_ATTR localfunc (LexState *ls) {
}
static void ICACHE_FLASH_ATTR localstat (LexState *ls) {
static void localstat (LexState *ls) {
/* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */
int nvars = 0;
int nexps;
......@@ -1201,7 +1201,7 @@ static void ICACHE_FLASH_ATTR localstat (LexState *ls) {
}
static int ICACHE_FLASH_ATTR funcname (LexState *ls, expdesc *v) {
static int funcname (LexState *ls, expdesc *v) {
/* funcname -> NAME {field} [`:' NAME] */
int needself = 0;
singlevar(ls, v);
......@@ -1215,7 +1215,7 @@ static int ICACHE_FLASH_ATTR funcname (LexState *ls, expdesc *v) {
}
static void ICACHE_FLASH_ATTR funcstat (LexState *ls, int line) {
static void funcstat (LexState *ls, int line) {
/* funcstat -> FUNCTION funcname body */
int needself;
expdesc v, b;
......@@ -1227,7 +1227,7 @@ static void ICACHE_FLASH_ATTR funcstat (LexState *ls, int line) {
}
static void ICACHE_FLASH_ATTR exprstat (LexState *ls) {
static void exprstat (LexState *ls) {
/* stat -> func | assignment */
FuncState *fs = ls->fs;
struct LHS_assign v;
......@@ -1241,7 +1241,7 @@ static void ICACHE_FLASH_ATTR exprstat (LexState *ls) {
}
static void ICACHE_FLASH_ATTR retstat (LexState *ls) {
static void retstat (LexState *ls) {
/* stat -> RETURN explist */
FuncState *fs = ls->fs;
expdesc e;
......@@ -1274,7 +1274,7 @@ static void ICACHE_FLASH_ATTR retstat (LexState *ls) {
}
static int ICACHE_FLASH_ATTR statement (LexState *ls) {
static int statement (LexState *ls) {
int line = ls->linenumber; /* may be needed for error messages */
switch (ls->t.token) {
case TK_IF: { /* stat -> ifstat */
......@@ -1328,7 +1328,7 @@ static int ICACHE_FLASH_ATTR statement (LexState *ls) {
}
static void ICACHE_FLASH_ATTR chunk (LexState *ls) {
static void chunk (LexState *ls) {
/* chunk -> { stat [`;'] } */
int islast = 0;
enterlevel(ls);
......
......@@ -16,7 +16,7 @@
#undef LREGISTER
#if (MIN_OPT_LEVEL > 0) && (LUA_OPTIMIZE_MEMORY >= MIN_OPT_LEVEL)
#define LUA_REG_TYPE luaR_entry
#define LUA_REG_TYPE luaR_entry ICACHE_RODATA_ATTR
#define LSTRKEY LRO_STRKEY
#define LNUMKEY LRO_NUMKEY
#define LNILKEY LRO_NILKEY
......
......@@ -16,7 +16,7 @@
extern const luaR_table lua_rotable[];
/* Find a global "read only table" in the constant lua_rotable array */
void* ICACHE_FLASH_ATTR luaR_findglobal(const char *name, unsigned len) {
void* luaR_findglobal(const char *name, unsigned len) {
unsigned i;
if (c_strlen(name) > LUA_MAX_ROTABLE_NAME)
......@@ -29,7 +29,7 @@ void* ICACHE_FLASH_ATTR luaR_findglobal(const char *name, unsigned len) {
}
/* Find an entry in a rotable and return it */
static const TValue* ICACHE_FLASH_ATTR luaR_auxfind(const luaR_entry *pentry, const char *strkey, luaR_numkey numkey, unsigned *ppos) {
static const TValue* luaR_auxfind(const luaR_entry *pentry, const char *strkey, luaR_numkey numkey, unsigned *ppos) {
const TValue *res = NULL;
unsigned i = 0;
......@@ -48,7 +48,7 @@ static const TValue* ICACHE_FLASH_ATTR luaR_auxfind(const luaR_entry *pentry, co
return res;
}
int ICACHE_FLASH_ATTR luaR_findfunction(lua_State *L, const luaR_entry *ptable) {
int luaR_findfunction(lua_State *L, const luaR_entry *ptable) {
const TValue *res = NULL;
const char *key = luaL_checkstring(L, 2);
......@@ -64,12 +64,12 @@ int ICACHE_FLASH_ATTR luaR_findfunction(lua_State *L, const luaR_entry *ptable)
/* Find an entry in a rotable and return its type
If "strkey" is not NULL, the function will look for a string key,
otherwise it will look for a number key */
const TValue* ICACHE_FLASH_ATTR luaR_findentry(void *data, const char *strkey, luaR_numkey numkey, unsigned *ppos) {
const TValue* luaR_findentry(void *data, const char *strkey, luaR_numkey numkey, unsigned *ppos) {
return luaR_auxfind((const luaR_entry*)data, strkey, numkey, ppos);
}
/* Find the metatable of a given table */
void* ICACHE_FLASH_ATTR luaR_getmeta(void *data) {
void* luaR_getmeta(void *data) {
#ifdef LUA_META_ROTABLES
const TValue *res = luaR_auxfind((const luaR_entry*)data, "__metatable", 0, NULL);
return res && ttisrotable(res) ? rvalue(res) : NULL;
......@@ -78,7 +78,7 @@ void* ICACHE_FLASH_ATTR luaR_getmeta(void *data) {
#endif
}
static void ICACHE_FLASH_ATTR luaR_next_helper(lua_State *L, const luaR_entry *pentries, int pos, TValue *key, TValue *val) {
static void luaR_next_helper(lua_State *L, const luaR_entry *pentries, int pos, TValue *key, TValue *val) {
setnilvalue(key);
setnilvalue(val);
if (pentries[pos].key.type != LUA_TNIL) {
......@@ -91,7 +91,7 @@ static void ICACHE_FLASH_ATTR luaR_next_helper(lua_State *L, const luaR_entry *p
}
}
/* next (used for iteration) */
void ICACHE_FLASH_ATTR luaR_next(lua_State *L, void *data, TValue *key, TValue *val) {
void luaR_next(lua_State *L, void *data, TValue *key, TValue *val) {
const luaR_entry* pentries = (const luaR_entry*)data;
char strkey[LUA_MAX_ROTABLE_NAME + 1], *pstrkey = NULL;
luaR_numkey numkey = 0;
......@@ -115,7 +115,7 @@ void ICACHE_FLASH_ATTR luaR_next(lua_State *L, void *data, TValue *key, TValue *
}
/* Convert a Lua string to a C string */
void ICACHE_FLASH_ATTR luaR_getcstr(char *dest, const TString *src, size_t maxsize) {
void luaR_getcstr(char *dest, const TString *src, size_t maxsize) {
if (src->tsv.len+1 > maxsize)
dest[0] = '\0';
else {
......@@ -129,7 +129,7 @@ void ICACHE_FLASH_ATTR luaR_getcstr(char *dest, const TString *src, size_t maxsi
#include "compiler.h"
int ICACHE_FLASH_ATTR luaR_isrotable(void *p) {
int luaR_isrotable(void *p) {
return RODATA_START_ADDRESS <= (char*)p && (char*)p <= RODATA_END_ADDRESS;
}
#endif
......@@ -38,7 +38,7 @@ typedef struct LG {
static void ICACHE_FLASH_ATTR stack_init (lua_State *L1, lua_State *L) {
static void stack_init (lua_State *L1, lua_State *L) {
/* initialize CallInfo array */
L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo);
L1->ci = L1->base_ci;
......@@ -57,7 +57,7 @@ static void ICACHE_FLASH_ATTR stack_init (lua_State *L1, lua_State *L) {
}
static void ICACHE_FLASH_ATTR freestack (lua_State *L, lua_State *L1) {
static void freestack (lua_State *L, lua_State *L1) {
luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo);
luaM_freearray(L, L1->stack, L1->stacksize, TValue);
}
......@@ -66,7 +66,7 @@ static void ICACHE_FLASH_ATTR freestack (lua_State *L, lua_State *L1) {
/*
** open parts that may cause memory-allocation errors
*/
static void ICACHE_FLASH_ATTR f_luaopen (lua_State *L, void *ud) {
static void f_luaopen (lua_State *L, void *ud) {
global_State *g = G(L);
UNUSED(ud);
stack_init(L, L); /* init stack */
......@@ -80,7 +80,7 @@ static void ICACHE_FLASH_ATTR f_luaopen (lua_State *L, void *ud) {
}
static void ICACHE_FLASH_ATTR preinit_state (lua_State *L, global_State *g) {
static void preinit_state (lua_State *L, global_State *g) {
G(L) = g;
L->stack = NULL;
L->stacksize = 0;
......@@ -101,7 +101,7 @@ static void ICACHE_FLASH_ATTR preinit_state (lua_State *L, global_State *g) {
}
static void ICACHE_FLASH_ATTR close_state (lua_State *L) {
static void close_state (lua_State *L) {
global_State *g = G(L);
luaF_close(L, L->stack); /* close all upvalues for this thread */
luaC_freeall(L); /* collect all objects */
......@@ -115,7 +115,7 @@ static void ICACHE_FLASH_ATTR close_state (lua_State *L) {
}
lua_State *ICACHE_FLASH_ATTR luaE_newthread (lua_State *L) {
lua_State *luaE_newthread (lua_State *L) {
lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State)));
luaC_link(L, obj2gco(L1), LUA_TTHREAD);
setthvalue(L, L->top, L1); /* put thread on stack */
......@@ -133,7 +133,7 @@ lua_State *ICACHE_FLASH_ATTR luaE_newthread (lua_State *L) {
}
void ICACHE_FLASH_ATTR luaE_freethread (lua_State *L, lua_State *L1) {
void luaE_freethread (lua_State *L, lua_State *L1) {
luaF_close(L1, L1->stack); /* close all upvalues for this thread */
lua_assert(L1->openupval == NULL);
luai_userstatefree(L1);
......@@ -142,7 +142,7 @@ void ICACHE_FLASH_ATTR luaE_freethread (lua_State *L, lua_State *L1) {
}
LUA_API lua_State *ICACHE_FLASH_ATTR lua_newstate (lua_Alloc f, void *ud) {
LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
int i;
lua_State *L;
global_State *g;
......@@ -205,7 +205,7 @@ LUA_API lua_State *ICACHE_FLASH_ATTR lua_newstate (lua_Alloc f, void *ud) {
}
static void ICACHE_FLASH_ATTR callallgcTM (lua_State *L, void *ud) {
static void callallgcTM (lua_State *L, void *ud) {
UNUSED(ud);
luaC_callGCTM(L); /* call GC metamethods for all udata */
}
......@@ -214,15 +214,15 @@ static void ICACHE_FLASH_ATTR callallgcTM (lua_State *L, void *ud) {
extern lua_State *luaL_newstate (void);
static lua_State *lua_crtstate;
lua_State *ICACHE_FLASH_ATTR lua_open(void) {
lua_State *lua_open(void) {
lua_crtstate = luaL_newstate();
return lua_crtstate;
}
lua_State *ICACHE_FLASH_ATTR lua_getstate(void) {
lua_State *lua_getstate(void) {
return lua_crtstate;
}
LUA_API void ICACHE_FLASH_ATTR lua_close (lua_State *L) {
LUA_API void lua_close (lua_State *L) {
#ifndef LUA_CROSS_COMPILER
lua_sethook( L, NULL, 0, 0 );
lua_crtstate = NULL;
......
......@@ -20,7 +20,7 @@
#define LUAS_READONLY_STRING 1
#define LUAS_REGULAR_STRING 0
void ICACHE_FLASH_ATTR luaS_resize (lua_State *L, int newsize) {
void luaS_resize (lua_State *L, int newsize) {
stringtable *tb;
int i;
tb = &G(L)->strt;
......@@ -51,7 +51,7 @@ void ICACHE_FLASH_ATTR luaS_resize (lua_State *L, int newsize) {
unset_resizing_strings_gc(L);
}
static TString *ICACHE_FLASH_ATTR newlstr (lua_State *L, const char *str, size_t l,
static TString *newlstr (lua_State *L, const char *str, size_t l,
unsigned int h, int readonly) {
TString *ts;
stringtable *tb;
......@@ -80,7 +80,7 @@ static TString *ICACHE_FLASH_ATTR newlstr (lua_State *L, const char *str, size_t
}
static TString *ICACHE_FLASH_ATTR luaS_newlstr_helper (lua_State *L, const char *str, size_t l, int readonly) {
static TString *luaS_newlstr_helper (lua_State *L, const char *str, size_t l, int readonly) {
GCObject *o;
unsigned int h = cast(unsigned int, l); /* seed */
size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */
......@@ -100,7 +100,7 @@ static TString *ICACHE_FLASH_ATTR luaS_newlstr_helper (lua_State *L, const char
return newlstr(L, str, l, h, readonly); /* not found */
}
static int ICACHE_FLASH_ATTR lua_is_ptr_in_ro_area(const char *p) {
static int lua_is_ptr_in_ro_area(const char *p) {
#ifdef LUA_CROSS_COMPILER
return 0;
#else
......@@ -111,7 +111,7 @@ static int ICACHE_FLASH_ATTR lua_is_ptr_in_ro_area(const char *p) {
#endif
}
TString *ICACHE_FLASH_ATTR luaS_newlstr (lua_State *L, const char *str, size_t l) {
TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
// If the pointer is in a read-only memory and the string is at least 4 chars in length,
// create it as a read-only string instead
if(lua_is_ptr_in_ro_area(str) && l+1 > sizeof(char**) && l == c_strlen(str))
......@@ -121,7 +121,7 @@ TString *ICACHE_FLASH_ATTR luaS_newlstr (lua_State *L, const char *str, size_t l
}
LUAI_FUNC TString *ICACHE_FLASH_ATTR luaS_newrolstr (lua_State *L, const char *str, size_t l) {
LUAI_FUNC TString *luaS_newrolstr (lua_State *L, const char *str, size_t l) {
if(l+1 > sizeof(char**) && l == c_strlen(str))
return luaS_newlstr_helper(L, str, l, LUAS_READONLY_STRING);
else // no point in creating a RO string, as it would actually be larger
......@@ -129,7 +129,7 @@ LUAI_FUNC TString *ICACHE_FLASH_ATTR luaS_newrolstr (lua_State *L, const char *s
}
Udata *ICACHE_FLASH_ATTR luaS_newudata (lua_State *L, size_t s, Table *e) {
Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
Udata *u;
if (s > MAX_SIZET - sizeof(Udata))
luaM_toobig(L);
......
......@@ -25,7 +25,7 @@
static int ICACHE_FLASH_ATTR str_len (lua_State *L) {
static int str_len (lua_State *L) {
size_t l;
luaL_checklstring(L, 1, &l);
lua_pushinteger(L, l);
......@@ -33,14 +33,14 @@ static int ICACHE_FLASH_ATTR str_len (lua_State *L) {
}
static ptrdiff_t ICACHE_FLASH_ATTR posrelat (ptrdiff_t pos, size_t len) {
static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) {
/* relative string position: negative means back from end */
if (pos < 0) pos += (ptrdiff_t)len + 1;
return (pos >= 0) ? pos : 0;
}
static int ICACHE_FLASH_ATTR str_sub (lua_State *L) {
static int str_sub (lua_State *L) {
size_t l;
const char *s = luaL_checklstring(L, 1, &l);
ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l);
......@@ -54,7 +54,7 @@ static int ICACHE_FLASH_ATTR str_sub (lua_State *L) {
}
static int ICACHE_FLASH_ATTR str_reverse (lua_State *L) {
static int str_reverse (lua_State *L) {
size_t l;
luaL_Buffer b;
const char *s = luaL_checklstring(L, 1, &l);
......@@ -65,7 +65,7 @@ static int ICACHE_FLASH_ATTR str_reverse (lua_State *L) {
}
static int ICACHE_FLASH_ATTR str_lower (lua_State *L) {
static int str_lower (lua_State *L) {
size_t l;
size_t i;
luaL_Buffer b;
......@@ -78,7 +78,7 @@ static int ICACHE_FLASH_ATTR str_lower (lua_State *L) {
}
static int ICACHE_FLASH_ATTR str_upper (lua_State *L) {
static int str_upper (lua_State *L) {
size_t l;
size_t i;
luaL_Buffer b;
......@@ -90,7 +90,7 @@ static int ICACHE_FLASH_ATTR str_upper (lua_State *L) {
return 1;
}
static int ICACHE_FLASH_ATTR str_rep (lua_State *L) {
static int str_rep (lua_State *L) {
size_t l;
luaL_Buffer b;
const char *s = luaL_checklstring(L, 1, &l);
......@@ -103,7 +103,7 @@ static int ICACHE_FLASH_ATTR str_rep (lua_State *L) {
}
static int ICACHE_FLASH_ATTR str_byte (lua_State *L) {
static int str_byte (lua_State *L) {
size_t l;
const char *s = luaL_checklstring(L, 1, &l);
ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l);
......@@ -122,7 +122,7 @@ static int ICACHE_FLASH_ATTR str_byte (lua_State *L) {
}
static int ICACHE_FLASH_ATTR str_char (lua_State *L) {
static int str_char (lua_State *L) {
int n = lua_gettop(L); /* number of arguments */
int i;
luaL_Buffer b;
......@@ -137,14 +137,14 @@ static int ICACHE_FLASH_ATTR str_char (lua_State *L) {
}
static int ICACHE_FLASH_ATTR writer (lua_State *L, const void* b, size_t size, void* B) {
static int writer (lua_State *L, const void* b, size_t size, void* B) {
(void)L;
luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
return 0;
}
static int ICACHE_FLASH_ATTR str_dump (lua_State *L) {
static int str_dump (lua_State *L) {
luaL_Buffer b;
luaL_checktype(L, 1, LUA_TFUNCTION);
lua_settop(L, 1);
......@@ -183,7 +183,7 @@ typedef struct MatchState {
#define SPECIALS "^$*+?.([%-"
static int ICACHE_FLASH_ATTR check_capture (MatchState *ms, int l) {
static int check_capture (MatchState *ms, int l) {
l -= '1';
if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)
return luaL_error(ms->L, "invalid capture index");
......@@ -191,7 +191,7 @@ static int ICACHE_FLASH_ATTR check_capture (MatchState *ms, int l) {
}
static int ICACHE_FLASH_ATTR capture_to_close (MatchState *ms) {
static int capture_to_close (MatchState *ms) {
int level = ms->level;
for (level--; level>=0; level--)
if (ms->capture[level].len == CAP_UNFINISHED) return level;
......@@ -199,7 +199,7 @@ static int ICACHE_FLASH_ATTR capture_to_close (MatchState *ms) {
}
static const char *ICACHE_FLASH_ATTR classend (MatchState *ms, const char *p) {
static const char *classend (MatchState *ms, const char *p) {
switch (*p++) {
case L_ESC: {
if (*p == '\0')
......@@ -223,7 +223,7 @@ static const char *ICACHE_FLASH_ATTR classend (MatchState *ms, const char *p) {
}
static int ICACHE_FLASH_ATTR match_class (int c, int cl) {
static int match_class (int c, int cl) {
int res;
switch (tolower(cl)) {
case 'a' : res = isalpha(c); break;
......@@ -242,7 +242,7 @@ static int ICACHE_FLASH_ATTR match_class (int c, int cl) {
}
static int ICACHE_FLASH_ATTR matchbracketclass (int c, const char *p, const char *ec) {
static int matchbracketclass (int c, const char *p, const char *ec) {
int sig = 1;
if (*(p+1) == '^') {
sig = 0;
......@@ -265,7 +265,7 @@ static int ICACHE_FLASH_ATTR matchbracketclass (int c, const char *p, const char
}
static int ICACHE_FLASH_ATTR singlematch (int c, const char *p, const char *ep) {
static int singlematch (int c, const char *p, const char *ep) {
switch (*p) {
case '.': return 1; /* matches any char */
case L_ESC: return match_class(c, uchar(*(p+1)));
......@@ -278,7 +278,7 @@ static int ICACHE_FLASH_ATTR singlematch (int c, const char *p, const char *ep)
static const char *match (MatchState *ms, const char *s, const char *p);
static const char *ICACHE_FLASH_ATTR matchbalance (MatchState *ms, const char *s,
static const char *matchbalance (MatchState *ms, const char *s,
const char *p) {
if (*p == 0 || *(p+1) == 0)
luaL_error(ms->L, "unbalanced pattern");
......@@ -298,7 +298,7 @@ static const char *ICACHE_FLASH_ATTR matchbalance (MatchState *ms, const char *s
}
static const char *ICACHE_FLASH_ATTR max_expand (MatchState *ms, const char *s,
static const char *max_expand (MatchState *ms, const char *s,
const char *p, const char *ep) {
ptrdiff_t i = 0; /* counts maximum expand for item */
while ((s+i)<ms->src_end && singlematch(uchar(*(s+i)), p, ep))
......@@ -313,7 +313,7 @@ static const char *ICACHE_FLASH_ATTR max_expand (MatchState *ms, const char *s,
}
static const char *ICACHE_FLASH_ATTR min_expand (MatchState *ms, const char *s,
static const char *min_expand (MatchState *ms, const char *s,
const char *p, const char *ep) {
for (;;) {
const char *res = match(ms, s, ep+1);
......@@ -326,7 +326,7 @@ static const char *ICACHE_FLASH_ATTR min_expand (MatchState *ms, const char *s,
}
static const char *ICACHE_FLASH_ATTR start_capture (MatchState *ms, const char *s,
static const char *start_capture (MatchState *ms, const char *s,
const char *p, int what) {
const char *res;
int level = ms->level;
......@@ -340,7 +340,7 @@ static const char *ICACHE_FLASH_ATTR start_capture (MatchState *ms, const char *
}
static const char *ICACHE_FLASH_ATTR end_capture (MatchState *ms, const char *s,
static const char *end_capture (MatchState *ms, const char *s,
const char *p) {
int l = capture_to_close(ms);
const char *res;
......@@ -351,7 +351,7 @@ static const char *ICACHE_FLASH_ATTR end_capture (MatchState *ms, const char *s,
}
static const char *ICACHE_FLASH_ATTR match_capture (MatchState *ms, const char *s, int l) {
static const char *match_capture (MatchState *ms, const char *s, int l) {
size_t len;
l = check_capture(ms, l);
len = ms->capture[l].len;
......@@ -362,7 +362,7 @@ static const char *ICACHE_FLASH_ATTR match_capture (MatchState *ms, const char *
}
static const char *ICACHE_FLASH_ATTR match (MatchState *ms, const char *s, const char *p) {
static const char *match (MatchState *ms, const char *s, const char *p) {
init: /* using goto's to optimize tail recursion */
switch (*p) {
case '(': { /* start capture */
......@@ -441,7 +441,7 @@ static const char *ICACHE_FLASH_ATTR match (MatchState *ms, const char *s, const
static const char *ICACHE_FLASH_ATTR lmemfind (const char *s1, size_t l1,
static const char *lmemfind (const char *s1, size_t l1,
const char *s2, size_t l2) {
if (l2 == 0) return s1; /* empty strings are everywhere */
else if (l2 > l1) return NULL; /* avoids a negative `l1' */
......@@ -463,7 +463,7 @@ static const char *ICACHE_FLASH_ATTR lmemfind (const char *s1, size_t l1,
}
static void ICACHE_FLASH_ATTR push_onecapture (MatchState *ms, int i, const char *s,
static void push_onecapture (MatchState *ms, int i, const char *s,
const char *e) {
if (i >= ms->level) {
if (i == 0) /* ms->level == 0, too */
......@@ -482,7 +482,7 @@ static void ICACHE_FLASH_ATTR push_onecapture (MatchState *ms, int i, const char
}
static int ICACHE_FLASH_ATTR push_captures (MatchState *ms, const char *s, const char *e) {
static int push_captures (MatchState *ms, const char *s, const char *e) {
int i;
int nlevels = (ms->level == 0 && s) ? 1 : ms->level;
luaL_checkstack(ms->L, nlevels, "too many captures");
......@@ -492,7 +492,7 @@ static int ICACHE_FLASH_ATTR push_captures (MatchState *ms, const char *s, const
}
static int ICACHE_FLASH_ATTR str_find_aux (lua_State *L, int find) {
static int str_find_aux (lua_State *L, int find) {
size_t l1, l2;
const char *s = luaL_checklstring(L, 1, &l1);
const char *p = luaL_checklstring(L, 2, &l2);
......@@ -535,17 +535,17 @@ static int ICACHE_FLASH_ATTR str_find_aux (lua_State *L, int find) {
}
static int ICACHE_FLASH_ATTR str_find (lua_State *L) {
static int str_find (lua_State *L) {
return str_find_aux(L, 1);
}
static int ICACHE_FLASH_ATTR str_match (lua_State *L) {
static int str_match (lua_State *L) {
return str_find_aux(L, 0);
}
static int ICACHE_FLASH_ATTR gmatch_aux (lua_State *L) {
static int gmatch_aux (lua_State *L) {
MatchState ms;
size_t ls;
const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls);
......@@ -571,7 +571,7 @@ static int ICACHE_FLASH_ATTR gmatch_aux (lua_State *L) {
}
static int ICACHE_FLASH_ATTR gmatch (lua_State *L) {
static int gmatch (lua_State *L) {
luaL_checkstring(L, 1);
luaL_checkstring(L, 2);
lua_settop(L, 2);
......@@ -581,13 +581,13 @@ static int ICACHE_FLASH_ATTR gmatch (lua_State *L) {
}
#if LUA_OPTIMIZE_MEMORY == 0 || !defined(LUA_COMPAT_GFIND)
static int ICACHE_FLASH_ATTR gfind_nodef (lua_State *L) {
static int gfind_nodef (lua_State *L) {
return luaL_error(L, LUA_QL("string.gfind") " was renamed to "
LUA_QL("string.gmatch"));
}
#endif
static void ICACHE_FLASH_ATTR add_s (MatchState *ms, luaL_Buffer *b, const char *s,
static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
const char *e) {
size_t l, i;
const char *news = lua_tolstring(ms->L, 3, &l);
......@@ -609,7 +609,7 @@ static void ICACHE_FLASH_ATTR add_s (MatchState *ms, luaL_Buffer *b, const char
}
static void ICACHE_FLASH_ATTR add_value (MatchState *ms, luaL_Buffer *b, const char *s,
static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
const char *e) {
lua_State *L = ms->L;
switch (lua_type(L, 3)) {
......@@ -642,7 +642,7 @@ static void ICACHE_FLASH_ATTR add_value (MatchState *ms, luaL_Buffer *b, const c
}
static int ICACHE_FLASH_ATTR str_gsub (lua_State *L) {
static int str_gsub (lua_State *L) {
size_t srcl;
const char *src = luaL_checklstring(L, 1, &srcl);
const char *p = luaL_checkstring(L, 2);
......@@ -696,7 +696,7 @@ static int ICACHE_FLASH_ATTR str_gsub (lua_State *L) {
#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10)
static void ICACHE_FLASH_ATTR addquoted (lua_State *L, luaL_Buffer *b, int arg) {
static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
size_t l;
const char *s = luaL_checklstring(L, arg, &l);
luaL_addchar(b, '"');
......@@ -725,7 +725,7 @@ static void ICACHE_FLASH_ATTR addquoted (lua_State *L, luaL_Buffer *b, int arg)
luaL_addchar(b, '"');
}
static const char *ICACHE_FLASH_ATTR scanformat (lua_State *L, const char *strfrmt, char *form) {
static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
const char *p = strfrmt;
while (*p != '\0' && c_strchr(FLAGS, *p) != NULL) p++; /* skip flags */
if ((size_t)(p - strfrmt) >= sizeof(FLAGS))
......@@ -747,7 +747,7 @@ static const char *ICACHE_FLASH_ATTR scanformat (lua_State *L, const char *strfr
}
static void ICACHE_FLASH_ATTR addintlen (char *form) {
static void addintlen (char *form) {
size_t l = c_strlen(form);
char spec = form[l - 1];
c_strcpy(form + l - 1, LUA_INTFRMLEN);
......@@ -756,7 +756,7 @@ static void ICACHE_FLASH_ATTR addintlen (char *form) {
}
static int ICACHE_FLASH_ATTR str_format (lua_State *L) {
static int str_format (lua_State *L) {
int top = lua_gettop(L);
int arg = 1;
size_t sfl;
......@@ -858,7 +858,7 @@ const LUA_REG_TYPE strlib[] = {
#if LUA_OPTIMIZE_MEMORY != 2
static void ICACHE_FLASH_ATTR createmetatable (lua_State *L) {
static void createmetatable (lua_State *L) {
lua_createtable(L, 0, 1); /* create metatable for strings */
lua_pushliteral(L, ""); /* dummy string */
lua_pushvalue(L, -2);
......@@ -873,7 +873,7 @@ static void ICACHE_FLASH_ATTR createmetatable (lua_State *L) {
/*
** Open string library
*/
LUALIB_API int ICACHE_FLASH_ATTR luaopen_string (lua_State *L) {
LUALIB_API int luaopen_string (lua_State *L) {
#if LUA_OPTIMIZE_MEMORY == 0
luaL_register(L, LUA_STRLIBNAME, strlib);
#if defined(LUA_COMPAT_GFIND)
......
......@@ -81,7 +81,7 @@ static const Node dummynode_ = {
/*
** hash for lua_Numbers
*/
static Node *ICACHE_FLASH_ATTR hashnum (const Table *t, lua_Number n) {
static Node *hashnum (const Table *t, lua_Number n) {
unsigned int a[numints];
int i;
if (luai_numeq(n, 0)) /* avoid problems with -0 */
......@@ -97,7 +97,7 @@ static Node *ICACHE_FLASH_ATTR hashnum (const Table *t, lua_Number n) {
** returns the `main' position of an element in a table (that is, the index
** of its hash value)
*/
static Node *ICACHE_FLASH_ATTR mainposition (const Table *t, const TValue *key) {
static Node *mainposition (const Table *t, const TValue *key) {
switch (ttype(key)) {
case LUA_TNUMBER:
return hashnum(t, nvalue(key));
......@@ -119,7 +119,7 @@ static Node *ICACHE_FLASH_ATTR mainposition (const Table *t, const TValue *key)
** returns the index for `key' if `key' is an appropriate key to live in
** the array part of the table, -1 otherwise.
*/
static int ICACHE_FLASH_ATTR arrayindex (const TValue *key) {
static int arrayindex (const TValue *key) {
if (ttisnumber(key)) {
lua_Number n = nvalue(key);
int k;
......@@ -136,7 +136,7 @@ static int ICACHE_FLASH_ATTR arrayindex (const TValue *key) {
** elements in the array part, then elements in the hash part. The
** beginning of a traversal is signalled by -1.
*/
static int ICACHE_FLASH_ATTR findindex (lua_State *L, Table *t, StkId key) {
static int findindex (lua_State *L, Table *t, StkId key) {
int i;
if (ttisnil(key)) return -1; /* first iteration */
i = arrayindex(key);
......@@ -161,7 +161,7 @@ static int ICACHE_FLASH_ATTR findindex (lua_State *L, Table *t, StkId key) {
}
int ICACHE_FLASH_ATTR luaH_next (lua_State *L, Table *t, StkId key) {
int luaH_next (lua_State *L, Table *t, StkId key) {
int i = findindex(L, t, key); /* find original element */
for (i++; i < t->sizearray; i++) { /* try first array part */
if (!ttisnil(&t->array[i])) { /* a non-nil value? */
......@@ -181,7 +181,7 @@ int ICACHE_FLASH_ATTR luaH_next (lua_State *L, Table *t, StkId key) {
}
int ICACHE_FLASH_ATTR luaH_next_ro (lua_State *L, void *t, StkId key) {
int luaH_next_ro (lua_State *L, void *t, StkId key) {
luaR_next(L, t, key, key+1);
return ttisnil(key) ? 0 : 1;
}
......@@ -194,7 +194,7 @@ int ICACHE_FLASH_ATTR luaH_next_ro (lua_State *L, void *t, StkId key) {
*/
static int ICACHE_FLASH_ATTR computesizes (int nums[], int *narray) {
static int computesizes (int nums[], int *narray) {
int i;
int twotoi; /* 2^i */
int a = 0; /* number of elements smaller than 2^i */
......@@ -216,7 +216,7 @@ static int ICACHE_FLASH_ATTR computesizes (int nums[], int *narray) {
}
static int ICACHE_FLASH_ATTR countint (const TValue *key, int *nums) {
static int countint (const TValue *key, int *nums) {
int k = arrayindex(key);
if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */
nums[ceillog2(k)]++; /* count as such */
......@@ -227,7 +227,7 @@ static int ICACHE_FLASH_ATTR countint (const TValue *key, int *nums) {
}
static int ICACHE_FLASH_ATTR numusearray (const Table *t, int *nums) {
static int numusearray (const Table *t, int *nums) {
int lg;
int ttlg; /* 2^lg */
int ause = 0; /* summation of `nums' */
......@@ -252,7 +252,7 @@ static int ICACHE_FLASH_ATTR numusearray (const Table *t, int *nums) {
}
static int ICACHE_FLASH_ATTR numusehash (const Table *t, int *nums, int *pnasize) {
static int numusehash (const Table *t, int *nums, int *pnasize) {
int totaluse = 0; /* total number of elements */
int ause = 0; /* summation of `nums' */
int i = sizenode(t);
......@@ -268,7 +268,7 @@ static int ICACHE_FLASH_ATTR numusehash (const Table *t, int *nums, int *pnasize
}
static void ICACHE_FLASH_ATTR setarrayvector (lua_State *L, Table *t, int size) {
static void setarrayvector (lua_State *L, Table *t, int size) {
int i;
luaM_reallocvector(L, t->array, t->sizearray, size, TValue);
for (i=t->sizearray; i<size; i++)
......@@ -277,7 +277,7 @@ static void ICACHE_FLASH_ATTR setarrayvector (lua_State *L, Table *t, int size)
}
static Node *ICACHE_FLASH_ATTR getfreepos (Table *t) {
static Node *getfreepos (Table *t) {
while (t->lastfree-- > t->node) {
if (ttisnil(gkey(t->lastfree)))
return t->lastfree;
......@@ -286,7 +286,7 @@ static Node *ICACHE_FLASH_ATTR getfreepos (Table *t) {
}
static void ICACHE_FLASH_ATTR resizenodevector (lua_State *L, Table *t, int oldsize, int newsize) {
static void resizenodevector (lua_State *L, Table *t, int oldsize, int newsize) {
int lsize;
if (newsize == 0) { /* no elements to hash part? */
t->node = cast(Node *, dummynode); /* use common `dummynode' */
......@@ -317,7 +317,7 @@ static void ICACHE_FLASH_ATTR resizenodevector (lua_State *L, Table *t, int olds
}
static Node *ICACHE_FLASH_ATTR find_prev_node(Node *mp, Node *next) {
static Node *find_prev_node(Node *mp, Node *next) {
Node *prev = mp;
while (prev != NULL && gnext(prev) != next) prev = gnext(prev);
return prev;
......@@ -331,7 +331,7 @@ static Node *ICACHE_FLASH_ATTR find_prev_node(Node *mp, Node *next) {
** 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.
*/
static int ICACHE_FLASH_ATTR 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));
/* if node is in it's main position, don't need to move node. */
if (mp == node) return 1;
......@@ -369,7 +369,7 @@ static int ICACHE_FLASH_ATTR move_node (lua_State *L, Table *t, Node *node) {
}
static int ICACHE_FLASH_ATTR move_number (lua_State *L, Table *t, Node *node) {
static int move_number (lua_State *L, Table *t, Node *node) {
int key;
lua_Number n = nvalue(key2tval(node));
lua_number2int(key, n);
......@@ -386,7 +386,7 @@ static int ICACHE_FLASH_ATTR move_number (lua_State *L, Table *t, Node *node) {
}
static void ICACHE_FLASH_ATTR resize_hashpart (lua_State *L, Table *t, int nhsize) {
static void resize_hashpart (lua_State *L, Table *t, int nhsize) {
int i;
int lsize=0;
int oldhsize = (t->node != dummynode) ? twoto(t->lsizenode) : 0;
......@@ -439,7 +439,7 @@ static void ICACHE_FLASH_ATTR resize_hashpart (lua_State *L, Table *t, int nhsiz
}
static void ICACHE_FLASH_ATTR resize (lua_State *L, Table *t, int nasize, int nhsize) {
static void resize (lua_State *L, Table *t, int nasize, int nhsize) {
int i;
int oldasize = t->sizearray;
if (nasize > oldasize) /* array part must grow? */
......@@ -458,13 +458,13 @@ static void ICACHE_FLASH_ATTR resize (lua_State *L, Table *t, int nasize, int nh
}
void ICACHE_FLASH_ATTR luaH_resizearray (lua_State *L, Table *t, int nasize) {
void luaH_resizearray (lua_State *L, Table *t, int nasize) {
int nsize = (t->node == dummynode) ? 0 : sizenode(t);
resize(L, t, nasize, nsize);
}
static void ICACHE_FLASH_ATTR rehash (lua_State *L, Table *t, const TValue *ek) {
static void rehash (lua_State *L, Table *t, const TValue *ek) {
int nasize, na;
int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */
int i;
......@@ -489,7 +489,7 @@ static void ICACHE_FLASH_ATTR rehash (lua_State *L, Table *t, const TValue *ek)
*/
Table *ICACHE_FLASH_ATTR luaH_new (lua_State *L, int narray, int nhash) {
Table *luaH_new (lua_State *L, int narray, int nhash) {
Table *t = luaM_new(L, Table);
luaC_link(L, obj2gco(t), LUA_TTABLE);
sethvalue2s(L, L->top, t); /* put table on stack */
......@@ -508,7 +508,7 @@ Table *ICACHE_FLASH_ATTR luaH_new (lua_State *L, int narray, int nhash) {
}
void ICACHE_FLASH_ATTR luaH_free (lua_State *L, Table *t) {
void luaH_free (lua_State *L, Table *t) {
if (t->node != dummynode)
luaM_freearray(L, t->node, sizenode(t), Node);
luaM_freearray(L, t->array, t->sizearray, TValue);
......@@ -524,7 +524,7 @@ void ICACHE_FLASH_ATTR luaH_free (lua_State *L, Table *t) {
** put new key in its main position; otherwise (colliding node is in its main
** position), new key goes to an empty position.
*/
static TValue *ICACHE_FLASH_ATTR 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);
if (!ttisnil(gval(mp)) || mp == dummynode) {
Node *othern;
......@@ -560,7 +560,7 @@ static TValue *ICACHE_FLASH_ATTR newkey (lua_State *L, Table *t, const TValue *k
/*
** search function for integers
*/
const TValue *ICACHE_FLASH_ATTR luaH_getnum (Table *t, int key) {
const TValue *luaH_getnum (Table *t, int key) {
/* (1 <= key && key <= t->sizearray) */
if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))
return &t->array[key-1];
......@@ -577,7 +577,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_getnum (Table *t, int key) {
}
/* same thing for rotables */
const TValue *ICACHE_FLASH_ATTR luaH_getnum_ro (void *t, int key) {
const TValue *luaH_getnum_ro (void *t, int key) {
const TValue *res = luaR_findentry(t, NULL, key, NULL);
return res ? res : luaO_nilobject;
}
......@@ -586,7 +586,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_getnum_ro (void *t, int key) {
/*
** search function for strings
*/
const TValue *ICACHE_FLASH_ATTR luaH_getstr (Table *t, TString *key) {
const TValue *luaH_getstr (Table *t, TString *key) {
Node *n = hashstr(t, key);
do { /* check whether `key' is somewhere in the chain */
if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key)
......@@ -597,7 +597,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_getstr (Table *t, TString *key) {
}
/* same thing for rotables */
const TValue *ICACHE_FLASH_ATTR luaH_getstr_ro (void *t, TString *key) {
const TValue *luaH_getstr_ro (void *t, TString *key) {
char keyname[LUA_MAX_ROTABLE_NAME + 1];
const TValue *res;
if (!t)
......@@ -611,7 +611,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_getstr_ro (void *t, TString *key) {
/*
** main search function
*/
const TValue *ICACHE_FLASH_ATTR luaH_get (Table *t, const TValue *key) {
const TValue *luaH_get (Table *t, const TValue *key) {
switch (ttype(key)) {
case LUA_TNIL: return luaO_nilobject;
case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));
......@@ -636,7 +636,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_get (Table *t, const TValue *key) {
}
/* same thing for rotables */
const TValue *ICACHE_FLASH_ATTR luaH_get_ro (void *t, const TValue *key) {
const TValue *luaH_get_ro (void *t, const TValue *key) {
switch (ttype(key)) {
case LUA_TNIL: return luaO_nilobject;
case LUA_TSTRING: return luaH_getstr_ro(t, rawtsvalue(key));
......@@ -655,7 +655,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_get_ro (void *t, const TValue *key) {
}
TValue *ICACHE_FLASH_ATTR luaH_set (lua_State *L, Table *t, const TValue *key) {
TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
const TValue *p = luaH_get(t, key);
t->flags = 0;
if (p != luaO_nilobject)
......@@ -669,7 +669,7 @@ TValue *ICACHE_FLASH_ATTR luaH_set (lua_State *L, Table *t, const TValue *key) {
}
TValue *ICACHE_FLASH_ATTR luaH_setnum (lua_State *L, Table *t, int key) {
TValue *luaH_setnum (lua_State *L, Table *t, int key) {
const TValue *p = luaH_getnum(t, key);
if (p != luaO_nilobject)
return cast(TValue *, p);
......@@ -681,7 +681,7 @@ TValue *ICACHE_FLASH_ATTR luaH_setnum (lua_State *L, Table *t, int key) {
}
TValue *ICACHE_FLASH_ATTR luaH_setstr (lua_State *L, Table *t, TString *key) {
TValue *luaH_setstr (lua_State *L, Table *t, TString *key) {
const TValue *p = luaH_getstr(t, key);
if (p != luaO_nilobject)
return cast(TValue *, p);
......@@ -693,7 +693,7 @@ TValue *ICACHE_FLASH_ATTR luaH_setstr (lua_State *L, Table *t, TString *key) {
}
static int ICACHE_FLASH_ATTR unbound_search (Table *t, unsigned int j) {
static int unbound_search (Table *t, unsigned int j) {
unsigned int i = j; /* i is zero or a present index */
j++;
/* find `i' and `j' such that i is present and j is not */
......@@ -721,7 +721,7 @@ static int ICACHE_FLASH_ATTR unbound_search (Table *t, unsigned int j) {
** Try to find a boundary in table `t'. A `boundary' is an integer index
** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil).
*/
int ICACHE_FLASH_ATTR luaH_getn (Table *t) {
int luaH_getn (Table *t) {
unsigned int j = t->sizearray;
if (j > 0 && ttisnil(&t->array[j - 1])) {
/* there is a boundary in the array part: (binary) search for it */
......@@ -740,7 +740,7 @@ int ICACHE_FLASH_ATTR luaH_getn (Table *t) {
}
/* same thing for rotables */
int ICACHE_FLASH_ATTR luaH_getn_ro (void *t) {
int luaH_getn_ro (void *t) {
int i = 1, len=0;
while(luaR_findentry(t, NULL, i ++, NULL))
......@@ -750,10 +750,10 @@ int ICACHE_FLASH_ATTR luaH_getn_ro (void *t) {
#if defined(LUA_DEBUG)
Node *ICACHE_FLASH_ATTR luaH_mainposition (const Table *t, const TValue *key) {
Node *luaH_mainposition (const Table *t, const TValue *key) {
return mainposition(t, key);
}
int ICACHE_FLASH_ATTR luaH_isdummy (Node *n) { return n == dummynode; }
int luaH_isdummy (Node *n) { return n == dummynode; }
#endif
......@@ -20,7 +20,7 @@
#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n))
static int ICACHE_FLASH_ATTR foreachi (lua_State *L) {
static int foreachi (lua_State *L) {
int i;
int n = aux_getn(L, 1);
luaL_checkanyfunction(L, 2);
......@@ -37,7 +37,7 @@ static int ICACHE_FLASH_ATTR foreachi (lua_State *L) {
}
static int ICACHE_FLASH_ATTR foreach (lua_State *L) {
static int foreach (lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
luaL_checkanyfunction(L, 2);
lua_pushnil(L); /* first key */
......@@ -54,7 +54,7 @@ static int ICACHE_FLASH_ATTR foreach (lua_State *L) {
}
static int ICACHE_FLASH_ATTR maxn (lua_State *L) {
static int maxn (lua_State *L) {
lua_Number max = 0;
luaL_checktype(L, 1, LUA_TTABLE);
lua_pushnil(L); /* first key */
......@@ -70,13 +70,13 @@ static int ICACHE_FLASH_ATTR maxn (lua_State *L) {
}
static int ICACHE_FLASH_ATTR getn (lua_State *L) {
static int getn (lua_State *L) {
lua_pushinteger(L, aux_getn(L, 1));
return 1;
}
static int ICACHE_FLASH_ATTR setn (lua_State *L) {
static int setn (lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
#ifndef luaL_setn
luaL_setn(L, 1, luaL_checkint(L, 2));
......@@ -88,7 +88,7 @@ static int ICACHE_FLASH_ATTR setn (lua_State *L) {
}
static int ICACHE_FLASH_ATTR tinsert (lua_State *L) {
static int tinsert (lua_State *L) {
int e = aux_getn(L, 1) + 1; /* first empty element */
int pos; /* where to insert new element */
switch (lua_gettop(L)) {
......@@ -116,7 +116,7 @@ static int ICACHE_FLASH_ATTR tinsert (lua_State *L) {
}
static int ICACHE_FLASH_ATTR tremove (lua_State *L) {
static int tremove (lua_State *L) {
int e = aux_getn(L, 1);
int pos = luaL_optint(L, 2, e);
if (!(1 <= pos && pos <= e)) /* position is outside bounds? */
......@@ -133,7 +133,7 @@ static int ICACHE_FLASH_ATTR tremove (lua_State *L) {
}
static void ICACHE_FLASH_ATTR addfield (lua_State *L, luaL_Buffer *b, int i) {
static void addfield (lua_State *L, luaL_Buffer *b, int i) {
lua_rawgeti(L, 1, i);
if (!lua_isstring(L, -1))
luaL_error(L, "invalid value (%s) at index %d in table for "
......@@ -142,7 +142,7 @@ static void ICACHE_FLASH_ATTR addfield (lua_State *L, luaL_Buffer *b, int i) {
}
static int ICACHE_FLASH_ATTR tconcat (lua_State *L) {
static int tconcat (lua_State *L) {
luaL_Buffer b;
size_t lsep;
int i, last;
......@@ -171,12 +171,12 @@ static int ICACHE_FLASH_ATTR tconcat (lua_State *L) {
*/
static void ICACHE_FLASH_ATTR set2 (lua_State *L, int i, int j) {
static void set2 (lua_State *L, int i, int j) {
lua_rawseti(L, 1, i);
lua_rawseti(L, 1, j);
}
static int ICACHE_FLASH_ATTR sort_comp (lua_State *L, int a, int b) {
static int sort_comp (lua_State *L, int a, int b) {
if (!lua_isnil(L, 2)) { /* function? */
int res;
lua_pushvalue(L, 2);
......@@ -191,7 +191,7 @@ static int ICACHE_FLASH_ATTR sort_comp (lua_State *L, int a, int b) {
return lua_lessthan(L, a, b);
}
static void ICACHE_FLASH_ATTR auxsort (lua_State *L, int l, int u) {
static void auxsort (lua_State *L, int l, int u) {
while (l < u) { /* for tail recursion */
int i, j;
/* sort elements a[l], a[(l+u)/2] and a[u] */
......@@ -254,7 +254,7 @@ static void ICACHE_FLASH_ATTR auxsort (lua_State *L, int l, int u) {
} /* repeat the routine for the larger one */
}
static int ICACHE_FLASH_ATTR sort (lua_State *L) {
static int sort (lua_State *L) {
int n = aux_getn(L, 1);
luaL_checkstack(L, 40, ""); /* assume array is smaller than 2^40 */
if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */
......@@ -282,6 +282,6 @@ const LUA_REG_TYPE tab_funcs[] = {
{LNILKEY, LNILVAL}
};
LUALIB_API int ICACHE_FLASH_ATTR luaopen_table (lua_State *L) {
LUALIB_API int luaopen_table (lua_State *L) {
LREGISTER(L, LUA_TABLIBNAME, tab_funcs);
}
......@@ -28,7 +28,7 @@ const char *const luaT_typenames[] = {
};
void ICACHE_FLASH_ATTR luaT_init (lua_State *L) {
void luaT_init (lua_State *L) {
static const char *const luaT_eventname[] = { /* ORDER TM */
"__index", "__newindex",
"__gc", "__mode", "__eq",
......@@ -48,7 +48,7 @@ void ICACHE_FLASH_ATTR luaT_init (lua_State *L) {
** function to be used with macro "fasttm": optimized for absence of
** tag methods
*/
const TValue *ICACHE_FLASH_ATTR luaT_gettm (Table *events, TMS event, TString *ename) {
const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
const TValue *tm = luaR_isrotable(events) ? luaH_getstr_ro(events, ename) : luaH_getstr(events, ename);
lua_assert(event <= TM_EQ);
if (ttisnil(tm)) { /* no tag method? */
......@@ -60,7 +60,7 @@ const TValue *ICACHE_FLASH_ATTR luaT_gettm (Table *events, TMS event, TString *e
}
const TValue *ICACHE_FLASH_ATTR luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
Table *mt;
switch (ttype(o)) {
case LUA_TTABLE:
......
......@@ -35,14 +35,14 @@ int led_high_count = LED_HIGH_COUNT_DEFAULT;
int led_low_count = LED_LOW_COUNT_DEFAULT;
static int led_count = 0;
#if 0
static void ICACHE_FLASH_ATTR lstop (lua_State *L, lua_Debug *ar) {
static void lstop (lua_State *L, lua_Debug *ar) {
(void)ar; /* unused arg. */
lua_sethook(L, NULL, 0, 0);
luaL_error(L, "interrupted!");
}
static void ICACHE_FLASH_ATTR laction (int i) {
static void laction (int i) {
// signal(i, SIG_DFL);
/* if another SIGINT happens before lstop,
terminate process (default action) */
......@@ -50,7 +50,7 @@ static void ICACHE_FLASH_ATTR laction (int i) {
}
static void ICACHE_FLASH_ATTR print_usage (void) {
static void print_usage (void) {
#if defined(LUA_USE_STDIO)
c_fprintf(c_stderr,
#else
......@@ -73,7 +73,7 @@ static void ICACHE_FLASH_ATTR print_usage (void) {
}
#endif
static void ICACHE_FLASH_ATTR l_message (const char *pname, const char *msg) {
static void l_message (const char *pname, const char *msg) {
#if defined(LUA_USE_STDIO)
if (pname) c_fprintf(c_stderr, "%s: ", pname);
c_fprintf(c_stderr, "%s\n", msg);
......@@ -85,7 +85,7 @@ static void ICACHE_FLASH_ATTR l_message (const char *pname, const char *msg) {
}
static int ICACHE_FLASH_ATTR report (lua_State *L, int status) {
static int report (lua_State *L, int status) {
if (status && !lua_isnil(L, -1)) {
const char *msg = lua_tostring(L, -1);
if (msg == NULL) msg = "(error object is not a string)";
......@@ -96,7 +96,7 @@ static int ICACHE_FLASH_ATTR report (lua_State *L, int status) {
}
static int ICACHE_FLASH_ATTR traceback (lua_State *L) {
static int traceback (lua_State *L) {
if (!lua_isstring(L, 1)) /* 'message' not a string? */
return 1; /* keep it intact */
lua_getfield(L, LUA_GLOBALSINDEX, "debug");
......@@ -116,7 +116,7 @@ static int ICACHE_FLASH_ATTR traceback (lua_State *L) {
}
static int ICACHE_FLASH_ATTR docall (lua_State *L, int narg, int clear) {
static int docall (lua_State *L, int narg, int clear) {
int status;
int base = lua_gettop(L) - narg; /* function index */
lua_pushcfunction(L, traceback); /* push traceback function */
......@@ -131,13 +131,13 @@ static int ICACHE_FLASH_ATTR docall (lua_State *L, int narg, int clear) {
}
static void ICACHE_FLASH_ATTR print_version (void) {
static void print_version (void) {
// l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT);
l_message(NULL, NODE_VERSION " " BUILD_DATE " powered by " LUA_RELEASE);
}
static int ICACHE_FLASH_ATTR getargs (lua_State *L, char **argv, int n) {
static int getargs (lua_State *L, char **argv, int n) {
int narg;
int i;
int argc = 0;
......@@ -155,30 +155,30 @@ static int ICACHE_FLASH_ATTR getargs (lua_State *L, char **argv, int n) {
}
#if 0
static int ICACHE_FLASH_ATTR dofile (lua_State *L, const char *name) {
static int dofile (lua_State *L, const char *name) {
int status = luaL_loadfile(L, name) || docall(L, 0, 1);
return report(L, status);
}
#else
static int ICACHE_FLASH_ATTR dofsfile (lua_State *L, const char *name) {
static int dofsfile (lua_State *L, const char *name) {
int status = luaL_loadfsfile(L, name) || docall(L, 0, 1);
return report(L, status);
}
#endif
static int ICACHE_FLASH_ATTR dostring (lua_State *L, const char *s, const char *name) {
static int dostring (lua_State *L, const char *s, const char *name) {
int status = luaL_loadbuffer(L, s, c_strlen(s), name) || docall(L, 0, 1);
return report(L, status);
}
static int ICACHE_FLASH_ATTR dolibrary (lua_State *L, const char *name) {
static int dolibrary (lua_State *L, const char *name) {
lua_getglobal(L, "require");
lua_pushstring(L, name);
return report(L, docall(L, 1, 1));
}
static const char *ICACHE_FLASH_ATTR get_prompt (lua_State *L, int firstline) {
static const char *get_prompt (lua_State *L, int firstline) {
const char *p;
lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2");
p = lua_tostring(L, -1);
......@@ -188,7 +188,7 @@ static const char *ICACHE_FLASH_ATTR get_prompt (lua_State *L, int firstline) {
}
static int ICACHE_FLASH_ATTR incomplete (lua_State *L, int status) {
static int incomplete (lua_State *L, int status) {
if (status == LUA_ERRSYNTAX) {
size_t lmsg;
const char *msg = lua_tolstring(L, -1, &lmsg);
......@@ -202,7 +202,7 @@ static int ICACHE_FLASH_ATTR incomplete (lua_State *L, int status) {
}
#if 0
static int ICACHE_FLASH_ATTR pushline (lua_State *L, int firstline) {
static int pushline (lua_State *L, int firstline) {
char buffer[LUA_MAXINPUT];
char *b = buffer;
size_t l;
......@@ -221,7 +221,7 @@ static int ICACHE_FLASH_ATTR pushline (lua_State *L, int firstline) {
}
static int ICACHE_FLASH_ATTR loadline (lua_State *L) {
static int loadline (lua_State *L) {
int status;
lua_settop(L, 0);
if (!pushline(L, 1))
......@@ -241,7 +241,7 @@ static int ICACHE_FLASH_ATTR loadline (lua_State *L) {
}
static void ICACHE_FLASH_ATTR dotty (lua_State *L) {
static void dotty (lua_State *L) {
int status;
const char *oldprogname = progname;
progname = NULL;
......@@ -270,7 +270,7 @@ static void ICACHE_FLASH_ATTR dotty (lua_State *L) {
}
static int ICACHE_FLASH_ATTR handle_script (lua_State *L, char **argv, int n) {
static int handle_script (lua_State *L, char **argv, int n) {
int status;
const char *fname;
int narg = getargs(L, argv, n); /* collect arguments */
......@@ -292,7 +292,7 @@ static int ICACHE_FLASH_ATTR handle_script (lua_State *L, char **argv, int n) {
#define notail(x) {if ((x)[2] != '\0') return -1;}
static int ICACHE_FLASH_ATTR collectargs (char **argv, int *pi, int *pv, int *pe) {
static int collectargs (char **argv, int *pi, int *pv, int *pe) {
int i;
for (i = 1; argv[i] != NULL; i++) {
if (argv[i][0] != '-') /* not an option? */
......@@ -326,7 +326,7 @@ static int ICACHE_FLASH_ATTR collectargs (char **argv, int *pi, int *pv, int *pe
}
static int ICACHE_FLASH_ATTR runargs (lua_State *L, char **argv, int n) {
static int runargs (lua_State *L, char **argv, int n) {
int i;
for (i = 1; i < n; i++) {
if (argv[i] == NULL) continue;
......@@ -364,7 +364,7 @@ static int ICACHE_FLASH_ATTR runargs (lua_State *L, char **argv, int n) {
}
static int ICACHE_FLASH_ATTR handle_luainit (lua_State *L) {
static int handle_luainit (lua_State *L) {
const char *init = c_getenv(LUA_INIT);
if (init == NULL) return 0; /* status OK */
else if (init[0] == '@')
......@@ -385,7 +385,7 @@ struct Smain {
};
static int ICACHE_FLASH_ATTR pmain (lua_State *L) {
static int pmain (lua_State *L) {
struct Smain *s = (struct Smain *)lua_touserdata(L, 1);
char **argv = s->argv;
int script;
......@@ -433,9 +433,9 @@ void readline(lua_Load *load);
char line_buffer[LUA_MAXINPUT];
#ifdef LUA_RPC
int ICACHE_FLASH_ATTR main (int argc, char **argv) {
int main (int argc, char **argv) {
#else
int ICACHE_FLASH_ATTR lua_main (int argc, char **argv) {
int lua_main (int argc, char **argv) {
#endif
int status;
struct Smain s;
......@@ -469,7 +469,7 @@ int ICACHE_FLASH_ATTR lua_main (int argc, char **argv) {
return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
}
void ICACHE_FLASH_ATTR donejob(lua_Load *load){
void donejob(lua_Load *load){
lua_close(load->L);
}
......@@ -478,7 +478,7 @@ int log_fd = -1;
int noparse = 0;
#endif
void ICACHE_FLASH_ATTR dojob(lua_Load *load){
void dojob(lua_Load *load){
size_t l, rs;
int status;
char *b = load->line;
......@@ -545,7 +545,7 @@ extern void key_long_press(void *arg);
extern void key_short_press(void *arg);
static bool key_short_pressed = false;
static bool key_long_pressed = false;
void ICACHE_FLASH_ATTR update_key_led(){
void update_key_led(){
uint8_t temp = 1, level = 1;
led_count++;
if(led_count>led_low_count+led_high_count){
......@@ -588,7 +588,7 @@ extern bool uart0_echo;
extern bool run_input;
extern uint16_t need_len;
extern int16_t end_char;
void ICACHE_FLASH_ATTR readline(lua_Load *load){
void readline(lua_Load *load){
// NODE_DBG("readline() is called.\n");
update_key_led();
char ch;
......
......@@ -37,7 +37,7 @@ typedef struct {
#else
#define IF(c,s) if (c) error(S,s)
static void ICACHE_FLASH_ATTR error(LoadState* S, const char* why)
static void error(LoadState* S, const char* why)
{
luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why);
luaD_throw(S->L,LUA_ERRSYNTAX);
......@@ -48,14 +48,14 @@ static void ICACHE_FLASH_ATTR error(LoadState* S, const char* why)
#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x))
#define LoadVector(S,b,n,size) LoadMem(S,b,n,size)
static void ICACHE_FLASH_ATTR LoadBlock(LoadState* S, void* b, size_t size)
static void LoadBlock(LoadState* S, void* b, size_t size)
{
size_t r=luaZ_read(S->Z,b,size);
IF (r!=0, "unexpected end");
S->total+=size;
}
static void ICACHE_FLASH_ATTR LoadMem (LoadState* S, void* b, int n, size_t size)
static void LoadMem (LoadState* S, void* b, int n, size_t size)
{
LoadBlock(S,b,n*size);
if (S->swap && b)
......@@ -98,20 +98,20 @@ static void ICACHE_FLASH_ATTR LoadMem (LoadState* S, void* b, int n, size_t size
}
}
static int ICACHE_FLASH_ATTR LoadChar(LoadState* S)
static int LoadChar(LoadState* S)
{
char x;
LoadVar(S,x);
return x;
}
static void ICACHE_FLASH_ATTR Align4(LoadState* S)
static void Align4(LoadState* S)
{
while(S->total&3)
LoadChar(S);
}
static int ICACHE_FLASH_ATTR LoadInt(LoadState* S)
static int LoadInt(LoadState* S)
{
int x;
LoadVar(S,x);
......@@ -119,7 +119,7 @@ static int ICACHE_FLASH_ATTR LoadInt(LoadState* S)
return x;
}
static lua_Number ICACHE_FLASH_ATTR LoadNumber(LoadState* S)
static lua_Number LoadNumber(LoadState* S)
{
lua_Number x;
if(S->toflt)
......@@ -158,7 +158,7 @@ static lua_Number ICACHE_FLASH_ATTR LoadNumber(LoadState* S)
return x;
}
static TString* ICACHE_FLASH_ATTR LoadString(LoadState* S)
static TString* LoadString(LoadState* S)
{
int32_t size;
LoadVar(S,size);
......@@ -179,7 +179,7 @@ static TString* ICACHE_FLASH_ATTR LoadString(LoadState* S)
}
}
static void ICACHE_FLASH_ATTR LoadCode(LoadState* S, Proto* f)
static void LoadCode(LoadState* S, Proto* f)
{
int n=LoadInt(S);
Align4(S);
......@@ -195,7 +195,7 @@ static void ICACHE_FLASH_ATTR LoadCode(LoadState* S, Proto* f)
static Proto* LoadFunction(LoadState* S, TString* p);
static void ICACHE_FLASH_ATTR LoadConstants(LoadState* S, Proto* f)
static void LoadConstants(LoadState* S, Proto* f)
{
int i,n;
n=LoadInt(S);
......@@ -232,7 +232,7 @@ static void ICACHE_FLASH_ATTR LoadConstants(LoadState* S, Proto* f)
for (i=0; i<n; i++) f->p[i]=LoadFunction(S,f->source);
}
static void ICACHE_FLASH_ATTR LoadDebug(LoadState* S, Proto* f)
static void LoadDebug(LoadState* S, Proto* f)
{
int i,n;
n=LoadInt(S);
......@@ -262,7 +262,7 @@ static void ICACHE_FLASH_ATTR LoadDebug(LoadState* S, Proto* f)
for (i=0; i<n; i++) f->upvalues[i]=LoadString(S);
}
static Proto* ICACHE_FLASH_ATTR LoadFunction(LoadState* S, TString* p)
static Proto* LoadFunction(LoadState* S, TString* p)
{
Proto* f;
if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep");
......@@ -285,7 +285,7 @@ static Proto* ICACHE_FLASH_ATTR LoadFunction(LoadState* S, TString* p)
return f;
}
static void ICACHE_FLASH_ATTR LoadHeader(LoadState* S)
static void LoadHeader(LoadState* S)
{
char h[LUAC_HEADERSIZE];
char s[LUAC_HEADERSIZE];
......@@ -302,7 +302,7 @@ static void ICACHE_FLASH_ATTR LoadHeader(LoadState* S)
/*
** load precompiled chunk
*/
Proto* ICACHE_FLASH_ATTR luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)
Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)
{
LoadState S;
if (*name=='@' || *name=='=')
......@@ -322,7 +322,7 @@ Proto* ICACHE_FLASH_ATTR luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const
/*
* make header
*/
void ICACHE_FLASH_ATTR luaU_header (char* h)
void luaU_header (char* h)
{
int x=1;
c_memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1);
......
......@@ -32,7 +32,7 @@
#define MAXTAGLOOP 100
#if defined LUA_NUMBER_INTEGRAL
LUA_NUMBER ICACHE_FLASH_ATTR luai_ipow(LUA_NUMBER a, LUA_NUMBER b) {
LUA_NUMBER luai_ipow(LUA_NUMBER a, LUA_NUMBER b) {
if (b < 0)
return 0;
else if (b == 0)
......@@ -51,7 +51,7 @@ LUA_NUMBER ICACHE_FLASH_ATTR luai_ipow(LUA_NUMBER a, LUA_NUMBER b) {
}
#endif
const TValue *ICACHE_FLASH_ATTR luaV_tonumber (const TValue *obj, TValue *n) {
const TValue *luaV_tonumber (const TValue *obj, TValue *n) {
lua_Number num;
if (ttisnumber(obj)) return obj;
if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) {
......@@ -63,7 +63,7 @@ const TValue *ICACHE_FLASH_ATTR luaV_tonumber (const TValue *obj, TValue *n) {
}
int ICACHE_FLASH_ATTR luaV_tostring (lua_State *L, StkId obj) {
int luaV_tostring (lua_State *L, StkId obj) {
if (!ttisnumber(obj))
return 0;
else {
......@@ -77,7 +77,7 @@ int ICACHE_FLASH_ATTR luaV_tostring (lua_State *L, StkId obj) {
}
static void ICACHE_FLASH_ATTR traceexec (lua_State *L, const Instruction *pc) {
static void traceexec (lua_State *L, const Instruction *pc) {
lu_byte mask = L->hookmask;
const Instruction *oldpc = L->savedpc;
L->savedpc = pc;
......@@ -97,7 +97,7 @@ static void ICACHE_FLASH_ATTR traceexec (lua_State *L, const Instruction *pc) {
}
static void ICACHE_FLASH_ATTR callTMres (lua_State *L, StkId res, const TValue *f,
static void callTMres (lua_State *L, StkId res, const TValue *f,
const TValue *p1, const TValue *p2) {
ptrdiff_t result = savestack(L, res);
setobj2s(L, L->top, f); /* push function */
......@@ -113,7 +113,7 @@ static void ICACHE_FLASH_ATTR callTMres (lua_State *L, StkId res, const TValue *
static void ICACHE_FLASH_ATTR callTM (lua_State *L, const TValue *f, const TValue *p1,
static void callTM (lua_State *L, const TValue *f, const TValue *p1,
const TValue *p2, const TValue *p3) {
setobj2s(L, L->top, f); /* push function */
setobj2s(L, L->top+1, p1); /* 1st argument */
......@@ -125,7 +125,7 @@ static void ICACHE_FLASH_ATTR callTM (lua_State *L, const TValue *f, const TValu
}
void ICACHE_FLASH_ATTR luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
int loop;
TValue temp;
for (loop = 0; loop < MAXTAGLOOP; loop++) {
......@@ -154,7 +154,7 @@ void ICACHE_FLASH_ATTR luaV_gettable (lua_State *L, const TValue *t, TValue *key
}
void ICACHE_FLASH_ATTR luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
int loop;
TValue temp;
setnilvalue(L->top);
......@@ -195,7 +195,7 @@ void ICACHE_FLASH_ATTR luaV_settable (lua_State *L, const TValue *t, TValue *key
}
static int ICACHE_FLASH_ATTR call_binTM (lua_State *L, const TValue *p1, const TValue *p2,
static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2,
StkId res, TMS event) {
const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */
if (ttisnil(tm))
......@@ -206,7 +206,7 @@ static int ICACHE_FLASH_ATTR call_binTM (lua_State *L, const TValue *p1, const T
}
static const TValue *ICACHE_FLASH_ATTR get_compTM (lua_State *L, Table *mt1, Table *mt2,
static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2,
TMS event) {
const TValue *tm1 = fasttm(L, mt1, event);
const TValue *tm2;
......@@ -220,7 +220,7 @@ static const TValue *ICACHE_FLASH_ATTR get_compTM (lua_State *L, Table *mt1, Tab
}
static int ICACHE_FLASH_ATTR call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,
static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,
TMS event) {
const TValue *tm1 = luaT_gettmbyobj(L, p1, event);
const TValue *tm2;
......@@ -233,7 +233,7 @@ static int ICACHE_FLASH_ATTR call_orderTM (lua_State *L, const TValue *p1, const
}
static int ICACHE_FLASH_ATTR l_strcmp (const TString *ls, const TString *rs) {
static int l_strcmp (const TString *ls, const TString *rs) {
const char *l = getstr(ls);
size_t ll = ls->tsv.len;
const char *r = getstr(rs);
......@@ -255,7 +255,7 @@ static int ICACHE_FLASH_ATTR l_strcmp (const TString *ls, const TString *rs) {
}
int ICACHE_FLASH_ATTR luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
int res;
if (ttype(l) != ttype(r))
return luaG_ordererror(L, l, r);
......@@ -269,7 +269,7 @@ int ICACHE_FLASH_ATTR luaV_lessthan (lua_State *L, const TValue *l, const TValue
}
static int ICACHE_FLASH_ATTR lessequal (lua_State *L, const TValue *l, const TValue *r) {
static int lessequal (lua_State *L, const TValue *l, const TValue *r) {
int res;
if (ttype(l) != ttype(r))
return luaG_ordererror(L, l, r);
......@@ -285,7 +285,7 @@ static int ICACHE_FLASH_ATTR lessequal (lua_State *L, const TValue *l, const TVa
}
int ICACHE_FLASH_ATTR luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
const TValue *tm;
lua_assert(ttype(t1) == ttype(t2));
switch (ttype(t1)) {
......@@ -315,7 +315,7 @@ int ICACHE_FLASH_ATTR luaV_equalval (lua_State *L, const TValue *t1, const TValu
}
void ICACHE_FLASH_ATTR luaV_concat (lua_State *L, int total, int last) {
void luaV_concat (lua_State *L, int total, int last) {
lu_mem max_sizet = MAX_SIZET;
if (G(L)->memlimit < max_sizet) max_sizet = G(L)->memlimit;
do {
......@@ -359,7 +359,7 @@ void ICACHE_FLASH_ATTR luaV_concat (lua_State *L, int total, int last) {
}
static void ICACHE_FLASH_ATTR Arith (lua_State *L, StkId ra, const TValue *rb,
static void Arith (lua_State *L, StkId ra, const TValue *rb,
const TValue *rc, TMS op) {
TValue tempb, tempc;
const TValue *b, *c;
......@@ -424,7 +424,7 @@ static void ICACHE_FLASH_ATTR Arith (lua_State *L, StkId ra, const TValue *rb,
void ICACHE_FLASH_ATTR luaV_execute (lua_State *L, int nexeccalls) {
void luaV_execute (lua_State *L, int nexeccalls) {
LClosure *cl;
StkId base;
TValue *k;
......
......@@ -18,7 +18,7 @@
#include "lzio.h"
int ICACHE_FLASH_ATTR luaZ_fill (ZIO *z) {
int luaZ_fill (ZIO *z) {
size_t size;
lua_State *L = z->L;
const char *buff;
......@@ -32,7 +32,7 @@ int ICACHE_FLASH_ATTR luaZ_fill (ZIO *z) {
}
int ICACHE_FLASH_ATTR luaZ_lookahead (ZIO *z) {
int luaZ_lookahead (ZIO *z) {
if (z->n == 0) {
if (luaZ_fill(z) == EOZ)
return EOZ;
......@@ -45,7 +45,7 @@ int ICACHE_FLASH_ATTR luaZ_lookahead (ZIO *z) {
}
void ICACHE_FLASH_ATTR luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) {
void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) {
z->L = L;
z->reader = reader;
z->data = data;
......@@ -55,7 +55,7 @@ void ICACHE_FLASH_ATTR luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void
/* --------------------------------------------------------------- read --- */
size_t ICACHE_FLASH_ATTR luaZ_read (ZIO *z, void *b, size_t n) {
size_t luaZ_read (ZIO *z, void *b, size_t n) {
while (n) {
size_t m;
if (luaZ_lookahead(z) == EOZ)
......@@ -74,7 +74,7 @@ size_t ICACHE_FLASH_ATTR luaZ_read (ZIO *z, void *b, size_t n) {
}
/* ------------------------------------------------------------------------ */
char *ICACHE_FLASH_ATTR luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) {
char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) {
if (n > buff->buffsize) {
if (n < LUA_MINBUFFER) n = LUA_MINBUFFER;
luaZ_resizebuffer(L, buff, n);
......
......@@ -20,13 +20,13 @@
static int ICACHE_FLASH_ATTR db_getregistry (lua_State *L) {
static int db_getregistry (lua_State *L) {
lua_pushvalue(L, LUA_REGISTRYINDEX);
return 1;
}
static int ICACHE_FLASH_ATTR db_getmetatable (lua_State *L) {
static int db_getmetatable (lua_State *L) {
luaL_checkany(L, 1);
if (!lua_getmetatable(L, 1)) {
lua_pushnil(L); /* no metatable */
......@@ -35,7 +35,7 @@ static int ICACHE_FLASH_ATTR db_getmetatable (lua_State *L) {
}
static int ICACHE_FLASH_ATTR db_setmetatable (lua_State *L) {
static int db_setmetatable (lua_State *L) {
int t = lua_type(L, 2);
luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
"nil or table expected");
......@@ -45,14 +45,14 @@ static int ICACHE_FLASH_ATTR db_setmetatable (lua_State *L) {
}
static int ICACHE_FLASH_ATTR db_getfenv (lua_State *L) {
static int db_getfenv (lua_State *L) {
luaL_checkany(L, 1);
lua_getfenv(L, 1);
return 1;
}
static int ICACHE_FLASH_ATTR db_setfenv (lua_State *L) {
static int db_setfenv (lua_State *L) {
luaL_checktype(L, 2, LUA_TTABLE);
lua_settop(L, 2);
if (lua_setfenv(L, 1) == 0)
......@@ -62,19 +62,19 @@ static int ICACHE_FLASH_ATTR db_setfenv (lua_State *L) {
}
static void ICACHE_FLASH_ATTR settabss (lua_State *L, const char *i, const char *v) {
static void settabss (lua_State *L, const char *i, const char *v) {
lua_pushstring(L, v);
lua_setfield(L, -2, i);
}
static void ICACHE_FLASH_ATTR settabsi (lua_State *L, const char *i, int v) {
static void settabsi (lua_State *L, const char *i, int v) {
lua_pushinteger(L, v);
lua_setfield(L, -2, i);
}
static lua_State *ICACHE_FLASH_ATTR getthread (lua_State *L, int *arg) {
static lua_State *getthread (lua_State *L, int *arg) {
if (lua_isthread(L, 1)) {
*arg = 1;
return lua_tothread(L, 1);
......@@ -86,7 +86,7 @@ static lua_State *ICACHE_FLASH_ATTR getthread (lua_State *L, int *arg) {
}
static void ICACHE_FLASH_ATTR treatstackoption (lua_State *L, lua_State *L1, const char *fname) {
static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) {
if (L == L1) {
lua_pushvalue(L, -2);
lua_remove(L, -3);
......@@ -97,7 +97,7 @@ static void ICACHE_FLASH_ATTR treatstackoption (lua_State *L, lua_State *L1, con
}
static int ICACHE_FLASH_ATTR db_getinfo (lua_State *L) {
static int db_getinfo (lua_State *L) {
lua_Debug ar;
int arg;
lua_State *L1 = getthread(L, &arg);
......@@ -142,7 +142,7 @@ static int ICACHE_FLASH_ATTR db_getinfo (lua_State *L) {
}
static int ICACHE_FLASH_ATTR db_getlocal (lua_State *L) {
static int db_getlocal (lua_State *L) {
int arg;
lua_State *L1 = getthread(L, &arg);
lua_Debug ar;
......@@ -163,7 +163,7 @@ static int ICACHE_FLASH_ATTR db_getlocal (lua_State *L) {
}
static int ICACHE_FLASH_ATTR db_setlocal (lua_State *L) {
static int db_setlocal (lua_State *L) {
int arg;
lua_State *L1 = getthread(L, &arg);
lua_Debug ar;
......@@ -177,7 +177,7 @@ static int ICACHE_FLASH_ATTR db_setlocal (lua_State *L) {
}
static int ICACHE_FLASH_ATTR auxupvalue (lua_State *L, int get) {
static int auxupvalue (lua_State *L, int get) {
const char *name;
int n = luaL_checkint(L, 2);
luaL_checktype(L, 1, LUA_TFUNCTION);
......@@ -190,12 +190,12 @@ static int ICACHE_FLASH_ATTR auxupvalue (lua_State *L, int get) {
}
static int ICACHE_FLASH_ATTR db_getupvalue (lua_State *L) {
static int db_getupvalue (lua_State *L) {
return auxupvalue(L, 1);
}
static int ICACHE_FLASH_ATTR db_setupvalue (lua_State *L) {
static int db_setupvalue (lua_State *L) {
luaL_checkany(L, 3);
return auxupvalue(L, 0);
}
......@@ -205,7 +205,7 @@ static int ICACHE_FLASH_ATTR db_setupvalue (lua_State *L) {
static const char KEY_HOOK = 'h';
static void ICACHE_FLASH_ATTR hookf (lua_State *L, lua_Debug *ar) {
static void hookf (lua_State *L, lua_Debug *ar) {
static const char *const hooknames[] =
{"call", "return", "line", "count", "tail return"};
lua_pushlightuserdata(L, (void *)&KEY_HOOK);
......@@ -223,7 +223,7 @@ static void ICACHE_FLASH_ATTR hookf (lua_State *L, lua_Debug *ar) {
}
static int ICACHE_FLASH_ATTR makemask (const char *smask, int count) {
static int makemask (const char *smask, int count) {
int mask = 0;
if (c_strchr(smask, 'c')) mask |= LUA_MASKCALL;
if (c_strchr(smask, 'r')) mask |= LUA_MASKRET;
......@@ -233,7 +233,7 @@ static int ICACHE_FLASH_ATTR makemask (const char *smask, int count) {
}
static char *ICACHE_FLASH_ATTR unmakemask (int mask, char *smask) {
static char *unmakemask (int mask, char *smask) {
int i = 0;
if (mask & LUA_MASKCALL) smask[i++] = 'c';
if (mask & LUA_MASKRET) smask[i++] = 'r';
......@@ -243,7 +243,7 @@ static char *ICACHE_FLASH_ATTR unmakemask (int mask, char *smask) {
}
static void ICACHE_FLASH_ATTR gethooktable (lua_State *L) {
static void gethooktable (lua_State *L) {
lua_pushlightuserdata(L, (void *)&KEY_HOOK);
lua_rawget(L, LUA_REGISTRYINDEX);
if (!lua_istable(L, -1)) {
......@@ -256,7 +256,7 @@ static void ICACHE_FLASH_ATTR gethooktable (lua_State *L) {
}
static int ICACHE_FLASH_ATTR db_sethook (lua_State *L) {
static int db_sethook (lua_State *L) {
int arg, mask, count;
lua_Hook func;
lua_State *L1 = getthread(L, &arg);
......@@ -280,7 +280,7 @@ static int ICACHE_FLASH_ATTR db_sethook (lua_State *L) {
}
static int ICACHE_FLASH_ATTR db_gethook (lua_State *L) {
static int db_gethook (lua_State *L) {
int arg;
lua_State *L1 = getthread(L, &arg);
char buff[5];
......@@ -300,7 +300,7 @@ static int ICACHE_FLASH_ATTR db_gethook (lua_State *L) {
}
static int ICACHE_FLASH_ATTR db_debug (lua_State *L) {
static int db_debug (lua_State *L) {
for (;;) {
char buffer[LUA_MAXINPUT];
#if defined(LUA_USE_STDIO)
......@@ -329,7 +329,7 @@ static int ICACHE_FLASH_ATTR db_debug (lua_State *L) {
#define LEVELS1 12 /* size of the first part of the stack */
#define LEVELS2 10 /* size of the second part of the stack */
static int ICACHE_FLASH_ATTR db_errorfb (lua_State *L) {
static int db_errorfb (lua_State *L) {
int level;
int firstpart = 1; /* still before eventual `...' */
int arg;
......@@ -401,6 +401,6 @@ const LUA_REG_TYPE dblib[] = {
{LNILKEY, LNILVAL}
};
LUALIB_API int ICACHE_FLASH_ATTR luaopen_debug (lua_State *L) {
LUALIB_API int luaopen_debug (lua_State *L) {
LREGISTER(L, LUA_DBLIBNAME, dblib);
}
......@@ -10,7 +10,7 @@
#include "c_types.h"
// Lua: read(id) , return system adc
static int ICACHE_FLASH_ATTR adc_sample( lua_State* L )
static int adc_sample( lua_State* L )
{
unsigned id = luaL_checkinteger( L, 1 );
MOD_CHECK_ID( adc, id );
......@@ -31,7 +31,7 @@ const LUA_REG_TYPE adc_map[] =
{ LNILKEY, LNILVAL }
};
LUALIB_API int ICACHE_FLASH_ATTR luaopen_adc( lua_State *L )
LUALIB_API int luaopen_adc( lua_State *L )
{
#if LUA_OPTIMIZE_MEMORY > 0
return 0;
......
......@@ -34,13 +34,13 @@ typedef size_t lua_UInteger;
*/
#define MONADIC(name, op) \
static int ICACHE_FLASH_ATTR bit_ ## name(lua_State *L) { \
static int bit_ ## name(lua_State *L) { \
lua_pushinteger(L, op TOBIT(L, 1)); \
return 1; \
}
#define VARIADIC(name, op) \
static int ICACHE_FLASH_ATTR bit_ ## name(lua_State *L) { \
static int bit_ ## name(lua_State *L) { \
int n = lua_gettop(L), i; \
lua_Integer w = TOBIT(L, 1); \
for (i = 2; i <= n; i++) \
......@@ -50,14 +50,14 @@ typedef size_t lua_UInteger;
}
#define LOGICAL_SHIFT(name, op) \
static int ICACHE_FLASH_ATTR bit_ ## name(lua_State *L) { \
static int bit_ ## name(lua_State *L) { \
lua_pushinteger(L, (lua_UInteger)TOBIT(L, 1) op \
(unsigned)luaL_checknumber(L, 2)); \
return 1; \
}
#define ARITHMETIC_SHIFT(name, op) \
static int ICACHE_FLASH_ATTR bit_ ## name(lua_State *L) { \
static int bit_ ## name(lua_State *L) { \
lua_pushinteger(L, (lua_Integer)TOBIT(L, 1) op \
(unsigned)luaL_checknumber(L, 2)); \
return 1; \
......@@ -72,14 +72,14 @@ LOGICAL_SHIFT(rshift, >>)
ARITHMETIC_SHIFT(arshift, >>)
// Lua: res = bit( position )
static int ICACHE_FLASH_ATTR bit_bit( lua_State* L )
static int bit_bit( lua_State* L )
{
lua_pushinteger( L, ( lua_Integer )( 1 << luaL_checkinteger( L, 1 ) ) );
return 1;
}
// Lua: res = isset( value, position )
static int ICACHE_FLASH_ATTR bit_isset( lua_State* L )
static int bit_isset( lua_State* L )
{
lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 );
unsigned pos = ( unsigned )luaL_checkinteger( L, 2 );
......@@ -89,7 +89,7 @@ static int ICACHE_FLASH_ATTR bit_isset( lua_State* L )
}
// Lua: res = isclear( value, position )
static int ICACHE_FLASH_ATTR bit_isclear( lua_State* L )
static int bit_isclear( lua_State* L )
{
lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 );
unsigned pos = ( unsigned )luaL_checkinteger( L, 2 );
......@@ -99,7 +99,7 @@ static int ICACHE_FLASH_ATTR bit_isclear( lua_State* L )
}
// Lua: res = set( value, pos1, pos2, ... )
static int ICACHE_FLASH_ATTR bit_set( lua_State* L )
static int bit_set( lua_State* L )
{
lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 );
unsigned total = lua_gettop( L ), i;
......@@ -111,7 +111,7 @@ static int ICACHE_FLASH_ATTR bit_set( lua_State* L )
}
// Lua: res = clear( value, pos1, pos2, ... )
static int ICACHE_FLASH_ATTR bit_clear( lua_State* L )
static int bit_clear( lua_State* L )
{
lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 );
unsigned total = lua_gettop( L ), i;
......@@ -140,6 +140,6 @@ const LUA_REG_TYPE bit_map[] = {
{ LNILKEY, LNILVAL}
};
LUALIB_API int ICACHE_FLASH_ATTR luaopen_bit (lua_State *L) {
LUALIB_API int luaopen_bit (lua_State *L) {
LREGISTER( L, "bit", bit_map );
}
......@@ -14,7 +14,7 @@
static int file_fd = FS_OPEN_OK - 1;
// Lua: open(filename, mode)
static int ICACHE_FLASH_ATTR file_open( lua_State* L )
static int file_open( lua_State* L )
{
size_t len;
if((FS_OPEN_OK - 1)!=file_fd){
......@@ -39,7 +39,7 @@ static int ICACHE_FLASH_ATTR file_open( lua_State* L )
}
// Lua: close()
static int ICACHE_FLASH_ATTR file_close( lua_State* L )
static int file_close( lua_State* L )
{
if((FS_OPEN_OK - 1)!=file_fd){
fs_close(file_fd);
......@@ -50,7 +50,7 @@ static int ICACHE_FLASH_ATTR file_close( lua_State* L )
#if defined(BUILD_WOFS)
// Lua: list()
static int ICACHE_FLASH_ATTR file_list( lua_State* L )
static int file_list( lua_State* L )
{
uint32_t start = 0;
size_t act_len = 0;
......@@ -64,7 +64,7 @@ static int ICACHE_FLASH_ATTR file_list( lua_State* L )
}
// Lua: format()
static int ICACHE_FLASH_ATTR file_format( lua_State* L )
static int file_format( lua_State* L )
{
size_t len;
file_close(L);
......@@ -84,7 +84,7 @@ static int ICACHE_FLASH_ATTR file_format( lua_State* L )
extern spiffs fs;
// Lua: list()
static int ICACHE_FLASH_ATTR file_list( lua_State* L )
static int file_list( lua_State* L )
{
spiffs_DIR d;
struct spiffs_dirent e;
......@@ -101,7 +101,7 @@ static int ICACHE_FLASH_ATTR file_list( lua_State* L )
return 1;
}
static int ICACHE_FLASH_ATTR file_seek (lua_State *L)
static int file_seek (lua_State *L)
{
static const int mode[] = {FS_SEEK_SET, FS_SEEK_CUR, FS_SEEK_END};
static const char *const modenames[] = {"set", "cur", "end", NULL};
......@@ -118,7 +118,7 @@ static int ICACHE_FLASH_ATTR file_seek (lua_State *L)
}
// Lua: remove(filename)
static int ICACHE_FLASH_ATTR file_remove( lua_State* L )
static int file_remove( lua_State* L )
{
size_t len;
const char *fname = luaL_checklstring( L, 1, &len );
......@@ -130,7 +130,7 @@ static int ICACHE_FLASH_ATTR file_remove( lua_State* L )
}
// Lua: flush()
static int ICACHE_FLASH_ATTR file_flush( lua_State* L )
static int file_flush( lua_State* L )
{
if((FS_OPEN_OK - 1)==file_fd)
return luaL_error(L, "open a file first");
......@@ -142,7 +142,7 @@ static int ICACHE_FLASH_ATTR file_flush( lua_State* L )
}
#if 0
// Lua: check()
static int ICACHE_FLASH_ATTR file_check( lua_State* L )
static int file_check( lua_State* L )
{
file_close(L);
lua_pushinteger(L, fs_check());
......@@ -153,7 +153,7 @@ static int ICACHE_FLASH_ATTR file_check( lua_State* L )
#endif
// g_read()
static int ICACHE_FLASH_ATTR file_g_read( lua_State* L, int n, int16_t end_char )
static int file_g_read( lua_State* L, int n, int16_t end_char )
{
if(n< 0 || n>LUAL_BUFFERSIZE)
n = LUAL_BUFFERSIZE;
......@@ -197,7 +197,7 @@ static int ICACHE_FLASH_ATTR file_g_read( lua_State* L, int n, int16_t end_char
// file.read() will read all byte in file
// file.read(10) will read 10 byte from file, or EOF is reached.
// file.read('q') will read until 'q' or EOF is reached.
static int ICACHE_FLASH_ATTR file_read( lua_State* L )
static int file_read( lua_State* L )
{
unsigned need_len = LUAL_BUFFERSIZE;
int16_t end_char = EOF;
......@@ -222,13 +222,13 @@ static int ICACHE_FLASH_ATTR file_read( lua_State* L )
}
// Lua: readline()
static int ICACHE_FLASH_ATTR file_readline( lua_State* L )
static int file_readline( lua_State* L )
{
return file_g_read(L, LUAL_BUFFERSIZE, '\n');
}
// Lua: write("string")
static int ICACHE_FLASH_ATTR file_write( lua_State* L )
static int file_write( lua_State* L )
{
if((FS_OPEN_OK - 1)==file_fd)
return luaL_error(L, "open a file first");
......@@ -243,7 +243,7 @@ static int ICACHE_FLASH_ATTR file_write( lua_State* L )
}
// Lua: writeline("string")
static int ICACHE_FLASH_ATTR file_writeline( lua_State* L )
static int file_writeline( lua_State* L )
{
if((FS_OPEN_OK - 1)==file_fd)
return luaL_error(L, "open a file first");
......@@ -290,7 +290,7 @@ const LUA_REG_TYPE file_map[] =
{ LNILKEY, LNILVAL }
};
LUALIB_API int ICACHE_FLASH_ATTR luaopen_file( lua_State *L )
LUALIB_API int luaopen_file( lua_State *L )
{
#if LUA_OPTIMIZE_MEMORY > 0
return 0;
......
......@@ -23,7 +23,7 @@
static int gpio_cb_ref[GPIO_PIN_NUM];
static lua_State* gL = NULL;
void ICACHE_FLASH_ATTR lua_gpio_unref(unsigned pin){
void lua_gpio_unref(unsigned pin){
if(gpio_cb_ref[pin] != LUA_NOREF){
if(gL!=NULL)
luaL_unref(gL, LUA_REGISTRYINDEX, gpio_cb_ref[pin]);
......@@ -31,7 +31,7 @@ void ICACHE_FLASH_ATTR lua_gpio_unref(unsigned pin){
gpio_cb_ref[pin] = LUA_NOREF;
}
void ICACHE_FLASH_ATTR gpio_intr_callback( unsigned pin, unsigned level )
void gpio_intr_callback( unsigned pin, unsigned level )
{
NODE_DBG("pin:%d, level:%d \n", pin, level);
if(gpio_cb_ref[pin] == LUA_NOREF)
......@@ -44,7 +44,7 @@ void ICACHE_FLASH_ATTR gpio_intr_callback( unsigned pin, unsigned level )
}
// Lua: trig( pin, type, function )
static int ICACHE_FLASH_ATTR lgpio_trig( lua_State* L )
static int lgpio_trig( lua_State* L )
{
unsigned type;
unsigned pin;
......@@ -87,7 +87,7 @@ static int ICACHE_FLASH_ATTR lgpio_trig( lua_State* L )
#endif
// Lua: mode( pin, mode, pullup )
static int ICACHE_FLASH_ATTR lgpio_mode( lua_State* L )
static int lgpio_mode( lua_State* L )
{
unsigned mode, pullup = FLOAT;
unsigned pin;
......@@ -119,7 +119,7 @@ static int ICACHE_FLASH_ATTR lgpio_mode( lua_State* L )
}
// Lua: read( pin )
static int ICACHE_FLASH_ATTR lgpio_read( lua_State* L )
static int lgpio_read( lua_State* L )
{
unsigned pin;
......@@ -132,7 +132,7 @@ static int ICACHE_FLASH_ATTR lgpio_read( lua_State* L )
}
// Lua: write( pin, level )
static int ICACHE_FLASH_ATTR lgpio_write( lua_State* L )
static int lgpio_write( lua_State* L )
{
unsigned level;
unsigned pin;
......@@ -171,7 +171,7 @@ const LUA_REG_TYPE gpio_map[] =
{ LNILKEY, LNILVAL }
};
LUALIB_API int ICACHE_FLASH_ATTR luaopen_gpio( lua_State *L )
LUALIB_API int luaopen_gpio( lua_State *L )
{
#ifdef GPIO_INTERRUPT_ENABLE
int i;
......
......@@ -8,7 +8,7 @@
#include "lrotable.h"
// Lua: speed = i2c.setup( id, sda, scl, speed )
static int ICACHE_FLASH_ATTR i2c_setup( lua_State *L )
static int i2c_setup( lua_State *L )
{
unsigned id = luaL_checkinteger( L, 1 );
unsigned sda = luaL_checkinteger( L, 2 );
......@@ -29,7 +29,7 @@ static int ICACHE_FLASH_ATTR i2c_setup( lua_State *L )
}
// Lua: i2c.start( id )
static int ICACHE_FLASH_ATTR i2c_start( lua_State *L )
static int i2c_start( lua_State *L )
{
unsigned id = luaL_checkinteger( L, 1 );
......@@ -39,7 +39,7 @@ static int ICACHE_FLASH_ATTR i2c_start( lua_State *L )
}
// Lua: i2c.stop( id )
static int ICACHE_FLASH_ATTR i2c_stop( lua_State *L )
static int i2c_stop( lua_State *L )
{
unsigned id = luaL_checkinteger( L, 1 );
......@@ -49,7 +49,7 @@ static int ICACHE_FLASH_ATTR i2c_stop( lua_State *L )
}
// Lua: status = i2c.address( id, address, direction )
static int ICACHE_FLASH_ATTR i2c_address( lua_State *L )
static int i2c_address( lua_State *L )
{
unsigned id = luaL_checkinteger( L, 1 );
int address = luaL_checkinteger( L, 2 );
......@@ -64,7 +64,7 @@ static int ICACHE_FLASH_ATTR i2c_address( lua_State *L )
// Lua: wrote = i2c.write( id, data1, [data2], ..., [datan] )
// data can be either a string, a table or an 8-bit number
static int ICACHE_FLASH_ATTR i2c_write( lua_State *L )
static int i2c_write( lua_State *L )
{
unsigned id = luaL_checkinteger( L, 1 );
const char *pdata;
......@@ -122,7 +122,7 @@ static int ICACHE_FLASH_ATTR i2c_write( lua_State *L )
}
// Lua: read = i2c.read( id, size )
static int ICACHE_FLASH_ATTR i2c_read( lua_State *L )
static int i2c_read( lua_State *L )
{
unsigned id = luaL_checkinteger( L, 1 );
u32 size = ( u32 )luaL_checkinteger( L, 2 ), i;
......@@ -162,7 +162,7 @@ const LUA_REG_TYPE i2c_map[] =
{ LNILKEY, LNILVAL }
};
LUALIB_API int ICACHE_FLASH_ATTR luaopen_i2c( lua_State *L )
LUALIB_API int luaopen_i2c( lua_State *L )
{
#if LUA_OPTIMIZE_MEMORY > 0
return 0;
......
......@@ -55,8 +55,7 @@ typedef struct lnet_userdata
#endif
}lnet_userdata;
static void ICACHE_FLASH_ATTR
net_server_disconnected(void *arg) // for tcp server only
static void net_server_disconnected(void *arg) // for tcp server only
{
NODE_DBG("net_server_disconnected is called.\n");
struct espconn *pesp_conn = arg;
......@@ -99,8 +98,7 @@ net_server_disconnected(void *arg) // for tcp server only
lua_gc(gL, LUA_GCRESTART, 0);
}
static void ICACHE_FLASH_ATTR
net_socket_disconnected(void *arg) // tcp only
static void net_socket_disconnected(void *arg) // tcp only
{
NODE_DBG("net_socket_disconnected is called.\n");
struct espconn *pesp_conn = arg;
......@@ -130,22 +128,19 @@ net_socket_disconnected(void *arg) // tcp only
lua_gc(gL, LUA_GCRESTART, 0);
}
static void ICACHE_FLASH_ATTR
net_server_reconnected(void *arg, sint8_t err)
static void net_server_reconnected(void *arg, sint8_t err)
{
NODE_DBG("net_server_reconnected is called.\n");
net_server_disconnected(arg);
}
static void ICACHE_FLASH_ATTR
net_socket_reconnected(void *arg, sint8_t err)
static void net_socket_reconnected(void *arg, sint8_t err)
{
NODE_DBG("net_socket_reconnected is called.\n");
net_socket_disconnected(arg);
}
static void ICACHE_FLASH_ATTR
net_socket_received(void *arg, char *pdata, unsigned short len)
static void net_socket_received(void *arg, char *pdata, unsigned short len)
{
NODE_DBG("net_socket_received is called.\n");
struct espconn *pesp_conn = arg;
......@@ -169,8 +164,7 @@ net_socket_received(void *arg, char *pdata, unsigned short len)
lua_call(gL, 2, 0);
}
static void ICACHE_FLASH_ATTR
net_socket_sent(void *arg)
static void net_socket_sent(void *arg)
{
// NODE_DBG("net_socket_sent is called.\n");
struct espconn *pesp_conn = arg;
......@@ -188,8 +182,7 @@ net_socket_sent(void *arg)
lua_call(gL, 1, 0);
}
static void ICACHE_FLASH_ATTR
net_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
static void net_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
{
NODE_DBG("net_dns_found is called.\n");
struct espconn *pesp_conn = arg;
......@@ -242,8 +235,7 @@ net_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
}
}
static void ICACHE_FLASH_ATTR
net_server_connected(void *arg) // for tcp only
static void net_server_connected(void *arg) // for tcp only
{
NODE_DBG("net_server_connected is called.\n");
struct espconn *pesp_conn = arg;
......@@ -324,8 +316,7 @@ net_server_connected(void *arg) // for tcp only
lua_call(gL, 1, 0); // function(conn)
}
static void ICACHE_FLASH_ATTR
net_socket_connected(void *arg)
static void net_socket_connected(void *arg)
{
NODE_DBG("net_socket_connected is called.\n");
struct espconn *pesp_conn = arg;
......@@ -349,8 +340,7 @@ net_socket_connected(void *arg)
}
// Lua: s = net.create(type, secure/timeout, function(conn))
static int ICACHE_FLASH_ATTR
net_create( lua_State* L, const char* mt )
static int net_create( lua_State* L, const char* mt )
{
NODE_DBG("net_create is called.\n");
struct espconn *pesp_conn = NULL;
......@@ -496,8 +486,7 @@ net_create( lua_State* L, const char* mt )
// call close() first
// server: disconnect server, unref everything
// socket: unref everything
static int ICACHE_FLASH_ATTR
net_delete( lua_State* L, const char* mt )
static int net_delete( lua_State* L, const char* mt )
{
NODE_DBG("net_delete is called.\n");
bool isserver = false;
......@@ -571,7 +560,7 @@ net_delete( lua_State* L, const char* mt )
return 0;
}
static void ICACHE_FLASH_ATTR socket_connect(struct espconn *pesp_conn)
static void socket_connect(struct espconn *pesp_conn)
{
if(pesp_conn == NULL)
return;
......@@ -600,8 +589,7 @@ static void ICACHE_FLASH_ATTR socket_connect(struct espconn *pesp_conn)
static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg);
static dns_reconn_count = 0;
static void ICACHE_FLASH_ATTR
socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
{
NODE_DBG("socket_dns_found is called.\n");
struct espconn *pesp_conn = arg;
......@@ -647,8 +635,7 @@ socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
// Lua: server:listen( port, ip, function(con) )
// Lua: socket:connect( port, ip, function(con) )
static int ICACHE_FLASH_ATTR
net_start( lua_State* L, const char* mt )
static int net_start( lua_State* L, const char* mt )
{
NODE_DBG("net_start is called.\n");
struct espconn *pesp_conn = NULL;
......@@ -819,8 +806,7 @@ net_start( lua_State* L, const char* mt )
// Lua: server/socket:close()
// server disconnect everything, unref everything
// client disconnect and unref itself
static int ICACHE_FLASH_ATTR
net_close( lua_State* L, const char* mt )
static int net_close( lua_State* L, const char* mt )
{
NODE_DBG("net_close is called.\n");
bool isserver = false;
......@@ -929,8 +915,7 @@ net_close( lua_State* L, const char* mt )
}
// Lua: socket/udpserver:on( "method", function(s) )
static int ICACHE_FLASH_ATTR
net_on( lua_State* L, const char* mt )
static int net_on( lua_State* L, const char* mt )
{
NODE_DBG("net_on is called.\n");
bool isserver = false;
......@@ -994,8 +979,7 @@ net_on( lua_State* L, const char* mt )
}
// Lua: server/socket:send( string, function(sent) )
static int ICACHE_FLASH_ATTR
net_send( lua_State* L, const char* mt )
static int net_send( lua_State* L, const char* mt )
{
// NODE_DBG("net_send is called.\n");
bool isserver = false;
......@@ -1061,8 +1045,7 @@ net_send( lua_State* L, const char* mt )
}
// Lua: socket:dns( string, function(socket, ip) )
static int ICACHE_FLASH_ATTR
net_dns( lua_State* L, const char* mt )
static int net_dns( lua_State* L, const char* mt )
{
NODE_DBG("net_dns is called.\n");
bool isserver = false;
......@@ -1115,111 +1098,98 @@ net_dns( lua_State* L, const char* mt )
// Lua: s = net.createServer(type, function(server))
static int ICACHE_FLASH_ATTR net_createServer( lua_State* L )
static int net_createServer( lua_State* L )
{
const char *mt = "net.server";
return net_create(L, mt);
}
// Lua: server:delete()
static int ICACHE_FLASH_ATTR
net_server_delete( lua_State* L )
static int net_server_delete( lua_State* L )
{
const char *mt = "net.server";
return net_delete(L, mt);
}
// Lua: server:listen( port, ip )
static int ICACHE_FLASH_ATTR
net_server_listen( lua_State* L )
static int net_server_listen( lua_State* L )
{
const char *mt = "net.server";
return net_start(L, mt);
}
// Lua: server:close()
static int ICACHE_FLASH_ATTR
net_server_close( lua_State* L )
static int net_server_close( lua_State* L )
{
const char *mt = "net.server";
return net_close(L, mt);
}
// Lua: udpserver:on( "method", function(udpserver) )
static int ICACHE_FLASH_ATTR
net_udpserver_on( lua_State* L )
static int net_udpserver_on( lua_State* L )
{
const char *mt = "net.server";
return net_on(L, mt);
}
// Lua: udpserver:send(string, function() )
static int ICACHE_FLASH_ATTR
net_udpserver_send( lua_State* L )
static int net_udpserver_send( lua_State* L )
{
const char *mt = "net.server";
return net_send(L, mt);;
}
// Lua: s = net.createConnection(type, function(conn))
static int ICACHE_FLASH_ATTR
net_createConnection( lua_State* L )
static int net_createConnection( lua_State* L )
{
const char *mt = "net.socket";
return net_create(L, mt);
}
// Lua: socket:delete()
static int ICACHE_FLASH_ATTR
net_socket_delete( lua_State* L )
static int net_socket_delete( lua_State* L )
{
const char *mt = "net.socket";
return net_delete(L, mt);
}
// Lua: socket:connect( port, ip )
static int ICACHE_FLASH_ATTR
net_socket_connect( lua_State* L )
static int net_socket_connect( lua_State* L )
{
const char *mt = "net.socket";
return net_start(L, mt);
}
// Lua: socket:close()
static int ICACHE_FLASH_ATTR
net_socket_close( lua_State* L )
static int net_socket_close( lua_State* L )
{
const char *mt = "net.socket";
return net_close(L, mt);
}
// Lua: socket:on( "method", function(socket) )
static int ICACHE_FLASH_ATTR
net_socket_on( lua_State* L )
static int net_socket_on( lua_State* L )
{
const char *mt = "net.socket";
return net_on(L, mt);
}
// Lua: socket:send( string, function() )
static int ICACHE_FLASH_ATTR
net_socket_send( lua_State* L )
static int net_socket_send( lua_State* L )
{
const char *mt = "net.socket";
return net_send(L, mt);
}
// Lua: socket:dns( string, function(ip) )
static int ICACHE_FLASH_ATTR
net_socket_dns( lua_State* L )
static int net_socket_dns( lua_State* L )
{
const char *mt = "net.socket";
return net_dns(L, mt);
}
#if 0
static int ICACHE_FLASH_ATTR
net_array_index( lua_State* L )
static int net_array_index( lua_State* L )
{
char** parray = luaL_checkudata(L, 1, "net.array");
int index = luaL_checkint(L, 2);
......@@ -1227,8 +1197,7 @@ net_array_index( lua_State* L )
return 1;
}
static int ICACHE_FLASH_ATTR
net_array_newindex( lua_State* L )
static int net_array_newindex( lua_State* L )
{
char** parray = luaL_checkudata(L, 1, "net.array");
int index = luaL_checkint(L, 2);
......@@ -1238,8 +1207,7 @@ net_array_newindex( lua_State* L )
}
// expose an array to lua, by storing it in a userdata with the array metatable
static int ICACHE_FLASH_ATTR
expose_array(lua_State* L, char *array, unsigned short len) {
static int expose_array(lua_State* L, char *array, unsigned short len) {
char** parray = lua_newuserdata(L, len);
*parray = array;
luaL_getmetatable(L, "net.array");
......@@ -1300,7 +1268,7 @@ const LUA_REG_TYPE net_map[] =
{ LNILKEY, LNILVAL }
};
LUALIB_API int ICACHE_FLASH_ATTR luaopen_net( lua_State *L )
LUALIB_API int luaopen_net( lua_State *L )
{
int i;
for(i=0;i<MAX_SOCKET;i++)
......
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