Curses (programming library)

From Wikipedia, the free encyclopedia

This article is about the Unix console library. For other uses, see curse. For the interactive fiction game, see Curses (computer game).

Curses is a terminal control library for Unix-like systems, enabling the construction of text user interface (TUI) applications. It was invented by Ken Arnold and originally released with BSD UNIX, where it was used for several games, most notably the Rogue game. The name curses is a pun on cursor optimization. Sometimes it is incorrectly stated that curses was used by the vi editor. In fact the code in curses that optimizes moving the cursor from one place on the screen to another was borrowed from vi, which predated curses.[citation needed]

Using curses, programmers are able to write text-based applications without writing directly for any specific terminal type. The curses library on the executing system takes care of sending the correct control characters to the monitor in use based on the terminal type. The model is one of the programmer having one or more window objects that map on to the real display screen. Each window is a character matrix, and the programmer sets up the window to look as they want the display to look, and then tells the curses package to update the screen. The package figures out a relatively minimal set of changes needed to make to the display and then executes these using the terminal's specific capabilities and control sequences.

In the end, this means that the programmer simply creates a character matrix of how the screen should look and lets curses handle doing the work to make it so.

[edit] See also

[edit] References

[edit] External links

In other languages