mirror of
https://github.com/lua/lua
synced 2024-12-24 03:16:50 +03:00
`name' in comments changed to 'name'
This commit is contained in:
parent
c3c78030f7
commit
bdf566a8a3
10
lapi.c
10
lapi.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lapi.c,v 2.237 2014/10/15 14:27:40 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 2.238 2014/10/17 19:17:55 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -178,7 +178,7 @@ LUA_API void lua_settop (lua_State *L, int idx) {
|
||||
}
|
||||
else {
|
||||
api_check(-(idx+1) <= (L->top - (func + 1)), "invalid new top");
|
||||
L->top += idx+1; /* `subtract' index (index is negative) */
|
||||
L->top += idx+1; /* 'subtract' index (index is negative) */
|
||||
}
|
||||
lua_unlock(L);
|
||||
}
|
||||
@ -375,7 +375,7 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
|
||||
if (len != NULL) *len = 0;
|
||||
return NULL;
|
||||
}
|
||||
lua_lock(L); /* `luaO_tostring' may create a new string */
|
||||
lua_lock(L); /* 'luaO_tostring' may create a new string */
|
||||
luaC_checkGC(L);
|
||||
o = index2addr(L, idx); /* previous call may reallocate the stack */
|
||||
luaO_tostring(L, o);
|
||||
@ -867,7 +867,7 @@ LUA_API void lua_setuservalue (lua_State *L, int idx) {
|
||||
|
||||
|
||||
/*
|
||||
** `load' and `call' functions (run Lua code)
|
||||
** 'load' and 'call' functions (run Lua code)
|
||||
*/
|
||||
|
||||
|
||||
@ -902,7 +902,7 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults,
|
||||
/*
|
||||
** Execute a protected call.
|
||||
*/
|
||||
struct CallS { /* data to `f_call' */
|
||||
struct CallS { /* data to 'f_call' */
|
||||
StkId func;
|
||||
int nresults;
|
||||
};
|
||||
|
10
lauxlib.c
10
lauxlib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lauxlib.c,v 1.269 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** $Id: lauxlib.c,v 1.270 2014/10/22 11:44:20 roberto Exp roberto $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -156,7 +156,7 @@ LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) {
|
||||
return luaL_error(L, "bad argument #%d (%s)", arg, extramsg);
|
||||
lua_getinfo(L, "n", &ar);
|
||||
if (strcmp(ar.namewhat, "method") == 0) {
|
||||
arg--; /* do not count `self' */
|
||||
arg--; /* do not count 'self' */
|
||||
if (arg == 0) /* error is in the self argument itself? */
|
||||
return luaL_error(L, "calling '%s' on bad self (%s)",
|
||||
ar.name, extramsg);
|
||||
@ -526,7 +526,7 @@ LUALIB_API int luaL_ref (lua_State *L, int t) {
|
||||
int ref;
|
||||
if (lua_isnil(L, -1)) {
|
||||
lua_pop(L, 1); /* remove from stack */
|
||||
return LUA_REFNIL; /* `nil' has a unique fixed reference */
|
||||
return LUA_REFNIL; /* 'nil' has a unique fixed reference */
|
||||
}
|
||||
t = lua_absindex(L, t);
|
||||
lua_rawgeti(L, t, freelist); /* get first free element */
|
||||
@ -658,7 +658,7 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
|
||||
readstatus = ferror(lf.f);
|
||||
if (filename) fclose(lf.f); /* close file (even in case of errors) */
|
||||
if (readstatus) {
|
||||
lua_settop(L, fnameindex); /* ignore results from `lua_load' */
|
||||
lua_settop(L, fnameindex); /* ignore results from 'lua_load' */
|
||||
return errfile(L, "read", fnameindex);
|
||||
}
|
||||
lua_remove(L, fnameindex);
|
||||
@ -918,7 +918,7 @@ LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,
|
||||
while ((wild = strstr(s, p)) != NULL) {
|
||||
luaL_addlstring(&b, s, wild - s); /* push prefix */
|
||||
luaL_addstring(&b, r); /* push replacement in place of pattern */
|
||||
s = wild + l; /* continue after `p' */
|
||||
s = wild + l; /* continue after 'p' */
|
||||
}
|
||||
luaL_addstring(&b, s); /* push last suffix */
|
||||
luaL_pushresult(&b);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lauxlib.h,v 1.125 2014/06/26 17:25:11 roberto Exp roberto $
|
||||
** $Id: lauxlib.h,v 1.126 2014/10/01 11:54:56 roberto Exp roberto $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
|
||||
/* extra error code for `luaL_load' */
|
||||
/* extra error code for 'luaL_load' */
|
||||
#define LUA_ERRFILE (LUA_ERRERR+1)
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lbaselib.c,v 1.302 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** $Id: lbaselib.c,v 1.303 2014/10/17 19:17:55 roberto Exp roberto $
|
||||
** Basic library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -325,7 +325,7 @@ static int luaB_loadfile (lua_State *L) {
|
||||
|
||||
|
||||
/*
|
||||
** Reader for generic `load' function: `lua_load' uses the
|
||||
** Reader for generic 'load' function: 'lua_load' uses the
|
||||
** stack for internal stuff, so the reader cannot change the
|
||||
** stack top. Instead, it keeps its resulting string in a
|
||||
** reserved slot inside the stack.
|
||||
|
16
lcode.c
16
lcode.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lcode.c,v 2.89 2014/04/29 18:14:16 roberto Exp roberto $
|
||||
** $Id: lcode.c,v 2.90 2014/05/08 18:58:46 roberto Exp roberto $
|
||||
** Code generator for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -107,7 +107,7 @@ static void fixjump (FuncState *fs, int pc, int dest) {
|
||||
|
||||
|
||||
/*
|
||||
** returns current `pc' and marks it as a jump target (to avoid wrong
|
||||
** returns current 'pc' and marks it as a jump target (to avoid wrong
|
||||
** optimizations with consecutive instructions not in the same basic block).
|
||||
*/
|
||||
int luaK_getlabel (FuncState *fs) {
|
||||
@ -230,7 +230,7 @@ void luaK_concat (FuncState *fs, int *l1, int l2) {
|
||||
|
||||
static int luaK_code (FuncState *fs, Instruction i) {
|
||||
Proto *f = fs->f;
|
||||
dischargejpc(fs); /* `pc' will change */
|
||||
dischargejpc(fs); /* 'pc' will change */
|
||||
/* put new instruction in code array */
|
||||
luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction,
|
||||
MAX_INT, "opcodes");
|
||||
@ -503,7 +503,7 @@ static void discharge2anyreg (FuncState *fs, expdesc *e) {
|
||||
static void exp2reg (FuncState *fs, expdesc *e, int reg) {
|
||||
discharge2reg(fs, e, reg);
|
||||
if (e->k == VJMP)
|
||||
luaK_concat(fs, &e->t, e->u.info); /* put this jump in `t' list */
|
||||
luaK_concat(fs, &e->t, e->u.info); /* put this jump in 't' list */
|
||||
if (hasjumps(e)) {
|
||||
int final; /* position after whole expression */
|
||||
int p_f = NO_JUMP; /* position of an eventual LOAD false */
|
||||
@ -677,7 +677,7 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */
|
||||
luaK_concat(fs, &e->f, pc); /* insert last jump in 'f' list */
|
||||
luaK_patchtohere(fs, e->t);
|
||||
e->t = NO_JUMP;
|
||||
}
|
||||
@ -700,7 +700,7 @@ void luaK_goiffalse (FuncState *fs, expdesc *e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */
|
||||
luaK_concat(fs, &e->t, pc); /* insert last jump in 't' list */
|
||||
luaK_patchtohere(fs, e->f);
|
||||
e->f = NO_JUMP;
|
||||
}
|
||||
@ -831,7 +831,7 @@ static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
|
||||
freeexp(fs, e2);
|
||||
freeexp(fs, e1);
|
||||
if (cond == 0 && op != OP_EQ) {
|
||||
int temp; /* exchange args to replace by `<' or `<=' */
|
||||
int temp; /* exchange args to replace by '<' or '<=' */
|
||||
temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */
|
||||
cond = 1;
|
||||
}
|
||||
@ -865,7 +865,7 @@ void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
|
||||
break;
|
||||
}
|
||||
case OPR_CONCAT: {
|
||||
luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */
|
||||
luaK_exp2nextreg(fs, v); /* operand must be on the 'stack' */
|
||||
break;
|
||||
}
|
||||
case OPR_ADD: case OPR_SUB:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lcorolib.c,v 1.6 2014/05/08 13:52:20 roberto Exp roberto $
|
||||
** $Id: lcorolib.c,v 1.7 2014/09/01 18:00:04 roberto Exp roberto $
|
||||
** Coroutine Library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -65,7 +65,7 @@ static int luaB_coresume (lua_State *L) {
|
||||
else {
|
||||
lua_pushboolean(L, 1);
|
||||
lua_insert(L, -(r + 1));
|
||||
return r + 1; /* return true + `resume' returns */
|
||||
return r + 1; /* return true + 'resume' returns */
|
||||
}
|
||||
}
|
||||
|
||||
|
4
ldebug.c
4
ldebug.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldebug.c,v 2.100 2014/07/30 14:00:14 roberto Exp roberto $
|
||||
** $Id: ldebug.c,v 2.101 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** Debug Interface
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -365,7 +365,7 @@ static int findsetreg (Proto *p, int lastpc, int reg) {
|
||||
case OP_JMP: {
|
||||
int b = GETARG_sBx(i);
|
||||
int dest = pc + 1 + b;
|
||||
/* jump is forward and do not skip `lastpc'? */
|
||||
/* jump is forward and do not skip 'lastpc'? */
|
||||
if (pc < dest && dest <= lastpc) {
|
||||
if (dest > jmptarget)
|
||||
jmptarget = dest; /* update 'jmptarget' */
|
||||
|
8
ldo.c
8
ldo.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldo.c,v 2.129 2014/10/08 12:20:26 roberto Exp roberto $
|
||||
** $Id: ldo.c,v 2.130 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** Stack and Call structure of Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -287,7 +287,7 @@ static StkId tryfuncTM (lua_State *L, StkId func) {
|
||||
ptrdiff_t funcr = savestack(L, func);
|
||||
if (!ttisfunction(tm))
|
||||
luaG_typeerror(L, func, "call");
|
||||
/* Open a hole inside the stack at `func' */
|
||||
/* Open a hole inside the stack at 'func' */
|
||||
for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);
|
||||
incr_top(L);
|
||||
func = restorestack(L, funcr); /* previous call may change stack */
|
||||
@ -575,7 +575,7 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) {
|
||||
status = luaD_rawrunprotected(L, unroll, &status);
|
||||
}
|
||||
if (errorstatus(status)) { /* unrecoverable error? */
|
||||
L->status = cast_byte(status); /* mark thread as `dead' */
|
||||
L->status = cast_byte(status); /* mark thread as 'dead' */
|
||||
seterrorobj(L, status, L->top); /* push error message */
|
||||
L->ci->top = L->top;
|
||||
}
|
||||
@ -650,7 +650,7 @@ int luaD_pcall (lua_State *L, Pfunc func, void *u,
|
||||
/*
|
||||
** Execute a protected parser.
|
||||
*/
|
||||
struct SParser { /* data to `f_parser' */
|
||||
struct SParser { /* data to 'f_parser' */
|
||||
ZIO *z;
|
||||
Mbuffer buff; /* dynamic structure used by the scanner */
|
||||
Dyndata dyd; /* dynamic structures used by the parser */
|
||||
|
4
ldo.h
4
ldo.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ldo.h,v 2.19 2011/10/07 20:45:19 roberto Exp roberto $
|
||||
** $Id: ldo.h,v 2.20 2011/11/29 15:55:08 roberto Exp roberto $
|
||||
** Stack and Call structure of Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -23,7 +23,7 @@
|
||||
#define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
|
||||
|
||||
|
||||
/* type of protected functions, to be ran by `runprotected' */
|
||||
/* type of protected functions, to be ran by 'runprotected' */
|
||||
typedef void (*Pfunc) (lua_State *L, void *ud);
|
||||
|
||||
LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
|
||||
|
6
lfunc.c
6
lfunc.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lfunc.c,v 2.42 2014/06/18 22:59:29 roberto Exp roberto $
|
||||
** $Id: lfunc.c,v 2.43 2014/06/19 18:27:20 roberto Exp roberto $
|
||||
** Auxiliary functions to manipulate prototypes and closures
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -82,7 +82,7 @@ void luaF_close (lua_State *L, StkId level) {
|
||||
UpVal *uv;
|
||||
while (L->openupval != NULL && (uv = L->openupval)->v >= level) {
|
||||
lua_assert(upisopen(uv));
|
||||
L->openupval = uv->u.open.next; /* remove from `open' list */
|
||||
L->openupval = uv->u.open.next; /* remove from 'open' list */
|
||||
if (uv->refcount == 0) /* no references? */
|
||||
luaM_free(L, uv); /* free upvalue */
|
||||
else {
|
||||
@ -132,7 +132,7 @@ void luaF_freeproto (lua_State *L, Proto *f) {
|
||||
|
||||
|
||||
/*
|
||||
** Look for n-th local variable at line `line' in function `func'.
|
||||
** Look for n-th local variable at line 'line' in function 'func'.
|
||||
** Returns NULL if not found.
|
||||
*/
|
||||
const char *luaF_getlocalname (const Proto *f, int local_number, int pc) {
|
||||
|
8
lgc.c
8
lgc.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lgc.c,v 2.195 2014/09/04 18:15:29 roberto Exp roberto $
|
||||
** $Id: lgc.c,v 2.196 2014/10/03 12:54:37 roberto Exp roberto $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -119,14 +119,14 @@ static void removeentry (Node *n) {
|
||||
/*
|
||||
** tells whether a key or value can be cleared from a weak
|
||||
** table. Non-collectable objects are never removed from weak
|
||||
** tables. Strings behave as `values', so are never removed too. for
|
||||
** tables. Strings behave as 'values', so are never removed too. for
|
||||
** other objects: if really collected, cannot keep them; for objects
|
||||
** being finalized, keep them in keys, but not in values
|
||||
*/
|
||||
static int iscleared (global_State *g, const TValue *o) {
|
||||
if (!iscollectable(o)) return 0;
|
||||
else if (ttisstring(o)) {
|
||||
markobject(g, tsvalue(o)); /* strings are `values', so are never weak */
|
||||
markobject(g, tsvalue(o)); /* strings are 'values', so are never weak */
|
||||
return 0;
|
||||
}
|
||||
else return iswhite(gcvalue(o));
|
||||
@ -1031,7 +1031,7 @@ static lu_mem singlestep (lua_State *L) {
|
||||
g->GCmemtrav = 0;
|
||||
lua_assert(g->gray);
|
||||
propagatemark(g);
|
||||
if (g->gray == NULL) /* no more `gray' objects? */
|
||||
if (g->gray == NULL) /* no more gray objects? */
|
||||
g->gcstate = GCSatomic; /* finish propagate phase */
|
||||
return g->GCmemtrav; /* memory traversed in this step */
|
||||
}
|
||||
|
4
lgc.h
4
lgc.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lgc.h,v 2.84 2014/07/19 15:09:37 roberto Exp roberto $
|
||||
** $Id: lgc.h,v 2.85 2014/07/19 15:14:46 roberto Exp roberto $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -74,7 +74,7 @@
|
||||
#define testbit(x,b) testbits(x, bitmask(b))
|
||||
|
||||
|
||||
/* Layout for bit use in `marked' field: */
|
||||
/* Layout for bit use in 'marked' field: */
|
||||
#define WHITE0BIT 0 /* object is white (type 0) */
|
||||
#define WHITE1BIT 1 /* object is white (type 1) */
|
||||
#define BLACKBIT 2 /* object is black */
|
||||
|
4
liolib.c
4
liolib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: liolib.c,v 2.135 2014/10/22 11:44:20 roberto Exp roberto $
|
||||
** $Id: liolib.c,v 2.136 2014/10/22 16:55:57 roberto Exp roberto $
|
||||
** Standard I/O (and system) library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -182,7 +182,7 @@ static FILE *tofile (lua_State *L) {
|
||||
|
||||
|
||||
/*
|
||||
** When creating file handles, always creates a `closed' file handle
|
||||
** When creating file handles, always creates a 'closed' file handle
|
||||
** before opening the actual file; so, if there is a memory error, the
|
||||
** file is not left opened.
|
||||
*/
|
||||
|
14
llex.c
14
llex.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: llex.c,v 2.83 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** $Id: llex.c,v 2.84 2014/10/22 11:44:20 roberto Exp roberto $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -125,7 +125,7 @@ l_noret luaX_syntaxerror (LexState *ls, const char *msg) {
|
||||
*/
|
||||
TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
|
||||
lua_State *L = ls->L;
|
||||
TValue *o; /* entry for `str' */
|
||||
TValue *o; /* entry for 'str' */
|
||||
TString *ts = luaS_newlstr(L, str, l); /* create new string */
|
||||
setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */
|
||||
o = luaH_set(L, ls->h, L->top - 1);
|
||||
@ -150,9 +150,9 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
|
||||
static void inclinenumber (LexState *ls) {
|
||||
int old = ls->current;
|
||||
lua_assert(currIsNewline(ls));
|
||||
next(ls); /* skip `\n' or `\r' */
|
||||
next(ls); /* skip '\n' or '\r' */
|
||||
if (currIsNewline(ls) && ls->current != old)
|
||||
next(ls); /* skip `\n\r' or `\r\n' */
|
||||
next(ls); /* skip '\n\r' or '\r\n' */
|
||||
if (++ls->linenumber >= MAX_INT)
|
||||
luaX_syntaxerror(ls, "chunk has too many lines");
|
||||
}
|
||||
@ -298,7 +298,7 @@ static int skip_sep (LexState *ls) {
|
||||
|
||||
static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
|
||||
int line = ls->linenumber; /* initial line (for error message) */
|
||||
save_and_next(ls); /* skip 2nd `[' */
|
||||
save_and_next(ls); /* skip 2nd '[' */
|
||||
if (currIsNewline(ls)) /* string starts with a newline? */
|
||||
inclinenumber(ls); /* skip it */
|
||||
for (;;) {
|
||||
@ -312,7 +312,7 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
|
||||
}
|
||||
case ']': {
|
||||
if (skip_sep(ls) == sep) {
|
||||
save_and_next(ls); /* skip 2nd `]' */
|
||||
save_and_next(ls); /* skip 2nd ']' */
|
||||
goto endloop;
|
||||
}
|
||||
break;
|
||||
@ -480,7 +480,7 @@ static int llex (LexState *ls, SemInfo *seminfo) {
|
||||
next(ls);
|
||||
if (ls->current == '[') { /* long comment? */
|
||||
int sep = skip_sep(ls);
|
||||
luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */
|
||||
luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */
|
||||
if (sep >= 0) {
|
||||
read_long_string(ls, NULL, sep); /* skip long comment */
|
||||
luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */
|
||||
|
4
llex.h
4
llex.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: llex.h,v 1.75 2013/08/30 16:01:37 roberto Exp roberto $
|
||||
** $Id: llex.h,v 1.76 2013/12/30 20:47:58 roberto Exp roberto $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -54,7 +54,7 @@ typedef struct Token {
|
||||
typedef struct LexState {
|
||||
int current; /* current character (charint) */
|
||||
int linenumber; /* input line counter */
|
||||
int lastline; /* line of last token `consumed' */
|
||||
int lastline; /* line of last token 'consumed' */
|
||||
Token t; /* current token */
|
||||
Token lookahead; /* look ahead token */
|
||||
struct FuncState *fs; /* current function (parser) */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
** $Id: llimits.h,v 1.119 2014/07/18 18:18:45 roberto Exp roberto $
|
||||
** Limits, basic types, and some other `installation-dependent' definitions
|
||||
** $Id: llimits.h,v 1.120 2014/07/18 18:29:12 roberto Exp roberto $
|
||||
** Limits, basic types, and some other 'installation-dependent' definitions
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
@ -23,7 +23,7 @@ typedef LUAI_MEM l_mem;
|
||||
|
||||
|
||||
|
||||
/* chars used as small naturals (so that `char' is reserved for characters) */
|
||||
/* chars used as small naturals (so that 'char' is reserved for characters) */
|
||||
typedef unsigned char lu_byte;
|
||||
|
||||
|
||||
|
8
lmem.c
8
lmem.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lmem.c,v 1.85 2014/06/26 18:29:05 roberto Exp roberto $
|
||||
** $Id: lmem.c,v 1.86 2014/07/15 21:26:50 roberto Exp roberto $
|
||||
** Interface to Memory Manager
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -24,12 +24,12 @@
|
||||
/*
|
||||
** About the realloc function:
|
||||
** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize);
|
||||
** (`osize' is the old size, `nsize' is the new size)
|
||||
** ('osize' is the old size, 'nsize' is the new size)
|
||||
**
|
||||
** * frealloc(ud, NULL, x, s) creates a new block of size `s' (no
|
||||
** * frealloc(ud, NULL, x, s) creates a new block of size 's' (no
|
||||
** matter 'x').
|
||||
**
|
||||
** * frealloc(ud, p, x, 0) frees the block `p'
|
||||
** * frealloc(ud, p, x, 0) frees the block 'p'
|
||||
** (in this specific case, frealloc must return NULL);
|
||||
** particularly, frealloc(ud, NULL, 0, 0) does nothing
|
||||
** (which is equivalent to free(NULL) in ANSI C)
|
||||
|
10
loadlib.c
10
loadlib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: loadlib.c,v 1.116 2014/07/29 16:01:00 roberto Exp roberto $
|
||||
** $Id: loadlib.c,v 1.117 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** Dynamic library loader for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
**
|
||||
@ -729,7 +729,7 @@ static void createsearcherstable (lua_State *L) {
|
||||
}
|
||||
#if defined(LUA_COMPAT_LOADERS)
|
||||
lua_pushvalue(L, -1); /* make a copy of 'searchers' table */
|
||||
lua_setfield(L, -3, "loaders"); /* put it in field `loaders' */
|
||||
lua_setfield(L, -3, "loaders"); /* put it in field 'loaders' */
|
||||
#endif
|
||||
lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */
|
||||
}
|
||||
@ -750,7 +750,7 @@ static void createclibstable (lua_State *L) {
|
||||
|
||||
LUAMOD_API int luaopen_package (lua_State *L) {
|
||||
createclibstable(L);
|
||||
luaL_newlib(L, pk_funcs); /* create `package' table */
|
||||
luaL_newlib(L, pk_funcs); /* create 'package' table */
|
||||
createsearcherstable(L);
|
||||
/* set field 'path' */
|
||||
setpath(L, "path", LUA_PATHVARVERSION, LUA_PATH_VAR, LUA_PATH_DEFAULT);
|
||||
@ -760,10 +760,10 @@ LUAMOD_API int luaopen_package (lua_State *L) {
|
||||
lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n"
|
||||
LUA_EXEC_DIR "\n" LUA_IGMARK "\n");
|
||||
lua_setfield(L, -2, "config");
|
||||
/* set field `loaded' */
|
||||
/* set field 'loaded' */
|
||||
luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
|
||||
lua_setfield(L, -2, "loaded");
|
||||
/* set field `preload' */
|
||||
/* set field 'preload' */
|
||||
luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
|
||||
lua_setfield(L, -2, "preload");
|
||||
lua_pushglobaltable(L);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lobject.c,v 2.93 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** $Id: lobject.c,v 2.94 2014/10/24 11:42:29 roberto Exp roberto $
|
||||
** Some generic functions over Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -399,7 +399,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
|
||||
break;
|
||||
}
|
||||
case 'p': {
|
||||
char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */
|
||||
char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */
|
||||
int l = sprintf(buff, "%p", va_arg(argp, void *));
|
||||
pushstr(L, buff, l);
|
||||
break;
|
||||
|
14
lobject.h
14
lobject.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lobject.h,v 2.102 2014/09/04 18:15:29 roberto Exp roberto $
|
||||
** $Id: lobject.h,v 2.103 2014/10/01 11:52:33 roberto Exp roberto $
|
||||
** Type definitions for Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -345,7 +345,7 @@ typedef struct Udata {
|
||||
** Ensures that address after this type is always fully aligned.
|
||||
*/
|
||||
typedef union UUdata {
|
||||
L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
|
||||
L_Umaxalign dummy; /* ensures maximum alignment for 'local' udata */
|
||||
Udata uv;
|
||||
} UUdata;
|
||||
|
||||
@ -399,10 +399,10 @@ typedef struct Proto {
|
||||
lu_byte is_vararg;
|
||||
lu_byte maxstacksize; /* maximum stack used by this function */
|
||||
int sizeupvalues; /* size of 'upvalues' */
|
||||
int sizek; /* size of `k' */
|
||||
int sizek; /* size of 'k' */
|
||||
int sizecode;
|
||||
int sizelineinfo;
|
||||
int sizep; /* size of `p' */
|
||||
int sizep; /* size of 'p' */
|
||||
int sizelocvars;
|
||||
int linedefined;
|
||||
int lastlinedefined;
|
||||
@ -486,8 +486,8 @@ typedef struct Node {
|
||||
typedef struct Table {
|
||||
CommonHeader;
|
||||
lu_byte flags; /* 1<<p means tagmethod(p) is not present */
|
||||
lu_byte lsizenode; /* log2 of size of `node' array */
|
||||
unsigned int sizearray; /* size of `array' array */
|
||||
lu_byte lsizenode; /* log2 of size of 'node' array */
|
||||
unsigned int sizearray; /* size of 'array' array */
|
||||
TValue *array; /* array part */
|
||||
Node *node;
|
||||
Node *lastfree; /* any free position is before this position */
|
||||
@ -498,7 +498,7 @@ typedef struct Table {
|
||||
|
||||
|
||||
/*
|
||||
** `module' operation for hashing (size is always a power of 2)
|
||||
** 'module' operation for hashing (size is always a power of 2)
|
||||
*/
|
||||
#define lmod(s,size) \
|
||||
(check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))))
|
||||
|
28
lopcodes.h
28
lopcodes.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lopcodes.h,v 1.146 2013/12/30 20:47:58 roberto Exp roberto $
|
||||
** $Id: lopcodes.h,v 1.147 2014/10/20 18:29:55 roberto Exp roberto $
|
||||
** Opcodes for Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -14,12 +14,12 @@
|
||||
We assume that instructions are unsigned numbers.
|
||||
All instructions have an opcode in the first 6 bits.
|
||||
Instructions can have the following fields:
|
||||
`A' : 8 bits
|
||||
`B' : 9 bits
|
||||
`C' : 9 bits
|
||||
'A' : 8 bits
|
||||
'B' : 9 bits
|
||||
'C' : 9 bits
|
||||
'Ax' : 26 bits ('A', 'B', and 'C' together)
|
||||
`Bx' : 18 bits (`B' and `C' together)
|
||||
`sBx' : signed Bx
|
||||
'Bx' : 18 bits ('B' and 'C' together)
|
||||
'sBx' : signed Bx
|
||||
|
||||
A signed argument is represented in excess K; that is, the number
|
||||
value is the unsigned value minus K. K is exactly the maximum value
|
||||
@ -58,7 +58,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */
|
||||
*/
|
||||
#if SIZE_Bx < LUAI_BITSINT-1
|
||||
#define MAXARG_Bx ((1<<SIZE_Bx)-1)
|
||||
#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */
|
||||
#define MAXARG_sBx (MAXARG_Bx>>1) /* 'sBx' is signed */
|
||||
#else
|
||||
#define MAXARG_Bx MAX_INT
|
||||
#define MAXARG_sBx MAX_INT
|
||||
@ -76,10 +76,10 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */
|
||||
#define MAXARG_C ((1<<SIZE_C)-1)
|
||||
|
||||
|
||||
/* creates a mask with `n' 1 bits at position `p' */
|
||||
/* creates a mask with 'n' 1 bits at position 'p' */
|
||||
#define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p))
|
||||
|
||||
/* creates a mask with `n' 0 bits at position `p' */
|
||||
/* creates a mask with 'n' 0 bits at position 'p' */
|
||||
#define MASK0(n,p) (~MASK1(n,p))
|
||||
|
||||
/*
|
||||
@ -238,16 +238,16 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
|
||||
|
||||
/*===========================================================================
|
||||
Notes:
|
||||
(*) In OP_CALL, if (B == 0) then B = top. If (C == 0), then `top' is
|
||||
(*) In OP_CALL, if (B == 0) then B = top. If (C == 0), then 'top' is
|
||||
set to last_result+1, so next open instruction (OP_CALL, OP_RETURN,
|
||||
OP_SETLIST) may use `top'.
|
||||
OP_SETLIST) may use 'top'.
|
||||
|
||||
(*) In OP_VARARG, if (B == 0) then use actual number of varargs and
|
||||
set top (like in OP_CALL with C == 0).
|
||||
|
||||
(*) In OP_RETURN, if (B == 0) then return up to `top'.
|
||||
(*) In OP_RETURN, if (B == 0) then return up to 'top'.
|
||||
|
||||
(*) In OP_SETLIST, if (B == 0) then B = `top'; if (C == 0) then next
|
||||
(*) In OP_SETLIST, if (B == 0) then B = 'top'; if (C == 0) then next
|
||||
'instruction' is EXTRAARG(real C).
|
||||
|
||||
(*) In OP_LOADKX, the next 'instruction' is always EXTRAARG.
|
||||
@ -255,7 +255,7 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
|
||||
(*) For comparisons, A specifies what condition the test should accept
|
||||
(true or false).
|
||||
|
||||
(*) All `skips' (pc++) assume that next instruction is a jump.
|
||||
(*) All 'skips' (pc++) assume that next instruction is a jump.
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
|
4
loslib.c
4
loslib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: loslib.c,v 1.48 2014/10/08 19:57:31 roberto Exp roberto $
|
||||
** $Id: loslib.c,v 1.49 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** Standard Operating System library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -227,7 +227,7 @@ static int os_date (lua_State *L) {
|
||||
struct tm tmr, *stm;
|
||||
if (*s == '!') { /* UTC? */
|
||||
stm = l_gmtime(&t, &tmr);
|
||||
s++; /* skip `!' */
|
||||
s++; /* skip '!' */
|
||||
}
|
||||
else
|
||||
stm = l_localtime(&t, &tmr);
|
||||
|
62
lparser.c
62
lparser.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lparser.c,v 2.142 2014/07/21 16:02:10 roberto Exp roberto $
|
||||
** $Id: lparser.c,v 2.143 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** Lua Parser
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -49,7 +49,7 @@ typedef struct BlockCnt {
|
||||
short firstgoto; /* index of first pending goto in this block */
|
||||
lu_byte nactvar; /* # active locals outside the block */
|
||||
lu_byte upval; /* true if some variable in the block is an upvalue */
|
||||
lu_byte isloop; /* true if `block' is a loop */
|
||||
lu_byte isloop; /* true if 'block' is a loop */
|
||||
} BlockCnt;
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ static void expr (LexState *ls, expdesc *v);
|
||||
|
||||
/* semantic error */
|
||||
static l_noret semerror (LexState *ls, const char *msg) {
|
||||
ls->t.token = 0; /* remove 'near to' from final message */
|
||||
ls->t.token = 0; /* remove "near <token>" from final message */
|
||||
luaX_syntaxerror(ls, msg);
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ static void findgotos (LexState *ls, Labeldesc *lb) {
|
||||
|
||||
|
||||
/*
|
||||
** "export" pending gotos to outer level, to check them against
|
||||
** export pending gotos to outer level, to check them against
|
||||
** outer labels; if the block being exited has upvalues, and
|
||||
** the goto exits the scope of any variable (which can be the
|
||||
** upvalue), close those variables being exited.
|
||||
@ -442,7 +442,7 @@ static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) {
|
||||
|
||||
|
||||
/*
|
||||
** create a label named "break" to resolve break statements
|
||||
** create a label named 'break' to resolve break statements
|
||||
*/
|
||||
static void breaklabel (LexState *ls) {
|
||||
TString *n = luaS_new(ls->L, "break");
|
||||
@ -574,7 +574,7 @@ static void close_func (LexState *ls) {
|
||||
/*
|
||||
** check whether current token is in the follow set of a block.
|
||||
** 'until' closes syntactical blocks, but do not close scope,
|
||||
** so it handled in separate.
|
||||
** so it is handled in separate.
|
||||
*/
|
||||
static int block_follow (LexState *ls, int withuntil) {
|
||||
switch (ls->t.token) {
|
||||
@ -588,7 +588,7 @@ static int block_follow (LexState *ls, int withuntil) {
|
||||
|
||||
|
||||
static void statlist (LexState *ls) {
|
||||
/* statlist -> { stat [`;'] } */
|
||||
/* statlist -> { stat [';'] } */
|
||||
while (!block_follow(ls, 1)) {
|
||||
if (ls->t.token == TK_RETURN) {
|
||||
statement(ls);
|
||||
@ -629,14 +629,14 @@ static void yindex (LexState *ls, expdesc *v) {
|
||||
struct ConsControl {
|
||||
expdesc v; /* last list item read */
|
||||
expdesc *t; /* table descriptor */
|
||||
int nh; /* total number of `record' elements */
|
||||
int nh; /* total number of 'record' elements */
|
||||
int na; /* total number of array elements */
|
||||
int tostore; /* number of array elements pending to be stored */
|
||||
};
|
||||
|
||||
|
||||
static void recfield (LexState *ls, struct ConsControl *cc) {
|
||||
/* recfield -> (NAME | `['exp1`]') = exp1 */
|
||||
/* recfield -> (NAME | '['exp1']') = exp1 */
|
||||
FuncState *fs = ls->fs;
|
||||
int reg = ls->fs->freereg;
|
||||
expdesc key, val;
|
||||
@ -743,12 +743,12 @@ static void constructor (LexState *ls, expdesc *t) {
|
||||
|
||||
|
||||
static void parlist (LexState *ls) {
|
||||
/* parlist -> [ param { `,' param } ] */
|
||||
/* parlist -> [ param { ',' param } ] */
|
||||
FuncState *fs = ls->fs;
|
||||
Proto *f = fs->f;
|
||||
int nparams = 0;
|
||||
f->is_vararg = 0;
|
||||
if (ls->t.token != ')') { /* is `parlist' not empty? */
|
||||
if (ls->t.token != ')') { /* is 'parlist' not empty? */
|
||||
do {
|
||||
switch (ls->t.token) {
|
||||
case TK_NAME: { /* param -> NAME */
|
||||
@ -756,7 +756,7 @@ static void parlist (LexState *ls) {
|
||||
nparams++;
|
||||
break;
|
||||
}
|
||||
case TK_DOTS: { /* param -> `...' */
|
||||
case TK_DOTS: { /* param -> '...' */
|
||||
luaX_next(ls);
|
||||
f->is_vararg = 1;
|
||||
break;
|
||||
@ -772,7 +772,7 @@ static void parlist (LexState *ls) {
|
||||
|
||||
|
||||
static void body (LexState *ls, expdesc *e, int ismethod, int line) {
|
||||
/* body -> `(' parlist `)' block END */
|
||||
/* body -> '(' parlist ')' block END */
|
||||
FuncState new_fs;
|
||||
BlockCnt bl;
|
||||
new_fs.f = addprototype(ls);
|
||||
@ -794,7 +794,7 @@ static void body (LexState *ls, expdesc *e, int ismethod, int line) {
|
||||
|
||||
|
||||
static int explist (LexState *ls, expdesc *v) {
|
||||
/* explist -> expr { `,' expr } */
|
||||
/* explist -> expr { ',' expr } */
|
||||
int n = 1; /* at least one expression */
|
||||
expr(ls, v);
|
||||
while (testnext(ls, ',')) {
|
||||
@ -811,7 +811,7 @@ static void funcargs (LexState *ls, expdesc *f, int line) {
|
||||
expdesc args;
|
||||
int base, nparams;
|
||||
switch (ls->t.token) {
|
||||
case '(': { /* funcargs -> `(' [ explist ] `)' */
|
||||
case '(': { /* funcargs -> '(' [ explist ] ')' */
|
||||
luaX_next(ls);
|
||||
if (ls->t.token == ')') /* arg list is empty? */
|
||||
args.k = VVOID;
|
||||
@ -828,7 +828,7 @@ static void funcargs (LexState *ls, expdesc *f, int line) {
|
||||
}
|
||||
case TK_STRING: { /* funcargs -> STRING */
|
||||
codestring(ls, &args, ls->t.seminfo.ts);
|
||||
luaX_next(ls); /* must use `seminfo' before `next' */
|
||||
luaX_next(ls); /* must use 'seminfo' before 'next' */
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@ -894,14 +894,14 @@ static void suffixedexp (LexState *ls, expdesc *v) {
|
||||
fieldsel(ls, v);
|
||||
break;
|
||||
}
|
||||
case '[': { /* `[' exp1 `]' */
|
||||
case '[': { /* '[' exp1 ']' */
|
||||
expdesc key;
|
||||
luaK_exp2anyregup(fs, v);
|
||||
yindex(ls, &key);
|
||||
luaK_indexed(fs, v, &key);
|
||||
break;
|
||||
}
|
||||
case ':': { /* `:' NAME funcargs */
|
||||
case ':': { /* ':' NAME funcargs */
|
||||
expdesc key;
|
||||
luaX_next(ls);
|
||||
checkname(ls, &key);
|
||||
@ -1035,7 +1035,7 @@ static const struct {
|
||||
|
||||
/*
|
||||
** subexpr -> (simpleexp | unop subexpr) { binop subexpr }
|
||||
** where `binop' is any binary operator with a priority higher than `limit'
|
||||
** where 'binop' is any binary operator with a priority higher than 'limit'
|
||||
*/
|
||||
static BinOpr subexpr (LexState *ls, expdesc *v, int limit) {
|
||||
BinOpr op;
|
||||
@ -1049,7 +1049,7 @@ static BinOpr subexpr (LexState *ls, expdesc *v, int limit) {
|
||||
luaK_prefix(ls->fs, uop, v, line);
|
||||
}
|
||||
else simpleexp(ls, v);
|
||||
/* expand while operators have priorities higher than `limit' */
|
||||
/* expand while operators have priorities higher than 'limit' */
|
||||
op = getbinopr(ls->t.token);
|
||||
while (op != OPR_NOBINOPR && priority[op].left > limit) {
|
||||
expdesc v2;
|
||||
@ -1149,7 +1149,7 @@ static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
|
||||
"C levels");
|
||||
assignment(ls, &nv, nvars+1);
|
||||
}
|
||||
else { /* assignment -> `=' explist */
|
||||
else { /* assignment -> '=' explist */
|
||||
int nexps;
|
||||
checknext(ls, '=');
|
||||
nexps = explist(ls, &e);
|
||||
@ -1173,7 +1173,7 @@ static int cond (LexState *ls) {
|
||||
/* cond -> exp */
|
||||
expdesc v;
|
||||
expr(ls, &v); /* read condition */
|
||||
if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */
|
||||
if (v.k == VNIL) v.k = VFALSE; /* 'falses' are all equal here */
|
||||
luaK_goiftrue(ls->fs, &v);
|
||||
return v.f;
|
||||
}
|
||||
@ -1362,7 +1362,7 @@ static void forstat (LexState *ls, int line) {
|
||||
TString *varname;
|
||||
BlockCnt bl;
|
||||
enterblock(fs, &bl, 1); /* scope for loop and control variables */
|
||||
luaX_next(ls); /* skip `for' */
|
||||
luaX_next(ls); /* skip 'for' */
|
||||
varname = str_checkname(ls); /* first variable name */
|
||||
switch (ls->t.token) {
|
||||
case '=': fornum(ls, varname, line); break;
|
||||
@ -1370,7 +1370,7 @@ static void forstat (LexState *ls, int line) {
|
||||
default: luaX_syntaxerror(ls, "'=' or 'in' expected");
|
||||
}
|
||||
check_match(ls, TK_END, TK_FOR, line);
|
||||
leaveblock(fs); /* loop scope (`break' jumps to this point) */
|
||||
leaveblock(fs); /* loop scope ('break' jumps to this point) */
|
||||
}
|
||||
|
||||
|
||||
@ -1400,7 +1400,7 @@ static void test_then_block (LexState *ls, int *escapelist) {
|
||||
enterblock(fs, &bl, 0);
|
||||
jf = v.f;
|
||||
}
|
||||
statlist(ls); /* `then' part */
|
||||
statlist(ls); /* 'then' part */
|
||||
leaveblock(fs);
|
||||
if (ls->t.token == TK_ELSE ||
|
||||
ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */
|
||||
@ -1417,7 +1417,7 @@ static void ifstat (LexState *ls, int line) {
|
||||
while (ls->t.token == TK_ELSEIF)
|
||||
test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */
|
||||
if (testnext(ls, TK_ELSE))
|
||||
block(ls); /* `else' part */
|
||||
block(ls); /* 'else' part */
|
||||
check_match(ls, TK_END, TK_IF, line);
|
||||
luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */
|
||||
}
|
||||
@ -1435,7 +1435,7 @@ static void localfunc (LexState *ls) {
|
||||
|
||||
|
||||
static void localstat (LexState *ls) {
|
||||
/* stat -> LOCAL NAME {`,' NAME} [`=' explist] */
|
||||
/* stat -> LOCAL NAME {',' NAME} ['=' explist] */
|
||||
int nvars = 0;
|
||||
int nexps;
|
||||
expdesc e;
|
||||
@ -1455,7 +1455,7 @@ static void localstat (LexState *ls) {
|
||||
|
||||
|
||||
static int funcname (LexState *ls, expdesc *v) {
|
||||
/* funcname -> NAME {fieldsel} [`:' NAME] */
|
||||
/* funcname -> NAME {fieldsel} [':' NAME] */
|
||||
int ismethod = 0;
|
||||
singlevar(ls, v);
|
||||
while (ls->t.token == '.')
|
||||
@ -1476,7 +1476,7 @@ static void funcstat (LexState *ls, int line) {
|
||||
ismethod = funcname(ls, &v);
|
||||
body(ls, &b, ismethod, line);
|
||||
luaK_storevar(ls->fs, &v, &b);
|
||||
luaK_fixline(ls->fs, line); /* definition `happens' in the first line */
|
||||
luaK_fixline(ls->fs, line); /* definition "happens" in the first line */
|
||||
}
|
||||
|
||||
|
||||
@ -1518,8 +1518,8 @@ static void retstat (LexState *ls) {
|
||||
if (nret == 1) /* only one single value? */
|
||||
first = luaK_exp2anyreg(fs, &e);
|
||||
else {
|
||||
luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */
|
||||
first = fs->nactvar; /* return all `active' values */
|
||||
luaK_exp2nextreg(fs, &e); /* values must go to the stack */
|
||||
first = fs->nactvar; /* return all active values */
|
||||
lua_assert(nret == fs->freereg - first);
|
||||
}
|
||||
}
|
||||
|
16
lparser.h
16
lparser.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lparser.h,v 1.72 2013/08/30 16:01:37 roberto Exp roberto $
|
||||
** $Id: lparser.h,v 1.73 2014/06/19 18:27:20 roberto Exp roberto $
|
||||
** Lua Parser
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -21,7 +21,7 @@ typedef enum {
|
||||
VNIL,
|
||||
VTRUE,
|
||||
VFALSE,
|
||||
VK, /* info = index of constant in `k' */
|
||||
VK, /* info = index of constant in 'k' */
|
||||
VKFLT, /* nval = numerical float value */
|
||||
VKINT, /* nval = numerical integer value */
|
||||
VNONRELOC, /* info = result register */
|
||||
@ -50,8 +50,8 @@ typedef struct expdesc {
|
||||
lua_Number nval; /* for VKFLT */
|
||||
lua_Integer ival; /* for VKINT */
|
||||
} u;
|
||||
int t; /* patch list of `exit when true' */
|
||||
int f; /* patch list of `exit when false' */
|
||||
int t; /* patch list of 'exit when true' */
|
||||
int f; /* patch list of 'exit when false' */
|
||||
} expdesc;
|
||||
|
||||
|
||||
@ -100,11 +100,11 @@ typedef struct FuncState {
|
||||
struct FuncState *prev; /* enclosing function */
|
||||
struct LexState *ls; /* lexical state */
|
||||
struct BlockCnt *bl; /* chain of current blocks */
|
||||
int pc; /* next position to code (equivalent to `ncode') */
|
||||
int pc; /* next position to code (equivalent to 'ncode') */
|
||||
int lasttarget; /* 'label' of last 'jump label' */
|
||||
int jpc; /* list of pending jumps to `pc' */
|
||||
int nk; /* number of elements in `k' */
|
||||
int np; /* number of elements in `p' */
|
||||
int jpc; /* list of pending jumps to 'pc' */
|
||||
int nk; /* number of elements in 'k' */
|
||||
int np; /* number of elements in 'p' */
|
||||
int firstlocal; /* index of first local var (in Dyndata array) */
|
||||
short nlocvars; /* number of elements in 'f->locvars' */
|
||||
lu_byte nactvar; /* number of active local variables */
|
||||
|
10
lstate.h
10
lstate.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lstate.h,v 2.116 2014/10/06 21:34:34 roberto Exp roberto $
|
||||
** $Id: lstate.h,v 2.117 2014/10/07 18:29:13 roberto Exp roberto $
|
||||
** Global State
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -103,11 +103,11 @@ typedef struct CallInfo {
|
||||
|
||||
|
||||
/*
|
||||
** `global state', shared by all threads of this state
|
||||
** 'global state', shared by all threads of this state
|
||||
*/
|
||||
typedef struct global_State {
|
||||
lua_Alloc frealloc; /* function to reallocate memory */
|
||||
void *ud; /* auxiliary data to `frealloc' */
|
||||
void *ud; /* auxiliary data to 'frealloc' */
|
||||
lu_mem totalbytes; /* number of bytes currently allocated - GCdebt */
|
||||
l_mem GCdebt; /* bytes allocated not yet compensated by the collector */
|
||||
lu_mem GCmemtrav; /* memory traversed by the GC */
|
||||
@ -133,7 +133,7 @@ typedef struct global_State {
|
||||
Mbuffer buff; /* temporary buffer for string concatenation */
|
||||
unsigned int gcfinnum; /* number of finalizers to call in each GC step */
|
||||
int gcpause; /* size of pause between successive GCs */
|
||||
int gcstepmul; /* GC `granularity' */
|
||||
int gcstepmul; /* GC 'granularity' */
|
||||
lua_CFunction panic; /* to be called in unprotected errors */
|
||||
struct lua_State *mainthread;
|
||||
const lua_Number *version; /* pointer to version number */
|
||||
@ -144,7 +144,7 @@ typedef struct global_State {
|
||||
|
||||
|
||||
/*
|
||||
** `per thread' state
|
||||
** 'per thread' state
|
||||
*/
|
||||
struct lua_State {
|
||||
CommonHeader;
|
||||
|
26
lstrlib.c
26
lstrlib.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lstrlib.c,v 1.205 2014/10/20 16:44:54 roberto Exp roberto $
|
||||
** $Id: lstrlib.c,v 1.206 2014/10/24 11:42:29 roberto Exp roberto $
|
||||
** Standard library for string operations and pattern-matching
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -30,7 +30,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* macro to `unsign' a character */
|
||||
/* macro to 'unsign' a character */
|
||||
#define uchar(c) ((unsigned char)(c))
|
||||
|
||||
|
||||
@ -255,11 +255,11 @@ static const char *classend (MatchState *ms, const char *p) {
|
||||
}
|
||||
case '[': {
|
||||
if (*p == '^') p++;
|
||||
do { /* look for a `]' */
|
||||
do { /* look for a ']' */
|
||||
if (p == ms->p_end)
|
||||
luaL_error(ms->L, "malformed pattern (missing ']')");
|
||||
if (*(p++) == L_ESC && p < ms->p_end)
|
||||
p++; /* skip escapes (e.g. `%]') */
|
||||
p++; /* skip escapes (e.g. '%]') */
|
||||
} while (*p != ']');
|
||||
return p+1;
|
||||
}
|
||||
@ -294,7 +294,7 @@ static int matchbracketclass (int c, const char *p, const char *ec) {
|
||||
int sig = 1;
|
||||
if (*(p+1) == '^') {
|
||||
sig = 0;
|
||||
p++; /* skip the `^' */
|
||||
p++; /* skip the '^' */
|
||||
}
|
||||
while (++p < ec) {
|
||||
if (*p == L_ESC) {
|
||||
@ -431,7 +431,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
|
||||
break;
|
||||
}
|
||||
case '$': {
|
||||
if ((p + 1) != ms->p_end) /* is the `$' the last char in pattern? */
|
||||
if ((p + 1) != ms->p_end) /* is the '$' the last char in pattern? */
|
||||
goto dflt; /* no; go to default */
|
||||
s = (s == ms->src_end) ? s : NULL; /* check end of string */
|
||||
break;
|
||||
@ -519,16 +519,16 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
|
||||
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' */
|
||||
else if (l2 > l1) return NULL; /* avoids a negative 'l1' */
|
||||
else {
|
||||
const char *init; /* to search for a `*s2' inside `s1' */
|
||||
l2--; /* 1st char will be checked by `memchr' */
|
||||
l1 = l1-l2; /* `s2' cannot be found after that */
|
||||
const char *init; /* to search for a '*s2' inside 's1' */
|
||||
l2--; /* 1st char will be checked by 'memchr' */
|
||||
l1 = l1-l2; /* 's2' cannot be found after that */
|
||||
while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) {
|
||||
init++; /* 1st char is already checked */
|
||||
if (memcmp(init, s2+1, l2) == 0)
|
||||
return init-1;
|
||||
else { /* correct `l1' and `s1' to try again */
|
||||
else { /* correct 'l1' and 's1' to try again */
|
||||
l1 -= init-s1;
|
||||
s1 = init;
|
||||
}
|
||||
@ -879,7 +879,7 @@ static int str_format (lua_State *L) {
|
||||
else if (*++strfrmt == L_ESC)
|
||||
luaL_addchar(&b, *strfrmt++); /* %% */
|
||||
else { /* format item */
|
||||
char form[MAX_FORMAT]; /* to store the format (`%...') */
|
||||
char form[MAX_FORMAT]; /* to store the format ('%...') */
|
||||
char *buff = luaL_prepbuffsize(&b, MAX_ITEM); /* to put formatted item */
|
||||
int nb = 0; /* number of bytes in added item */
|
||||
if (++arg > top)
|
||||
@ -925,7 +925,7 @@ static int str_format (lua_State *L) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
default: { /* also treat cases `pnLlh' */
|
||||
default: { /* also treat cases 'pnLlh' */
|
||||
return luaL_error(L, "invalid option '%%%c' to 'format'",
|
||||
*(strfrmt - 1));
|
||||
}
|
||||
|
36
ltable.c
36
ltable.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltable.c,v 2.96 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** $Id: ltable.c,v 2.97 2014/10/24 11:42:06 roberto Exp roberto $
|
||||
** Lua tables (hash)
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -9,11 +9,11 @@
|
||||
** Implementation of tables (aka arrays, objects, or hash tables).
|
||||
** Tables keep its elements in two parts: an array part and a hash part.
|
||||
** Non-negative integer keys are all candidates to be kept in the array
|
||||
** part. The actual size of the array is the largest `n' such that at
|
||||
** part. The actual size of the array is the largest 'n' such that at
|
||||
** least half the slots between 0 and n are in use.
|
||||
** Hash uses a mix of chained scatter table with Brent's variation.
|
||||
** A main invariant of these tables is that, if an element is not
|
||||
** in its main position (i.e. the `original' position that its hash gives
|
||||
** in its main position (i.e. the 'original' position that its hash gives
|
||||
** to it), then the colliding element is in its own main position.
|
||||
** Hence even when the load factor reaches 100%, performance remains good.
|
||||
*/
|
||||
@ -111,7 +111,7 @@ static Node *hashfloat (const Table *t, lua_Number n) {
|
||||
|
||||
|
||||
/*
|
||||
** returns the `main' position of an element in a table (that is, the index
|
||||
** returns the 'main' position of an element in a table (that is, the index
|
||||
** of its hash value)
|
||||
*/
|
||||
static Node *mainposition (const Table *t, const TValue *key) {
|
||||
@ -143,7 +143,7 @@ static Node *mainposition (const Table *t, const TValue *key) {
|
||||
|
||||
|
||||
/*
|
||||
** returns the index for `key' if `key' is an appropriate key to live in
|
||||
** returns the index for 'key' if 'key' is an appropriate key to live in
|
||||
** the array part of the table, 0 otherwise.
|
||||
*/
|
||||
static unsigned int arrayindex (const TValue *key) {
|
||||
@ -152,12 +152,12 @@ static unsigned int arrayindex (const TValue *key) {
|
||||
if (0 < k && (lua_Unsigned)k <= MAXASIZE)
|
||||
return cast(unsigned int, k); /* 'key' is an appropriate array index */
|
||||
}
|
||||
return 0; /* `key' did not match some condition */
|
||||
return 0; /* 'key' did not match some condition */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** returns the index of a `key' for table traversals. First goes all
|
||||
** returns the index of a 'key' for table traversals. First goes all
|
||||
** elements in the array part, then elements in the hash part. The
|
||||
** beginning of a traversal is signaled by 0.
|
||||
*/
|
||||
@ -165,13 +165,13 @@ static unsigned int findindex (lua_State *L, Table *t, StkId key) {
|
||||
unsigned int i;
|
||||
if (ttisnil(key)) return 0; /* first iteration */
|
||||
i = arrayindex(key);
|
||||
if (i != 0 && i <= t->sizearray) /* is `key' inside array part? */
|
||||
if (i != 0 && i <= t->sizearray) /* is 'key' inside array part? */
|
||||
return i; /* yes; that's the index */
|
||||
else {
|
||||
int nx;
|
||||
Node *n = mainposition(t, key);
|
||||
for (;;) { /* check whether `key' is somewhere in the chain */
|
||||
/* key may be dead already, but it is ok to use it in `next' */
|
||||
for (;;) { /* check whether 'key' is somewhere in the chain */
|
||||
/* key may be dead already, but it is ok to use it in 'next' */
|
||||
if (luaV_rawequalobj(gkey(n), key) ||
|
||||
(ttisdeadkey(gkey(n)) && iscollectable(key) &&
|
||||
deadvalue(gkey(n)) == gcvalue(key))) {
|
||||
@ -244,7 +244,7 @@ static unsigned int computesizes (unsigned int nums[], unsigned int *narray) {
|
||||
|
||||
static int countint (const TValue *key, unsigned int *nums) {
|
||||
unsigned int k = arrayindex(key);
|
||||
if (k != 0) { /* is `key' an appropriate array index? */
|
||||
if (k != 0) { /* is 'key' an appropriate array index? */
|
||||
nums[luaO_ceillog2(k)]++; /* count as such */
|
||||
return 1;
|
||||
}
|
||||
@ -256,7 +256,7 @@ static int countint (const TValue *key, unsigned int *nums) {
|
||||
static unsigned int numusearray (const Table *t, unsigned int *nums) {
|
||||
int lg;
|
||||
unsigned int ttlg; /* 2^lg */
|
||||
unsigned int ause = 0; /* summation of `nums' */
|
||||
unsigned int ause = 0; /* summation of 'nums' */
|
||||
unsigned int i = 1; /* count to traverse all array keys */
|
||||
/* traverse each slice */
|
||||
for (lg = 0, ttlg = 1; lg <= MAXABITS; lg++, ttlg *= 2) {
|
||||
@ -308,7 +308,7 @@ static void setarrayvector (lua_State *L, Table *t, unsigned int size) {
|
||||
static void setnodevector (lua_State *L, Table *t, unsigned int size) {
|
||||
int lsize;
|
||||
if (size == 0) { /* no elements to hash part? */
|
||||
t->node = cast(Node *, dummynode); /* use common `dummynode' */
|
||||
t->node = cast(Node *, dummynode); /* use common 'dummynode' */
|
||||
lsize = 0;
|
||||
}
|
||||
else {
|
||||
@ -498,7 +498,7 @@ const TValue *luaH_getint (Table *t, lua_Integer key) {
|
||||
return &t->array[key - 1];
|
||||
else {
|
||||
Node *n = hashint(t, key);
|
||||
for (;;) { /* check whether `key' is somewhere in the chain */
|
||||
for (;;) { /* check whether 'key' is somewhere in the chain */
|
||||
if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key)
|
||||
return gval(n); /* that's it */
|
||||
else {
|
||||
@ -518,7 +518,7 @@ const TValue *luaH_getint (Table *t, lua_Integer key) {
|
||||
const TValue *luaH_getstr (Table *t, TString *key) {
|
||||
Node *n = hashstr(t, key);
|
||||
lua_assert(key->tt == LUA_TSHRSTR);
|
||||
for (;;) { /* check whether `key' is somewhere in the chain */
|
||||
for (;;) { /* check whether 'key' is somewhere in the chain */
|
||||
const TValue *k = gkey(n);
|
||||
if (ttisshrstring(k) && eqshrstr(tsvalue(k), key))
|
||||
return gval(n); /* that's it */
|
||||
@ -548,7 +548,7 @@ const TValue *luaH_get (Table *t, const TValue *key) {
|
||||
}
|
||||
default: {
|
||||
Node *n = mainposition(t, key);
|
||||
for (;;) { /* check whether `key' is somewhere in the chain */
|
||||
for (;;) { /* check whether 'key' is somewhere in the chain */
|
||||
if (luaV_rawequalobj(gkey(n), key))
|
||||
return gval(n); /* that's it */
|
||||
else {
|
||||
@ -592,7 +592,7 @@ void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) {
|
||||
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 */
|
||||
/* find 'i' and 'j' such that i is present and j is not */
|
||||
while (!ttisnil(luaH_getint(t, j))) {
|
||||
i = j;
|
||||
if (j > cast(unsigned int, MAX_INT)/2) { /* overflow? */
|
||||
@ -614,7 +614,7 @@ static int unbound_search (Table *t, unsigned int j) {
|
||||
|
||||
|
||||
/*
|
||||
** Try to find a boundary in table `t'. A `boundary' is an integer index
|
||||
** 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 luaH_getn (Table *t) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltablib.c,v 1.76 2014/09/22 06:42:15 roberto Exp roberto $
|
||||
** $Id: ltablib.c,v 1.77 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** Library for Table Manipulation
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -225,7 +225,7 @@ static int unpack (lua_State *L) {
|
||||
/*
|
||||
** {======================================================
|
||||
** Quicksort
|
||||
** (based on `Algorithms in MODULA-3', Robert Sedgewick;
|
||||
** (based on 'Algorithms in MODULA-3', Robert Sedgewick;
|
||||
** Addison-Wesley, 1993.)
|
||||
** =======================================================
|
||||
*/
|
||||
@ -241,7 +241,7 @@ static int sort_comp (lua_State *L, int a, int b) {
|
||||
int res;
|
||||
lua_pushvalue(L, 2);
|
||||
lua_pushvalue(L, a-1); /* -1 to compensate function */
|
||||
lua_pushvalue(L, b-2); /* -2 to compensate function and `a' */
|
||||
lua_pushvalue(L, b-2); /* -2 to compensate function and 'a' */
|
||||
lua_call(L, 2, 1);
|
||||
res = lua_toboolean(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
4
ltests.c
4
ltests.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltests.c,v 2.187 2014/10/06 17:06:49 roberto Exp roberto $
|
||||
** $Id: ltests.c,v 2.188 2014/10/07 18:29:13 roberto Exp roberto $
|
||||
** Internal Module for Debugging of the Lua Implementation
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -152,7 +152,7 @@ void *debug_realloc (void *ud, void *b, size_t oldsize, size_t size) {
|
||||
memcpy(newblock + 1, block + 1, commonsize); /* copy old contents */
|
||||
freeblock(mc, block); /* erase (and check) old copy */
|
||||
}
|
||||
/* initialize new part of the block with something `weird' */
|
||||
/* initialize new part of the block with something weird */
|
||||
fillmem(cast(char *, newblock + 1) + commonsize, size - commonsize);
|
||||
/* initialize marks after block */
|
||||
for (i = 0; i < MARKSIZE; i++)
|
||||
|
4
ltm.h
4
ltm.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltm.h,v 2.19 2013/12/30 20:47:58 roberto Exp roberto $
|
||||
** $Id: ltm.h,v 2.20 2014/06/10 18:53:18 roberto Exp roberto $
|
||||
** Tag methods
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -21,7 +21,7 @@ typedef enum {
|
||||
TM_GC,
|
||||
TM_MODE,
|
||||
TM_LEN,
|
||||
TM_EQ, /* last tag method with `fast' access */
|
||||
TM_EQ, /* last tag method with fast access */
|
||||
TM_ADD,
|
||||
TM_SUB,
|
||||
TM_MUL,
|
||||
|
18
lvm.c
18
lvm.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 2.224 2014/10/17 16:28:21 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 2.225 2014/10/24 11:42:06 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -158,7 +158,7 @@ void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
||||
int loop; /* counter to avoid infinite loops */
|
||||
for (loop = 0; loop < MAXTAGLOOP; loop++) {
|
||||
const TValue *tm;
|
||||
if (ttistable(t)) { /* `t' is a table? */
|
||||
if (ttistable(t)) { /* 't' is a table? */
|
||||
Table *h = hvalue(t);
|
||||
const TValue *res = luaH_get(h, key); /* do a primitive get */
|
||||
if (!ttisnil(res) || /* result is not nil? */
|
||||
@ -188,7 +188,7 @@ void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
||||
int loop; /* counter to avoid infinite loops */
|
||||
for (loop = 0; loop < MAXTAGLOOP; loop++) {
|
||||
const TValue *tm;
|
||||
if (ttistable(t)) { /* `t' is a table? */
|
||||
if (ttistable(t)) { /* 't' is a table? */
|
||||
Table *h = hvalue(t);
|
||||
TValue *oldval = cast(TValue *, luaH_get(h, key));
|
||||
/* if previous value is not nil, there must be a previous entry
|
||||
@ -240,12 +240,12 @@ static int l_strcmp (const TString *ls, const TString *rs) {
|
||||
if (temp != 0) /* not equal? */
|
||||
return temp; /* done */
|
||||
else { /* strings are equal up to a '\0' */
|
||||
size_t len = strlen(l); /* index of first `\0' in both strings */
|
||||
size_t len = strlen(l); /* index of first '\0' in both strings */
|
||||
if (len == lr) /* 'rs' is finished? */
|
||||
return (len == ll) ? 0 : 1; /* check 'ls' */
|
||||
else if (len == ll) /* 'ls' is finished? */
|
||||
return -1; /* 'ls' is smaller than 'rs' ('rs' is not finished) */
|
||||
/* both strings longer than `len'; go on comparing after the '\0' */
|
||||
/* both strings longer than 'len'; go on comparing after the '\0' */
|
||||
len++;
|
||||
l += len; ll -= len; r += len; lr -= len;
|
||||
}
|
||||
@ -283,9 +283,9 @@ int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) {
|
||||
return luai_numle(nl, nr);
|
||||
else if (ttisstring(l) && ttisstring(r)) /* both are strings? */
|
||||
return l_strcmp(tsvalue(l), tsvalue(r)) <= 0;
|
||||
else if ((res = luaT_callorderTM(L, l, r, TM_LE)) >= 0) /* first try `le' */
|
||||
else if ((res = luaT_callorderTM(L, l, r, TM_LE)) >= 0) /* first try 'le' */
|
||||
return res;
|
||||
else if ((res = luaT_callorderTM(L, r, l, TM_LT)) < 0) /* else try `lt' */
|
||||
else if ((res = luaT_callorderTM(L, r, l, TM_LT)) < 0) /* else try 'lt' */
|
||||
luaG_ordererror(L, l, r);
|
||||
return !res;
|
||||
}
|
||||
@ -596,7 +596,7 @@ void luaV_finishOp (lua_State *L) {
|
||||
|
||||
|
||||
/*
|
||||
** some macros for common tasks in `luaV_execute'
|
||||
** some macros for common tasks in 'luaV_execute'
|
||||
*/
|
||||
|
||||
#if !defined luai_runtimecheck
|
||||
@ -657,7 +657,7 @@ void luaV_execute (lua_State *L) {
|
||||
(--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
|
||||
Protect(luaG_traceexec(L));
|
||||
}
|
||||
/* WARNING: several calls may realloc the stack and invalidate `ra' */
|
||||
/* WARNING: several calls may realloc the stack and invalidate 'ra' */
|
||||
ra = RA(i);
|
||||
lua_assert(base == ci->u.l.base);
|
||||
lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
|
||||
|
Loading…
Reference in New Issue
Block a user