From 50e02aeabc0a7c3203d534340ff0354166cc7a6e Mon Sep 17 00:00:00 2001 From: Kosorukov Anatolii Date: Mon, 6 Jun 2022 18:42:45 +0200 Subject: [PATCH 1/8] Make improvements for documenation generation --- .gitignore | 10 ++++- Makefile | 12 ++++++ doc/img/logo.png | Bin 0 -> 9843 bytes doc/overview.edoc | 7 ++++ doc/style.css | 75 +++++++++++++++++++++++++++++++++++ rebar.config | 7 ++++ src/eiconv.erl | 99 +++++++++++++++++++++++++++++++--------------- src/iconv.erl | 32 ++++++++------- 8 files changed, 194 insertions(+), 48 deletions(-) create mode 100644 doc/img/logo.png create mode 100644 doc/overview.edoc create mode 100644 doc/style.css diff --git a/.gitignore b/.gitignore index 23f7e39..f733bd9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,12 @@ c_src/*.o .eunit/ _build c_src/eiconv_nif.d -rebar3 \ No newline at end of file +rebar3 +doc/* +!doc/style.css +!doc/overview.edoc +!doc/img +!doc/img/* +!doc/img/logo.png +.vscode +erl_crash.dump \ No newline at end of file diff --git a/Makefile b/Makefile index 9a3ebed..9f05460 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,18 @@ xref: $(REBAR) clean: $(REBAR) $(REBAR) clean + clean_doc + +clean_doc: + @rm -f doc/*.html + @rm -f doc/erlang.png + @rm -f doc/edoc-info + +edoc: $(REBAR) + $(REBAR) edoc + +edoc_private: $(REBAR) + $(REBAR) as edoc_private edoc ./rebar3: $(ERL) -noshell -s inets -s ssl \ diff --git a/doc/img/logo.png b/doc/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..94ea9de05137b897f08fbc6d773ccaeeb0ae042b GIT binary patch literal 9843 zcmb_?2|Sc*`+qA*(%~oBRnq58ksM1|>zqQwNtUv=QN-BCFi4IhDe;Q2wrH`8<%l6$ z_R3b-vJ(c`#!NAj!S8xzhN#~6od5sx^NhLYdG6nW2%d zX8#VacdZE*Iq1xD_=YeKkFs_UZvWo1f`UBjjtjovIPw0(r5HTz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4p1HTz6|4I_rsKJkzSJxD&9$?Y%ykMP#4r()R(GeCe?nOx+Ex(B zXfX2tPjnUK8tZD^kcdV08ZJDsJ!Tq&fs>HN7ts||KLSrDCY3|L=7oQpXNqx)fPsH zgN&j{hJy=vT*T5+0OX`bArnLQ6ZjZYSS(+ugBhPdnP9hU%mSvsDiWtH$T=k_~??>jN z6etf)mFmY?3@rHC1*235RRpV!ik|j9gMxh1za z#5uYSxW(>#+VNeN9CTfF9bjG6MSL}K^md%(z_&)t*XFK%+?j#KJNw8HLml*wjXKzV znmkg1;yXIb_xeC(fe0?j>B+m8s|iT5V%0`)z)sS=&e|YLJ}$G6VSdfHXf_H(=~7gn zHJT_=5piIAsFlVI0@|lR`P(3fei$@@W^l22411=7A6U)GzLk4RXZnu6-&5joITC(3 zK>IXkH?1 zAS^ez*CnM0=-TCK^1<&$2#T78f2s5)56do0NXx-5D|!?OwE0*w>`c|x-HunBKOT#k z>>MV?3t8xO4!gh}ui}fiymx~Yq0+k@-3~fGstNw@UFMT6AHhJlhoa&O>_U*md>?V^ zf{S;oW_MQ~u2R&*gdOHpR-y6()L() zo0?OIeM^OnVGgWkcxcMQ`H@{5S*m^bI@#9A+nx?S6*)QETU)N1n~AwN_`J&bvfZRL z$lOBA#ogys^FQ3lfoqT(kORJKM>*cg>k^3|RPP@Rr#PI&(O^dqoPyDx?12k6g z2d0LR+iu%?T$dl6yE$F|Cz>D${KD1VwHE9oyx8gJuG#tNc3!iHbGGtF8+1k8#Esal zUla>=I(le!j@`~{`)Nm~u(PXc1+23X2vwjAg1g}E__KA^=BJuLd->t#R}1Q>vsvvC TY{%yjg-H9T-tXy0tgrnqF_4I{ literal 0 HcmV?d00001 diff --git a/doc/overview.edoc b/doc/overview.edoc new file mode 100644 index 0000000..a12c5e9 --- /dev/null +++ b/doc/overview.edoc @@ -0,0 +1,7 @@ +@author Zotonic Team + [http://zotonic.com] +@title iconv NIF interface +@doc An Erlang wrapper for the character set conversion utility +[https://en.wikipedia.org/wiki/Iconv iconv]. +@copyright 2011, 2012, 2013 Maas-Maarten Zeeman, Apache-2.0 +@since 2011 \ No newline at end of file diff --git a/doc/style.css b/doc/style.css new file mode 100644 index 0000000..8015eb0 --- /dev/null +++ b/doc/style.css @@ -0,0 +1,75 @@ +/* standard EDoc style sheet */ +body { + font-family: Verdana, Arial, Helvetica, sans-serif; + margin-left: .25in; + margin-right: .2in; + margin-top: 0.2in; + margin-bottom: 0.2in; + color: #000000; + background-color: #ffffff; +} +h1,h2 { + margin-left: -0.2in; +} +div.navbar { + background-color: #add8e6; + padding: 0.2em; +} +h2.indextitle { + padding: 0.4em; + background-color: #add8e6; +} +h3.function,h3.typedecl { + background-color: #add8e6; + padding-left: 1em; +} +div.spec { + margin-left: 2em; + + background-color: #eeeeee; +} +a.module { + text-decoration:none +} +a.module:hover { + background-color: #eeeeee; +} +ul.definitions { + list-style-type: none; +} +ul.index { + list-style-type: none; + background-color: #eeeeee; +} + +/* + * Minor style tweaks + */ +ul { + list-style-type: square; +} +table { + border-collapse: collapse; +} +td { + padding: 3px; + vertical-align: middle; +} + +/* +Tune styles +*/ + +table[summary="navigation bar"] { + background-image: url('http://zotonic.com/lib/images/logo.png'); + background-repeat: no-repeat; + background-position: center; +} + +code, p>tt, a>tt { + font-size: 1.2em; +} + +p { + line-height: 1.5; +} diff --git a/rebar.config b/rebar.config index 3a8734d..8cbe0db 100644 --- a/rebar.config +++ b/rebar.config @@ -45,5 +45,12 @@ ] } ]} + ]}, + {edoc_private, [ + {edoc_opts, [{private, true}]} ]} ]}. + +{edoc_opts, [ + {preprocess, true}, {stylesheet, "style.css"} +]}. diff --git a/src/eiconv.erl b/src/eiconv.erl index 543b93c..9a02017 100644 --- a/src/eiconv.erl +++ b/src/eiconv.erl @@ -1,16 +1,37 @@ -% Copyright 2011, 2012, 2013 Maas-Maarten Zeeman -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. +%%% Copyright 2011, 2012, 2013 Maas-Maarten Zeeman +%%% +%%% Licensed under the Apache License, Version 2.0 (the "License"); +%%% you may not use this file except in compliance with the License. +%%% You may obtain a copy of the License at +%%% +%%% http://www.apache.org/licenses/LICENSE-2.0 +%%% +%%% Unless required by applicable law or agreed to in writing, software +%%% distributed under the License is distributed on an "AS IS" BASIS, +%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%%% See the License for the specific language governing permissions and +%%% limitations under the License. +%%% +%%% @author Maas-Maarten Zeeman +%%% @doc eiconv module. +%%% +%%%

There two type of APIs:

+%%%
    +%%%
  • Easy API one shot convert API: +%%%
      +%%%
    • {@link convert/2}
    • +%%%
    • {@link convert/3}
    • +%%%
    +%%%
  • +%%%
  • Old iconv compatible API: +%%%
      +%%%
    • {@link open/2}
    • +%%%
    • {@link conv/2}
    • +%%%
    • {@link conv/3}
    • +%%%
    • {@link close/1}
    • +%%%
    +%%%
  • +%%%
-module(eiconv). -author("Maas-Maarten Zeeman "). @@ -28,8 +49,9 @@ -on_load(init/0). -% @doc Load the nif -% +%% @private +%% @doc Load the NIF + init() -> NifName = "eiconv_nif", NifFileName = case code:priv_dir(eiconv) of @@ -39,29 +61,32 @@ init() -> ok = erlang:load_nif(NifFileName, 0). -% @doc Open a new encoder which can be used to convert text from FromCode into ToCode. -% +%% @doc Open a new encoder which can be used to convert text from `FromCode' into `ToCode'. + open(_ToCode, _FromCode) -> erlang:nif_error(nif_library_not_loaded). -% @doc Convert a chunk, returns {done, ConvertedBytes} } | {more, Converted} -% +%% @private +%% @doc Convert a chunk, returns `{done, ConvertedBytes} } | {more, Converted}' + chunk(_Cd, _Input) -> erlang:nif_error(nif_library_not_loaded). -% @doc Reset the cd structure, returns ok | {rest, LeftOverBytes} -% +%% @private +%% @doc Reset the cd structure, +%% @returns `ok | {rest, LeftOverBytes}' + finalize(_Cd) -> erlang:nif_error(nif_library_not_loaded). -% @doc Convert Input into the requested encoding. -% +%% @doc Convert Input into the requested encoding. + conv(Cd, Input) -> conv(Cd, Input, ?DEFAULT_CHUNK_SIZE). -% @doc Convert input. The input will first be split into -% chunks of ChunkSize before being converted by the nif. -% +%% @doc Convert input. The input will first be split into +%% chunks of `ChunkSize' before being converted by the nif. + conv(Cd, Input, ChunkSize) -> Chunks = split_input(ChunkSize, Input), case conv1(Cd, Chunks, []) of @@ -88,18 +113,28 @@ conv1(Cd, [H|T], Acc) -> conv1(Cd, T, [Result | Acc]) end. -% @doc Close the encoder - dummy function, close will be done by the garbage collector. -% +%% @doc Close the encoder - dummy function, close will be done by the garbage collector. + close(_Cd) -> ok. -% @doc Convert input FromEncoding to utf-8 -% +%% @doc Convert input `FromEncoding' to `utf-8' +%% @equiv convert(FromEncoding, "utf-8", Input) + +-spec convert(FromEncoding, Input) -> Result when + FromEncoding :: string(), + Input :: string(), + Result :: {ok, binary()}. convert(FromEncoding, Input) -> convert(FromEncoding, "utf-8", Input). -% @doc Convert input which is in FromEncoding to ToEncoding. -% +%% @doc Convert `Input' which is in `FromEncoding' to `ToEncoding'. + +-spec convert(FromEncoding, ToEncoding, Input) -> Result when + FromEncoding :: string(), + ToEncoding :: string(), + Input :: string(), + Result :: {ok, binary()}. convert(FromEncoding, ToEncoding, Input) -> case open(ToEncoding, FromEncoding) of {ok, Cd} -> diff --git a/src/iconv.erl b/src/iconv.erl index 1220470..d6b430e 100644 --- a/src/iconv.erl +++ b/src/iconv.erl @@ -1,18 +1,20 @@ -% Copyright 2011, 2012, 2013 Maas-Maarten Zeeman -% -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. -% You may obtain a copy of the License at -% -% http://www.apache.org/licenses/LICENSE-2.0 -% -% Unless required by applicable law or agreed to in writing, software -% distributed under the License is distributed on an "AS IS" BASIS, -% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -% See the License for the specific language governing permissions and -% limitations under the License. - -% drop in replacement module. +%%% Copyright 2011, 2012, 2013 Maas-Maarten Zeeman +%%% +%%% Licensed under the Apache License, Version 2.0 (the "License"); +%%% you may not use this file except in compliance with the License. +%%% You may obtain a copy of the License at +%%% +%%% http://www.apache.org/licenses/LICENSE-2.0 +%%% +%%% Unless required by applicable law or agreed to in writing, software +%%% distributed under the License is distributed on an "AS IS" BASIS, +%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%%% See the License for the specific language governing permissions and +%%% limitations under the License. +%%% +%%% @author Maas-Maarten Zeeman +%%% @doc drop in replacement module. +%%% -module(iconv). -author("Maas-Maarten Zeeman "). From 2c6d1870f9972dd99b5e861240768684fbd3e5a3 Mon Sep 17 00:00:00 2001 From: Kosorukov Anatolii Date: Mon, 6 Jun 2022 19:04:07 +0200 Subject: [PATCH 2/8] Update badge list --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 472505b..f4fa0fc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ -# Erlang NIF wrapper for iconv +[![Build Status][gh badge]][gh] +[![Hex.pm version][hexpm version]][hexpm] +[![Hex.pm Downloads][hexpm downloads]][hexpm] +[![Hex.pm Documentation][hexdocs documentation]][hexdocs] +[![Erlang Versions][erlang version badge]][gh] +[![License][license]](https://www.apache.org/licenses/LICENSE-2.0) -![Test](https://github.com/zotonic/eiconv/workflows/Test/badge.svg) -[![Hex pm](http://img.shields.io/hexpm/v/eiconv.svg?style=flat)](https://hex.pm/packages/eiconv) +# Erlang NIF wrapper for iconv An Erlang wrapper for the character set conversion utility [iconv](https://en.wikipedia.org/wiki/Iconv). @@ -63,3 +67,14 @@ Wrapper provided by Maas-Maarten Zeeman and the [Zotonic](https://github.com/zot * [Maas-Maarten Zeeman](https://github.com/mmzeeman) * [Arjan Scherpenisse](https://github.com/arjan) * [Marc Worrell](https://github.com/mworrell) + + +[hexpm]: https://hex.pm/packages/eiconv +[hexpm version]: https://img.shields.io/hexpm/v/eiconv.svg?style=flat-curcle "Hex version" +[hexpm downloads]: https://img.shields.io/hexpm/dt/eiconv.svg?style=flat-curcle +[hexdocs documentation]: https://img.shields.io/badge/hex-docs-purple.svg?style=flat-curcle +[hexdocs]: https://hexdocs.pm/eiconv +[gh]: https://github.com/zotonic/eiconv/actions/workflows/test.yaml +[gh badge]: https://github.com/zotonic/eiconv/workflows/Test/badge.svg +[erlang version badge]: https://img.shields.io/badge/Supported%20Erlang%2FOTP-19%20to%2023-blue.svg?style=flat-curcle +[license]: https://img.shields.io/badge/License-Apache_2.0-blue.svg?logo=apache&logoColor=red "Apache 2.0" \ No newline at end of file From 1f2680c6d814af903142e4c7262e3113137f8a73 Mon Sep 17 00:00:00 2001 From: Anatolii Kosorukov Date: Mon, 6 Jun 2022 23:26:39 +0300 Subject: [PATCH 3/8] Fix Makefile clean_doc target position --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9f05460..8b6e23d 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,8 @@ dialyzer: $(REBAR) xref: $(REBAR) $(REBAR) as test xref -clean: $(REBAR) +clean: $(REBAR) clean_doc $(REBAR) clean - clean_doc clean_doc: @rm -f doc/*.html From 91e9f9a5445f2c0fb172ee6b451a260ffeb2e08e Mon Sep 17 00:00:00 2001 From: Anatolii Kosorukov Date: Thu, 9 Jun 2022 09:55:34 +0300 Subject: [PATCH 4/8] Make changes while review --- .gitignore | 5 +---- doc/img/logo.png | Bin 9843 -> 0 bytes 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 doc/img/logo.png diff --git a/.gitignore b/.gitignore index f733bd9..a4cc5f8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,5 @@ rebar3 doc/* !doc/style.css !doc/overview.edoc -!doc/img -!doc/img/* -!doc/img/logo.png .vscode -erl_crash.dump \ No newline at end of file +erl_crash.dump diff --git a/doc/img/logo.png b/doc/img/logo.png deleted file mode 100644 index 94ea9de05137b897f08fbc6d773ccaeeb0ae042b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9843 zcmb_?2|Sc*`+qA*(%~oBRnq58ksM1|>zqQwNtUv=QN-BCFi4IhDe;Q2wrH`8<%l6$ z_R3b-vJ(c`#!NAj!S8xzhN#~6od5sx^NhLYdG6nW2%d zX8#VacdZE*Iq1xD_=YeKkFs_UZvWo1f`UBjjtjovIPw0(r5HTzt;SXTUypC_cZ~7( zKQ!~NNb`FG;f2TV4RnQz=-j@5dFQI`u7^)KloL1S ziVqrNGn?R*dis;m-Y$696x!~&s;9WPBQ12{YjngEQ=0jx(*I&iGx{6$s?Pk?s@Dk>=2nE zc5QDp4l2x3=_MN^hQzD!AM%lQ`)WS?Isfg5YgXgXxu*@4dW;TbA8C)T=H{PVos%0X zAFJ_4E$#&BC342E=0CJn+Kuhoh3^d#rF48O%|)Hu-CxF{g9-`qHaUuCZ4G5(nhe3p z?;LpUIBSHPwdBLYDw0y#M2(-LtIVy$TpoAX_SH+{3216{tQmbg)+{csdypz*aoehA zfcoXcQZwm7_loLoEf6k&?l02S8R&z)MKx2SaN^Iq2pMSF^cU%chA+}RMehbDyE{LM zp&a`NgfpI~s3B#a?)Gh2FO<)s4P_HpCNB@4#lbc>VbN;nUYD2BCStUAQZFw{ZD3?r z*3~|Ca^5;Z-N!wk2Xi)l!SiD1`6%OqU&r=nCR+3jXG;nDcmzIbNO$_&#&=t-pzNKF zlyK4W|J0;H-LNW7JA`%` zd+Z+DBy~L^Mth$Gg!JMZ(qecULR?EeBISvC`tW8+H;<~qe6<1G`+h4&$0?Im1uBs; ziv99&PYJ2%fR!gUxM820r{{z6a!wIZ%V84fNNf;)yGr3(Vqc&Fx6E^l=YzU(P6tub zOO&_JwY6R4`CH-x=z^;*ExR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Dx?12k6g z2d0LR+iu%?T$dl6yE$F|Cz>D${KD1VwHE9oyx8gJuG#tNc3!iHbGGtF8+1k8#Esal zUla>=I(le!j@`~{`)Nm~u(PXc1+23X2vwjAg1g}E__KA^=BJuLd->t#R}1Q>vsvvC TY{%yjg-H9T-tXy0tgrnqF_4I{ From 7f1a427bb1785ff55a9a3ff4fa980e57448f17ab Mon Sep 17 00:00:00 2001 From: Anatolii Kosorukov Date: Fri, 10 Jun 2022 13:55:23 +0300 Subject: [PATCH 5/8] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 373ddbd..2cdfce7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: - otp_version: [19.3,20,21,22,23] + otp_version: [22,23,24,25] os: [ubuntu-latest] container: From 1a1757b6be53800f6e64e4ec34229a0f6da396ef Mon Sep 17 00:00:00 2001 From: Anatolii Kosorukov Date: Fri, 10 Jun 2022 13:57:54 +0300 Subject: [PATCH 6/8] Update REAMDE.md Update supported OTP version information. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f4fa0fc..3e7a66f 100644 --- a/README.md +++ b/README.md @@ -76,5 +76,5 @@ Wrapper provided by Maas-Maarten Zeeman and the [Zotonic](https://github.com/zot [hexdocs]: https://hexdocs.pm/eiconv [gh]: https://github.com/zotonic/eiconv/actions/workflows/test.yaml [gh badge]: https://github.com/zotonic/eiconv/workflows/Test/badge.svg -[erlang version badge]: https://img.shields.io/badge/Supported%20Erlang%2FOTP-19%20to%2023-blue.svg?style=flat-curcle -[license]: https://img.shields.io/badge/License-Apache_2.0-blue.svg?logo=apache&logoColor=red "Apache 2.0" \ No newline at end of file +[erlang version badge]: https://img.shields.io/badge/Supported%20Erlang%2FOTP-22%20to%2025-blue.svg?style=flat-curcle +[license]: https://img.shields.io/badge/License-Apache_2.0-blue.svg?logo=apache&logoColor=red "Apache 2.0" From f6d25b3e1793ff76f3be3be2262f1c2899c342db Mon Sep 17 00:00:00 2001 From: Kosorukov Anatolii Date: Fri, 10 Jun 2022 13:37:15 +0200 Subject: [PATCH 7/8] Tune separator into Makefile. Line 33. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8b6e23d..adb2652 100644 --- a/Makefile +++ b/Makefile @@ -30,10 +30,10 @@ clean_doc: @rm -f doc/edoc-info edoc: $(REBAR) - $(REBAR) edoc + $(REBAR) edoc edoc_private: $(REBAR) - $(REBAR) as edoc_private edoc + $(REBAR) as edoc_private edoc ./rebar3: $(ERL) -noshell -s inets -s ssl \ From a1909bf3e60901b1c7fcdf5712d4d0afc58e6db9 Mon Sep 17 00:00:00 2001 From: Kosorukov Anatolii Date: Fri, 10 Jun 2022 13:46:51 +0200 Subject: [PATCH 8/8] Fix -spec issue --- src/eiconv.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/eiconv.erl b/src/eiconv.erl index 9a02017..c9a4ec2 100644 --- a/src/eiconv.erl +++ b/src/eiconv.erl @@ -124,7 +124,8 @@ close(_Cd) -> -spec convert(FromEncoding, Input) -> Result when FromEncoding :: string(), Input :: string(), - Result :: {ok, binary()}. + Result :: {ok, binary()} | {error, Error}, + Error :: term(). convert(FromEncoding, Input) -> convert(FromEncoding, "utf-8", Input). @@ -134,7 +135,8 @@ convert(FromEncoding, Input) -> FromEncoding :: string(), ToEncoding :: string(), Input :: string(), - Result :: {ok, binary()}. + Result :: {ok, binary()} | {error, Error}, + Error :: term(). convert(FromEncoding, ToEncoding, Input) -> case open(ToEncoding, FromEncoding) of {ok, Cd} ->