John Labenski <jlaben...@...> writes: > > On Wed, Feb 18, 2009 at 7:58 PM, Andre Arpin <ar...@...> wrote: > > The value for wxstc.wxSTC_MASK_FOLDERS has to be -33554432 or maybe - 0x2000000 > > > > or SetMarginMask should expect an unsigned int (I did not check that). > > > > I'm not sure what you're trying to do, but this is the C++ code that defines it. > > #define wxSTC_MASK_FOLDERS 0xFE000000 >
this solves the problem this number is too large for an int static int LUACALL wxLua_wxStyledTextCtrl_SetMarginMask(lua_State *L) { double doubleMask = wxlua_getnumbertype(L, 3); int mask = (doubleMask > INT_MAX) ? (int)((doubleMask - INT_MAX) -1 )| INT_MIN : (int)doubleMask; ---------- you can look below if you like it shows some detail of ---------- the problem (if you are interested) We are hitting a LUA limit (really a double to int limit) ---------------the first section show the problem in LUA ---------------the second section show the problem in the C code ------------- first section ------------- --- the following shows that lua will display both --- wxstc.wxSTC_MASK_FOLDERS and -33554432 as fe000000 --- but they are not equal print("1:", wxstc.wxSTC_MASK_FOLDERS, string.format("%x", wxstc.wxSTC_MASK_FOLDERS)) 1: 4261412864 fe000000 print("2:", string.format("%x", -33554432)) 2: fe000000 print("3:", wxstc.wxSTC_MASK_FOLDERS == (-33554432)) 3: false print("4:", string.format("%x", wxstc.wxSTC_MASK_FOLDERS - (-33554432))) 4: 0 print("5:", wxstc.wxSTC_MASK_FOLDERS - (-33554432)) 5: 4294967296 local xx = wxstc.wxSTC_MASK_FOLDERS - (-33554432) print("6:", xx, string.format("%x", xx)) 6: 4294967296 0 ------------- second section ------------- static int LUACALL wxLua_wxStyledTextCtrl_SetMarginMask(lua_State *L) { // int mask int mask = (int)wxlua_getnumbertype(L, 3); // int margin int margin = (int)wxlua_getnumbertype(L, 2); <<<< breakpoint on this line -----------> breaking while the program execute these line -----------> the mask value as displayed in the watch panel editor:SetMarginMask(2, -1) mask 0xffffffff int editor:SetMarginMask(2, wxstc.wxSTC_MASK_FOLDERS) mask 0x80000000 int <<<< this is the problem editor:SetMarginMask(2, -2) mask 0xfffffffe int editor:SetMarginMask(2, -33554432) mask 0xfe000000 int editor:SetMarginMask(2, -3) mask 0xfffffffd int editor:SetMarginMask(2, -0x2000000) mask 0xfe000000 int ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users