6.2 Curses Overview

Curses, the DEC C Screen Management Package, is composed of DEC C RTL functions and macros that create and modify defined sections of the terminal screen and optimize cursor movement. Using the screen management package, you can develop a user interface that is both visually attractive and user-friendly. Curses is terminal-independent and provides simplified terminal screen formatting and efficient cursor movement.

Most Curses functions and macros are listed in pairs where the first routine is a macro and the second is a function beginning with the prefix "w," for "window." These prefixes are delimited by brackets ([ ]). For example, [w]addstr designates the addstr macro and the waddstr function. The macros default to the window stdscr; the functions accept a specified window as an argument.

To access the Curses functions and macros, include the <curses.h> header file.

The terminal-independent Screen Management Software, which is part of the OpenVMS RTL, is used to implement Curses. For portability purposes, most functions and macros are designed to perform in a manner similar to other C implementations. However, the Curses routines depend on the OpenVMS system and its Screen Management Software, so performance of some functions and macros could differ slightly from those of other implementations.

Some functions and macros available on other systems are not available with the DEC C RTL Curses package.

Some functions, such as [w]clrattr, [w]insstr, mv[w]insstr, and [w]setattr are specific to DEC C for OpenVMS Systems and are not portable.

Table 6-1 lists all of the Curses functions and macros found in the DEC C RTL. For more detailed information on each function and macro, see the Reference Section.

Table 6-1 Curses Functions and Macros

Function or Macro  Description 
[w]addch  Adds a character to the window at the current position of the cursor. 
[w]addstr  Adds a string to the window at the current position of the cursor. 
box  Draws a box around the window. 
[w]clear  Erases the contents of the specified window and resets the cursor to coordinates (0,0). 
clearok  Sets the clear flag for the window. 
[w]clrattr  Deactivates the video display attribute within the window. 
[w]clrtobot  Erases the contents of the window from the current position of the cursor to the bottom of the window. 
[w]clrtoeol  Erases the contents of the window from the current cursor position to the end of the line on the specified window. 
[no]crmode  Sets and unsets the terminal from cbreak mode. 
[w]delch  Deletes the character on the specified window at the current position of the cursor. 
[w]deleteln  Deletes the line at the current position of the cursor. 
delwin  Deletes the specified window from memory. 
[no]echo  Sets the terminal so that characters may or may not be echoed on the terminal screen. 
endwin  Clears the terminal screen and frees any virtual memory allocated to Curses data structures. 
[w]erase  Erases the window by painting it with blanks. 
[w]getch  Gets a character from the terminal screen and echoes it on the specified window. 
[w]getstr  Gets a string from the terminal screen, stores it in a character variable, and echoes it on the specified window. 
getyx  Puts the (y,x) coordinates of the current cursor position on the window in the variables y and x. 
[w]inch  Returns the character at the current cursor position on the specified window without making changes to the window. 
initscr  Initializes the terminal- type data and all screen functions. 
[w]insch  Inserts a character at the current cursor position in the specified window. 
[w]insertln  Inserts a line above the line containing the current cursor position. 
[w]insstr  Inserts a string at the current cursor position on the specified window. 
leaveok  Leaves the cursor at the current coordinates after an update to the window. 
longname  Assigns the full terminal name to a character name that must be large enough to hold the character string. 
[w]move  Changes the current cursor position on the specified window. 
mv[w]addch  Moves the cursor and adds a character to the specified window. 
mv[w]addstr  Moves the cursor and adds a string to the specified window. 
mvcur  Moves the terminal's cursor. 
mv[w]delch  Moves the cursor and deletes a character on the specified window. 
mv[w]getch  Moves the cursor, gets a character from the terminal screen, and echoes it on the specified window. 
mv[w]getstr  Moves the cursor, gets a string from the terminal screen, stores it in a variable, and echoes it on the specified window. 
mv[w]inch  Moves the cursor and returns the character on the specified window without making changes to the window. 
mv[w]insch  Moves the cursor and inserts a character in the specified window. 
mv[w]insstr  Moves the cursor and inserts a string in the specified window. 
mvwin  Moves the starting position of the window to the specified coordinates. 
newwin  Creates a new window with lines and columns starting at the coordinates on the terminal screen. 
[no]nl  Provided only for UNIX software compatibility and has no functionality in the OpenVMS environment. 
overlay  Writes the contents of one window that will fit over the contents of another window, beginning at the starting coordinates of both windows. 
overwrite  Writes the contents of one window, insofar as it will fit, over the contents of another window beginning at the starting coordinates of both windows. 
[w]printw  Performs a printf on the window starting at the current position of the cursor. 
[no]raw  Provided only for UNIX software compatibility and has no functionality in the OpenVMS environment. 
[w]refresh  Repaints the specified window on the terminal screen. 
[w]scanw  Performs a scanf on the window. 
scroll  Moves all the lines on the window up one line. 
scrollok  Sets the scroll flag for the specified window. 
[w]setattr  Activates the video display attribute within the window. 
[w]standend  Deactivates the boldface attribute for the specified window. 
[w]standout  Activates the boldface attribute of the specified window. 
subwin  Creates a new subwindow with lines and columns starting at the coordinates on the terminal screen. 
touchwin  Places the most recently edited version of the specified window on the terminal screen. 
wrapok  OpenVMS Curses only. Allows the wrapping of a word from the right border of the window to the beginning of the next line. 

[1] Copyright (c) 1981 Regents of the University of California.

All rights reserved.


Previous Page | Next Page | Table of Contents | Index