diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-01-25 20:14:54 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-01-25 20:14:54 -0200 |
| commit | 50e29525936be4891f9db090f293432913b5f7c0 (patch) | |
| tree | 8e487b87f82761e15cd096ac345354f57f38fedc /ltests.c | |
| parent | b217ae644e3a83def93be2fe742e2cd0970e1a5f (diff) | |
| download | lua-50e29525936be4891f9db090f293432913b5f7c0.tar.gz lua-50e29525936be4891f9db090f293432913b5f7c0.tar.bz2 lua-50e29525936be4891f9db090f293432913b5f7c0.zip | |
first version of dynamic stack
Diffstat (limited to 'ltests.c')
| -rw-r--r-- | ltests.c | 12 |
1 files changed, 8 insertions, 4 deletions
| @@ -254,10 +254,14 @@ static int hash_query (lua_State *L) { | |||
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | 256 | ||
| 257 | static int Cstacklevel (lua_State *L) { | 257 | static int stacklevel (lua_State *L) { |
| 258 | unsigned long a = 0; | 258 | unsigned long a = 0; |
| 259 | lua_pushnumber(L, (int)(L->top - L->stack)); | ||
| 260 | lua_pushnumber(L, (int)(L->stack_last - L->stack)); | ||
| 261 | lua_pushnumber(L, (int)(L->ci - L->base_ci)); | ||
| 262 | lua_pushnumber(L, (int)(L->end_ci - L->base_ci)); | ||
| 259 | lua_pushnumber(L, (unsigned long)&a); | 263 | lua_pushnumber(L, (unsigned long)&a); |
| 260 | return 1; | 264 | return 5; |
| 261 | } | 265 | } |
| 262 | 266 | ||
| 263 | 267 | ||
| @@ -307,7 +311,7 @@ static int string_query (lua_State *L) { | |||
| 307 | int n = 0; | 311 | int n = 0; |
| 308 | for (ts = tb->hash[s]; ts; ts = ts->tsv.nexthash) { | 312 | for (ts = tb->hash[s]; ts; ts = ts->tsv.nexthash) { |
| 309 | setsvalue(L->top, ts); | 313 | setsvalue(L->top, ts); |
| 310 | incr_top; | 314 | incr_top(L); |
| 311 | n++; | 315 | n++; |
| 312 | } | 316 | } |
| 313 | return n; | 317 | return n; |
| @@ -629,7 +633,7 @@ static const struct luaL_reg tests_funcs[] = { | |||
| 629 | {"listk", listk}, | 633 | {"listk", listk}, |
| 630 | {"listlocals", listlocals}, | 634 | {"listlocals", listlocals}, |
| 631 | {"loadlib", loadlib}, | 635 | {"loadlib", loadlib}, |
| 632 | {"Cstacklevel", Cstacklevel}, | 636 | {"stacklevel", stacklevel}, |
| 633 | {"querystr", string_query}, | 637 | {"querystr", string_query}, |
| 634 | {"querytab", table_query}, | 638 | {"querytab", table_query}, |
| 635 | {"testC", testC}, | 639 | {"testC", testC}, |
