|
|
@ -83,7 +83,9 @@ format(Format, Args, Options) -> |
|
|
|
|
|
|
|
-spec formatBin(Format :: format(), Data :: [term()]) -> chars(). |
|
|
|
formatBin(Format, Args) -> |
|
|
|
try iolist_to_binary(fWrite(Format, Args)) |
|
|
|
try fWrite(Format, Args) of |
|
|
|
Ret -> |
|
|
|
iolist_to_binary(Ret) |
|
|
|
catch |
|
|
|
_C:_R -> |
|
|
|
erlang:error(badarg, [Format, Args, _C, _R]) |
|
|
@ -91,7 +93,9 @@ formatBin(Format, Args) -> |
|
|
|
|
|
|
|
-spec formatBin(Format :: format(), Data :: [term()], Options :: [{charsLimit, CharsLimit :: charsLimit()}]) -> chars(). |
|
|
|
formatBin(Format, Args, Options) -> |
|
|
|
try iolist_to_binary(fWrite(Format, Args, Options)) |
|
|
|
try fWrite(Format, Args, Options) of |
|
|
|
Ret -> |
|
|
|
iolist_to_binary(Ret) |
|
|
|
catch |
|
|
|
_C:_R -> |
|
|
|
erlang:error(badarg, [Format, Args]) |
|
|
@ -494,7 +498,7 @@ writeTerm(Term, _Depth, _Width, _Encoding, _Strings) when is_function(Term) -> ? |
|
|
|
fWrite(Format, Args) -> |
|
|
|
fBuild(fScan(Format, Args), []). |
|
|
|
|
|
|
|
-spec fWrite(Format :: format(), Data :: [term()], Options :: [{'chars_limit', CharsLimit :: integer()}]) -> chars(). |
|
|
|
-spec fWrite(Format :: format(), Data :: [term()], Options :: [{charsLimit, CharsLimit :: integer()}]) -> chars(). |
|
|
|
fWrite(Format, Args, Options) -> |
|
|
|
fBuild(fScan(Format, Args), Options). |
|
|
|
|
|
|
@ -634,9 +638,9 @@ doCollCA(LPart, Args, Width, Adjust, Precision, PadChar, Encoding, Strings, Acc) |
|
|
|
fBuild(Cs) -> |
|
|
|
fBuild(Cs, []). |
|
|
|
|
|
|
|
-spec fBuild(FormatList :: [char() | fmtSpec()], Options :: [{'chars_limit', CharsLimit :: integer()}]) -> chars(). |
|
|
|
-spec fBuild(FormatList :: [char() | fmtSpec()], Options :: [{charsLimit, CharsLimit :: integer()}]) -> chars(). |
|
|
|
fBuild(Cs, Options) -> |
|
|
|
CharsLimit = getOpt(chars_limit, Options, -1), |
|
|
|
CharsLimit = getOpt(charsLimit, Options, -1), |
|
|
|
buildSmall(Cs, CharsLimit, 0, 0, 0, 0, []). |
|
|
|
|
|
|
|
buildSmall([], CharsLimit, P, S, W, Other, Acc) -> |
|
|
@ -1077,8 +1081,7 @@ visualUtf8Char($\v, _) -> true; |
|
|
|
visualUtf8Char($\b, _) -> true; |
|
|
|
visualUtf8Char($\f, _) -> true; |
|
|
|
visualUtf8Char($\e, _) -> true; |
|
|
|
visualUtf8Char(C, _Encoding) -> |
|
|
|
C >= $\s andalso C =< $~ orelse C >= 16#A0 andalso C < 16#D800 orelse C > 16#DFFF andalso C < 16#FFFE orelse C > 16#FFFF andalso C =< 16#10FFFF. |
|
|
|
visualUtf8Char(C, _Encoding) -> C >= $\s andalso C =< $~ orelse C >= 16#A0 andalso C < 16#D800 orelse C > 16#DFFF andalso C < 16#FFFE orelse C > 16#FFFF andalso C =< 16#10FFFF. |
|
|
|
%% case Encoding of |
|
|
|
%% latin1 -> |
|
|
|
%% C >= $\s andalso C =< $~ orelse C >= 16#A0 andalso C =< 16#FF; |
|
|
|