From: John L. <jr...@us...> - 2008-10-31 05:25:22
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11491/wxLua/modules/wxbind/src Modified Files: wxcore_geometry.cpp Log Message: Add op_deref() for dereferencing a pointer to an object, i.e. *ptr == obj. Index: wxcore_geometry.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_geometry.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** wxcore_geometry.cpp 29 Oct 2008 04:44:33 -0000 1.13 --- wxcore_geometry.cpp 31 Oct 2008 05:25:08 -0000 1.14 *************** *** 340,343 **** --- 340,364 ---- } + static wxLuaArgType s_wxluatypeArray_wxLua_wxPoint2DInt_op_mul[] = { &wxluatype_wxPoint2DInt, &wxluatype_TNUMBER, NULL }; + static int LUACALL wxLua_wxPoint2DInt_op_mul(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxPoint2DInt_op_mul[1] = {{ wxLua_wxPoint2DInt_op_mul, WXLUAMETHOD_METHOD, 2, 2, s_wxluatypeArray_wxLua_wxPoint2DInt_op_mul }}; + // %operator wxPoint2DInt operator*(wxInt32 n) + static int LUACALL wxLua_wxPoint2DInt_op_mul(lua_State *L) + { + // wxInt32 n + wxInt32 n = (wxInt32)wxlua_getnumbertype(L, 2); + // get this + wxPoint2DInt * self = (wxPoint2DInt *)wxluaT_getuserdatatype(L, 1, wxluatype_wxPoint2DInt); + // call op_mul + // allocate a new object using the copy constructor + wxPoint2DInt* returns = new wxPoint2DInt((*self)*(n)); + // add the new object to the tracked memory list + wxluaO_addgcobject(L, (void*)returns, new wxLua_wxObject_wxPoint2DInt((wxPoint2DInt*)returns)); + // push the result datatype + wxluaT_pushuserdatatype(L, returns, wxluatype_wxPoint2DInt); + + return 1; + } + static wxLuaArgType s_wxluatypeArray_wxLua_wxPoint2DInt_op_neg[] = { &wxluatype_wxPoint2DInt, NULL }; static int LUACALL wxLua_wxPoint2DInt_op_neg(lua_State *L); *************** *** 483,486 **** --- 504,508 ---- { "op_imul", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxPoint2DInt_op_imul, 1, NULL }, { "op_isub", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxPoint2DInt_op_isub, 1, NULL }, + { "op_mul", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxPoint2DInt_op_mul, 1, NULL }, { "op_neg", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxPoint2DInt_op_neg, 1, NULL }, { "op_set", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxPoint2DInt_op_set, 1, NULL }, |