;+ ; NAME: ; STATUSLINE ; ; AUTHOR: ; Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770 ; craigm@lheamail.gsfc.nasa.gov ; ; PURPOSE: ; Maintain a one-line status line on a VT100-compatible terminal. (Unix) ; ; MAJOR TOPICS: ; Text Output, Terminal. ; ; CALLING SEQUENCE: ; STATUSLINE, string, column, LENGTH=length, [/CLOSE,] ; [/CLEAR,] [/LEFT,] [/RIGHT,] [/QUIET,] [/ENABLE,] [/DISABLE] ; ; DESCRIPTION: ; ; STATUSLINE maintains the current line of a VT100- or ; ANSI-compatible terminal, usually as a status line. ; ; Programs that run for extended periods of time can inform the user ; of the status of the computation by printing vital information. ; Instead of cluttering the console by using the PRINT procedure, ; which uses a new line with each call, STATUSLINE will re-use the ; same line. This can make a cleaner interface. ; ; STATUSLINE interacts directly with the Unix terminal device, ; sending VT100-compatible cursor commands. As a side effect it ; opens the terminal device /dev/tty and allocates a logical unit ; number. Picky programmers should call STATUSLINE, /CLOSE to close ; the file unit. ; ; Procedures that finish their computation, or wish to make normal ; output to the console should first clear the terminal line with ; STATUSLINE, /CLEAR. This will ensure that the console is ; uncluttered before printing. ; ; By default, STATUSLINE enables output for terminal types vt100, ; vtnnn, xterm, dec, or ansi. *No* output appears on other ; terminals. You can enable it explicitly by calling STATUSLINE, ; /ENABLE, and disable it by calling STATUSLINE, /DISABLE. ; ; INPUTS: ; ; STRING - A string to be placed on the current line. ; ; OPTIONAL INPUTS: ; ; COLUMN - The starting column number, beginning with zero. ; Default: zero. ; ; INPUT KEYWORD PARAMETERS: ; ; LENGTH - the record length, an integer. Strings longer than this ; length will be truncated. ; Default: strlen(STRING) ; ; CLEAR - if set, clear the current line to the end. Control ; returns immediately (i.e., no output is made). ; ; LEFT - if set, then left justify the string within the record. ; If the string is longer than the record length, then the ; leftmost portion of the string is printed. ; The Default (if /RIGHT is not given). ; ; RIGHT - if set, then right jusfity the string within the record. ; If the string is longer than the record length, then the ; rightmost portion of the string is printed. ; ; QUIET - if set, then no output is made (for this call only). ; ; NOCR - if set, no carriage return operation is performed after ; output. This also has the side effect that in subsequent ; calls, column "0" will not cause the cursor to move. ; Default: cursor returns to column 0 after each output. ; ; ENABLE - if set, then permanently enable output by STATUSLINE. ; Normally STATUSLINE automatically enables output only for ; vt100-compatible terminals. By setting /ENABLE, you ; override this automatic test. However, /QUIET will ; still override ENABLE in an individual call. ; ; DISABLE - if set, then permanently disable output by STATUSLINE. ; When disabled, no output is ever produced. Output can ; only be re-enabled again by using the /ENABLE flag. ; ; CLOSE - if set, instruct STATUSLINE to close the terminal device ; logical unit number. Users should perform this operation ; when the computation has finished so that the terminal ; device is not left dangling open. If, at a later time, ; STATUSLINE is called again, the terminal device will be ; re-opened. ; ; OUTPUTS: ; NONE ; ; SEE ALSO: ; PRINT, PRINTF ; PRINTLOG - to maintain transcript of IDL output ; ; MODIFICATION HISTORY: ; Written, CM, 1997-1998 ; Documented, CM, Sep 1999 ; Added NOCR keyword, CM, 28 Oct 1999 ; Doesn't crash if can't write to TTY. Returns silently. CM, 16 ; Nov 1999. ; Added PRINTLOG to "SEE ALSO", CM, 22 Jun 2000 ; Keyword QUIET now causes earlier exit; catch errors in the CLEAR ; case, CM, 12 Oct 2001 ; Allow variations on the "xterm" terminal type, CM, 26 Jun 2007 ; ; $Id: statusline.pro,v 1.5 2007/06/26 16:15:12 craigm Exp $ ; ;- ; Copyright (C) 1998, 1999, 2000, 2001, 2007, Craig Markwardt ; This software is provided as is without any warranty whatsoever. ; Permission to use, copy and distribute unmodified copies for ; non-commercial purposes, and to modify and use for personal or ; internal use, is granted. All other rights are reserved. ;-