17 #ifndef SWIGTEMPLATEDISAMBIGUATOR
18 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
19 # define SWIGTEMPLATEDISAMBIGUATOR template
20 # elif defined(__HP_aCC)
23 # define SWIGTEMPLATEDISAMBIGUATOR template
25 # define SWIGTEMPLATEDISAMBIGUATOR
31 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
32 # define SWIGINLINE inline
40 # if defined(__GNUC__)
41 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
42 # define SWIGUNUSED __attribute__ ((__unused__))
47 # define SWIGUNUSED __attribute__ ((__unused__))
53 #ifndef SWIG_MSC_UNSUPPRESS_4505
54 # if defined(_MSC_VER)
55 # pragma warning(disable : 4505)
59 #ifndef SWIGUNUSEDPARM
61 # define SWIGUNUSEDPARM(p)
63 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
69 # define SWIGINTERN static SWIGUNUSED
73 #ifndef SWIGINTERNINLINE
74 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
78 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
79 # ifndef GCC_HASCLASSVISIBILITY
80 # define GCC_HASCLASSVISIBILITY
85 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
86 # if defined(STATIC_LINKED)
89 # define SWIGEXPORT __declspec(dllexport)
92 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
93 # define SWIGEXPORT __attribute__ ((visibility("default")))
102 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
103 # define SWIGSTDCALL __stdcall
110 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
111 # define _CRT_SECURE_NO_DEPRECATE
115 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
116 # define _SCL_SECURE_NO_DEPRECATE
120 #define SWIG_UnknownError -1
121 #define SWIG_IOError -2
122 #define SWIG_RuntimeError -3
123 #define SWIG_IndexError -4
124 #define SWIG_TypeError -5
125 #define SWIG_DivisionByZero -6
126 #define SWIG_OverflowError -7
127 #define SWIG_SyntaxError -8
128 #define SWIG_ValueError -9
129 #define SWIG_SystemError -10
130 #define SWIG_AttributeError -11
131 #define SWIG_MemoryError -12
132 #define SWIG_NullReferenceError -13
136 #define SWIG_UnknownError -1
137 #define SWIG_IOError -2
138 #define SWIG_RuntimeError -3
139 #define SWIG_IndexError -4
140 #define SWIG_TypeError -5
141 #define SWIG_DivisionByZero -6
142 #define SWIG_OverflowError -7
143 #define SWIG_SyntaxError -8
144 #define SWIG_ValueError -9
145 #define SWIG_SystemError -10
146 #define SWIG_AttributeError -11
147 #define SWIG_MemoryError -12
148 #define SWIG_NullReferenceError -13
160 #define SWIG_RUNTIME_VERSION "4"
163 #ifdef SWIG_TYPE_TABLE
164 # define SWIG_QUOTE_STRING(x) #x
165 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
166 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
168 # define SWIG_TYPE_TABLE_NAME
181 # define SWIGRUNTIME SWIGINTERN
184 #ifndef SWIGRUNTIMEINLINE
185 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
189 #ifndef SWIG_BUFFER_SIZE
190 # define SWIG_BUFFER_SIZE 1024
194 #define SWIG_POINTER_DISOWN 0x1
195 #define SWIG_CAST_NEW_MEMORY 0x2
198 #define SWIG_POINTER_OWN 0x1
281 #define SWIG_ERROR (-1)
282 #define SWIG_IsOK(r) (r >= 0)
283 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
286 #define SWIG_CASTRANKLIMIT (1 << 8)
288 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
290 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
292 #define SWIG_BADOBJ (SWIG_ERROR)
293 #define SWIG_OLDOBJ (SWIG_OK)
294 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
295 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
297 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
298 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
299 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
300 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
301 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
302 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
305 #if defined(SWIG_CASTRANK_MODE)
306 # ifndef SWIG_TypeRank
307 # define SWIG_TypeRank unsigned long
309 # ifndef SWIG_MAXCASTRANK
310 # define SWIG_MAXCASTRANK (2)
312 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
313 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
318 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
321 # define SWIG_AddCast
322 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
332 typedef void *(*swig_converter_func)(
void *,
int *);
374 const char *f2,
const char *l2) {
375 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
376 while ((*f1 ==
' ') && (f1 != l1)) ++f1;
377 while ((*f2 ==
' ') && (f2 != l2)) ++f2;
378 if (*f1 != *f2)
return (*f1 > *f2) ? 1 : -1;
380 return (
int)((l1 - f1) - (l2 - f2));
390 const char* te = tb + strlen(tb);
392 while (!equiv && *ne) {
393 for (nb = ne; *ne; ++ne) {
394 if (*ne ==
'|')
break;
409 const char* te = tb + strlen(tb);
411 while (!equiv && *ne) {
412 for (nb = ne; *ne; ++ne) {
413 if (*ne ==
'|')
break;
430 if (strcmp(iter->
type->
name, c) == 0) {
431 if (iter == ty->
cast)
457 if (iter->
type == from) {
458 if (iter == ty->
cast)
490 if (!ty || !ty->
dcast)
return ty;
491 while (ty && (ty->
dcast)) {
492 ty = (*ty->
dcast)(ptr);
516 if (!type)
return NULL;
517 if (type->
str != NULL) {
518 const char *last_name = type->
str;
520 for (s = type->
str; *s; s++)
521 if (*s ==
'|') last_name = s+1;
568 register size_t l = 0;
569 register size_t r = iter->
size - 1;
572 register size_t i = (l + r) >> 1;
573 const char *iname = iter->
types[i]->
name;
575 register int compare = strcmp(name, iname);
577 return iter->
types[i];
578 }
else if (compare < 0) {
584 }
else if (compare > 0) {
593 }
while (iter != end);
619 register size_t i = 0;
620 for (; i < iter->
size; ++i) {
622 return iter->
types[i];
625 }
while (iter != end);
637 static const char hex[17] =
"0123456789abcdef";
638 register const unsigned char *u = (
unsigned char *) ptr;
639 register const unsigned char *eu = u + sz;
640 for (; u != eu; ++u) {
641 register unsigned char uu = *u;
642 *(c++) = hex[(uu & 0xf0) >> 4];
643 *(c++) = hex[uu & 0xf];
653 register unsigned char *u = (
unsigned char *) ptr;
654 register const unsigned char *eu = u + sz;
655 for (; u != eu; ++u) {
656 register char d = *(c++);
657 register unsigned char uu;
658 if ((d >=
'0') && (d <=
'9'))
659 uu = ((d -
'0') << 4);
660 else if ((d >=
'a') && (d <=
'f'))
661 uu = ((d - (
'a'-10)) << 4);
665 if ((d >=
'0') && (d <=
'9'))
667 else if ((d >=
'a') && (d <=
'f'))
668 uu |= (d - (
'a'-10));
682 if ((2*
sizeof(
void *) + 2) > bsz)
return 0;
685 if (strlen(name) + 1 > (bsz - (r - buff)))
return 0;
693 if (strcmp(c,
"NULL") == 0) {
706 size_t lname = (name ? strlen(name) : 0);
707 if ((2*sz + 2 + lname) > bsz)
return 0;
711 strncpy(r,name,lname+1);
721 if (strcmp(c,
"NULL") == 0) {
755 #define SWIG_LUA_INT 1
756 #define SWIG_LUA_FLOAT 2
757 #define SWIG_LUA_STRING 3
758 #define SWIG_LUA_POINTER 4
759 #define SWIG_LUA_BINARY 5
760 #define SWIG_LUA_CHAR 6
821 #define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
822 #define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags)
823 #define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname)
825 #define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty)
826 #define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type)
829 #define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata))
830 #define SWIG_SetModule(clientdata, pointer) SWIG_Lua_SetModule((lua_State*) (clientdata), pointer)
831 #define SWIG_MODULE_CLIENTDATA_TYPE lua_State*
834 #define SWIG_contract_assert(expr, msg) \
835 if (!(expr)) { lua_pushstring(L, (char *) msg); goto fail; } else
838 #define SWIG_fail {goto fail;}
839 #define SWIG_fail_arg(func_name,argnum,type) \
840 {lua_pushfstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\
841 func_name,argnum,type,SWIG_Lua_typename(L,argnum));\
843 #define SWIG_fail_ptr(func_name,argnum,type) \
844 SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*")
845 #define SWIG_check_num_args(func_name,a,b) \
846 if (lua_gettop(L)<a || lua_gettop(L)>b) \
847 {lua_pushfstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\
851 #define SWIG_Lua_get_table(L,n) \
852 (lua_pushstring(L, n), lua_rawget(L,-2))
854 #define SWIG_Lua_add_function(L,n,f) \
855 (lua_pushstring(L, n), \
856 lua_pushcfunction(L, f), \
860 #define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
873 lua_rawget(L,LUA_REGISTRYINDEX);
874 if (lua_islightuserdata(L,-1))
884 lua_pushlightuserdata(L,(
void*)module);
885 lua_rawset(L,LUA_REGISTRYINDEX);
898 #ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
900 lua_pushstring(L,
"This variable is immutable");
917 assert(lua_istable(L,1));
918 lua_getmetatable(L,1);
919 assert(lua_istable(L,-1));
922 if (lua_istable(L,-1))
928 if (lua_iscfunction(L,-1))
949 assert(lua_istable(L,1));
950 lua_getmetatable(L,1);
951 assert(lua_istable(L,-1));
954 if (lua_istable(L,-1))
960 if (lua_iscfunction(L,-1))
976 assert(lua_istable(L,-1));
977 lua_pushstring(L,name);
983 lua_pushstring(L,
".get");
986 lua_pushstring(L,
".set");
989 lua_setmetatable(L,-2);
1003 assert(lua_istable(L,-1));
1004 lua_getmetatable(L,-1);
1005 assert(lua_istable(L,-1));
1007 assert(lua_istable(L,-1));
1013 assert(lua_istable(L,-1));
1037 assert(lua_isuserdata(L,-2));
1038 lua_getmetatable(L,-2);
1039 assert(lua_istable(L,-1));
1041 assert(lua_istable(L,-1));
1046 if (lua_iscfunction(L,-1))
1056 assert(lua_istable(L,-1));
1060 if (lua_isfunction(L,-1))
1069 if (lua_iscfunction(L,-1))
1092 assert(lua_isuserdata(L,1));
1093 lua_getmetatable(L,1);
1094 assert(lua_istable(L,-1));
1097 if (lua_istable(L,-1))
1102 if (lua_iscfunction(L,-1))
1115 if (lua_iscfunction(L,-1))
1134 assert(lua_isuserdata(L,-1));
1152 lua_pushstring(L,
"SWIG");
1153 lua_rawget(L,LUA_REGISTRYINDEX);
1154 if (!lua_istable(L,-1))
1157 lua_pushstring(L,
"SWIG");
1159 lua_rawset(L,LUA_REGISTRYINDEX);
1161 lua_pushstring(L,
"SWIG");
1162 lua_rawget(L,LUA_REGISTRYINDEX);
1170 lua_pushstring(L,cname);
1178 assert(lua_istable(L,-1));
1180 assert(lua_istable(L,-1));
1186 assert(lua_istable(L,-1));
1197 for(i=0;clss->
bases[i];i++)
1207 assert(lua_istable(L,-1));
1236 if (clss->
bases[i]==0)
1256 lua_pushstring(L,clss->
name);
1259 lua_pushstring(L,
".type");
1260 lua_pushstring(L,clss->
name);
1263 lua_pushstring(L,
".get");
1267 lua_pushstring(L,
".set");
1271 lua_pushstring(L,
".fn");
1297 if (lua_istable(L,-1))
1299 lua_setmetatable(L,-2);
1329 if (lua_isnil(L,index)){*ptr=0;
return SWIG_OK;}
1355 int argnum,
const char* func_name){
1358 lua_pushfstring(L,
"Error in %s, expected a %s at argument number %d\n",
1359 func_name,(type && type->
str)?type->
str:
"void*",argnum);
1373 memcpy(raw->
data,ptr,size);
1383 if (type==0 || type==raw->
type)
1385 memcpy(ptr,raw->
data,size);
1395 if (lua_isuserdata(L,tp))
1400 return "userdata (unknown type)";
1402 return lua_typename(L,lua_type(L,tp));
1419 if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2))
1424 result=(usr1->
ptr==usr2->
ptr);
1425 lua_pushboolean(L,result);
1437 for (i = 0; constants[i].
type; i++) {
1438 switch(constants[i].type) {
1440 lua_pushstring(L,constants[i].name);
1441 lua_pushnumber(L,(lua_Number)constants[i].lvalue);
1445 lua_pushstring(L,constants[i].name);
1446 lua_pushnumber(L,(lua_Number)constants[i].dvalue);
1450 lua_pushstring(L,constants[i].name);
1451 lua_pushfstring(L,
"%c",(
char)constants[i].lvalue);
1455 lua_pushstring(L,constants[i].name);
1456 lua_pushstring(L,(
char *) constants[i].pvalue);
1460 lua_pushstring(L,constants[i].name);
1465 lua_pushstring(L,constants[i].name);
1466 SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
1479 #ifndef SWIG_DOSTRING_FAIL
1480 #define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
1490 if (str==0 || str[0]==0)
return 0;
1492 #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
1493 ok=luaL_dostring(L,str);
1495 ok=lua_dostring(L,str);
1518 #ifdef SWIG_MODULE_CLIENTDATA_TYPE