linol/ocaml/Load_path/index.html
2025-01-10 16:49:28 +00:00

11 lines
10 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>Load_path (ocaml.Load_path)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.4"/><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">ocaml</a> &#x00BB; Load_path</nav><header class="odoc-preamble"><h1>Module <code><span>Load_path</span></code></h1><p>Management of include directories.</p><p>This module offers a high level interface to locating files in the load path, which is constructed from <code>-I</code> and <code>-H</code> command line flags and a few other parameters.</p><p>It makes the assumption that the contents of include directories doesn't change during the execution of the compiler.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-add_dir"><a href="#val-add_dir" class="anchor"></a><code><span><span class="keyword">val</span> add_dir : <span><span class="label">hidden</span>:bool <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Add a directory to the end of the load path (i.e. at lowest priority.)</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-remove_dir"><a href="#val-remove_dir" class="anchor"></a><code><span><span class="keyword">val</span> remove_dir : <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Remove a directory from the load path</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-reset"><a href="#val-reset" class="anchor"></a><code><span><span class="keyword">val</span> reset : <span>unit <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Remove all directories</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Dir"><a href="#module-Dir" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Dir/index.html">Dir</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-auto_include_callback"><a href="#type-auto_include_callback" class="anchor"></a><code><span><span class="keyword">type</span> auto_include_callback</span><span> =
<span><span>(<span><a href="Dir/index.html#type-t">Dir.t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <span>string option</span>)</span> <span class="arrow">&#45;&gt;</span></span>
<span>string <span class="arrow">&#45;&gt;</span></span>
string</span></code></div><div class="spec-doc"><p>The type of callback functions on for <code>init ~auto_include</code></p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-no_auto_include"><a href="#val-no_auto_include" class="anchor"></a><code><span><span class="keyword">val</span> no_auto_include : <a href="#type-auto_include_callback">auto_include_callback</a></span></code></div><div class="spec-doc"><p>No automatic directory inclusion: misses in the load path raise <code>Not_found</code> as normal.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-init"><a href="#val-init" class="anchor"></a><code><span><span class="keyword">val</span> init :
<span><span class="label">auto_include</span>:<a href="#type-auto_include_callback">auto_include_callback</a> <span class="arrow">&#45;&gt;</span></span>
<span><span class="label">visible</span>:<span>string list</span> <span class="arrow">&#45;&gt;</span></span>
<span><span class="label">hidden</span>:<span>string list</span> <span class="arrow">&#45;&gt;</span></span>
unit</span></code></div><div class="spec-doc"><p><code>init ~visible ~hidden</code> is the same as <code>reset ();
List.iter add_dir (List.rev hidden);
List.iter add_dir (List.rev visible)</code></p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-auto_include_otherlibs"><a href="#val-auto_include_otherlibs" class="anchor"></a><code><span><span class="keyword">val</span> auto_include_otherlibs : <span><span>(<span>string <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-auto_include_callback">auto_include_callback</a></span></code></div><div class="spec-doc"><p><code>auto_include_otherlibs alert</code> is a callback function to be passed to <a href="#val-init"><code>Load_path.init</code></a> and automatically adds <code>-I +lib</code> to the load path after calling <code>alert lib</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_path_list"><a href="#val-get_path_list" class="anchor"></a><code><span><span class="keyword">val</span> get_path_list : <span>unit <span class="arrow">&#45;&gt;</span></span> <span>string list</span></span></code></div><div class="spec-doc"><p>Return the list of directories passed to <code>add_dir</code> so far.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-paths"><a href="#type-paths" class="anchor"></a><code><span><span class="keyword">type</span> paths</span><span> = </span><span>{</span></code><ol><li id="type-paths.visible" class="def record field anchored"><a href="#type-paths.visible" class="anchor"></a><code><span>visible : <span>string list</span>;</span></code></li><li id="type-paths.hidden" class="def record field anchored"><a href="#type-paths.hidden" class="anchor"></a><code><span>hidden : <span>string list</span>;</span></code></li></ol><code><span>}</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_paths"><a href="#val-get_paths" class="anchor"></a><code><span><span class="keyword">val</span> get_paths : <span>unit <span class="arrow">&#45;&gt;</span></span> <a href="#type-paths">paths</a></span></code></div><div class="spec-doc"><p>Return the directories passed to <code>add_dir</code> so far.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-find"><a href="#val-find" class="anchor"></a><code><span><span class="keyword">val</span> find : <span>string <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Locate a file in the load path. Raise <code>Not_found</code> if the file cannot be found. This function is optimized for the case where the filename is a basename, i.e. doesn't contain a directory separator.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-find_normalized"><a href="#val-find_normalized" class="anchor"></a><code><span><span class="keyword">val</span> find_normalized : <span>string <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p>Same as <code>find</code>, but search also for normalized unit name (see <a href="../Misc/index.html#val-normalized_unit_filename"><code>Misc.normalized_unit_filename</code></a>), i.e. if name is <code>Foo.ml</code>, allow <code>/path/Foo.ml</code> and <code>/path/foo.ml</code> to match.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-visibility"><a href="#type-visibility" class="anchor"></a><code><span><span class="keyword">type</span> visibility</span><span> = </span></code><ol><li id="type-visibility.Visible" class="def variant constructor anchored"><a href="#type-visibility.Visible" class="anchor"></a><code><span>| </span><span><span class="constructor">Visible</span></span></code></li><li id="type-visibility.Hidden" class="def variant constructor anchored"><a href="#type-visibility.Hidden" class="anchor"></a><code><span>| </span><span><span class="constructor">Hidden</span></span></code></li></ol></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-find_normalized_with_visibility"><a href="#val-find_normalized_with_visibility" class="anchor"></a><code><span><span class="keyword">val</span> find_normalized_with_visibility : <span>string <span class="arrow">&#45;&gt;</span></span> string * <a href="#type-visibility">visibility</a></span></code></div><div class="spec-doc"><p>Same as <code>find_normalized</code>, but also reports whether the cmi was found in a -I directory (Visible) or a -H directory (Hidden)</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add"><a href="#val-add" class="anchor"></a><code><span><span class="keyword">val</span> add : <span><a href="Dir/index.html#type-t">Dir.t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Old name for <a href="#val-append_dir"><code>append_dir</code></a></p><ul class="at-tags"><li class="deprecated"><span class="at-tag">deprecated</span> </li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-append_dir"><a href="#val-append_dir" class="anchor"></a><code><span><span class="keyword">val</span> append_dir : <span><a href="Dir/index.html#type-t">Dir.t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>append_dir d</code> adds <code>d</code> to the end of the load path (i.e. at lowest priority.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-prepend_dir"><a href="#val-prepend_dir" class="anchor"></a><code><span><span class="keyword">val</span> prepend_dir : <span><a href="Dir/index.html#type-t">Dir.t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>prepend_dir d</code> adds <code>d</code> to the start of the load path (i.e. at highest priority.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_visible"><a href="#val-get_visible" class="anchor"></a><code><span><span class="keyword">val</span> get_visible : <span>unit <span class="arrow">&#45;&gt;</span></span> <span><a href="Dir/index.html#type-t">Dir.t</a> list</span></span></code></div><div class="spec-doc"><p>Same as <code>get_paths ()</code>, except that it returns a <code>Dir.t list</code>, and doesn't include the -H paths.</p></div></div></div></body></html>