aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/api_gen/wx_gen_cpp.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2012-02-17 13:07:28 +0100
committerDan Gudmundsson <[email protected]>2012-02-20 11:49:46 +0100
commit2c95eb0c575c95a2cdf3c2eacb562d1a5a8cfe08 (patch)
tree823354ee20475634f8abeb4bb2b4b0c404548ffa /lib/wx/api_gen/wx_gen_cpp.erl
parent953ee650a80d863a85c99e82ef69501496db0ad6 (diff)
downloadotp-2c95eb0c575c95a2cdf3c2eacb562d1a5a8cfe08.tar.gz
otp-2c95eb0c575c95a2cdf3c2eacb562d1a5a8cfe08.tar.bz2
otp-2c95eb0c575c95a2cdf3c2eacb562d1a5a8cfe08.zip
[wx] Fix api bugs in wxDC
Some out arguments was in args.
Diffstat (limited to 'lib/wx/api_gen/wx_gen_cpp.erl')
-rw-r--r--lib/wx/api_gen/wx_gen_cpp.erl24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl
index 4bc58533ad..1b50c49fb9 100644
--- a/lib/wx/api_gen/wx_gen_cpp.erl
+++ b/lib/wx/api_gen/wx_gen_cpp.erl
@@ -64,11 +64,16 @@ gen_derived_dest(Defs) ->
[gen_derived_dest_2(Class) || Class <- Defs],
ok.
-gen_derived_dest_2(C=#class{name=Class}) ->
+gen_derived_dest_2(C=#class{name=Class, options=Opts}) ->
?WTC("gen_derived_dest_2"),
Derived = is_derived(C),
TaylorMade = taylormade_class(C),
+
if Derived andalso (TaylorMade =:= false) ->
+ case lists:keysearch(ifdef,1,Opts) of
+ {value, {ifdef, What}} -> w("#if ~p~n",[What]);
+ _ -> ok
+ end,
w("class E~s : public ~s {~n",[Class,Class]),
case Class of
"wxGLCanvas" -> %% Special for cleaning up gl context
@@ -78,7 +83,13 @@ gen_derived_dest_2(C=#class{name=Class}) ->
w(" public: ~~E~s() {((WxeApp *)wxTheApp)->clearPtr(this);};~n", [Class])
end,
gen_constructors(C),
- w("};~n~n", []);
+ case lists:keysearch(ifdef,1,Opts) of
+ {value, {ifdef, Endif}} ->
+ w("};~n", []),
+ w("#endif // ~p~n~n",[Endif]);
+ _ ->
+ w("};~n~n", [])
+ end;
TaylorMade /= false ->
w("~s~n", [TaylorMade]);
true ->
@@ -324,6 +335,8 @@ declare_var(P = #param{name=Name,in=In,def=Def,type=Type}) ->
declare_type(N,false,_,#type{name="wxArrayInt"}) ->
w(" wxArrayInt ~s;~n", [N]);
+declare_type(N,false,_,#type{name="wxArrayDouble"}) ->
+ w(" wxArrayDouble ~s;~n", [N]);
declare_type(N,false,_,#type{name="wxArrayString"}) ->
w(" wxArrayString ~s;~n", [N]);
declare_type(N,false,_,#type{base=Base,single=true,name=Type,by_val=false,mod=Mod})
@@ -335,6 +348,8 @@ declare_type(N,false,_,#type{name="wxArrayTreeItemIds",ref=reference}) ->
w(" wxArrayTreeItemIds ~s;~n", [N]);
declare_type(N,false,_,#type{name="wxDateTime"}) ->
w(" wxDateTime ~s;~n", [N]);
+declare_type(N,false,_,#type{name="wxColour"}) ->
+ w(" wxColour ~s;~n", [N]);
declare_type(N,false,_,#type{name=Type, base=int64, ref=reference}) ->
w(" ~s ~s;~n", [Type,N]);
declare_type(N,true,Def,#type{base=Base,single=true,name=Type,by_val=true})
@@ -363,6 +378,8 @@ declare_type(N,true,Def,#type{base=binary, name=char}) ->
w(" char ~sD[] = {~s}, * ~s = ~sD;~n", [N,Def,N,N]);
declare_type(_N,true,_Def,void) ->
skip;
+declare_type(_N,true,_Def,voidp) ->
+ skip;
declare_type(N,true,Def,#type{name=Type, ref={pointer,2}}) ->
%% xxxx
w(" ~s ** ~s = ~s;~n", [Type,N,Def]);
@@ -802,6 +819,7 @@ call_arg(#param{name=N,type={merged,_,#type{base={class,_},single=true,
when ByVal =:= true; Ref =:= reference ->
"*" ++ N;
call_arg(#param{def=Def, type=void}) when Def =/= none -> Def;
+call_arg(#param{def=Def, type=voidp}) when Def =/= none -> Def;
call_arg(#param{name=N,type=#type{base={ref,_},by_val=true,single=true}}) -> N;
call_arg(#param{name=N,type={merged,_,_,_,_,_,_}}) -> N.
@@ -927,6 +945,8 @@ build_ret(Name,_,#type{base=int,single=true,mod=M}) ->
end;
build_ret(Name,_,#type{name="wxArrayInt"}) ->
w(" rt.add(~s);~n", [Name]);
+build_ret(Name,_,#type{name="wxArrayDouble"}) ->
+ w(" rt.add(~s);~n", [Name]);
build_ret(Name,_,#type{base={comp,_,_},single=array}) ->
w(" for(unsigned int i=0; i < ~s.GetCount(); i++) {~n", [Name]),
w(" rt.add(~s[i]);~n }~n",[Name]),