1 /*
2 Xnee's Not an Event Emulator enables recording and replaying of X protocol data
3 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2008 Henrik Sandklef
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 3
8 of the License, or any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301, USA.
18 */
19 
20 
21 
22 #include "xnee_record.h"
23 #include "xnee_replay.h"
24 #include "print_varargs.h"
25 
26 #ifndef XNEE_PRINT_H
27 #define XNEE_PRINT_H
28 
29 #define XNEE_VERBOSE_ENTER_FUNCTION() xnee_verbose((xd, " ---> %s\n", __func__ ))
30 #define XNEE_VERBOSE_LEAVE_FUNCTION() xnee_verbose((xd, " <--- %s\n", __func__ ))
31 #define XNEE_VERBOSE_IN_FUNCTION(str) xnee_verbose((xd, "      %s: \"%s\"\n", __func__ , str))
32 #define XNEE_VERBOSE_MARK()           xnee_verbose((xd, "      %s:%d  %s()\n", __FILE__, __LINE__, __func__ ))
33 
34 
35 /**
36  * Prints number and name of X11 events
37  *
38  * @param  xd     xnee's main structure
39  * @return int    XNEE_OK on success.
40  */
41 int
42 xnee_print_event_info (xnee_data *xd);
43 
44 
45 /**
46  * Prints number and name of X11 errors
47  *
48  * @param xd     xnee's main structure
49  * @return int
50  */
51 int
52 xnee_print_error_info (xnee_data *xd);
53 
54 
55 /**
56  * Prints number and name of X11 replies
57  *
58  * @param xd     xnee's main structure
59  * @return int
60  */
61 int
62 xnee_print_reply_info (xnee_data *xd);
63 
64 
65 /**
66  * Prints number and name of X11 requests
67  *
68  * @param xd     xnee's main structure
69  * @return int
70  */
71 int
72 xnee_print_request_info (xnee_data *xd);
73 
74 
75 /**
76  * Prints number and name of X11 data
77  *
78  * @param xd     xnee's main structure
79  * @return int
80  */
81 int
82 xnee_print_data_info (xnee_data *xd);
83 
84 
85 
86 
87 int
88 xnee_print_sys_info(xnee_data *, FILE *);
89 
90 
91 
92 
93 /*
94  * Print character representation of event if verbose mode is on
95  */
96 void
97 xnee_verbose_event (xnee_data *, int ev ) ;
98 
99 
100 
101 
102 
103 
104 
105 
106 /*
107  *
108  * Name:      xnee_record_print_request
109  *
110  * Arguments: xnee_data
111  *            XRecordInterceptData
112  *
113  *
114  * Description: Prints X requests according to the Xnee protocol/format
115  *
116  */
117 void
118 xnee_record_print_request (xnee_data *xd, XRecordInterceptData *xrecintd );
119 
120 
121 /*
122  *
123  * Name:      xnee_human_print_request
124  *
125  * Arguments: xnee_data
126  *            XRecordInterceptData
127  *
128  *
129  * Description: Prints X requests so humans can read
130  *
131  */
132 void
133 xnee_human_print_request (xnee_data *xd, XRecordInterceptData *xrecintd );
134 
135 
136 /*
137  *
138  * Name:      xnee_human_print_reply
139  *
140  * Arguments: xnee_data
141  *            XRecordInterceptData
142  *
143  *
144  * Description: Prints X replies so humans can read
145  *
146  */
147 void xnee_human_print_reply (xnee_data* xd, XRecordInterceptData *xrecintd );
148 
149 
150 /*
151  *
152  * Name:      xnee_record_print_reply
153  *
154  * Arguments: xnee_data
155  *            XRecordInterceptData
156  *
157  *
158  * Description: Prints X replies  according to the Xnee protocol/format
159  *
160  */
161 void xnee_record_print_reply (xnee_data* xd, XRecordInterceptData *xrecintd );
162 
163 
164 
165 /*
166  *
167  * Name:      xnee_record_print_error
168  *
169  * Arguments: xnee_data
170  *            XRecordInterceptData
171  *
172  *
173  * Description: Prints X errors according to the Xnee protocol/format
174  *
175  */
176 void xnee_record_print_error (xnee_data *xd, XRecordInterceptData *xrecintd );
177 
178 
179 /*
180  *
181  * Name:      xnee_human_print_error
182  *
183  * Arguments: xnee_data
184  *            XRecordInterceptData
185  *
186  *
187  * Description: Prints X errors in a human format
188  *
189  */
190 void xnee_human_print_error (xnee_data *xd, XRecordInterceptData *xrecintd );
191 
192 /*
193  *
194  * Name:      xnee_human_print_event
195  *
196  * Arguments: xnee_data
197  *            XRecordInterceptData
198  *
199  *
200  * Description: Prints X events in a human format
201  *
202  */
203 void xnee_human_print_event (xnee_data *xd, XRecordInterceptData *xrecintd );
204 
205 
206 
207 /*
208  *
209  * Name:      xnee_record_print_record_range
210  *
211  * Arguments: xnee_data* , FILE*
212  *
213  *
214  * Description: Prints the Record range in a(n almost) user friendly format
215  *              File descriptors to be used are specified in the xnee_data struct
216  *
217  */
218 int
219 xnee_record_print_record_range (xnee_data *xd, /*@null@*/ FILE *) ;
220 
221 
222 /*
223  *
224  * Name:      xnee_record_print_sys_info
225  *
226  * Arguments: xnee_data
227  *
228  *
229  * Description: Prints the X and xnee states and settings
230  *              The format of the file will be recognised by xnee
231  *              when replaying, in order to use the same settings
232  *              and thereby enable synchronisation again
233  *
234  *
235 int
236 xnee_rec_print_sys_info(xnee_data *xd);
237  */
238 
239 
240 
241 
242 /*
243  *
244  * Name:      xnee_print_xnee_settings
245  *
246  * Arguments: xnee_data
247  *
248  *
249  * Description: Prints some init stuff ......
250  *              This function is obsoleted by the new printout function xnee_rec_print_sys_info
251  *
252  *
253  */
254 int
255 xnee_print_xnee_settings (xnee_data* xd, /*@null@*/ FILE *) ;
256 
257 
258 /*
259  *   Name:          xnee_print_distribution_list
260  *
261  *   Arguments:
262  *     xnee_data *, FILE *
263  *
264  *   Description:   Prints the list of displays to distribute events to
265  *
266  *
267  */
268 int
269 xnee_print_distr_list (xnee_data*, /*@null@*/FILE *);
270 
271 
272 
273 
274 
275 /*
276  *   Name:        xnee_print_data_range_count
277  *
278  * Arguments: xnee_data*
279  *
280  *
281  */
282 int
283 xnee_print_data_range_count (xnee_data * xd);
284 
285 #ifdef NO_BUF_VERBOSE
286 #define xnee_replay_printbuffer(a)
287 #else
288 #define xnee_replay_printbuffer(a) xnee_replay_printbuffer_impl(a)
289 #endif
290 
291 
292 /**
293  * If xnee_data->verbose is set this functions prints the synchronisation buffers.
294  *
295  * @param xd       xnee's main structure
296  * @return void
297  */
298 void
299 xnee_replay_printbuffer_impl (xnee_data *xd);
300 
301 
302 /**
303  * Print version information etc
304  *
305  * @param xd      xnee's main structure
306  * @return void
307  */
308 void
309 xnee_version(xnee_data *xd);
310 
311 
312 int
313 xnee_print_ranges (xnee_data *xd, FILE *fp);
314 
315 
316 int
317 xnee_print_xnee_resource_settings (xnee_data* xd, FILE* out) ;
318 
319 void
320 xnee_store_mouse_pos (xnee_data* xd );
321 
322 
323 int
324 xnee_print_xnee_data(xnee_data *xd);
325 
326 void
327 xnee_human_print_request_verbose (xnee_data *xd, XRecordInterceptData *xrecintd );
328 
329 void
330 xnee_human_print_event_verbose (xnee_data *xd, XRecordInterceptData *xrecintd );
331 
332 int
333 xnee_print_data_str(xnee_data *xd, char *tmp, int type);
334 
335 
336 #endif /* XNEE_PRINT_H */
337