link wopen
April 15, 2002; Gregg M. Townsend and Ralph E. Griswold
Requires: Version 9 graphics
This file is in the public domain.
These procedures provide window input and output using "W" names as substitutes for standard input and output functions. WOpen() opens and returns a window; the result is also assigned to &window if &window is null. WOpen(attrib, ...) opens and returns a window. WRead(W) reads a line from a window. WReads(W, i) reads i characters from a window. WWrite(W, s, ...) writes a line to window. WWrites(W, s, ...) writes a partial line to window. WDelay(W, n) flushes a window, then delays n milliseconds. default: n = 1 WClose(W) closes a window; if W === &window, sets &window to &null. WDone(), WQuit(), QuitCheck(), and QuitEvents() incorporate knowledge of the Icon standard set of "quit" events, currently the letters "q" or "Q". The procedures themselves are trivial. WQuit() consumes unread window events and succeeds if a quit event is seen. It does not wait. WDone() waits until a quit event is read, then exits the program. QuitCheck(ev) calls exit() if its parameter is a quit event; QuitCheck can be used with the vidget package as a default event handler. QuitEvents() generates the standard set of quit events. ZDone() is a zooming version of WDone(). If the window is resized while waiting for a quit event, its contents are zoomed to fill the new size. Zooming to a multiple of the original size can also be accomplished by typing a nonzero digit into the window. SubWindow(W, x, y, w, h) produces a subwindow by creating and reconfiguring a clone of the given window. The original window is not modified. In the clone, which is returned, clipping bounds are set by the given rectangle and the origin is set at the rectangle's upper left corner.