diff options
-rw-r--r-- | lapi.c | 4 | ||||
-rw-r--r-- | ldebug.c | 12 | ||||
-rw-r--r-- | llex.c | 4 | ||||
-rw-r--r-- | lstate.c | 6 | ||||
-rw-r--r-- | ltable.c | 24 | ||||
-rw-r--r-- | ltable.h | 5 | ||||
-rw-r--r-- | lvm.c | 4 |
7 files changed, 25 insertions, 34 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.148 2011/06/02 19:31:40 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.149 2011/06/13 14:13:06 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 | */ |
@@ -744,7 +744,7 @@ LUA_API void lua_rawseti (lua_State *L, int idx, int n) { | |||
744 | api_checknelems(L, 1); | 744 | api_checknelems(L, 1); |
745 | o = index2addr(L, idx); | 745 | o = index2addr(L, idx); |
746 | api_check(L, ttistable(o), "table expected"); | 746 | api_check(L, ttistable(o), "table expected"); |
747 | setobj2t(L, luaH_setint(L, hvalue(o), n), L->top-1); | 747 | luaH_setint(L, hvalue(o), n, L->top - 1); |
748 | luaC_barrierback(L, gcvalue(o), L->top-1); | 748 | luaC_barrierback(L, gcvalue(o), L->top-1); |
749 | L->top--; | 749 | L->top--; |
750 | lua_unlock(L); | 750 | lua_unlock(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.81 2011/04/28 14:00:11 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.82 2011/06/02 19:31:40 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 | */ |
@@ -190,12 +190,14 @@ static void collectvalidlines (lua_State *L, Closure *f) { | |||
190 | } | 190 | } |
191 | else { | 191 | else { |
192 | int i; | 192 | int i; |
193 | TValue v; | ||
193 | int *lineinfo = f->l.p->lineinfo; | 194 | int *lineinfo = f->l.p->lineinfo; |
194 | Table *t = luaH_new(L); | 195 | Table *t = luaH_new(L); /* new table to store active lines */ |
195 | sethvalue(L, L->top, t); | 196 | sethvalue(L, L->top, t); /* push it on stack */ |
196 | incr_top(L); | 197 | incr_top(L); |
197 | for (i=0; i<f->l.p->sizelineinfo; i++) | 198 | setbvalue(&v, 1); /* boolean 'true' to be the value of all indices */ |
198 | setbvalue(luaH_setint(L, t, lineinfo[i]), 1); | 199 | for (i = 0; i < f->l.p->sizelineinfo; i++) /* for all lines with code */ |
200 | luaH_setint(L, t, lineinfo[i], &v); /* table[line] = true */ | ||
199 | } | 201 | } |
200 | } | 202 | } |
201 | 203 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 2.54 2011/07/15 12:30:41 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.55 2011/07/15 12:48:03 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 | */ |
@@ -126,7 +126,7 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { | |||
126 | TValue *o; /* entry for `str' */ | 126 | TValue *o; /* entry for `str' */ |
127 | TString *ts = luaS_newlstr(L, str, l); /* create new string */ | 127 | TString *ts = luaS_newlstr(L, str, l); /* create new string */ |
128 | setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ | 128 | setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ |
129 | o = luaH_setstr(L, ls->fs->h, ts); | 129 | o = luaH_set(L, ls->fs->h, L->top - 1); |
130 | if (ttisnil(o)) { | 130 | if (ttisnil(o)) { |
131 | setbvalue(o, 1); /* t[string] = true */ | 131 | setbvalue(o, 1); /* t[string] = true */ |
132 | luaC_checkGC(L); | 132 | luaC_checkGC(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.88 2010/12/20 18:17:46 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.89 2010/12/20 19:40:07 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 | */ |
@@ -136,10 +136,10 @@ static void init_registry (lua_State *L, global_State *g) { | |||
136 | luaH_resize(L, registry, LUA_RIDX_LAST, 0); | 136 | luaH_resize(L, registry, LUA_RIDX_LAST, 0); |
137 | /* registry[LUA_RIDX_MAINTHREAD] = L */ | 137 | /* registry[LUA_RIDX_MAINTHREAD] = L */ |
138 | setthvalue(L, &mt, L); | 138 | setthvalue(L, &mt, L); |
139 | setobj2t(L, luaH_setint(L, registry, LUA_RIDX_MAINTHREAD), &mt); | 139 | luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &mt); |
140 | /* registry[LUA_RIDX_GLOBALS] = table of globals */ | 140 | /* registry[LUA_RIDX_GLOBALS] = table of globals */ |
141 | sethvalue(L, &mt, luaH_new(L)); | 141 | sethvalue(L, &mt, luaH_new(L)); |
142 | setobj2t(L, luaH_setint(L, registry, LUA_RIDX_GLOBALS), &mt); | 142 | luaH_setint(L, registry, LUA_RIDX_GLOBALS, &mt); |
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.59 2011/06/09 18:23:27 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.60 2011/06/16 14:14:31 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 | */ |
@@ -314,7 +314,7 @@ void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize) { | |||
314 | /* re-insert elements from vanishing slice */ | 314 | /* re-insert elements from vanishing slice */ |
315 | for (i=nasize; i<oldasize; i++) { | 315 | for (i=nasize; i<oldasize; i++) { |
316 | if (!ttisnil(&t->array[i])) | 316 | if (!ttisnil(&t->array[i])) |
317 | setobjt2t(L, luaH_setint(L, t, i+1), &t->array[i]); | 317 | luaH_setint(L, t, i + 1, &t->array[i]); |
318 | } | 318 | } |
319 | /* shrink array */ | 319 | /* shrink array */ |
320 | luaM_reallocvector(L, t->array, oldasize, nasize, TValue); | 320 | luaM_reallocvector(L, t->array, oldasize, nasize, TValue); |
@@ -507,27 +507,17 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { | |||
507 | } | 507 | } |
508 | 508 | ||
509 | 509 | ||
510 | TValue *luaH_setint (lua_State *L, Table *t, int key) { | 510 | void luaH_setint (lua_State *L, Table *t, int key, TValue *value) { |
511 | const TValue *p = luaH_getint(t, key); | 511 | const TValue *p = luaH_getint(t, key); |
512 | TValue *cell; | ||
512 | if (p != luaO_nilobject) | 513 | if (p != luaO_nilobject) |
513 | return cast(TValue *, p); | 514 | cell = cast(TValue *, p); |
514 | else { | 515 | else { |
515 | TValue k; | 516 | TValue k; |
516 | setnvalue(&k, cast_num(key)); | 517 | setnvalue(&k, cast_num(key)); |
517 | return newkey(L, t, &k); | 518 | cell = newkey(L, t, &k); |
518 | } | ||
519 | } | ||
520 | |||
521 | |||
522 | TValue *luaH_setstr (lua_State *L, Table *t, TString *key) { | ||
523 | const TValue *p = luaH_getstr(t, key); | ||
524 | if (p != luaO_nilobject) | ||
525 | return cast(TValue *, p); | ||
526 | else { | ||
527 | TValue k; | ||
528 | setsvalue(L, &k, key); | ||
529 | return newkey(L, t, &k); | ||
530 | } | 519 | } |
520 | setobj2t(L, cell, value); | ||
531 | } | 521 | } |
532 | 522 | ||
533 | 523 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.h,v 2.13 2009/11/06 17:07:48 roberto Exp roberto $ | 2 | ** $Id: ltable.h,v 2.14 2010/06/25 12:18:10 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 | */ |
@@ -17,9 +17,8 @@ | |||
17 | 17 | ||
18 | 18 | ||
19 | LUAI_FUNC const TValue *luaH_getint (Table *t, int key); | 19 | LUAI_FUNC const TValue *luaH_getint (Table *t, int key); |
20 | LUAI_FUNC TValue *luaH_setint (lua_State *L, Table *t, int key); | 20 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, int key, TValue *value); |
21 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); | 21 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); |
22 | LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); | ||
23 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); | 22 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); |
24 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); | 23 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); |
25 | LUAI_FUNC Table *luaH_new (lua_State *L); | 24 | LUAI_FUNC Table *luaH_new (lua_State *L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.140 2011/06/02 19:31:40 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.141 2011/06/09 18:24:22 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 | */ |
@@ -808,7 +808,7 @@ void luaV_execute (lua_State *L) { | |||
808 | luaH_resizearray(L, h, last); /* pre-allocate it at once */ | 808 | luaH_resizearray(L, h, last); /* pre-allocate it at once */ |
809 | for (; n > 0; n--) { | 809 | for (; n > 0; n--) { |
810 | TValue *val = ra+n; | 810 | TValue *val = ra+n; |
811 | setobj2t(L, luaH_setint(L, h, last--), val); | 811 | luaH_setint(L, h, last--, val); |
812 | luaC_barrierback(L, obj2gco(h), val); | 812 | luaC_barrierback(L, obj2gco(h), val); |
813 | } | 813 | } |
814 | L->top = ci->top; /* correct top (in case of previous open call) */ | 814 | L->top = ci->top; /* correct top (in case of previous open call) */ |