Using ClearWin+, simple programs can be compiled unchanged. As soon as standard
output is generated which would have gone to the screen, or the program
attempts to read from the keyboard, a ClearWin window is set up by the
ClearWin+ system. Successive lines of output are written to this window
(entitled Output), which scrolls when necessary. The window acts like a
terminal, so keyboard input is echoed in the window. The window can be
scrolled, moved, or resized by the user. The system retains the information
output to the window so that WM_PAINT messages can be handled without any
special programmer action. As an example, here is a complete application
program to calculate square roots:
DOUBLE PRECISION d
Notice that this program does not require an explicit exit path. Each time it
pauses for input, the system will be prepared to accept a window close request
(Alt-F4). When your program exits, its window will remain open until closed by
the user in order to ensure that the user has time to read the output.
Because ClearWin+ must store away every line that you send to a window - to
cater for possible repaint requests or user scroll operations - it is
important to limit the amount of output to manageable proportions. Store is
consumed from the heap and is reclaimed when the ClearWin window is
closed or cleared. It is recommended that the routine set_all_max_lines@
(or set_max_lines@) be used to limit the amount of store that is consumed.
In a similar way, DOS applications that contain calls to the Silverfrost graphics
library can also be compiled unchanged. In this case ClearWin+ will
automatically create a simple format window for the drawing.