Dec 232017
 
Adds and deletes experessions in Debug Watch window for TP V5.0+.
File TP5WATCH.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Adds and deletes experessions in Debug Watch window for TP V5.0+.
File Name File Size Zip Size Zip Type
WATCHDEM.PAS 1951 838 deflated
WATCHMGR.DOC 9477 3824 deflated
WATCHMGR.TPU 1600 972 deflated

Download File TP5WATCH.ZIP Here

Contents of the WATCHMGR.DOC file



Watch Manager Version 1.0

Copyright (c) 1989 Richard W. Prescott
All Rights Reserved



Files in this package:

WATCHMGR.DOC - This file
WATCHMGR.TPU - Watch Manager Version 1.0
WATCHDEM.PAS - Brief demo of WatchMgr



The following topics are discussed in this file:

0. Overview
1. Using WatchMgr
2. Conditional Example
3. Disclaimer
4. Source Code Availability
5. TP&Asm/TP&Asm-M



0. Overview


As discussed on page 140 of the Turbo 5.0 User's Guide, there may be
certain expressions that you commonly want to watch or evaluate at
certain points in your program. This package provides a convenient
alternative to the technique described there.

The unit WATCHMGR.TPU consists of three procedures and two functions
which may be used to automatically set and clear watch expressions
under program control as you trace your program in the Integrated
Development Environment. You are still free to manually set and
clear watches in addition to those being set automatically. Using
conditional compilation you can easily activate/deactivate the
automatic watch control.

Watch Manager Version 1.0 is copyrighted as indicated above. You
may however share this package and/or upload it to bulletin boards
as long as no fee is charged. User's groups and PD/shareware
distributors may charge a nominal fee, not to exceed $8, provided
it is accurately represented as payment for their services, not
payment for the software. In any case, the original unmodified
files must all be present.

Please report problems or suggestions to me at the address listed
in section 4, or to my CompUServe mailbox [76656,2476].



1. Using WatchMgr


To activate WatchMgr, simply place "WatchMgr" in the Uses clause of
the Main program you are debugging. You may then use any of the
routines AddWatch, DelWatch, ClrWatch, WatchCount, and WatchStr to
modify the display of watch expressions under program control.



The interface definitions for the five routines are as follows:

PROCEDURE AddWatch(WatchExpr: STRING);
PROCEDURE DelWatch(WatchExpr: STRING);
PROCEDURE ClrWatch;

FUNCTION WatchCount: WORD;
FUNCTION WatchStr(WatchNo: WORD): STRING;


AddWatch adds the designated watch expression to the watch window
with leading and trailing (but not intermediate) spaces removed.
The new watch becomes the "current" (highlighted/bulleted) watch.
Like the IDE menu commands, AddWatch permits multiple definitions
of the same watch expression. If there is a possibility that a
watch may already be defined, call DelWatch before AddWatch to
prevent an additional copy from being generated. AddWatch is
equivalent to the menu command "Break/Add watch".


DelWatch searches for the designated watch expression, and, if
found, deletes it from the watch window. Case differences and
leading/trailing spaces are ignored in searching for a match.
Thus DelWatch(' GLOBALVAR ');
will clear the watch set by
AddWatch('GlobalVar');
If the deleted watch was the "current" watch, the next older watch
becomes "current". Otherwise, the "current" watch is unchanged.
If multiple copies of the same watch expression are defined,
DelWatch will delete the oldest copy. DelWatch is an extension
of the menu command "Break/Delete watch".


ClrWatch clears all watch expressions from the watch window. It
is equivalent to the menu command "Break/Remove all watches".


WatchCount returns the current number of watches defined. There
is no IDE equivalent.


WatchStr returns the watch expression corresponding to the parameter
WatchNo (numbered from oldest to most recent). There is no IDE
equivalent.


The file WatchDem.Pas gives a brief demonstration of the use of
each of these routines.



2. Conditional Example

The following example shows how to use conditional compilation to
easily activate or deactivate the watch management routines:


Program Demo;
Uses Dos {$IFDEF Test} ,WatchMgr {$ENDIF} ;

CONST DemoVar: WORD = $15;

BEGIN
{$IFDEF Test} ClrWatch; AddWatch ('DemoVar,$'); {$ENDIF}
DemoVar := DosVersion;
END.


To activate the watch routines, set

Options/Compiler/Conditional defines

to include "test". If "test" is not defined, the compiled program
will include no WatchMgr code.


NOTE: the IDE watch management routines cannot (obviously) be used
in a program which is compiled to disk. If you should inadvertantly
compile to disk with WatchMgr included, the WatchMgr initialization
code will detect the absence of the IDE and halt with the message:

Watch Manager 1.0 Requires TURBO.EXE 5.0 (IDE)



3. DISCLAIMER OF WARRANTY

This software and accompanying documentation are provided "as is"
and without warranties as to performance or merchantability.

This package is provided without any express or implied warranties
whatsoever. Because of the diversity of conditions and hardware
under which this package may be used, no warranty of fitness for a
particular purpose is offered. The user is advised to test the
package thoroughly before relying on it. THE USER MUST ASSUME THE
ENTIRE RISK OF USING THE PACKAGE.



4. Source Code Availability.

For those who are interested in how this package works, the source
code is available from me for the following prices:

Source Listing .......... $5

Source Disk (5 1/4) ..... $8

The source code consists of a single PAS file containing about 350
lines of assembly code. It was compiled using the TP&Asm integrated
compile-time assembler (described below) running Turbo Pascal
Version 5.0.

To order, send a check or money order payable to:

Richard W. Prescott
724 Sauk Ridge Trail
Madison, WI 53705



5. TP&Asm/TP&Asm-M

TP&Asm is a small assembler which runs Turbo 4.0/5.0 (Integrated
Environment or TPC) as a subprocess and permits you to place
assembly language statements directly into your Pascal source code
in blocks beginning with the keywords "Assemble" and/or "Internal".

TP&Asm provides the convenience and flexibility of having "live"
assembly language in your programs which can be modified and
immediately recompiled with no need to exit and reassemble. You
have complete freedom to place assembly language anywhere in your
program, freely mix Pascal and assembly blocks, freely transfer
between Pascal and assembly blocks via Call/Jump/Loop/Goto to any
Pascal or assembly label, make direct Call, Jmp and Offset
references to Pascal Proc/Functions, and make simplified Pascal
style references to your Pascal and assembly variables and
parameters. Units compiled with TP&Asm can be distributed and
Used independent of TP&Asm.

With Turbo Version 5.0, you can trace your assembly code line by
line in the IDE. Using the record variable CPU defined in the unit
ASMWATCH (included), you can Watch, Evaluate, and Modify the CPU
registers and flags during the trace.

The result is an ASSEMBLY Development Environment which is identical
to your PASCAL Development Environment. It provides fast assembly
with no additional disk access, and reports assembly syntax errors
on the standard Turbo error line with cursor placed on the error.
It accepts the standard syntax of both MASM and A86, but also
provides certain enhancements such as the placement of named data
in the Code Segment.

TP&Asm Version 2.0 will be available from me for $49 plus $3 P&H.
The current Beta Test Version 2 is available now for $39 plus $3
P&H, with a free upgrade to 2.0 when it becomes available.

A shareable Memory Mode version called TP&Asm-M is also available.
The distinction between TP&Asm and TP&Asm-M is that TP&Asm-M is
intended for developing and debugging assembly language in the IDE,
but not for final compilation. You can compile to Memory (with the
standard Turbo style interactive syntax error detection) and Trace
your assembly code in the IDE with full capability to Watch,
Evaluate, and Modify the CPU registers and Flags - then convert to
INLINE or EXTERNAL after the code is fully developed. TP&Asm-M's
INTERNAL statement and its support of the standard syntax of MASM,
A86, and INLINE.COM simplifies this conversion.

The TP&Asm-M distribution disk can be ordered from me for $5 plus
$3 P&H, with the $5 being credited toward subsequent registration
of TP&Asm or TP&Asm-M. It can also be downloaded from the IBMPRO
or BPROGA forums on CompUServe. Look for TPA2-A.ARC and TPA2-R.ARC.
Registration for TP&Asm-M is $19.


To order TP&Asm, please send a check or money order payable to:

Richard W. Prescott
724 Sauk Ridge Trail
Madison, WI 53705

Please include the following information:

1. Full Version number of the Turbo Pascal compiler you now use.

2. Your registration number for that compiler.

3. If you obtained TP&Asm-M from a bulletin board:
3a. Area code and phone number of that bulletin board
3b. Full Version number of the TP&Asm-M version you have
3c. Directory Date of the README file


 December 23, 2017  Add comments

Leave a Reply