MONITOR Declaration

The MONITOR declaration designates items to be monitored during execution of the program and the method by which the items are monitored. The MONITOR declaration is used when diagnostic information is needed.

<monitor declaration>

── MONITOR ────────────────────────────────────────────────────────────►
  ┌◄─────────────────────────── , ───────────────────────────┐
  │                                ┌◄──────── , ───────┐     │
►─┴─┬─<file identifier>──────┬─ ( ─┴─<monitor element>─┴─ ) ─┴─────────┤
    └─<procedure identifier>─┘

Each time an identifier designated as a monitor element is used in one of the ways described in this section, the identifier and its current value are written to the file or passed as parameters to the procedure specified in the MONITOR declaration.

The monitor action does not occur within procedures that are declared before the MONITOR declaration is encountered. Monitoring of a variable in the monitor list does not occur if this identifier is passed as an actual parameter to a call-by-name formal parameter that is modified within the procedure. In addition, the control variable in a FOR statement cannot be monitored. The monitor action does not occur when a value changes as the result of a READ statement or a REPLACE statement.

When a procedure identifier is specified in the MONITOR declaration, printing of the monitor element must be performed by the procedure. Also, the monitoring procedure performs the specified operations depending on the values passed to it.

For a debugging feature, refer to “TADS Option” in Compiling Programs.