[Scummvm-cvs-logs] SF.net SVN: scummvm:[33324] residual/trunk/engine/lua

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Sun Jul 27 10:20:59 CEST 2008


Revision: 33324
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33324&view=rev
Author:   aquadran
Date:     2008-07-27 08:20:58 +0000 (Sun, 27 Jul 2008)

Log Message:
-----------
removed few unused library funcs by grim/monkey

Modified Paths:
--------------
    residual/trunk/engine/lua/README.residual
    residual/trunk/engine/lua/lmathlib.cpp
    residual/trunk/engine/lua/lstrlib.cpp
    residual/trunk/engine/lua/ltm.cpp
    residual/trunk/engine/lua/lua.h

Modified: residual/trunk/engine/lua/README.residual
===================================================================
--- residual/trunk/engine/lua/README.residual	2008-07-27 07:25:01 UTC (rev 33323)
+++ residual/trunk/engine/lua/README.residual	2008-07-27 08:20:58 UTC (rev 33324)
@@ -7,3 +7,4 @@
 * Added several internal functions which implement this multithreading.
 * Added save/restore Lua state.
 * Unified types like int -> int32 and similiars
+* Removed few unused library funcs by games

Modified: residual/trunk/engine/lua/lmathlib.cpp
===================================================================
--- residual/trunk/engine/lua/lmathlib.cpp	2008-07-27 07:25:01 UTC (rev 33323)
+++ residual/trunk/engine/lua/lmathlib.cpp	2008-07-27 08:20:58 UTC (rev 33324)
@@ -55,11 +55,6 @@
   lua_pushnumber(FROMRAD(atan(luaL_check_number(1))));
 }
 
-static void math_atan2 (void)
-{
-  lua_pushnumber(FROMRAD(atan2(luaL_check_number(1), luaL_check_number(2))));
-}
-
 static void math_ceil (void)
 {
   lua_pushnumber(ceil(luaL_check_number(1)));
@@ -85,43 +80,16 @@
   lua_pushnumber(pow(luaL_check_number(1), luaL_check_number(2)));
 }
 
-static void math_log (void)
-{
-  lua_pushnumber(log(luaL_check_number(1)));
-}
-
-static void math_log10 (void)
-{
-  lua_pushnumber(log10(luaL_check_number(1)));
-}
-
-static void math_exp (void)
-{
-  lua_pushnumber(exp(luaL_check_number(1)));
-}
-
 static void math_deg (void)
 {
   lua_pushnumber(luaL_check_number(1)*(180.0/LOCAL_PI));
 }
-
+  
 static void math_rad (void)
 {
   lua_pushnumber(luaL_check_number(1)*(LOCAL_PI/180.0));
 }
-
-static void math_frexp (void) {
-  int e;
-  lua_pushnumber(frexp(luaL_check_number(1), &e));
-  lua_pushnumber(e);
-}
-
-static void math_ldexp (void) {
-  lua_pushnumber(ldexp(luaL_check_number(1), (int32)luaL_check_number(2)));
-}
-
-
-
+    
 static void math_min (void)
 {
   int32 i = 1;
@@ -134,7 +102,6 @@
   lua_pushnumber(dmin);
 }
 
-
 static void math_max (void)
 {
   int32 i = 1;
@@ -147,7 +114,6 @@
   lua_pushnumber(dmax);
 }
 
-
 static void math_random (void)
 {
   /* the '%' is needed because on some systems (SunOS!) "rand()" may */
@@ -160,7 +126,6 @@
     lua_pushnumber((int32)(r*l)+1);
 }
 
-
 static void math_randomseed (void)
 {
   srand((unsigned int)luaL_check_number(1));
@@ -175,18 +140,12 @@
 {"asin",  math_asin},
 {"acos",  math_acos},
 {"atan",  math_atan},
-{"atan2", math_atan2},
 {"ceil",  math_ceil},
 {"floor", math_floor},
 {"mod",   math_mod},
-{"frexp", math_frexp},
-{"ldexp", math_ldexp},
 {"sqrt",  math_sqrt},
 {"min",   math_min},
 {"max",   math_max},
-{"log",   math_log},
-{"log10", math_log10},
-{"exp",   math_exp},
 {"deg",   math_deg},
 {"rad",   math_rad},
 {"random",     math_random},

Modified: residual/trunk/engine/lua/lstrlib.cpp
===================================================================
--- residual/trunk/engine/lua/lstrlib.cpp	2008-07-27 07:25:01 UTC (rev 33323)
+++ residual/trunk/engine/lua/lstrlib.cpp	2008-07-27 08:20:58 UTC (rev 33324)
@@ -87,27 +87,6 @@
 }
 
 
-static void str_byte (void)
-{
-  int32 l;
-  const char *s = luaL_check_lstr(1, &l);
-  int32 pos = posrelat((int32)luaL_opt_number(2, 1), l);
-  luaL_arg_check(0<pos && pos<=l, 2,  "out of range");
-  lua_pushnumber((byte)s[pos-1]);
-}
-
-static void str_char (void) {
-  int32 i = 0;
-  luaL_resetbuffer();
-  while (lua_getparam(++i) != LUA_NOOBJECT) {
-    double c = luaL_check_number(i);
-    luaL_arg_check((byte)c == c, i, "invalid value");
-    luaL_addchar((int32)c);
-  }
-  closeandpush();
-}
-
-
 /*
 ** =======================================================
 ** PATTERN MATCHING
@@ -517,10 +496,7 @@
 {"strsub", str_sub},
 {"strlower", str_lower},
 {"strupper", str_upper},
-{"strchar", str_char},
 {"strrep", str_rep},
-{"ascii", str_byte},  /* for compatibility */
-{"strbyte", str_byte},
 {"format", str_format},
 {"strfind", str_find},
 {"gsub", str_gsub}

Modified: residual/trunk/engine/lua/ltm.cpp
===================================================================
--- residual/trunk/engine/lua/ltm.cpp	2008-07-27 07:25:01 UTC (rev 33323)
+++ residual/trunk/engine/lua/ltm.cpp	2008-07-27 08:20:58 UTC (rev 33324)
@@ -206,10 +206,10 @@
 
 void luaT_setfallback (void)
 {
-  static char *oldnames [] = {"error", "getglobal", "arith", "order", NULL};
+  static const char *oldnames [] = {"error", "getglobal", "arith", "order", NULL};
   TObject oldfunc;
   lua_CFunction replace;
-  char *name = luaL_check_string(1);
+  const char *name = luaL_check_string(1);
   lua_Object func = lua_getparam(2);
   luaL_arg_check(lua_isfunction(func), 2, "function expected");
   switch (luaL_findstring(name, oldnames)) {

Modified: residual/trunk/engine/lua/lua.h
===================================================================
--- residual/trunk/engine/lua/lua.h	2008-07-27 07:25:01 UTC (rev 33323)
+++ residual/trunk/engine/lua/lua.h	2008-07-27 08:20:58 UTC (rev 33324)
@@ -157,7 +157,7 @@
 ** for compatibility with old versions. Avoid using these macros/functions
 ** If your program does need any of these, define LUA_COMPAT2_5
 */
-//#define LUA_COMPAT2_5
+#define LUA_COMPAT2_5
 
 #ifdef LUA_COMPAT2_5
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list