Skip to content

Commit

Permalink
Change API function order
Browse files Browse the repository at this point in the history
  • Loading branch information
aerosol committed Oct 29, 2012
1 parent e0ca459 commit 7cc2ea1
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/binpp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,6 @@
% API %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

-spec convert(binary(), atom()) -> {ok, list()}.

convert(Bin, hex) when is_binary(Bin) orelse is_bitstring(Bin) ->
convert(Bin, [], fun hexstr/1);

convert(Bin, bin) when is_binary(Bin) orelse is_bitstring(Bin) ->
convert(Bin, [], fun binstr/1).

-spec convert(binary()) -> {ok, list()}.

convert(Bin) when is_binary(Bin) ->
convert(Bin, hex).

-spec format(binary(), atom()) -> ok.

format(Bin, Base) ->
{ok, Octets} = convert(Bin, Base),
io:format("~p~n", [string:join(Octets, " ")]).

-spec format(binary()) -> ok.

format(Bin) ->
format(Bin, hex).

-spec pprint(binary()) -> ok.

pprint(Bin) ->
Expand Down Expand Up @@ -96,6 +72,30 @@ from_str(Str, hex) when is_list(Str) ->
from_str(Str) when is_list(Str) ->
from_str(Str, hex).

-spec format(binary(), atom()) -> ok.

format(Bin, Base) ->
{ok, Octets} = convert(Bin, Base),
io:format("~p~n", [string:join(Octets, " ")]).

-spec format(binary()) -> ok.

format(Bin) ->
format(Bin, hex).

-spec convert(binary(), atom()) -> {ok, list()}.

convert(Bin, hex) when is_binary(Bin) orelse is_bitstring(Bin) ->
convert(Bin, [], fun hexstr/1);

convert(Bin, bin) when is_binary(Bin) orelse is_bitstring(Bin) ->
convert(Bin, [], fun binstr/1).

-spec convert(binary()) -> {ok, list()}.

convert(Bin) when is_binary(Bin) ->
convert(Bin, hex).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Core :) %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down

0 comments on commit 7cc2ea1

Please sign in to comment.