home *** CD-ROM | disk | FTP | other *** search
- --------------------------------------------------------------------------
- DOSWDW: A windowed execution of a child process in Turbo C.
- --------------------------------------------------------------------------
-
- Author: Edward V. Dong Date: 29 December 1989
-
- DOSWDW is based on EXECWINDOW by Kim Kokkonen, TurboPower Software,
- which was released to the public domain, and which I ported to Turbo C.
-
- What it does is to use a routine doswdw() to keep the video output of a
- child process within a specified window on the screen. The technique
- used is to grab interrupt 21h and thus control all writes to the
- standard output and error devices. These are rerouted to the screen,
- within the specified window. Note that the technique will not work for
- programs that write directly to video memory, through the BIOS, or
- through some other file handle assigned to the console. It does work
- with standard DOS commands, with the TPC.EXE compiler, and with other
- command line utilities like ARCX.COM.
-
- Files included are: doswdw.asm (assembly code), doswdw.obj (large
- model), and test files (test2.c, test2.prj, test2.exe). The source
- code (doswdw.asm and test2.c) is extensively annotated, and provides a
- good explanation of how the code works.
-
- Note that the standard definition of getvect and setvect are altered, as
- follows:
-
- void interrupt (* _Cdecl getvect(int interruptno)) ();
- void _Cdecl setvect (int interruptno,void far *isr);
-
- Prototypes:
- ----------
- void interrupt doswdw(void); /* DOS window routine */
- void far setup21(int NumberOfRows); /* doswdw() setup routine */
-
- NOTE: The parameter NumberOfRows should be either ZERO (0) or the
- exact number of rows in the window that you use.
-
- Required Global Variables:
- -------------------------
- void far *newint21 = &doswdw; /* points to doswdw() */
- int wdwpos, /* cursor position in window */
- wdwupr, /* top right corner */
- wdwlwr; /* bottom left corner */
- char wdwattr; /* desired attribute */
-
- NOTE: Parameters 'wdwpos', 'wdwupr', and 'wdwlwr' are actually
- packed short unsigned integers, each comprising bytes for the x-
- and y-coordinates. See code below for order of bytes. The x- and
- y-coordinates are DECREMENTED by one to conform with the standard
- BIOS screen conventions which start from (0,0), instead of Turbo
- C's convention of starting at (1,1).
-
- Recommended (but not required) Global Variable:
- ----------------------------------------------
- void far *oldint21 = NULL; /* to save the old int 21h vector */
-
- FINALLY: Here's the prototype for DosWdw (please note the changed
- capitalization!), where pausing is embedded. It creates a window using
- the standard Turbo C calls, and runs the command ('cmd') via a system()
- call.
-
- void far DosWdw(int xleft,int ytop,int xrite,int ybottom,int attrib,char *cmd)
-
- xleft,ytop,xrite,ybottom are the coordinates of the WINDOW you want,
- in standard Turbo C screen coordinate convention.
-
- 'attrib' is the text attribute to be used.
-
- 'cmd' is the command to initiate the child process, in the test
- case used, via the system() command.
-
- Basically, you now have a complete package to be integrated into your
- programs, and which is easily alterable. If you do, I'd appreciate a
- copy of these program(s) in source; money is also very nice, too! and a
- credit line somewhere for yours truly.