File: Topfind.html

package info (click to toggle)
findlib 1.2.5%2Bdebian-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,496 kB
  • ctags: 678
  • sloc: ml: 4,661; xml: 2,445; sh: 1,322; makefile: 306
file content (142 lines) | stat: -rw-r--r-- 7,152 bytes parent folder | download | duplicates (2)
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
<!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">
<link rel="Start" href="index.html">
<link rel="previous" href="Fl_metascanner.html">
<link rel="Up" href="index.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="Findlib" rel="Chapter" href="Findlib.html">
<link title="Fl_package_base" rel="Chapter" href="Fl_package_base.html">
<link title="Fl_metascanner" rel="Chapter" href="Fl_metascanner.html">
<link title="Topfind" rel="Chapter" href="Topfind.html"><link title="Directives" rel="Section" href="#1_Directives">
<link title="Functions and variables" rel="Section" href="#1_Functionsandvariables">
<title>The Findlib Library : Topfind</title>
</head>
<body>
<div class="navbar"><a href="Fl_metascanner.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;</div>
<center><h1>Module <a href="type_Topfind.html">Topfind</a></h1></center>
<br>
<pre><span class="keyword">module</span> Topfind: <code class="code">sig</code> <a href="Topfind.html">..</a> <code class="code">end</code></pre>Load packages from toploops and scripts
<p>

 The <code class="code">Topfind</code> module is part of the <code class="code">findlib</code> package. The module
 depends on the presence of a toploop. When building a toploop, it is
 automatically linked in if "findlib" is linked in, e.g.
 <pre><code class="code"> ocamlfind ocamlmktop ...options... -package findlib -linkpkg 
 </code></pre>
<p>

 When the platform supports DLLs, another possibility to get a toploop
 with findlib directives is to load the file "topfind" (normally installed
 in the standard library directory):
 <pre><code class="code"> $ ocaml
         Objective Caml version 3.04
 # #use "topfind";;
 Findlib has been successfully loaded. Additional directives:
   #require "package";;      to load a package
   #list;;                   to list the available packages
   #camlp4o;;                to load camlp4 (standard syntax)
   #camlp4r;;                to load camlp4 (revised syntax)
   Topfind.reset();;         to force that packages will be reloaded
 ~ : unit = ()
 # _
 </code></pre>
<p>

 This works even in scripts (but the startup message is suppressed in this
 case).
<p>

 The module is not thread-safe; if used in a multi-threaded script, all
 packgage loading must have happened before the first thread forks.
<p>

 The Topfind module contains some functions simplifying package loading
 in scripts. Most important, there is a new directive <code class="code">#require</code> for
 the same purpose (see below).
<p>

 The <code class="code">Topfind</code> module needs some initialization, in particular the 
 <code class="code">predicates</code> variable needs to be
 set, and the packages already compiled into the toploop needs to be
 declared by the <code class="code">don't_load</code>
 function. If the toploop has been built by <code class="code">ocamlfind</code>,
 the necessary initialization is
 automatically compiled in.<br>
<hr width="100%">
<br>
<a name="1_Directives"></a>
<h1>Directives</h1>
<p>

 This module also defines the following directives for the toploop:
<p>
<ul>
<li><code class="code">#require "&lt;package&gt;"</code>
   loads the package (and if necessary the prerequisites of the package)</li>
<li><code class="code">#camlp4o</code>
   loads camlp4 and selects standard syntax</li>
<li><code class="code">#camlp4r</code>
   loads camlp4 and selects revised syntax</li>
<li><code class="code">#list</code>
   lists the available packages (calls external command "ocamlfind")</li>
<li><code class="code">#thread</code>
   enables multi-threading if possible</li>
<li><code class="code">#predicates "p1,p2,..."</code>
   adds these predicates</li>
</ul>
<br>
<br>
<a name="1_Functionsandvariables"></a>
<h1>Functions and variables</h1><br>
<pre><span class="keyword">val</span> <a name="VALpredicates"></a>predicates : <code class="type">string list Pervasives.ref</code></pre><div class="info">
The list of predicates used for package loading<br>
</div>
<pre><span class="keyword">val</span> <a name="VALadd_predicates"></a>add_predicates : <code class="type">string list -> unit</code></pre><div class="info">
Adds predicates to the list of predicates<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsyntax"></a>syntax : <code class="type">string -> unit</code></pre><div class="info">
Emulates the <code class="code">-syntax</code> option<br>
</div>
<pre><span class="keyword">val</span> <a name="VALstandard_syntax"></a>standard_syntax : <code class="type">unit -> unit</code></pre><div class="info">
Adds predicates that select the standard syntax. Same as
 <code class="code">syntax "camlp4o"</code><br>
</div>
<pre><span class="keyword">val</span> <a name="VALrevised_syntax"></a>revised_syntax : <code class="type">unit -> unit</code></pre><div class="info">
Adds predicates that select the revised syntax. Same as 
 <code class="code">syntax "camlp4r"</code><br>
</div>
<pre><span class="keyword">val</span> <a name="VALdon't_load"></a>don't_load : <code class="type">string list -> unit</code></pre><div class="info">
The packages named in pkglist are added to the list of packages which
 are already loaded.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALdon't_load_deeply"></a>don't_load_deeply : <code class="type">string list -> unit</code></pre><div class="info">
The packages named in pkglist and all direct and indirect ancestors
 are added to the list of packages which are already loaded.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALload"></a>load : <code class="type">string list -> unit</code></pre><div class="info">
The packages from the passed package list are loaded, from left to
 right, but packages that have already been loaded are left out.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALload_deeply"></a>load_deeply : <code class="type">string list -> unit</code></pre><div class="info">
The packages from the passed package list and all direct or indirect 
 ancestors are loaded in topological order. Packages that have already
 been loaded are left out.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALreset"></a>reset : <code class="type">unit -> unit</code></pre><div class="info">
All entries in the list of loaded packages that have been added by
 <code class="code">load</code> or <code class="code">load_deeply</code> functions are removed from this list. This
 means that if you execute the same <code class="code">load</code> or <code class="code">load_deeply</code> functions
 again, the packages will be reloaded.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALannounce"></a>announce : <code class="type">unit -> unit</code></pre><div class="info">
Output the startup message<br>
</div>
</body></html>