|
@ -145,7 +145,7 @@ build([], Acc, MaxLen, _O) -> |
|
|
|
|
|
|
|
|
build2([{C,As,F,Ad,P,Pad,Enc}|Cs], Count, MaxLen) -> |
|
|
build2([{C,As,F,Ad,P,Pad,Enc}|Cs], Count, MaxLen) -> |
|
|
{S, Len} = control2(C, As, F, Ad, P, Pad, Enc, MaxLen div Count), |
|
|
{S, Len} = control2(C, As, F, Ad, P, Pad, Enc, MaxLen div Count), |
|
|
[S|build2(Cs, Count - 1, MaxLen - abs(Len))]; |
|
|
|
|
|
|
|
|
[S|build2(Cs, Count - 1, MaxLen - Len)]; |
|
|
build2([C|Cs], Count, MaxLen) -> |
|
|
build2([C|Cs], Count, MaxLen) -> |
|
|
[C|build2(Cs, Count, MaxLen)]; |
|
|
[C|build2(Cs, Count, MaxLen)]; |
|
|
build2([], _, _) -> []. |
|
|
build2([], _, _) -> []. |
|
@ -221,27 +221,27 @@ control(C, A, F, Adj, P, Pad, Enc, L) -> |
|
|
control2($w, [A], F, Adj, P, Pad, _Enc, L) -> |
|
|
control2($w, [A], F, Adj, P, Pad, _Enc, L) -> |
|
|
Term = lager_trunc_io:fprint(A, L, [{lists_as_strings, false}]), |
|
|
Term = lager_trunc_io:fprint(A, L, [{lists_as_strings, false}]), |
|
|
Res = term(Term, F, Adj, P, Pad), |
|
|
Res = term(Term, F, Adj, P, Pad), |
|
|
{Res, L - lists:flatlength(Res)}; |
|
|
|
|
|
|
|
|
{Res, lists:flatlength(Res)}; |
|
|
control2($p, [A], F, Adj, P, Pad, _Enc, L) -> |
|
|
control2($p, [A], F, Adj, P, Pad, _Enc, L) -> |
|
|
Term = lager_trunc_io:fprint(A, L, [{lists_as_strings, true}]), |
|
|
Term = lager_trunc_io:fprint(A, L, [{lists_as_strings, true}]), |
|
|
Res = term(Term, F, Adj, P, Pad), |
|
|
Res = term(Term, F, Adj, P, Pad), |
|
|
{Res, L - lists:flatlength(Res)}; |
|
|
|
|
|
|
|
|
{Res, lists:flatlength(Res)}; |
|
|
control2($W, [A,Depth], F, Adj, P, Pad, _Enc, L) when is_integer(Depth) -> |
|
|
control2($W, [A,Depth], F, Adj, P, Pad, _Enc, L) when is_integer(Depth) -> |
|
|
Term = lager_trunc_io:fprint(A, L, [{depth, Depth}, {lists_as_strings, false}]), |
|
|
Term = lager_trunc_io:fprint(A, L, [{depth, Depth}, {lists_as_strings, false}]), |
|
|
Res = term(Term, F, Adj, P, Pad), |
|
|
Res = term(Term, F, Adj, P, Pad), |
|
|
{Res, L - lists:flatlength(Res)}; |
|
|
|
|
|
|
|
|
{Res, lists:flatlength(Res)}; |
|
|
control2($P, [A,Depth], F, Adj, P, Pad, _Enc, L) when is_integer(Depth) -> |
|
|
control2($P, [A,Depth], F, Adj, P, Pad, _Enc, L) when is_integer(Depth) -> |
|
|
Term = lager_trunc_io:fprint(A, L, [{depth, Depth}, {lists_as_strings, true}]), |
|
|
Term = lager_trunc_io:fprint(A, L, [{depth, Depth}, {lists_as_strings, true}]), |
|
|
Res = term(Term, F, Adj, P, Pad), |
|
|
Res = term(Term, F, Adj, P, Pad), |
|
|
{Res, L - lists:flatlength(Res)}; |
|
|
|
|
|
|
|
|
{Res, lists:flatlength(Res)}; |
|
|
control2($s, [L0], F, Adj, P, Pad, latin1, L) -> |
|
|
control2($s, [L0], F, Adj, P, Pad, latin1, L) -> |
|
|
List = lager_trunc_io:fprint(maybe_flatten(L0), L, [{force_strings, true}]), |
|
|
List = lager_trunc_io:fprint(maybe_flatten(L0), L, [{force_strings, true}]), |
|
|
Res = string(List, F, Adj, P, Pad), |
|
|
Res = string(List, F, Adj, P, Pad), |
|
|
{Res, L - lists:flatlength(Res)}; |
|
|
|
|
|
|
|
|
{Res, lists:flatlength(Res)}; |
|
|
control2($s, [L0], F, Adj, P, Pad, unicode, L) -> |
|
|
control2($s, [L0], F, Adj, P, Pad, unicode, L) -> |
|
|
List = lager_trunc_io:fprint(unicode:characters_to_list(L0), L, [{force_strings, true}]), |
|
|
List = lager_trunc_io:fprint(unicode:characters_to_list(L0), L, [{force_strings, true}]), |
|
|
Res = uniconv(string(List, F, Adj, P, Pad)), |
|
|
Res = uniconv(string(List, F, Adj, P, Pad)), |
|
|
{Res, L - lists:flatlength(Res)}. |
|
|
|
|
|
|
|
|
{Res, lists:flatlength(Res)}. |
|
|
|
|
|
|
|
|
maybe_flatten(X) when is_list(X) -> |
|
|
maybe_flatten(X) when is_list(X) -> |
|
|
lists:flatten(X); |
|
|
lists:flatten(X); |
|
|