cinvoke-svn
[Top][All Lists]
Advanced

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

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


From: will
Subject: [cinvoke-svn] r100 - trunk/cinvoke/bindings/lua
Date: 31 Jul 2006 13:49:32 -0400

Author: will
Date: 2006-07-31 13:49:31 -0400 (Mon, 31 Jul 2006)
New Revision: 100

Added:
   trunk/cinvoke/bindings/lua/cinvoke_lua.sln
   trunk/cinvoke/bindings/lua/cinvoke_lua.vcproj
Modified:
   trunk/cinvoke/bindings/lua/cinvoke_lua.c
Log:
fixed some warnings and added VC++ solution files...they dont seem to work too 
well atm though


Modified: trunk/cinvoke/bindings/lua/cinvoke_lua.c
===================================================================
--- trunk/cinvoke/bindings/lua/cinvoke_lua.c    2006-07-31 17:05:12 UTC (rev 99)
+++ trunk/cinvoke/bindings/lua/cinvoke_lua.c    2006-07-31 17:49:31 UTC (rev 
100)
@@ -36,6 +36,12 @@
 #define snprintf _snprintf
 #endif
 
+#ifdef _WIN32
+#define DLLEXPORT __declspec(dllexport)
+#else
+#define DLLEXPORT
+#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) {
@@ -489,7 +495,7 @@
 int get_arrelement_size(lua_State *l, int type) {
        int ret;
        lua_getfield(l, type, "size");
-       ret = tointeger(l, -1);
+       ret = (int)tointeger(l, -1);
        lua_pop(l, 1);
        return ret;
 }
@@ -508,7 +514,11 @@
        if (strlen(pstr) == 1 ||
                strncmp("0x", pstr, 2)) {
                char *endptr;
+#ifdef _WIN32
+               ret = (void *)(long long)strtol(pstr, &endptr, 16);
+#else
                ret = (void *)strtol(pstr, &endptr, 16);
+#endif
                if (*endptr != '\0') {
                        lua_pushstring(l, "invalid pointer value");
                        lua_error(l);
@@ -649,7 +659,7 @@
                        if (lua_isnil(l, argindex))
                                *ptr = NULL;
                        else {
-                               int arrlen = lua_objlen(l, argindex);
+                               int arrlen = (int)lua_objlen(l, argindex);
                                int elsize = get_arrelement_size(l, typeindex);
                                *ptr = malloc(arrlen * elsize);
                                if (*ptr) {
@@ -734,7 +744,7 @@
                        lua_pushnumber(l, *(long *)value);
                        break;
                case CINV_T_EXTRALONG:
-                       lua_pushnumber(l, *(long long *)value);
+                       lua_pushnumber(l, (lua_Number)*(long long *)value);
                        break;
                case CINV_T_FLOAT:
                        lua_pushnumber(l, *(float *)value);
@@ -795,7 +805,7 @@
 }
 void unmarshal_array(lua_State *l, int typeindex, void *value, int outindex) {
        char *cptr = *(char **)value;
-       int arrlen = lua_objlen(l, outindex), i;
+       int arrlen = (int)lua_objlen(l, outindex), i;
        int elsize = get_arrelement_size(l, typeindex);
 
        for (i = 1; i <= arrlen; i++) {
@@ -857,7 +867,7 @@
 
        lua_getfield(cb->l, usertable, "params");
        pindex = lua_gettop(cb->l);
-       numargs = lua_objlen(cb->l, pindex);
+       numargs = (int)lua_objlen(cb->l, pindex);
 
        for (i = 0; i < numargs; i++) {
                lua_pushinteger(cb->l, i + 1);
@@ -1038,7 +1048,7 @@
 
        lua_getfield(l, 1, "params");
        pindex = lua_gettop(l);
-       numargs = lua_objlen(l, pindex);
+       numargs = (int)lua_objlen(l, pindex);
        if (numargs > 0) {
                parameters = malloc(numargs * sizeof(void*));
                for (i = 0; i < numargs; i++) {
@@ -1355,7 +1365,7 @@
        }
        ptr = get_ptr_val(l, 1);
        if (!lua_gettop(l) == 2) {
-               len = tointeger(l, 2);
+               len = (int)tointeger(l, 2);
                if (len < 0) {
                        lua_pushstring(l, "invalid length parameter");
                        lua_error(l);
@@ -1389,7 +1399,7 @@
        if (value == NULL)
                lua_pushnil(l);
        else {
-               len = tointeger(l, 3);
+               len = (int)tointeger(l, 3);
                // create table of desired len and call unmarshal_array
                lua_newtable(l);
                index = lua_gettop(l);
@@ -1442,7 +1452,7 @@
                lua_error(l);
        }
 
-       num = tointeger(l, 2);
+       num = (int)tointeger(l, 2);
        ptr = get_ptr_val(l, 1);
 
        ptr += num;
@@ -1485,8 +1495,7 @@
        return 1;
 }
 
-
-LUALIB_API int luaopen_cinvoke_lua(lua_State *l) {
+DLLEXPORT 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));

Added: trunk/cinvoke/bindings/lua/cinvoke_lua.sln
===================================================================
--- trunk/cinvoke/bindings/lua/cinvoke_lua.sln                          (rev 0)
+++ trunk/cinvoke/bindings/lua/cinvoke_lua.sln  2006-07-31 17:49:31 UTC (rev 
100)
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cinvoke_lua", 
"cinvoke_lua.vcproj", "{396ABD75-9AE6-4AC1-98E3-31F3EC1D90D9}"
+       ProjectSection(ProjectDependencies) = postProject
+       EndProjectSection
+EndProject
+Global
+       GlobalSection(SolutionConfiguration) = preSolution
+               Debug = Debug
+               Release = Release
+       EndGlobalSection
+       GlobalSection(ProjectConfiguration) = postSolution
+               {396ABD75-9AE6-4AC1-98E3-31F3EC1D90D9}.Debug.ActiveCfg = 
Debug|Win32
+               {396ABD75-9AE6-4AC1-98E3-31F3EC1D90D9}.Debug.Build.0 = 
Debug|Win32
+               {396ABD75-9AE6-4AC1-98E3-31F3EC1D90D9}.Release.ActiveCfg = 
Release|Win32
+               {396ABD75-9AE6-4AC1-98E3-31F3EC1D90D9}.Release.Build.0 = 
Release|Win32
+       EndGlobalSection
+       GlobalSection(ExtensibilityGlobals) = postSolution
+       EndGlobalSection
+       GlobalSection(ExtensibilityAddIns) = postSolution
+       EndGlobalSection
+EndGlobal

Added: trunk/cinvoke/bindings/lua/cinvoke_lua.vcproj
===================================================================
--- trunk/cinvoke/bindings/lua/cinvoke_lua.vcproj                               
(rev 0)
+++ trunk/cinvoke/bindings/lua/cinvoke_lua.vcproj       2006-07-31 17:49:31 UTC 
(rev 100)
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="7.10"
+       Name="cinvoke_lua"
+       ProjectGUID="{396ABD75-9AE6-4AC1-98E3-31F3EC1D90D9}"
+       Keyword="Win32Proj">
+       <Platforms>
+               <Platform
+                       Name="Win32"/>
+       </Platforms>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="Debug"
+                       IntermediateDirectory="Debug"
+                       ConfigurationType="2"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               
AdditionalIncludeDirectories="c:\lua\include;..\..\lib"
+                               
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CINVOKE_LUA_EXPORTS;ARCH_CL_X86_WIN;CINVOKE_BUILD"
+                               MinimalRebuild="TRUE"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="1"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="TRUE"
+                               DebugInformationFormat="4"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="cinvoke.lib lua5.1.lib"
+                               OutputFile="$(OutDir)/cinvoke_lua.dll"
+                               LinkIncremental="2"
+                               
AdditionalLibraryDirectories="..\..\lib\Debug;C:\lua\lib\vc7"
+                               GenerateDebugInformation="TRUE"
+                               ProgramDatabaseFile="$(OutDir)/cinvoke_lua.pdb"
+                               SubSystem="2"
+                               ImportLibrary="$(OutDir)/cinvoke_lua.lib"
+                               TargetMachine="1"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCWebDeploymentTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="Release"
+                       IntermediateDirectory="Release"
+                       ConfigurationType="2"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               
AdditionalIncludeDirectories="c:\lua\include;..\..\lib"
+                               
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CINVOKE_BUILD;ARCH_CL_X86_WIN;CINVOKE_BUILD"
+                               RuntimeLibrary="0"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="TRUE"
+                               DebugInformationFormat="3"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="cinvoke.lib lua5.1.lib"
+                               OutputFile="$(OutDir)/cinvoke_lua.dll"
+                               LinkIncremental="1"
+                               
AdditionalLibraryDirectories="..\..\lib\Release;C:\lua\lib\vc7"
+                               GenerateDebugInformation="TRUE"
+                               SubSystem="2"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               ImportLibrary="$(OutDir)/cinvoke_lua.lib"
+                               TargetMachine="1"/>
+                       <Tool
+                               Name="VCMIDLTool"/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCWebDeploymentTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+                       
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+                       <File
+                               RelativePath=".\cinvoke_lua.c">
+                       </File>
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>





reply via email to

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