[ Debugging | Reference Manual | Alphabetic Index ]

make_display_matrix(+Terms, +Name)

Creates a display matrix of terms that can be monitored with the graphical ECLiPSe (the predicate will succeed silently in tty ECLiPSe).
Terms
One or two dimensional array, or List/integer.
Name
An atomic term.

Description

Set up a one or two dimensional matrix of terms that can then be monitored for changes in their values. The terms are either provided in the form of an array (the nested structure type, compatible with dim/2), or in the form +List/+Spec, where List is a list of the terms, and Spec is an integer specifying the number of cells per row of the matrix, 0 means that the matrix is to have only one row (except if the members of the list are matricies of the same size, in which case a two dimensional matrix will be created). If List is supplied without a Spec, this is treated as Spec = 0. Name specifies the name that is associated with this display matrix, and cannot be used for another display matrix that is active at the same time in the same module. The name is mapped into a string internally, so a name that is a atom or number is the same name as its equivalent string (i.e. 'matrix' and "matrix" are the same name).

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. This predicate sets default value for how the demon is suspended: it is suspended with a priority of 1, and in the constrained suspension list. This should enable it to monitor all changes unless the changes were also effected by suspensions of priority 1.

The display matrix will be removed on backtracking. However, it will not be removed if make_display_matrix has been cut. It is possible to explicitly remove a matrix with kill_display_matrix/1.

Each cell of the display matrix represents one term. The value of the term is displayed in the cell, and break-points can be set from a pop-up menu so that execution suspends when an update occurs in a cell. The term can also be inspected by the inspector. The actual current value of the term will be examined, which may be different from the value shown in the cell depending on how often the cell is updated. With breaks, the changes due to forward execution (further constraining of a variable's value) and backtracking are shown in different colours. Inspection is not allowed on a term that has just been backtracked, because the actual backtracking of the value have not yet occurred (the demon sends the old value just before the actual backtracking). It can be examined at the next break-point. The pop-up menu also shows the current displayed value, and the previous displayed value for the cell.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Resatisfiable

No (but display matrix removed on backtracking).

Exceptions

(5) type error
Invalidly constructed Terms, or non-atomic Name.
(6) out of range
Name has already been given to another display matrix that is still active.

Examples

   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),
       % Label the variables
       labeling(List).




See Also

make_display_matrix / 5, kill_display_matrix / 1, dim / 2