浏览代码

ft: eFmt import函数

master
SisMaker 4 年前
父节点
当前提交
87841773ba
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. +8
    -6
      src/eFmt.erl

+ 8
- 6
src/eFmt.erl 查看文件

@ -1,6 +1,8 @@
-module(eFmt). -module(eFmt).
-import(binary, [split/2, part/3]). -import(binary, [split/2, part/3]).
-import(lists, [keyfind/3, reverse/2]).
-import(maps, [iterator/1, next/1]).
-compile(inline). -compile(inline).
-compile({inline_size, 128}). -compile({inline_size, 128}).
@ -237,7 +239,7 @@ writeMap(Map, D, E, BinAcc) ->
D =:= 1 -> D =:= 1 ->
<<BinAcc/binary, "...}">>; <<BinAcc/binary, "...}">>;
true -> true ->
writeMapBody(maps:iterator(Map), D, E, BinAcc)
writeMapBody(iterator(Map), D, E, BinAcc)
end. end.
writeMapBody(I, D, E, BinAcc) -> writeMapBody(I, D, E, BinAcc) ->
@ -245,7 +247,7 @@ writeMapBody(I, D, E, BinAcc) ->
D =:= 1 -> D =:= 1 ->
<<BinAcc/binary, " ...}">>; <<BinAcc/binary, " ...}">>;
true -> true ->
case maps:next(I) of
case next(I) of
{K, V, none} -> {K, V, none} ->
KeyTermBin = writeTerm(K, -1, E), KeyTermBin = writeTerm(K, -1, E),
ValueTermBin = writeTerm(V, -1, E), ValueTermBin = writeTerm(V, -1, E),
@ -369,7 +371,7 @@ writeMap(Map, Depth, Width, Encoding, Strings, SumLC, BinAcc) ->
Depth =:= 1 -> Depth =:= 1 ->
<<BinAcc/binary, "...}">>; <<BinAcc/binary, "...}">>;
true -> true ->
writeMapBody(maps:iterator(Map), Depth, Width, Encoding, Strings, SumLC, BinAcc)
writeMapBody(iterator(Map), Depth, Width, Encoding, Strings, SumLC, BinAcc)
end. end.
writeMapBody(I, Depth, Width, Encoding, Strings, SumLC, BinAcc) -> writeMapBody(I, Depth, Width, Encoding, Strings, SumLC, BinAcc) ->
@ -377,7 +379,7 @@ writeMapBody(I, Depth, Width, Encoding, Strings, SumLC, BinAcc) ->
Depth =:= 1 -> Depth =:= 1 ->
<<BinAcc/binary, " ...}">>; <<BinAcc/binary, " ...}">>;
true -> true ->
case maps:next(I) of
case next(I) of
{K, V, none} -> {K, V, none} ->
KeyTermBin = writeTerm(K, -1, Width, Encoding, Strings), KeyTermBin = writeTerm(K, -1, Width, Encoding, Strings),
ValueTermBin = writeTerm(V, -1, Width, Encoding, Strings), ValueTermBin = writeTerm(V, -1, Width, Encoding, Strings),
@ -643,7 +645,7 @@ buildSmall([], CharsLimit, P, S, W, Other, Acc) ->
[One, Two, Three] -> [One, Two, Three] ->
[Three, Two, One]; [Three, Two, One];
Ret -> Ret ->
lists:reverse(Ret, [])
reverse(Ret, [])
end end
end; end;
buildSmall([OneCA | Cs], CharsLimit, P, S, W, Other, Acc) -> buildSmall([OneCA | Cs], CharsLimit, P, S, W, Other, Acc) ->
@ -1012,7 +1014,7 @@ charsLen(S) ->
end. end.
getOpt(Key, TupleList, Default) -> getOpt(Key, TupleList, Default) ->
case lists:keyfind(Key, 1, TupleList) of
case keyfind(Key, 1, TupleList) of
false -> false ->
Default; Default;
ValueTuple -> ValueTuple ->

正在加载...
取消
保存