diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-02 13:45:03 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-02 13:45:03 -0300 |
| commit | 15462edb0ff86bf1904011b29635420451cab2c5 (patch) | |
| tree | 9a626d34736b830f83fda3f1b2f3342990a05b1f /ldebug.c | |
| parent | 6f936bc7931662d0460d47ad73eca308ba5fab2f (diff) | |
| download | lua-15462edb0ff86bf1904011b29635420451cab2c5.tar.gz lua-15462edb0ff86bf1904011b29635420451cab2c5.tar.bz2 lua-15462edb0ff86bf1904011b29635420451cab2c5.zip | |
new definitions for closure structures
Diffstat (limited to '')
| -rw-r--r-- | ldebug.c | 18 |
1 files changed, 9 insertions, 9 deletions
| @@ -33,7 +33,7 @@ static const l_char *getfuncname (lua_State *L, CallInfo *ci, | |||
| 33 | 33 | ||
| 34 | static int isLmark (CallInfo *ci) { | 34 | static int isLmark (CallInfo *ci) { |
| 35 | lua_assert(ci == NULL || ttype(ci->base - 1) == LUA_TFUNCTION); | 35 | lua_assert(ci == NULL || ttype(ci->base - 1) == LUA_TFUNCTION); |
| 36 | return (ci && ci->prev && !ci_func(ci)->isC); | 36 | return (ci && ci->prev && !ci_func(ci)->c.isC); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | 39 | ||
| @@ -117,7 +117,7 @@ int luaG_getline (int *lineinfo, int pc, int refline, int *prefi) { | |||
| 117 | static int currentpc (CallInfo *ci) { | 117 | static int currentpc (CallInfo *ci) { |
| 118 | lua_assert(isLmark(ci)); | 118 | lua_assert(isLmark(ci)); |
| 119 | if (ci->pc) | 119 | if (ci->pc) |
| 120 | return (*ci->pc - ci_func(ci)->u.l.p->code) - 1; | 120 | return (*ci->pc - ci_func(ci)->l.p->code) - 1; |
| 121 | else | 121 | else |
| 122 | return -1; /* function is not active */ | 122 | return -1; /* function is not active */ |
| 123 | } | 123 | } |
| @@ -127,7 +127,7 @@ static int currentline (CallInfo *ci) { | |||
| 127 | if (!isLmark(ci)) | 127 | if (!isLmark(ci)) |
| 128 | return -1; /* only active lua functions have current-line information */ | 128 | return -1; /* only active lua functions have current-line information */ |
| 129 | else { | 129 | else { |
| 130 | int *lineinfo = ci_func(ci)->u.l.p->lineinfo; | 130 | int *lineinfo = ci_func(ci)->l.p->lineinfo; |
| 131 | return luaG_getline(lineinfo, currentpc(ci), 1, NULL); | 131 | return luaG_getline(lineinfo, currentpc(ci), 1, NULL); |
| 132 | } | 132 | } |
| 133 | } | 133 | } |
| @@ -135,7 +135,7 @@ static int currentline (CallInfo *ci) { | |||
| 135 | 135 | ||
| 136 | 136 | ||
| 137 | static Proto *getluaproto (CallInfo *ci) { | 137 | static Proto *getluaproto (CallInfo *ci) { |
| 138 | return (isLmark(ci) ? ci_func(ci)->u.l.p : NULL); | 138 | return (isLmark(ci) ? ci_func(ci)->l.p : NULL); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | 141 | ||
| @@ -193,13 +193,13 @@ static void funcinfo (lua_State *L, lua_Debug *ar, StkId func) { | |||
| 193 | luaD_error(L, l_s("value for `lua_getinfo' is not a function")); | 193 | luaD_error(L, l_s("value for `lua_getinfo' is not a function")); |
| 194 | cl = NULL; /* to avoid warnings */ | 194 | cl = NULL; /* to avoid warnings */ |
| 195 | } | 195 | } |
| 196 | if (cl->isC) { | 196 | if (cl->c.isC) { |
| 197 | ar->source = l_s("=C"); | 197 | ar->source = l_s("=C"); |
| 198 | ar->linedefined = -1; | 198 | ar->linedefined = -1; |
| 199 | ar->what = l_s("C"); | 199 | ar->what = l_s("C"); |
| 200 | } | 200 | } |
| 201 | else | 201 | else |
| 202 | infoLproto(ar, cl->u.l.p); | 202 | infoLproto(ar, cl->l.p); |
| 203 | luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); | 203 | luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); |
| 204 | if (ar->linedefined == 0) | 204 | if (ar->linedefined == 0) |
| 205 | ar->what = l_s("main"); | 205 | ar->what = l_s("main"); |
| @@ -268,7 +268,7 @@ LUA_API int lua_getinfo (lua_State *L, const l_char *what, lua_Debug *ar) { | |||
| 268 | break; | 268 | break; |
| 269 | } | 269 | } |
| 270 | case l_c('u'): { | 270 | case l_c('u'): { |
| 271 | ar->nups = (ttype(f) == LUA_TFUNCTION) ? clvalue(f)->nupvalues : 0; | 271 | ar->nups = (ttype(f) == LUA_TFUNCTION) ? clvalue(f)->c.nupvalues : 0; |
| 272 | break; | 272 | break; |
| 273 | } | 273 | } |
| 274 | case l_c('n'): { | 274 | case l_c('n'): { |
| @@ -473,7 +473,7 @@ int luaG_checkcode (const Proto *pt) { | |||
| 473 | static const l_char *getobjname (lua_State *L, StkId obj, const l_char **name) { | 473 | static const l_char *getobjname (lua_State *L, StkId obj, const l_char **name) { |
| 474 | CallInfo *ci = ci_stack(L, obj); | 474 | CallInfo *ci = ci_stack(L, obj); |
| 475 | if (isLmark(ci)) { /* an active Lua function? */ | 475 | if (isLmark(ci)) { /* an active Lua function? */ |
| 476 | Proto *p = ci_func(ci)->u.l.p; | 476 | Proto *p = ci_func(ci)->l.p; |
| 477 | int pc = currentpc(ci); | 477 | int pc = currentpc(ci); |
| 478 | int stackpos = obj - ci->base; | 478 | int stackpos = obj - ci->base; |
| 479 | Instruction i; | 479 | Instruction i; |
| @@ -517,7 +517,7 @@ static const l_char *getfuncname (lua_State *L, CallInfo *ci, | |||
| 517 | if (ci == &L->basefunc || !isLmark(ci)) | 517 | if (ci == &L->basefunc || !isLmark(ci)) |
| 518 | return NULL; /* not an active Lua function */ | 518 | return NULL; /* not an active Lua function */ |
| 519 | else { | 519 | else { |
| 520 | Proto *p = ci_func(ci)->u.l.p; | 520 | Proto *p = ci_func(ci)->l.p; |
| 521 | int pc = currentpc(ci); | 521 | int pc = currentpc(ci); |
| 522 | Instruction i; | 522 | Instruction i; |
| 523 | if (pc == -1) return NULL; /* function is not activated */ | 523 | if (pc == -1) return NULL; /* function is not activated */ |
