Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[PATCH] Add binpp.app.src. Cosmetic changes.

  • Loading branch information...
commit c44ed281ffe2b5da08d21e5b2f9a4d82516b55eb 1 parent 38db91b
@ates authored
View
1  .gitignore
@@ -1,4 +1,5 @@
.eunit
+ebin
deps
priv
*.o
View
6 ebin/binpp.app
@@ -1,6 +0,0 @@
-{application,binpp,
- [{description,"Erlang Binary Pretty Printer"},
- {vsn,"1"},
- {registered,[]},
- {applications,[kernel,stdlib]},
- {modules,[binpp]}]}.
View
6 src/binpp.app.src
@@ -0,0 +1,6 @@
+{application, binpp, [
+ {description, "Erlang Binary Pretty Printer"},
+ {vsn, "1"},
+ {registered, []},
+ {applications, [kernel, stdlib]}
+]}.
View
12 src/binpp.erl
@@ -42,22 +42,19 @@ convert(Bin) when is_binary(Bin) ->
format(Bin, Base) ->
{ok, Octets} = convert(Bin, Base),
- io:format("~p~n", [string:join(Octets, " ")]),
- ok.
+ io:format("~p~n", [string:join(Octets, " ")]).
-spec format(binary()) -> ok.
format(Bin) ->
- format(Bin, hex),
- ok.
+ format(Bin, hex).
-spec pprint(binary()) -> ok.
pprint(Bin) ->
{ok, Octets} = convert(Bin, hex),
Buckets = buckets(16, Octets),
- lists:foreach(fun print_bucket/1, Buckets),
- ok.
+ lists:foreach(fun print_bucket/1, Buckets).
pprint(Bin, Pos, Len) when Len =< size(Bin) ->
pprint(binary:part(Bin, Pos, Len));
@@ -83,7 +80,7 @@ from_str(Str, hex) when is_list(Str) ->
false when length(Str) rem 2 =:= 0 ->
buckets(2, Str)
end,
- list_to_binary([ list_to_integer(B,16) || B <- Bytes]).
+ list_to_binary([list_to_integer(B, 16) || B <- Bytes]).
-spec from_str(string()) -> binary().
@@ -161,4 +158,3 @@ buckets(N, N, M, [H|T], [A|Acc]) ->
buckets(1, N, M-1, T, [[], lists:reverse([H|A]) | Acc]);
buckets(X, N, M, [H|T], [A|Acc]) ->
buckets(X+1, N, M, T, [[H|A]|Acc]).
-
Please sign in to comment.
Something went wrong with that request. Please try again.