|
|
@ -32,6 +32,9 @@ |
|
|
|
, toUpperStr/1 |
|
|
|
, toBinary/1 |
|
|
|
, charsLen/1 |
|
|
|
, getOpt/3 |
|
|
|
, visualList/2 |
|
|
|
, visualBin/2 |
|
|
|
]). |
|
|
|
|
|
|
|
%% ********************************************** eFmt start *********************************************************** |
|
|
@ -216,10 +219,12 @@ writeBinary(Bin, D, BinAcc) -> |
|
|
|
%% **************************************************** ~w end ******************************************************* |
|
|
|
|
|
|
|
%% **************************************************** ~p start ******************************************************* |
|
|
|
writeList([], _Depth, _Width, _Encoding, _Strings) -> |
|
|
|
<<"[]">>; |
|
|
|
writeList(List, Depth, Width, Encoding, Strings) -> |
|
|
|
case Strings andalso visualList(List, Encoding) of |
|
|
|
true -> |
|
|
|
list_to_binary(List); |
|
|
|
<<"\"", (list_to_binary(List))/binary, "\"">>; |
|
|
|
_ -> |
|
|
|
writeList(List, Depth, Width, Encoding, Strings, 0, <<"[">>) |
|
|
|
end. |
|
|
@ -333,10 +338,12 @@ writeMapBody(I, Depth, Width, Encoding, Strings, SumLC, BinAcc) -> |
|
|
|
end |
|
|
|
end. |
|
|
|
|
|
|
|
writeBinary(<<>>, _Depth, _Width, _Encoding, _Strings) -> |
|
|
|
<<"<<>>">>; |
|
|
|
writeBinary(Bin, Depth, Width, Encoding, Strings) -> |
|
|
|
case Strings andalso visualBin(Bin, Encoding) of |
|
|
|
true -> |
|
|
|
<<"<<", Bin/binary, ">>">>; |
|
|
|
<<"<<\"", Bin/binary, "\">>">>; |
|
|
|
_ -> |
|
|
|
writeBinary(Bin, Depth, Width, Encoding, Strings, 0, <<"<<">>) |
|
|
|
end. |
|
|
@ -389,7 +396,7 @@ writeTerm(Term, _Depth, _Width, _Encoding, _Strings) when is_integer(Term) -> ?w |
|
|
|
writeTerm(Term, _Depth, _Width, Encoding, _Strings) when is_atom(Term) -> ?writeAtom(Term, Encoding); |
|
|
|
writeTerm(Term, Depth, Width, Encoding, Strings) when is_list(Term) -> writeList(Term, Depth, Width, Encoding, Strings); |
|
|
|
writeTerm(Term, Depth, Width, Encoding, Strings) when is_map(Term) -> writeMap(Term, Depth, Width, Encoding, Strings, 0, <<"#{">>); |
|
|
|
writeTerm(Term, Depth, Width, Encoding, Strings) when is_tuple(Term) -> writeTuple(Term, Depth, Width, Encoding, Strings, 1, 0, tuple_size(Term), <<"{">>); |
|
|
|
writeTerm(Term, Depth, Width, Encoding, Strings) when is_tuple(Term) -> writeTuple(Term, Depth, Width, Encoding, Strings, 1, tuple_size(Term), 0, <<"{">>); |
|
|
|
writeTerm(Term, Depth, Width, Encoding, Strings) when is_bitstring(Term) -> writeBinary(Term, Depth, Width, Encoding, Strings); |
|
|
|
writeTerm(Term, _Depth, _Width, _Encoding, _Strings) when is_pid(Term) -> ?writePid(Term); |
|
|
|
writeTerm(Term, _Depth, _Width, _Encoding, _Strings) when is_float(Term) -> ?writeFloat(Term); |
|
|
@ -556,7 +563,18 @@ buildSmall([], CharsLimit, P, S, W, Other, Acc) -> |
|
|
|
Acc; |
|
|
|
_ -> |
|
|
|
RemainChars = remainChars(CharsLimit, Other), |
|
|
|
buildLimited(Acc, P, NumOfLimited, RemainChars, 0, []) |
|
|
|
case buildLimited(Acc, P, NumOfLimited, RemainChars, 0, []) of |
|
|
|
[] -> |
|
|
|
[]; |
|
|
|
[_One] = Ret -> |
|
|
|
Ret; |
|
|
|
[One, Two] -> |
|
|
|
[Two, One]; |
|
|
|
[One, Two, Three] -> |
|
|
|
[Three, Two, One]; |
|
|
|
Ret -> |
|
|
|
lists:reverse(Ret) |
|
|
|
end |
|
|
|
end; |
|
|
|
buildSmall([OneCA | Cs], CharsLimit, P, S, W, Other, Acc) -> |
|
|
|
case OneCA of |
|
|
|