+55.5.0+dev0-2025-04-28/'Marshal,extern_flagsA;@@*No_sharing@@8../../stdlib/marshal.mlix  x  @@'MarshalA@(Closures@@ y   y  @@ B@)Compat_32@@z 6 8z 6 C@@C@@@A@@@@@w  @@A@@@A@*to_channel@&Stdlib +out_channel@@@@!a@B@@$list"'Marshal!,extern_flags@@@@@@$unit#@@@@@@@@@@I~  J~  @@HD@@(to_bytes@!a@B@@(%'Marshal$,extern_flags@@@@@@%bytes&@@@@@@@:caml_output_value_to_bytesBA @@@@vtjjwu~@@uE@@)to_string@!a@B@@U('Marshal',extern_flags@@@@@@&string)@@@@@@@;caml_output_value_to_stringBA-@@@@|}@@F@@)to_buffer@C*@@@@#int+@@@@,@@@@!a@B@@.'Marshal-,extern_flags@@@@@@%/@@@@@@@@@@@@@@777|@@G@@,from_channel@&Stdlib0*in_channel@@@!a@B@@@@@@H@@*from_bytes@1@@@@U2@@@!a@B@@@@@@@@I@@+from_string@3@@@@r4@@@!a@B@@@@@@12 $@@0J@@+header_size5@@@@?  @  @@>K@@)data_size@6@@@@7@@@8@@@@@@@@[$$\$$@@ZL@@*total_size@9@@@@:@@@;@@@@@@@@w$$x$%@@vM@@@3>Marshaling of data structures.@  This module provides functions to encode arbitrary data structures as sequences of bytes, which can then be written on a file or sent over a pipe or network connection. The bytes can then be read back later, possibly in another process, and decoded back into a data structure. The format for the byte sequences is compatible across all machines for a given version of OCaml.@  Warning: marshaling is currently not type-safe. The type of marshaled data is not transmitted along the value of the data, making it impossible to check that the data read back possesses the type expected by the context. In particular, the result type of the .Marshal.from_*7 functions is given as "'a L, but this is misleading: the returned OCaml value does not possess type "'a, for all "'a ; it has one, unique type which cannot be determined at compile-time. The programmer should explicitly give the expected type of the returned value, using the following syntax: "(Marshal.from_channel chan : type) d. Anything can happen at run-time if the object in the file does not belong to the given type.@@ V Values of extensible variant types, for example exceptions (of extensible type #exn N), returned by the unmarshaller should not be pattern-matched over through .match ... with$ or ,try ... with  , because unmarshalling does not preserve the information required for matching their constructors. Structural equalities with other extensible variant values does not work either. Most other uses such as Printexc.to_string, will still work as expected.@ The representation of marshaled values is not human-readable, and uses bytes that are not printable characters. Therefore, input and output channels used in conjunction with 2Marshal.to_channel( and 4Marshal.from_channel . must be opened in binary mode, using e.g. ,open_out_bin$ or +open_in_bin ; channels opened in text mode will cause unmarshaling errors on platforms where text channels behave differently than binary channels, e.g. Windows.@@@@@@@@@@@@A8../../stdlib/marshal.mli#4Marshal.extern_flags@@@@36Don't preserve sharing@@@@@@@@@@@@@@36Send function closures@@@@@@@@@@@@@@3;Ensure 32-bit compatibility@@@@@@@@@@@@@A@@@@1The flags to the ,Marshal.to_*1 functions below.@2Marshal.to_channel3?Marshal.to_channel chan v flags ! writes the representation of !v, on channel $chan&. The %flags argument is a possibly empty list of flags that governs the marshaling behavior with respect to sharing, functional values, and compatibility between 32- and 64-bit platforms.@' If %flags2 does not contain 2Marshal.No_sharing 0, circularities and sharing inside the value !v are detected and preserved in the sequence of bytes produced. In particular, this guarantees that marshaling always terminates. Sharing between values marshaled by successive calls to 2Marshal.to_channel 2 is neither detected nor preserved, though. If %flags* contains 2Marshal.No_sharing >, sharing is ignored. This results in faster marshaling if !v l contains no shared substructures, but may cause slower marshaling and larger byte representations if !v : actually contains sharing, or even non-termination if !v1 contains cycles.@' If %flags2 does not contain 0Marshal.Closures C, marshaling fails when it encounters a functional value inside !v : only 'pure' data structures, containing neither functions nor objects, can safely be transmitted between different programs. If %flags- contains 0Marshal.Closures , functional values will be marshaled as a the position in the code of the program together with the values corresponding to the free variables captured in the closure. In this case, the output of marshaling can only be read back in processes that run exactly the same program, with exactly the same compiled code. (This is checked at un-marshaling time, using an MD5 digest of the code transmitted along with the code position.)@  The exact definition of which free variables are captured in a closure is not specified and can vary between bytecode and native code (and according to optimization flags). In particular, a function value accessing a global reference may or may not include the reference in its closure. If it does, unmarshaling the corresponding closure will create a new reference, different from the global one.@' If %flags* contains 1Marshal.Compat_32 L, marshaling fails when it encounters an integer value outside the range "-2"30@", !2"30@"-1 of integers that are representable on a 32-bit platform. This ensures that marshaled data generated on a 64-bit platform can be safely read back on a 32-bit platform. If %flags5 does not contain 1Marshal.Compat_32 &, integer values outside the range "-2"30@", !2"30@"-1 are marshaled, and can be read back on a 64-bit platform, but will cause an error at un-marshaling time when read back on a 32-bit platform. The 0Mashal.Compat_32 flag only matters when marshaling is performed on a 64-bit platform; it has no effect if marshaling is performed on a 32-bit platform.@@@@@@@@'Failure#if $chan7 is not in binary mode.@@@@@@ @@@@@@0Marshal.to_bytes38Marshal.to_bytes v flags = returns a byte sequence containing the representation of !v). The %flags ) argument has the same meaning as for D@!.@@@@$4.02@@@@@@@@-@0@@@@1Marshal.to_string3(Same as (to_bytes B but return the result as a string instead of a byte sequence.@@@@@@@@@@@@@E@H@@@@1Marshal.to_buffer3 &Marshal.to_buffer buff ofs len v flags4 marshals the value !v 5, storing its byte representation in the sequence $buff7, starting at index #ofs9, and writing at most #len n bytes. It returns the number of bytes actually written to the sequence. If the byte representation of !v1 does not fit in #len; characters, the exception 'Failure. is raised.@@@@@@@@@@@@@@@@@@@@@4Marshal.from_channel39Marshal.from_channel chan4 reads from channel $chan P the byte representation of a structured value, as produced by one of the ,Marshal.to_* D functions, and reconstructs and returns the corresponding value.@@@@@@@@+End_of_file#if $chan # is already at the end of the file.@'Failure Gif the end of the file is reached during unmarshalling itself or if $chan7 is not in binary mode.@@@@@@@@@@2Marshal.from_bytes3;Marshal.from_bytes buff ofs ' unmarshals a structured value like BD@ n does, except that the byte representation is not read from a channel, but taken from the byte sequence $buff7, starting at position #ofs &. The byte sequence is not mutated.@@@@$4.02@@@@@@@@@@@@@ʠ3Marshal.from_string3(Same as *from_bytes > but take a string as argument instead of a byte sequence.@@@@@@@@@@@@@@@@@@Š3Marshal.header_size3 The bytes representing a marshaled value are composed of a fixed-size header and a variable-sized data part, whose size can be determined from the header.  D@ * is the size, in bytes, of the header. 1Marshal.data_sizeD@) buff ofs U is the size, in bytes, of the data part, assuming a valid header is stored in $buff6 starting at position #ofs.. Finally, 2Marshal.total_sizeD@! (buff ofs A is the total size, in bytes, of the marshaled value. Both #D@% and D@' raise 'Failure' if $buff", #ofs ! does not contain a valid header.@ u To read the byte representation of a marshaled value into a byte sequence, the program needs to read first TD@ g bytes into the sequence, then determine the length of the remainder of the representation using KD@ j, make sure the sequence is large enough to hold the remaining data, then read it, and finally call D@; to unmarshal the value.@@@@@@@@@@@@#@@@@ Z3$See qD@!.@@@@@@@@@@@@&@'@#@@@@[3$See D@!.@@@@@@@@@@@@!@"@@@@@A3marshal_concurrency9Marshal and domain safety@@ S Care must be taken when marshaling a mutable value that may be modified by a different domain. Mutating a value that is being marshaled (i.e., turned into a sequence of bytes) is a programming error and might result in surprising values (when unmarshaling) due to tearing, since marshaling involves byte-per-byte copy.@@@@@A@@@@@