#include "cobscreen.h" int cobtermmode(const cobuns8_t *mode);
mode | The terminal mode; the address of a byte that is either 0 or 1. |
call "cobtermmode" using mode
The following code switches the terminal into wide mode, displays some text, waits for a keypress and restores the terminal back to normal mode:
cobuns8_t mode_on=1, mode_off=0; if (cobtermmode(&mode_on) == 0) { /* Display some text over beyond column 80 to demo */ /* wide mode */ cobmove(10, 100); cobprintf("Line 10, Column 100"); cobgetch(); /* Wait for a key press */ cobtermmode(&mode_off); /* Back into standard mode */ }
Comments:
This routine toggles the terminal screen between default and wide modes, if this functionality is present in the terminfo database for the terminal type you are using.
To function correctly, the terminfo database must support a terminal whose name is the current terminal type with a -w suffix, and the terminfo entries must also have appropriate initialization and/or reset capabilities. For example, if the current terminal is vt100 then there also needs to be a vt100-w in the terminfo database and the vt100 and vt100-w need appropriate is1, is2, is3, rs1, rs2 and/or rs3 entries.
The mode parameter should be 0 to put the terminal into standard (default) terminal mode or 1 to put the terminal into wide terminal mode. Any other value gives undefined results.
When the terminal mode is successfully toggled, the screen handling system is initialised (if it wasn't already), the screen is cleared and the cursor positioned in the home position.
This routine can be safely called from COBOL. See the section Wide Terminal Modein the chapter Terminfo Database and Terminal Devices of yourUser's Guide for more details.
When using this routine, you must be aware of the following:
See the chapter Terminfo Database and Terminal Devicesin yourUser's Guide for more details on the terminfo search order.
This routine returns 0 on success, non-zero on error. The following error values are currently returned