~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/wx/api_gen/wx_gen_cpp.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-08-05 20:54:29 UTC
  • mfrom: (6.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090805205429-pm4pnwew8axraosl
Tags: 1:13.b.1-dfsg-5
* Fixed parentheses in Emacs mode (closes: #536891).
* Removed unnecessary conflicts with erlang-manpages package.
* Added workaround for #475459: disabled threads on sparc architecture.
  This breaks wxErlang, so it's only a temporary solution.

Show diffs side-by-side

added added

removed removed

Lines of Context:
229
229
    erase(current_class),
230
230
    C#class{methods=NewMs}.
231
231
 
232
 
%%gen_methods(ClassName, Ms) ->
233
 
%%    [gen_method(ClassName, M) ||  M <- Ms].
234
 
 
235
232
gen_method(_CName, M=#method{where=erl_no_opt}) ->     M;
236
233
gen_method(CName, M=#method{where=taylormade, name=Name, id=Id}) ->     
237
234
    {ok, Bin} = file:read_file(filename:join([wx_extra, CName ++".c_src"])),
238
235
    Str0 = binary_to_list(Bin),
239
236
    %%    io:format("C++ Class ~p ~p ~n", [CName, Name]),
240
 
    {match, Start, Len} = regexp:first_match(Str0, "<<" ++ Name),
241
 
    {match, End, _} = regexp:first_match(Str0, Name ++ ">>"),
242
 
    Str1 = string:substr(Str0, Start+Len, End-Start-Len),
243
 
    %% {ok, Str, _} = regexp:sub(Str1, "FUNCID", integer_to_list(Id)),
 
237
    
 
238
    {match, [Str1]} = re:run(Str0, "<<"++Name++"(.*)"++Name++">>",
 
239
                           [dotall, {capture, all_but_first, list}]),
244
240
    ?WTC("gen_method"),
245
241
    w(Str1, [wx_gen_erl:get_unique_name(Id)]),
246
242
    M;
885
881
    w(" rt.endList(~s.GetCount());~n",[Name]);    
886
882
build_ret(Name,_,#type{name=List,single=list,base={class,Class}}) ->
887
883
    w(" int i=0;~n"),
888
 
    w(" for(~s::Node *node = ~s.GetFirst(); node; node = node->GetNext()) {~n",
889
 
      [List, Name]),
890
 
    w("   ~s * ~sTmp = node->GetData();~n", [Class,Name]),
 
884
    w(" for(~s::const_iterator it = ~s.begin(); it != ~s.end(); ++it) {~n",
 
885
      [List, Name, Name]),
 
886
    w("   ~s * ~sTmp = *it;~n", [Class,Name]),
891
887
    w("   rt.addRef(getRef((void *)~sTmp,memenv), \"~s\"); i++;}~n",[Name,Class]),
892
888
    w(" rt.endList(~s.GetCount());~n",[Name]);    
893
889
    
989
985
    w("#include <wx/statline.h>~n"), 
990
986
    w("#include <wx/clipbrd.h>~n"), 
991
987
    w("#include <wx/splitter.h>~n"),
992
 
 
 
988
    w("#include <wx/choicebk.h>~n"),
 
989
    w("#include <wx/toolbook.h>~n"),
 
990
    w("#include <wx/listbook.h>~n"),
 
991
    w("#include <wx/treebook.h>~n"),
 
992
    
993
993
    w("~n~n", []),
994
994
    [w("#define ~s_~s ~p~n", [Class,Name,Id]) || 
995
995
        {Class,Name,_,Id} <- wx_gen_erl:get_unique_names()],
1095
1095
      " wxMBConvUTF32 UTFconverter;~n"
1096
1096
      " wxeEtype *Etype = etmap[event->GetEventType()];~n"
1097
1097
      " wxeCallbackData *cb = (wxeCallbackData *)event->m_callbackUserData;~n"
1098
 
      "  WxeApp * app = (WxeApp *) wxTheApp;~n"
 
1098
      " WxeApp * app = (WxeApp *) wxTheApp;~n"
1099
1099
      " wxeMemEnv *memenv = app->getMemEnv(port);~n"
1100
 
      "  wxeReturn rt = wxeReturn(port, cb->listener);~n"),
 
1100
      " if(!memenv) return 0;~n~n"
 
1101
      " wxeReturn rt = wxeReturn(port, cb->listener);~n"),
1101
1102
    
1102
1103
    w("~n rt.addAtom((char*)\"wx\");~n"
1103
1104
      " rt.addInt((int) event->GetId());~n"
1104
1105
      " rt.addRef(getRef((void *)(cb->obj), memenv), cb->class_name);~n"
1105
1106
      " rt.addExt2Term(cb->user_data);~n"),
1106
1107
 
1107
 
    w(" if(!memenv) return 0;~n~n"),
1108
1108
    w(" switch(Etype->cID) {~n"),
1109
1109
    lists:foreach(fun(Ev) -> encode_event(Ev) end, Evs),
1110
1110
    w(" }~n~n"),