tmp_biniou_b.ml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. (* Auto-generated from "tmp_biniou.atd" *)
  2. type rc_name = Tmp_biniou_t.rc_name
  3. type rc_entry = Tmp_biniou_t.rc_entry = { commands: (string * int) }
  4. type tmp_file = Tmp_biniou_t.tmp_file = {
  5. rc: (rc_name * (rc_entry list)) list;
  6. daemon: int
  7. }
  8. let rc_name_tag = Bi_io.string_tag
  9. let write_untagged_rc_name = (
  10. Bi_io.write_untagged_string
  11. )
  12. let write_rc_name ob x =
  13. Bi_io.write_tag ob Bi_io.string_tag;
  14. write_untagged_rc_name ob x
  15. let string_of_rc_name ?(len = 1024) x =
  16. let ob = Bi_outbuf.create len in
  17. write_rc_name ob x;
  18. Bi_outbuf.contents ob
  19. let get_rc_name_reader = (
  20. Ag_ob_run.get_string_reader
  21. )
  22. let read_rc_name = (
  23. Ag_ob_run.read_string
  24. )
  25. let rc_name_of_string ?pos s =
  26. read_rc_name (Bi_inbuf.from_string ?pos s)
  27. let rc_entry_tag = Bi_io.record_tag
  28. let write_untagged_rc_entry : Bi_outbuf.t -> rc_entry -> unit = (
  29. fun ob x ->
  30. Bi_vint.write_uvint ob 1;
  31. Bi_outbuf.add_char4 ob '\190' 'U' '\176' '\200';
  32. (
  33. fun ob x ->
  34. Bi_io.write_tag ob Bi_io.tuple_tag;
  35. Bi_vint.write_uvint ob 2;
  36. (
  37. let x, _ = x in (
  38. Bi_io.write_string
  39. ) ob x
  40. );
  41. (
  42. let _, x = x in (
  43. Bi_io.write_svint
  44. ) ob x
  45. );
  46. ) ob x.commands;
  47. )
  48. let write_rc_entry ob x =
  49. Bi_io.write_tag ob Bi_io.record_tag;
  50. write_untagged_rc_entry ob x
  51. let string_of_rc_entry ?(len = 1024) x =
  52. let ob = Bi_outbuf.create len in
  53. write_rc_entry ob x;
  54. Bi_outbuf.contents ob
  55. let get_rc_entry_reader = (
  56. fun tag ->
  57. if tag <> 21 then Ag_ob_run.read_error () else
  58. fun ib ->
  59. let field_commands = ref (Obj.magic (Sys.opaque_identity 0.0)) in
  60. let bits0 = ref 0 in
  61. let len = Bi_vint.read_uvint ib in
  62. for i = 1 to len do
  63. match Bi_io.read_field_hashtag ib with
  64. | 1045803208 ->
  65. field_commands := (
  66. (
  67. fun ib ->
  68. if Bi_io.read_tag ib <> 20 then Ag_ob_run.read_error_at ib;
  69. let len = Bi_vint.read_uvint ib in
  70. if len < 2 then Ag_ob_run.missing_tuple_fields len [ 0; 1 ];
  71. let x0 =
  72. (
  73. Ag_ob_run.read_string
  74. ) ib
  75. in
  76. let x1 =
  77. (
  78. Ag_ob_run.read_int
  79. ) ib
  80. in
  81. for i = 2 to len - 1 do Bi_io.skip ib done;
  82. (x0, x1)
  83. ) ib
  84. );
  85. bits0 := !bits0 lor 0x1;
  86. | _ -> Bi_io.skip ib
  87. done;
  88. if !bits0 <> 0x1 then Ag_ob_run.missing_fields [| !bits0 |] [| "commands" |];
  89. (
  90. {
  91. commands = !field_commands;
  92. }
  93. : rc_entry)
  94. )
  95. let read_rc_entry = (
  96. fun ib ->
  97. if Bi_io.read_tag ib <> 21 then Ag_ob_run.read_error_at ib;
  98. let field_commands = ref (Obj.magic (Sys.opaque_identity 0.0)) in
  99. let bits0 = ref 0 in
  100. let len = Bi_vint.read_uvint ib in
  101. for i = 1 to len do
  102. match Bi_io.read_field_hashtag ib with
  103. | 1045803208 ->
  104. field_commands := (
  105. (
  106. fun ib ->
  107. if Bi_io.read_tag ib <> 20 then Ag_ob_run.read_error_at ib;
  108. let len = Bi_vint.read_uvint ib in
  109. if len < 2 then Ag_ob_run.missing_tuple_fields len [ 0; 1 ];
  110. let x0 =
  111. (
  112. Ag_ob_run.read_string
  113. ) ib
  114. in
  115. let x1 =
  116. (
  117. Ag_ob_run.read_int
  118. ) ib
  119. in
  120. for i = 2 to len - 1 do Bi_io.skip ib done;
  121. (x0, x1)
  122. ) ib
  123. );
  124. bits0 := !bits0 lor 0x1;
  125. | _ -> Bi_io.skip ib
  126. done;
  127. if !bits0 <> 0x1 then Ag_ob_run.missing_fields [| !bits0 |] [| "commands" |];
  128. (
  129. {
  130. commands = !field_commands;
  131. }
  132. : rc_entry)
  133. )
  134. let rc_entry_of_string ?pos s =
  135. read_rc_entry (Bi_inbuf.from_string ?pos s)
  136. let _1_tag = Bi_io.array_tag
  137. let write_untagged__1 = (
  138. Ag_ob_run.write_untagged_list
  139. rc_entry_tag
  140. (
  141. write_untagged_rc_entry
  142. )
  143. )
  144. let write__1 ob x =
  145. Bi_io.write_tag ob Bi_io.array_tag;
  146. write_untagged__1 ob x
  147. let string_of__1 ?(len = 1024) x =
  148. let ob = Bi_outbuf.create len in
  149. write__1 ob x;
  150. Bi_outbuf.contents ob
  151. let get__1_reader = (
  152. Ag_ob_run.get_list_reader (
  153. get_rc_entry_reader
  154. )
  155. )
  156. let read__1 = (
  157. Ag_ob_run.read_list (
  158. get_rc_entry_reader
  159. )
  160. )
  161. let _1_of_string ?pos s =
  162. read__1 (Bi_inbuf.from_string ?pos s)
  163. let _2_tag = Bi_io.array_tag
  164. let write_untagged__2 = (
  165. Ag_ob_run.write_untagged_list
  166. Bi_io.tuple_tag
  167. (
  168. fun ob x ->
  169. Bi_vint.write_uvint ob 2;
  170. (
  171. let x, _ = x in (
  172. write_rc_name
  173. ) ob x
  174. );
  175. (
  176. let _, x = x in (
  177. fun ob x ->
  178. Bi_io.write_tag ob Bi_io.tuple_tag;
  179. Bi_vint.write_uvint ob 1;
  180. (
  181. let x = x in (
  182. write__1
  183. ) ob x
  184. );
  185. ) ob x
  186. );
  187. )
  188. )
  189. let write__2 ob x =
  190. Bi_io.write_tag ob Bi_io.array_tag;
  191. write_untagged__2 ob x
  192. let string_of__2 ?(len = 1024) x =
  193. let ob = Bi_outbuf.create len in
  194. write__2 ob x;
  195. Bi_outbuf.contents ob
  196. let get__2_reader = (
  197. Ag_ob_run.get_list_reader (
  198. fun tag ->
  199. if tag <> 20 then Ag_ob_run.read_error () else
  200. fun ib ->
  201. let len = Bi_vint.read_uvint ib in
  202. if len < 2 then Ag_ob_run.missing_tuple_fields len [ 0; 1 ];
  203. let x0 =
  204. (
  205. read_rc_name
  206. ) ib
  207. in
  208. let x1 =
  209. (
  210. fun ib ->
  211. if Bi_io.read_tag ib <> 20 then Ag_ob_run.read_error_at ib;
  212. let len = Bi_vint.read_uvint ib in
  213. if len < 1 then Ag_ob_run.missing_tuple_fields len [ 0 ];
  214. let x0 =
  215. (
  216. read__1
  217. ) ib
  218. in
  219. for i = 1 to len - 1 do Bi_io.skip ib done;
  220. (x0)
  221. ) ib
  222. in
  223. for i = 2 to len - 1 do Bi_io.skip ib done;
  224. (x0, x1)
  225. )
  226. )
  227. let read__2 = (
  228. Ag_ob_run.read_list (
  229. fun tag ->
  230. if tag <> 20 then Ag_ob_run.read_error () else
  231. fun ib ->
  232. let len = Bi_vint.read_uvint ib in
  233. if len < 2 then Ag_ob_run.missing_tuple_fields len [ 0; 1 ];
  234. let x0 =
  235. (
  236. read_rc_name
  237. ) ib
  238. in
  239. let x1 =
  240. (
  241. fun ib ->
  242. if Bi_io.read_tag ib <> 20 then Ag_ob_run.read_error_at ib;
  243. let len = Bi_vint.read_uvint ib in
  244. if len < 1 then Ag_ob_run.missing_tuple_fields len [ 0 ];
  245. let x0 =
  246. (
  247. read__1
  248. ) ib
  249. in
  250. for i = 1 to len - 1 do Bi_io.skip ib done;
  251. (x0)
  252. ) ib
  253. in
  254. for i = 2 to len - 1 do Bi_io.skip ib done;
  255. (x0, x1)
  256. )
  257. )
  258. let _2_of_string ?pos s =
  259. read__2 (Bi_inbuf.from_string ?pos s)
  260. let tmp_file_tag = Bi_io.record_tag
  261. let write_untagged_tmp_file : Bi_outbuf.t -> tmp_file -> unit = (
  262. fun ob x ->
  263. Bi_vint.write_uvint ob 2;
  264. Bi_outbuf.add_char4 ob '\128' '\000' 'c' '\177';
  265. (
  266. write__2
  267. ) ob x.rc;
  268. Bi_outbuf.add_char4 ob '\152' '\163' '\253' '\132';
  269. (
  270. Bi_io.write_svint
  271. ) ob x.daemon;
  272. )
  273. let write_tmp_file ob x =
  274. Bi_io.write_tag ob Bi_io.record_tag;
  275. write_untagged_tmp_file ob x
  276. let string_of_tmp_file ?(len = 1024) x =
  277. let ob = Bi_outbuf.create len in
  278. write_tmp_file ob x;
  279. Bi_outbuf.contents ob
  280. let get_tmp_file_reader = (
  281. fun tag ->
  282. if tag <> 21 then Ag_ob_run.read_error () else
  283. fun ib ->
  284. let field_rc = ref (Obj.magic (Sys.opaque_identity 0.0)) in
  285. let field_daemon = ref (Obj.magic (Sys.opaque_identity 0.0)) in
  286. let bits0 = ref 0 in
  287. let len = Bi_vint.read_uvint ib in
  288. for i = 1 to len do
  289. match Bi_io.read_field_hashtag ib with
  290. | 25521 ->
  291. field_rc := (
  292. (
  293. read__2
  294. ) ib
  295. );
  296. bits0 := !bits0 lor 0x1;
  297. | 413400452 ->
  298. field_daemon := (
  299. (
  300. Ag_ob_run.read_int
  301. ) ib
  302. );
  303. bits0 := !bits0 lor 0x2;
  304. | _ -> Bi_io.skip ib
  305. done;
  306. if !bits0 <> 0x3 then Ag_ob_run.missing_fields [| !bits0 |] [| "rc"; "daemon" |];
  307. (
  308. {
  309. rc = !field_rc;
  310. daemon = !field_daemon;
  311. }
  312. : tmp_file)
  313. )
  314. let read_tmp_file = (
  315. fun ib ->
  316. if Bi_io.read_tag ib <> 21 then Ag_ob_run.read_error_at ib;
  317. let field_rc = ref (Obj.magic (Sys.opaque_identity 0.0)) in
  318. let field_daemon = ref (Obj.magic (Sys.opaque_identity 0.0)) in
  319. let bits0 = ref 0 in
  320. let len = Bi_vint.read_uvint ib in
  321. for i = 1 to len do
  322. match Bi_io.read_field_hashtag ib with
  323. | 25521 ->
  324. field_rc := (
  325. (
  326. read__2
  327. ) ib
  328. );
  329. bits0 := !bits0 lor 0x1;
  330. | 413400452 ->
  331. field_daemon := (
  332. (
  333. Ag_ob_run.read_int
  334. ) ib
  335. );
  336. bits0 := !bits0 lor 0x2;
  337. | _ -> Bi_io.skip ib
  338. done;
  339. if !bits0 <> 0x3 then Ag_ob_run.missing_fields [| !bits0 |] [| "rc"; "daemon" |];
  340. (
  341. {
  342. rc = !field_rc;
  343. daemon = !field_daemon;
  344. }
  345. : tmp_file)
  346. )
  347. let tmp_file_of_string ?pos s =
  348. read_tmp_file (Bi_inbuf.from_string ?pos s)