diff options
Diffstat (limited to 'ltests.c')
| -rw-r--r-- | ltests.c | 14 |
1 files changed, 12 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 2.69 2009/08/26 17:41:26 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.70 2009/09/09 20:44:10 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 | */ |
| @@ -836,6 +836,8 @@ static int getnum_aux (lua_State *L, const char **pc) { | |||
| 836 | sig = -1; | 836 | sig = -1; |
| 837 | (*pc)++; | 837 | (*pc)++; |
| 838 | } | 838 | } |
| 839 | if (!lisdigit(cast(unsigned char, **pc))) | ||
| 840 | luaL_error(L, "number expected (%s)", *pc); | ||
| 839 | while (lisdigit(cast(unsigned char, **pc))) res = res*10 + (*(*pc)++) - '0'; | 841 | while (lisdigit(cast(unsigned char, **pc))) res = res*10 + (*(*pc)++) - '0'; |
| 840 | return sig*res; | 842 | return sig*res; |
| 841 | } | 843 | } |
| @@ -1033,6 +1035,11 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
| 1033 | else if EQ("yield") { | 1035 | else if EQ("yield") { |
| 1034 | return lua_yield(L1, getnum); | 1036 | return lua_yield(L1, getnum); |
| 1035 | } | 1037 | } |
| 1038 | else if EQ("yieldk") { | ||
| 1039 | int nres = getnum; | ||
| 1040 | int i = getnum; | ||
| 1041 | return lua_yieldk(L1, nres, i, Cfunck); | ||
| 1042 | } | ||
| 1036 | else if EQ("loadstring") { | 1043 | else if EQ("loadstring") { |
| 1037 | size_t sl; | 1044 | size_t sl; |
| 1038 | const char *s = luaL_checklstring(L1, getnum, &sl); | 1045 | const char *s = luaL_checklstring(L1, getnum, &sl); |
| @@ -1056,9 +1063,12 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
| 1056 | lua_pushinteger(L1, lua_objlen(L1, i)); | 1063 | lua_pushinteger(L1, lua_objlen(L1, i)); |
| 1057 | } | 1064 | } |
| 1058 | else if EQ("getctx") { | 1065 | else if EQ("getctx") { |
| 1066 | static const char *const codes[] = {"OK", "YIELD", "ERRRUN", | ||
| 1067 | "ERRSYNTAX", "ERRMEM", "ERRGCMM", "ERRERR"}; | ||
| 1068 | |||
| 1059 | int i = 0; | 1069 | int i = 0; |
| 1060 | int s = lua_getctx(L1, &i); | 1070 | int s = lua_getctx(L1, &i); |
| 1061 | lua_pushinteger(L1, s); | 1071 | lua_pushstring(L1, codes[s]); |
| 1062 | lua_pushinteger(L1, i); | 1072 | lua_pushinteger(L1, i); |
| 1063 | } | 1073 | } |
| 1064 | else if EQ("checkstack") { | 1074 | else if EQ("checkstack") { |
