From 9aa30b9d0f0286cc8f6b7095a11194f89f0d5adb Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Tue, 30 Jun 2015 10:32:27 +0200 Subject: wx: Fix code generator I had changed the (generatade) code without updating the code generator in commit 38cb91a9. Fixed now, and also fixed a typo in the generated licence code. --- lib/wx/api_gen/gen_util.erl | 4 ++-- lib/wx/api_gen/wx_extra/wxEvtHandler.c_src | 2 +- lib/wx/api_gen/wx_gen_cpp.erl | 18 ++++++++--------- lib/wx/api_gen/wxapi.conf | 32 +++++++++++++++--------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/wx/api_gen/gen_util.erl b/lib/wx/api_gen/gen_util.erl index 6bdbb4ca96..ff245a6359 100644 --- a/lib/wx/api_gen/gen_util.erl +++ b/lib/wx/api_gen/gen_util.erl @@ -230,7 +230,7 @@ erl_copyright() -> w("%% Copyright Ericsson AB ~p-~p. All Rights Reserved.~n", [StartYear, CurrentYear]), w("%%~n",[]), - w("%% Licensed under the Apache License, Version 2.0 (the \"License\");,~n",[]), + w("%% Licensed under the Apache License, Version 2.0 (the \"License\");~n",[]), w("%% you may not use this file except in compliance with the License.~n",[]), w("%% You may obtain a copy of the License at~n",[]), w("%%~n",[]), @@ -251,7 +251,7 @@ c_copyright() -> w(" *~n",[]), w(" * Copyright Ericsson AB 2008-~p. All Rights Reserved.~n",[CurrentYear]), w(" *~n",[]), - w(" * Licensed under the Apache License, Version 2.0 (the \"License\");,~n",[]), + w(" * Licensed under the Apache License, Version 2.0 (the \"License\");~n",[]), w(" * you may not use this file except in compliance with the License.~n",[]), w(" * You may obtain a copy of the License at~n",[]), w(" *~n",[]), diff --git a/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src b/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src index 5d20019d8f..5e02066309 100644 --- a/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src +++ b/lib/wx/api_gen/wx_extra/wxEvtHandler.c_src @@ -11,7 +11,7 @@ case 100: { // wxEvtHandler::Connect int * class_nameLen = (int *) bp; bp += 4; if(*haveUserData) { - userData = new wxeErlTerm(Ecmd.bin[0]); + userData = new wxeErlTerm(&Ecmd.bin[0]); } int eventType = wxeEventTypeFromAtom(bp); bp += *eventTypeLen; diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index 3120d491b1..2ce6295078 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -206,8 +206,8 @@ gen_funcs(Defs) -> " rt.addAtom(\"ok\");~n" " break;~n" " }~n"), - w(" case WXE_BIN_INCR:~n driver_binary_inc_refc(Ecmd.bin[0]->bin);~n break;~n",[]), - w(" case WXE_BIN_DECR:~n driver_binary_dec_refc(Ecmd.bin[0]->bin);~n break;~n",[]), + w(" case WXE_BIN_INCR:~n driver_binary_inc_refc(Ecmd.bin[0].bin);~n break;~n",[]), + w(" case WXE_BIN_DECR:~n driver_binary_dec_refc(Ecmd.bin[0].bin);~n break;~n",[]), w(" case WXE_INIT_OPENGL:~n wxe_initOpenGL(&rt, bp);~n break;~n",[]), Res = [gen_class(Class) || Class <- Defs], @@ -631,10 +631,10 @@ decode_arg(N,#type{name=Type,base=binary,mod=Mod0},Arg,A0) -> Mod = mods([M || M <- Mod0]), case Arg of arg -> - w(" ~s~s * ~s = (~s~s*) Ecmd.bin[~p]->base;~n", + w(" ~s~s * ~s = (~s~s*) Ecmd.bin[~p].base;~n", [Mod,Type,N,Mod,Type, next_id(bin_count)]); opt -> - w(" ~s = (~s~s*) Ecmd.bin[~p]->base;~n", + w(" ~s = (~s~s*) Ecmd.bin[~p].base;~n", [N,Mod,Type,next_id(bin_count)]) end, A0; @@ -644,10 +644,10 @@ decode_arg(N,#type{base={term,"wxTreeItemData"},mod=Mod0},Arg,A0) -> BinCnt = next_id(bin_count), case Arg of arg -> - w(" ~s~s * ~s = new ~s(Ecmd.bin[~p]->size, Ecmd.bin[~p]->base);~n", + w(" ~s~s * ~s = new ~s(Ecmd.bin[~p].size, Ecmd.bin[~p].base);~n", [Mod,Type,N,Type,BinCnt,BinCnt]); opt -> - w(" ~s = new ~s(Ecmd.bin[~p]->size, Ecmd.bin[~p]->base);~n", + w(" ~s = new ~s(Ecmd.bin[~p].size, Ecmd.bin[~p].base);~n", [N,Type,BinCnt,BinCnt]) end, A0; @@ -656,10 +656,10 @@ decode_arg(N,#type{name=Type,base={term,_},mod=Mod0},Arg,A0) -> BinCnt = next_id(bin_count), case Arg of arg -> - w(" ~s~s * ~s = new ~s(Ecmd.bin[~p]);~n", + w(" ~s~s * ~s = new ~s(&Ecmd.bin[~p]);~n", [Mod,Type,N,Type,BinCnt]); opt -> - w(" ~s = new ~s(Ecmd.bin[~p]);~n", + w(" ~s = new ~s(&Ecmd.bin[~p]);~n", [N,Type,BinCnt]) end, A0; @@ -832,7 +832,7 @@ call_arg(#param{where=c, alt={length,Alt}}) when is_list(Alt) -> "*" ++ Alt ++ "Len"; call_arg(#param{where=c, alt={size,Id}}) when is_integer(Id) -> %% It's a binary - "Ecmd.bin["++ integer_to_list(Id) ++ "]->size"; + "Ecmd.bin["++ integer_to_list(Id) ++ "].size"; call_arg(#param{name=N,def=Def,type=#type{by_val=true,single=true,base=Base}}) when Base =:= int; Base =:= long; Base =:= float; Base =:= double; Base =:= bool -> case Def of diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index 09877f0f5a..a243f21852 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -556,14 +556,14 @@ {"alpha",[in,{base,binary}]}, {{4,pre_hook}, [{c, "if(!static_data) {" - "data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - "memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}"}]}, + "data = (unsigned char *) malloc(Ecmd.bin[0].size);" + "memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);}"}]}, {{5,pre_hook}, [{c, "if(!static_data) {" - " data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - " alpha = (unsigned char *) malloc(Ecmd.bin[1]->size);" - " memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);" - " memcpy(alpha,Ecmd.bin[1]->base,Ecmd.bin[1]->size);}"}]} + " data = (unsigned char *) malloc(Ecmd.bin[0].size);" + " alpha = (unsigned char *) malloc(Ecmd.bin[1].size);" + " memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);" + " memcpy(alpha,Ecmd.bin[1].base,Ecmd.bin[1].size);}"}]} ]}, '~wxImage',%'AddHandler', 'Blur','BlurHorizontal','BlurVertical', @@ -575,14 +575,14 @@ {"alpha",[in,{base,binary}]}, {{4,pre_hook}, [{c, "if(!static_data) {" - "data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - "memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}"}]}, + "data = (unsigned char *) malloc(Ecmd.bin[0].size);" + "memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);}"}]}, {{5,pre_hook}, [{c, "if(!static_data) {" - " data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - " alpha = (unsigned char *) malloc(Ecmd.bin[1]->size);" - " memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);" - " memcpy(alpha,Ecmd.bin[1]->base,Ecmd.bin[1]->size);}"}]} + " data = (unsigned char *) malloc(Ecmd.bin[0].size);" + " alpha = (unsigned char *) malloc(Ecmd.bin[1].size);" + " memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);" + " memcpy(alpha,Ecmd.bin[1].base,Ecmd.bin[1].size);}"}]} ]}, 'Destroy','FindFirstUnusedColour', % 'FindHandler', 'GetImageExtWildcard', @@ -608,14 +608,14 @@ {'SetAlpha', [{{2,"alpha"},[in,{base,binary}, {def, none}]}, {{2,pre_hook}, [{c, "if(!static_data) {" - "alpha = (unsigned char *) malloc(Ecmd.bin[0]->size);" - "memcpy(alpha,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}"}]} + "alpha = (unsigned char *) malloc(Ecmd.bin[0].size);" + "memcpy(alpha,Ecmd.bin[0].base,Ecmd.bin[0].size);}"}]} ]}, {'SetData', [{"data",[in,{base,binary}]}, {pre_hook, [{c, "if(!static_data) {" - "data = (unsigned char *) malloc(Ecmd.bin[0]->size);" - "memcpy(data,Ecmd.bin[0]->base,Ecmd.bin[0]->size);}"}]} + "data = (unsigned char *) malloc(Ecmd.bin[0].size);" + "memcpy(data,Ecmd.bin[0].base,Ecmd.bin[0].size);}"}]} ]}, 'SetMask','SetMaskColour','SetMaskFromImage','SetOption', 'SetPalette', -- cgit v1.2.3