linol/ocaml/Bytesections/index.html
2025-04-03 13:23:17 +00:00

2 lines
7.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Bytesections (ocaml.Bytesections)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.0.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../index.html">Index</a> &#x00BB; <a href="../index.html">ocaml</a> &#x00BB; Bytesections</nav><header class="odoc-preamble"><h1>Module <code><span>Bytesections</span></code></h1></header><div class="odoc-content"><div class="odoc-spec"><div class="spec module anchored" id="module-Name"><a href="#module-Name" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Name/index.html">Name</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><p>Recording sections written to a bytecode executable file</p><div class="odoc-spec"><div class="spec type anchored" id="type-toc_writer"><a href="#type-toc_writer" class="anchor"></a><code><span><span class="keyword">type</span> toc_writer</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-init_record"><a href="#val-init_record" class="anchor"></a><code><span><span class="keyword">val</span> init_record : <span><a href="../Stdlib/index.html#type-out_channel">out_channel</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-toc_writer">toc_writer</a></span></code></div><div class="spec-doc"><p>Start recording sections from the current position in out_channel</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-record"><a href="#val-record" class="anchor"></a><code><span><span class="keyword">val</span> record : <span><a href="#type-toc_writer">toc_writer</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="Name/index.html#type-t">Name.t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Record the current position in the out_channel as the end of the section with the given name.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-write_toc_and_trailer"><a href="#val-write_toc_and_trailer" class="anchor"></a><code><span><span class="keyword">val</span> write_toc_and_trailer : <span><a href="#type-toc_writer">toc_writer</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write the table of contents and the standard trailer for bytecode executable files</p></div></div><p>Reading sections from a bytecode executable file</p><div class="odoc-spec"><div class="spec type anchored" id="type-section_entry"><a href="#type-section_entry" class="anchor"></a><code><span><span class="keyword">type</span> section_entry</span><span> = </span><span>{</span></code><ol><li id="type-section_entry.name" class="def record field anchored"><a href="#type-section_entry.name" class="anchor"></a><code><span>name : <a href="Name/index.html#type-t">Name.t</a>;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>name of the section.</p><span class="comment-delim">*)</span></div></li><li id="type-section_entry.pos" class="def record field anchored"><a href="#type-section_entry.pos" class="anchor"></a><code><span>pos : int;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>byte offset at which the section starts.</p><span class="comment-delim">*)</span></div></li><li id="type-section_entry.len" class="def record field anchored"><a href="#type-section_entry.len" class="anchor"></a><code><span>len : int;</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>length of the section.</p><span class="comment-delim">*)</span></div></li></ol><code><span>}</span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-section_table"><a href="#type-section_table" class="anchor"></a><code><span><span class="keyword">type</span> section_table</span></code></div></div><div class="odoc-spec"><div class="spec exception anchored" id="exception-Bad_magic_number"><a href="#exception-Bad_magic_number" class="anchor"></a><code><span><span class="keyword">exception</span> </span><span><span class="exception">Bad_magic_number</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-read_toc"><a href="#val-read_toc" class="anchor"></a><code><span><span class="keyword">val</span> read_toc : <span><a href="../Stdlib/index.html#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-section_table">section_table</a></span></code></div><div class="spec-doc"><p>Read the table of sections from a bytecode executable. Raise <code>Bad_magic_number</code> if magic number doesn't match</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-seek_section"><a href="#val-seek_section" class="anchor"></a><code><span><span class="keyword">val</span> seek_section : <span><a href="#type-section_table">section_table</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Stdlib/index.html#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="Name/index.html#type-t">Name.t</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Position the input channel at the beginning of the section named &quot;name&quot;, and return the length of that section. Raise Not_found if no such section exists.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-read_section_string"><a href="#val-read_section_string" class="anchor"></a><code><span><span class="keyword">val</span> read_section_string : <span><a href="#type-section_table">section_table</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Stdlib/index.html#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="Name/index.html#type-t">Name.t</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Return the contents of a section, as a string.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-read_section_struct"><a href="#val-read_section_struct" class="anchor"></a><code><span><span class="keyword">val</span> read_section_struct : <span><a href="#type-section_table">section_table</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Stdlib/index.html#type-in_channel">in_channel</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="Name/index.html#type-t">Name.t</a> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p>Return the contents of a section, as marshalled data.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-all"><a href="#val-all" class="anchor"></a><code><span><span class="keyword">val</span> all : <span><a href="#type-section_table">section_table</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-section_entry">section_entry</a> list</span></span></code></div><div class="spec-doc"><p>Returns all <code>section_entry</code> from a <code>section_table</code> in increasing position order.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pos_first_section"><a href="#val-pos_first_section" class="anchor"></a><code><span><span class="keyword">val</span> pos_first_section : <span><a href="#type-section_table">section_table</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Return the position of the beginning of the first section</p></div></div></div></body></html>