cinvoke-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cinvoke-svn] r99 - trunk/cinvoke/bindings/lua


From: will
Subject: [cinvoke-svn] r99 - trunk/cinvoke/bindings/lua
Date: 31 Jul 2006 13:05:12 -0400

Author: will
Date: 2006-07-31 13:05:12 -0400 (Mon, 31 Jul 2006)
New Revision: 99

Modified:
   trunk/cinvoke/bindings/lua/cinvoke_lua.c
Log:
fixes for compiling lua in windows


Modified: trunk/cinvoke/bindings/lua/cinvoke_lua.c
===================================================================
--- trunk/cinvoke/bindings/lua/cinvoke_lua.c    2006-07-29 15:08:06 UTC (rev 98)
+++ trunk/cinvoke/bindings/lua/cinvoke_lua.c    2006-07-31 17:05:12 UTC (rev 99)
@@ -32,6 +32,10 @@
 #include <string.h>
 #include <time.h>
 
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
+
 // stack reading functions, we define our own so we can specify
 // the exact semantics/errors we want
 void expected(lua_State *l, const char *exp, int index) {
@@ -380,8 +384,9 @@
                }
                return 'p';
        } else if (!strcmp(family, "basic")) {
+               lua_Integer charid;
                lua_getfield(l, tblindex, "charid");
-               lua_Integer charid = tointeger(l, -1);
+               charid = tointeger(l, -1);
                lua_pop(l, 1);
                return (char)charid;
        } else {
@@ -503,7 +508,7 @@
        if (strlen(pstr) == 1 ||
                strncmp("0x", pstr, 2)) {
                char *endptr;
-               ret = (void *)strtol(pstr, &endptr, 10);
+               ret = (void *)strtol(pstr, &endptr, 16);
                if (*endptr != '\0') {
                        lua_pushstring(l, "invalid pointer value");
                        lua_error(l);
@@ -1481,7 +1486,7 @@
 }
 
 
-int luaopen_cinvoke_lua(lua_State *l) {
+LUALIB_API int luaopen_cinvoke_lua(lua_State *l) {
        declbasic(l, "Cchar", CINV_T_CHAR, 'c', 1);
        declbasic(l, "Cshort", CINV_T_SHORT, 's', sizeof(short));
        declbasic(l, "Cint", CINV_T_INT, 'i', sizeof(int));





reply via email to

[Prev in Thread] Current Thread [Next in Thread]