Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
In  making  available  the generalized terminal	descriptions in	,
much information was made available to the programmer, but little
work  was  taken out of	one's hands.  The purpose of this package
is to allow the	C programmer to	do the most common type	of termi-
nal dependent functions, those of movement optimization	and opti-
mal screen updating, without doing any of  the	dirty  work,  and
(hopefully)  with  nearly  as much ease	as is necessary	to simply
print or read things.  The package is split into three parts: (1)
Screen	updating;  (2)	Screen	updating with user input; and (3)
Cursor motion optimization.  It	is possible to use the motion op-
timization  without using either of the	other two, and screen up-
dating and input can be	done without any programmer knowledge  of
the  motion  optimization, or indeed the   itself.  In this docu-
ment, the following terminology	is kept	to with	 reasonable  con-

An  internal representation containing an image	of what	a section
     of	the terminal screen may	look like at some point	in  time.
     This  subsection  can  either  encompass the entire terminal
     screen, or	any smaller portion down to  a	single	character
     within that screen.

Sometimes called The package's idea of what the	terminal's screen
     currently looks like, what	the user sees  now.   This  is	a

This  is  a  subset of windows which are as large as the terminal
     screen, they start	at the upper left hand corner and  encom-
     pass the lower right hand corner.	One of these, is automat-
     ically provided for the programmer.  In order to use the li-
     brary,  it	 is necessary to have certain types and	variables
     defined.  Therefore, the programmer must have a line: at the
     top of the	program	source.	 The header file needs to include
     so	the one	should not do so oneself.

     The screen	package	also uses the Standard	I/O  library,  so
     includes  It  is redundant	(but harmless) for the programmer
     to	do it, too.  Also, compilations	should have the	following
     form:  cc	[ flags	] file ... -lcurses -ltermcap In order to
     update the	screen optimally, it is	necessary  for	the  rou-
     tines  to know what the screen currently looks like and what
     the programmer wants it to	look like next.	  For  this  pur-
     pose,  a  data  type  (structure) named is	defined	which de-
     scribes a window image to the routines, including its start-
     ing position on the screen	(the  of the upper left	hand cor-
     ner) and its size.	 One of	these (called for is a screen im-
     age  of  what  the	 terminal  currently looks like.  Another
     screen (called for	is provided by default	to  make  changes
     on.   A  window  is a purely internal representation.  It is
     used to build and store a potential image of  a  portion  of
     the  terminal.   It  doesn't  bear	any necessary relation to
     what is really on the terminal screen.  It	is more	 like  an
     array  of characters on which to make changes.  When one has
     a window which describes what some	part the terminal  should
     look  like,  the routine (or if the window	is not is called.
     makes the terminal, in the	area covered by	the window,  look
     like  that	window.	 Note, therefore, that changing	something
     on	a window Actual	updates	to the terminal	screen	are  made
     only  by  calling	or This	allows the programmer to maintain
     several different ideas of	what a portion	of  the	 terminal
     screen  should look like.	Also, changes can be made to win-
     dows in any order,	 without  regard  to  motion  efficiency.
     Then,  at	will,  the programmer can effectively say and let
     the package worry about the best way to do	this.  As  hinted
     above, the	routines can use several windows, but two are au-
     tomatically given:	which knows what the terminal looks like,
     and  which	is what	the programmer wants the terminal to look
     like next.	 The user should never	really	access	directly.
     Changes  should  be made to the appropriate screen, and then
     the routine (or should be called.	Many functions are set up
     to	 deal  with  as	 a default screen.  For	example, to add	a
     character to one calls with the  desired  character.   If	a
     different	window is to be	used, the routine (for is provid-

     Actually, is really a macro with arguments, as are	 most  of
     the  "functions" which deal with as a default.  This conven-
     tion of prepending	function names with a when they	are to be
     applied  to  specific  windows is consistent.  The	only rou-
     tines which do do this are	those to which a window	must  al-
     ways  be  specified.  In order to move the	current	 from one
     point to another, the routines and	are  provided.	 However,
     it	 is  often  desirable to first move and	then perform some
     I/O operation.  In	order to avoid clumsyness, most	I/O  rou-
     tines  can	 be  preceded by the prefix and	the desired  then
     can be added to the arguments to the function.  For example,
     the  calls	 move(yx);  addch(ch);	can be replaced	by mvadd-
     ch(yxch); and wmove(winyx); waddch(winch);	can  be	 replaced
     by	 mvwaddch(winyxch);  Note  that	 the  window  description
     pointer comes before the added .  If such pointers	are need,
     they are always the first parameters passed.

Want to link to this manual page? Use this URL:

home | help