mglib

Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes

cmdline_tools/

mg_statusline.pro


Routines

top mg_statusline

mg_statusline, str [, column] [, length=integer] [, /clear] [, /left] [, /right] [, /quiet] [, /close], enable=enable, disable=disable [, /nocr] [, error=long]

Maintain a one-line status line on a VT100-compatible terminal (Unix only). Compatible with the interface of Craig Markwardt's STATUSLINE routine.

Programs that run for extended periods of time can inform the user of the status of the computation by updating their status on a single line instead of cluttering the console with output from multiple PRINT statements.

MG_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. To close the file unit, call:

IDL> mg_statusline, /close
Procedures that finish their computation, or wish to make normal output to the console, should first clear the terminal line with:
IDL> mg_statusline, /clear
If using LENGTH to output status messages, set the same length on the clear. This will ensure that the console is uncluttered before printing.

By default, MG_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:

IDL> mg_statusline, /enable
and disable it by calling:
IDL> mg_statusline, /disable
But if /dev/tty can't be opened, no output will appear even if explicitly enabled.

Parameters

str in required type=string

a string to be placed on the current line

column in optional type=integer default=0

the starting column number, beginning with zero

Keywords

length in optional type=integer default=strlen(str)

the record length; strings longer than this length will be truncated

clear in optional type=boolean

if set, clear the current line to the end; control returns immediately, i.e., no output is made

left in optional type=boolean

set to left justify the output; the default unless RIGHT is set

right in optional type=boolean

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 in optional type=boolean

if set, then no output is made (for this call only)

close in optional type=boolean

If set, instruct MG_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, MG_STATUSLINE is called again, the terminal device will be re-opened.

enable
disable
nocr in optional type=boolean

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. The default is for the cursor to return to column 0 after each output.

error out optional type=long

set to a named variable to retrieve the error status; 0 for success, other values indicate errors

Examples

Try the example main-level program at the end of this file. Run it with:

IDL> .run mg_statusline
The example does the following:
for i = 0, 10 do begin mg_statusline, string(i, format='(%"item: %d")'), /right, length=100 wait, 0.2 endfor mg_statusline, /clear, length=100 print, 'This is the next line of normal output.'

File attributes

Modification date: Wed May 14 15:07:14 2014
Lines: 101
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.