From c384a91846f7d0aff189fb51d1d502330d7abef4 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Tue, 8 Jan 2013 14:55:52 +0100 Subject: wx: Fix comments Fix utf-8 code generation for opengl docs --- lib/wx/api_gen/gen_util.erl | 10 ++++++---- lib/wx/api_gen/gl_gen_erl.erl | 22 ++++++++++++---------- lib/wx/api_gen/gl_scan_doc.erl | 14 ++++++++++---- lib/wx/api_gen/wx_extra/wxPrintout.erl | 5 +++-- 4 files changed, 31 insertions(+), 20 deletions(-) (limited to 'lib/wx/api_gen') diff --git a/lib/wx/api_gen/gen_util.erl b/lib/wx/api_gen/gen_util.erl index d4941d4fdb..2ba1c6e16f 100644 --- a/lib/wx/api_gen/gen_util.erl +++ b/lib/wx/api_gen/gen_util.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. 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 @@ -49,8 +49,10 @@ get_taylor_made(Str, Name) -> [dotall, {capture, all_but_first, list}]). open_write(File) -> + open_write(File, []). +open_write(File, Opts) -> %% io:format("Generating ~s~n",[File]), - {ok, Fd} = file:open(File++".temp", [write]), + {ok, Fd} = file:open(File++".temp", [write|Opts]), put(current_file, {Fd,File}). @@ -223,7 +225,7 @@ erl_copyright() -> w("%%~n",[]), w("%% %CopyrightBegin%~n",[]), w("%%~n",[]), - w("%% Copyright Ericsson AB ~p-2012. All Rights Reserved.~n", + w("%% Copyright Ericsson AB ~p-2013. All Rights Reserved.~n", [StartYear]), w("%%~n",[]), w("%% The contents of this file are subject to the Erlang Public License,~n",[]), @@ -243,7 +245,7 @@ c_copyright() -> w("/*~n",[]), w(" * %CopyrightBegin%~n",[]), w(" *~n",[]), - w(" * Copyright Ericsson AB 2008-2012. All Rights Reserved.~n",[]), + w(" * Copyright Ericsson AB 2008-2013. 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",[]), diff --git a/lib/wx/api_gen/gl_gen_erl.erl b/lib/wx/api_gen/gl_gen_erl.erl index 25f89e4ad4..446521098e 100644 --- a/lib/wx/api_gen/gl_gen_erl.erl +++ b/lib/wx/api_gen/gl_gen_erl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2012. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. 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 @@ -31,7 +31,7 @@ -import(lists, [foldl/3,foldr/3,reverse/1, keysearch/3, map/2, filter/2, max/1]). -import(gen_util, [lowercase/1, lowercase_all/1, uppercase/1, uppercase_all/1, - open_write/1, close/0, erl_copyright/0, w/2, + open_write/1, open_write/2, close/0, erl_copyright/0, w/2, args/3, args/4, strip_name/2]). gl_defines(Defs) -> @@ -90,7 +90,8 @@ types() -> ]. gl_api(Fs) -> - open_write("../src/gen/gl.erl"), + open_write("../src/gen/gl.erl", [{encoding,utf8}]), + w("%% -*- coding: utf-8 -*-~n~n", []), erl_copyright(), w("~n%% OPENGL API~n~n", []), w("%% This file is generated DO NOT EDIT~n~n", []), @@ -148,7 +149,8 @@ gl_api(Fs) -> ok. glu_api(Fs) -> - open_write("../src/gen/glu.erl"), + open_write("../src/gen/glu.erl", [{encoding,utf8}]), + w("%% -*- coding: utf-8 -*-~n~n", []), erl_copyright(), w("~n%% OPENGL UTILITY API~n~n", []), w("%% This file is generated DO NOT EDIT~n~n", []), @@ -330,7 +332,7 @@ format_doc([{constant, Const}|Rest], Count) -> w("`?~s'", [Const]), format_doc(Rest, Count-length(Const)-8); format_doc([{emphasis, Const}|Rest], Count) -> - w("`~s'", [Const]), + w("`~ts'", [Const]), format_doc(Rest, Count-length(Const)-7); format_doc([{function, Func}|Rest], Count) -> case Func of @@ -377,7 +379,7 @@ format_doc([{fenced, Open, Close, Eq}|Rest], Count) -> format_doc(Rest, Count); format_doc([{code, Code}|Rest], Count) -> - w("``~s''", [Code]), + w("``~ts''", [Code]), format_doc(Rest, Count-length(Code)-7); format_doc([para|Rest], _Count) -> @@ -387,10 +389,10 @@ format_doc([break|Rest], _Count) -> w("
~n%% ", []), format_doc(Rest, ?LINE_LEN); format_doc([{purpose, Purpose}, para | Doc], _Count) -> - w("%% @doc ~s~n%%~n%% ", [uppercase(Purpose)]), + w("%% @doc ~ts~n%%~n%% ", [uppercase(Purpose)]), format_doc(Doc, ?LINE_LEN); format_doc([{purpose, Purpose} | Doc], _Count) -> - w("%% @doc ~s~n%%~n%% ", [Purpose]), + w("%% @doc ~ts~n%%~n%% ", [Purpose]), format_doc(Doc, ?LINE_LEN); format_doc([listentry|Rest], _Count) -> w("~n%%~n%% ", []), @@ -398,11 +400,11 @@ format_doc([listentry|Rest], _Count) -> format_doc([Str|Rest], Count) -> case length(Str) of Len when Len < Count -> - w("~s", [Str]), + w("~ts", [Str]), format_doc(Rest, Count-Len); _ -> {Str1, Str2} = split(Str, Count, []), - w("~s~n%% ", [Str1]), + w("~ts~n%% ", [Str1]), format_doc([Str2|Rest], ?LINE_LEN) end; format_doc([], _) -> ok. diff --git a/lib/wx/api_gen/gl_scan_doc.erl b/lib/wx/api_gen/gl_scan_doc.erl index fc7b7cf275..80b4826a30 100644 --- a/lib/wx/api_gen/gl_scan_doc.erl +++ b/lib/wx/api_gen/gl_scan_doc.erl @@ -2,7 +2,7 @@ %%-------------------------------------------------------------------- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2012. All Rights Reserved. +%% Copyright Ericsson AB 2012-2013. 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 @@ -56,8 +56,10 @@ gen_output({characters, String0}, #state{gen_output=true, type=Type, str=Str} = mi -> case hd(Str) of "/" -> String; "*" -> String; + [215] -> String; "+" -> String; "-" -> String; + "=" -> String; {fenced,_,_} -> String; _ -> [$ |String] @@ -268,7 +270,9 @@ fix_str([$<|Str]) -> fix_str([$>|Str]) -> [$&,$g,$t,$;|fix_str(Str)]; fix_str("×"++Str) -> - [$*|fix_str(Str)]; + [215|fix_str(Str)]; +%% fix_str([215|Str]) -> +%% [$*|fix_str(Str)]; fix_str("″"++Str) -> [$"|fix_str(Str)]; fix_str("·"++Str) -> @@ -277,10 +281,12 @@ fix_str("⁡"++Str) -> fix_str(Str); fix_str("⁢"++Str) -> [$ |fix_str(Str)]; +fix_str(" "++Str) -> + [$ |fix_str(Str)]; fix_str([$&|Str]) -> [$&,$a,$m,$p,$; |fix_str(Str)]; -fix_str([C|Str]) when C > 255 -> - fix_str(Str); +%% fix_str([C|Str]) when C > 255 -> +%% fix_str(Str); fix_str([C|Str]) -> [C|fix_str(Str)]; fix_str([]) -> []. diff --git a/lib/wx/api_gen/wx_extra/wxPrintout.erl b/lib/wx/api_gen/wx_extra/wxPrintout.erl index be8f2e2fa5..1dfd86ec62 100644 --- a/lib/wx/api_gen/wx_extra/wxPrintout.erl +++ b/lib/wx/api_gen/wx_extra/wxPrintout.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2009. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. 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 @@ -40,7 +40,8 @@ new(Title, OnPrintPage) -> %%
OnBeginDocument(This,StartPage,EndPage) -> boolean()  
%%
OnEndDocument(This) -> term()  
%%
HasPage(This,Page)} -> boolean()   
-%%
GetPageInfo(This) -> {MinPage:.integer(), MaxPage::integer(), PageFrom::integer(), PageTo::integer()}  
+%%
GetPageInfo(This) -> {MinPage::integer(), MaxPage::integer(),
+%%                              PageFrom::integer(), PageTo::integer()}  
%% The This argument is the wxPrintout object reference to this object %%
NOTE: The callbacks may not call other processes. new(Title, OnPrintPage, Opts) when is_list(Title), is_function(OnPrintPage), is_list(Opts) -> -- cgit v1.2.3