-module(protoMsg). -compile([nowarn_unused_vars]). -export([encodeIol/1, encodeBin/1, encodeIol/2, subEncode/1, subEncode/2, decode/1, decodeBin/2, getMsgName/1]). -define(min8, -128). -define(max8, 127). -define(min16, -32768). -define(max16, 32767). -define(min32, -2147483648). -define(max32, 2147483647). -define(min64, -9223372036854775808). -define(max64, 9223372036854775807). -define(minF32, 1.175494351E-38). -define(maxF32, 3.402823466E+38). -define(minF64, 2.2250738585072014E-308). -define(maxF64, 1.7976931348623158E+308). -define(int8(V), <>). -define(uint8(V), <>). -define(int16(V), <>). -define(uint16(V), <>). -define(int32(V), <>). -define(uint32(V), <>). -define(int64(V), <>). -define(uint64(V), <>). -define(integer(V), (integer(V))). -define(number(V), (number(V))). -define(string(V), (string(V))). -define(float(V), <>). -define(double(V), <>). -define(bool(V), (case V of true -> <<1:8>>; _ -> <<0:8>> end)). -define(record(V), (case V of undefined -> [<<0:8>>]; V -> [<<1:8>>, subEncode(V)] end)). -define(list_bool(List), [<<(length(List)):16/big>>, [?bool(V) || V <- List]]). -define(list_int8(List), [<<(length(List)):16/big>>, [?int8(V) || V <- List]]). -define(list_uint8(List), [<<(length(List)):16/big>>, [?uint8(V) || V <- List]]). -define(list_int16(List), [<<(length(List)):16/big>>, [?int16(V) || V <- List]]). -define(list_uint16(List), [<<(length(List)):16/big>>, [?uint16(V) || V <- List]]). -define(list_int32(List), [<<(length(List)):16/big>>, [?int32(V) || V <- List]]). -define(list_uint32(List), [<<(length(List)):16/big>>, [?uint32(V) || V <- List]]). -define(list_int64(List), [<<(length(List)):16/big>>, [?int64(V) || V <- List]]). -define(list_uint64(List), [<<(length(List)):16/big>>, [?uint64(V) || V <- List]]). -define(list_float(List), [<<(length(List)):16/big>>, [?float(V) || V <- List]]). -define(list_double(List), [<<(length(List)):16/big>>, [?double(V) || V <- List]]). -define(list_integer(List), [<<(length(List)):16/big>>, [integer(V) || V <- List]]). -define(list_number(List), [<<(length(List)):16/big>>, [number(V) || V <- List]]). -define(list_string(List), [<<(length(List)):16/big>>, [string(V) || V <- List]]). -define(list_record(List), [<<(length(List)):16/big>>, [subEncode(V) || V <- List]]). -define(BinaryShareSize, 65). -define(BinaryCopyRatio, 1.2). integer(V) -> if V >= ?min8 andalso V =< ?max8 -> <<8:8, <>/binary>>; V >= ?min16 andalso V =< ?max16 -> <<16:8, <>/binary>>; V >= ?min32 andalso V =< ?max32 -> <<32:8, <>/binary>>; V >= ?min64 andalso V =< ?max64 -> <<64:8, <>/binary>>; true -> throw(exceeded_the_integer) end. number(V) -> if erlang:is_integer(V) -> if V >= ?min8 andalso V =< ?max8 -> <<8:8, <>/binary>>; V >= ?min16 andalso V =< ?max16 -> <<16:8, <>/binary>>; V >= ?min32 andalso V =< ?max32 -> <<32:8, <>/binary>>; V >= ?min64 andalso V =< ?max64 -> <<64:8, <>/binary>>; true -> throw(exceeded_the_integer) end; erlang:is_float(V) -> if V >= ?minF32 andalso V =< ?maxF32 -> <<33:8, <>/binary>>; V >= ?minF64 andalso V =< ?maxF64 -> <<65:8, <>/binary>>; true -> throw(exceeded_the_float) end; true -> throw(is_not_number) end. string(Str) when is_binary(Str) -> [<<(byte_size(Str)):16/big>>, Str]; string(Str) -> Str2 = unicode:characters_to_binary(Str, utf8), [<<(byte_size(Str2)):16/big>>, Str2]. decode(Bin) -> <> = Bin, decodeBin(MsgId, MsgBin). deIntegerList(0, MsgBin, RetList) -> {lists:reverse(RetList), MsgBin}; deIntegerList(N, MsgBin, RetList) -> <> = MsgBin, deIntegerList(N - 1, LeftBin, [Int | RetList]). deNumberList(0, MsgBin, RetList) -> {lists:reverse(RetList), MsgBin}; deNumberList(N, MsgBin, RetList) -> <> = MsgBin, case NumBits of 33 -> <> = NumBin, deNumberList(N - 1, LeftBin, [Float | RetList]); 65 -> <> = NumBin, deNumberList(N - 1, LeftBin, [Float | RetList]); _ -> <> = NumBin, deNumberList(N - 1, LeftBin, [Int | RetList]) end. deStringList(0, MsgBin, _RefSize, RetList) -> {lists:reverse(RetList), MsgBin}; deStringList(N, MsgBin, RefSize, RetList) -> <> = MsgBin, case Len < ?BinaryShareSize of true -> deStringList(N - 1, LeftBin, RefSize, [StrBin | RetList]); _ -> case RefSize / Len > ?BinaryCopyRatio of true -> StrBinCopy = binary:copy(StrBin), deStringList(N - 1, LeftBin, RefSize, [StrBinCopy | RetList]); _ -> deStringList(N - 1, LeftBin, RefSize, [StrBin | RetList]) end end. deRecordList(0, _MsgId, MsgBin, RetList) -> {lists:reverse(RetList), MsgBin}; deRecordList(N, MsgId, MsgBin, RetList) -> {Tuple, LeftBin} = decodeRec(MsgId, MsgBin), deRecordList(N - 1, MsgId, LeftBin, [Tuple | RetList]). encodeIol(RecMsg) -> encodeIol(erlang:element(1, RecMsg), RecMsg). encodeBin(RecMsg) -> erlang:iolist_to_binary(encodeIol(RecMsg)). subEncode(RecMsg) -> subEncode(erlang:element(1, RecMsg), RecMsg). subEncode(test, {_, V1}) -> [?string(V1)]; subEncode(phoneNumber, {_, V1, V2}) -> [?record(V1), ?int32(V2)]; subEncode(person, {_, V1, V2, V3, V4}) -> [?string(V1), ?int32(V2), ?string(V3), ?list_record(V4)]; subEncode(union, {_, V1, V2}) -> [?string(V1), ?int32(V2)]; subEncode(_, _) -> []. encodeIol(test, {_, V1}) -> [<<1:16/big-unsigned>>, ?string(V1)]; encodeIol(phoneNumber, {_, V1, V2}) -> [<<2:16/big-unsigned>>, ?record(V1), ?int32(V2)]; encodeIol(person, {_, V1, V2, V3, V4}) -> [<<3:16/big-unsigned>>, ?string(V1), ?int32(V2), ?string(V3), ?list_record(V4)]; encodeIol(addressBook, {_, V1, V2}) -> [<<4:16/big-unsigned>>, ?list_record(V1), ?list_record(V2)]; encodeIol(union, {_, V1, V2}) -> [<<5:16/big-unsigned>>, ?string(V1), ?int32(V2)]; encodeIol(tbool, {_, V1}) -> [<<6:16/big-unsigned>>, ?bool(V1)]; encodeIol(tint8, {_, V1, V2}) -> [<<7:16/big-unsigned>>, ?int8(V1), ?int8(V2)]; encodeIol(tuint8, {_, V1, V2}) -> [<<8:16/big-unsigned>>, ?uint8(V1), ?uint8(V2)]; encodeIol(tint16, {_, V1, V2}) -> [<<9:16/big-unsigned>>, ?int16(V1), ?int16(V2)]; encodeIol(tuint16, {_, V1, V2}) -> [<<10:16/big-unsigned>>, ?uint16(V1), ?uint16(V2)]; encodeIol(tint32, {_, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10}) -> [<<11:16/big-unsigned>>, ?int32(V1), ?int32(V2), ?int32(V3), ?int32(V4), ?int32(V5), ?int32(V6), ?int32(V7), ?int32(V8), ?int32(V9), ?int32(V10)]; encodeIol(tuint32, {_, V1, V2}) -> [<<12:16/big-unsigned>>, ?uint32(V1), ?uint32(V2)]; encodeIol(tint64, {_, V1, V2}) -> [<<13:16/big-unsigned>>, ?int64(V1), ?int64(V2)]; encodeIol(tuint64, {_, V1, V2}) -> [<<14:16/big-unsigned>>, ?uint64(V1), ?uint64(V2)]; encodeIol(tinteger, {_, V1, V2, V3, V4, V5, V6, V7, V8}) -> [<<15:16/big-unsigned>>, ?integer(V1), ?integer(V2), ?integer(V3), ?integer(V4), ?integer(V5), ?integer(V6), ?integer(V7), ?integer(V8)]; encodeIol(tnumber, {_, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10}) -> [<<16:16/big-unsigned>>, ?number(V1), ?number(V2), ?number(V3), ?number(V4), ?number(V5), ?number(V6), ?number(V7), ?number(V8), ?number(V9), ?number(V10)]; encodeIol(tfloat, {_, V1, V2}) -> [<<17:16/big-unsigned>>, ?float(V1), ?float(V2)]; encodeIol(tdouble, {_, V1, V2}) -> [<<18:16/big-unsigned>>, ?double(V1), ?double(V2)]; encodeIol(tstring, {_, V1, V2}) -> [<<19:16/big-unsigned>>, ?string(V1), ?string(V2)]; encodeIol(tlistbool, {_, V1}) -> [<<20:16/big-unsigned>>, ?list_bool(V1)]; encodeIol(tlistint8, {_, V1}) -> [<<21:16/big-unsigned>>, ?list_int8(V1)]; encodeIol(tlistuint8, {_, V1}) -> [<<22:16/big-unsigned>>, ?list_uint8(V1)]; encodeIol(tlistint16, {_, V1}) -> [<<23:16/big-unsigned>>, ?list_int16(V1)]; encodeIol(tlistuint16, {_, V1}) -> [<<24:16/big-unsigned>>, ?list_uint16(V1)]; encodeIol(tlistint32, {_, V1}) -> [<<25:16/big-unsigned>>, ?list_int32(V1)]; encodeIol(tlistuint32, {_, V1}) -> [<<26:16/big-unsigned>>, ?list_uint32(V1)]; encodeIol(tlistint64, {_, V1}) -> [<<27:16/big-unsigned>>, ?list_int64(V1)]; encodeIol(tlistuint64, {_, V1}) -> [<<28:16/big-unsigned>>, ?list_uint64(V1)]; encodeIol(tlistinteger, {_, V1}) -> [<<29:16/big-unsigned>>, ?list_integer(V1)]; encodeIol(tlistnumber, {_, V1}) -> [<<30:16/big-unsigned>>, ?list_number(V1)]; encodeIol(tlistfloat, {_, V1}) -> [<<31:16/big-unsigned>>, ?list_float(V1)]; encodeIol(tlistdouble, {_, V1}) -> [<<32:16/big-unsigned>>, ?list_double(V1)]; encodeIol(tliststring, {_, V1}) -> [<<33:16/big-unsigned>>, ?list_string(V1)]; encodeIol(tlistunion, {_, V1}) -> [<<34:16/big-unsigned>>, ?list_record(V1)]; encodeIol(allType, {_, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27, V28, V29, V30, V31, V32, V33, V34, V35, V36, V37, V38, V39, V40, V41, V42, V43, V44, V45, V46, V47, V48, V49, V50, V51, V52, V53, V54, V55}) -> [<<35:16/big-unsigned>>, ?bool(V1), ?int8(V2), ?uint8(V3), ?int16(V4), ?uint16(V5), ?int32(V6), ?uint32(V7), ?int64(V8), ?uint64(V9), ?integer(V10), ?integer(V11), ?integer(V12), ?integer(V13), ?integer(V14), ?integer(V15), ?integer(V16), ?integer(V17), ?number(V18), ?number(V19), ?number(V20), ?number(V21), ?number(V22), ?number(V23), ?number(V24), ?number(V25), ?number(V26), ?number(V27), ?float(V28), ?double(V29), ?string(V30), ?string(V31), ?record(V32), ?list_bool(V33), ?list_int8(V34), ?list_uint8(V35), ?list_int16(V36), ?list_uint16(V37), ?list_int32(V38), ?list_uint32(V39), ?list_int64(V40), ?list_uint64(V41), ?list_integer(V42), ?list_integer(V43), ?list_integer(V44), ?list_integer(V45), ?list_number(V46), ?list_number(V47), ?list_number(V48), ?list_number(V49), ?list_number(V50), ?list_number(V51), ?list_float(V52), ?list_double(V53), ?list_string(V54), ?list_record(V55)]; encodeIol(testnull, {_}) -> [<<36:16/big-unsigned>>]; encodeIol(person1, {_, V1, V2, V3, V4}) -> [<<1001:16/big-unsigned>>, ?string(V1), ?int32(V2), ?string(V3), ?list_record(V4)]; encodeIol(_, _) -> []. decodeRec(1, LeftBin0) -> RefSize = binary:referenced_byte_size(LeftBin0), <> = LeftBin0, case Len1 < ?BinaryShareSize of true -> V1 = TemStrV1; _ -> case RefSize / Len1 > ?BinaryCopyRatio of true -> V1 = binary:copy(TemStrV1); _ -> V1 = TemStrV1 end end, MsgRec = {test, V1}, {MsgRec, LeftBin1}; decodeRec(2, LeftBin0) -> <> = LeftBin0, case IsUndef1 of 0 -> V1 = undefined, LeftBin2 = LeftBin1 ; _ -> {V1, LeftBin2} = decodeRec(1, LeftBin1) end, <> = LeftBin2, MsgRec = {phoneNumber, V1, V2}, {MsgRec, LeftBin3}; decodeRec(3, LeftBin0) -> RefSize = binary:referenced_byte_size(LeftBin0), <> = LeftBin0, case Len1 < ?BinaryShareSize of true -> V1 = TemStrV1; _ -> case RefSize / Len1 > ?BinaryCopyRatio of true -> V1 = binary:copy(TemStrV1); _ -> V1 = TemStrV1 end end, <> = LeftBin1, <> = LeftBin2, case Len2 < ?BinaryShareSize of true -> V3 = TemStrV3; _ -> case RefSize / Len2 > ?BinaryCopyRatio of true -> V3 = binary:copy(TemStrV3); _ -> V3 = TemStrV3 end end, <> = LeftBin3, {V4, LeftBin5} = deRecordList(Len3, 2, LeftBin4, []), MsgRec = {person, V1, V2, V3, V4}, {MsgRec, LeftBin5}; decodeRec(5, LeftBin0) -> RefSize = binary:referenced_byte_size(LeftBin0), <> = LeftBin0, case Len1 < ?BinaryShareSize of true -> V1 = TemStrV1; _ -> case RefSize / Len1 > ?BinaryCopyRatio of true -> V1 = binary:copy(TemStrV1); _ -> V1 = TemStrV1 end end, <> = LeftBin1, MsgRec = {union, V1, V2}, {MsgRec, LeftBin2}; decodeRec(_, _) -> {{}, <<>>}. decodeBin(1, LeftBin0) -> RefSize = binary:referenced_byte_size(LeftBin0), <> = LeftBin0, case Len1 < ?BinaryShareSize of true -> V1 = TemStrV1; _ -> case RefSize / Len1 > ?BinaryCopyRatio of true -> V1 = binary:copy(TemStrV1); _ -> V1 = TemStrV1 end end, {testHer, test, {test, V1}}; decodeBin(2, LeftBin0) -> <> = LeftBin0, case IsUndef1 of 0 -> V1 = undefined, LeftBin2 = LeftBin1 ; _ -> {V1, LeftBin2} = decodeRec(1, LeftBin1) end, <> = LeftBin2, {testHer, phoneNumber, {phoneNumber, V1, V2}}; decodeBin(3, LeftBin0) -> RefSize = binary:referenced_byte_size(LeftBin0), <> = LeftBin0, case Len1 < ?BinaryShareSize of true -> V1 = TemStrV1; _ -> case RefSize / Len1 > ?BinaryCopyRatio of true -> V1 = binary:copy(TemStrV1); _ -> V1 = TemStrV1 end end, <> = LeftBin1, <> = LeftBin2, case Len2 < ?BinaryShareSize of true -> V3 = TemStrV3; _ -> case RefSize / Len2 > ?BinaryCopyRatio of true -> V3 = binary:copy(TemStrV3); _ -> V3 = TemStrV3 end end, <> = LeftBin3, {V4, LeftBin5} = deRecordList(Len3, 2, LeftBin4, []), {testHer, person, {person, V1, V2, V3, V4}}; decodeBin(4, LeftBin0) -> <> = LeftBin0, {V1, LeftBin2} = deRecordList(Len1, 3, LeftBin1, []), <> = LeftBin2, {V2, LeftBin4} = deRecordList(Len2, 3, LeftBin3, []), {testHer, addressBook, {addressBook, V1, V2}}; decodeBin(5, LeftBin0) -> RefSize = binary:referenced_byte_size(LeftBin0), <> = LeftBin0, case Len1 < ?BinaryShareSize of true -> V1 = TemStrV1; _ -> case RefSize / Len1 > ?BinaryCopyRatio of true -> V1 = binary:copy(TemStrV1); _ -> V1 = TemStrV1 end end, <> = LeftBin1, {testHer, union, {union, V1, V2}}; decodeBin(6, LeftBin0) -> <> = LeftBin0, V1 = Bool1 =:= 1, {testHer, tbool, {tbool, V1}}; decodeBin(7, LeftBin0) -> <> = LeftBin0, {testHer, tint8, {tint8, V1, V2}}; decodeBin(8, LeftBin0) -> <> = LeftBin0, {testHer, tuint8, {tuint8, V1, V2}}; decodeBin(9, LeftBin0) -> <> = LeftBin0, {testHer, tint16, {tint16, V1, V2}}; decodeBin(10, LeftBin0) -> <> = LeftBin0, {testHer, tuint16, {tuint16, V1, V2}}; decodeBin(11, LeftBin0) -> <> = LeftBin0, {testHer, tint32, {tint32, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10}}; decodeBin(12, LeftBin0) -> <> = LeftBin0, {testHer, tuint32, {tuint32, V1, V2}}; decodeBin(13, LeftBin0) -> <> = LeftBin0, {testHer, tint64, {tint64, V1, V2}}; decodeBin(14, LeftBin0) -> <> = LeftBin0, {testHer, tuint64, {tuint64, V1, V2}}; decodeBin(15, LeftBin0) -> <> = LeftBin0, {testHer, tinteger, {tinteger, V1, V2, V3, V4, V5, V6, V7, V8}}; decodeBin(16, LeftBin0) -> <> = LeftBin0, case NumBits1 of 33-> <> = LeftBin1; 65 -> <> = LeftBin1; _ -> <> = LeftBin1 end, <> = LeftBin2, case NumBits2 of 33-> <> = LeftBin3; 65 -> <> = LeftBin3; _ -> <> = LeftBin3 end, <> = LeftBin4, case NumBits3 of 33-> <> = LeftBin5; 65 -> <> = LeftBin5; _ -> <> = LeftBin5 end, <> = LeftBin6, case NumBits4 of 33-> <> = LeftBin7; 65 -> <> = LeftBin7; _ -> <> = LeftBin7 end, <> = LeftBin8, case NumBits5 of 33-> <> = LeftBin9; 65 -> <> = LeftBin9; _ -> <> = LeftBin9 end, <> = LeftBin10, case NumBits6 of 33-> <> = LeftBin11; 65 -> <> = LeftBin11; _ -> <> = LeftBin11 end, <> = LeftBin12, case NumBits7 of 33-> <> = LeftBin13; 65 -> <> = LeftBin13; _ -> <> = LeftBin13 end, <> = LeftBin14, case NumBits8 of 33-> <> = LeftBin15; 65 -> <> = LeftBin15; _ -> <> = LeftBin15 end, <> = LeftBin16, case NumBits9 of 33-> <> = LeftBin17; 65 -> <> = LeftBin17; _ -> <> = LeftBin17 end, <> = LeftBin18, case NumBits10 of 33-> <> = LeftBin19; 65 -> <> = LeftBin19; _ -> <> = LeftBin19 end, {testHer, tnumber, {tnumber, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10}}; decodeBin(17, LeftBin0) -> <> = LeftBin0, {testHer, tfloat, {tfloat, V1, V2}}; decodeBin(18, LeftBin0) -> <> = LeftBin0, {testHer, tdouble, {tdouble, V1, V2}}; decodeBin(19, LeftBin0) -> RefSize = binary:referenced_byte_size(LeftBin0), <> = LeftBin0, case Len1 < ?BinaryShareSize of true -> V1 = TemStrV1; _ -> case RefSize / Len1 > ?BinaryCopyRatio of true -> V1 = binary:copy(TemStrV1); _ -> V1 = TemStrV1 end end, <> = LeftBin1, case Len2 < ?BinaryShareSize of true -> V2 = TemStrV2; _ -> case RefSize / Len2 > ?BinaryCopyRatio of true -> V2 = binary:copy(TemStrV2); _ -> V2 = TemStrV2 end end, {testHer, tstring, {tstring, V1, V2}}; decodeBin(20, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV =:= 1 || <> <= ListBin1], {testHer, tlistbool, {tlistbool, V1}}; decodeBin(21, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistint8, {tlistint8, V1}}; decodeBin(22, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistuint8, {tlistuint8, V1}}; decodeBin(23, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistint16, {tlistint16, V1}}; decodeBin(24, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistuint16, {tlistuint16, V1}}; decodeBin(25, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistint32, {tlistint32, V1}}; decodeBin(26, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistuint32, {tlistuint32, V1}}; decodeBin(27, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistint64, {tlistint64, V1}}; decodeBin(28, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistuint64, {tlistuint64, V1}}; decodeBin(29, LeftBin0) -> <> = LeftBin0, {V1, LeftBin2} = deIntegerList(Len1, LeftBin1, []), {testHer, tlistinteger, {tlistinteger, V1}}; decodeBin(30, LeftBin0) -> <> = LeftBin0, {V1, LeftBin2} = deNumberList(Len1, LeftBin1, []), {testHer, tlistnumber, {tlistnumber, V1}}; decodeBin(31, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistfloat, {tlistfloat, V1}}; decodeBin(32, LeftBin0) -> <> = LeftBin0, <> = LeftBin1, V1 = [TemV || <> <= ListBin1], {testHer, tlistdouble, {tlistdouble, V1}}; decodeBin(33, LeftBin0) -> <> = LeftBin0, RefSize = binary:referenced_byte_size(LeftBin0), {V1, LeftBin2} = deStringList(Len1, LeftBin1, RefSize, []), {testHer, tliststring, {tliststring, V1}}; decodeBin(34, LeftBin0) -> <> = LeftBin0, {V1, LeftBin2} = deRecordList(Len1, 5, LeftBin1, []), {testHer, tlistunion, {tlistunion, V1}}; decodeBin(35, LeftBin0) -> <> = LeftBin0, V1 = Bool1 =:= 1, <> = LeftBin1, <> = LeftBin2, case NumBits1 of 33-> <> = LeftBin3; 65 -> <> = LeftBin3; _ -> <> = LeftBin3 end, <> = LeftBin4, case NumBits2 of 33-> <> = LeftBin5; 65 -> <> = LeftBin5; _ -> <> = LeftBin5 end, <> = LeftBin6, case NumBits3 of 33-> <> = LeftBin7; 65 -> <> = LeftBin7; _ -> <> = LeftBin7 end, <> = LeftBin8, case NumBits4 of 33-> <> = LeftBin9; 65 -> <> = LeftBin9; _ -> <> = LeftBin9 end, <> = LeftBin10, case NumBits5 of 33-> <> = LeftBin11; 65 -> <> = LeftBin11; _ -> <> = LeftBin11 end, <> = LeftBin12, case NumBits6 of 33-> <> = LeftBin13; 65 -> <> = LeftBin13; _ -> <> = LeftBin13 end, <> = LeftBin14, case NumBits7 of 33-> <> = LeftBin15; 65 -> <> = LeftBin15; _ -> <> = LeftBin15 end, <> = LeftBin16, case NumBits8 of 33-> <> = LeftBin17; 65 -> <> = LeftBin17; _ -> <> = LeftBin17 end, <> = LeftBin18, case NumBits9 of 33-> <> = LeftBin19; 65 -> <> = LeftBin19; _ -> <> = LeftBin19 end, <> = LeftBin20, case NumBits10 of 33-> <> = LeftBin21; 65 -> <> = LeftBin21; _ -> <> = LeftBin21 end, <> = LeftBin22, RefSize = binary:referenced_byte_size(LeftBin0), <> = LeftBin23, case Len1 < ?BinaryShareSize of true -> V30 = TemStrV30; _ -> case RefSize / Len1 > ?BinaryCopyRatio of true -> V30 = binary:copy(TemStrV30); _ -> V30 = TemStrV30 end end, <> = LeftBin24, case Len2 < ?BinaryShareSize of true -> V31 = TemStrV31; _ -> case RefSize / Len2 > ?BinaryCopyRatio of true -> V31 = binary:copy(TemStrV31); _ -> V31 = TemStrV31 end end, <> = LeftBin25, case IsUndef1 of 0 -> V32 = undefined, LeftBin27 = LeftBin26 ; _ -> {V32, LeftBin27} = decodeRec(5, LeftBin26) end, <> = LeftBin27, <> = LeftBin28, V33 = [TemV =:= 1 || <> <= ListBin1], <> = LeftBin29, <> = LeftBin30, V34 = [TemV || <> <= ListBin2], <> = LeftBin31, <> = LeftBin32, V35 = [TemV || <> <= ListBin3], <> = LeftBin33, <> = LeftBin34, V36 = [TemV || <> <= ListBin4], <> = LeftBin35, <> = LeftBin36, V37 = [TemV || <> <= ListBin5], <> = LeftBin37, <> = LeftBin38, V38 = [TemV || <> <= ListBin6], <> = LeftBin39, <> = LeftBin40, V39 = [TemV || <> <= ListBin7], <> = LeftBin41, <> = LeftBin42, V40 = [TemV || <> <= ListBin8], <> = LeftBin43, <> = LeftBin44, V41 = [TemV || <> <= ListBin9], <> = LeftBin45, {V42, LeftBin47} = deIntegerList(Len12, LeftBin46, []), <> = LeftBin47, {V43, LeftBin49} = deIntegerList(Len13, LeftBin48, []), <> = LeftBin49, {V44, LeftBin51} = deIntegerList(Len14, LeftBin50, []), <> = LeftBin51, {V45, LeftBin53} = deIntegerList(Len15, LeftBin52, []), <> = LeftBin53, {V46, LeftBin55} = deNumberList(Len16, LeftBin54, []), <> = LeftBin55, {V47, LeftBin57} = deNumberList(Len17, LeftBin56, []), <> = LeftBin57, {V48, LeftBin59} = deNumberList(Len18, LeftBin58, []), <> = LeftBin59, {V49, LeftBin61} = deNumberList(Len19, LeftBin60, []), <> = LeftBin61, {V50, LeftBin63} = deNumberList(Len20, LeftBin62, []), <> = LeftBin63, {V51, LeftBin65} = deNumberList(Len21, LeftBin64, []), <> = LeftBin65, <> = LeftBin66, V52 = [TemV || <> <= ListBin20], <> = LeftBin67, <> = LeftBin68, V53 = [TemV || <> <= ListBin21], <> = LeftBin69, {V54, LeftBin71} = deStringList(Len24, LeftBin70, RefSize, []), <> = LeftBin71, {V55, LeftBin73} = deRecordList(Len25, 5, LeftBin72, []), {testHer, allType, {allType, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13, V14, V15, V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27, V28, V29, V30, V31, V32, V33, V34, V35, V36, V37, V38, V39, V40, V41, V42, V43, V44, V45, V46, V47, V48, V49, V50, V51, V52, V53, V54, V55}}; decodeBin(36, LeftBin0) -> {testHer, testnull, {testnull}}; decodeBin(1001, LeftBin0) -> RefSize = binary:referenced_byte_size(LeftBin0), <> = LeftBin0, case Len1 < ?BinaryShareSize of true -> V1 = TemStrV1; _ -> case RefSize / Len1 > ?BinaryCopyRatio of true -> V1 = binary:copy(TemStrV1); _ -> V1 = TemStrV1 end end, <> = LeftBin1, <> = LeftBin2, case Len2 < ?BinaryShareSize of true -> V3 = TemStrV3; _ -> case RefSize / Len2 > ?BinaryCopyRatio of true -> V3 = binary:copy(TemStrV3); _ -> V3 = TemStrV3 end end, <> = LeftBin3, {V4, LeftBin5} = deRecordList(Len3, 2, LeftBin4, []), {errorHer, person1, {person1, V1, V2, V3, V4}}; decodeBin(_, _) -> {undefinedHer, undefined, {}}. getMsgName(1)-> test; getMsgName(2)-> phoneNumber; getMsgName(3)-> person; getMsgName(4)-> addressBook; getMsgName(5)-> union; getMsgName(6)-> tbool; getMsgName(7)-> tint8; getMsgName(8)-> tuint8; getMsgName(9)-> tint16; getMsgName(10)-> tuint16; getMsgName(11)-> tint32; getMsgName(12)-> tuint32; getMsgName(13)-> tint64; getMsgName(14)-> tuint64; getMsgName(15)-> tinteger; getMsgName(16)-> tnumber; getMsgName(17)-> tfloat; getMsgName(18)-> tdouble; getMsgName(19)-> tstring; getMsgName(20)-> tlistbool; getMsgName(21)-> tlistint8; getMsgName(22)-> tlistuint8; getMsgName(23)-> tlistint16; getMsgName(24)-> tlistuint16; getMsgName(25)-> tlistint32; getMsgName(26)-> tlistuint32; getMsgName(27)-> tlistint64; getMsgName(28)-> tlistuint64; getMsgName(29)-> tlistinteger; getMsgName(30)-> tlistnumber; getMsgName(31)-> tlistfloat; getMsgName(32)-> tlistdouble; getMsgName(33)-> tliststring; getMsgName(34)-> tlistunion; getMsgName(35)-> allType; getMsgName(36)-> testnull; getMsgName(1001)-> person1; getMsgName(_) -> undefiend.