erlang自定义二进制协议
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

894 line
33 KiB

4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
4 年之前
5 年之前
5 年之前
  1. -module(protoMsg).
  2. -compile([nowarn_unused_vars]).
  3. -export([encodeIol/1, encodeBin/1, encodeIol/2, subEncode/1, subEncode/2, decode/1, decodeBin/2, getMsgName/1]).
  4. -define(min8, -128).
  5. -define(max8, 127).
  6. -define(min16, -32768).
  7. -define(max16, 32767).
  8. -define(min32, -2147483648).
  9. -define(max32, 2147483647).
  10. -define(min64, -9223372036854775808).
  11. -define(max64, 9223372036854775807).
  12. -define(minF32, 1.175494351E-38).
  13. -define(maxF32, 3.402823466E+38).
  14. -define(minF64, 2.2250738585072014E-308).
  15. -define(maxF64, 1.7976931348623158E+308).
  16. -define(int8(V), <<V:8>>).
  17. -define(uint8(V), <<V:8>>).
  18. -define(int16(V), <<V:16/big>>).
  19. -define(uint16(V), <<V:16/big>>).
  20. -define(int32(V), <<V:32/big>>).
  21. -define(uint32(V), <<V:32/big>>).
  22. -define(int64(V), <<V:64/big>>).
  23. -define(uint64(V), <<V:64/big>>).
  24. -define(integer(V), (integer(V))).
  25. -define(number(V), (number(V))).
  26. -define(string(V), (string(V))).
  27. -define(float(V), <<V:32/big-float>>).
  28. -define(double(V), <<V:64/big-float>>).
  29. -define(bool(V), (case V of true -> <<1:8>>; _ -> <<0:8>> end)).
  30. -define(record(V), (case V of undefined -> [<<0:8>>]; V -> [<<1:8>>, subEncode(V)] end)).
  31. -define(list_bool(List), [<<(length(List)):16/big>>, [?bool(V) || V <- List]]).
  32. -define(list_int8(List), [<<(length(List)):16/big>>, [?int8(V) || V <- List]]).
  33. -define(list_uint8(List), [<<(length(List)):16/big>>, [?uint8(V) || V <- List]]).
  34. -define(list_int16(List), [<<(length(List)):16/big>>, [?int16(V) || V <- List]]).
  35. -define(list_uint16(List), [<<(length(List)):16/big>>, [?uint16(V) || V <- List]]).
  36. -define(list_int32(List), [<<(length(List)):16/big>>, [?int32(V) || V <- List]]).
  37. -define(list_uint32(List), [<<(length(List)):16/big>>, [?uint32(V) || V <- List]]).
  38. -define(list_int64(List), [<<(length(List)):16/big>>, [?int64(V) || V <- List]]).
  39. -define(list_uint64(List), [<<(length(List)):16/big>>, [?uint64(V) || V <- List]]).
  40. -define(list_float(List), [<<(length(List)):16/big>>, [?float(V) || V <- List]]).
  41. -define(list_double(List), [<<(length(List)):16/big>>, [?double(V) || V <- List]]).
  42. -define(list_integer(List), [<<(length(List)):16/big>>, [integer(V) || V <- List]]).
  43. -define(list_number(List), [<<(length(List)):16/big>>, [number(V) || V <- List]]).
  44. -define(list_string(List), [<<(length(List)):16/big>>, [string(V) || V <- List]]).
  45. -define(list_record(List), [<<(length(List)):16/big>>, [subEncode(V) || V <- List]]).
  46. -define(BinaryShareSize, 65).
  47. -define(BinaryCopyRatio, 1.2).
  48. integer(V) ->
  49. if
  50. V >= ?min8 andalso V =< ?max8 ->
  51. <<8:8, <<V:8>>/binary>>;
  52. V >= ?min16 andalso V =< ?max16 ->
  53. <<16:8, <<V:16/big>>/binary>>;
  54. V >= ?min32 andalso V =< ?max32 ->
  55. <<32:8, <<V:32/big>>/binary>>;
  56. V >= ?min64 andalso V =< ?max64 ->
  57. <<64:8, <<V:64/big>>/binary>>;
  58. true ->
  59. throw(exceeded_the_integer)
  60. end.
  61. number(V) ->
  62. if
  63. erlang:is_integer(V) ->
  64. if
  65. V >= ?min8 andalso V =< ?max8 ->
  66. <<8:8, <<V:8>>/binary>>;
  67. V >= ?min16 andalso V =< ?max16 ->
  68. <<16:8, <<V:16/big>>/binary>>;
  69. V >= ?min32 andalso V =< ?max32 ->
  70. <<32:8, <<V:32/big>>/binary>>;
  71. V >= ?min64 andalso V =< ?max64 ->
  72. <<64:8, <<V:64/big>>/binary>>;
  73. true ->
  74. throw(exceeded_the_integer)
  75. end;
  76. erlang:is_float(V) ->
  77. if
  78. V >= ?minF32 andalso V =< ?maxF32 ->
  79. <<33:8, <<V:32/big-float>>/binary>>;
  80. V >= ?minF64 andalso V =< ?maxF64 ->
  81. <<65:8, <<V:64/big-float>>/binary>>;
  82. true ->
  83. throw(exceeded_the_float)
  84. end;
  85. true ->
  86. throw(is_not_number)
  87. end.
  88. string(Str) when is_binary(Str) ->
  89. [<<(byte_size(Str)):16/big>>, Str];
  90. string(Str) ->
  91. Str2 = unicode:characters_to_binary(Str, utf8),
  92. [<<(byte_size(Str2)):16/big>>, Str2].
  93. decode(Bin) ->
  94. <<MsgId:16/big, MsgBin/binary>> = Bin,
  95. decodeBin(MsgId, MsgBin).
  96. deIntegerList(0, MsgBin, RetList) ->
  97. {lists:reverse(RetList), MsgBin};
  98. deIntegerList(N, MsgBin, RetList) ->
  99. <<IntBits:8, Int:IntBits/big-signed, LeftBin/binary>> = MsgBin,
  100. deIntegerList(N - 1, LeftBin, [Int | RetList]).
  101. deNumberList(0, MsgBin, RetList) ->
  102. {lists:reverse(RetList), MsgBin};
  103. deNumberList(N, MsgBin, RetList) ->
  104. <<NumBits:8, NumBin/binary>> = MsgBin,
  105. case NumBits of
  106. 33 ->
  107. <<Float:32/big-float, LeftBin/binary>> = NumBin,
  108. deNumberList(N - 1, LeftBin, [Float | RetList]);
  109. 65 ->
  110. <<Float:64/big-float, LeftBin/binary>> = NumBin,
  111. deNumberList(N - 1, LeftBin, [Float | RetList]);
  112. _ ->
  113. <<Int:NumBits/big-signed, LeftBin/binary>> = NumBin,
  114. deNumberList(N - 1, LeftBin, [Int | RetList])
  115. end.
  116. deStringList(0, MsgBin, _RefSize, RetList) ->
  117. {lists:reverse(RetList), MsgBin};
  118. deStringList(N, MsgBin, RefSize, RetList) ->
  119. <<Len:16/big, StrBin:Len/binary-unit:8, LeftBin/binary>> = MsgBin,
  120. case Len < ?BinaryShareSize of
  121. true ->
  122. deStringList(N - 1, LeftBin, RefSize, [StrBin | RetList]);
  123. _ ->
  124. case RefSize / Len > ?BinaryCopyRatio of
  125. true ->
  126. StrBinCopy = binary:copy(StrBin),
  127. deStringList(N - 1, LeftBin, RefSize, [StrBinCopy | RetList]);
  128. _ ->
  129. deStringList(N - 1, LeftBin, RefSize, [StrBin | RetList])
  130. end
  131. end.
  132. deRecordList(0, _MsgId, MsgBin, RetList) ->
  133. {lists:reverse(RetList), MsgBin};
  134. deRecordList(N, MsgId, MsgBin, RetList) ->
  135. {Tuple, LeftBin} = decodeRec(MsgId, MsgBin),
  136. deRecordList(N - 1, MsgId, LeftBin, [Tuple | RetList]).
  137. encodeIol(RecMsg) ->
  138. encodeIol(erlang:element(1, RecMsg), RecMsg).
  139. encodeBin(RecMsg) ->
  140. erlang:iolist_to_binary(encodeIol(RecMsg)).
  141. subEncode(RecMsg) ->
  142. subEncode(erlang:element(1, RecMsg), RecMsg).
  143. subEncode(test, {_, V1}) ->
  144. [?string(V1)];
  145. subEncode(phoneNumber, {_, V1, V2}) ->
  146. [?record(V1), ?int32(V2)];
  147. subEncode(person, {_, V1, V2, V3, V4}) ->
  148. [?string(V1), ?int32(V2), ?string(V3), ?list_record(V4)];
  149. subEncode(union, {_, V1, V2}) ->
  150. [?string(V1), ?int32(V2)];
  151. subEncode(_, _) ->
  152. [].
  153. encodeIol(test, {_, V1}) ->
  154. [<<1:16/big-unsigned>>, ?string(V1)];
  155. encodeIol(phoneNumber, {_, V1, V2}) ->
  156. [<<2:16/big-unsigned>>, ?record(V1), ?int32(V2)];
  157. encodeIol(person, {_, V1, V2, V3, V4}) ->
  158. [<<3:16/big-unsigned>>, ?string(V1), ?int32(V2), ?string(V3), ?list_record(V4)];
  159. encodeIol(addressBook, {_, V1, V2}) ->
  160. [<<4:16/big-unsigned>>, ?list_record(V1), ?list_record(V2)];
  161. encodeIol(union, {_, V1, V2}) ->
  162. [<<5:16/big-unsigned>>, ?string(V1), ?int32(V2)];
  163. encodeIol(tbool, {_, V1}) ->
  164. [<<6:16/big-unsigned>>, ?bool(V1)];
  165. encodeIol(tint8, {_, V1, V2}) ->
  166. [<<7:16/big-unsigned>>, ?int8(V1), ?int8(V2)];
  167. encodeIol(tuint8, {_, V1, V2}) ->
  168. [<<8:16/big-unsigned>>, ?uint8(V1), ?uint8(V2)];
  169. encodeIol(tint16, {_, V1, V2}) ->
  170. [<<9:16/big-unsigned>>, ?int16(V1), ?int16(V2)];
  171. encodeIol(tuint16, {_, V1, V2}) ->
  172. [<<10:16/big-unsigned>>, ?uint16(V1), ?uint16(V2)];
  173. encodeIol(tint32, {_, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10}) ->
  174. [<<11:16/big-unsigned>>, ?int32(V1), ?int32(V2), ?int32(V3), ?int32(V4), ?int32(V5), ?int32(V6), ?int32(V7), ?int32(V8), ?int32(V9), ?int32(V10)];
  175. encodeIol(tuint32, {_, V1, V2}) ->
  176. [<<12:16/big-unsigned>>, ?uint32(V1), ?uint32(V2)];
  177. encodeIol(tint64, {_, V1, V2}) ->
  178. [<<13:16/big-unsigned>>, ?int64(V1), ?int64(V2)];
  179. encodeIol(tuint64, {_, V1, V2}) ->
  180. [<<14:16/big-unsigned>>, ?uint64(V1), ?uint64(V2)];
  181. encodeIol(tinteger, {_, V1, V2, V3, V4, V5, V6, V7, V8}) ->
  182. [<<15:16/big-unsigned>>, ?integer(V1), ?integer(V2), ?integer(V3), ?integer(V4), ?integer(V5), ?integer(V6), ?integer(V7), ?integer(V8)];
  183. encodeIol(tnumber, {_, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10}) ->
  184. [<<16:16/big-unsigned>>, ?number(V1), ?number(V2), ?number(V3), ?number(V4), ?number(V5), ?number(V6), ?number(V7), ?number(V8), ?number(V9), ?number(V10)];
  185. encodeIol(tfloat, {_, V1, V2}) ->
  186. [<<17:16/big-unsigned>>, ?float(V1), ?float(V2)];
  187. encodeIol(tdouble, {_, V1, V2}) ->
  188. [<<18:16/big-unsigned>>, ?double(V1), ?double(V2)];
  189. encodeIol(tstring, {_, V1, V2}) ->
  190. [<<19:16/big-unsigned>>, ?string(V1), ?string(V2)];
  191. encodeIol(tlistbool, {_, V1}) ->
  192. [<<20:16/big-unsigned>>, ?list_bool(V1)];
  193. encodeIol(tlistint8, {_, V1}) ->
  194. [<<21:16/big-unsigned>>, ?list_int8(V1)];
  195. encodeIol(tlistuint8, {_, V1}) ->
  196. [<<22:16/big-unsigned>>, ?list_uint8(V1)];
  197. encodeIol(tlistint16, {_, V1}) ->
  198. [<<23:16/big-unsigned>>, ?list_int16(V1)];
  199. encodeIol(tlistuint16, {_, V1}) ->
  200. [<<24:16/big-unsigned>>, ?list_uint16(V1)];
  201. encodeIol(tlistint32, {_, V1}) ->
  202. [<<25:16/big-unsigned>>, ?list_int32(V1)];
  203. encodeIol(tlistuint32, {_, V1}) ->
  204. [<<26:16/big-unsigned>>, ?list_uint32(V1)];
  205. encodeIol(tlistint64, {_, V1}) ->
  206. [<<27:16/big-unsigned>>, ?list_int64(V1)];
  207. encodeIol(tlistuint64, {_, V1}) ->
  208. [<<28:16/big-unsigned>>, ?list_uint64(V1)];
  209. encodeIol(tlistinteger, {_, V1}) ->
  210. [<<29:16/big-unsigned>>, ?list_integer(V1)];
  211. encodeIol(tlistnumber, {_, V1}) ->
  212. [<<30:16/big-unsigned>>, ?list_number(V1)];
  213. encodeIol(tlistfloat, {_, V1}) ->
  214. [<<31:16/big-unsigned>>, ?list_float(V1)];
  215. encodeIol(tlistdouble, {_, V1}) ->
  216. [<<32:16/big-unsigned>>, ?list_double(V1)];
  217. encodeIol(tliststring, {_, V1}) ->
  218. [<<33:16/big-unsigned>>, ?list_string(V1)];
  219. encodeIol(tlistunion, {_, V1}) ->
  220. [<<34:16/big-unsigned>>, ?list_record(V1)];
  221. 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}) ->
  222. [<<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)];
  223. encodeIol(testnull, {_}) ->
  224. [<<36:16/big-unsigned>>];
  225. encodeIol(person1, {_, V1, V2, V3, V4}) ->
  226. [<<1001:16/big-unsigned>>, ?string(V1), ?int32(V2), ?string(V3), ?list_record(V4)];
  227. encodeIol(_, _) ->
  228. [].
  229. decodeRec(1, LeftBin0) ->
  230. RefSize = binary:referenced_byte_size(LeftBin0),
  231. <<Len1:16/big-unsigned, TemStrV1:Len1/binary, LeftBin1/binary>> = LeftBin0,
  232. case Len1 < ?BinaryShareSize of
  233. true ->
  234. V1 = TemStrV1;
  235. _ ->
  236. case RefSize / Len1 > ?BinaryCopyRatio of
  237. true ->
  238. V1 = binary:copy(TemStrV1);
  239. _ ->
  240. V1 = TemStrV1
  241. end
  242. end,
  243. MsgRec = {test, V1},
  244. {MsgRec, LeftBin1};
  245. decodeRec(2, LeftBin0) ->
  246. <<IsUndef1:8/big-unsigned, LeftBin1/binary>> = LeftBin0,
  247. case IsUndef1 of
  248. 0 ->
  249. V1 = undefined,
  250. LeftBin2 = LeftBin1 ;
  251. _ ->
  252. {V1, LeftBin2} = decodeRec(1, LeftBin1)
  253. end,
  254. <<V2:32/big-signed, LeftBin3/binary>> = LeftBin2,
  255. MsgRec = {phoneNumber, V1, V2},
  256. {MsgRec, LeftBin3};
  257. decodeRec(3, LeftBin0) ->
  258. RefSize = binary:referenced_byte_size(LeftBin0),
  259. <<Len1:16/big-unsigned, TemStrV1:Len1/binary, LeftBin1/binary>> = LeftBin0,
  260. case Len1 < ?BinaryShareSize of
  261. true ->
  262. V1 = TemStrV1;
  263. _ ->
  264. case RefSize / Len1 > ?BinaryCopyRatio of
  265. true ->
  266. V1 = binary:copy(TemStrV1);
  267. _ ->
  268. V1 = TemStrV1
  269. end
  270. end,
  271. <<V2:32/big-signed, LeftBin2/binary>> = LeftBin1,
  272. <<Len2:16/big-unsigned, TemStrV3:Len2/binary, LeftBin3/binary>> = LeftBin2,
  273. case Len2 < ?BinaryShareSize of
  274. true ->
  275. V3 = TemStrV3;
  276. _ ->
  277. case RefSize / Len2 > ?BinaryCopyRatio of
  278. true ->
  279. V3 = binary:copy(TemStrV3);
  280. _ ->
  281. V3 = TemStrV3
  282. end
  283. end,
  284. <<Len3:16/big-unsigned, LeftBin4/binary>> = LeftBin3,
  285. {V4, LeftBin5} = deRecordList(Len3, 2, LeftBin4, []),
  286. MsgRec = {person, V1, V2, V3, V4},
  287. {MsgRec, LeftBin5};
  288. decodeRec(5, LeftBin0) ->
  289. RefSize = binary:referenced_byte_size(LeftBin0),
  290. <<Len1:16/big-unsigned, TemStrV1:Len1/binary, LeftBin1/binary>> = LeftBin0,
  291. case Len1 < ?BinaryShareSize of
  292. true ->
  293. V1 = TemStrV1;
  294. _ ->
  295. case RefSize / Len1 > ?BinaryCopyRatio of
  296. true ->
  297. V1 = binary:copy(TemStrV1);
  298. _ ->
  299. V1 = TemStrV1
  300. end
  301. end,
  302. <<V2:32/big-signed, LeftBin2/binary>> = LeftBin1,
  303. MsgRec = {union, V1, V2},
  304. {MsgRec, LeftBin2};
  305. decodeRec(_, _) ->
  306. {{}, <<>>}.
  307. decodeBin(1, LeftBin0) ->
  308. RefSize = binary:referenced_byte_size(LeftBin0),
  309. <<Len1:16/big-unsigned, TemStrV1:Len1/binary, LeftBin1/binary>> = LeftBin0,
  310. case Len1 < ?BinaryShareSize of
  311. true ->
  312. V1 = TemStrV1;
  313. _ ->
  314. case RefSize / Len1 > ?BinaryCopyRatio of
  315. true ->
  316. V1 = binary:copy(TemStrV1);
  317. _ ->
  318. V1 = TemStrV1
  319. end
  320. end,
  321. {testHer, test, {test, V1}};
  322. decodeBin(2, LeftBin0) ->
  323. <<IsUndef1:8/big-unsigned, LeftBin1/binary>> = LeftBin0,
  324. case IsUndef1 of
  325. 0 ->
  326. V1 = undefined,
  327. LeftBin2 = LeftBin1 ;
  328. _ ->
  329. {V1, LeftBin2} = decodeRec(1, LeftBin1)
  330. end,
  331. <<V2:32/big-signed, LeftBin3/binary>> = LeftBin2,
  332. {testHer, phoneNumber, {phoneNumber, V1, V2}};
  333. decodeBin(3, LeftBin0) ->
  334. RefSize = binary:referenced_byte_size(LeftBin0),
  335. <<Len1:16/big-unsigned, TemStrV1:Len1/binary, LeftBin1/binary>> = LeftBin0,
  336. case Len1 < ?BinaryShareSize of
  337. true ->
  338. V1 = TemStrV1;
  339. _ ->
  340. case RefSize / Len1 > ?BinaryCopyRatio of
  341. true ->
  342. V1 = binary:copy(TemStrV1);
  343. _ ->
  344. V1 = TemStrV1
  345. end
  346. end,
  347. <<V2:32/big-signed, LeftBin2/binary>> = LeftBin1,
  348. <<Len2:16/big-unsigned, TemStrV3:Len2/binary, LeftBin3/binary>> = LeftBin2,
  349. case Len2 < ?BinaryShareSize of
  350. true ->
  351. V3 = TemStrV3;
  352. _ ->
  353. case RefSize / Len2 > ?BinaryCopyRatio of
  354. true ->
  355. V3 = binary:copy(TemStrV3);
  356. _ ->
  357. V3 = TemStrV3
  358. end
  359. end,
  360. <<Len3:16/big-unsigned, LeftBin4/binary>> = LeftBin3,
  361. {V4, LeftBin5} = deRecordList(Len3, 2, LeftBin4, []),
  362. {testHer, person, {person, V1, V2, V3, V4}};
  363. decodeBin(4, LeftBin0) ->
  364. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  365. {V1, LeftBin2} = deRecordList(Len1, 3, LeftBin1, []),
  366. <<Len2:16/big-unsigned, LeftBin3/binary>> = LeftBin2,
  367. {V2, LeftBin4} = deRecordList(Len2, 3, LeftBin3, []),
  368. {testHer, addressBook, {addressBook, V1, V2}};
  369. decodeBin(5, LeftBin0) ->
  370. RefSize = binary:referenced_byte_size(LeftBin0),
  371. <<Len1:16/big-unsigned, TemStrV1:Len1/binary, LeftBin1/binary>> = LeftBin0,
  372. case Len1 < ?BinaryShareSize of
  373. true ->
  374. V1 = TemStrV1;
  375. _ ->
  376. case RefSize / Len1 > ?BinaryCopyRatio of
  377. true ->
  378. V1 = binary:copy(TemStrV1);
  379. _ ->
  380. V1 = TemStrV1
  381. end
  382. end,
  383. <<V2:32/big-signed, LeftBin2/binary>> = LeftBin1,
  384. {testHer, union, {union, V1, V2}};
  385. decodeBin(6, LeftBin0) ->
  386. <<Bool1:8/big-unsigned, LeftBin1/binary>> = LeftBin0,
  387. V1 = Bool1 =:= 1,
  388. {testHer, tbool, {tbool, V1}};
  389. decodeBin(7, LeftBin0) ->
  390. <<V1:8/big-signed, V2:8/big-signed, LeftBin1/binary>> = LeftBin0,
  391. {testHer, tint8, {tint8, V1, V2}};
  392. decodeBin(8, LeftBin0) ->
  393. <<V1:8/big-unsigned, V2:8/big-unsigned, LeftBin1/binary>> = LeftBin0,
  394. {testHer, tuint8, {tuint8, V1, V2}};
  395. decodeBin(9, LeftBin0) ->
  396. <<V1:16/big-signed, V2:16/big-signed, LeftBin1/binary>> = LeftBin0,
  397. {testHer, tint16, {tint16, V1, V2}};
  398. decodeBin(10, LeftBin0) ->
  399. <<V1:16/big-unsigned, V2:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  400. {testHer, tuint16, {tuint16, V1, V2}};
  401. decodeBin(11, LeftBin0) ->
  402. <<V1:32/big-signed, V2:32/big-signed, V3:32/big-signed, V4:32/big-signed, V5:32/big-signed, V6:32/big-signed, V7:32/big-signed, V8:32/big-signed, V9:32/big-signed, V10:32/big-signed, LeftBin1/binary>> = LeftBin0,
  403. {testHer, tint32, {tint32, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10}};
  404. decodeBin(12, LeftBin0) ->
  405. <<V1:32/big-unsigned, V2:32/big-unsigned, LeftBin1/binary>> = LeftBin0,
  406. {testHer, tuint32, {tuint32, V1, V2}};
  407. decodeBin(13, LeftBin0) ->
  408. <<V1:64/big-signed, V2:64/big-signed, LeftBin1/binary>> = LeftBin0,
  409. {testHer, tint64, {tint64, V1, V2}};
  410. decodeBin(14, LeftBin0) ->
  411. <<V1:64/big-unsigned, V2:64/big-unsigned, LeftBin1/binary>> = LeftBin0,
  412. {testHer, tuint64, {tuint64, V1, V2}};
  413. decodeBin(15, LeftBin0) ->
  414. <<IntBits1:8, V1:IntBits1/big-signed, IntBits2:8, V2:IntBits2/big-signed, IntBits3:8, V3:IntBits3/big-signed, IntBits4:8, V4:IntBits4/big-signed, IntBits5:8, V5:IntBits5/big-signed, IntBits6:8, V6:IntBits6/big-signed, IntBits7:8, V7:IntBits7/big-signed, IntBits8:8, V8:IntBits8/big-signed, LeftBin1/binary>> = LeftBin0,
  415. {testHer, tinteger, {tinteger, V1, V2, V3, V4, V5, V6, V7, V8}};
  416. decodeBin(16, LeftBin0) ->
  417. <<NumBits1:8, LeftBin1/binary>> = LeftBin0,
  418. case NumBits1 of
  419. 33->
  420. <<V1:32/big-float, LeftBin2/binary>> = LeftBin1;
  421. 65 ->
  422. <<V1:64/big-float, LeftBin2/binary>> = LeftBin1;
  423. _ ->
  424. <<V1:NumBits1/big-signed, LeftBin2/binary>> = LeftBin1
  425. end,
  426. <<NumBits2:8, LeftBin3/binary>> = LeftBin2,
  427. case NumBits2 of
  428. 33->
  429. <<V2:32/big-float, LeftBin4/binary>> = LeftBin3;
  430. 65 ->
  431. <<V2:64/big-float, LeftBin4/binary>> = LeftBin3;
  432. _ ->
  433. <<V2:NumBits2/big-signed, LeftBin4/binary>> = LeftBin3
  434. end,
  435. <<NumBits3:8, LeftBin5/binary>> = LeftBin4,
  436. case NumBits3 of
  437. 33->
  438. <<V3:32/big-float, LeftBin6/binary>> = LeftBin5;
  439. 65 ->
  440. <<V3:64/big-float, LeftBin6/binary>> = LeftBin5;
  441. _ ->
  442. <<V3:NumBits3/big-signed, LeftBin6/binary>> = LeftBin5
  443. end,
  444. <<NumBits4:8, LeftBin7/binary>> = LeftBin6,
  445. case NumBits4 of
  446. 33->
  447. <<V4:32/big-float, LeftBin8/binary>> = LeftBin7;
  448. 65 ->
  449. <<V4:64/big-float, LeftBin8/binary>> = LeftBin7;
  450. _ ->
  451. <<V4:NumBits4/big-signed, LeftBin8/binary>> = LeftBin7
  452. end,
  453. <<NumBits5:8, LeftBin9/binary>> = LeftBin8,
  454. case NumBits5 of
  455. 33->
  456. <<V5:32/big-float, LeftBin10/binary>> = LeftBin9;
  457. 65 ->
  458. <<V5:64/big-float, LeftBin10/binary>> = LeftBin9;
  459. _ ->
  460. <<V5:NumBits5/big-signed, LeftBin10/binary>> = LeftBin9
  461. end,
  462. <<NumBits6:8, LeftBin11/binary>> = LeftBin10,
  463. case NumBits6 of
  464. 33->
  465. <<V6:32/big-float, LeftBin12/binary>> = LeftBin11;
  466. 65 ->
  467. <<V6:64/big-float, LeftBin12/binary>> = LeftBin11;
  468. _ ->
  469. <<V6:NumBits6/big-signed, LeftBin12/binary>> = LeftBin11
  470. end,
  471. <<NumBits7:8, LeftBin13/binary>> = LeftBin12,
  472. case NumBits7 of
  473. 33->
  474. <<V7:32/big-float, LeftBin14/binary>> = LeftBin13;
  475. 65 ->
  476. <<V7:64/big-float, LeftBin14/binary>> = LeftBin13;
  477. _ ->
  478. <<V7:NumBits7/big-signed, LeftBin14/binary>> = LeftBin13
  479. end,
  480. <<NumBits8:8, LeftBin15/binary>> = LeftBin14,
  481. case NumBits8 of
  482. 33->
  483. <<V8:32/big-float, LeftBin16/binary>> = LeftBin15;
  484. 65 ->
  485. <<V8:64/big-float, LeftBin16/binary>> = LeftBin15;
  486. _ ->
  487. <<V8:NumBits8/big-signed, LeftBin16/binary>> = LeftBin15
  488. end,
  489. <<NumBits9:8, LeftBin17/binary>> = LeftBin16,
  490. case NumBits9 of
  491. 33->
  492. <<V9:32/big-float, LeftBin18/binary>> = LeftBin17;
  493. 65 ->
  494. <<V9:64/big-float, LeftBin18/binary>> = LeftBin17;
  495. _ ->
  496. <<V9:NumBits9/big-signed, LeftBin18/binary>> = LeftBin17
  497. end,
  498. <<NumBits10:8, LeftBin19/binary>> = LeftBin18,
  499. case NumBits10 of
  500. 33->
  501. <<V10:32/big-float, LeftBin20/binary>> = LeftBin19;
  502. 65 ->
  503. <<V10:64/big-float, LeftBin20/binary>> = LeftBin19;
  504. _ ->
  505. <<V10:NumBits10/big-signed, LeftBin20/binary>> = LeftBin19
  506. end,
  507. {testHer, tnumber, {tnumber, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10}};
  508. decodeBin(17, LeftBin0) ->
  509. <<V1:32/big-float, V2:32/big-float, LeftBin1/binary>> = LeftBin0,
  510. {testHer, tfloat, {tfloat, V1, V2}};
  511. decodeBin(18, LeftBin0) ->
  512. <<V1:64/big-float, V2:64/big-float, LeftBin1/binary>> = LeftBin0,
  513. {testHer, tdouble, {tdouble, V1, V2}};
  514. decodeBin(19, LeftBin0) ->
  515. RefSize = binary:referenced_byte_size(LeftBin0),
  516. <<Len1:16/big-unsigned, TemStrV1:Len1/binary, LeftBin1/binary>> = LeftBin0,
  517. case Len1 < ?BinaryShareSize of
  518. true ->
  519. V1 = TemStrV1;
  520. _ ->
  521. case RefSize / Len1 > ?BinaryCopyRatio of
  522. true ->
  523. V1 = binary:copy(TemStrV1);
  524. _ ->
  525. V1 = TemStrV1
  526. end
  527. end,
  528. <<Len2:16/big-unsigned, TemStrV2:Len2/binary, LeftBin2/binary>> = LeftBin1,
  529. case Len2 < ?BinaryShareSize of
  530. true ->
  531. V2 = TemStrV2;
  532. _ ->
  533. case RefSize / Len2 > ?BinaryCopyRatio of
  534. true ->
  535. V2 = binary:copy(TemStrV2);
  536. _ ->
  537. V2 = TemStrV2
  538. end
  539. end,
  540. {testHer, tstring, {tstring, V1, V2}};
  541. decodeBin(20, LeftBin0) ->
  542. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  543. <<ListBin1:Len1/big-binary-unit:8, LeftBin2/binary>> = LeftBin1,
  544. V1 = [TemV =:= 1 || <<TemV:8/big-unsigned>> <= ListBin1],
  545. {testHer, tlistbool, {tlistbool, V1}};
  546. decodeBin(21, LeftBin0) ->
  547. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  548. <<ListBin1:Len1/big-binary-unit:8, LeftBin2/binary>> = LeftBin1,
  549. V1 = [TemV || <<TemV:8/big-signed>> <= ListBin1],
  550. {testHer, tlistint8, {tlistint8, V1}};
  551. decodeBin(22, LeftBin0) ->
  552. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  553. <<ListBin1:Len1/big-binary-unit:8, LeftBin2/binary>> = LeftBin1,
  554. V1 = [TemV || <<TemV:8/big-unsigned>> <= ListBin1],
  555. {testHer, tlistuint8, {tlistuint8, V1}};
  556. decodeBin(23, LeftBin0) ->
  557. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  558. <<ListBin1:Len1/big-binary-unit:16, LeftBin2/binary>> = LeftBin1,
  559. V1 = [TemV || <<TemV:16/big-signed>> <= ListBin1],
  560. {testHer, tlistint16, {tlistint16, V1}};
  561. decodeBin(24, LeftBin0) ->
  562. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  563. <<ListBin1:Len1/big-binary-unit:16, LeftBin2/binary>> = LeftBin1,
  564. V1 = [TemV || <<TemV:16/big-unsigned>> <= ListBin1],
  565. {testHer, tlistuint16, {tlistuint16, V1}};
  566. decodeBin(25, LeftBin0) ->
  567. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  568. <<ListBin1:Len1/big-binary-unit:32, LeftBin2/binary>> = LeftBin1,
  569. V1 = [TemV || <<TemV:32/big-signed>> <= ListBin1],
  570. {testHer, tlistint32, {tlistint32, V1}};
  571. decodeBin(26, LeftBin0) ->
  572. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  573. <<ListBin1:Len1/big-binary-unit:32, LeftBin2/binary>> = LeftBin1,
  574. V1 = [TemV || <<TemV:32/big-unsigned>> <= ListBin1],
  575. {testHer, tlistuint32, {tlistuint32, V1}};
  576. decodeBin(27, LeftBin0) ->
  577. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  578. <<ListBin1:Len1/big-binary-unit:64, LeftBin2/binary>> = LeftBin1,
  579. V1 = [TemV || <<TemV:64/big-signed>> <= ListBin1],
  580. {testHer, tlistint64, {tlistint64, V1}};
  581. decodeBin(28, LeftBin0) ->
  582. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  583. <<ListBin1:Len1/big-binary-unit:64, LeftBin2/binary>> = LeftBin1,
  584. V1 = [TemV || <<TemV:64/big-unsigned>> <= ListBin1],
  585. {testHer, tlistuint64, {tlistuint64, V1}};
  586. decodeBin(29, LeftBin0) ->
  587. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  588. {V1, LeftBin2} = deIntegerList(Len1, LeftBin1, []),
  589. {testHer, tlistinteger, {tlistinteger, V1}};
  590. decodeBin(30, LeftBin0) ->
  591. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  592. {V1, LeftBin2} = deNumberList(Len1, LeftBin1, []),
  593. {testHer, tlistnumber, {tlistnumber, V1}};
  594. decodeBin(31, LeftBin0) ->
  595. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  596. <<ListBin1:Len1/big-binary-unit:32, LeftBin2/binary>> = LeftBin1,
  597. V1 = [TemV || <<TemV:32/big-float>> <= ListBin1],
  598. {testHer, tlistfloat, {tlistfloat, V1}};
  599. decodeBin(32, LeftBin0) ->
  600. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  601. <<ListBin1:Len1/big-binary-unit:64, LeftBin2/binary>> = LeftBin1,
  602. V1 = [TemV || <<TemV:64/big-float>> <= ListBin1],
  603. {testHer, tlistdouble, {tlistdouble, V1}};
  604. decodeBin(33, LeftBin0) ->
  605. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  606. RefSize = binary:referenced_byte_size(LeftBin0),
  607. {V1, LeftBin2} = deStringList(Len1, LeftBin1, RefSize, []),
  608. {testHer, tliststring, {tliststring, V1}};
  609. decodeBin(34, LeftBin0) ->
  610. <<Len1:16/big-unsigned, LeftBin1/binary>> = LeftBin0,
  611. {V1, LeftBin2} = deRecordList(Len1, 5, LeftBin1, []),
  612. {testHer, tlistunion, {tlistunion, V1}};
  613. decodeBin(35, LeftBin0) ->
  614. <<Bool1:8/big-unsigned, LeftBin1/binary>> = LeftBin0,
  615. V1 = Bool1 =:= 1,
  616. <<V2:8/big-signed, V3:8/big-unsigned, V4:16/big-signed, V5:16/big-unsigned, V6:32/big-signed, V7:32/big-unsigned, V8:64/big-signed, V9:64/big-unsigned, IntBits1:8, V10:IntBits1/big-signed, IntBits2:8, V11:IntBits2/big-signed, IntBits3:8, V12:IntBits3/big-signed, IntBits4:8, V13:IntBits4/big-signed, IntBits5:8, V14:IntBits5/big-signed, IntBits6:8, V15:IntBits6/big-signed, IntBits7:8, V16:IntBits7/big-signed, IntBits8:8, V17:IntBits8/big-signed, LeftBin2/binary>> = LeftBin1,
  617. <<NumBits1:8, LeftBin3/binary>> = LeftBin2,
  618. case NumBits1 of
  619. 33->
  620. <<V18:32/big-float, LeftBin4/binary>> = LeftBin3;
  621. 65 ->
  622. <<V18:64/big-float, LeftBin4/binary>> = LeftBin3;
  623. _ ->
  624. <<V18:NumBits1/big-signed, LeftBin4/binary>> = LeftBin3
  625. end,
  626. <<NumBits2:8, LeftBin5/binary>> = LeftBin4,
  627. case NumBits2 of
  628. 33->
  629. <<V19:32/big-float, LeftBin6/binary>> = LeftBin5;
  630. 65 ->
  631. <<V19:64/big-float, LeftBin6/binary>> = LeftBin5;
  632. _ ->
  633. <<V19:NumBits2/big-signed, LeftBin6/binary>> = LeftBin5
  634. end,
  635. <<NumBits3:8, LeftBin7/binary>> = LeftBin6,
  636. case NumBits3 of
  637. 33->
  638. <<V20:32/big-float, LeftBin8/binary>> = LeftBin7;
  639. 65 ->
  640. <<V20:64/big-float, LeftBin8/binary>> = LeftBin7;
  641. _ ->
  642. <<V20:NumBits3/big-signed, LeftBin8/binary>> = LeftBin7
  643. end,
  644. <<NumBits4:8, LeftBin9/binary>> = LeftBin8,
  645. case NumBits4 of
  646. 33->
  647. <<V21:32/big-float, LeftBin10/binary>> = LeftBin9;
  648. 65 ->
  649. <<V21:64/big-float, LeftBin10/binary>> = LeftBin9;
  650. _ ->
  651. <<V21:NumBits4/big-signed, LeftBin10/binary>> = LeftBin9
  652. end,
  653. <<NumBits5:8, LeftBin11/binary>> = LeftBin10,
  654. case NumBits5 of
  655. 33->
  656. <<V22:32/big-float, LeftBin12/binary>> = LeftBin11;
  657. 65 ->
  658. <<V22:64/big-float, LeftBin12/binary>> = LeftBin11;
  659. _ ->
  660. <<V22:NumBits5/big-signed, LeftBin12/binary>> = LeftBin11
  661. end,
  662. <<NumBits6:8, LeftBin13/binary>> = LeftBin12,
  663. case NumBits6 of
  664. 33->
  665. <<V23:32/big-float, LeftBin14/binary>> = LeftBin13;
  666. 65 ->
  667. <<V23:64/big-float, LeftBin14/binary>> = LeftBin13;
  668. _ ->
  669. <<V23:NumBits6/big-signed, LeftBin14/binary>> = LeftBin13
  670. end,
  671. <<NumBits7:8, LeftBin15/binary>> = LeftBin14,
  672. case NumBits7 of
  673. 33->
  674. <<V24:32/big-float, LeftBin16/binary>> = LeftBin15;
  675. 65 ->
  676. <<V24:64/big-float, LeftBin16/binary>> = LeftBin15;
  677. _ ->
  678. <<V24:NumBits7/big-signed, LeftBin16/binary>> = LeftBin15
  679. end,
  680. <<NumBits8:8, LeftBin17/binary>> = LeftBin16,
  681. case NumBits8 of
  682. 33->
  683. <<V25:32/big-float, LeftBin18/binary>> = LeftBin17;
  684. 65 ->
  685. <<V25:64/big-float, LeftBin18/binary>> = LeftBin17;
  686. _ ->
  687. <<V25:NumBits8/big-signed, LeftBin18/binary>> = LeftBin17
  688. end,
  689. <<NumBits9:8, LeftBin19/binary>> = LeftBin18,
  690. case NumBits9 of
  691. 33->
  692. <<V26:32/big-float, LeftBin20/binary>> = LeftBin19;
  693. 65 ->
  694. <<V26:64/big-float, LeftBin20/binary>> = LeftBin19;
  695. _ ->
  696. <<V26:NumBits9/big-signed, LeftBin20/binary>> = LeftBin19
  697. end,
  698. <<NumBits10:8, LeftBin21/binary>> = LeftBin20,
  699. case NumBits10 of
  700. 33->
  701. <<V27:32/big-float, LeftBin22/binary>> = LeftBin21;
  702. 65 ->
  703. <<V27:64/big-float, LeftBin22/binary>> = LeftBin21;
  704. _ ->
  705. <<V27:NumBits10/big-signed, LeftBin22/binary>> = LeftBin21
  706. end,
  707. <<V28:32/big-float, V29:64/big-float, LeftBin23/binary>> = LeftBin22,
  708. RefSize = binary:referenced_byte_size(LeftBin0),
  709. <<Len1:16/big-unsigned, TemStrV30:Len1/binary, LeftBin24/binary>> = LeftBin23,
  710. case Len1 < ?BinaryShareSize of
  711. true ->
  712. V30 = TemStrV30;
  713. _ ->
  714. case RefSize / Len1 > ?BinaryCopyRatio of
  715. true ->
  716. V30 = binary:copy(TemStrV30);
  717. _ ->
  718. V30 = TemStrV30
  719. end
  720. end,
  721. <<Len2:16/big-unsigned, TemStrV31:Len2/binary, LeftBin25/binary>> = LeftBin24,
  722. case Len2 < ?BinaryShareSize of
  723. true ->
  724. V31 = TemStrV31;
  725. _ ->
  726. case RefSize / Len2 > ?BinaryCopyRatio of
  727. true ->
  728. V31 = binary:copy(TemStrV31);
  729. _ ->
  730. V31 = TemStrV31
  731. end
  732. end,
  733. <<IsUndef1:8/big-unsigned, LeftBin26/binary>> = LeftBin25,
  734. case IsUndef1 of
  735. 0 ->
  736. V32 = undefined,
  737. LeftBin27 = LeftBin26 ;
  738. _ ->
  739. {V32, LeftBin27} = decodeRec(5, LeftBin26)
  740. end,
  741. <<Len3:16/big-unsigned, LeftBin28/binary>> = LeftBin27,
  742. <<ListBin1:Len3/big-binary-unit:8, LeftBin29/binary>> = LeftBin28,
  743. V33 = [TemV =:= 1 || <<TemV:8/big-unsigned>> <= ListBin1],
  744. <<Len4:16/big-unsigned, LeftBin30/binary>> = LeftBin29,
  745. <<ListBin2:Len4/big-binary-unit:8, LeftBin31/binary>> = LeftBin30,
  746. V34 = [TemV || <<TemV:8/big-signed>> <= ListBin2],
  747. <<Len5:16/big-unsigned, LeftBin32/binary>> = LeftBin31,
  748. <<ListBin3:Len5/big-binary-unit:8, LeftBin33/binary>> = LeftBin32,
  749. V35 = [TemV || <<TemV:8/big-unsigned>> <= ListBin3],
  750. <<Len6:16/big-unsigned, LeftBin34/binary>> = LeftBin33,
  751. <<ListBin4:Len6/big-binary-unit:16, LeftBin35/binary>> = LeftBin34,
  752. V36 = [TemV || <<TemV:16/big-signed>> <= ListBin4],
  753. <<Len7:16/big-unsigned, LeftBin36/binary>> = LeftBin35,
  754. <<ListBin5:Len7/big-binary-unit:16, LeftBin37/binary>> = LeftBin36,
  755. V37 = [TemV || <<TemV:16/big-unsigned>> <= ListBin5],
  756. <<Len8:16/big-unsigned, LeftBin38/binary>> = LeftBin37,
  757. <<ListBin6:Len8/big-binary-unit:32, LeftBin39/binary>> = LeftBin38,
  758. V38 = [TemV || <<TemV:32/big-signed>> <= ListBin6],
  759. <<Len9:16/big-unsigned, LeftBin40/binary>> = LeftBin39,
  760. <<ListBin7:Len9/big-binary-unit:32, LeftBin41/binary>> = LeftBin40,
  761. V39 = [TemV || <<TemV:32/big-unsigned>> <= ListBin7],
  762. <<Len10:16/big-unsigned, LeftBin42/binary>> = LeftBin41,
  763. <<ListBin8:Len10/big-binary-unit:64, LeftBin43/binary>> = LeftBin42,
  764. V40 = [TemV || <<TemV:64/big-signed>> <= ListBin8],
  765. <<Len11:16/big-unsigned, LeftBin44/binary>> = LeftBin43,
  766. <<ListBin9:Len11/big-binary-unit:64, LeftBin45/binary>> = LeftBin44,
  767. V41 = [TemV || <<TemV:64/big-unsigned>> <= ListBin9],
  768. <<Len12:16/big-unsigned, LeftBin46/binary>> = LeftBin45,
  769. {V42, LeftBin47} = deIntegerList(Len12, LeftBin46, []),
  770. <<Len13:16/big-unsigned, LeftBin48/binary>> = LeftBin47,
  771. {V43, LeftBin49} = deIntegerList(Len13, LeftBin48, []),
  772. <<Len14:16/big-unsigned, LeftBin50/binary>> = LeftBin49,
  773. {V44, LeftBin51} = deIntegerList(Len14, LeftBin50, []),
  774. <<Len15:16/big-unsigned, LeftBin52/binary>> = LeftBin51,
  775. {V45, LeftBin53} = deIntegerList(Len15, LeftBin52, []),
  776. <<Len16:16/big-unsigned, LeftBin54/binary>> = LeftBin53,
  777. {V46, LeftBin55} = deNumberList(Len16, LeftBin54, []),
  778. <<Len17:16/big-unsigned, LeftBin56/binary>> = LeftBin55,
  779. {V47, LeftBin57} = deNumberList(Len17, LeftBin56, []),
  780. <<Len18:16/big-unsigned, LeftBin58/binary>> = LeftBin57,
  781. {V48, LeftBin59} = deNumberList(Len18, LeftBin58, []),
  782. <<Len19:16/big-unsigned, LeftBin60/binary>> = LeftBin59,
  783. {V49, LeftBin61} = deNumberList(Len19, LeftBin60, []),
  784. <<Len20:16/big-unsigned, LeftBin62/binary>> = LeftBin61,
  785. {V50, LeftBin63} = deNumberList(Len20, LeftBin62, []),
  786. <<Len21:16/big-unsigned, LeftBin64/binary>> = LeftBin63,
  787. {V51, LeftBin65} = deNumberList(Len21, LeftBin64, []),
  788. <<Len22:16/big-unsigned, LeftBin66/binary>> = LeftBin65,
  789. <<ListBin20:Len22/big-binary-unit:32, LeftBin67/binary>> = LeftBin66,
  790. V52 = [TemV || <<TemV:32/big-float>> <= ListBin20],
  791. <<Len23:16/big-unsigned, LeftBin68/binary>> = LeftBin67,
  792. <<ListBin21:Len23/big-binary-unit:64, LeftBin69/binary>> = LeftBin68,
  793. V53 = [TemV || <<TemV:64/big-float>> <= ListBin21],
  794. <<Len24:16/big-unsigned, LeftBin70/binary>> = LeftBin69,
  795. {V54, LeftBin71} = deStringList(Len24, LeftBin70, RefSize, []),
  796. <<Len25:16/big-unsigned, LeftBin72/binary>> = LeftBin71,
  797. {V55, LeftBin73} = deRecordList(Len25, 5, LeftBin72, []),
  798. {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}};
  799. decodeBin(36, LeftBin0) ->
  800. {testHer, testnull, {testnull}};
  801. decodeBin(1001, LeftBin0) ->
  802. RefSize = binary:referenced_byte_size(LeftBin0),
  803. <<Len1:16/big-unsigned, TemStrV1:Len1/binary, LeftBin1/binary>> = LeftBin0,
  804. case Len1 < ?BinaryShareSize of
  805. true ->
  806. V1 = TemStrV1;
  807. _ ->
  808. case RefSize / Len1 > ?BinaryCopyRatio of
  809. true ->
  810. V1 = binary:copy(TemStrV1);
  811. _ ->
  812. V1 = TemStrV1
  813. end
  814. end,
  815. <<V2:32/big-signed, LeftBin2/binary>> = LeftBin1,
  816. <<Len2:16/big-unsigned, TemStrV3:Len2/binary, LeftBin3/binary>> = LeftBin2,
  817. case Len2 < ?BinaryShareSize of
  818. true ->
  819. V3 = TemStrV3;
  820. _ ->
  821. case RefSize / Len2 > ?BinaryCopyRatio of
  822. true ->
  823. V3 = binary:copy(TemStrV3);
  824. _ ->
  825. V3 = TemStrV3
  826. end
  827. end,
  828. <<Len3:16/big-unsigned, LeftBin4/binary>> = LeftBin3,
  829. {V4, LeftBin5} = deRecordList(Len3, 2, LeftBin4, []),
  830. {errorHer, person1, {person1, V1, V2, V3, V4}};
  831. decodeBin(_, _) ->
  832. {undefinedHer, undefined, {}}.
  833. getMsgName(1)-> test;
  834. getMsgName(2)-> phoneNumber;
  835. getMsgName(3)-> person;
  836. getMsgName(4)-> addressBook;
  837. getMsgName(5)-> union;
  838. getMsgName(6)-> tbool;
  839. getMsgName(7)-> tint8;
  840. getMsgName(8)-> tuint8;
  841. getMsgName(9)-> tint16;
  842. getMsgName(10)-> tuint16;
  843. getMsgName(11)-> tint32;
  844. getMsgName(12)-> tuint32;
  845. getMsgName(13)-> tint64;
  846. getMsgName(14)-> tuint64;
  847. getMsgName(15)-> tinteger;
  848. getMsgName(16)-> tnumber;
  849. getMsgName(17)-> tfloat;
  850. getMsgName(18)-> tdouble;
  851. getMsgName(19)-> tstring;
  852. getMsgName(20)-> tlistbool;
  853. getMsgName(21)-> tlistint8;
  854. getMsgName(22)-> tlistuint8;
  855. getMsgName(23)-> tlistint16;
  856. getMsgName(24)-> tlistuint16;
  857. getMsgName(25)-> tlistint32;
  858. getMsgName(26)-> tlistuint32;
  859. getMsgName(27)-> tlistint64;
  860. getMsgName(28)-> tlistuint64;
  861. getMsgName(29)-> tlistinteger;
  862. getMsgName(30)-> tlistnumber;
  863. getMsgName(31)-> tlistfloat;
  864. getMsgName(32)-> tlistdouble;
  865. getMsgName(33)-> tliststring;
  866. getMsgName(34)-> tlistunion;
  867. getMsgName(35)-> allType;
  868. getMsgName(36)-> testnull;
  869. getMsgName(1001)-> person1;
  870. getMsgName(_) -> undefiend.