1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="previous" href="Misc.EnvLazy.html">
<link rel="Up" href="Misc.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg_helper" rel="Chapter" href="Arg_helper.html">
<link title="Ast_helper" rel="Chapter" href="Ast_helper.html">
<link title="Ast_invariants" rel="Chapter" href="Ast_invariants.html">
<link title="Ast_iterator" rel="Chapter" href="Ast_iterator.html">
<link title="Ast_mapper" rel="Chapter" href="Ast_mapper.html">
<link title="Asttypes" rel="Chapter" href="Asttypes.html">
<link title="Attr_helper" rel="Chapter" href="Attr_helper.html">
<link title="Build_path_prefix_map" rel="Chapter" href="Build_path_prefix_map.html">
<link title="Builtin_attributes" rel="Chapter" href="Builtin_attributes.html">
<link title="CamlinternalMenhirLib" rel="Chapter" href="CamlinternalMenhirLib.html">
<link title="Ccomp" rel="Chapter" href="Ccomp.html">
<link title="Clflags" rel="Chapter" href="Clflags.html">
<link title="Compiler_libs" rel="Chapter" href="Compiler_libs.html">
<link title="Config" rel="Chapter" href="Config.html">
<link title="Consistbl" rel="Chapter" href="Consistbl.html">
<link title="Depend" rel="Chapter" href="Depend.html">
<link title="Docstrings" rel="Chapter" href="Docstrings.html">
<link title="Domainstate" rel="Chapter" href="Domainstate.html">
<link title="Identifiable" rel="Chapter" href="Identifiable.html">
<link title="Int_replace_polymorphic_compare" rel="Chapter" href="Int_replace_polymorphic_compare.html">
<link title="Lexer" rel="Chapter" href="Lexer.html">
<link title="Load_path" rel="Chapter" href="Load_path.html">
<link title="Location" rel="Chapter" href="Location.html">
<link title="Longident" rel="Chapter" href="Longident.html">
<link title="Misc" rel="Chapter" href="Misc.html">
<link title="Numbers" rel="Chapter" href="Numbers.html">
<link title="Parse" rel="Chapter" href="Parse.html">
<link title="Parser" rel="Chapter" href="Parser.html">
<link title="Parsetree" rel="Chapter" href="Parsetree.html">
<link title="Pparse" rel="Chapter" href="Pparse.html">
<link title="Pprintast" rel="Chapter" href="Pprintast.html">
<link title="Printast" rel="Chapter" href="Printast.html">
<link title="Profile" rel="Chapter" href="Profile.html">
<link title="Strongly_connected_components" rel="Chapter" href="Strongly_connected_components.html">
<link title="Syntaxerr" rel="Chapter" href="Syntaxerr.html">
<link title="Targetint" rel="Chapter" href="Targetint.html">
<link title="Terminfo" rel="Chapter" href="Terminfo.html">
<link title="Warnings" rel="Chapter" href="Warnings.html"><link title="Parsing magic numbers" rel="Section" href="#3_Parsingmagicnumbers">
<link title="Checking that magic numbers are current" rel="Section" href="#3_Checkingthatmagicnumbersarecurrent">
<link title="Information on magic numbers" rel="Section" href="#3_Informationonmagicnumbers">
<link title="Raw representations" rel="Section" href="#3_Rawrepresentations">
<title>Misc.Magic_number</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Misc.EnvLazy.html" title="Misc.EnvLazy">Previous</a>
<a class="up" href="Misc.html" title="Misc">Up</a>
</div>
<h1>Module <a href="type_Misc.Magic_number.html">Misc.Magic_number</a></h1>
<pre><span id="MODULEMagic_number"><span class="keyword">module</span> Magic_number</span>: <code class="code"><span class="keyword">sig</span></code> <a href="Misc.Magic_number.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><hr width="100%">
<p>a typical magic number is "Caml1999I011"; it is formed of an
alphanumeric prefix, here Caml1990I, followed by a version,
here 011. The prefix identifies the kind of the versioned data:
here the I indicates that it is the magic number for .cmi files.</p>
<p>All magic numbers have the same byte length, <code class="code">magic_length</code>, and
this is important for users as it gives them the number of bytes
to read to obtain the byte sequence that should be a magic
number. Typical user code will look like:</p>
<pre class="codepre"><code class="code"> <span class="keyword">let</span> ic = open_in_bin path <span class="keyword">in</span>
<span class="keyword">let</span> magic =
<span class="keyword">try</span> really_input_string ic <span class="constructor">Magic_number</span>.magic_length
<span class="keyword">with</span> <span class="constructor">End_of_file</span> <span class="keywordsign">-></span> ... <span class="keyword">in</span>
<span class="keyword">match</span> <span class="constructor">Magic_number</span>.parse magic <span class="keyword">with</span>
<span class="keywordsign">|</span> <span class="constructor">Error</span> parse_error <span class="keywordsign">-></span> ...
<span class="keywordsign">|</span> <span class="constructor">Ok</span> info <span class="keywordsign">-></span> ...
</code></pre>
<p>A given compiler version expects one specific version for each
kind of object file, and will fail if given an unsupported
version. Because versions grow monotonically, you can compare
the parsed version with the expected "current version" for
a kind, to tell whether the wrong-magic object file comes from
the past or from the future.</p>
<p>An example of code block that expects the "currently supported version"
of a given kind of magic numbers, here <code class="code"><span class="constructor">Cmxa</span></code>, is as follows:</p>
<pre class="codepre"><code class="code"> <span class="keyword">let</span> ic = open_in_bin path <span class="keyword">in</span>
<span class="keyword">begin</span>
<span class="keyword">try</span> <span class="constructor">Magic_number</span>.(expect_current <span class="constructor">Cmxa</span> (get_info ic)) <span class="keyword">with</span>
<span class="keywordsign">|</span> <span class="constructor">Parse_error</span> error <span class="keywordsign">-></span> ...
<span class="keywordsign">|</span> <span class="constructor">Unexpected</span> error <span class="keywordsign">-></span> ...
<span class="keyword">end</span>;
...
</code></pre>
<p>Parse errors distinguish inputs that are <code class="code"><span class="constructor">Not_a_magic_number</span> str</code>,
which are likely to come from the file being completely
different, and <code class="code"><span class="constructor">Truncated</span> str</code>, raised by headers that are the
(possibly empty) prefix of a valid magic number.</p>
<p>Unexpected errors correspond to valid magic numbers that are not
the one expected, either because it corresponds to a different
kind, or to a newer or older version.</p>
<p>The helper functions <code class="code">explain_parse_error</code> and <code class="code">explain_unexpected_error</code>
will generate a textual explanation of each error,
for use in error messages.</p>
<pre><code><span id="TYPEnative_obj_config"><span class="keyword">type</span> <code class="type"></code>native_obj_config</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTnative_obj_config.flambda">flambda</span> : <code class="type">bool</code>;</code></td>
</tr></table>
<code>}</code>
<div class="info ">
<div class="info-desc">
<p>native object files have a format and magic number that depend
on certain native-compiler configuration parameters. This
configuration space is expressed by the <code class="code">native_obj_config</code>
type.</p>
</div>
</div>
<pre><span id="VALnative_obj_config"><span class="keyword">val</span> native_obj_config</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEnative_obj_config">native_obj_config</a></code></pre><div class="info ">
<div class="info-desc">
<p>the native object file configuration of the active/configured compiler.</p>
</div>
</div>
<pre><span id="TYPEversion"><span class="keyword">type</span> <code class="type"></code>version</span> = <code class="type">int</code> </pre>
<pre><code><span id="TYPEkind"><span class="keyword">type</span> <code class="type"></code>kind</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Exec"><span class="constructor">Exec</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Cmi"><span class="constructor">Cmi</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Cmo"><span class="constructor">Cmo</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Cma"><span class="constructor">Cma</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Cmx"><span class="constructor">Cmx</span></span> <span class="keyword">of</span> <code class="type"><a href="Misc.Magic_number.html#TYPEnative_obj_config">native_obj_config</a></code></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Cmxa"><span class="constructor">Cmxa</span></span> <span class="keyword">of</span> <code class="type"><a href="Misc.Magic_number.html#TYPEnative_obj_config">native_obj_config</a></code></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Cmxs"><span class="constructor">Cmxs</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Cmt"><span class="constructor">Cmt</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Ast_impl"><span class="constructor">Ast_impl</span></span></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTkind.Ast_intf"><span class="constructor">Ast_intf</span></span></code></td>
</tr></table>
<pre><code><span id="TYPEinfo"><span class="keyword">type</span> <code class="type"></code>info</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTinfo.kind">kind</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a></code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTinfo.version">version</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEversion">version</a></code>;</code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Note: some versions of the compiler use the same <code class="code">version</code> suffix
for all kinds, but others use different versions counters for different
kinds. We may only assume that versions are growing monotonically
(not necessarily always by one) between compiler versions.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>
<code>}</code>
<pre><span id="TYPEraw"><span class="keyword">type</span> <code class="type"></code>raw</span> = <code class="type">string</code> </pre>
<div class="info ">
<div class="info-desc">
<p>the type of raw magic numbers,
such as "Caml1999A027" for the .cma files of OCaml 4.10</p>
</div>
</div>
<h4 id="3_Parsingmagicnumbers">Parsing magic numbers</h4>
<pre><code><span id="TYPEparse_error"><span class="keyword">type</span> <code class="type"></code>parse_error</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTparse_error.Truncated"><span class="constructor">Truncated</span></span> <span class="keyword">of</span> <code class="type">string</code></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTparse_error.Not_a_magic_number"><span class="constructor">Not_a_magic_number</span></span> <span class="keyword">of</span> <code class="type">string</code></code></td>
</tr></table>
<pre><span id="VALexplain_parse_error"><span class="keyword">val</span> explain_parse_error</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a> option -> <a href="Misc.Magic_number.html#TYPEparse_error">parse_error</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Produces an explanation for a parse error. If no kind is provided,
we use an unspecific formulation suggesting that any compiler-produced
object file would have been satisfying.</p>
</div>
</div>
<pre><span id="VALparse"><span class="keyword">val</span> parse</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEraw">raw</a> -><br> (<a href="Misc.Magic_number.html#TYPEinfo">info</a>, <a href="Misc.Magic_number.html#TYPEparse_error">parse_error</a>) result</code></pre><div class="info ">
<div class="info-desc">
<p>Parses a raw magic number</p>
</div>
</div>
<pre><span id="VALread_info"><span class="keyword">val</span> read_info</span> : <code class="type">in_channel -><br> (<a href="Misc.Magic_number.html#TYPEinfo">info</a>, <a href="Misc.Magic_number.html#TYPEparse_error">parse_error</a>) result</code></pre><div class="info ">
<div class="info-desc">
<p>Read a raw magic number from an input channel.</p>
<p>If the data read <code class="code">str</code> is not a valid magic number, it can be
recovered from the <code class="code"><span class="constructor">Truncated</span> str <span class="keywordsign">|</span> <span class="constructor">Not_a_magic_number</span> str</code>
payload of the <code class="code"><span class="constructor">Error</span> parse_error</code> case.</p>
<p>If parsing succeeds with an <code class="code"><span class="constructor">Ok</span> info</code> result, we know that
exactly <code class="code">magic_length</code> bytes have been consumed from the
input_channel.</p>
<p>If you also wish to enforce that the magic number
is at the current version, see <a href="Misc.Magic_number.html#VALread_current_info"><code class="code"><span class="constructor">Misc</span>.<span class="constructor">Magic_number</span>.read_current_info</code></a> below.</p>
</div>
</div>
<pre><span id="VALmagic_length"><span class="keyword">val</span> magic_length</span> : <code class="type">int</code></pre><div class="info ">
<div class="info-desc">
<p>all magic numbers take the same number of bytes</p>
</div>
</div>
<h4 id="3_Checkingthatmagicnumbersarecurrent">Checking that magic numbers are current</h4>
<pre><code><span id="TYPEunexpected"><span class="keyword">type</span> <code class="type">'a</code> unexpected</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTunexpected.expected">expected</span> : <code class="type">'a</code>;</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code> </code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTunexpected.actual">actual</span> : <code class="type">'a</code>;</code></td>
</tr></table>
<code>}</code>
<pre><code><span id="TYPEunexpected_error"><span class="keyword">type</span> <code class="type"></code>unexpected_error</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTunexpected_error.Kind"><span class="constructor">Kind</span></span> <span class="keyword">of</span> <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a> <a href="Misc.Magic_number.html#TYPEunexpected">unexpected</a></code></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTunexpected_error.Version"><span class="constructor">Version</span></span> <span class="keyword">of</span> <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a><br> * <a href="Misc.Magic_number.html#TYPEversion">version</a> <a href="Misc.Magic_number.html#TYPEunexpected">unexpected</a></code></code></td>
</tr></table>
<pre><span id="VALcheck_current"><span class="keyword">val</span> check_current</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a> -><br> <a href="Misc.Magic_number.html#TYPEinfo">info</a> -><br> (unit, <a href="Misc.Magic_number.html#TYPEunexpected_error">unexpected_error</a>) result</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">check_current kind info</code> checks that the provided magic <code class="code">info</code>
is the current version of <code class="code">kind</code>'s magic header.</p>
</div>
</div>
<pre><span id="VALexplain_unexpected_error"><span class="keyword">val</span> explain_unexpected_error</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEunexpected_error">unexpected_error</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Provides an explanation of the <code class="code">unexpected_error</code>.</p>
</div>
</div>
<pre><code><span id="TYPEerror"><span class="keyword">type</span> <code class="type"></code>error</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTerror.Parse_error"><span class="constructor">Parse_error</span></span> <span class="keyword">of</span> <code class="type"><a href="Misc.Magic_number.html#TYPEparse_error">parse_error</a></code></code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTerror.Unexpected_error"><span class="constructor">Unexpected_error</span></span> <span class="keyword">of</span> <code class="type"><a href="Misc.Magic_number.html#TYPEunexpected_error">unexpected_error</a></code></code></td>
</tr></table>
<pre><span id="VALread_current_info"><span class="keyword">val</span> read_current_info</span> : <code class="type">expected_kind:<a href="Misc.Magic_number.html#TYPEkind">kind</a> option -><br> in_channel -><br> (<a href="Misc.Magic_number.html#TYPEinfo">info</a>, <a href="Misc.Magic_number.html#TYPEerror">error</a>) result</code></pre><div class="info ">
<div class="info-desc">
<p>Read a magic number as <code class="code">read_info</code>,
and check that it is the current version as its kind.
If the <code class="code">expected_kind</code> argument is <code class="code"><span class="constructor">None</span></code>, any kind is accepted.</p>
</div>
</div>
<h4 id="3_Informationonmagicnumbers">Information on magic numbers</h4>
<pre><span id="VALstring_of_kind"><span class="keyword">val</span> string_of_kind</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>a user-printable string for a kind, eg. "exec" or "cmo", to use
in error messages.</p>
</div>
</div>
<pre><span id="VALhuman_name_of_kind"><span class="keyword">val</span> human_name_of_kind</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>a user-meaningful name for a kind, eg. "executable file" or
"bytecode object file", to use in error messages.</p>
</div>
</div>
<pre><span id="VALcurrent_raw"><span class="keyword">val</span> current_raw</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a> -> <a href="Misc.Magic_number.html#TYPEraw">raw</a></code></pre><div class="info ">
<div class="info-desc">
<p>the current magic number of each kind</p>
</div>
</div>
<pre><span id="VALcurrent_version"><span class="keyword">val</span> current_version</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a> -> <a href="Misc.Magic_number.html#TYPEversion">version</a></code></pre><div class="info ">
<div class="info-desc">
<p>the current version of each kind</p>
</div>
</div>
<h4 id="3_Rawrepresentations">Raw representations</h4>
<p>Mainly for internal usage and testing.</p>
<pre><span id="TYPEraw_kind"><span class="keyword">type</span> <code class="type"></code>raw_kind</span> = <code class="type">string</code> </pre>
<div class="info ">
<div class="info-desc">
<p>the type of raw magic numbers kinds,
such as "Caml1999A" for .cma files</p>
</div>
</div>
<pre><span id="VALparse_kind"><span class="keyword">val</span> parse_kind</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEraw_kind">raw_kind</a> -> <a href="Misc.Magic_number.html#TYPEkind">kind</a> option</code></pre><div class="info ">
<div class="info-desc">
<p>parse a raw kind into a kind</p>
</div>
</div>
<pre><span id="VALraw_kind"><span class="keyword">val</span> raw_kind</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEkind">kind</a> -> <a href="Misc.Magic_number.html#TYPEraw_kind">raw_kind</a></code></pre><div class="info ">
<div class="info-desc">
<p>the current raw representation of a kind.</p>
<p>In some cases the raw representation of a kind has changed
over compiler versions, so other files of the same kind
may have different raw kinds.
Note that all currently known cases are parsed correctly by <code class="code">parse_kind</code>.</p>
</div>
</div>
<pre><span id="VALraw"><span class="keyword">val</span> raw</span> : <code class="type"><a href="Misc.Magic_number.html#TYPEinfo">info</a> -> <a href="Misc.Magic_number.html#TYPEraw">raw</a></code></pre><div class="info ">
<div class="info-desc">
<p>A valid raw representation of the magic number.</p>
<p>Due to past and future changes in the string representation of
magic numbers, we cannot guarantee that the raw strings returned
for past and future versions actually match the expectations of
those compilers. The representation is accurate for current
versions, and it is correctly parsed back into the desired
version by the parsing functions above.</p>
</div>
</div>
</body></html>
|