Partial Fix #1569587. The type is now correct, but the name is still not correct.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9399 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Gossage 2006-10-04 05:21:02 +00:00
commit 628bc386cc
2 changed files with 14 additions and 9 deletions

View file

@ -164,9 +164,14 @@ but if its an output, then it should be wrappered like any other SWIG object (us
%typemap(consttab) float, double
{ SWIG_LUA_FLOAT, (char *)"$symname", 0, (double) $value, 0, 0}
%typemap(consttab) char, char *
%typemap(consttab) char *
{ SWIG_LUA_STRING, (char *)"$symname", 0, 0, (void *)"$value", 0}
// note: char is treated as a seperate special type
// signed char & unsigned char are numbers
%typemap(consttab) char
{ SWIG_LUA_CHAR, (char *)"$symname", (long)$value, 0, 0, 0}
%typemap(consttab) long long, unsigned long long
{ SWIG_LUA_STRING, (char *) "$symname", 0, 0, (void *)"$value", 0}

View file

@ -26,12 +26,7 @@ extern "C" {
#define SWIG_LUA_STRING 3
#define SWIG_LUA_POINTER 4
#define SWIG_LUA_BINARY 5
/* Structure for command table (replaced by luaLib's luaL_reg) */
/*typedef struct {
const char *name;
lua_CFunction wrapper;
} swig_lua_command_info;*/
#define SWIG_LUA_CHAR 6
/* Structure for variable linking table */
typedef struct {
@ -581,12 +576,17 @@ SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
switch(constants[i].type) {
case SWIG_LUA_INT:
lua_pushstring(L,constants[i].name);
lua_pushnumber(L,(double)constants[i].lvalue);
lua_pushnumber(L,(lua_Number)constants[i].lvalue);
lua_rawset(L,-3);
break;
case SWIG_LUA_FLOAT:
lua_pushstring(L,constants[i].name);
lua_pushnumber(L,(double)constants[i].dvalue);
lua_pushnumber(L,(lua_Number)constants[i].dvalue);
lua_rawset(L,-3);
break;
case SWIG_LUA_CHAR:
lua_pushstring(L,constants[i].name);
lua_pushfstring(L,"%c",(char)constants[i].lvalue);
lua_rawset(L,-3);
break;
case SWIG_LUA_STRING: