ncurses 6.0 - patch 20171118
[ncurses.git] / doc / html / man / curs_trace.3x.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 2000-2016,2017 Free Software Foundation, Inc.              *
4   *                                                                          *
5   * Permission is hereby granted, free of charge, to any person obtaining a  *
6   * copy of this software and associated documentation files (the            *
7   * "Software"), to deal in the Software without restriction, including      *
8   * without limitation the rights to use, copy, modify, merge, publish,      *
9   * distribute, distribute with modifications, sublicense, and/or sell       *
10   * copies of the Software, and to permit persons to whom the Software is    *
11   * furnished to do so, subject to the following conditions:                 *
12   *                                                                          *
13   * The above copyright notice and this permission notice shall be included  *
14   * in all copies or substantial portions of the Software.                   *
15   *                                                                          *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23   *                                                                          *
24   * Except as contained in this notice, the name(s) of the above copyright   *
25   * holders shall not be used in advertising or otherwise to promote the     *
26   * sale, use or other dealings in this Software without prior written       *
27   * authorization.                                                           *
28   ****************************************************************************
29   * @Id: curs_trace.3x,v 1.19 2017/11/18 23:47:37 tom Exp @
30 -->
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
32 <HTML>
33 <HEAD>
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
36 <TITLE>curs_trace 3x</TITLE>
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
39 </HEAD>
40 <BODY>
41 <H1 class="no-header">curs_trace 3x</H1>
42 <PRE>
43 <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>                                                  <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>
44
45
46
47
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49        <STRONG>trace</STRONG>, <STRONG>_tracef</STRONG>, <STRONG>_traceattr</STRONG>, <STRONG>_traceattr2</STRONG>, <STRONG>_tracecchar_t</STRONG>, <STRONG>_tracecchar_t2</STRONG>,
50        <STRONG>_tracechar</STRONG>, <STRONG>_tracechtype</STRONG>, <STRONG>_tracechtype2</STRONG>, <STRONG>_nc_tracebits</STRONG>, <STRONG>_tracedump</STRONG>,
51        <STRONG>_tracemouse</STRONG> - <STRONG>curses</STRONG> debugging routines
52
53
54 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
55        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
56
57        <STRONG>void</STRONG> <STRONG>trace(const</STRONG> <STRONG>unsigned</STRONG> <STRONG>int</STRONG> <EM>param</EM><STRONG>);</STRONG>
58
59        <STRONG>void</STRONG> <STRONG>_tracef(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>format</EM><STRONG>,</STRONG> <STRONG>...);</STRONG>
60
61        <STRONG>char</STRONG> <STRONG>*_traceattr(attr_t</STRONG> <EM>attr</EM><STRONG>);</STRONG>
62        <STRONG>char</STRONG> <STRONG>*_traceattr2(int</STRONG> <EM>buffer</EM><STRONG>,</STRONG> <STRONG>chtype</STRONG> <EM>ch</EM><STRONG>);</STRONG>
63        <STRONG>char</STRONG> <STRONG>*_tracecchar_t(const</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>string</EM><STRONG>);</STRONG>
64        <STRONG>char</STRONG> <STRONG>*_tracecchar_t2(int</STRONG> <EM>buffer</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>string</EM><STRONG>);</STRONG>
65        <STRONG>char</STRONG> <STRONG>*_tracechar(int</STRONG> <EM>ch</EM><STRONG>);</STRONG>
66        <STRONG>char</STRONG> <STRONG>*_tracechtype(chtype</STRONG> <EM>ch</EM><STRONG>);</STRONG>
67        <STRONG>char</STRONG> <STRONG>*_tracechtype2(int</STRONG> <EM>buffer</EM><STRONG>,</STRONG> <STRONG>chtype</STRONG> <EM>ch</EM><STRONG>);</STRONG>
68
69        <STRONG>void</STRONG> <STRONG>_tracedump(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>label</EM><STRONG>,</STRONG> <STRONG>WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>);</STRONG>
70        <STRONG>char</STRONG> <STRONG>*_nc_tracebits(void);</STRONG>
71        <STRONG>char</STRONG> <STRONG>*_tracemouse(const</STRONG> <STRONG>MEVENT</STRONG> <STRONG>*</STRONG><EM>event</EM><STRONG>);</STRONG>
72
73
74 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
75        The  <STRONG>trace</STRONG>  routines  are  used for debugging the ncurses libraries, as
76        well as applications which use the ncurses libraries.  These  functions
77        are  normally available only with the debugging library e.g., <EM>libncurs-</EM>
78        <EM>es</EM><STRONG>_</STRONG><EM>g.a</EM>, but may be compiled into any model (shared, static, profile) by
79        defining  the  symbol  <STRONG>TRACE</STRONG>.   Additionally,  some  functions are only
80        available with the wide-character configuration of the libraries.
81
82
83 </PRE><H3><a name="h3-Functions">Functions</a></H3><PRE>
84        The principal parts of this interface are
85
86        <STRONG>o</STRONG>   <STRONG>trace</STRONG>, which selectively enables different tracing features, and
87
88        <STRONG>o</STRONG>   <STRONG>_tracef</STRONG>, which writes formatted data to the <EM>trace</EM> file.
89
90        Calling <STRONG>trace</STRONG> with a nonzero parameter creates the file  <STRONG>trace</STRONG>  in  the
91        current  directory  for output.  If the file already exists, no tracing
92        is done.
93
94        The other functions either return a pointer to a string-area (allocated
95        by the corresponding function), or return no value (such as <STRONG>_tracedump</STRONG>,
96        which implements the screen dump for <STRONG>TRACE_UPDATE</STRONG>).  The caller  should
97        not  free  these  strings, since the allocation is reused on successive
98        calls.  To work around the problem of a single  string-area  per  func-
99        tion,  some use a buffer-number parameter, telling the library to allo-
100        cate additional string-areas.
101
102
103 </PRE><H3><a name="h3-Trace-Parameter">Trace Parameter</a></H3><PRE>
104        The trace parameter is  formed  by  OR'ing  values  from  the  list  of
105        <STRONG>TRACE_</STRONG><EM>xxx</EM> definitions in <STRONG>&lt;curses.h&gt;</STRONG>.  These include:
106
107        <STRONG>TRACE_DISABLE</STRONG>
108             turn off tracing by passing a zero parameter.
109
110             The  library flushes the output file, but retains an open file-de-
111             scriptor to the trace file so that it can resume tracing later  if
112             a nonzero parameter is passed to the <STRONG>trace</STRONG> function.
113
114        <STRONG>TRACE_TIMES</STRONG>
115             trace user and system times of updates.
116
117        <STRONG>TRACE_TPUTS</STRONG>
118             trace <STRONG><A HREF="curs_terminfo.3x.html">tputs(3x)</A></STRONG> calls.
119
120        <STRONG>TRACE_UPDATE</STRONG>
121             trace update actions, old &amp; new screens.
122
123        <STRONG>TRACE_MOVE</STRONG>
124             trace cursor movement and scrolling.
125
126        <STRONG>TRACE_CHARPUT</STRONG>
127             trace all character outputs.
128
129        <STRONG>TRACE_ORDINARY</STRONG>
130             trace  all  update  actions.   The old and new screen contents are
131             written to the trace file for each refresh.
132
133        <STRONG>TRACE_CALLS</STRONG>
134             trace all curses calls.  The parameters for each call are  traced,
135             as well as return values.
136
137        <STRONG>TRACE_VIRTPUT</STRONG>
138             trace virtual character puts, i.e., calls to <STRONG>addch</STRONG>.
139
140        <STRONG>TRACE_IEVENT</STRONG>
141             trace low-level input processing, including timeouts.
142
143        <STRONG>TRACE_BITS</STRONG>
144             trace state of TTY control bits.
145
146        <STRONG>TRACE_ICALLS</STRONG>
147             trace internal/nested calls.
148
149        <STRONG>TRACE_CCALLS</STRONG>
150             trace per-character calls.
151
152        <STRONG>TRACE_DATABASE</STRONG>
153             trace read/write of terminfo/termcap data.
154
155        <STRONG>TRACE_ATTRS</STRONG>
156             trace changes to video attributes and colors.
157
158        <STRONG>TRACE_MAXIMUM</STRONG>
159             maximum trace level, enables all of the separate trace features.
160
161        Some  tracing  features  are  enabled  whenever  the <STRONG>trace</STRONG> parameter is
162        nonzero.  Some features overlap.  The specific  names  are  used  as  a
163        guideline.
164
165
166 </PRE><H3><a name="h3-Initialization">Initialization</a></H3><PRE>
167        These  functions  check  the <STRONG>NCURSES_TRACE</STRONG> environment variable, to set
168        the tracing feature as if <STRONG>trace</STRONG> was called:
169
170            filter, initscr, new_prescr, newterm, nofilter, restartterm,
171            ripoffline, setupterm, slk_init, tgetent, use_env,
172            use_extended_names, use_tioctl
173
174
175 </PRE><H3><a name="h3-Command-line-Utilities">Command-line Utilities</a></H3><PRE>
176        The command-line utilities such as  <STRONG><A HREF="tic.1m.html">tic(1)</A></STRONG>  provide  a  verbose  option
177        which  extends  the  set  of messages written using the <STRONG>trace</STRONG> function.
178        Both of these (<STRONG>-v</STRONG> and <STRONG>trace</STRONG>) use the same variable (<STRONG>_nc_tracing</STRONG>), which
179        determines the messages which are written.
180
181        Because  the  command-line  utilities may call initialization functions
182        such as <STRONG>setupterm</STRONG>, <STRONG>tgetent</STRONG> or <STRONG>use_extended_names</STRONG>, some of their  debug-
183        ging  output may be directed to the <EM>trace</EM> file if the <STRONG>NCURSES_TRACE</STRONG> en-
184        vironment variable is set:
185
186        <STRONG>o</STRONG>   messages produced in the utility are written to the standard error.
187
188        <STRONG>o</STRONG>   messages produced by the underlying library are written to <EM>trace</EM>.
189
190        If ncurses is built without tracing, none of the latter  are  produced,
191        and fewer diagnostics are provided by the command-line utilities.
192
193
194 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
195        Routines  which return a value are designed to be used as parameters to
196        the <STRONG>_tracef</STRONG> routine.
197
198
199 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
200        These functions are not part of the XSI interface.  Some  other  curses
201        implementations  are  known to have similar, undocumented features, but
202        they are not compatible with ncurses.
203
204        A few functions are not provided when symbol versioning is used:
205
206            _nc_tracebits, _tracedump, _tracemouse
207
208
209 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
210        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>.
211
212
213
214                                                                 <STRONG><A HREF="curs_trace.3x.html">curs_trace(3x)</A></STRONG>
215 </PRE>
216 <div class="nav">
217 <ul>
218 <li><a href="#h2-NAME">NAME</a></li>
219 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
220 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
221 <ul>
222 <li><a href="#h3-Functions">Functions</a></li>
223 <li><a href="#h3-Trace-Parameter">Trace Parameter</a></li>
224 <li><a href="#h3-Initialization">Initialization</a></li>
225 <li><a href="#h3-Command-line-Utilities">Command-line Utilities</a></li>
226 </ul>
227 </li>
228 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
229 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
230 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
231 </ul>
232 </div>
233 </BODY>
234 </HTML>