-(** .moo file format
- * - an integer -- magic number -- denoting the version of the dumped data
- * structure. Different magic numbers stand for incompatible data structures
- * - an integer -- checksum -- denoting the hash value (computed with
- * Hashtbl.hash) of the string representation of the dumped data structur
- * - marshalled data: list of GrafiteAst.command
- *)
-
-let save_moo ~fname moo =
- let ensure_path_exists path =
- let dir = Filename.dirname path in
- HExtlib.mkdir dir
- in
- ensure_path_exists fname;
- let oc = open_out fname in
- let marshalled = Marshal.to_string (List.rev moo) marshal_flags in
- let checksum = Hashtbl.hash marshalled in
- output_binary_int oc GrafiteAst.magic;
- output_binary_int oc checksum;
- output_string oc marshalled;
- close_out oc