8
6
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
9
<META name="GENERATOR" content="hevea 1.08">
7
<META name="GENERATOR" content="hevea 1.09">
10
8
<LINK rel="stylesheet" type="text/css" href="manual.css">
12
The browser/editor (ocamlbrowser)
9
<TITLE>The browser/editor (ocamlbrowser)</TITLE>
16
<A HREF="manual027.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
17
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
18
<A HREF="manual029.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
12
<A HREF="manual027.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
13
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
14
<A HREF="manual029.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
21
<H1 CLASS="chapter"><A NAME="htoc149">Chapter 14</A> The browser/editor (ocamlbrowser)</H1> <A NAME="c:browser"></A>
23
This chapter describes OCamlBrowser, a source and compiled interface
16
<H1 CLASS="chapter"><A NAME="htoc149">Chapter�14</A>��The browser/editor (ocamlbrowser)</H1><P> <A NAME="c:browser"></A>
17
</P><P>This chapter describes OCamlBrowser, a source and compiled interface
24
18
browser, written using LablTk. This is a useful companion to the
28
<UL CLASS="itemize"><LI CLASS="li-itemize">
19
programmer.</P><P>Its functions are:
20
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
29
21
navigation through Objective Caml's modules (using compiled interfaces).
30
<LI CLASS="li-itemize">source editing, type-checking, and browsing.
31
<LI CLASS="li-itemize">integrated Objective Caml shell, running as a subprocess.
34
<H2 CLASS="section"><A NAME="htoc150">14.1</A> Invocation</H2> <A NAME="s:browser-options"></A>
35
The browser is started by the command <TT>ocamlbrowser</TT>, as follows:
22
</LI><LI CLASS="li-itemize">source editing, type-checking, and browsing.
23
</LI><LI CLASS="li-itemize">integrated Objective Caml shell, running as a subprocess.
24
</LI></UL><H2 CLASS="section"><A NAME="htoc150">14.1</A>��Invocation</H2><P> <A NAME="s:browser-options"></A></P><P>The browser is started by the command <TT>ocamlbrowser</TT>, as follows:
37
26
ocamlbrowser <I>options</I>
39
The following command-line options are recognized by <TT>ocamlbrowser</TT>.
40
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description"><B><TT>-I</TT> <I>directory</I></B><DD CLASS="dd-description">
27
</PRE><P>The following command-line options are recognized by <TT>ocamlbrowser</TT>.</P><DL CLASS="description"><DT CLASS="dt-description"><B><TT>-I</TT> <I>directory</I></B></DT><DD CLASS="dd-description">
41
28
Add the given directory to the list of directories searched for
42
29
source and compiled files. By default, only the standard library
43
30
directory is searched. The standard library can also be changed by
44
setting the <TT>OCAMLLIB</TT> environment variable.<BR>
46
<DT CLASS="dt-description"><TT><B>-nolabels</B></TT><DD CLASS="dd-description">
31
setting the <TT>OCAMLLIB</TT> environment variable.</DD><DT CLASS="dt-description"><TT><B>-nolabels</B></TT></DT><DD CLASS="dd-description">
47
32
Ignore non-optional labels in types. Labels cannot be used in
48
applications, and parameter order becomes strict.<BR>
50
<DT CLASS="dt-description"><TT><B>-oldui</B></TT><DD CLASS="dd-description">
33
applications, and parameter order becomes strict.</DD><DT CLASS="dt-description"><TT><B>-oldui</B></TT></DT><DD CLASS="dd-description">
51
34
Old multi-window interface. The default is now more like Smalltalk's
54
<DT CLASS="dt-description"><TT><B>-rectypes</B></TT><DD CLASS="dd-description">
35
class browser.</DD><DT CLASS="dt-description"><TT><B>-rectypes</B></TT></DT><DD CLASS="dd-description">
55
36
Allow arbitrary recursive types during type-checking. By default,
56
37
only recursive types where the recursion goes through an object type
59
<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">
60
Print version and exit.<BR>
62
<DT CLASS="dt-description"><B><TT>-w</TT> <I>warning-list</I></B><DD CLASS="dd-description">
63
Enable or disable warnings according to the argument <I>warning-list</I>.</DL>
64
Most options can also be modified inside the application by the <B>Modules - Path editor</B> and <B>Compiler - Preferences</B> commands.
65
They are inherited when you start a toplevel shell.<BR>
68
<H2 CLASS="section"><A NAME="htoc151">14.2</A> Viewer</H2>
38
are supported.</DD><DT CLASS="dt-description"><TT><B>-version</B></TT></DT><DD CLASS="dd-description">
39
Print version and exit.</DD><DT CLASS="dt-description"><B><TT>-w</TT> <I>warning-list</I></B></DT><DD CLASS="dd-description">
40
Enable or disable warnings according to the argument <I>warning-list</I>.</DD></DL><P>Most options can also be modified inside the application by the <B>Modules - Path editor</B> and <B>Compiler - Preferences</B> commands.
41
They are inherited when you start a toplevel shell.</P><H2 CLASS="section"><A NAME="htoc151">14.2</A>��Viewer</H2><P>
69
42
This is the first window you get when you start OCamlBrowser.
70
43
It displays a search window, and the list of modules in the load path.
71
At the top a row of menus.
72
<UL CLASS="itemize"><LI CLASS="li-itemize">
44
At the top a row of menus.</P><UL CLASS="itemize"><LI CLASS="li-itemize">
73
45
<B>File - Open</B> and <B>File - Editor</B> give access to the
76
<LI CLASS="li-itemize"><B>File - Shell</B> creates an Objective Caml subprocess in a shell.<BR>
78
<LI CLASS="li-itemize"><B>View - Show all defs</B> displays the signature of the currently
81
<LI CLASS="li-itemize"><B>View - Search entry</B> shows/hides the search entry just
82
below the menu bar.<BR>
84
<LI CLASS="li-itemize"><B>Modules - Path editor</B> changes the load path. <B>Modules
85
- Reset cache</B> rescans the load path and resets the module cache.
86
Do it if you recompile some interface, or get confused about what is
89
<LI CLASS="li-itemize"><B>Modules - Search symbol</B> allows to search a symbol either
90
by its name, like the bottom line of the viewer, or, more
91
interestingly, by its type. <B>Exact type</B> searches for a type
92
with exactly the same information as the pattern (variables match
93
only variables). <B>Included type</B> allows to give only partial
94
information: the actual type may take more arguments and return more
95
results, and variables in the pattern match anything. In both cases,
96
argument and tuple order is irrelevant<SUP><A NAME="text2" HREF="#note2">1</A></SUP>,
97
and unlabeled arguments in the pattern match any label.<BR>
99
<LI CLASS="li-itemize">The <B>Search entry</B> just below the menu bar allows one to
100
search for an identifier in all modules (wildcards “?” and “*”
101
allowed). If you choose the <TT>type</TT> option, the search is done by type
102
inclusion (<EM>cf.</EM> Search Symbol - Included type).<BR>
104
<LI CLASS="li-itemize">The <B>Close all</B> button is there to dismiss the windows
105
created by the Detach button.
106
By double-clicking on it you will quit the browser.</UL>
108
<H2 CLASS="section"><A NAME="htoc152">14.3</A> Module browsing</H2>
109
You select a module in the leftmost box by either cliking on it or
46
editor.</LI><LI CLASS="li-itemize"><B>File - Shell</B> creates an Objective Caml subprocess in a shell.</LI><LI CLASS="li-itemize"><B>View - Show all defs</B> displays the signature of the currently
47
selected module.</LI><LI CLASS="li-itemize"><B>View - Search entry</B> shows/hides the search entry just
48
below the menu bar.</LI><LI CLASS="li-itemize"><B>Modules - Path editor</B> changes the load path. <B>Modules
49
- Reset cache</B> rescans the load path and resets the module cache.
50
Do it if you recompile some interface, or get confused about what is
51
in the cache.</LI><LI CLASS="li-itemize"><B>Modules - Search symbol</B> allows to search a symbol either
52
by its name, like the bottom line of the viewer, or, more
53
interestingly, by its type. <B>Exact type</B> searches for a type
54
with exactly the same information as the pattern (variables match
55
only variables). <B>Included type</B> allows to give only partial
56
information: the actual type may take more arguments and return more
57
results, and variables in the pattern match anything. In both cases,
58
argument and tuple order is irrelevant<SUP><A NAME="text2" HREF="#note2">1</A></SUP>,
59
and unlabeled arguments in the pattern match any label.</LI><LI CLASS="li-itemize">The <B>Search entry</B> just below the menu bar allows one to
60
search for an identifier in all modules (wildcards “?” and “*”
61
allowed). If you choose the <TT>type</TT> option, the search is done by type
62
inclusion (<EM>cf.</EM> Search Symbol - Included type).</LI><LI CLASS="li-itemize">The <B>Close all</B> button is there to dismiss the windows
63
created by the Detach button.
64
By double-clicking on it you will quit the browser.</LI></UL><H2 CLASS="section"><A NAME="htoc152">14.3</A>��Module browsing</H2><P>You select a module in the leftmost box by either cliking on it or
110
65
pressing return when it is selected. Fast access is available in all
111
66
boxes pressing the first few letter of the desired name.
112
67
Double-clicking / double-return displays the whole signature for the
115
Defined identifiers inside the module are displayed in a box to the
68
module.</P><P>Defined identifiers inside the module are displayed in a box to the
116
69
right of the previous one. If you click on one, this will either
117
70
display its contents in another box (if this is a sub-module) or
118
display the signature for this identifier below.<BR>
120
Signatures are clickable. Double clicking with the left mouse
71
display the signature for this identifier below.</P><P>Signatures are clickable. Double clicking with the left mouse
121
72
button on an identifier in a signature brings you to its signature.
122
73
A single click on the right button pops up a menu displaying the
123
74
type declaration for the selected identifier. Its title, when
124
selectable, also brings you to its signature.<BR>
126
At the bottom, a series of buttons, depending on the context.
127
<UL CLASS="itemize"><LI CLASS="li-itemize">
75
selectable, also brings you to its signature.</P><P>At the bottom, a series of buttons, depending on the context.
76
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
128
77
<B>Detach</B> copies the currently displayed signature in a new window,
130
<LI CLASS="li-itemize"><B>Impl</B> and <B>Intf</B> bring you to the implementation or
131
interface of the currently displayed signature, if it is available.
133
Control-S lets you search a string in the signature.<BR>
136
<H2 CLASS="section"><A NAME="htoc153">14.4</A> File editor</H2>
79
</LI><LI CLASS="li-itemize"><B>Impl</B> and <B>Intf</B> bring you to the implementation or
80
interface of the currently displayed signature, if it is available.
81
</LI></UL><P>Control-S lets you search a string in the signature.</P><H2 CLASS="section"><A NAME="htoc153">14.4</A>��File editor</H2><P>
137
82
You can edit files with it, if you're not yet used to emacs. Otherwise
138
you can use it as a browser, making occasional corrections.<BR>
140
The <B>Edit</B> menu contains commands for jump (C-g), search (C-s),
83
you can use it as a browser, making occasional corrections.</P><P>The <B>Edit</B> menu contains commands for jump (C-g), search (C-s),
141
84
and sending the current phrase (or selection if some text is selected)
142
85
to a sub-shell (M-x). For this last option, you may choose the shell
145
Essential functions are in the <B>Compiler</B> menu.
146
<UL CLASS="itemize"><LI CLASS="li-itemize">
86
via a dialog.</P><P>Essential functions are in the <B>Compiler</B> menu.</P><UL CLASS="itemize"><LI CLASS="li-itemize">
147
87
<B>Preferences</B> opens a dialog to set internals of the editor
148
and type-checker.<BR>
150
<LI CLASS="li-itemize"><B>Lex</B> adds colors according to lexical categories.<BR>
152
<LI CLASS="li-itemize"><B>Typecheck</B> verifies typing, and memorizes to let one see an
153
expression's type by double-clicking on it. This is also valid for
154
interfaces. If an error occurs, the part of the interface preceding
155
the error is computed.<BR>
157
After typechecking, pressing the right button pops up a menu giving
158
the type of the pointed expression, and eventually allowing to
159
follow some links.<BR>
161
<LI CLASS="li-itemize"><B>Clear errors</B> dismisses type-checker error messages and warnings.<BR>
163
<LI CLASS="li-itemize"><B>Signature</B> shows the signature of the current file
164
(after type checking).
167
<H2 CLASS="section"><A NAME="htoc154">14.5</A> Shell</H2>
88
and type-checker.</LI><LI CLASS="li-itemize"><B>Lex</B> adds colors according to lexical categories.</LI><LI CLASS="li-itemize"><B>Typecheck</B> verifies typing, and memorizes to let one see an
89
expression's type by double-clicking on it. This is also valid for
90
interfaces. If an error occurs, the part of the interface preceding
91
the error is computed.<P>After typechecking, pressing the right button pops up a menu giving
92
the type of the pointed expression, and eventually allowing to
93
follow some links.</P></LI><LI CLASS="li-itemize"><B>Clear errors</B> dismisses type-checker error messages and warnings.</LI><LI CLASS="li-itemize"><B>Signature</B> shows the signature of the current file
94
(after type checking).
95
</LI></UL><H2 CLASS="section"><A NAME="htoc154">14.5</A>��Shell</H2><P>
168
96
When you create a shell, a dialog is presented to you, letting you
169
97
choose which command you want to run, and the title of the shell (to
170
choose it in the Editor).<BR>
172
The executed subshell is given the current load path.
173
<UL CLASS="itemize"><LI CLASS="li-itemize">
98
choose it in the Editor).</P><P>The executed subshell is given the current load path.</P><UL CLASS="itemize"><LI CLASS="li-itemize">
174
99
<B>File</B> use a source file or load a bytecode file. You may
175
also import the browser's path into the subprocess.
176
<LI CLASS="li-itemize"><B>History</B> M-p and M-n browse up and down.
177
<LI CLASS="li-itemize"><B>Signal</B> C-c interrupts, and you can also kill the subprocess.
181
<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
182
combinatorial explosion of the search space, optional arguments in
183
the actual type are ignored in the actual if (1) there are too many
184
of them, and (2) they do not appear explicitly in the pattern.
100
also import the browser's path into the subprocess.
101
</LI><LI CLASS="li-itemize"><B>History</B> M-p and M-n browse up and down.
102
</LI><LI CLASS="li-itemize"><B>Signal</B> C-c interrupts, and you can also kill the subprocess.
103
</LI></UL><HR CLASS="ffootnoterule"><DL CLASS="thefootnotes"><DT CLASS="dt-thefootnotes">
104
<A NAME="note2" HREF="#text2">1</A></DT><DD CLASS="dd-thefootnotes">To avoid
105
combinatorial explosion of the search space, optional arguments in
106
the actual type are ignored in the actual if (1) there are too many
107
of them, and (2) they do not appear explicitly in the pattern.
187
<A HREF="manual027.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
188
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
189
<A HREF="manual029.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
110
<A HREF="manual027.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
111
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
112
<A HREF="manual029.html"><IMG SRC="next_motif.gif" ALT="Next"></A>