diff options
-rw-r--r-- | lapi.c | 10 | ||||
-rw-r--r-- | lauxlib.c | 10 | ||||
-rw-r--r-- | lauxlib.h | 4 | ||||
-rw-r--r-- | lbaselib.c | 4 | ||||
-rw-r--r-- | lcode.c | 16 | ||||
-rw-r--r-- | lcorolib.c | 4 | ||||
-rw-r--r-- | ldebug.c | 4 | ||||
-rw-r--r-- | ldo.c | 8 | ||||
-rw-r--r-- | ldo.h | 4 | ||||
-rw-r--r-- | lfunc.c | 6 | ||||
-rw-r--r-- | lgc.c | 8 | ||||
-rw-r--r-- | lgc.h | 4 | ||||
-rw-r--r-- | liolib.c | 4 | ||||
-rw-r--r-- | llex.c | 14 | ||||
-rw-r--r-- | llex.h | 4 | ||||
-rw-r--r-- | llimits.h | 6 | ||||
-rw-r--r-- | lmem.c | 8 | ||||
-rw-r--r-- | loadlib.c | 10 | ||||
-rw-r--r-- | lobject.c | 4 | ||||
-rw-r--r-- | lobject.h | 14 | ||||
-rw-r--r-- | lopcodes.h | 28 | ||||
-rw-r--r-- | loslib.c | 4 | ||||
-rw-r--r-- | lparser.c | 62 | ||||
-rw-r--r-- | lparser.h | 16 | ||||
-rw-r--r-- | lstate.h | 10 | ||||
-rw-r--r-- | lstrlib.c | 26 | ||||
-rw-r--r-- | ltable.c | 36 | ||||
-rw-r--r-- | ltablib.c | 6 | ||||
-rw-r--r-- | ltests.c | 4 | ||||
-rw-r--r-- | ltm.h | 4 | ||||
-rw-r--r-- | lvm.c | 18 |
31 files changed, 180 insertions, 180 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.237 2014/10/15 14:27:40 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.238 2014/10/17 19:17:55 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -178,7 +178,7 @@ LUA_API void lua_settop (lua_State *L, int idx) { | |||
178 | } | 178 | } |
179 | else { | 179 | else { |
180 | api_check(-(idx+1) <= (L->top - (func + 1)), "invalid new top"); | 180 | api_check(-(idx+1) <= (L->top - (func + 1)), "invalid new top"); |
181 | L->top += idx+1; /* `subtract' index (index is negative) */ | 181 | L->top += idx+1; /* 'subtract' index (index is negative) */ |
182 | } | 182 | } |
183 | lua_unlock(L); | 183 | lua_unlock(L); |
184 | } | 184 | } |
@@ -375,7 +375,7 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { | |||
375 | if (len != NULL) *len = 0; | 375 | if (len != NULL) *len = 0; |
376 | return NULL; | 376 | return NULL; |
377 | } | 377 | } |
378 | lua_lock(L); /* `luaO_tostring' may create a new string */ | 378 | lua_lock(L); /* 'luaO_tostring' may create a new string */ |
379 | luaC_checkGC(L); | 379 | luaC_checkGC(L); |
380 | o = index2addr(L, idx); /* previous call may reallocate the stack */ | 380 | o = index2addr(L, idx); /* previous call may reallocate the stack */ |
381 | luaO_tostring(L, o); | 381 | luaO_tostring(L, o); |
@@ -867,7 +867,7 @@ LUA_API void lua_setuservalue (lua_State *L, int idx) { | |||
867 | 867 | ||
868 | 868 | ||
869 | /* | 869 | /* |
870 | ** `load' and `call' functions (run Lua code) | 870 | ** 'load' and 'call' functions (run Lua code) |
871 | */ | 871 | */ |
872 | 872 | ||
873 | 873 | ||
@@ -902,7 +902,7 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults, | |||
902 | /* | 902 | /* |
903 | ** Execute a protected call. | 903 | ** Execute a protected call. |
904 | */ | 904 | */ |
905 | struct CallS { /* data to `f_call' */ | 905 | struct CallS { /* data to 'f_call' */ |
906 | StkId func; | 906 | StkId func; |
907 | int nresults; | 907 | int nresults; |
908 | }; | 908 | }; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.269 2014/10/17 16:28:21 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.270 2014/10/22 11:44:20 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -156,7 +156,7 @@ LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) { | |||
156 | return luaL_error(L, "bad argument #%d (%s)", arg, extramsg); | 156 | return luaL_error(L, "bad argument #%d (%s)", arg, extramsg); |
157 | lua_getinfo(L, "n", &ar); | 157 | lua_getinfo(L, "n", &ar); |
158 | if (strcmp(ar.namewhat, "method") == 0) { | 158 | if (strcmp(ar.namewhat, "method") == 0) { |
159 | arg--; /* do not count `self' */ | 159 | arg--; /* do not count 'self' */ |
160 | if (arg == 0) /* error is in the self argument itself? */ | 160 | if (arg == 0) /* error is in the self argument itself? */ |
161 | return luaL_error(L, "calling '%s' on bad self (%s)", | 161 | return luaL_error(L, "calling '%s' on bad self (%s)", |
162 | ar.name, extramsg); | 162 | ar.name, extramsg); |
@@ -526,7 +526,7 @@ LUALIB_API int luaL_ref (lua_State *L, int t) { | |||
526 | int ref; | 526 | int ref; |
527 | if (lua_isnil(L, -1)) { | 527 | if (lua_isnil(L, -1)) { |
528 | lua_pop(L, 1); /* remove from stack */ | 528 | lua_pop(L, 1); /* remove from stack */ |
529 | return LUA_REFNIL; /* `nil' has a unique fixed reference */ | 529 | return LUA_REFNIL; /* 'nil' has a unique fixed reference */ |
530 | } | 530 | } |
531 | t = lua_absindex(L, t); | 531 | t = lua_absindex(L, t); |
532 | lua_rawgeti(L, t, freelist); /* get first free element */ | 532 | lua_rawgeti(L, t, freelist); /* get first free element */ |
@@ -658,7 +658,7 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, | |||
658 | readstatus = ferror(lf.f); | 658 | readstatus = ferror(lf.f); |
659 | if (filename) fclose(lf.f); /* close file (even in case of errors) */ | 659 | if (filename) fclose(lf.f); /* close file (even in case of errors) */ |
660 | if (readstatus) { | 660 | if (readstatus) { |
661 | lua_settop(L, fnameindex); /* ignore results from `lua_load' */ | 661 | lua_settop(L, fnameindex); /* ignore results from 'lua_load' */ |
662 | return errfile(L, "read", fnameindex); | 662 | return errfile(L, "read", fnameindex); |
663 | } | 663 | } |
664 | lua_remove(L, fnameindex); | 664 | lua_remove(L, fnameindex); |
@@ -918,7 +918,7 @@ LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, | |||
918 | while ((wild = strstr(s, p)) != NULL) { | 918 | while ((wild = strstr(s, p)) != NULL) { |
919 | luaL_addlstring(&b, s, wild - s); /* push prefix */ | 919 | luaL_addlstring(&b, s, wild - s); /* push prefix */ |
920 | luaL_addstring(&b, r); /* push replacement in place of pattern */ | 920 | luaL_addstring(&b, r); /* push replacement in place of pattern */ |
921 | s = wild + l; /* continue after `p' */ | 921 | s = wild + l; /* continue after 'p' */ |
922 | } | 922 | } |
923 | luaL_addstring(&b, s); /* push last suffix */ | 923 | luaL_addstring(&b, s); /* push last suffix */ |
924 | luaL_pushresult(&b); | 924 | luaL_pushresult(&b); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.h,v 1.125 2014/06/26 17:25:11 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.126 2014/10/01 11:54:56 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | 17 | ||
18 | 18 | ||
19 | /* extra error code for `luaL_load' */ | 19 | /* extra error code for 'luaL_load' */ |
20 | #define LUA_ERRFILE (LUA_ERRERR+1) | 20 | #define LUA_ERRFILE (LUA_ERRERR+1) |
21 | 21 | ||
22 | 22 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.302 2014/10/17 16:28:21 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.303 2014/10/17 19:17:55 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -325,7 +325,7 @@ static int luaB_loadfile (lua_State *L) { | |||
325 | 325 | ||
326 | 326 | ||
327 | /* | 327 | /* |
328 | ** Reader for generic `load' function: `lua_load' uses the | 328 | ** Reader for generic 'load' function: 'lua_load' uses the |
329 | ** stack for internal stuff, so the reader cannot change the | 329 | ** stack for internal stuff, so the reader cannot change the |
330 | ** stack top. Instead, it keeps its resulting string in a | 330 | ** stack top. Instead, it keeps its resulting string in a |
331 | ** reserved slot inside the stack. | 331 | ** reserved slot inside the stack. |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.89 2014/04/29 18:14:16 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.90 2014/05/08 18:58:46 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -107,7 +107,7 @@ static void fixjump (FuncState *fs, int pc, int dest) { | |||
107 | 107 | ||
108 | 108 | ||
109 | /* | 109 | /* |
110 | ** returns current `pc' and marks it as a jump target (to avoid wrong | 110 | ** returns current 'pc' and marks it as a jump target (to avoid wrong |
111 | ** optimizations with consecutive instructions not in the same basic block). | 111 | ** optimizations with consecutive instructions not in the same basic block). |
112 | */ | 112 | */ |
113 | int luaK_getlabel (FuncState *fs) { | 113 | int luaK_getlabel (FuncState *fs) { |
@@ -230,7 +230,7 @@ void luaK_concat (FuncState *fs, int *l1, int l2) { | |||
230 | 230 | ||
231 | static int luaK_code (FuncState *fs, Instruction i) { | 231 | static int luaK_code (FuncState *fs, Instruction i) { |
232 | Proto *f = fs->f; | 232 | Proto *f = fs->f; |
233 | dischargejpc(fs); /* `pc' will change */ | 233 | dischargejpc(fs); /* 'pc' will change */ |
234 | /* put new instruction in code array */ | 234 | /* put new instruction in code array */ |
235 | luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, | 235 | luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, |
236 | MAX_INT, "opcodes"); | 236 | MAX_INT, "opcodes"); |
@@ -503,7 +503,7 @@ static void discharge2anyreg (FuncState *fs, expdesc *e) { | |||
503 | static void exp2reg (FuncState *fs, expdesc *e, int reg) { | 503 | static void exp2reg (FuncState *fs, expdesc *e, int reg) { |
504 | discharge2reg(fs, e, reg); | 504 | discharge2reg(fs, e, reg); |
505 | if (e->k == VJMP) | 505 | if (e->k == VJMP) |
506 | luaK_concat(fs, &e->t, e->u.info); /* put this jump in `t' list */ | 506 | luaK_concat(fs, &e->t, e->u.info); /* put this jump in 't' list */ |
507 | if (hasjumps(e)) { | 507 | if (hasjumps(e)) { |
508 | int final; /* position after whole expression */ | 508 | int final; /* position after whole expression */ |
509 | int p_f = NO_JUMP; /* position of an eventual LOAD false */ | 509 | int p_f = NO_JUMP; /* position of an eventual LOAD false */ |
@@ -677,7 +677,7 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) { | |||
677 | break; | 677 | break; |
678 | } | 678 | } |
679 | } | 679 | } |
680 | luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */ | 680 | luaK_concat(fs, &e->f, pc); /* insert last jump in 'f' list */ |
681 | luaK_patchtohere(fs, e->t); | 681 | luaK_patchtohere(fs, e->t); |
682 | e->t = NO_JUMP; | 682 | e->t = NO_JUMP; |
683 | } | 683 | } |
@@ -700,7 +700,7 @@ void luaK_goiffalse (FuncState *fs, expdesc *e) { | |||
700 | break; | 700 | break; |
701 | } | 701 | } |
702 | } | 702 | } |
703 | luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */ | 703 | luaK_concat(fs, &e->t, pc); /* insert last jump in 't' list */ |
704 | luaK_patchtohere(fs, e->f); | 704 | luaK_patchtohere(fs, e->f); |
705 | e->f = NO_JUMP; | 705 | e->f = NO_JUMP; |
706 | } | 706 | } |
@@ -831,7 +831,7 @@ static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, | |||
831 | freeexp(fs, e2); | 831 | freeexp(fs, e2); |
832 | freeexp(fs, e1); | 832 | freeexp(fs, e1); |
833 | if (cond == 0 && op != OP_EQ) { | 833 | if (cond == 0 && op != OP_EQ) { |
834 | int temp; /* exchange args to replace by `<' or `<=' */ | 834 | int temp; /* exchange args to replace by '<' or '<=' */ |
835 | temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ | 835 | temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ |
836 | cond = 1; | 836 | cond = 1; |
837 | } | 837 | } |
@@ -865,7 +865,7 @@ void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { | |||
865 | break; | 865 | break; |
866 | } | 866 | } |
867 | case OPR_CONCAT: { | 867 | case OPR_CONCAT: { |
868 | luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ | 868 | luaK_exp2nextreg(fs, v); /* operand must be on the 'stack' */ |
869 | break; | 869 | break; |
870 | } | 870 | } |
871 | case OPR_ADD: case OPR_SUB: | 871 | case OPR_ADD: case OPR_SUB: |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcorolib.c,v 1.6 2014/05/08 13:52:20 roberto Exp roberto $ | 2 | ** $Id: lcorolib.c,v 1.7 2014/09/01 18:00:04 roberto Exp roberto $ |
3 | ** Coroutine Library | 3 | ** Coroutine Library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -65,7 +65,7 @@ static int luaB_coresume (lua_State *L) { | |||
65 | else { | 65 | else { |
66 | lua_pushboolean(L, 1); | 66 | lua_pushboolean(L, 1); |
67 | lua_insert(L, -(r + 1)); | 67 | lua_insert(L, -(r + 1)); |
68 | return r + 1; /* return true + `resume' returns */ | 68 | return r + 1; /* return true + 'resume' returns */ |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.100 2014/07/30 14:00:14 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.101 2014/10/17 16:28:21 roberto Exp roberto $ |
3 | ** Debug Interface | 3 | ** Debug Interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -365,7 +365,7 @@ static int findsetreg (Proto *p, int lastpc, int reg) { | |||
365 | case OP_JMP: { | 365 | case OP_JMP: { |
366 | int b = GETARG_sBx(i); | 366 | int b = GETARG_sBx(i); |
367 | int dest = pc + 1 + b; | 367 | int dest = pc + 1 + b; |
368 | /* jump is forward and do not skip `lastpc'? */ | 368 | /* jump is forward and do not skip 'lastpc'? */ |
369 | if (pc < dest && dest <= lastpc) { | 369 | if (pc < dest && dest <= lastpc) { |
370 | if (dest > jmptarget) | 370 | if (dest > jmptarget) |
371 | jmptarget = dest; /* update 'jmptarget' */ | 371 | jmptarget = dest; /* update 'jmptarget' */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.129 2014/10/08 12:20:26 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.130 2014/10/17 16:28:21 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -287,7 +287,7 @@ static StkId tryfuncTM (lua_State *L, StkId func) { | |||
287 | ptrdiff_t funcr = savestack(L, func); | 287 | ptrdiff_t funcr = savestack(L, func); |
288 | if (!ttisfunction(tm)) | 288 | if (!ttisfunction(tm)) |
289 | luaG_typeerror(L, func, "call"); | 289 | luaG_typeerror(L, func, "call"); |
290 | /* Open a hole inside the stack at `func' */ | 290 | /* Open a hole inside the stack at 'func' */ |
291 | for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); | 291 | for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); |
292 | incr_top(L); | 292 | incr_top(L); |
293 | func = restorestack(L, funcr); /* previous call may change stack */ | 293 | 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) { | |||
575 | status = luaD_rawrunprotected(L, unroll, &status); | 575 | status = luaD_rawrunprotected(L, unroll, &status); |
576 | } | 576 | } |
577 | if (errorstatus(status)) { /* unrecoverable error? */ | 577 | if (errorstatus(status)) { /* unrecoverable error? */ |
578 | L->status = cast_byte(status); /* mark thread as `dead' */ | 578 | L->status = cast_byte(status); /* mark thread as 'dead' */ |
579 | seterrorobj(L, status, L->top); /* push error message */ | 579 | seterrorobj(L, status, L->top); /* push error message */ |
580 | L->ci->top = L->top; | 580 | L->ci->top = L->top; |
581 | } | 581 | } |
@@ -650,7 +650,7 @@ int luaD_pcall (lua_State *L, Pfunc func, void *u, | |||
650 | /* | 650 | /* |
651 | ** Execute a protected parser. | 651 | ** Execute a protected parser. |
652 | */ | 652 | */ |
653 | struct SParser { /* data to `f_parser' */ | 653 | struct SParser { /* data to 'f_parser' */ |
654 | ZIO *z; | 654 | ZIO *z; |
655 | Mbuffer buff; /* dynamic structure used by the scanner */ | 655 | Mbuffer buff; /* dynamic structure used by the scanner */ |
656 | Dyndata dyd; /* dynamic structures used by the parser */ | 656 | Dyndata dyd; /* dynamic structures used by the parser */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.h,v 2.19 2011/10/07 20:45:19 roberto Exp roberto $ | 2 | ** $Id: ldo.h,v 2.20 2011/11/29 15:55:08 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -23,7 +23,7 @@ | |||
23 | #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) | 23 | #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) |
24 | 24 | ||
25 | 25 | ||
26 | /* type of protected functions, to be ran by `runprotected' */ | 26 | /* type of protected functions, to be ran by 'runprotected' */ |
27 | typedef void (*Pfunc) (lua_State *L, void *ud); | 27 | typedef void (*Pfunc) (lua_State *L, void *ud); |
28 | 28 | ||
29 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, | 29 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lfunc.c,v 2.42 2014/06/18 22:59:29 roberto Exp roberto $ | 2 | ** $Id: lfunc.c,v 2.43 2014/06/19 18:27:20 roberto Exp roberto $ |
3 | ** Auxiliary functions to manipulate prototypes and closures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -82,7 +82,7 @@ void luaF_close (lua_State *L, StkId level) { | |||
82 | UpVal *uv; | 82 | UpVal *uv; |
83 | while (L->openupval != NULL && (uv = L->openupval)->v >= level) { | 83 | while (L->openupval != NULL && (uv = L->openupval)->v >= level) { |
84 | lua_assert(upisopen(uv)); | 84 | lua_assert(upisopen(uv)); |
85 | L->openupval = uv->u.open.next; /* remove from `open' list */ | 85 | L->openupval = uv->u.open.next; /* remove from 'open' list */ |
86 | if (uv->refcount == 0) /* no references? */ | 86 | if (uv->refcount == 0) /* no references? */ |
87 | luaM_free(L, uv); /* free upvalue */ | 87 | luaM_free(L, uv); /* free upvalue */ |
88 | else { | 88 | else { |
@@ -132,7 +132,7 @@ void luaF_freeproto (lua_State *L, Proto *f) { | |||
132 | 132 | ||
133 | 133 | ||
134 | /* | 134 | /* |
135 | ** Look for n-th local variable at line `line' in function `func'. | 135 | ** Look for n-th local variable at line 'line' in function 'func'. |
136 | ** Returns NULL if not found. | 136 | ** Returns NULL if not found. |
137 | */ | 137 | */ |
138 | const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { | 138 | const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.195 2014/09/04 18:15:29 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.196 2014/10/03 12:54:37 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -119,14 +119,14 @@ static void removeentry (Node *n) { | |||
119 | /* | 119 | /* |
120 | ** tells whether a key or value can be cleared from a weak | 120 | ** tells whether a key or value can be cleared from a weak |
121 | ** table. Non-collectable objects are never removed from weak | 121 | ** table. Non-collectable objects are never removed from weak |
122 | ** tables. Strings behave as `values', so are never removed too. for | 122 | ** tables. Strings behave as 'values', so are never removed too. for |
123 | ** other objects: if really collected, cannot keep them; for objects | 123 | ** other objects: if really collected, cannot keep them; for objects |
124 | ** being finalized, keep them in keys, but not in values | 124 | ** being finalized, keep them in keys, but not in values |
125 | */ | 125 | */ |
126 | static int iscleared (global_State *g, const TValue *o) { | 126 | static int iscleared (global_State *g, const TValue *o) { |
127 | if (!iscollectable(o)) return 0; | 127 | if (!iscollectable(o)) return 0; |
128 | else if (ttisstring(o)) { | 128 | else if (ttisstring(o)) { |
129 | markobject(g, tsvalue(o)); /* strings are `values', so are never weak */ | 129 | markobject(g, tsvalue(o)); /* strings are 'values', so are never weak */ |
130 | return 0; | 130 | return 0; |
131 | } | 131 | } |
132 | else return iswhite(gcvalue(o)); | 132 | else return iswhite(gcvalue(o)); |
@@ -1031,7 +1031,7 @@ static lu_mem singlestep (lua_State *L) { | |||
1031 | g->GCmemtrav = 0; | 1031 | g->GCmemtrav = 0; |
1032 | lua_assert(g->gray); | 1032 | lua_assert(g->gray); |
1033 | propagatemark(g); | 1033 | propagatemark(g); |
1034 | if (g->gray == NULL) /* no more `gray' objects? */ | 1034 | if (g->gray == NULL) /* no more gray objects? */ |
1035 | g->gcstate = GCSatomic; /* finish propagate phase */ | 1035 | g->gcstate = GCSatomic; /* finish propagate phase */ |
1036 | return g->GCmemtrav; /* memory traversed in this step */ | 1036 | return g->GCmemtrav; /* memory traversed in this step */ |
1037 | } | 1037 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.h,v 2.84 2014/07/19 15:09:37 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 2.85 2014/07/19 15:14:46 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -74,7 +74,7 @@ | |||
74 | #define testbit(x,b) testbits(x, bitmask(b)) | 74 | #define testbit(x,b) testbits(x, bitmask(b)) |
75 | 75 | ||
76 | 76 | ||
77 | /* Layout for bit use in `marked' field: */ | 77 | /* Layout for bit use in 'marked' field: */ |
78 | #define WHITE0BIT 0 /* object is white (type 0) */ | 78 | #define WHITE0BIT 0 /* object is white (type 0) */ |
79 | #define WHITE1BIT 1 /* object is white (type 1) */ | 79 | #define WHITE1BIT 1 /* object is white (type 1) */ |
80 | #define BLACKBIT 2 /* object is black */ | 80 | #define BLACKBIT 2 /* object is black */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.135 2014/10/22 11:44:20 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.136 2014/10/22 16:55:57 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -182,7 +182,7 @@ static FILE *tofile (lua_State *L) { | |||
182 | 182 | ||
183 | 183 | ||
184 | /* | 184 | /* |
185 | ** When creating file handles, always creates a `closed' file handle | 185 | ** When creating file handles, always creates a 'closed' file handle |
186 | ** before opening the actual file; so, if there is a memory error, the | 186 | ** before opening the actual file; so, if there is a memory error, the |
187 | ** file is not left opened. | 187 | ** file is not left opened. |
188 | */ | 188 | */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 2.83 2014/10/17 16:28:21 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.84 2014/10/22 11:44:20 roberto Exp roberto $ |
3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -125,7 +125,7 @@ l_noret luaX_syntaxerror (LexState *ls, const char *msg) { | |||
125 | */ | 125 | */ |
126 | TString *luaX_newstring (LexState *ls, const char *str, size_t l) { | 126 | TString *luaX_newstring (LexState *ls, const char *str, size_t l) { |
127 | lua_State *L = ls->L; | 127 | lua_State *L = ls->L; |
128 | TValue *o; /* entry for `str' */ | 128 | TValue *o; /* entry for 'str' */ |
129 | TString *ts = luaS_newlstr(L, str, l); /* create new string */ | 129 | TString *ts = luaS_newlstr(L, str, l); /* create new string */ |
130 | setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ | 130 | setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ |
131 | o = luaH_set(L, ls->h, L->top - 1); | 131 | o = luaH_set(L, ls->h, L->top - 1); |
@@ -150,9 +150,9 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { | |||
150 | static void inclinenumber (LexState *ls) { | 150 | static void inclinenumber (LexState *ls) { |
151 | int old = ls->current; | 151 | int old = ls->current; |
152 | lua_assert(currIsNewline(ls)); | 152 | lua_assert(currIsNewline(ls)); |
153 | next(ls); /* skip `\n' or `\r' */ | 153 | next(ls); /* skip '\n' or '\r' */ |
154 | if (currIsNewline(ls) && ls->current != old) | 154 | if (currIsNewline(ls) && ls->current != old) |
155 | next(ls); /* skip `\n\r' or `\r\n' */ | 155 | next(ls); /* skip '\n\r' or '\r\n' */ |
156 | if (++ls->linenumber >= MAX_INT) | 156 | if (++ls->linenumber >= MAX_INT) |
157 | luaX_syntaxerror(ls, "chunk has too many lines"); | 157 | luaX_syntaxerror(ls, "chunk has too many lines"); |
158 | } | 158 | } |
@@ -298,7 +298,7 @@ static int skip_sep (LexState *ls) { | |||
298 | 298 | ||
299 | static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { | 299 | static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { |
300 | int line = ls->linenumber; /* initial line (for error message) */ | 300 | int line = ls->linenumber; /* initial line (for error message) */ |
301 | save_and_next(ls); /* skip 2nd `[' */ | 301 | save_and_next(ls); /* skip 2nd '[' */ |
302 | if (currIsNewline(ls)) /* string starts with a newline? */ | 302 | if (currIsNewline(ls)) /* string starts with a newline? */ |
303 | inclinenumber(ls); /* skip it */ | 303 | inclinenumber(ls); /* skip it */ |
304 | for (;;) { | 304 | for (;;) { |
@@ -312,7 +312,7 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { | |||
312 | } | 312 | } |
313 | case ']': { | 313 | case ']': { |
314 | if (skip_sep(ls) == sep) { | 314 | if (skip_sep(ls) == sep) { |
315 | save_and_next(ls); /* skip 2nd `]' */ | 315 | save_and_next(ls); /* skip 2nd ']' */ |
316 | goto endloop; | 316 | goto endloop; |
317 | } | 317 | } |
318 | break; | 318 | break; |
@@ -480,7 +480,7 @@ static int llex (LexState *ls, SemInfo *seminfo) { | |||
480 | next(ls); | 480 | next(ls); |
481 | if (ls->current == '[') { /* long comment? */ | 481 | if (ls->current == '[') { /* long comment? */ |
482 | int sep = skip_sep(ls); | 482 | int sep = skip_sep(ls); |
483 | luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ | 483 | luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */ |
484 | if (sep >= 0) { | 484 | if (sep >= 0) { |
485 | read_long_string(ls, NULL, sep); /* skip long comment */ | 485 | read_long_string(ls, NULL, sep); /* skip long comment */ |
486 | luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ | 486 | luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.h,v 1.75 2013/08/30 16:01:37 roberto Exp roberto $ | 2 | ** $Id: llex.h,v 1.76 2013/12/30 20:47:58 roberto Exp roberto $ |
3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -54,7 +54,7 @@ typedef struct Token { | |||
54 | typedef struct LexState { | 54 | typedef struct LexState { |
55 | int current; /* current character (charint) */ | 55 | int current; /* current character (charint) */ |
56 | int linenumber; /* input line counter */ | 56 | int linenumber; /* input line counter */ |
57 | int lastline; /* line of last token `consumed' */ | 57 | int lastline; /* line of last token 'consumed' */ |
58 | Token t; /* current token */ | 58 | Token t; /* current token */ |
59 | Token lookahead; /* look ahead token */ | 59 | Token lookahead; /* look ahead token */ |
60 | struct FuncState *fs; /* current function (parser) */ | 60 | struct FuncState *fs; /* current function (parser) */ |
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llimits.h,v 1.119 2014/07/18 18:18:45 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.120 2014/07/18 18:29:12 roberto Exp roberto $ |
3 | ** Limits, basic types, and some other `installation-dependent' definitions | 3 | ** Limits, basic types, and some other 'installation-dependent' definitions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
6 | 6 | ||
@@ -23,7 +23,7 @@ typedef LUAI_MEM l_mem; | |||
23 | 23 | ||
24 | 24 | ||
25 | 25 | ||
26 | /* chars used as small naturals (so that `char' is reserved for characters) */ | 26 | /* chars used as small naturals (so that 'char' is reserved for characters) */ |
27 | typedef unsigned char lu_byte; | 27 | typedef unsigned char lu_byte; |
28 | 28 | ||
29 | 29 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.c,v 1.85 2014/06/26 18:29:05 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.86 2014/07/15 21:26:50 roberto Exp roberto $ |
3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -24,12 +24,12 @@ | |||
24 | /* | 24 | /* |
25 | ** About the realloc function: | 25 | ** About the realloc function: |
26 | ** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); | 26 | ** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); |
27 | ** (`osize' is the old size, `nsize' is the new size) | 27 | ** ('osize' is the old size, 'nsize' is the new size) |
28 | ** | 28 | ** |
29 | ** * frealloc(ud, NULL, x, s) creates a new block of size `s' (no | 29 | ** * frealloc(ud, NULL, x, s) creates a new block of size 's' (no |
30 | ** matter 'x'). | 30 | ** matter 'x'). |
31 | ** | 31 | ** |
32 | ** * frealloc(ud, p, x, 0) frees the block `p' | 32 | ** * frealloc(ud, p, x, 0) frees the block 'p' |
33 | ** (in this specific case, frealloc must return NULL); | 33 | ** (in this specific case, frealloc must return NULL); |
34 | ** particularly, frealloc(ud, NULL, 0, 0) does nothing | 34 | ** particularly, frealloc(ud, NULL, 0, 0) does nothing |
35 | ** (which is equivalent to free(NULL) in ANSI C) | 35 | ** (which is equivalent to free(NULL) in ANSI C) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loadlib.c,v 1.116 2014/07/29 16:01:00 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.117 2014/10/17 16:28:21 roberto Exp roberto $ |
3 | ** Dynamic library loader for Lua | 3 | ** Dynamic library loader for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | ** | 5 | ** |
@@ -729,7 +729,7 @@ static void createsearcherstable (lua_State *L) { | |||
729 | } | 729 | } |
730 | #if defined(LUA_COMPAT_LOADERS) | 730 | #if defined(LUA_COMPAT_LOADERS) |
731 | lua_pushvalue(L, -1); /* make a copy of 'searchers' table */ | 731 | lua_pushvalue(L, -1); /* make a copy of 'searchers' table */ |
732 | lua_setfield(L, -3, "loaders"); /* put it in field `loaders' */ | 732 | lua_setfield(L, -3, "loaders"); /* put it in field 'loaders' */ |
733 | #endif | 733 | #endif |
734 | lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */ | 734 | lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */ |
735 | } | 735 | } |
@@ -750,7 +750,7 @@ static void createclibstable (lua_State *L) { | |||
750 | 750 | ||
751 | LUAMOD_API int luaopen_package (lua_State *L) { | 751 | LUAMOD_API int luaopen_package (lua_State *L) { |
752 | createclibstable(L); | 752 | createclibstable(L); |
753 | luaL_newlib(L, pk_funcs); /* create `package' table */ | 753 | luaL_newlib(L, pk_funcs); /* create 'package' table */ |
754 | createsearcherstable(L); | 754 | createsearcherstable(L); |
755 | /* set field 'path' */ | 755 | /* set field 'path' */ |
756 | setpath(L, "path", LUA_PATHVARVERSION, LUA_PATH_VAR, LUA_PATH_DEFAULT); | 756 | setpath(L, "path", LUA_PATHVARVERSION, LUA_PATH_VAR, LUA_PATH_DEFAULT); |
@@ -760,10 +760,10 @@ LUAMOD_API int luaopen_package (lua_State *L) { | |||
760 | lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n" | 760 | lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n" |
761 | LUA_EXEC_DIR "\n" LUA_IGMARK "\n"); | 761 | LUA_EXEC_DIR "\n" LUA_IGMARK "\n"); |
762 | lua_setfield(L, -2, "config"); | 762 | lua_setfield(L, -2, "config"); |
763 | /* set field `loaded' */ | 763 | /* set field 'loaded' */ |
764 | luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); | 764 | luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); |
765 | lua_setfield(L, -2, "loaded"); | 765 | lua_setfield(L, -2, "loaded"); |
766 | /* set field `preload' */ | 766 | /* set field 'preload' */ |
767 | luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); | 767 | luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); |
768 | lua_setfield(L, -2, "preload"); | 768 | lua_setfield(L, -2, "preload"); |
769 | lua_pushglobaltable(L); | 769 | lua_pushglobaltable(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 2.93 2014/10/17 16:28:21 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 2.94 2014/10/24 11:42:29 roberto Exp roberto $ |
3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -399,7 +399,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | |||
399 | break; | 399 | break; |
400 | } | 400 | } |
401 | case 'p': { | 401 | case 'p': { |
402 | char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */ | 402 | char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */ |
403 | int l = sprintf(buff, "%p", va_arg(argp, void *)); | 403 | int l = sprintf(buff, "%p", va_arg(argp, void *)); |
404 | pushstr(L, buff, l); | 404 | pushstr(L, buff, l); |
405 | break; | 405 | break; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 2.102 2014/09/04 18:15:29 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.103 2014/10/01 11:52:33 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -345,7 +345,7 @@ typedef struct Udata { | |||
345 | ** Ensures that address after this type is always fully aligned. | 345 | ** Ensures that address after this type is always fully aligned. |
346 | */ | 346 | */ |
347 | typedef union UUdata { | 347 | typedef union UUdata { |
348 | L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */ | 348 | L_Umaxalign dummy; /* ensures maximum alignment for 'local' udata */ |
349 | Udata uv; | 349 | Udata uv; |
350 | } UUdata; | 350 | } UUdata; |
351 | 351 | ||
@@ -399,10 +399,10 @@ typedef struct Proto { | |||
399 | lu_byte is_vararg; | 399 | lu_byte is_vararg; |
400 | lu_byte maxstacksize; /* maximum stack used by this function */ | 400 | lu_byte maxstacksize; /* maximum stack used by this function */ |
401 | int sizeupvalues; /* size of 'upvalues' */ | 401 | int sizeupvalues; /* size of 'upvalues' */ |
402 | int sizek; /* size of `k' */ | 402 | int sizek; /* size of 'k' */ |
403 | int sizecode; | 403 | int sizecode; |
404 | int sizelineinfo; | 404 | int sizelineinfo; |
405 | int sizep; /* size of `p' */ | 405 | int sizep; /* size of 'p' */ |
406 | int sizelocvars; | 406 | int sizelocvars; |
407 | int linedefined; | 407 | int linedefined; |
408 | int lastlinedefined; | 408 | int lastlinedefined; |
@@ -486,8 +486,8 @@ typedef struct Node { | |||
486 | typedef struct Table { | 486 | typedef struct Table { |
487 | CommonHeader; | 487 | CommonHeader; |
488 | lu_byte flags; /* 1<<p means tagmethod(p) is not present */ | 488 | lu_byte flags; /* 1<<p means tagmethod(p) is not present */ |
489 | lu_byte lsizenode; /* log2 of size of `node' array */ | 489 | lu_byte lsizenode; /* log2 of size of 'node' array */ |
490 | unsigned int sizearray; /* size of `array' array */ | 490 | unsigned int sizearray; /* size of 'array' array */ |
491 | TValue *array; /* array part */ | 491 | TValue *array; /* array part */ |
492 | Node *node; | 492 | Node *node; |
493 | Node *lastfree; /* any free position is before this position */ | 493 | Node *lastfree; /* any free position is before this position */ |
@@ -498,7 +498,7 @@ typedef struct Table { | |||
498 | 498 | ||
499 | 499 | ||
500 | /* | 500 | /* |
501 | ** `module' operation for hashing (size is always a power of 2) | 501 | ** 'module' operation for hashing (size is always a power of 2) |
502 | */ | 502 | */ |
503 | #define lmod(s,size) \ | 503 | #define lmod(s,size) \ |
504 | (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1))))) | 504 | (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1))))) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lopcodes.h,v 1.146 2013/12/30 20:47:58 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.147 2014/10/20 18:29:55 roberto Exp roberto $ |
3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -14,12 +14,12 @@ | |||
14 | We assume that instructions are unsigned numbers. | 14 | We assume that instructions are unsigned numbers. |
15 | All instructions have an opcode in the first 6 bits. | 15 | All instructions have an opcode in the first 6 bits. |
16 | Instructions can have the following fields: | 16 | Instructions can have the following fields: |
17 | `A' : 8 bits | 17 | 'A' : 8 bits |
18 | `B' : 9 bits | 18 | 'B' : 9 bits |
19 | `C' : 9 bits | 19 | 'C' : 9 bits |
20 | 'Ax' : 26 bits ('A', 'B', and 'C' together) | 20 | 'Ax' : 26 bits ('A', 'B', and 'C' together) |
21 | `Bx' : 18 bits (`B' and `C' together) | 21 | 'Bx' : 18 bits ('B' and 'C' together) |
22 | `sBx' : signed Bx | 22 | 'sBx' : signed Bx |
23 | 23 | ||
24 | A signed argument is represented in excess K; that is, the number | 24 | A signed argument is represented in excess K; that is, the number |
25 | value is the unsigned value minus K. K is exactly the maximum value | 25 | 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 */ | |||
58 | */ | 58 | */ |
59 | #if SIZE_Bx < LUAI_BITSINT-1 | 59 | #if SIZE_Bx < LUAI_BITSINT-1 |
60 | #define MAXARG_Bx ((1<<SIZE_Bx)-1) | 60 | #define MAXARG_Bx ((1<<SIZE_Bx)-1) |
61 | #define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */ | 61 | #define MAXARG_sBx (MAXARG_Bx>>1) /* 'sBx' is signed */ |
62 | #else | 62 | #else |
63 | #define MAXARG_Bx MAX_INT | 63 | #define MAXARG_Bx MAX_INT |
64 | #define MAXARG_sBx MAX_INT | 64 | #define MAXARG_sBx MAX_INT |
@@ -76,10 +76,10 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ | |||
76 | #define MAXARG_C ((1<<SIZE_C)-1) | 76 | #define MAXARG_C ((1<<SIZE_C)-1) |
77 | 77 | ||
78 | 78 | ||
79 | /* creates a mask with `n' 1 bits at position `p' */ | 79 | /* creates a mask with 'n' 1 bits at position 'p' */ |
80 | #define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p)) | 80 | #define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p)) |
81 | 81 | ||
82 | /* creates a mask with `n' 0 bits at position `p' */ | 82 | /* creates a mask with 'n' 0 bits at position 'p' */ |
83 | #define MASK0(n,p) (~MASK1(n,p)) | 83 | #define MASK0(n,p) (~MASK1(n,p)) |
84 | 84 | ||
85 | /* | 85 | /* |
@@ -238,16 +238,16 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ | |||
238 | 238 | ||
239 | /*=========================================================================== | 239 | /*=========================================================================== |
240 | Notes: | 240 | Notes: |
241 | (*) In OP_CALL, if (B == 0) then B = top. If (C == 0), then `top' is | 241 | (*) In OP_CALL, if (B == 0) then B = top. If (C == 0), then 'top' is |
242 | set to last_result+1, so next open instruction (OP_CALL, OP_RETURN, | 242 | set to last_result+1, so next open instruction (OP_CALL, OP_RETURN, |
243 | OP_SETLIST) may use `top'. | 243 | OP_SETLIST) may use 'top'. |
244 | 244 | ||
245 | (*) In OP_VARARG, if (B == 0) then use actual number of varargs and | 245 | (*) In OP_VARARG, if (B == 0) then use actual number of varargs and |
246 | set top (like in OP_CALL with C == 0). | 246 | set top (like in OP_CALL with C == 0). |
247 | 247 | ||
248 | (*) In OP_RETURN, if (B == 0) then return up to `top'. | 248 | (*) In OP_RETURN, if (B == 0) then return up to 'top'. |
249 | 249 | ||
250 | (*) In OP_SETLIST, if (B == 0) then B = `top'; if (C == 0) then next | 250 | (*) In OP_SETLIST, if (B == 0) then B = 'top'; if (C == 0) then next |
251 | 'instruction' is EXTRAARG(real C). | 251 | 'instruction' is EXTRAARG(real C). |
252 | 252 | ||
253 | (*) In OP_LOADKX, the next 'instruction' is always EXTRAARG. | 253 | (*) In OP_LOADKX, the next 'instruction' is always EXTRAARG. |
@@ -255,7 +255,7 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ | |||
255 | (*) For comparisons, A specifies what condition the test should accept | 255 | (*) For comparisons, A specifies what condition the test should accept |
256 | (true or false). | 256 | (true or false). |
257 | 257 | ||
258 | (*) All `skips' (pc++) assume that next instruction is a jump. | 258 | (*) All 'skips' (pc++) assume that next instruction is a jump. |
259 | 259 | ||
260 | ===========================================================================*/ | 260 | ===========================================================================*/ |
261 | 261 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loslib.c,v 1.48 2014/10/08 19:57:31 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.49 2014/10/17 16:28:21 roberto Exp roberto $ |
3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -227,7 +227,7 @@ static int os_date (lua_State *L) { | |||
227 | struct tm tmr, *stm; | 227 | struct tm tmr, *stm; |
228 | if (*s == '!') { /* UTC? */ | 228 | if (*s == '!') { /* UTC? */ |
229 | stm = l_gmtime(&t, &tmr); | 229 | stm = l_gmtime(&t, &tmr); |
230 | s++; /* skip `!' */ | 230 | s++; /* skip '!' */ |
231 | } | 231 | } |
232 | else | 232 | else |
233 | stm = l_localtime(&t, &tmr); | 233 | stm = l_localtime(&t, &tmr); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.142 2014/07/21 16:02:10 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.143 2014/10/17 16:28:21 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -49,7 +49,7 @@ typedef struct BlockCnt { | |||
49 | short firstgoto; /* index of first pending goto in this block */ | 49 | short firstgoto; /* index of first pending goto in this block */ |
50 | lu_byte nactvar; /* # active locals outside the block */ | 50 | lu_byte nactvar; /* # active locals outside the block */ |
51 | lu_byte upval; /* true if some variable in the block is an upvalue */ | 51 | lu_byte upval; /* true if some variable in the block is an upvalue */ |
52 | lu_byte isloop; /* true if `block' is a loop */ | 52 | lu_byte isloop; /* true if 'block' is a loop */ |
53 | } BlockCnt; | 53 | } BlockCnt; |
54 | 54 | ||
55 | 55 | ||
@@ -63,7 +63,7 @@ static void expr (LexState *ls, expdesc *v); | |||
63 | 63 | ||
64 | /* semantic error */ | 64 | /* semantic error */ |
65 | static l_noret semerror (LexState *ls, const char *msg) { | 65 | static l_noret semerror (LexState *ls, const char *msg) { |
66 | ls->t.token = 0; /* remove 'near to' from final message */ | 66 | ls->t.token = 0; /* remove "near <token>" from final message */ |
67 | luaX_syntaxerror(ls, msg); | 67 | luaX_syntaxerror(ls, msg); |
68 | } | 68 | } |
69 | 69 | ||
@@ -406,7 +406,7 @@ static void findgotos (LexState *ls, Labeldesc *lb) { | |||
406 | 406 | ||
407 | 407 | ||
408 | /* | 408 | /* |
409 | ** "export" pending gotos to outer level, to check them against | 409 | ** export pending gotos to outer level, to check them against |
410 | ** outer labels; if the block being exited has upvalues, and | 410 | ** outer labels; if the block being exited has upvalues, and |
411 | ** the goto exits the scope of any variable (which can be the | 411 | ** the goto exits the scope of any variable (which can be the |
412 | ** upvalue), close those variables being exited. | 412 | ** upvalue), close those variables being exited. |
@@ -442,7 +442,7 @@ static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) { | |||
442 | 442 | ||
443 | 443 | ||
444 | /* | 444 | /* |
445 | ** create a label named "break" to resolve break statements | 445 | ** create a label named 'break' to resolve break statements |
446 | */ | 446 | */ |
447 | static void breaklabel (LexState *ls) { | 447 | static void breaklabel (LexState *ls) { |
448 | TString *n = luaS_new(ls->L, "break"); | 448 | TString *n = luaS_new(ls->L, "break"); |
@@ -574,7 +574,7 @@ static void close_func (LexState *ls) { | |||
574 | /* | 574 | /* |
575 | ** check whether current token is in the follow set of a block. | 575 | ** check whether current token is in the follow set of a block. |
576 | ** 'until' closes syntactical blocks, but do not close scope, | 576 | ** 'until' closes syntactical blocks, but do not close scope, |
577 | ** so it handled in separate. | 577 | ** so it is handled in separate. |
578 | */ | 578 | */ |
579 | static int block_follow (LexState *ls, int withuntil) { | 579 | static int block_follow (LexState *ls, int withuntil) { |
580 | switch (ls->t.token) { | 580 | switch (ls->t.token) { |
@@ -588,7 +588,7 @@ static int block_follow (LexState *ls, int withuntil) { | |||
588 | 588 | ||
589 | 589 | ||
590 | static void statlist (LexState *ls) { | 590 | static void statlist (LexState *ls) { |
591 | /* statlist -> { stat [`;'] } */ | 591 | /* statlist -> { stat [';'] } */ |
592 | while (!block_follow(ls, 1)) { | 592 | while (!block_follow(ls, 1)) { |
593 | if (ls->t.token == TK_RETURN) { | 593 | if (ls->t.token == TK_RETURN) { |
594 | statement(ls); | 594 | statement(ls); |
@@ -629,14 +629,14 @@ static void yindex (LexState *ls, expdesc *v) { | |||
629 | struct ConsControl { | 629 | struct ConsControl { |
630 | expdesc v; /* last list item read */ | 630 | expdesc v; /* last list item read */ |
631 | expdesc *t; /* table descriptor */ | 631 | expdesc *t; /* table descriptor */ |
632 | int nh; /* total number of `record' elements */ | 632 | int nh; /* total number of 'record' elements */ |
633 | int na; /* total number of array elements */ | 633 | int na; /* total number of array elements */ |
634 | int tostore; /* number of array elements pending to be stored */ | 634 | int tostore; /* number of array elements pending to be stored */ |
635 | }; | 635 | }; |
636 | 636 | ||
637 | 637 | ||
638 | static void recfield (LexState *ls, struct ConsControl *cc) { | 638 | static void recfield (LexState *ls, struct ConsControl *cc) { |
639 | /* recfield -> (NAME | `['exp1`]') = exp1 */ | 639 | /* recfield -> (NAME | '['exp1']') = exp1 */ |
640 | FuncState *fs = ls->fs; | 640 | FuncState *fs = ls->fs; |
641 | int reg = ls->fs->freereg; | 641 | int reg = ls->fs->freereg; |
642 | expdesc key, val; | 642 | expdesc key, val; |
@@ -743,12 +743,12 @@ static void constructor (LexState *ls, expdesc *t) { | |||
743 | 743 | ||
744 | 744 | ||
745 | static void parlist (LexState *ls) { | 745 | static void parlist (LexState *ls) { |
746 | /* parlist -> [ param { `,' param } ] */ | 746 | /* parlist -> [ param { ',' param } ] */ |
747 | FuncState *fs = ls->fs; | 747 | FuncState *fs = ls->fs; |
748 | Proto *f = fs->f; | 748 | Proto *f = fs->f; |
749 | int nparams = 0; | 749 | int nparams = 0; |
750 | f->is_vararg = 0; | 750 | f->is_vararg = 0; |
751 | if (ls->t.token != ')') { /* is `parlist' not empty? */ | 751 | if (ls->t.token != ')') { /* is 'parlist' not empty? */ |
752 | do { | 752 | do { |
753 | switch (ls->t.token) { | 753 | switch (ls->t.token) { |
754 | case TK_NAME: { /* param -> NAME */ | 754 | case TK_NAME: { /* param -> NAME */ |
@@ -756,7 +756,7 @@ static void parlist (LexState *ls) { | |||
756 | nparams++; | 756 | nparams++; |
757 | break; | 757 | break; |
758 | } | 758 | } |
759 | case TK_DOTS: { /* param -> `...' */ | 759 | case TK_DOTS: { /* param -> '...' */ |
760 | luaX_next(ls); | 760 | luaX_next(ls); |
761 | f->is_vararg = 1; | 761 | f->is_vararg = 1; |
762 | break; | 762 | break; |
@@ -772,7 +772,7 @@ static void parlist (LexState *ls) { | |||
772 | 772 | ||
773 | 773 | ||
774 | static void body (LexState *ls, expdesc *e, int ismethod, int line) { | 774 | static void body (LexState *ls, expdesc *e, int ismethod, int line) { |
775 | /* body -> `(' parlist `)' block END */ | 775 | /* body -> '(' parlist ')' block END */ |
776 | FuncState new_fs; | 776 | FuncState new_fs; |
777 | BlockCnt bl; | 777 | BlockCnt bl; |
778 | new_fs.f = addprototype(ls); | 778 | new_fs.f = addprototype(ls); |
@@ -794,7 +794,7 @@ static void body (LexState *ls, expdesc *e, int ismethod, int line) { | |||
794 | 794 | ||
795 | 795 | ||
796 | static int explist (LexState *ls, expdesc *v) { | 796 | static int explist (LexState *ls, expdesc *v) { |
797 | /* explist -> expr { `,' expr } */ | 797 | /* explist -> expr { ',' expr } */ |
798 | int n = 1; /* at least one expression */ | 798 | int n = 1; /* at least one expression */ |
799 | expr(ls, v); | 799 | expr(ls, v); |
800 | while (testnext(ls, ',')) { | 800 | while (testnext(ls, ',')) { |
@@ -811,7 +811,7 @@ static void funcargs (LexState *ls, expdesc *f, int line) { | |||
811 | expdesc args; | 811 | expdesc args; |
812 | int base, nparams; | 812 | int base, nparams; |
813 | switch (ls->t.token) { | 813 | switch (ls->t.token) { |
814 | case '(': { /* funcargs -> `(' [ explist ] `)' */ | 814 | case '(': { /* funcargs -> '(' [ explist ] ')' */ |
815 | luaX_next(ls); | 815 | luaX_next(ls); |
816 | if (ls->t.token == ')') /* arg list is empty? */ | 816 | if (ls->t.token == ')') /* arg list is empty? */ |
817 | args.k = VVOID; | 817 | args.k = VVOID; |
@@ -828,7 +828,7 @@ static void funcargs (LexState *ls, expdesc *f, int line) { | |||
828 | } | 828 | } |
829 | case TK_STRING: { /* funcargs -> STRING */ | 829 | case TK_STRING: { /* funcargs -> STRING */ |
830 | codestring(ls, &args, ls->t.seminfo.ts); | 830 | codestring(ls, &args, ls->t.seminfo.ts); |
831 | luaX_next(ls); /* must use `seminfo' before `next' */ | 831 | luaX_next(ls); /* must use 'seminfo' before 'next' */ |
832 | break; | 832 | break; |
833 | } | 833 | } |
834 | default: { | 834 | default: { |
@@ -894,14 +894,14 @@ static void suffixedexp (LexState *ls, expdesc *v) { | |||
894 | fieldsel(ls, v); | 894 | fieldsel(ls, v); |
895 | break; | 895 | break; |
896 | } | 896 | } |
897 | case '[': { /* `[' exp1 `]' */ | 897 | case '[': { /* '[' exp1 ']' */ |
898 | expdesc key; | 898 | expdesc key; |
899 | luaK_exp2anyregup(fs, v); | 899 | luaK_exp2anyregup(fs, v); |
900 | yindex(ls, &key); | 900 | yindex(ls, &key); |
901 | luaK_indexed(fs, v, &key); | 901 | luaK_indexed(fs, v, &key); |
902 | break; | 902 | break; |
903 | } | 903 | } |
904 | case ':': { /* `:' NAME funcargs */ | 904 | case ':': { /* ':' NAME funcargs */ |
905 | expdesc key; | 905 | expdesc key; |
906 | luaX_next(ls); | 906 | luaX_next(ls); |
907 | checkname(ls, &key); | 907 | checkname(ls, &key); |
@@ -1035,7 +1035,7 @@ static const struct { | |||
1035 | 1035 | ||
1036 | /* | 1036 | /* |
1037 | ** subexpr -> (simpleexp | unop subexpr) { binop subexpr } | 1037 | ** subexpr -> (simpleexp | unop subexpr) { binop subexpr } |
1038 | ** where `binop' is any binary operator with a priority higher than `limit' | 1038 | ** where 'binop' is any binary operator with a priority higher than 'limit' |
1039 | */ | 1039 | */ |
1040 | static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { | 1040 | static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { |
1041 | BinOpr op; | 1041 | BinOpr op; |
@@ -1049,7 +1049,7 @@ static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { | |||
1049 | luaK_prefix(ls->fs, uop, v, line); | 1049 | luaK_prefix(ls->fs, uop, v, line); |
1050 | } | 1050 | } |
1051 | else simpleexp(ls, v); | 1051 | else simpleexp(ls, v); |
1052 | /* expand while operators have priorities higher than `limit' */ | 1052 | /* expand while operators have priorities higher than 'limit' */ |
1053 | op = getbinopr(ls->t.token); | 1053 | op = getbinopr(ls->t.token); |
1054 | while (op != OPR_NOBINOPR && priority[op].left > limit) { | 1054 | while (op != OPR_NOBINOPR && priority[op].left > limit) { |
1055 | expdesc v2; | 1055 | expdesc v2; |
@@ -1149,7 +1149,7 @@ static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { | |||
1149 | "C levels"); | 1149 | "C levels"); |
1150 | assignment(ls, &nv, nvars+1); | 1150 | assignment(ls, &nv, nvars+1); |
1151 | } | 1151 | } |
1152 | else { /* assignment -> `=' explist */ | 1152 | else { /* assignment -> '=' explist */ |
1153 | int nexps; | 1153 | int nexps; |
1154 | checknext(ls, '='); | 1154 | checknext(ls, '='); |
1155 | nexps = explist(ls, &e); | 1155 | nexps = explist(ls, &e); |
@@ -1173,7 +1173,7 @@ static int cond (LexState *ls) { | |||
1173 | /* cond -> exp */ | 1173 | /* cond -> exp */ |
1174 | expdesc v; | 1174 | expdesc v; |
1175 | expr(ls, &v); /* read condition */ | 1175 | expr(ls, &v); /* read condition */ |
1176 | if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */ | 1176 | if (v.k == VNIL) v.k = VFALSE; /* 'falses' are all equal here */ |
1177 | luaK_goiftrue(ls->fs, &v); | 1177 | luaK_goiftrue(ls->fs, &v); |
1178 | return v.f; | 1178 | return v.f; |
1179 | } | 1179 | } |
@@ -1362,7 +1362,7 @@ static void forstat (LexState *ls, int line) { | |||
1362 | TString *varname; | 1362 | TString *varname; |
1363 | BlockCnt bl; | 1363 | BlockCnt bl; |
1364 | enterblock(fs, &bl, 1); /* scope for loop and control variables */ | 1364 | enterblock(fs, &bl, 1); /* scope for loop and control variables */ |
1365 | luaX_next(ls); /* skip `for' */ | 1365 | luaX_next(ls); /* skip 'for' */ |
1366 | varname = str_checkname(ls); /* first variable name */ | 1366 | varname = str_checkname(ls); /* first variable name */ |
1367 | switch (ls->t.token) { | 1367 | switch (ls->t.token) { |
1368 | case '=': fornum(ls, varname, line); break; | 1368 | case '=': fornum(ls, varname, line); break; |
@@ -1370,7 +1370,7 @@ static void forstat (LexState *ls, int line) { | |||
1370 | default: luaX_syntaxerror(ls, "'=' or 'in' expected"); | 1370 | default: luaX_syntaxerror(ls, "'=' or 'in' expected"); |
1371 | } | 1371 | } |
1372 | check_match(ls, TK_END, TK_FOR, line); | 1372 | check_match(ls, TK_END, TK_FOR, line); |
1373 | leaveblock(fs); /* loop scope (`break' jumps to this point) */ | 1373 | leaveblock(fs); /* loop scope ('break' jumps to this point) */ |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | 1376 | ||
@@ -1400,7 +1400,7 @@ static void test_then_block (LexState *ls, int *escapelist) { | |||
1400 | enterblock(fs, &bl, 0); | 1400 | enterblock(fs, &bl, 0); |
1401 | jf = v.f; | 1401 | jf = v.f; |
1402 | } | 1402 | } |
1403 | statlist(ls); /* `then' part */ | 1403 | statlist(ls); /* 'then' part */ |
1404 | leaveblock(fs); | 1404 | leaveblock(fs); |
1405 | if (ls->t.token == TK_ELSE || | 1405 | if (ls->t.token == TK_ELSE || |
1406 | ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */ | 1406 | ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */ |
@@ -1417,7 +1417,7 @@ static void ifstat (LexState *ls, int line) { | |||
1417 | while (ls->t.token == TK_ELSEIF) | 1417 | while (ls->t.token == TK_ELSEIF) |
1418 | test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */ | 1418 | test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */ |
1419 | if (testnext(ls, TK_ELSE)) | 1419 | if (testnext(ls, TK_ELSE)) |
1420 | block(ls); /* `else' part */ | 1420 | block(ls); /* 'else' part */ |
1421 | check_match(ls, TK_END, TK_IF, line); | 1421 | check_match(ls, TK_END, TK_IF, line); |
1422 | luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */ | 1422 | luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */ |
1423 | } | 1423 | } |
@@ -1435,7 +1435,7 @@ static void localfunc (LexState *ls) { | |||
1435 | 1435 | ||
1436 | 1436 | ||
1437 | static void localstat (LexState *ls) { | 1437 | static void localstat (LexState *ls) { |
1438 | /* stat -> LOCAL NAME {`,' NAME} [`=' explist] */ | 1438 | /* stat -> LOCAL NAME {',' NAME} ['=' explist] */ |
1439 | int nvars = 0; | 1439 | int nvars = 0; |
1440 | int nexps; | 1440 | int nexps; |
1441 | expdesc e; | 1441 | expdesc e; |
@@ -1455,7 +1455,7 @@ static void localstat (LexState *ls) { | |||
1455 | 1455 | ||
1456 | 1456 | ||
1457 | static int funcname (LexState *ls, expdesc *v) { | 1457 | static int funcname (LexState *ls, expdesc *v) { |
1458 | /* funcname -> NAME {fieldsel} [`:' NAME] */ | 1458 | /* funcname -> NAME {fieldsel} [':' NAME] */ |
1459 | int ismethod = 0; | 1459 | int ismethod = 0; |
1460 | singlevar(ls, v); | 1460 | singlevar(ls, v); |
1461 | while (ls->t.token == '.') | 1461 | while (ls->t.token == '.') |
@@ -1476,7 +1476,7 @@ static void funcstat (LexState *ls, int line) { | |||
1476 | ismethod = funcname(ls, &v); | 1476 | ismethod = funcname(ls, &v); |
1477 | body(ls, &b, ismethod, line); | 1477 | body(ls, &b, ismethod, line); |
1478 | luaK_storevar(ls->fs, &v, &b); | 1478 | luaK_storevar(ls->fs, &v, &b); |
1479 | luaK_fixline(ls->fs, line); /* definition `happens' in the first line */ | 1479 | luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ |
1480 | } | 1480 | } |
1481 | 1481 | ||
1482 | 1482 | ||
@@ -1518,8 +1518,8 @@ static void retstat (LexState *ls) { | |||
1518 | if (nret == 1) /* only one single value? */ | 1518 | if (nret == 1) /* only one single value? */ |
1519 | first = luaK_exp2anyreg(fs, &e); | 1519 | first = luaK_exp2anyreg(fs, &e); |
1520 | else { | 1520 | else { |
1521 | luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */ | 1521 | luaK_exp2nextreg(fs, &e); /* values must go to the stack */ |
1522 | first = fs->nactvar; /* return all `active' values */ | 1522 | first = fs->nactvar; /* return all active values */ |
1523 | lua_assert(nret == fs->freereg - first); | 1523 | lua_assert(nret == fs->freereg - first); |
1524 | } | 1524 | } |
1525 | } | 1525 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.h,v 1.72 2013/08/30 16:01:37 roberto Exp roberto $ | 2 | ** $Id: lparser.h,v 1.73 2014/06/19 18:27:20 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -21,7 +21,7 @@ typedef enum { | |||
21 | VNIL, | 21 | VNIL, |
22 | VTRUE, | 22 | VTRUE, |
23 | VFALSE, | 23 | VFALSE, |
24 | VK, /* info = index of constant in `k' */ | 24 | VK, /* info = index of constant in 'k' */ |
25 | VKFLT, /* nval = numerical float value */ | 25 | VKFLT, /* nval = numerical float value */ |
26 | VKINT, /* nval = numerical integer value */ | 26 | VKINT, /* nval = numerical integer value */ |
27 | VNONRELOC, /* info = result register */ | 27 | VNONRELOC, /* info = result register */ |
@@ -50,8 +50,8 @@ typedef struct expdesc { | |||
50 | lua_Number nval; /* for VKFLT */ | 50 | lua_Number nval; /* for VKFLT */ |
51 | lua_Integer ival; /* for VKINT */ | 51 | lua_Integer ival; /* for VKINT */ |
52 | } u; | 52 | } u; |
53 | int t; /* patch list of `exit when true' */ | 53 | int t; /* patch list of 'exit when true' */ |
54 | int f; /* patch list of `exit when false' */ | 54 | int f; /* patch list of 'exit when false' */ |
55 | } expdesc; | 55 | } expdesc; |
56 | 56 | ||
57 | 57 | ||
@@ -100,11 +100,11 @@ typedef struct FuncState { | |||
100 | struct FuncState *prev; /* enclosing function */ | 100 | struct FuncState *prev; /* enclosing function */ |
101 | struct LexState *ls; /* lexical state */ | 101 | struct LexState *ls; /* lexical state */ |
102 | struct BlockCnt *bl; /* chain of current blocks */ | 102 | struct BlockCnt *bl; /* chain of current blocks */ |
103 | int pc; /* next position to code (equivalent to `ncode') */ | 103 | int pc; /* next position to code (equivalent to 'ncode') */ |
104 | int lasttarget; /* 'label' of last 'jump label' */ | 104 | int lasttarget; /* 'label' of last 'jump label' */ |
105 | int jpc; /* list of pending jumps to `pc' */ | 105 | int jpc; /* list of pending jumps to 'pc' */ |
106 | int nk; /* number of elements in `k' */ | 106 | int nk; /* number of elements in 'k' */ |
107 | int np; /* number of elements in `p' */ | 107 | int np; /* number of elements in 'p' */ |
108 | int firstlocal; /* index of first local var (in Dyndata array) */ | 108 | int firstlocal; /* index of first local var (in Dyndata array) */ |
109 | short nlocvars; /* number of elements in 'f->locvars' */ | 109 | short nlocvars; /* number of elements in 'f->locvars' */ |
110 | lu_byte nactvar; /* number of active local variables */ | 110 | lu_byte nactvar; /* number of active local variables */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.116 2014/10/06 21:34:34 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.117 2014/10/07 18:29:13 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -103,11 +103,11 @@ typedef struct CallInfo { | |||
103 | 103 | ||
104 | 104 | ||
105 | /* | 105 | /* |
106 | ** `global state', shared by all threads of this state | 106 | ** 'global state', shared by all threads of this state |
107 | */ | 107 | */ |
108 | typedef struct global_State { | 108 | typedef struct global_State { |
109 | lua_Alloc frealloc; /* function to reallocate memory */ | 109 | lua_Alloc frealloc; /* function to reallocate memory */ |
110 | void *ud; /* auxiliary data to `frealloc' */ | 110 | void *ud; /* auxiliary data to 'frealloc' */ |
111 | lu_mem totalbytes; /* number of bytes currently allocated - GCdebt */ | 111 | lu_mem totalbytes; /* number of bytes currently allocated - GCdebt */ |
112 | l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ | 112 | l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ |
113 | lu_mem GCmemtrav; /* memory traversed by the GC */ | 113 | lu_mem GCmemtrav; /* memory traversed by the GC */ |
@@ -133,7 +133,7 @@ typedef struct global_State { | |||
133 | Mbuffer buff; /* temporary buffer for string concatenation */ | 133 | Mbuffer buff; /* temporary buffer for string concatenation */ |
134 | unsigned int gcfinnum; /* number of finalizers to call in each GC step */ | 134 | unsigned int gcfinnum; /* number of finalizers to call in each GC step */ |
135 | int gcpause; /* size of pause between successive GCs */ | 135 | int gcpause; /* size of pause between successive GCs */ |
136 | int gcstepmul; /* GC `granularity' */ | 136 | int gcstepmul; /* GC 'granularity' */ |
137 | lua_CFunction panic; /* to be called in unprotected errors */ | 137 | lua_CFunction panic; /* to be called in unprotected errors */ |
138 | struct lua_State *mainthread; | 138 | struct lua_State *mainthread; |
139 | const lua_Number *version; /* pointer to version number */ | 139 | const lua_Number *version; /* pointer to version number */ |
@@ -144,7 +144,7 @@ typedef struct global_State { | |||
144 | 144 | ||
145 | 145 | ||
146 | /* | 146 | /* |
147 | ** `per thread' state | 147 | ** 'per thread' state |
148 | */ | 148 | */ |
149 | struct lua_State { | 149 | struct lua_State { |
150 | CommonHeader; | 150 | CommonHeader; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.205 2014/10/20 16:44:54 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.206 2014/10/24 11:42:29 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -30,7 +30,7 @@ | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | 32 | ||
33 | /* macro to `unsign' a character */ | 33 | /* macro to 'unsign' a character */ |
34 | #define uchar(c) ((unsigned char)(c)) | 34 | #define uchar(c) ((unsigned char)(c)) |
35 | 35 | ||
36 | 36 | ||
@@ -255,11 +255,11 @@ static const char *classend (MatchState *ms, const char *p) { | |||
255 | } | 255 | } |
256 | case '[': { | 256 | case '[': { |
257 | if (*p == '^') p++; | 257 | if (*p == '^') p++; |
258 | do { /* look for a `]' */ | 258 | do { /* look for a ']' */ |
259 | if (p == ms->p_end) | 259 | if (p == ms->p_end) |
260 | luaL_error(ms->L, "malformed pattern (missing ']')"); | 260 | luaL_error(ms->L, "malformed pattern (missing ']')"); |
261 | if (*(p++) == L_ESC && p < ms->p_end) | 261 | if (*(p++) == L_ESC && p < ms->p_end) |
262 | p++; /* skip escapes (e.g. `%]') */ | 262 | p++; /* skip escapes (e.g. '%]') */ |
263 | } while (*p != ']'); | 263 | } while (*p != ']'); |
264 | return p+1; | 264 | return p+1; |
265 | } | 265 | } |
@@ -294,7 +294,7 @@ static int matchbracketclass (int c, const char *p, const char *ec) { | |||
294 | int sig = 1; | 294 | int sig = 1; |
295 | if (*(p+1) == '^') { | 295 | if (*(p+1) == '^') { |
296 | sig = 0; | 296 | sig = 0; |
297 | p++; /* skip the `^' */ | 297 | p++; /* skip the '^' */ |
298 | } | 298 | } |
299 | while (++p < ec) { | 299 | while (++p < ec) { |
300 | if (*p == L_ESC) { | 300 | if (*p == L_ESC) { |
@@ -431,7 +431,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) { | |||
431 | break; | 431 | break; |
432 | } | 432 | } |
433 | case '$': { | 433 | case '$': { |
434 | if ((p + 1) != ms->p_end) /* is the `$' the last char in pattern? */ | 434 | if ((p + 1) != ms->p_end) /* is the '$' the last char in pattern? */ |
435 | goto dflt; /* no; go to default */ | 435 | goto dflt; /* no; go to default */ |
436 | s = (s == ms->src_end) ? s : NULL; /* check end of string */ | 436 | s = (s == ms->src_end) ? s : NULL; /* check end of string */ |
437 | break; | 437 | break; |
@@ -519,16 +519,16 @@ static const char *match (MatchState *ms, const char *s, const char *p) { | |||
519 | static const char *lmemfind (const char *s1, size_t l1, | 519 | static const char *lmemfind (const char *s1, size_t l1, |
520 | const char *s2, size_t l2) { | 520 | const char *s2, size_t l2) { |
521 | if (l2 == 0) return s1; /* empty strings are everywhere */ | 521 | if (l2 == 0) return s1; /* empty strings are everywhere */ |
522 | else if (l2 > l1) return NULL; /* avoids a negative `l1' */ | 522 | else if (l2 > l1) return NULL; /* avoids a negative 'l1' */ |
523 | else { | 523 | else { |
524 | const char *init; /* to search for a `*s2' inside `s1' */ | 524 | const char *init; /* to search for a '*s2' inside 's1' */ |
525 | l2--; /* 1st char will be checked by `memchr' */ | 525 | l2--; /* 1st char will be checked by 'memchr' */ |
526 | l1 = l1-l2; /* `s2' cannot be found after that */ | 526 | l1 = l1-l2; /* 's2' cannot be found after that */ |
527 | while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { | 527 | while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { |
528 | init++; /* 1st char is already checked */ | 528 | init++; /* 1st char is already checked */ |
529 | if (memcmp(init, s2+1, l2) == 0) | 529 | if (memcmp(init, s2+1, l2) == 0) |
530 | return init-1; | 530 | return init-1; |
531 | else { /* correct `l1' and `s1' to try again */ | 531 | else { /* correct 'l1' and 's1' to try again */ |
532 | l1 -= init-s1; | 532 | l1 -= init-s1; |
533 | s1 = init; | 533 | s1 = init; |
534 | } | 534 | } |
@@ -879,7 +879,7 @@ static int str_format (lua_State *L) { | |||
879 | else if (*++strfrmt == L_ESC) | 879 | else if (*++strfrmt == L_ESC) |
880 | luaL_addchar(&b, *strfrmt++); /* %% */ | 880 | luaL_addchar(&b, *strfrmt++); /* %% */ |
881 | else { /* format item */ | 881 | else { /* format item */ |
882 | char form[MAX_FORMAT]; /* to store the format (`%...') */ | 882 | char form[MAX_FORMAT]; /* to store the format ('%...') */ |
883 | char *buff = luaL_prepbuffsize(&b, MAX_ITEM); /* to put formatted item */ | 883 | char *buff = luaL_prepbuffsize(&b, MAX_ITEM); /* to put formatted item */ |
884 | int nb = 0; /* number of bytes in added item */ | 884 | int nb = 0; /* number of bytes in added item */ |
885 | if (++arg > top) | 885 | if (++arg > top) |
@@ -925,7 +925,7 @@ static int str_format (lua_State *L) { | |||
925 | break; | 925 | break; |
926 | } | 926 | } |
927 | } | 927 | } |
928 | default: { /* also treat cases `pnLlh' */ | 928 | default: { /* also treat cases 'pnLlh' */ |
929 | return luaL_error(L, "invalid option '%%%c' to 'format'", | 929 | return luaL_error(L, "invalid option '%%%c' to 'format'", |
930 | *(strfrmt - 1)); | 930 | *(strfrmt - 1)); |
931 | } | 931 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.96 2014/10/17 16:28:21 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.97 2014/10/24 11:42:06 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -9,11 +9,11 @@ | |||
9 | ** Implementation of tables (aka arrays, objects, or hash tables). | 9 | ** Implementation of tables (aka arrays, objects, or hash tables). |
10 | ** Tables keep its elements in two parts: an array part and a hash part. | 10 | ** Tables keep its elements in two parts: an array part and a hash part. |
11 | ** Non-negative integer keys are all candidates to be kept in the array | 11 | ** Non-negative integer keys are all candidates to be kept in the array |
12 | ** part. The actual size of the array is the largest `n' such that at | 12 | ** part. The actual size of the array is the largest 'n' such that at |
13 | ** least half the slots between 0 and n are in use. | 13 | ** least half the slots between 0 and n are in use. |
14 | ** Hash uses a mix of chained scatter table with Brent's variation. | 14 | ** Hash uses a mix of chained scatter table with Brent's variation. |
15 | ** A main invariant of these tables is that, if an element is not | 15 | ** A main invariant of these tables is that, if an element is not |
16 | ** in its main position (i.e. the `original' position that its hash gives | 16 | ** in its main position (i.e. the 'original' position that its hash gives |
17 | ** to it), then the colliding element is in its own main position. | 17 | ** to it), then the colliding element is in its own main position. |
18 | ** Hence even when the load factor reaches 100%, performance remains good. | 18 | ** Hence even when the load factor reaches 100%, performance remains good. |
19 | */ | 19 | */ |
@@ -111,7 +111,7 @@ static Node *hashfloat (const Table *t, lua_Number n) { | |||
111 | 111 | ||
112 | 112 | ||
113 | /* | 113 | /* |
114 | ** returns the `main' position of an element in a table (that is, the index | 114 | ** returns the 'main' position of an element in a table (that is, the index |
115 | ** of its hash value) | 115 | ** of its hash value) |
116 | */ | 116 | */ |
117 | static Node *mainposition (const Table *t, const TValue *key) { | 117 | static Node *mainposition (const Table *t, const TValue *key) { |
@@ -143,7 +143,7 @@ static Node *mainposition (const Table *t, const TValue *key) { | |||
143 | 143 | ||
144 | 144 | ||
145 | /* | 145 | /* |
146 | ** returns the index for `key' if `key' is an appropriate key to live in | 146 | ** returns the index for 'key' if 'key' is an appropriate key to live in |
147 | ** the array part of the table, 0 otherwise. | 147 | ** the array part of the table, 0 otherwise. |
148 | */ | 148 | */ |
149 | static unsigned int arrayindex (const TValue *key) { | 149 | static unsigned int arrayindex (const TValue *key) { |
@@ -152,12 +152,12 @@ static unsigned int arrayindex (const TValue *key) { | |||
152 | if (0 < k && (lua_Unsigned)k <= MAXASIZE) | 152 | if (0 < k && (lua_Unsigned)k <= MAXASIZE) |
153 | return cast(unsigned int, k); /* 'key' is an appropriate array index */ | 153 | return cast(unsigned int, k); /* 'key' is an appropriate array index */ |
154 | } | 154 | } |
155 | return 0; /* `key' did not match some condition */ | 155 | return 0; /* 'key' did not match some condition */ |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | /* | 159 | /* |
160 | ** returns the index of a `key' for table traversals. First goes all | 160 | ** returns the index of a 'key' for table traversals. First goes all |
161 | ** elements in the array part, then elements in the hash part. The | 161 | ** elements in the array part, then elements in the hash part. The |
162 | ** beginning of a traversal is signaled by 0. | 162 | ** beginning of a traversal is signaled by 0. |
163 | */ | 163 | */ |
@@ -165,13 +165,13 @@ static unsigned int findindex (lua_State *L, Table *t, StkId key) { | |||
165 | unsigned int i; | 165 | unsigned int i; |
166 | if (ttisnil(key)) return 0; /* first iteration */ | 166 | if (ttisnil(key)) return 0; /* first iteration */ |
167 | i = arrayindex(key); | 167 | i = arrayindex(key); |
168 | if (i != 0 && i <= t->sizearray) /* is `key' inside array part? */ | 168 | if (i != 0 && i <= t->sizearray) /* is 'key' inside array part? */ |
169 | return i; /* yes; that's the index */ | 169 | return i; /* yes; that's the index */ |
170 | else { | 170 | else { |
171 | int nx; | 171 | int nx; |
172 | Node *n = mainposition(t, key); | 172 | Node *n = mainposition(t, key); |
173 | for (;;) { /* check whether `key' is somewhere in the chain */ | 173 | for (;;) { /* check whether 'key' is somewhere in the chain */ |
174 | /* key may be dead already, but it is ok to use it in `next' */ | 174 | /* key may be dead already, but it is ok to use it in 'next' */ |
175 | if (luaV_rawequalobj(gkey(n), key) || | 175 | if (luaV_rawequalobj(gkey(n), key) || |
176 | (ttisdeadkey(gkey(n)) && iscollectable(key) && | 176 | (ttisdeadkey(gkey(n)) && iscollectable(key) && |
177 | deadvalue(gkey(n)) == gcvalue(key))) { | 177 | deadvalue(gkey(n)) == gcvalue(key))) { |
@@ -244,7 +244,7 @@ static unsigned int computesizes (unsigned int nums[], unsigned int *narray) { | |||
244 | 244 | ||
245 | static int countint (const TValue *key, unsigned int *nums) { | 245 | static int countint (const TValue *key, unsigned int *nums) { |
246 | unsigned int k = arrayindex(key); | 246 | unsigned int k = arrayindex(key); |
247 | if (k != 0) { /* is `key' an appropriate array index? */ | 247 | if (k != 0) { /* is 'key' an appropriate array index? */ |
248 | nums[luaO_ceillog2(k)]++; /* count as such */ | 248 | nums[luaO_ceillog2(k)]++; /* count as such */ |
249 | return 1; | 249 | return 1; |
250 | } | 250 | } |
@@ -256,7 +256,7 @@ static int countint (const TValue *key, unsigned int *nums) { | |||
256 | static unsigned int numusearray (const Table *t, unsigned int *nums) { | 256 | static unsigned int numusearray (const Table *t, unsigned int *nums) { |
257 | int lg; | 257 | int lg; |
258 | unsigned int ttlg; /* 2^lg */ | 258 | unsigned int ttlg; /* 2^lg */ |
259 | unsigned int ause = 0; /* summation of `nums' */ | 259 | unsigned int ause = 0; /* summation of 'nums' */ |
260 | unsigned int i = 1; /* count to traverse all array keys */ | 260 | unsigned int i = 1; /* count to traverse all array keys */ |
261 | /* traverse each slice */ | 261 | /* traverse each slice */ |
262 | for (lg = 0, ttlg = 1; lg <= MAXABITS; lg++, ttlg *= 2) { | 262 | 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) { | |||
308 | static void setnodevector (lua_State *L, Table *t, unsigned int size) { | 308 | static void setnodevector (lua_State *L, Table *t, unsigned int size) { |
309 | int lsize; | 309 | int lsize; |
310 | if (size == 0) { /* no elements to hash part? */ | 310 | if (size == 0) { /* no elements to hash part? */ |
311 | t->node = cast(Node *, dummynode); /* use common `dummynode' */ | 311 | t->node = cast(Node *, dummynode); /* use common 'dummynode' */ |
312 | lsize = 0; | 312 | lsize = 0; |
313 | } | 313 | } |
314 | else { | 314 | else { |
@@ -498,7 +498,7 @@ const TValue *luaH_getint (Table *t, lua_Integer key) { | |||
498 | return &t->array[key - 1]; | 498 | return &t->array[key - 1]; |
499 | else { | 499 | else { |
500 | Node *n = hashint(t, key); | 500 | Node *n = hashint(t, key); |
501 | for (;;) { /* check whether `key' is somewhere in the chain */ | 501 | for (;;) { /* check whether 'key' is somewhere in the chain */ |
502 | if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) | 502 | if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) |
503 | return gval(n); /* that's it */ | 503 | return gval(n); /* that's it */ |
504 | else { | 504 | else { |
@@ -518,7 +518,7 @@ const TValue *luaH_getint (Table *t, lua_Integer key) { | |||
518 | const TValue *luaH_getstr (Table *t, TString *key) { | 518 | const TValue *luaH_getstr (Table *t, TString *key) { |
519 | Node *n = hashstr(t, key); | 519 | Node *n = hashstr(t, key); |
520 | lua_assert(key->tt == LUA_TSHRSTR); | 520 | lua_assert(key->tt == LUA_TSHRSTR); |
521 | for (;;) { /* check whether `key' is somewhere in the chain */ | 521 | for (;;) { /* check whether 'key' is somewhere in the chain */ |
522 | const TValue *k = gkey(n); | 522 | const TValue *k = gkey(n); |
523 | if (ttisshrstring(k) && eqshrstr(tsvalue(k), key)) | 523 | if (ttisshrstring(k) && eqshrstr(tsvalue(k), key)) |
524 | return gval(n); /* that's it */ | 524 | return gval(n); /* that's it */ |
@@ -548,7 +548,7 @@ const TValue *luaH_get (Table *t, const TValue *key) { | |||
548 | } | 548 | } |
549 | default: { | 549 | default: { |
550 | Node *n = mainposition(t, key); | 550 | Node *n = mainposition(t, key); |
551 | for (;;) { /* check whether `key' is somewhere in the chain */ | 551 | for (;;) { /* check whether 'key' is somewhere in the chain */ |
552 | if (luaV_rawequalobj(gkey(n), key)) | 552 | if (luaV_rawequalobj(gkey(n), key)) |
553 | return gval(n); /* that's it */ | 553 | return gval(n); /* that's it */ |
554 | else { | 554 | else { |
@@ -592,7 +592,7 @@ void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) { | |||
592 | static int unbound_search (Table *t, unsigned int j) { | 592 | static int unbound_search (Table *t, unsigned int j) { |
593 | unsigned int i = j; /* i is zero or a present index */ | 593 | unsigned int i = j; /* i is zero or a present index */ |
594 | j++; | 594 | j++; |
595 | /* find `i' and `j' such that i is present and j is not */ | 595 | /* find 'i' and 'j' such that i is present and j is not */ |
596 | while (!ttisnil(luaH_getint(t, j))) { | 596 | while (!ttisnil(luaH_getint(t, j))) { |
597 | i = j; | 597 | i = j; |
598 | if (j > cast(unsigned int, MAX_INT)/2) { /* overflow? */ | 598 | if (j > cast(unsigned int, MAX_INT)/2) { /* overflow? */ |
@@ -614,7 +614,7 @@ static int unbound_search (Table *t, unsigned int j) { | |||
614 | 614 | ||
615 | 615 | ||
616 | /* | 616 | /* |
617 | ** Try to find a boundary in table `t'. A `boundary' is an integer index | 617 | ** Try to find a boundary in table 't'. A 'boundary' is an integer index |
618 | ** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). | 618 | ** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). |
619 | */ | 619 | */ |
620 | int luaH_getn (Table *t) { | 620 | int luaH_getn (Table *t) { |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.76 2014/09/22 06:42:15 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.77 2014/10/17 16:28:21 roberto Exp roberto $ |
3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -225,7 +225,7 @@ static int unpack (lua_State *L) { | |||
225 | /* | 225 | /* |
226 | ** {====================================================== | 226 | ** {====================================================== |
227 | ** Quicksort | 227 | ** Quicksort |
228 | ** (based on `Algorithms in MODULA-3', Robert Sedgewick; | 228 | ** (based on 'Algorithms in MODULA-3', Robert Sedgewick; |
229 | ** Addison-Wesley, 1993.) | 229 | ** Addison-Wesley, 1993.) |
230 | ** ======================================================= | 230 | ** ======================================================= |
231 | */ | 231 | */ |
@@ -241,7 +241,7 @@ static int sort_comp (lua_State *L, int a, int b) { | |||
241 | int res; | 241 | int res; |
242 | lua_pushvalue(L, 2); | 242 | lua_pushvalue(L, 2); |
243 | lua_pushvalue(L, a-1); /* -1 to compensate function */ | 243 | lua_pushvalue(L, a-1); /* -1 to compensate function */ |
244 | lua_pushvalue(L, b-2); /* -2 to compensate function and `a' */ | 244 | lua_pushvalue(L, b-2); /* -2 to compensate function and 'a' */ |
245 | lua_call(L, 2, 1); | 245 | lua_call(L, 2, 1); |
246 | res = lua_toboolean(L, -1); | 246 | res = lua_toboolean(L, -1); |
247 | lua_pop(L, 1); | 247 | lua_pop(L, 1); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.187 2014/10/06 17:06:49 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.188 2014/10/07 18:29:13 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -152,7 +152,7 @@ void *debug_realloc (void *ud, void *b, size_t oldsize, size_t size) { | |||
152 | memcpy(newblock + 1, block + 1, commonsize); /* copy old contents */ | 152 | memcpy(newblock + 1, block + 1, commonsize); /* copy old contents */ |
153 | freeblock(mc, block); /* erase (and check) old copy */ | 153 | freeblock(mc, block); /* erase (and check) old copy */ |
154 | } | 154 | } |
155 | /* initialize new part of the block with something `weird' */ | 155 | /* initialize new part of the block with something weird */ |
156 | fillmem(cast(char *, newblock + 1) + commonsize, size - commonsize); | 156 | fillmem(cast(char *, newblock + 1) + commonsize, size - commonsize); |
157 | /* initialize marks after block */ | 157 | /* initialize marks after block */ |
158 | for (i = 0; i < MARKSIZE; i++) | 158 | for (i = 0; i < MARKSIZE; i++) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.h,v 2.19 2013/12/30 20:47:58 roberto Exp roberto $ | 2 | ** $Id: ltm.h,v 2.20 2014/06/10 18:53:18 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -21,7 +21,7 @@ typedef enum { | |||
21 | TM_GC, | 21 | TM_GC, |
22 | TM_MODE, | 22 | TM_MODE, |
23 | TM_LEN, | 23 | TM_LEN, |
24 | TM_EQ, /* last tag method with `fast' access */ | 24 | TM_EQ, /* last tag method with fast access */ |
25 | TM_ADD, | 25 | TM_ADD, |
26 | TM_SUB, | 26 | TM_SUB, |
27 | TM_MUL, | 27 | TM_MUL, |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.224 2014/10/17 16:28:21 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.225 2014/10/24 11:42:06 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -158,7 +158,7 @@ void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { | |||
158 | int loop; /* counter to avoid infinite loops */ | 158 | int loop; /* counter to avoid infinite loops */ |
159 | for (loop = 0; loop < MAXTAGLOOP; loop++) { | 159 | for (loop = 0; loop < MAXTAGLOOP; loop++) { |
160 | const TValue *tm; | 160 | const TValue *tm; |
161 | if (ttistable(t)) { /* `t' is a table? */ | 161 | if (ttistable(t)) { /* 't' is a table? */ |
162 | Table *h = hvalue(t); | 162 | Table *h = hvalue(t); |
163 | const TValue *res = luaH_get(h, key); /* do a primitive get */ | 163 | const TValue *res = luaH_get(h, key); /* do a primitive get */ |
164 | if (!ttisnil(res) || /* result is not nil? */ | 164 | if (!ttisnil(res) || /* result is not nil? */ |
@@ -188,7 +188,7 @@ void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { | |||
188 | int loop; /* counter to avoid infinite loops */ | 188 | int loop; /* counter to avoid infinite loops */ |
189 | for (loop = 0; loop < MAXTAGLOOP; loop++) { | 189 | for (loop = 0; loop < MAXTAGLOOP; loop++) { |
190 | const TValue *tm; | 190 | const TValue *tm; |
191 | if (ttistable(t)) { /* `t' is a table? */ | 191 | if (ttistable(t)) { /* 't' is a table? */ |
192 | Table *h = hvalue(t); | 192 | Table *h = hvalue(t); |
193 | TValue *oldval = cast(TValue *, luaH_get(h, key)); | 193 | TValue *oldval = cast(TValue *, luaH_get(h, key)); |
194 | /* if previous value is not nil, there must be a previous entry | 194 | /* 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) { | |||
240 | if (temp != 0) /* not equal? */ | 240 | if (temp != 0) /* not equal? */ |
241 | return temp; /* done */ | 241 | return temp; /* done */ |
242 | else { /* strings are equal up to a '\0' */ | 242 | else { /* strings are equal up to a '\0' */ |
243 | size_t len = strlen(l); /* index of first `\0' in both strings */ | 243 | size_t len = strlen(l); /* index of first '\0' in both strings */ |
244 | if (len == lr) /* 'rs' is finished? */ | 244 | if (len == lr) /* 'rs' is finished? */ |
245 | return (len == ll) ? 0 : 1; /* check 'ls' */ | 245 | return (len == ll) ? 0 : 1; /* check 'ls' */ |
246 | else if (len == ll) /* 'ls' is finished? */ | 246 | else if (len == ll) /* 'ls' is finished? */ |
247 | return -1; /* 'ls' is smaller than 'rs' ('rs' is not finished) */ | 247 | return -1; /* 'ls' is smaller than 'rs' ('rs' is not finished) */ |
248 | /* both strings longer than `len'; go on comparing after the '\0' */ | 248 | /* both strings longer than 'len'; go on comparing after the '\0' */ |
249 | len++; | 249 | len++; |
250 | l += len; ll -= len; r += len; lr -= len; | 250 | l += len; ll -= len; r += len; lr -= len; |
251 | } | 251 | } |
@@ -283,9 +283,9 @@ int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { | |||
283 | return luai_numle(nl, nr); | 283 | return luai_numle(nl, nr); |
284 | else if (ttisstring(l) && ttisstring(r)) /* both are strings? */ | 284 | else if (ttisstring(l) && ttisstring(r)) /* both are strings? */ |
285 | return l_strcmp(tsvalue(l), tsvalue(r)) <= 0; | 285 | return l_strcmp(tsvalue(l), tsvalue(r)) <= 0; |
286 | else if ((res = luaT_callorderTM(L, l, r, TM_LE)) >= 0) /* first try `le' */ | 286 | else if ((res = luaT_callorderTM(L, l, r, TM_LE)) >= 0) /* first try 'le' */ |
287 | return res; | 287 | return res; |
288 | else if ((res = luaT_callorderTM(L, r, l, TM_LT)) < 0) /* else try `lt' */ | 288 | else if ((res = luaT_callorderTM(L, r, l, TM_LT)) < 0) /* else try 'lt' */ |
289 | luaG_ordererror(L, l, r); | 289 | luaG_ordererror(L, l, r); |
290 | return !res; | 290 | return !res; |
291 | } | 291 | } |
@@ -596,7 +596,7 @@ void luaV_finishOp (lua_State *L) { | |||
596 | 596 | ||
597 | 597 | ||
598 | /* | 598 | /* |
599 | ** some macros for common tasks in `luaV_execute' | 599 | ** some macros for common tasks in 'luaV_execute' |
600 | */ | 600 | */ |
601 | 601 | ||
602 | #if !defined luai_runtimecheck | 602 | #if !defined luai_runtimecheck |
@@ -657,7 +657,7 @@ void luaV_execute (lua_State *L) { | |||
657 | (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { | 657 | (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { |
658 | Protect(luaG_traceexec(L)); | 658 | Protect(luaG_traceexec(L)); |
659 | } | 659 | } |
660 | /* WARNING: several calls may realloc the stack and invalidate `ra' */ | 660 | /* WARNING: several calls may realloc the stack and invalidate 'ra' */ |
661 | ra = RA(i); | 661 | ra = RA(i); |
662 | lua_assert(base == ci->u.l.base); | 662 | lua_assert(base == ci->u.l.base); |
663 | lua_assert(base <= L->top && L->top < L->stack + L->stacksize); | 663 | lua_assert(base <= L->top && L->top < L->stack + L->stacksize); |