From: John L. <jr...@us...> - 2008-10-24 04:40:21
|
Update of /cvsroot/wxlua/wxLua/bindings In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2076/wxLua/bindings Modified Files: genwxbind.lua Log Message: Small binding generator fixes for special cases, added op_cast. Index: genwxbind.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/bindings/genwxbind.lua,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** genwxbind.lua 22 Oct 2008 05:31:45 -0000 1.170 --- genwxbind.lua 24 Oct 2008 04:40:12 -0000 1.171 *************** *** 1097,1128 **** -- operators for %operator ! bindingOperatorTable["=="] = "op_eq" ! bindingOperatorTable["!="] = "op_ne" ! bindingOperatorTable["<"] = "op_lt" ! bindingOperatorTable[">"] = "op_gt" ! bindingOperatorTable["<="] = "op_le" ! bindingOperatorTable[">="] = "op_ge" ! bindingOperatorTable["||"] = "op_lor" -- logical or ! bindingOperatorTable["&&"] = "op_land" -- logical and ! bindingOperatorTable["!"] = "op_not" ! bindingOperatorTable["|"] = "op_or" ! bindingOperatorTable["&"] = "op_and" ! bindingOperatorTable["^"] = "op_xor" bindingOperatorTable["<<"] = "op_lshift" bindingOperatorTable[">>"] = "op_rshift" ! bindingOperatorTable["|="] = "op_ior" ! bindingOperatorTable["&="] = "op_iand" ! bindingOperatorTable["^="] = "op_ixor" ! bindingOperatorTable["<<="] = "op_ilshift" ! bindingOperatorTable[">>="] = "op_irshift" bindingOperatorTable["="] = "op_set" bindingOperatorTable["++"] = "op_inc" bindingOperatorTable["--"] = "op_dec" bindingOperatorTable["~"] = "op_comp" -- bitwise one's compliment ! --bindingOperatorTable["-"] = "op_neg" -- also op_sub if not unary - bindingOperatorTable["+"] = "op_add" --- 1097,1129 ---- -- operators for %operator ! bindingOperatorTable["=="] = "op_eq" ! bindingOperatorTable["!="] = "op_ne" ! bindingOperatorTable["<"] = "op_lt" ! bindingOperatorTable[">"] = "op_gt" ! bindingOperatorTable["<="] = "op_le" ! bindingOperatorTable[">="] = "op_ge" ! bindingOperatorTable["||"] = "op_lor" -- logical or ! bindingOperatorTable["&&"] = "op_land" -- logical and ! bindingOperatorTable["!"] = "op_not" ! bindingOperatorTable["|"] = "op_or" ! bindingOperatorTable["&"] = "op_and" ! bindingOperatorTable["^"] = "op_xor" bindingOperatorTable["<<"] = "op_lshift" bindingOperatorTable[">>"] = "op_rshift" ! bindingOperatorTable["|="] = "op_ior" ! bindingOperatorTable["&="] = "op_iand" ! bindingOperatorTable["^="] = "op_ixor" ! bindingOperatorTable["<<="] = "op_ilshift" ! bindingOperatorTable[">>="] = "op_irshift" bindingOperatorTable["="] = "op_set" + bindingOperatorTable["()"] = "op_cast" bindingOperatorTable["++"] = "op_inc" bindingOperatorTable["--"] = "op_dec" bindingOperatorTable["~"] = "op_comp" -- bitwise one's compliment ! --bindingOperatorTable["-"] = "op_neg" -- also op_sub if not unary - bindingOperatorTable["+"] = "op_add" *************** *** 1635,1638 **** --- 1636,1646 ---- end + function InsertParamState(Params, ParamState) + -- don't insert func(void) parameters + if ParamState.DataType and ((ParamState.DataTypeWithAttrib ~= "void") or (#ParamState.DataTypePointer > 0)) then + table.insert(Params, ParamState) + end + end + -- --------------------------------------------------------------------------- -- Build DataType Table by adding %classes (and their bases), %structs, and %enums *************** *** 1750,1753 **** --- 1758,1762 ---- function ParseData(interfaceData) + local objectList = {} local parseState = *************** *** 2384,2390 **** elseif lineState["%operator"] and string.find(tag, "operator", 1, 1) then -- eat the rest of the "operator+=(...)" symbols which may be split before ( ! while lineTags[t+1] and (not string.find(lineTags[t+1], "(", 1, 1)) do ! tag = tag..lineTags[t+1] ! t = t + 1 end --- 2393,2405 ---- elseif lineState["%operator"] and string.find(tag, "operator", 1, 1) then -- eat the rest of the "operator+=(...)" symbols which may be split before ( ! if (string.sub(tag, -1) == "r") and (lineTags[t+1] == "(") and (lineTags[t+2] == ")") then ! tag = tag..lineTags[t+1]..lineTags[t+2] ! print(tag) ! t = t + 2 ! else ! while lineTags[t+1] and (lineTags[t+1] ~= "(") do ! tag = tag..lineTags[t+1] ! t = t + 1 ! end end *************** *** 2441,2445 **** elseif lineState.Action == "action_methodbracket" then ! if tag ~= '(' then local msg = "(Name="..tostring(lineState.Name).."; DataType="..tostring(lineState.DataType)..")" print("ERROR: Expected Method Tag '(', got Tag='"..tag.."'. "..msg.." "..LineTableErrString(lineTable)) --- 2456,2460 ---- elseif lineState.Action == "action_methodbracket" then ! if tag ~= "(" then local msg = "(Name="..tostring(lineState.Name).."; DataType="..tostring(lineState.DataType)..")" print("ERROR: Expected Method Tag '(', got Tag='"..tag.."'. "..msg.." "..LineTableErrString(lineTable)) *************** *** 2485,2489 **** elseif tag == ")" then if lineState.ParamState.DataType then ! table.insert(lineState.Params, lineState.ParamState) lineState.ParamState = AllocParam() end --- 2500,2504 ---- elseif tag == ")" then if lineState.ParamState.DataType then ! InsertParamState(lineState.Params, lineState.ParamState) lineState.ParamState = AllocParam() end *************** *** 2516,2520 **** end ! table.insert(lineState.Params, lineState.ParamState) lineState.ParamState = AllocParam() --- 2531,2535 ---- end ! InsertParamState(lineState.Params, lineState.ParamState) lineState.ParamState = AllocParam() *************** *** 2527,2534 **** end ! if lineState.ParamState.DataType then ! table.insert(lineState.Params, lineState.ParamState) ! lineState.ParamState = AllocParam() ! end lineState.Action = "action_method_body" --- 2542,2547 ---- end ! InsertParamState(lineState.Params, lineState.ParamState) ! lineState.ParamState = AllocParam() lineState.Action = "action_method_body" *************** *** 2549,2553 **** end ! table.insert(lineState.Params, lineState.ParamState) lineState.ParamState = AllocParam() --- 2562,2566 ---- end ! InsertParamState(lineState.Params, lineState.ParamState) lineState.ParamState = AllocParam() *************** *** 2555,2562 **** lineState.ActionMandatory = true elseif tag == ")" then ! if lineState.ParamState.DataType then ! table.insert(lineState.Params, lineState.ParamState) ! lineState.ParamState = AllocParam() ! end lineState.Action = "action_method_body" --- 2568,2573 ---- lineState.ActionMandatory = true elseif tag == ")" then ! InsertParamState(lineState.Params, lineState.ParamState) ! lineState.ParamState = AllocParam() lineState.Action = "action_method_body" *************** *** 3368,3371 **** --- 3379,3383 ---- argTypeWithAttrib = "wxCharBuffer" + argCast = "const char*" -- allows for "unsigned char*" else if isTranslated and (origIndirectionCount == 0) then *************** *** 3744,3749 **** if member["%operator"] then memberPtr = false ! if paramCount > 1 then functor = "(*self)"..member["%operator"] else functor = member["%operator"].."(*self)" --- 3756,3763 ---- if member["%operator"] then memberPtr = false ! if paramCount == 2 then functor = "(*self)"..member["%operator"] + elseif (paramCount > 2) then + functor = "(*self)" else functor = member["%operator"].."(*self)" *************** *** 3800,3804 **** end ! elseif (not member["%operator"]) and (memberPtr == "&") and (memberType ~= "wxString") then table.insert(codeList, " "..memberTypeWithAttrib.." returns = &"..functor..";\n") elseif (memberPtr == "*") or (memberType == "voidptr_long") then --- 3814,3818 ---- end ! elseif (not member["%operator"]) and (memberPtr == "&") and string.find(memberTypeWithAttrib, "*") and (memberType ~= "wxString") then table.insert(codeList, " "..memberTypeWithAttrib.." returns = &"..functor..";\n") elseif (memberPtr == "*") or (memberType == "voidptr_long") then |