]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/html/man/curs_terminfo.3x.html
ncurses 5.0
[ncurses.git] / Ada95 / html / man / curs_terminfo.3x.html
1 <HTML>
2 <BODY>
3 <PRE>
4        <STRONG>setupterm</STRONG>, <STRONG>setterm</STRONG>, <STRONG>set_curterm</STRONG>, <STRONG>del_curterm</STRONG>, <STRONG>restartterm</STRONG>,
5        <STRONG>tparm</STRONG>, <STRONG>tputs</STRONG>, <STRONG>putp</STRONG>, <STRONG>vidputs</STRONG>,  <STRONG>vidattr</STRONG>,  <STRONG>mvcur</STRONG>,  <STRONG>tigetflag</STRONG>,
6        <STRONG>tigetnum</STRONG>,   <STRONG>tigetstr</STRONG>   -  <STRONG>curses</STRONG>  interfaces  to  terminfo
7        database
8
9
10 </PRE>
11 <H2>SYNOPSIS</H2><PRE>
12        <STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
13        <STRONG>#include</STRONG> <STRONG><term.h></STRONG>
14
15        <STRONG>int</STRONG> <STRONG>setupterm(const</STRONG> <STRONG>char</STRONG> <STRONG>*term,</STRONG> <STRONG>int</STRONG> <STRONG>fildes,</STRONG> <STRONG>int</STRONG> <STRONG>*errret);</STRONG>
16        <STRONG>int</STRONG> <STRONG>setterm(const</STRONG> <STRONG>char</STRONG> <STRONG>*term);</STRONG>
17        <STRONG>TERMINAL</STRONG> <STRONG>*set_curterm(TERMINAL</STRONG> <STRONG>*nterm);</STRONG>
18        <STRONG>int</STRONG> <STRONG>del_curterm(TERMINAL</STRONG> <STRONG>*oterm);</STRONG>
19        <STRONG>int</STRONG>  <STRONG>restartterm(const</STRONG>  <STRONG>char</STRONG>  <STRONG>*term,</STRONG>   <STRONG>int</STRONG>   <STRONG>fildes,</STRONG>   <STRONG>int</STRONG>
20        <STRONG>*errret);</STRONG>
21        <STRONG>char</STRONG> <STRONG>*tparm(const</STRONG> <STRONG>char</STRONG> <STRONG>*str,</STRONG> <STRONG>...);</STRONG>
22        <STRONG>int</STRONG> <STRONG>tputs(const</STRONG> <STRONG>char</STRONG> <STRONG>*str,</STRONG> <STRONG>int</STRONG> <STRONG>affcnt,</STRONG> <STRONG>int</STRONG> <STRONG>(*putc)(int));</STRONG>
23        <STRONG>int</STRONG> <STRONG>putp(const</STRONG> <STRONG>char</STRONG> <STRONG>*str);</STRONG>
24        <STRONG>int</STRONG> <STRONG>vidputs(chtype</STRONG> <STRONG>attrs,</STRONG> <STRONG>int</STRONG> <STRONG>(*putc)(char));</STRONG>
25        <STRONG>int</STRONG> <STRONG>vidattr(chtype</STRONG> <STRONG>attrs);</STRONG>
26        <STRONG>int</STRONG> <STRONG>mvcur(int</STRONG> <STRONG>oldrow,</STRONG> <STRONG>int</STRONG> <STRONG>oldcol,</STRONG> <STRONG>int</STRONG> <STRONG>newrow,</STRONG> <STRONG>int</STRONG> <STRONG>newcol);</STRONG>
27        <STRONG>int</STRONG> <STRONG>tigetflag(const</STRONG> <STRONG>char</STRONG> <STRONG>*capname);</STRONG>
28        <STRONG>int</STRONG> <STRONG>tigetnum(const</STRONG> <STRONG>char</STRONG> <STRONG>*capname);</STRONG>
29        <STRONG>char</STRONG> <STRONG>*tigetstr(const</STRONG> <STRONG>char</STRONG> <STRONG>*capname);</STRONG>
30
31
32 </PRE>
33 <H2>DESCRIPTION</H2><PRE>
34        These low-level routines must be called by  programs  that
35        have to deal directly with the <STRONG>terminfo</STRONG> database to handle
36        certain terminal capabilities, such as  programming  func-
37        tion  keys.   For all other functionality, <STRONG>curses</STRONG> routines
38        are more suitable and their use is recommended.
39
40        Initially,  <STRONG>setupterm</STRONG>  should  be   called.    Note   that
41        <STRONG>setupterm</STRONG>  is automatically called by <STRONG>initscr</STRONG> and <STRONG>newterm</STRONG>.
42        This  defines  the  set  of  terminal-dependent  variables
43        [listed in <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>].  The <STRONG>terminfo</STRONG> variables <STRONG>lines</STRONG> and
44        <STRONG>columns</STRONG>  are  initialized  by  <STRONG>setupterm</STRONG>  as  follows:  If
45        <STRONG>use_env(FALSE)</STRONG>  has  been  called,  values  for  <STRONG>lines</STRONG> and
46        <STRONG>columns</STRONG> specified in <STRONG>terminfo</STRONG> are used.  Otherwise, if the
47        environment  variables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> exist, their val-
48        ues are used.  If these environment variables do not exist
49        and the program is running in a window, the current window
50        size is used.  Otherwise, if the environment variables  do
51        not  exist,  the values for <STRONG>lines</STRONG> and <STRONG>columns</STRONG> specified in
52        the <STRONG>terminfo</STRONG> database are used.
53
54        The header files <STRONG>curses.h</STRONG> and <STRONG>term.h</STRONG>  should  be  included
55        (in  this order) to get the definitions for these strings,
56        numbers,  and  flags.   Parameterized  strings  should  be
57        passed  through  <STRONG>tparm</STRONG>  to instantiate them.  All <STRONG>terminfo</STRONG>
58        strings [including the output of <STRONG>tparm</STRONG>] should be  printed
59        with  <STRONG>tputs</STRONG> or <STRONG>putp</STRONG>.  Call the <STRONG>reset_shell_mode</STRONG> to restore
60        <STRONG>enter_ca_mode</STRONG> upon startup and should output  <STRONG>exit_ca_mode</STRONG>
61        before  exiting.   Programs  desiring shell escapes should
62        call
63
64        <STRONG>reset_shell_mode</STRONG> and output <STRONG>exit_ca_mode</STRONG> before the  shell
65        is   called  and  should  output  <STRONG>enter_ca_mode</STRONG>  and  call
66        <STRONG>reset_prog_mode</STRONG> after returning from the shell.
67
68        The <STRONG>setupterm</STRONG> routine reads in the <STRONG>terminfo</STRONG> database, ini-
69        tializing the <STRONG>terminfo</STRONG> structures, but does not set up the
70        output virtualization structures used by <STRONG>curses</STRONG>.  The ter-
71        minal  type is the character string <EM>term</EM>; if <EM>term</EM> is null,
72        the environment variable <STRONG>TERM</STRONG> is used.  All output  is  to
73        file  descriptor  <STRONG>fildes</STRONG>  which is initialized for output.
74        If <EM>errret</EM> is not null, then <STRONG>setupterm</STRONG> returns  <STRONG>OK</STRONG>  or  <STRONG>ERR</STRONG>
75        and  stores  a  status  value in the integer pointed to by
76        <EM>errret</EM>.  A status of <STRONG>1</STRONG> in <EM>errret</EM> is normal, <STRONG>0</STRONG>  means  that
77        the  terminal  could  not  be found, and <STRONG>-1</STRONG> means that the
78        <STRONG>terminfo</STRONG> database could not be found.  If <EM>errret</EM> is  null,
79        <STRONG>setupterm</STRONG>  prints  an  error message upon finding an error
80        and exits.  Thus, the simplest call is:
81
82              <STRONG>setupterm((char</STRONG> <STRONG>*)0,</STRONG> <STRONG>1,</STRONG> <STRONG>(int</STRONG> <STRONG>*)0);</STRONG>,
83
84        which uses all the defaults and sends the output  to  <STRONG>std-</STRONG>
85        <STRONG>out</STRONG>.
86
87        The  <STRONG>setterm</STRONG>  routine is being replaced by <STRONG>setupterm</STRONG>.  The
88        call:
89
90              <STRONG>setupterm(</STRONG><EM>term</EM><STRONG>,</STRONG> <STRONG>1,</STRONG> <STRONG>(int</STRONG> <STRONG>*)0)</STRONG>
91
92        provides the same  functionality  as  <STRONG>setterm(</STRONG><EM>term</EM><STRONG>)</STRONG>.   The
93        <STRONG>setterm</STRONG>  routine  is  included here for BSD compatibility,
94        and is not recommended for new programs.
95
96        The <STRONG>set_curterm</STRONG> routine  sets  the  variable  <STRONG>cur_term</STRONG>  to
97        <EM>nterm</EM>, and makes all of the <STRONG>terminfo</STRONG> boolean, numeric, and
98        string variables use the values from  <EM>nterm</EM>.   It  returns
99        the old value of <STRONG>cur_term</STRONG>.
100
101        The  <STRONG>del_curterm</STRONG>  routine  frees  the  space pointed to by
102        <EM>oterm</EM> and makes it available for further use.  If <EM>oterm</EM> is
103        the  same  as  <STRONG>cur_term</STRONG>, references to any of the <STRONG>terminfo</STRONG>
104        boolean, numeric,  and  string  variables  thereafter  may
105        refer  to invalid memory locations until another <STRONG>setupterm</STRONG>
106        has been called.
107
108        The  <STRONG>restartterm</STRONG>  routine  is  similar  to  <STRONG>setupterm</STRONG>  and
109        <STRONG>initscr</STRONG>,  except  that it is called after restoring memory
110        to a previous state (for example, when  reloading  a  game
111        saved  as a core image dump).  It assumes that the windows
112        be different.  Accordingly, it  saves  various  tty  state
113        bits, does a setupterm, and then restores the bits.
114
115        The <STRONG>tparm</STRONG> routine instantiates the string <EM>str</EM> with parame-
116        ters <EM>pi</EM>.  A pointer is returned to the result of <EM>str</EM>  with
117        the parameters applied.
118
119        The  <STRONG>tputs</STRONG>  routine  applies  padding  information  to the
120        string <EM>str</EM> and outputs it.  The <EM>str</EM>  must  be  a  terminfo
121        string  variable  or the return value from <STRONG>tparm</STRONG>, <STRONG>tgetstr</STRONG>,
122        or <STRONG>tgoto</STRONG>.  <EM>affcnt</EM> is the number of lines affected, or 1 if
123        not  applicable.   <EM>putc</EM> is a <STRONG>putchar</STRONG>-like routine to which
124        the characters are passed, one at a time.
125
126        The <STRONG>putp</STRONG> routine calls <STRONG>tputs(</STRONG><EM>str</EM><STRONG>,</STRONG> <STRONG>1,</STRONG> <STRONG>putchar)</STRONG>.  Note  that
127        the  output  of  <STRONG>putp</STRONG>  always  goes  to <STRONG>stdout</STRONG>, not to the
128        <EM>fildes</EM> specified in <STRONG>setupterm</STRONG>.
129
130        The <STRONG>vidputs</STRONG> routine displays the string on the terminal in
131        the  video  attribute mode <EM>attrs</EM>, which is any combination
132        of the attributes listed in  <STRONG><A HREF="ncurses.3x.html">curses(3X)</A></STRONG>.   The  characters
133        are passed to the <STRONG>putchar</STRONG>-like routine <EM>putc</EM>.
134
135        The  <STRONG>vidattr</STRONG>  routine  is like the <STRONG>vidputs</STRONG> routine, except
136        that it outputs through <STRONG>putchar</STRONG>.
137
138        The <STRONG>mvcur</STRONG> routine provides low-level  cursor  motion.   It
139        takes   effect   immediately  (rather  than  at  the  next
140        refresh).
141
142        The <STRONG>tigetflag</STRONG>, <STRONG>tigetnum</STRONG> and <STRONG>tigetstr</STRONG> routines  return  the
143        value of the capability corresponding to the <STRONG>terminfo</STRONG> <EM>cap-</EM>
144        <EM>name</EM> passed to them, such as <STRONG>xenl</STRONG>.
145
146        The <STRONG>tigetflag</STRONG> routine returns the value <STRONG>-1</STRONG> if  <EM>capname</EM>  is
147        not  a  boolean  capability,  or  <STRONG>0</STRONG>  if it is cancelled or
148        absent from the terminal description.
149
150        The <STRONG>tigetnum</STRONG> routine returns the value <STRONG>-2</STRONG>  if  <EM>capname</EM>  is
151        not  a  numeric  capability,  or  <STRONG>-1</STRONG> if it is cancelled or
152        absent from the terminal description.
153
154        The <STRONG>tigetstr</STRONG> routine returns the value <STRONG>(char</STRONG> <STRONG>*)-1</STRONG> if  <EM>cap-</EM>
155        <EM>name</EM>  is  not a string capability, or <STRONG>0</STRONG> if it is cancelled
156        or absent from the terminal description.
157
158        The <EM>capname</EM> for each capability is given in the table col-
159        umn  entitled  <EM>capname</EM> code in the capabilities section of
160        <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
161
162        <STRONG>char</STRONG> <STRONG>*boolnames</STRONG>, <STRONG>*boolcodes</STRONG>, <STRONG>*boolfnames</STRONG>
163
164
165        These null-terminated arrays  contain  the  <EM>capnames</EM>,  the
166        <STRONG>termcap</STRONG>  codes, and the full C names, for each of the <STRONG>ter-</STRONG>
167        <STRONG>minfo</STRONG> variables.
168
169
170 </PRE>
171 <H2>RETURN VALUE</H2><PRE>
172        Routines that return an integer return  <STRONG>ERR</STRONG>  upon  failure
173        and  <STRONG>OK</STRONG>  (SVr4 only specifies "an integer value other than
174        <STRONG>ERR</STRONG>") upon successful completion, unless  otherwise  noted
175        in the preceding routine descriptions.
176
177        Routines that return pointers always return <STRONG>NULL</STRONG> on error.
178
179
180 </PRE>
181 <H2>NOTES</H2><PRE>
182        The <STRONG>setupterm</STRONG> routine should be used in place of  <STRONG>setterm</STRONG>.
183        It  may be useful when you want to test for terminal capa-
184        bilities without committing to the allocation  of  storage
185        involved in <STRONG>initscr</STRONG>.
186
187        Note that <STRONG>vidattr</STRONG> and <STRONG>vidputs</STRONG> may be macros.
188
189
190 </PRE>
191 <H2>PORTABILITY</H2><PRE>
192        The  function  <STRONG>setterm</STRONG>  is not described in the XSI Curses
193        standard and must be considered non-portable.   All  other
194        functions are as described in the XSI curses standard.
195
196        In  System V Release 4, <STRONG>set_curterm</STRONG> has an <STRONG>int</STRONG> return type
197        and returns <STRONG>OK</STRONG> or <STRONG>ERR</STRONG>.  We have chosen  to  implement  the
198        XSI Curses semantics.
199
200        In System V Release 4, the third argument of <STRONG>tputs</STRONG> has the
201        type <STRONG>int</STRONG> <STRONG>(*putc)(char)</STRONG>.
202
203        The XSI Curses standard prototypes <STRONG>tparm</STRONG> with a fixed num-
204        ber of parameters, rather than a variable argument list.
205
206
207 </PRE>
208 <H2>SEE ALSO</H2><PRE>
209        <STRONG><A HREF="ncurses.3x.html">curses(3X)</A></STRONG>,  <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3X)</A></STRONG>, <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3X)</A></STRONG>, <STRONG>curs_term-</STRONG>
210        <STRONG><A HREF="cap.3x.html">cap(3X)</A></STRONG>, <STRONG><A HREF="putc.3s.html">putc(3S)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
211
212
213
214
215
216
217
218
219
220
221
222
223
224 </PRE>
225 </BODY>
226 </HTML>