Skip to content

Commit

Permalink
Merge branch 'dgud/wx_list_ctrl' into ccase/r13b04_dev
Browse files Browse the repository at this point in the history
* dgud/wx_list_ctrl:
  Generate without trailing spaces
  Fix correct starting copyright year
  Do not emit trailing whitespace
  Added tests for wxListCtrl:getItem/2.
  Added wxListCtrl:getEditCtrl (not available on Mac)

OTP-8408  Added wxListCtrl:getEditCtrl/1 (not available on Mac).
  • Loading branch information
Erlang/OTP committed Feb 5, 2010
2 parents 2e6ff4b + cfd2ba4 commit e76fa2f
Show file tree
Hide file tree
Showing 213 changed files with 14,011 additions and 13,962 deletions.
55 changes: 39 additions & 16 deletions lib/wx/api_gen/gen_util.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
%%
%%
%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%%
%% %CopyrightEnd%
%%
%% Some utilities
Expand Down Expand Up @@ -205,42 +205,65 @@ halt(Reason) ->
end.

erl_copyright() ->
StartYear = start_year(get(current_class)),
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 ~p-2010. All Rights Reserved.~n",
[StartYear]),
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",[]).


start_year("wxAuiManagerEvent") -> 2009;
start_year("wxAuiNotebookEvent") -> 2009;
start_year("wxChoicebook") -> 2009;
start_year("wxGridCellBoolEditor") -> 2009;
start_year("wxGridCellBoolRenderer") -> 2009;
start_year("wxGridCellChoiceEditor") -> 2009;
start_year("wxGridCellFloatEditor") -> 2009;
start_year("wxGridCellFloatRenderer") -> 2009;
start_year("wxGridCellNumberEditor") -> 2009;
start_year("wxGridCellNumberRenderer") -> 2009;
start_year("wxGridCellStringRenderer") -> 2009;
start_year("wxGridCellTextEditor") -> 2009;
start_year("wxHtmlLinkEvent") -> 2009;
start_year("wxHtmlWindow") -> 2009;
start_year("wxListbook") -> 2009;
start_year("wxLogNull") -> 2009;
start_year("wxSpinEvent") -> 2009;
start_year("wxSplitterEvent") -> 2009;
start_year("wxSplitterWindow") -> 2009;
start_year("wxToolbook") -> 2009;
start_year("wxTreebook") -> 2009;
start_year(_) -> 2008.
34 changes: 17 additions & 17 deletions lib/wx/api_gen/gl_gen_c.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
%%
%%
%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%%
%% %CopyrightEnd%
%%
%%%-------------------------------------------------------------------
Expand Down Expand Up @@ -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", []),
Expand All @@ -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",[]),

Expand All @@ -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];
Expand Down Expand Up @@ -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]),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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", []),
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
34 changes: 17 additions & 17 deletions lib/wx/api_gen/gl_gen_erl.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
%%
%%
%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%%
%% %CopyrightEnd%
%%
%%%-------------------------------------------------------------------
Expand Down Expand Up @@ -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", []),
Expand All @@ -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.
Expand All @@ -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", []),
Expand All @@ -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",[]),
Expand All @@ -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",[]),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",[]),
Expand Down

0 comments on commit e76fa2f

Please sign in to comment.