The user can interact with ECLiPSe by entering a
query at the Query entry window at the top-level, or through the menus and
buttons in the window. The query entry window acts similar to the command
line at the prompt of the tty interface, with the addition of a history
mechanism. Another difference from the tty interface is that output streams
are sent to different windows - the results of a query (top-level variable
bindings, state after executing query, and time taken to execute query) is
presented in the Results window, and the output to standard output and
error are sent to the Output and Error Messages window. Outputs to the
debug_output stream is sent to the tracer's trace log
window. Reading from standard input will cause a window to pop-up to read
input from the user. Figure 4.1 illustrates this division of the
outputs - the bindings to the top-level variable L
is shown in the
Results window, whereas the write(hello)
to standard output is shown
in the Output and Error Messages window.
All built-ins which are available in ECLiPSe are available under tkeclipse.
Some commands from the tty interface are not present in tkeclipse:
trace/0
and debug/0
which invoke the debugger;
and [user]
, which allow the user to type in simple ECLiPSe code.
The equivalent functionality is provided via the tkeclipse tracer
and compile scratch-pad tools respectively.
The Tools menu allow the user to launch the tools of the development tools suite. The following tools are available from the menu:
Note that one tool, the display matrix tool, is not available from the menu. This tool is be invoked from ECLiPSe code, and is described in more detail in section 4.2.1.
The File menu provides some common file related operations such as compile, edit and make, as well as exiting from tkeclipse. Note that the file browser defaults to the .ecl extension, so that only files with such an extension are shown in the browser initially.
If the name of a menu button on the menu-bar has an underlined character (as in File), then the pressing Alt with the underlined letter (either upper or lower case) will popup the associated menu without using the mouse. The arrow keys can be used to navigate the menu, and return to select.
The tkeclipse tools will not be covered in detail here - they are best tried by hands-on experimentation with the aid of the on-line help.
This tool replaces the [user]
facility of the tty interface, and
allows the user to type in short program code and compile it. The code is sent to
ECLiPSe as a string, and ECLiPSe will respond that `string' has been
compiled.
Note that the window's content is forgotten when the window is closed -
larger programs should be written using a text editor, source files
and the source file manager.
This tool provides an interface to the make facility of ECLiPSe - it displays the information used by make to track file statuses. All files that have been compiled by ECLiPSe in the current session would be listed, and the user can also use this to select files that needs editing or be compiled individually. Files which have not yet been compiled can be added to this list, but they must be compiled first before make will recompile them.
This tool allows the user to browse through the defined modules and predicates of the current session, showing the user the properties associated with the selected predicate. The modifiable properties can be changed.
This tool tries to display the source of a selected predicate. A predicate is selected in other tools, which will launch the source viewer window. The tool itself does not provide a selection mechanism. Note that the tool may be unable to display the source, because it may not be accessible to the user, and in addition, the tool uses a simple algorithm to try and find the predicate, so it may be unable to locate the predicate even if it is accessible.
This tool displays the currently delayed goals. It is possible to filter out uninteresting goals, e.g. by displaying only goals that are traceable or have a spy point set.
The user can select specific goals in the window and perform operations on the goals such as viewing its source, inspecting it, and putting a spy-point on the goal.
This tool is the debugger for tkeclipse, and replaces the tty-based tracer in functionality. One difference from the tty tracer is the display of the Call Stack, which shows the ancestors of the current goal. The user can select goals in this stack to perform operations such as viewing the source and inspecting them. The trace log window shows output similar to the output from the traditional tracer. Some of the most common debugger commands are available as buttons, and their keystroke equivalent can also be used to invoke the commands. The 'Continue Until' option provides a more sophisticated means of controlling which port the debugger should stop at.
Note that the tracer can be invoked to start tracing at a particular predicate. This is done by turning the `start_tracing' and `spy' predicate properties on for the predicate (this can be done from the predicate browser).
This tool provides a graphical browser for inspecting terms. Goals and data terms are displayed as a tree structure. Sub-trees can be collapsed and expanded by double-clicking. A navigation panel can be launched which provides arrow buttos as an alternative way to navigate the tree.
The Inspector tool can be invoked from within other tools such as the tracer and the delayed goals viewer, but it can also be invoked on its own, in which case the term being inspected is the current goal. Note that when the Inspector is active, interactions with the other tkeclipse windows are disallowed. This prevents the term from changing while being inspected. To continue tkeclipse, the inspector window must be closed.
This tool shows the settings of some global flags, which can be accessed
via the set_flag/2
and get_flag/2
predicates.
The tool displays some of the statistics on the current memory usage and
timings, information which can also be obtained using
statistics/0,2
. However, the information is displayed in a graphical
form, and is also updated automatically at regular intervals, allowing the
user to monitor the changing statistics as a program is executing.
This tool allows the user to send a simple query to ECLiPSe even while ECLiPSe is running some program and the Toplevel Query Entry window is unavailable. Note that the reply is shown in EXDR format (see the ECLiPSe Embedding and Interfacing Manual).
This tool provides an interface to the help/1
facility of
ECLiPSe. A simple form of `hypertext' facility is provided in that the
user can double click on any word in the window to select the word in the
entry window.
This tool provides a method to display the values of terms in a matrix form. It is particularly useful because it can display the attributes of an attributed variable4.1. The tool is invoked from ECLiPSe code with just one predicate. This predicate is considered a no-op in the tty based ECLiPSe, and so the same code can be run without modification in either environment.
This tool must be invoked from ECLiPSe code, using the
make_display_matrix/2,5
predicates. Only this one predicate needs to
be added, and no other changes need to be made to the code. For example, in
the following fragment of a N-queens program, only one extra line has been
added to invoke a display matrix:
queens(N, List) :- length(List, N), List :: 1..N, make_display_matrix(List/0, queens), % sets up a matrix with all variables in 1 row. This is the only % extra goal that has to be added to enable monitoring alldistinct(List), constrain_queens(List), labeling(List).
Figures 4.2 and 4.3 show the tool
invoked with the example N-Queens programs for 4 Queens, at the start
initially and during the execution of the program. The name of the display
window is specified by the second argument of make_display_matrix/2
,
along with the module it is in. The values of the terms are shown in the
matrix, which can be one dimensional (as in this case), or two
dimensional. Break-points can be set on each individual cell of the matrix
so that execution will stop when the cell is updated. The matrix can be
killed using the `Kill display' button. Left-clicking on a cell will bring
up a menu which shows the current and previous value of the term in the
cell (the current value is shown because the space available in the cell
may be too small to fully display the term), and allow the user to inspect
the term using the inspector.
Note the display matrix can be used independently of, or in conjunction with, the tracer. Multiple display matrices can be created to view different terms.
The following predicates are available in conjunction with the display matrix:
The terms are monitored by placing a demon suspension on the variables in each term. When a demon wakes, the new value of the term it is associated with is sent to the display matrix (and possibly updated, depending on the interactive settings on the matrix). When the new value is backtracked, the old value is sent to the display matrix. The other arguments in this predicate is used to control when the demon wakes, and what sort of information is monitored. Prio is the priority that the demon should be suspended at, Type is designed to specify the attributes that is being monitored (currently all attributes are monitored, and Type is a dummy argument), CondList is the suspension list that the demon should be added to. Depending on these arguments, the level of monitoring can be controlled. Note that it is possible for the display matrix to show values that are out of date because the change was not monitored.
The display matrix will be removed on backtracking. However, it will
not be removed if make_display_matrix has been
cut - kill_display_matrix/1
can be used to explicitly remove the
matrix in this case.
Destroys an existing display matrix. The display matrix is removed from being displayed, and from ECLiPSe so that the name can be reused. This is the only way to remove a display matrix if it is not removed normally when the original make_display_matrix used to create the matrix was unable to remove the matrix on backtracking because of cuts. It can also be used to remove a display matrix at any other time, but there may be less need for this.
The Name can be specified as Name@Module
, where Name was the original
name given to the display matrix, and Module the module in which the
display matrix was created in (this is the format that the name appears
in the title bar of the display matrix). This allows the display matrix
to be killed from any module.