File: manual028.html

package info (click to toggle)
ocaml-doc 3.09-1
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 10,428 kB
  • ctags: 4,963
  • sloc: ml: 9,244; makefile: 2,413; ansic: 122; sh: 49; asm: 17
file content (191 lines) | stat: -rw-r--r-- 9,022 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="manual.css">
<TITLE>
The browser/editor (ocamlbrowser)
</TITLE>
</HEAD>
<BODY >
<A HREF="manual027.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="manual029.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H1 CLASS="chapter"><A NAME="htoc149">Chapter&nbsp;14</A>&nbsp;&nbsp;The browser/editor (ocamlbrowser)</H1> <A NAME="c:browser"></A>

This chapter describes OCamlBrowser, a source and compiled interface
browser, written using LablTk. This is a useful companion to the
programmer.<BR>
<BR>
Its functions are:
<UL CLASS="itemize"><LI CLASS="li-itemize">
navigation through Objective Caml's modules (using compiled interfaces).
<LI CLASS="li-itemize">source editing, type-checking, and browsing.
<LI CLASS="li-itemize">integrated Objective Caml shell, running as a subprocess.
</UL>

<H2 CLASS="section"><A NAME="htoc150">14.1</A>&nbsp;&nbsp;Invocation</H2> <A NAME="s:browser-options"></A>
The browser is started by the command <TT>ocamlbrowser</TT>, as follows:
<PRE>
        ocamlbrowser <I>options</I>
</PRE>
The following command-line options are recognized by <TT>ocamlbrowser</TT>.
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description"><B><TT>-I</TT> <I>directory</I></B><DD CLASS="dd-description">
Add the given directory to the list of directories searched for
source and compiled files. By default, only the standard library
directory is searched. The standard library can also be changed by
setting the <TT>OCAMLLIB</TT> environment variable.<BR>
<BR>
<DT CLASS="dt-description"><TT><B>-nolabels</B></TT><DD CLASS="dd-description">
Ignore non-optional labels in types. Labels cannot be used in
applications, and parameter order becomes strict.<BR>
<BR>
<DT CLASS="dt-description"><TT><B>-oldui</B></TT><DD CLASS="dd-description">
Old multi-window interface. The default is now more like Smalltalk's
class browser.<BR>
<BR>
<DT CLASS="dt-description"><TT><B>-rectypes</B></TT><DD CLASS="dd-description">
Allow arbitrary recursive types during type-checking. By default,
only recursive types where the recursion goes through an object type
are supported.<BR>
<BR>
<DT CLASS="dt-description" style="background-color:yellow; color:red"><TT><B>-version</B></TT><DD CLASS="dd-description" style="background-color:yellow; color:red">
Print version and exit.<BR>
<BR>
<DT CLASS="dt-description"><B><TT>-w</TT> <I>warning-list</I></B><DD CLASS="dd-description">
Enable or disable warnings according to the argument <I>warning-list</I>.</DL>
Most options can also be modified inside the application by the <B>Modules - Path editor</B> and <B>Compiler - Preferences</B> commands.
They are inherited when you start a toplevel shell.<BR>
<BR>

<H2 CLASS="section"><A NAME="htoc151">14.2</A>&nbsp;&nbsp;Viewer</H2>
This is the first window you get when you start OCamlBrowser.
It displays a search window, and the list of modules in the load path.
At the top a row of menus.
<UL CLASS="itemize"><LI CLASS="li-itemize">
<B>File - Open</B> and <B>File - Editor</B> give access to the
 editor.<BR>
<BR>
<LI CLASS="li-itemize"><B>File - Shell</B> creates an Objective Caml subprocess in a shell.<BR>
<BR>
<LI CLASS="li-itemize"><B>View - Show all defs</B> displays the signature of the currently
 selected module.<BR>
<BR>
<LI CLASS="li-itemize"><B>View - Search entry</B> shows/hides the search entry just
 below the menu bar.<BR>
<BR>
<LI CLASS="li-itemize"><B>Modules - Path editor</B> changes the load path. <B>Modules
 - Reset cache</B> rescans the load path and resets the module cache.
 Do it if you recompile some interface, or get confused about what is 
 in the cache.<BR>
<BR>
<LI CLASS="li-itemize"><B>Modules - Search symbol</B> allows to search a symbol either
 by its name, like the bottom line of the viewer, or, more
 interestingly, by its type. <B>Exact type</B> searches for a type
 with exactly the same information as the pattern (variables match
 only variables). <B>Included type</B> allows to give only partial
 information: the actual type may take more arguments and return more
 results, and variables in the pattern match anything. In both cases,
 argument and tuple order is irrelevant<SUP><A NAME="text2" HREF="#note2">1</A></SUP>,
 and unlabeled arguments in the pattern match any label.<BR>
<BR>
<LI CLASS="li-itemize">The <B>Search entry</B> just below the menu bar allows one to
 search for an identifier in all modules (wildcards &#8220;?&#8221; and &#8220;*&#8221;
 allowed). If you choose the <TT>type</TT> option, the search is done by type
 inclusion (<EM>cf.</EM> Search Symbol - Included type).<BR>
<BR>
<LI CLASS="li-itemize">The <B>Close all</B> button is there to dismiss the windows
 created by the Detach button.
 By double-clicking on it you will quit the browser.</UL>

<H2 CLASS="section"><A NAME="htoc152">14.3</A>&nbsp;&nbsp;Module browsing</H2>
You select a module in the leftmost box by either cliking on it or
pressing return when it is selected. Fast access is available in all
boxes pressing the first few letter of the desired name.
Double-clicking / double-return displays the whole signature for the
module.<BR>
<BR>
Defined identifiers inside the module are displayed in a box to the
right of the previous one. If you click on one, this will either
display its contents in another box (if this is a sub-module) or
display the signature for this identifier below.<BR>
<BR>
Signatures are clickable. Double clicking with the left mouse
button on an identifier in a signature brings you to its signature.
A single click on the right button pops up a menu displaying the
type declaration for the selected identifier. Its title, when
selectable, also brings you to its signature.<BR>
<BR>
At the bottom, a series of buttons, depending on the context.
<UL CLASS="itemize"><LI CLASS="li-itemize">
<B>Detach</B> copies the currently displayed signature in a new window,
 to keep it.
<LI CLASS="li-itemize"><B>Impl</B> and <B>Intf</B> bring you to the implementation or
 interface of the currently displayed signature, if it is available.
</UL>
Control-S lets you search a string in the signature.<BR>
<BR>

<H2 CLASS="section"><A NAME="htoc153">14.4</A>&nbsp;&nbsp;File editor</H2>
You can edit files with it, if you're not yet used to emacs. Otherwise
you can use it as a browser, making occasional corrections.<BR>
<BR>
The <B>Edit</B> menu contains commands for jump (C-g), search (C-s),
and sending the current phrase (or selection if some text is selected)
to a sub-shell (M-x). For this last option, you may choose the shell
via a dialog.<BR>
<BR>
Essential functions are in the <B>Compiler</B> menu.
<UL CLASS="itemize"><LI CLASS="li-itemize">
<B>Preferences</B> opens a dialog to set internals of the editor
 and type-checker.<BR>
<BR>
<LI CLASS="li-itemize"><B>Lex</B> adds colors according to lexical categories.<BR>
<BR>
<LI CLASS="li-itemize"><B>Typecheck</B> verifies typing, and memorizes to let one see an
 expression's type by double-clicking on it. This is also valid for
 interfaces. If an error occurs, the part of the interface preceding
 the error is computed.<BR>
<BR>
After typechecking, pressing the right button pops up a menu giving
 the type of the pointed expression, and eventually allowing to
 follow some links.<BR>
<BR>
<LI CLASS="li-itemize"><B>Clear errors</B> dismisses type-checker error messages and warnings.<BR>
<BR>
<LI CLASS="li-itemize"><B>Signature</B> shows the signature of the current file
 (after type checking).
</UL>

<H2 CLASS="section"><A NAME="htoc154">14.5</A>&nbsp;&nbsp;Shell</H2>
When you create a shell, a dialog is presented to you, letting you
choose which command you want to run, and the title of the shell (to
choose it in the Editor).<BR>
<BR>
The executed subshell is given the current load path.
<UL CLASS="itemize"><LI CLASS="li-itemize">
<B>File</B> use a source file or load a bytecode file. You may
 also import the browser's path into the subprocess.
<LI CLASS="li-itemize"><B>History</B> M-p and M-n browse up and down.
<LI CLASS="li-itemize"><B>Signal</B> C-c interrupts, and you can also kill the subprocess.
</UL>


<HR WIDTH="50%" SIZE=1><DL CLASS="list"><DT CLASS="dt-list"><FONT SIZE=5><A NAME="note2" HREF="#text2">1</A></FONT><DD CLASS="dd-list">To avoid
 combinatorial explosion of the search space, optional arguments in
 the actual type are ignored in the actual if (1) there are too many
 of them, and (2) they do not appear explicitly in the pattern.
</DL>
<HR>
<A HREF="manual027.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="manual029.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>