aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ltests.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/ltests.c b/ltests.c
index 1517aa88..d92cd6c5 100644
--- a/ltests.c
+++ b/ltests.c
@@ -910,9 +910,9 @@ static int get_limits (lua_State *L) {
910 910
911static int mem_query (lua_State *L) { 911static int mem_query (lua_State *L) {
912 if (lua_isnone(L, 1)) { 912 if (lua_isnone(L, 1)) {
913 lua_pushinteger(L, cast(lua_Integer, l_memcontrol.total)); 913 lua_pushinteger(L, cast_Integer(l_memcontrol.total));
914 lua_pushinteger(L, cast(lua_Integer, l_memcontrol.numblocks)); 914 lua_pushinteger(L, cast_Integer(l_memcontrol.numblocks));
915 lua_pushinteger(L, cast(lua_Integer, l_memcontrol.maxmem)); 915 lua_pushinteger(L, cast_Integer(l_memcontrol.maxmem));
916 return 3; 916 return 3;
917 } 917 }
918 else if (lua_isnumber(L, 1)) { 918 else if (lua_isnumber(L, 1)) {
@@ -926,7 +926,7 @@ static int mem_query (lua_State *L) {
926 int i; 926 int i;
927 for (i = LUA_NUMTYPES - 1; i >= 0; i--) { 927 for (i = LUA_NUMTYPES - 1; i >= 0; i--) {
928 if (strcmp(t, ttypename(i)) == 0) { 928 if (strcmp(t, ttypename(i)) == 0) {
929 lua_pushinteger(L, cast(lua_Integer, l_memcontrol.objcount[i])); 929 lua_pushinteger(L, cast_Integer(l_memcontrol.objcount[i]));
930 return 1; 930 return 1;
931 } 931 }
932 } 932 }
@@ -1066,15 +1066,19 @@ static int tracegc (lua_State *L) {
1066 1066
1067static int hash_query (lua_State *L) { 1067static int hash_query (lua_State *L) {
1068 if (lua_isnone(L, 2)) { 1068 if (lua_isnone(L, 2)) {
1069 TString *ts;
1069 luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected"); 1070 luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected");
1070 lua_pushinteger(L, cast_int(tsvalue(obj_at(L, 1))->hash)); 1071 ts = tsvalue(obj_at(L, 1));
1072 if (ts->tt == LUA_VLNGSTR)
1073 luaS_hashlongstr(ts); /* make sure long string has a hash */
1074 lua_pushinteger(L, cast_int(ts->hash));
1071 } 1075 }
1072 else { 1076 else {
1073 TValue *o = obj_at(L, 1); 1077 TValue *o = obj_at(L, 1);
1074 Table *t; 1078 Table *t;
1075 luaL_checktype(L, 2, LUA_TTABLE); 1079 luaL_checktype(L, 2, LUA_TTABLE);
1076 t = hvalue(obj_at(L, 2)); 1080 t = hvalue(obj_at(L, 2));
1077 lua_pushinteger(L, cast(lua_Integer, luaH_mainposition(t, o) - t->node)); 1081 lua_pushinteger(L, cast_Integer(luaH_mainposition(t, o) - t->node));
1078 } 1082 }
1079 return 1; 1083 return 1;
1080} 1084}
@@ -1082,9 +1086,9 @@ static int hash_query (lua_State *L) {
1082 1086
1083static int stacklevel (lua_State *L) { 1087static int stacklevel (lua_State *L) {
1084 int a = 0; 1088 int a = 0;
1085 lua_pushinteger(L, cast(lua_Integer, L->top.p - L->stack.p)); 1089 lua_pushinteger(L, cast_Integer(L->top.p - L->stack.p));
1086 lua_pushinteger(L, stacksize(L)); 1090 lua_pushinteger(L, stacksize(L));
1087 lua_pushinteger(L, cast(lua_Integer, L->nCcalls)); 1091 lua_pushinteger(L, cast_Integer(L->nCcalls));
1088 lua_pushinteger(L, L->nci); 1092 lua_pushinteger(L, L->nci);
1089 lua_pushinteger(L, (lua_Integer)(size_t)&a); 1093 lua_pushinteger(L, (lua_Integer)(size_t)&a);
1090 return 5; 1094 return 5;
@@ -1099,9 +1103,9 @@ static int table_query (lua_State *L) {
1099 t = hvalue(obj_at(L, 1)); 1103 t = hvalue(obj_at(L, 1));
1100 asize = t->asize; 1104 asize = t->asize;
1101 if (i == -1) { 1105 if (i == -1) {
1102 lua_pushinteger(L, cast(lua_Integer, asize)); 1106 lua_pushinteger(L, cast_Integer(asize));
1103 lua_pushinteger(L, cast(lua_Integer, allocsizenode(t))); 1107 lua_pushinteger(L, cast_Integer(allocsizenode(t)));
1104 lua_pushinteger(L, cast(lua_Integer, asize > 0 ? *lenhint(t) : 0)); 1108 lua_pushinteger(L, cast_Integer(asize > 0 ? *lenhint(t) : 0));
1105 return 3; 1109 return 3;
1106 } 1110 }
1107 else if (cast_uint(i) < asize) { 1111 else if (cast_uint(i) < asize) {
@@ -1157,7 +1161,7 @@ static int test_codeparam (lua_State *L) {
1157static int test_applyparam (lua_State *L) { 1161static int test_applyparam (lua_State *L) {
1158 lua_Integer p = luaL_checkinteger(L, 1); 1162 lua_Integer p = luaL_checkinteger(L, 1);
1159 lua_Integer x = luaL_checkinteger(L, 2); 1163 lua_Integer x = luaL_checkinteger(L, 2);
1160 lua_pushinteger(L, cast(lua_Integer, luaO_applyparam(cast_byte(p), x))); 1164 lua_pushinteger(L, cast_Integer(luaO_applyparam(cast_byte(p), x)));
1161 return 1; 1165 return 1;
1162} 1166}
1163 1167
@@ -1257,7 +1261,7 @@ static int pushuserdata (lua_State *L) {
1257 1261
1258 1262
1259static int udataval (lua_State *L) { 1263static int udataval (lua_State *L) {
1260 lua_pushinteger(L, cast(lua_Integer, cast(size_t, lua_touserdata(L, 1)))); 1264 lua_pushinteger(L, cast_st2S(cast_sizet(lua_touserdata(L, 1))));
1261 return 1; 1265 return 1;
1262} 1266}
1263 1267
@@ -1294,7 +1298,7 @@ static int num2int (lua_State *L) {
1294 1298
1295 1299
1296static int makeseed (lua_State *L) { 1300static int makeseed (lua_State *L) {
1297 lua_pushinteger(L, cast(lua_Integer, luaL_makeseed(L))); 1301 lua_pushinteger(L, cast_Integer(luaL_makeseed(L)));
1298 return 1; 1302 return 1;
1299} 1303}
1300 1304
@@ -1638,7 +1642,7 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
1638 } 1642 }
1639 else if EQ("func2num") { 1643 else if EQ("func2num") {
1640 lua_CFunction func = lua_tocfunction(L1, getindex); 1644 lua_CFunction func = lua_tocfunction(L1, getindex);
1641 lua_pushinteger(L1, cast(lua_Integer, cast(size_t, func))); 1645 lua_pushinteger(L1, cast_st2S(cast_sizet(func)));
1642 } 1646 }
1643 else if EQ("getfield") { 1647 else if EQ("getfield") {
1644 int t = getindex; 1648 int t = getindex;
@@ -2011,7 +2015,7 @@ static int Cfunc (lua_State *L) {
2011static int Cfunck (lua_State *L, int status, lua_KContext ctx) { 2015static int Cfunck (lua_State *L, int status, lua_KContext ctx) {
2012 lua_pushstring(L, statcodes[status]); 2016 lua_pushstring(L, statcodes[status]);
2013 lua_setglobal(L, "status"); 2017 lua_setglobal(L, "status");
2014 lua_pushinteger(L, cast(lua_Integer, ctx)); 2018 lua_pushinteger(L, cast_Integer(ctx));
2015 lua_setglobal(L, "ctx"); 2019 lua_setglobal(L, "ctx");
2016 return runC(L, L, lua_tostring(L, cast_int(ctx))); 2020 return runC(L, L, lua_tostring(L, cast_int(ctx)));
2017} 2021}