diff options
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 1.9 2000/02/17 18:30:36 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.10 2000/03/03 14:58:26 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 | */ |
@@ -23,11 +23,11 @@ | |||
23 | 23 | ||
24 | 24 | ||
25 | static const lua_Type normtype[] = { /* ORDER LUA_T */ | 25 | static const lua_Type normtype[] = { /* ORDER LUA_T */ |
26 | LUA_T_USERDATA, LUA_T_NUMBER, LUA_T_STRING, LUA_T_ARRAY, | 26 | TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_ARRAY, |
27 | LUA_T_LPROTO, LUA_T_CPROTO, LUA_T_NIL, | 27 | TAG_LPROTO, TAG_CPROTO, TAG_NIL, |
28 | LUA_T_LCLOSURE, LUA_T_CCLOSURE, | 28 | TAG_LCLOSURE, TAG_CCLOSURE, |
29 | LUA_T_LCLOSURE, LUA_T_CCLOSURE, /* LUA_T_LCLMARK, LUA_T_CCLMARK */ | 29 | TAG_LCLOSURE, TAG_CCLOSURE, /* TAG_LCLMARK, TAG_CCLMARK */ |
30 | LUA_T_LPROTO, LUA_T_CPROTO /* LUA_T_LMARK, LUA_T_CMARK */ | 30 | TAG_LPROTO, TAG_CPROTO /* TAG_LMARK, TAG_CMARK */ |
31 | }; | 31 | }; |
32 | 32 | ||
33 | 33 | ||
@@ -39,7 +39,7 @@ static void setnormalized (TObject *d, const TObject *s) { | |||
39 | 39 | ||
40 | 40 | ||
41 | static int hasdebuginfo (lua_State *L, StkId f) { | 41 | static int hasdebuginfo (lua_State *L, StkId f) { |
42 | return (f+1 < L->top && (f+1)->ttype == LUA_T_LINE); | 42 | return (f+1 < L->top && (f+1)->ttype == TAG_LINE); |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
@@ -89,8 +89,8 @@ int lua_getstack (lua_State *L, int level, lua_Dbgactreg *ar) { | |||
89 | 89 | ||
90 | static int lua_nups (StkId f) { | 90 | static int lua_nups (StkId f) { |
91 | switch (ttype(f)) { | 91 | switch (ttype(f)) { |
92 | case LUA_T_LCLOSURE: case LUA_T_CCLOSURE: | 92 | case TAG_LCLOSURE: case TAG_CCLOSURE: |
93 | case LUA_T_LCLMARK: case LUA_T_CCLMARK: | 93 | case TAG_LCLMARK: case TAG_CCLMARK: |
94 | return f->value.cl->nelems; | 94 | return f->value.cl->nelems; |
95 | default: | 95 | default: |
96 | return 0; | 96 | return 0; |
@@ -103,10 +103,10 @@ static int lua_currentline (lua_State *L, StkId f) { | |||
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | static TProtoFunc *getluaproto (StkId f) { | 106 | static Proto *getluaproto (StkId f) { |
107 | if (ttype(f) == LUA_T_LMARK) | 107 | if (ttype(f) == TAG_LMARK) |
108 | return f->value.tf; | 108 | return f->value.tf; |
109 | else if (ttype(f) == LUA_T_LCLMARK) | 109 | else if (ttype(f) == TAG_LCLMARK) |
110 | return protovalue(f)->value.tf; | 110 | return protovalue(f)->value.tf; |
111 | else return NULL; | 111 | else return NULL; |
112 | } | 112 | } |
@@ -114,13 +114,13 @@ static TProtoFunc *getluaproto (StkId f) { | |||
114 | 114 | ||
115 | int lua_getlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) { | 115 | int lua_getlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) { |
116 | StkId f = ar->_func; | 116 | StkId f = ar->_func; |
117 | TProtoFunc *fp = getluaproto(f); | 117 | Proto *fp = getluaproto(f); |
118 | if (!fp) return 0; /* `f' is not a Lua function? */ | 118 | if (!fp) return 0; /* `f' is not a Lua function? */ |
119 | v->name = luaF_getlocalname(fp, v->index, lua_currentline(L, f)); | 119 | v->name = luaF_getlocalname(fp, v->index, lua_currentline(L, f)); |
120 | if (!v->name) return 0; | 120 | if (!v->name) return 0; |
121 | /* if `name', there must be a LUA_T_LINE */ | 121 | /* if `name', there must be a TAG_LINE */ |
122 | /* therefore, f+2 points to function base */ | 122 | /* therefore, f+2 points to function base */ |
123 | LUA_ASSERT(L, ttype(f+1) == LUA_T_LINE, ""); | 123 | LUA_ASSERT(L, ttype(f+1) == TAG_LINE, ""); |
124 | v->value = luaA_putluaObject(L, (f+2)+(v->index-1)); | 124 | v->value = luaA_putluaObject(L, (f+2)+(v->index-1)); |
125 | return 1; | 125 | return 1; |
126 | } | 126 | } |
@@ -128,11 +128,11 @@ int lua_getlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) { | |||
128 | 128 | ||
129 | int lua_setlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) { | 129 | int lua_setlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) { |
130 | StkId f = ar->_func; | 130 | StkId f = ar->_func; |
131 | TProtoFunc *fp = getluaproto(f); | 131 | Proto *fp = getluaproto(f); |
132 | if (!fp) return 0; /* `f' is not a Lua function? */ | 132 | if (!fp) return 0; /* `f' is not a Lua function? */ |
133 | v->name = luaF_getlocalname(fp, v->index, lua_currentline(L, f)); | 133 | v->name = luaF_getlocalname(fp, v->index, lua_currentline(L, f)); |
134 | if (!v->name) return 0; | 134 | if (!v->name) return 0; |
135 | LUA_ASSERT(L, ttype(f+1) == LUA_T_LINE, ""); | 135 | LUA_ASSERT(L, ttype(f+1) == TAG_LINE, ""); |
136 | *((f+2)+(v->index-1)) = *v->value; | 136 | *((f+2)+(v->index-1)) = *v->value; |
137 | return 1; | 137 | return 1; |
138 | } | 138 | } |
@@ -141,12 +141,12 @@ int lua_setlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) { | |||
141 | static void lua_funcinfo (lua_Dbgactreg *ar) { | 141 | static void lua_funcinfo (lua_Dbgactreg *ar) { |
142 | StkId func = ar->_func; | 142 | StkId func = ar->_func; |
143 | switch (ttype(func)) { | 143 | switch (ttype(func)) { |
144 | case LUA_T_LPROTO: case LUA_T_LMARK: | 144 | case TAG_LPROTO: case TAG_LMARK: |
145 | ar->source = tfvalue(func)->source->str; | 145 | ar->source = tfvalue(func)->source->str; |
146 | ar->linedefined = tfvalue(func)->lineDefined; | 146 | ar->linedefined = tfvalue(func)->lineDefined; |
147 | ar->what = "Lua"; | 147 | ar->what = "Lua"; |
148 | break; | 148 | break; |
149 | case LUA_T_LCLOSURE: case LUA_T_LCLMARK: | 149 | case TAG_LCLOSURE: case TAG_LCLMARK: |
150 | ar->source = tfvalue(protovalue(func))->source->str; | 150 | ar->source = tfvalue(protovalue(func))->source->str; |
151 | ar->linedefined = tfvalue(protovalue(func))->lineDefined; | 151 | ar->linedefined = tfvalue(protovalue(func))->lineDefined; |
152 | ar->what = "Lua"; | 152 | ar->what = "Lua"; |