diff options
author | Björn Gustavsson <[email protected]> | 2010-02-02 16:34:24 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-02-02 17:56:52 +0100 |
commit | ce3cd31661a9b7ce3d6f4ce60079af3f860d1f6a (patch) | |
tree | 7a7eb620eef404f68630b6ae0c1ac2b1ef3ea4d0 /lib/wx/api_gen | |
parent | aa17e2bb5e9d53c69dcd86b8bf31584db24fe35a (diff) | |
download | otp-ce3cd31661a9b7ce3d6f4ce60079af3f860d1f6a.tar.gz otp-ce3cd31661a9b7ce3d6f4ce60079af3f860d1f6a.tar.bz2 otp-ce3cd31661a9b7ce3d6f4ce60079af3f860d1f6a.zip |
Do not emit trailing whitespace
Diffstat (limited to 'lib/wx/api_gen')
-rw-r--r-- | lib/wx/api_gen/gen_util.erl | 20 | ||||
-rw-r--r-- | lib/wx/api_gen/gl_gen_c.erl | 24 | ||||
-rw-r--r-- | lib/wx/api_gen/gl_gen_erl.erl | 24 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_cpp.erl | 88 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_erl.erl | 40 |
5 files changed, 98 insertions, 98 deletions
diff --git a/lib/wx/api_gen/gen_util.erl b/lib/wx/api_gen/gen_util.erl index d47fd579a5..de66083fdf 100644 --- a/lib/wx/api_gen/gen_util.erl +++ b/lib/wx/api_gen/gen_util.erl @@ -207,39 +207,39 @@ halt(Reason) -> erl_copyright() -> w("%%~n",[]), w("%% %CopyrightBegin%~n",[]), - w("%% ~n",[]), - w("%% Copyright Ericsson AB 2008-2009. All Rights Reserved.~n",[]), - w("%% ~n",[]), + w("%%~n",[]), + w("%% Copyright Ericsson AB 2008-2010. All Rights Reserved.~n",[]), + w("%%~n",[]), w("%% The contents of this file are subject to the Erlang Public License,~n",[]), w("%% Version 1.1, (the \"License\"); you may not use this file except in~n",[]), w("%% compliance with the License. You should have received a copy of the~n",[]), w("%% Erlang Public License along with this software. If not, it can be~n",[]), w("%% retrieved online at http://www.erlang.org/.~n",[]), - w("%% ~n",[]), + w("%%~n",[]), w("%% Software distributed under the License is distributed on an \"AS IS\"~n",[]), w("%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See~n",[]), w("%% the License for the specific language governing rights and limitations~n",[]), w("%% under the License.~n",[]), - w("%% ~n",[]), + w("%%~n",[]), w("%% %CopyrightEnd%~n",[]). c_copyright() -> w("/*~n",[]), w(" * %CopyrightBegin%~n",[]), - w(" * ~n",[]), - w(" * Copyright Ericsson AB 2008-2009. All Rights Reserved.~n",[]), - w(" * ~n",[]), + w(" *~n",[]), + w(" * Copyright Ericsson AB 2008-2010. All Rights Reserved.~n",[]), + w(" *~n",[]), w(" * The contents of this file are subject to the Erlang Public License,~n",[]), w(" * Version 1.1, (the \"License\"); you may not use this file except in~n",[]), w(" * compliance with the License. You should have received a copy of the~n",[]), w(" * Erlang Public License along with this software. If not, it can be~n",[]), w(" * retrieved online at http://www.erlang.org/.~n",[]), - w(" * ~n",[]), + w(" *~n",[]), w(" * Software distributed under the License is distributed on an \"AS IS\"~n",[]), w(" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See~n",[]), w(" * the License for the specific language governing rights and limitations~n",[]), w(" * under the License.~n",[]), - w(" * ~n",[]), + w(" *~n",[]), w(" * %CopyrightEnd% ~n",[]), w("*/~n",[]). diff --git a/lib/wx/api_gen/gl_gen_c.erl b/lib/wx/api_gen/gl_gen_c.erl index 5c72499790..902d841a8f 100644 --- a/lib/wx/api_gen/gl_gen_c.erl +++ b/lib/wx/api_gen/gl_gen_c.erl @@ -44,7 +44,7 @@ gen(GLFuncs, GLUFuncs) -> %% Marshal funcs open_write("../c_src/gen/gl_funcs.cpp"), c_copyright(), - w("/***** This file is generated do not edit ****/ ~n~n", []), + w("/***** This file is generated do not edit ****/~n~n", []), w("#include <stdio.h>~n", []), w("#include <string.h>~n", []), w("#include \"../wxe_impl.h\"~n", []), @@ -67,8 +67,8 @@ gen(GLFuncs, GLUFuncs) -> " driver_send_term(WXE_DRV_PORT,caller,rt,8);~n" " return ;~n }~n };~n~n", []), - w(" switch(op) ~n{~n",[]), - w(" case 5000: ~n wxe_tess_impl(bp, caller); ~n break;~n", []), + w(" switch(op)~n{~n",[]), + w(" case 5000:~n wxe_tess_impl(bp, caller);~n break;~n", []), w(" case WXE_BIN_INCR:~n driver_binary_inc_refc(bins[0]->bin);~n break;~n",[]), w(" case WXE_BIN_DECR:~n driver_binary_dec_refc(bins[0]->bin);~n break;~n",[]), @@ -93,23 +93,23 @@ funcs(F) -> func(#func{where=erl}) -> ok; func(#func{id=Id,alt={has_vector,_,FuncName}}) -> #func{name=Name,type=T,params=As} = get(FuncName), - w("case ~p: { // ~s ~n", [Id,Name]), + w("case ~p: { // ~s~n", [Id,Name]), put(bin_count,-1), As1 = declare_vars(T, As), As2 = decode_args(As1), As3 = call_gl(Name,T,As2), build_return_vals(T,As3), free_args(), - w("}; break; ~n", []); + w("}; break;~n", []); func(#func{name=Name,id=Id,type=T,params=As,alt=_Alt}) -> - w("case ~p: { // ~s ~n", [Id,Name]), + w("case ~p: { // ~s~n", [Id,Name]), put(bin_count,-1), As2 = decode_args(As), declare_vars(T, As), %% Unusal order but it's c++ As3 = call_gl(Name,T,As2), build_return_vals(T,As3), free_args(), - w("}; break; ~n", []). + w("}; break;~n", []). declare_vars(void,Ps) -> [declare_var(P) || P <- Ps]; @@ -183,7 +183,7 @@ decode_arg(P=#arg{name=Name,type=#type{name=T,base=string,single=list}},A0) -> w(" int * ~sTotSize = (int *) bp; bp += 4;~n",[Name]), %% w(" if(*~sLen > 256) *~sLen = 256;", []), w(" ~s **~s;~n", [T,Name]), - w(" ~s = (~s **) driver_alloc(sizeof(~s *) * *~sLen); ~n",[Name, T, T, Name]), + w(" ~s = (~s **) driver_alloc(sizeof(~s *) * *~sLen);~n",[Name, T, T, Name]), store_free(Name), w(" for(int i=0;i<*~sLen;i++) {~n", [Name]), w(" ~s[i] = (~s *) bp; bp += 1+strlen(bp);};~n",[Name,T]), @@ -353,7 +353,7 @@ build_return_vals(Type,As) -> case Vars of none -> ignore; _ -> - w(" driver_free(rt); ~n", []) + w(" driver_free(rt);~n", []) end, [w(" ~s~n", [Name]) || Name <- FreeList], ok @@ -492,7 +492,7 @@ build_ret(Name,_Q,T=#type{}) -> gen_defines(GLFuncs,GLUFuncs) -> open_write("../c_src/gen/gl_fdefs.h"), c_copyright(), - w("/***** This file is generated do not edit ****/ ~n~n", []), + w("/***** This file is generated do not edit ****/~n~n", []), w("#ifdef WX_DEF_EXTS~n", []), w("# define WXE_EXTERN~n", []), w("#else~n# define WXE_EXTERN extern~n", []), @@ -543,7 +543,7 @@ fdef_types(As) -> gl_gen_init(Funcs) -> open_write("../c_src/gen/gl_finit.h"), c_copyright(), - w("/***** This file is generated do not edit ****/ ~n~n", []), + w("/***** This file is generated do not edit ****/~n~n", []), w("static struct {\n" " const char * name;\n" " const char * alt;\n" @@ -557,7 +557,7 @@ gl_gen_init(Funcs) -> glu_gen_init(Funcs) -> open_write("../c_src/gen/glu_finit.h"), c_copyright(), - w("/***** This file is generated do not edit ****/ ~n~n", []), + w("/***** This file is generated do not edit ****/~n~n", []), w("static struct {\n" " const char * name;\n" " const char * alt;\n" diff --git a/lib/wx/api_gen/gl_gen_erl.erl b/lib/wx/api_gen/gl_gen_erl.erl index 3e436100b6..66ab7ef8c5 100644 --- a/lib/wx/api_gen/gl_gen_erl.erl +++ b/lib/wx/api_gen/gl_gen_erl.erl @@ -86,14 +86,14 @@ gl_api(Fs) -> erl_copyright(), w("~n%% OPENGL API~n~n", []), w("%% This file is generated DO NOT EDIT~n~n", []), - w("%% @doc Standard OpenGL api. ~n", []), + w("%% @doc Standard OpenGL api.~n", []), w("%% See <a href=\"http://www.opengl.org/sdk/docs/man/\">www.opengl.org</a>~n",[]), w("%%~n", []), - w("%% Booleans are represented by integers 0 and 1. ~n~n", []), + w("%% Booleans are represented by integers 0 and 1.~n~n", []), w("%% @type wx_mem(). see wx.erl on memory allocation functions~n", []), w("%% @type enum(). An integer defined in gl.hrl~n", []), w("%% @type offset(). An integer which is an offset in an array~n", []), - w("%% @type clamp(). A float clamped between 0.0 - 1.0 ~n", []), + w("%% @type clamp(). A float clamped between 0.0 - 1.0~n", []), w("-module(gl).~n~n",[]), w("-compile(inline).~n", []), @@ -106,7 +106,7 @@ gl_api(Fs) -> ExportList = lists:map(Exp,Fs), w("~n-export([~s]).~n~n", [args(fun(EF) -> EF end, ",", ExportList, 60)]), - w("~n%% API ~n~n", []), + w("~n%% API~n~n", []), [gen_funcs(F) || F <- Fs], close(), ok. @@ -116,14 +116,14 @@ glu_api(Fs) -> erl_copyright(), w("~n%% OPENGL UTILITY API~n~n", []), w("%% This file is generated DO NOT EDIT~n~n", []), - w("%% @doc A part of the standard OpenGL Utility api. ~n", []), + w("%% @doc A part of the standard OpenGL Utility api.~n", []), w("%% See <a href=\"http://www.opengl.org/sdk/docs/man/\">www.opengl.org</a>~n",[]), w("%%~n", []), - w("%% Booleans are represented by integers 0 and 1. ~n~n", []), + w("%% Booleans are represented by integers 0 and 1.~n~n", []), w("%% @type wx_mem(). see wx.erl on memory allocation functions~n", []), w("%% @type enum(). An integer defined in gl.hrl~n", []), w("%% @type offset(). An integer which is an offset in an array~n", []), - w("%% @type clamp(). A float clamped between 0.0 - 1.0 ~n~n", []), + w("%% @type clamp(). A float clamped between 0.0 - 1.0~n~n", []), w("-module(glu).~n",[]), w("-compile(inline).~n", []), @@ -134,7 +134,7 @@ glu_api(Fs) -> ExportList = ["tesselate/2" | lists:map(Exp,Fs)], w("~n-export([~s]).~n~n", [args(fun(EF) -> EF end, ",", ExportList, 60)]), - w("~n%% API ~n~n", []), + w("~n%% API~n~n", []), w("%% @spec (Vec3, [Vec3]) -> {Triangles, VertexPos}~n",[]), w("%% Vec3 = {float(),float(),float()}~n",[]), @@ -143,8 +143,8 @@ glu_api(Fs) -> w("%% @doc General purpose polygon triangulation.~n",[]), w("%% The first argument is the normal and the second a list of~n" "%% vertex positions. Returned is a list of indecies of the vertices~n" - "%% and a binary (64bit native float) containing an array of ~n" - "%% vertex positions, it starts with the vertices in Vs and ~n" + "%% and a binary (64bit native float) containing an array of~n" + "%% vertex positions, it starts with the vertices in Vs and~n" "%% may contain newly created vertices in the end.~n", []), w("tesselate({Nx,Ny,Nz}, Vs) ->~n",[]), @@ -413,7 +413,7 @@ marshal_arg(#type{size=Sz,name=Type,single={tuple_list,TSz}},Name,A0) -> marshal_arg(T=#type{}, Name, Align) -> io:format("{\"~s\", {\"~s\", }}.~n", [get(current_func),lowercase(Name)]), %%?error({unhandled_type, {Name,T}}). - w(" Don't know how to marshal this type ~p ~p ~n", [T,Name]), + w(" Don't know how to marshal this type ~p ~p~n", [T,Name]), align(8,Align,""). % Make sure that it is aligned before adding it, and update alignment @@ -581,7 +581,7 @@ gen_debug(GL, GLU) -> open_write("../src/gen/gl_debug.hrl"), erl_copyright(), w("%% This file is generated DO NOT EDIT~n~n", []), - w("gldebug_table() -> ~n[~n", []), + w("gldebug_table() ->~n[~n", []), [printd(F,gl) || F <- GL], [printd(F,glu) || F <- GLU], w(" {-1, {mod, func, -1}}~n",[]), diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index 423dcd0179..9e9f8799c7 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -38,7 +38,7 @@ gen(Defs) -> open_write("../c_src/gen/wxe_derived_dest.h"), c_copyright(), - w("~n/***** This file is generated do not edit ****/ ~n~n", []), + w("~n/***** This file is generated do not edit ****/~n~n", []), gen_derived_dest(Defs), close(), @@ -91,16 +91,16 @@ gen_derived_dest_2(C=#class{name=Class}) -> case is_derived(C) of true -> ?WTC("gen_derived_dest_2"), - w("class E~s : public ~s { ~n",[Class,Class]), + w("class E~s : public ~s {~n",[Class,Class]), case Class of "wxGLCanvas" -> %% Special for cleaning up gl context w(" public: ~~E~s() {deleteActiveGL(this);" - "((WxeApp *)wxTheApp)->clearPtr(this);}; ~n", [Class]); + "((WxeApp *)wxTheApp)->clearPtr(this);};~n", [Class]); _ -> - w(" public: ~~E~s() {((WxeApp *)wxTheApp)->clearPtr(this);}; ~n", [Class]) + w(" public: ~~E~s() {((WxeApp *)wxTheApp)->clearPtr(this);};~n", [Class]) end, gen_constructors(C), - w("}; ~n~n", []); + w("};~n~n", []); false -> ignore end. @@ -147,7 +147,7 @@ gen_type({merged, _, _T1,_, _, T2,_}, 2) -> gen_type(T2,error). gen_funcs(Defs) -> - w("~n/***** This file is generated do not edit ****/ ~n~n"), + w("~n/***** This file is generated do not edit ****/~n~n"), w("#include <wx/wx.h>~n"), w("#include \"../wxe_impl.h\"~n"), w("#include \"../wxe_events.h\"~n"), @@ -156,21 +156,21 @@ gen_funcs(Defs) -> w("#include \"wxe_derived_dest.h\"~n~n"), w("void WxeApp::wxe_dispatch(wxeCommand& Ecmd)~n{~n"), - w(" char * bp = Ecmd.buffer; ~n"), + w(" char * bp = Ecmd.buffer;~n"), w(" wxeMemEnv *memenv = getMemEnv(Ecmd.port);~n"), %% w(" wxMBConvUTF32 UTFconverter;~n"), w(" wxeReturn rt = wxeReturn(WXE_DRV_PORT, Ecmd.caller, true);~n"), - w(" try { ~n"), - w(" switch (Ecmd.op) ~n{~n"), -%% w(" case WXE_CREATE_PORT: ~n", []), -%% w(" { newMemEnv(Ecmd.port); } break; ~n", []), -%% w(" case WXE_REMOVE_PORT: ~n", []), -%% w(" { destroyMemEnv(Ecmd.port); } break; ~n", []), - w(" case DESTROY_OBJECT: { ~n"), + w(" try {~n"), + w(" switch (Ecmd.op)~n{~n"), +%% w(" case WXE_CREATE_PORT:~n", []), +%% w(" { newMemEnv(Ecmd.port); } break;~n", []), +%% w(" case WXE_REMOVE_PORT:~n", []), +%% w(" { destroyMemEnv(Ecmd.port); } break;~n", []), + w(" case DESTROY_OBJECT: {~n"), w(" wxObject *This = (wxObject *) getPtr(bp,memenv); "), w(" if(This) {"), w(" ((WxeApp *) wxTheApp)->clearPtr((void *) This);~n"), - w(" delete This; }~n } break; ~n"), + w(" delete This; }~n } break;~n"), w(" case WXE_REGISTER_OBJECT: {~n" " registerPid(bp, Ecmd.caller, memenv);~n" " rt.addAtom(\"ok\");~n" @@ -190,7 +190,7 @@ gen_funcs(Defs) -> w(" }~n"), w("} // switch~n"), w(" rt.send();~n"), - w("} catch (wxe_badarg badarg) { // try ~n"), + w("} catch (wxe_badarg badarg) { // try~n"), w(" wxeReturn error = wxeReturn(WXE_DRV_PORT, Ecmd.caller, false);"), w(" error.addAtom(\"_wxe_error_\");~n"), w(" error.addInt((int) Ecmd.op);~n"), @@ -199,7 +199,7 @@ gen_funcs(Defs) -> w(" error.addTupleCount(2);~n"), w(" error.addTupleCount(3);~n"), w(" error.send();~n"), - w("}} /* The End */ ~n"), + w("}} /* The End */~n"), Res. gen_class(C=#class{name=Name,methods=Ms,options=Opts}) -> @@ -233,7 +233,7 @@ gen_method(_CName, M=#method{where=erl_no_opt}) -> M; gen_method(CName, M=#method{where=taylormade, name=Name, id=Id}) -> {ok, Bin} = file:read_file(filename:join([wx_extra, CName ++".c_src"])), Str0 = binary_to_list(Bin), - %% io:format("C++ Class ~p ~p ~n", [CName, Name]), + %% io:format("C++ Class ~p ~p~n", [CName, Name]), {match, [Str1]} = re:run(Str0, "<<"++Name++"(.*)"++Name++">>", [dotall, {capture, all_but_first, list}]), @@ -244,13 +244,13 @@ gen_method(CName, M=#method{name=N,params=[Ps],method_type=destructor,id=MethodI case hd(reverse(wx_gen_erl:parents(CName))) of root -> ?WTC("gen_method"), - w("case ~s: { // ~s::~s ~n", [wx_gen_erl:get_unique_name(MethodId),CName,N]), + w("case ~s: { // ~s::~s~n", [wx_gen_erl:get_unique_name(MethodId),CName,N]), decode_arguments([Ps]), w(" if(This) {", []), w(" ((WxeApp *) wxTheApp)->clearPtr((void *) This);~n", []), w(" delete This;}~n", []), free_args(), - w(" break; ~n}~n", []); + w(" break;~n}~n", []); object -> %% Use default ignore end, @@ -259,7 +259,7 @@ gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId put(current_func, N), put(bin_count,-1), ?WTC("gen_method"), - w("case ~s: { // ~s::~s ~n", [wx_gen_erl:get_unique_name(MethodId),CName,N]), + w("case ~s: { // ~s::~s~n", [wx_gen_erl:get_unique_name(MethodId),CName,N]), Ps1 = declare_variables(void, Ps0), {Ps2,Align} = decode_arguments(Ps1), Opts = [Opt || Opt = #param{def=Def,in=In,where=Where} <- Ps2, @@ -276,7 +276,7 @@ gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId end, free_args(), build_return_vals(T,Ps3), - w(" break; ~n}~n", []), + w(" break;~n}~n", []), erase(current_func), M. @@ -353,9 +353,9 @@ declare_type(N,In,Def,T) -> decode_options([], _Align) -> ok; decode_options(Opts, Align) -> align(Align, 64), - w(" while( * (int*) bp) { switch (* (int*) bp) { ~n", []), + w(" while( * (int*) bp) { switch (* (int*) bp) {~n", []), foldl(fun decode_opt/2, 1, Opts), - w(" }}; ~n", []). + w(" }};~n", []). decode_opt(#param{name=Name,type=Type}, N) -> w(" case ~p: {bp += 4;~n", [N]), @@ -548,10 +548,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; @@ -561,10 +561,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; @@ -573,10 +573,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; @@ -792,7 +792,7 @@ virtual_dest(#class{methods=Ms, parent=Parent}) -> "root" -> false; _ -> - io:format("Error: ~p ~n",[Parent]), + io:format("Error: ~p~n",[Parent]), erlang:error(no_parent) end; PClass -> @@ -1017,7 +1017,7 @@ gen_macros() -> build_events() -> open_write("../c_src/gen/wxe_events.cpp"), c_copyright(), - w("~n/***** This file is generated do not edit ****/ ~n~n"), + w("~n/***** This file is generated do not edit ****/~n~n"), w("#include <wx/wx.h>~n"), w("#include \"../wxe_impl.h\"~n~n"), w("#include \"wxe_macros.h\"~n"), @@ -1027,7 +1027,7 @@ build_events() -> w("wxeEtype::wxeEtype(const char *name, int Id) {eName = name;cID = Id;}~n~n"), w("WX_DECLARE_HASH_MAP(int, wxeEtype*, wxIntegerHash, wxIntegerEqual, wxeETmap );~n~n"), - w("wxeETmap etmap; ~n~n"), + w("wxeETmap etmap;~n~n"), w( "int wxeEventTypeFromAtom(char *etype_atom) { @@ -1054,16 +1054,16 @@ build_events() -> close(). initEventTable(Evs) -> - w("void initEventTable() ~n{~n"), + w("void initEventTable()~n{~n"), w(" struct { ",[]), - w("int ev_type; int class_id; const char * ev_name;} event_types[] = ~n {~n",[]), + w("int ev_type; int class_id; const char * ev_name;} event_types[] =~n {~n",[]), lists:foreach(fun(Ev) -> init_event_classes(Ev) end, [#class{id=0,event=[wxEVT_NULL]}|Evs]), w(" {-1, 0, ""}~n };~n",[]), w(" for(int i=0; event_types[i].ev_type != -1; i++) {~n",[]), w(" if(NULL == etmap[event_types[i].ev_type]) {~n",[]), - w(" etmap[event_types[i].ev_type] = ~n" + w(" etmap[event_types[i].ev_type] =~n" " new wxeEtype(event_types[i].ev_name, event_types[i].class_id);~n"), w(" } else {~n",[]), w(" wxeEtype *prev = etmap[event_types[i].ev_type];~n" @@ -1082,10 +1082,10 @@ init_event_classes(#class{event=ETs, id=Id}) -> w(" {~w + wxEVT_USER_FIRST, ~w, ~p},~n", [Cev, find_id(OtherClass), wx_gen_erl:event_type_name(Eev)]); ({Ev, {test_if, Test}}) -> - w("#if ~s ~n", [Test]), + w("#if ~s~n", [Test]), w(" {~w, ~w, ~p},~n", [Ev, Id, wx_gen_erl:event_type_name(Ev)]), - w("#endif ~n", []); + w("#endif~n", []); (Ev) -> w(" {~w, ~w, ~p},~n", [Ev, Id, wx_gen_erl:event_type_name(Ev)]) @@ -1099,20 +1099,20 @@ find_id(OtherClass) -> encode_events(Evs) -> ?WTC("encode_events"), - w("void wxeEvtListener::forward(wxEvent& event) ~n" - "{ ~n" + w("void wxeEvtListener::forward(wxEvent& event)~n" + "{~n" "#ifdef DEBUG~n" - " if(!sendevent(&event, port)) ~n" + " if(!sendevent(&event, port))~n" " fprintf(stderr, \"Couldn't send event!\\r\\n\");~n" "#else~n" "sendevent(&event, port);~n" "#endif~n" "}~n~n"), - w("int getRef(void* ptr, wxeMemEnv* memenv) ~n" - "{ ~n" + w("int getRef(void* ptr, wxeMemEnv* memenv)~n" + "{~n" " WxeApp * app = (WxeApp *) wxTheApp;~n" " return app->getRef(ptr,memenv);~n" - "} ~n~n"), + "}~n~n"), w("bool sendevent(wxEvent *event, ErlDrvPort port)~n{~n" " int send_res ;~n" " char * evClass = NULL;~n" diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl index c31d7d2a92..d75442d307 100644 --- a/lib/wx/api_gen/wx_gen_erl.erl +++ b/lib/wx/api_gen/wx_gen_erl.erl @@ -119,7 +119,7 @@ gen_class1(C=#class{name=Name,parent=Parent,methods=Ms,options=Opts}) -> case [P || P <- Parents, P =/= root, P =/= object] of [] -> ignore; Ps -> - w("%% <p>This class is derived (and can use functions) from: ~n", []), + w("%% <p>This class is derived (and can use functions) from:~n", []), [w("%% <br />{@link ~s}~n", [P]) || P <- Ps], w("%% </p>~n",[]) end, @@ -302,7 +302,7 @@ gen_dest(#class{name=CName,abstract=Abs}, Ms) -> gen_dest2(Class, Id) -> w("%% @spec (This::~s()) -> ok~n", [Class]), w("%% @doc Destroys this object, do not use object again~n", []), - w("destroy(Obj=#wx_ref{type=Type}) -> ~n", []), + w("destroy(Obj=#wx_ref{type=Type}) ->~n", []), w(" ?CLASS(Type,~s),~n",[Class]), case Id of object -> @@ -317,7 +317,7 @@ gen_inherited([object], Done, Exported) -> {Done, Exported}; gen_inherited([Parent|Ps], Done0, Exported0) -> #class{name=Class, methods=Ms} = get({class,Parent}), case is_list(Exported0) of - false -> w(" %% From ~s ~n", [Class]); + false -> w(" %% From ~s~n", [Class]); true -> ignore end, {Done,Exported} = gen_inherited_ms(Ms, Class, Done0, gb_sets:empty(), Exported0), @@ -673,7 +673,7 @@ gen_doc(Class, Cs = [#method{name=N, alias=A,method_type=MT}|_]) -> [lowercase_all(Class),lowercase_all(Class),lowercase_all(N)]) end, Name = case MT of constructor -> "new"; _ -> erl_func_name(N,A) end, - w("%% <br /> Alternatives: ~n",[]), + w("%% <br /> Alternatives:~n",[]), [gen_doc2(Name, Clause) || Clause <- Cs], ok. @@ -1026,22 +1026,22 @@ enum_name(Name) -> gen_enums_ints() -> %% open_write("../include/wx.hrl"), opened in gen_event_recs - w("~n%% Hardcoded Records ~n", []), - w("-record(wxMouseState, {x, y, %% integer() ~n" - " leftDown, middleDown, rightDown, %% bool() ~n" + w("~n%% Hardcoded Records~n", []), + w("-record(wxMouseState, {x, y, %% integer()~n" + " leftDown, middleDown, rightDown, %% bool()~n" " controlDown, shiftDown, altDown, metaDown, cmdDown %% bool()~n" " }).~n", []), - w("-record(wxHtmlLinkInfo, { ~n" - " href, target %% string() ~n" + w("-record(wxHtmlLinkInfo, {~n" + " href, target %% string()~n" " }).~n", []), - w("~n%% Hardcoded Defines ~n", []), + w("~n%% Hardcoded Defines~n", []), Enums = [E || E = {{enum,_},#enum{as_atom=false}} <- get()], w("-define(wxDefaultSize, {-1,-1}).~n", []), w("-define(wxDefaultPosition, {-1,-1}).~n", []), - w("~n%% Global Variables ~n", []), + w("~n%% Global Variables~n", []), [w("-define(~s, wxe_util:get_const(~s)).~n", [Gvar, Gvar]) || {Gvar,_,_Id} <- get(gvars)], - w("~n%% Enum and defines ~n", []), + w("~n%% Enum and defines~n", []), foldl(fun({{enum,Type},Enum= #enum{as_atom=false}}, Done) -> build_enum_ints(Type,Enum,Done); (_,Done) -> Done @@ -1051,9 +1051,9 @@ gen_enums_ints() -> build_enum_ints(Type,#enum{vals=Vals},Done) -> case Type of [$@|_] -> ok; % anonymous - {Class,[$@|_]} when Vals =/= [] -> w("% From class ~s ~n", [Class]); - {Class,Enum} when Vals =/= [] -> w("% From ~s::~s ~n", [Class,Enum]); - _ when Vals =/= [] -> w("% Type ~s ~n", [Type]); + {Class,[$@|_]} when Vals =/= [] -> w("% From class ~s~n", [Class]); + {Class,Enum} when Vals =/= [] -> w("% From ~s::~s~n", [Class,Enum]); + _ when Vals =/= [] -> w("% Type ~s~n", [Type]); _ -> ok end, @@ -1096,7 +1096,7 @@ gen_event_recs() -> erl_copyright(), w("", []), w("%% This file is generated DO NOT EDIT~n~n", []), - w("%% All event messages are encapsulated in a wx record ~n" + w("%% All event messages are encapsulated in a wx record~n" "%% they contain the widget id and a specialized event record.~n" "%% Each event record may be sent for one or more event types.~n" "%% The mapping to wxWidgets is one record per class.~n~n",[]), @@ -1104,7 +1104,7 @@ gen_event_recs() -> w("-record(wx, {id, %% Integer Identity of object.~n" " obj, %% Object reference that was used in the connect call.~n" " userData, %% User data specified in the connect call.~n" - " event}).%% The event record ~n~n",[]), + " event}).%% The event record~n~n",[]), w("%% Here comes the definitions of all event records.~n" "%% they contain the event type and possible some extra information.~n~n",[]), Types = [build_event_rec(C) || {_,C=#class{event=Evs}} <- get(), Evs =/= false], @@ -1157,7 +1157,7 @@ build_event_rec(Class=#class{name=Name, event=Evs}) -> %% false -> w("%% This event will be handled by other handlers~n",[]) %% end, w("%% Callback event: {@link ~s}~n", [Name]), - w("-record(~s, {type}). ~n~n", [Rec]); + w("-record(~s, {type}).~n~n", [Rec]); false -> w("%% @type ~s() = #~s{type=wxEventType(),~s}.~n", [Rec,Rec,args(GetType,",",Attr)]), @@ -1167,7 +1167,7 @@ build_event_rec(Class=#class{name=Name, event=Evs}) -> %% false -> w("%% This event will be handled by other handlers~n",[]) %% end, w("%% Callback event: {@link ~s}~n", [Name]), - w("-record(~s,{type, ~s}). ~n~n", [Rec,args(GetName,",",Attr)]) + w("-record(~s,{type, ~s}).~n~n", [Rec,args(GetName,",",Attr)]) end, EvTypes. @@ -1197,7 +1197,7 @@ gen_funcnames() -> open_write("../src/gen/wxe_debug.hrl"), erl_copyright(), w("%% This file is generated DO NOT EDIT~n~n", []), - w("wxdebug_table() -> ~n[~n", []), + w("wxdebug_table() ->~n[~n", []), w(" {0, {wx, internal_batch_start, 0}},~n", []), w(" {1, {wx, internal_batch_end, 0}},~n", []), w(" {4, {wxObject, internal_destroy, 1}},~n", []), |