ソースを参照

格式化 脚本添加

master
AICells 5年前
コミット
a64de2e2a5
6個のファイルの変更17行の追加18行の削除
  1. +10
    -10
      ebin/genProto.app
  2. +1
    -3
      src/protoCode.erl
  3. +3
    -4
      src/protoGen.erl
  4. +1
    -1
      test/genProto.bat
  5. +1
    -0
      test/genProto.sh
  6. +1
    -0
      test/remake.sh

+ 10
- 10
ebin/genProto.app ファイルの表示

@ -1,10 +1,10 @@
{application,genProto,
[{description,"An OTP library"},
{vsn,"0.1.0"},
{registered,[]},
{applications,[kernel,stdlib]},
{env,[]},
{modules,[protoCode,protoCode_bak,protoField,protoGen,
protoParse]},
{licenses,["Apache 2.0"]},
{links,[]}]}.
{application, genProto,
[{description, "An OTP library"},
{vsn, "0.1.0"},
{registered, []},
{applications, [kernel, stdlib]},
{env, []},
{modules, [protoCode, protoCode_bak, protoField, protoGen,
protoParse]},
{licenses, ["Apache 2.0"]},
{links, []}]}.

+ 1
- 3
src/protoCode.erl ファイルの表示

@ -1,8 +1,6 @@
-module(protoCode).
-compile([export_all, nowarn_unused_function, nowarn_export_all]).
-export([encode/1, decode/1, encodeRec/1, decodeBin/2]).
-define(min8, -128).
@ -114,7 +112,7 @@ deBoolList(N, MsgBin, RetList) ->
end.
deInt8List(0, MsgBin, RetList) ->
{RetList, MsgBin};
{lists:reverse(RetList), MsgBin};
deInt8List(N, MsgBin, RetList) ->
<<Int:8/big-signed, LeftBin/binary>> = MsgBin,
deInt8List(N - 1, LeftBin, [Int | RetList]).

+ 3
- 4
src/protoGen.erl ファイルの表示

@ -21,7 +21,6 @@ protoHrlHeader() ->
protoErlHeader() ->
"-module(protoMsg).\n\n
-compile([nowarn_unused_vars]).
-export([encode/1, decode/1, encodeRec/1, decodeBin/2]).
@ -135,7 +134,7 @@ deBoolList(N, MsgBin, RetList) ->
end.
deInt8List(0, MsgBin, RetList) ->
{RetList, MsgBin};
{lists:reverse(RetList), MsgBin};
deInt8List(N, MsgBin, RetList) ->
<<Int:8/big-signed, LeftBin/binary>> = MsgBin,
deInt8List(N - 1, LeftBin, [Int | RetList]).
@ -351,7 +350,7 @@ genDecodeBin({MsgName, MsgId, FieldList}, SortedSProtoList, IsForBin) ->
UseLeftBinStr2 = useIndexStr(pd_leftBin),
BoolStr = "\t<<Bool" ++ UseBoolStr ++ ":8/big-unsigned, LeftBin" ++ UseLeftBinStr2 ++ "/binary>> = LeftBin" ++ GetLeftBinStr2 ++ ",\n",
UseVStr = useIndexStr(pd_v),
VStr = "\tcase Bool" ++ UseBoolStr ++ " =:= 1 of\n\t\ttrue ->\n\t\t\tV" ++ UseVStr ++" = true;\n\t\t_ ->\n\t\t\tV" ++ UseVStr ++" = false\n\tend,\n",
VStr = "\tcase Bool" ++ UseBoolStr ++ " =:= 1 of\n\t\ttrue ->\n\t\t\tV" ++ UseVStr ++ " = true;\n\t\t_ ->\n\t\t\tV" ++ UseVStr ++ " = false\n\tend,\n",
{false, StrAcc ++ TemStr ++ BoolStr ++ VStr};
"int8" ->
TemStr =
@ -719,7 +718,7 @@ convertDir(ProtoDir, HrlDir, ErlDir) ->
EncodeStr = genEncodeRec(MsgInfo, false),
resetPd(),
DecodeStr = genDecodeBin(MsgInfo, SortedSProtoList, false),
{[EncodeStr |SubEncodeAcc], [DecodeStr | SubDecodeAcc]}
{[EncodeStr | SubEncodeAcc], [DecodeStr | SubDecodeAcc]}
end,
{MsgEncodeRecStr, MsgDecodeRecStr} = lists:foldl(FunSubRec, {["encodeRec(_) ->\n\t[].\n\n"], ["decodeRec(_, _) ->\n\t{{}, <<>>}.\n\n"]}, SortedSubRecList),

+ 1
- 1
test/genProto.bat ファイルの表示

@ -1 +1 @@
erl -pa ../ebin -s protoGen convertDir ../proto ./ ./
erl -pa ../ebin -s protoGen convert ../proto ./ ./

+ 1
- 0
test/genProto.sh ファイルの表示

@ -0,0 +1 @@
erl -pa ../ebin -s protoGen convert ../proto ./ ./

+ 1
- 0
test/remake.sh ファイルの表示

@ -0,0 +1 @@
erlc -W0 -o .

読み込み中…
キャンセル
保存