]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libxo/libxo/xo.h
Import libxo-0.7.2; add xo_options.7.
[FreeBSD/FreeBSD.git] / contrib / libxo / libxo / xo.h
1 /*
2  * Copyright (c) 2014-2015, Juniper Networks, Inc.
3  * All rights reserved.
4  * This SOFTWARE is licensed under the LICENSE provided in the
5  * ../Copyright file. By downloading, installing, copying, or otherwise
6  * using the SOFTWARE, you agree to be bound by the terms of that
7  * LICENSE.
8  * Phil Shafer, July 2014
9  */
10
11 /**
12  * libxo provides a means of generating text, XML, JSON, and HTML output
13  * using a single set of function calls, maximizing the value of output
14  * while minimizing the cost/impact on the code.
15  *
16  * Full documentation is available in ./doc/libxo.txt or online at:
17  *   http://juniper.github.io/libxo/libxo-manual.html
18  */
19
20 #ifndef INCLUDE_XO_H
21 #define INCLUDE_XO_H
22
23 #include <stdio.h>
24 #include <sys/types.h>
25 #include <stdarg.h>
26 #include <limits.h>
27 #include <stdlib.h>
28 #include <errno.h>
29
30 #ifdef __dead2
31 #define NORETURN __dead2
32 #else
33 #define NORETURN
34 #endif /* __dead2 */
35
36 /*
37  * Normally we'd use the HAVE_PRINTFLIKE define triggered by the
38  * --enable-printflike option to configure, but we don't install
39  * our internal "xoconfig.h", and I'd rather not.  Taking the
40  * coward's path, we'll turn it on inside a #if that allows
41  * others to turn it off where needed.  Not ideal, but functional.
42  */
43 #if !defined(NO_PRINTFLIKE)
44 #if defined(__linux) && !defined(__printflike)
45 #define __printflike(_x, _y) __attribute__((__format__ (__printf__, _x, _y)))
46 #endif
47 #define PRINTFLIKE(_x, _y) __printflike(_x, _y)
48 #else
49 #define PRINTFLIKE(_x, _y)
50 #endif /* NO_PRINTFLIKE */
51
52 /** Formatting types */
53 typedef unsigned short xo_style_t;
54 #define XO_STYLE_TEXT   0       /** Generate text output */
55 #define XO_STYLE_XML    1       /** Generate XML output */
56 #define XO_STYLE_JSON   2       /** Generate JSON output */
57 #define XO_STYLE_HTML   3       /** Generate HTML output */
58 #define XO_STYLE_SDPARAMS 4     /* Generate syslog structured data params */
59 #define XO_STYLE_ENCODER 5      /* Generate calls to external encoder */
60
61 /** Flags for libxo */
62 typedef unsigned long long xo_xof_flags_t;
63 #define XOF_BIT(_n) ((xo_xof_flags_t) 1 << (_n))
64 #define XOF_CLOSE_FP    XOF_BIT(0) /** Close file pointer on xo_close() */
65 #define XOF_PRETTY      XOF_BIT(1) /** Make 'pretty printed' output */
66 #define XOF_LOG_SYSLOG  XOF_BIT(2) /** Log (on stderr) our syslog content */
67 #define XOF_RESV3       XOF_BIT(3) /* Unused */
68
69 #define XOF_WARN        XOF_BIT(4) /** Generate warnings for broken calls */
70 #define XOF_XPATH       XOF_BIT(5) /** Emit XPath attributes in HTML  */
71 #define XOF_INFO        XOF_BIT(6) /** Emit additional info fields (HTML) */
72 #define XOF_WARN_XML    XOF_BIT(7) /** Emit warnings in XML (on stdout) */
73
74 #define XOF_NO_ENV      XOF_BIT(8) /** Don't look at LIBXO_OPTIONS env var */
75 #define XOF_NO_VA_ARG   XOF_BIT(9) /** Don't advance va_list w/ va_arg() */
76 #define XOF_DTRT        XOF_BIT(10) /** Enable "do the right thing" mode */
77 #define XOF_KEYS        XOF_BIT(11) /** Flag 'key' fields for xml and json */
78
79 #define XOF_IGNORE_CLOSE XOF_BIT(12) /** Ignore errors on close tags */
80 #define XOF_NOT_FIRST   XOF_BIT(13) /* Not the first item (JSON)  */
81 #define XOF_NO_LOCALE   XOF_BIT(14) /** Don't bother with locale */
82 #define XOF_RESV15      XOF_BIT(15) /* Unused */
83
84 #define XOF_NO_TOP      XOF_BIT(16) /** Don't emit the top braces in JSON */
85 #define XOF_RESV17      XOF_BIT(17) /* Unused  */
86 #define XOF_UNITS       XOF_BIT(18) /** Encode units in XML */
87 #define XOF_RESV19      XOF_BIT(19) /* Unused */
88
89 #define XOF_UNDERSCORES XOF_BIT(20) /** Replace dashes with underscores (JSON)*/
90 #define XOF_COLUMNS     XOF_BIT(21) /** xo_emit should return a column count */
91 #define XOF_FLUSH       XOF_BIT(22) /** Flush after each xo_emit call */
92 #define XOF_FLUSH_LINE  XOF_BIT(23) /** Flush after each newline */
93
94 #define XOF_NO_CLOSE    XOF_BIT(24) /** xo_finish won't close open elements */
95 #define XOF_COLOR_ALLOWED XOF_BIT(25) /** Allow color/effects to be enabled */
96 #define XOF_COLOR       XOF_BIT(26) /** Enable color and effects */
97 #define XOF_NO_HUMANIZE XOF_BIT(27) /** Block the {h:} modifier */
98
99 #define XOF_LOG_GETTEXT XOF_BIT(28) /** Log (stderr) gettext lookup strings */
100 #define XOF_UTF8        XOF_BIT(29) /** Force text output to be UTF8 */
101 #define XOF_RETAIN_ALL  XOF_BIT(30) /** Force use of XOEF_RETAIN */
102 #define XOF_RETAIN_NONE XOF_BIT(31) /** Prevent use of XOEF_RETAIN */
103
104 typedef unsigned xo_emit_flags_t; /* Flags to xo_emit() and friends */
105 #define XOEF_RETAIN     (1<<0)    /* Retain parsed formatting information */
106
107 /*
108  * The xo_info_t structure provides a mapping between names and
109  * additional data emitted via HTML.
110  */
111 typedef struct xo_info_s {
112     const char *xi_name;        /* Name of the element */
113     const char *xi_type;        /* Type of field */
114     const char *xi_help;        /* Description of field */
115 } xo_info_t;
116
117 #define XO_INFO_NULL NULL, NULL, NULL /* Use '{ XO_INFO_NULL }' to end lists */
118
119 struct xo_handle_s;             /* Opaque structure forward */
120 typedef struct xo_handle_s xo_handle_t; /* Handle for XO output */
121
122 /*
123  * Early versions of the API used "int" instead of "size_t" for buffer
124  * sizes.  We want to fix this but allow for backwards compatibility
125  * where needed.
126  */
127 #ifdef USE_INT_RETURN_CODES
128 typedef int xo_ssize_t;         /* Buffer size */
129 #else /* USE_INT_RETURN_CODES */
130 typedef ssize_t xo_ssize_t;     /* Buffer size */
131 #endif /* USE_INT_RETURN_CODES */
132
133 typedef xo_ssize_t (*xo_write_func_t)(void *, const char *);
134 typedef void (*xo_close_func_t)(void *);
135 typedef int (*xo_flush_func_t)(void *);
136 typedef void *(*xo_realloc_func_t)(void *, size_t);
137 typedef void (*xo_free_func_t)(void *);
138
139 /*
140  * The formatter function mirrors "vsnprintf", with an additional argument
141  * of the xo handle.  The caller should return the number of bytes _needed_
142  * to fit the data, even if this exceeds 'len'.
143  */
144 typedef xo_ssize_t (*xo_formatter_t)(xo_handle_t *, char *, xo_ssize_t,
145                                 const char *, va_list);
146 typedef void (*xo_checkpointer_t)(xo_handle_t *, va_list, int);
147
148 xo_handle_t *
149 xo_create (xo_style_t style, xo_xof_flags_t flags);
150
151 xo_handle_t *
152 xo_create_to_file (FILE *fp, xo_style_t style, xo_xof_flags_t flags);
153
154 void
155 xo_destroy (xo_handle_t *xop);
156
157 void
158 xo_set_writer (xo_handle_t *xop, void *opaque, xo_write_func_t write_func,
159                xo_close_func_t close_func, xo_flush_func_t flush_func);
160
161 void
162 xo_set_allocator (xo_realloc_func_t realloc_func, xo_free_func_t free_func);
163
164 void
165 xo_set_style (xo_handle_t *xop, xo_style_t style);
166
167 xo_style_t
168 xo_get_style (xo_handle_t *xop);
169
170 int
171 xo_set_style_name (xo_handle_t *xop, const char *style);
172
173 int
174 xo_set_options (xo_handle_t *xop, const char *input);
175
176 xo_xof_flags_t
177 xo_get_flags (xo_handle_t *xop);
178
179 void
180 xo_set_flags (xo_handle_t *xop, xo_xof_flags_t flags);
181
182 void
183 xo_clear_flags (xo_handle_t *xop, xo_xof_flags_t flags);
184
185 int
186 xo_set_file_h (xo_handle_t *xop, FILE *fp);
187
188 int
189 xo_set_file (FILE *fp);
190
191 void
192 xo_set_info (xo_handle_t *xop, xo_info_t *infop, int count);
193
194 void
195 xo_set_formatter (xo_handle_t *xop, xo_formatter_t func, xo_checkpointer_t);
196
197 void
198 xo_set_depth (xo_handle_t *xop, int depth);
199
200 xo_ssize_t
201 xo_emit_hv (xo_handle_t *xop, const char *fmt, va_list vap);
202
203 xo_ssize_t
204 xo_emit_h (xo_handle_t *xop, const char *fmt, ...);
205
206 xo_ssize_t
207 xo_emit (const char *fmt, ...);
208
209 xo_ssize_t
210 xo_emit_hvf (xo_handle_t *xop, xo_emit_flags_t flags,
211              const char *fmt, va_list vap);
212
213 xo_ssize_t
214 xo_emit_hf (xo_handle_t *xop, xo_emit_flags_t flags, const char *fmt, ...);
215
216 xo_ssize_t
217 xo_emit_f (xo_emit_flags_t flags, const char *fmt, ...);
218
219 PRINTFLIKE(2, 0)
220 static inline int
221 xo_emit_hvp (xo_handle_t *xop, const char *fmt, va_list vap)
222 {
223     return xo_emit_hv(xop, fmt, vap);
224 }
225
226 PRINTFLIKE(2, 3)
227 static inline int
228 xo_emit_hp (xo_handle_t *xop, const char *fmt, ...)
229 {
230     va_list vap;
231     va_start(vap, fmt);
232     int rc = xo_emit_hv(xop, fmt, vap);
233     va_end(vap);
234     return rc;
235 }
236
237 PRINTFLIKE(1, 2)
238 static inline int
239 xo_emit_p (const char *fmt, ...)
240 {
241     va_list vap;
242     va_start(vap, fmt);
243     int rc = xo_emit_hv(NULL, fmt, vap);
244     va_end(vap);
245     return rc;
246 }
247
248 PRINTFLIKE(3, 0)
249 static inline int
250 xo_emit_hvfp (xo_handle_t *xop, xo_emit_flags_t flags,
251               const char *fmt, va_list vap)
252 {
253     return xo_emit_hvf(xop, flags, fmt, vap);
254 }
255
256 PRINTFLIKE(3, 4)
257 static inline int
258 xo_emit_hfp (xo_handle_t *xop, xo_emit_flags_t flags, const char *fmt, ...)
259 {
260     va_list vap;
261     va_start(vap, fmt);
262     int rc = xo_emit_hvf(xop, flags, fmt, vap);
263     va_end(vap);
264     return rc;
265 }
266
267 PRINTFLIKE(2, 3)
268 static inline int
269 xo_emit_fp (xo_emit_flags_t flags, const char *fmt, ...)
270 {
271     va_list vap;
272     va_start(vap, fmt);
273     int rc = xo_emit_hvf(NULL, flags, fmt, vap);
274     va_end(vap);
275     return rc;
276 }
277
278 xo_ssize_t
279 xo_open_container_h (xo_handle_t *xop, const char *name);
280
281 xo_ssize_t
282 xo_open_container (const char *name);
283
284 xo_ssize_t
285 xo_open_container_hd (xo_handle_t *xop, const char *name);
286
287 xo_ssize_t
288 xo_open_container_d (const char *name);
289
290 xo_ssize_t
291 xo_close_container_h (xo_handle_t *xop, const char *name);
292
293 xo_ssize_t
294 xo_close_container (const char *name);
295
296 xo_ssize_t
297 xo_close_container_hd (xo_handle_t *xop);
298
299 xo_ssize_t
300 xo_close_container_d (void);
301
302 xo_ssize_t
303 xo_open_list_h (xo_handle_t *xop, const char *name);
304
305 xo_ssize_t
306 xo_open_list (const char *name);
307
308 xo_ssize_t
309 xo_open_list_hd (xo_handle_t *xop, const char *name);
310
311 xo_ssize_t
312 xo_open_list_d (const char *name);
313
314 xo_ssize_t
315 xo_close_list_h (xo_handle_t *xop, const char *name);
316
317 xo_ssize_t
318 xo_close_list (const char *name);
319
320 xo_ssize_t
321 xo_close_list_hd (xo_handle_t *xop);
322
323 xo_ssize_t
324 xo_close_list_d (void);
325
326 xo_ssize_t
327 xo_open_instance_h (xo_handle_t *xop, const char *name);
328
329 xo_ssize_t
330 xo_open_instance (const char *name);
331
332 xo_ssize_t
333 xo_open_instance_hd (xo_handle_t *xop, const char *name);
334
335 xo_ssize_t
336 xo_open_instance_d (const char *name);
337
338 xo_ssize_t
339 xo_close_instance_h (xo_handle_t *xop, const char *name);
340
341 xo_ssize_t
342 xo_close_instance (const char *name);
343
344 xo_ssize_t
345 xo_close_instance_hd (xo_handle_t *xop);
346
347 xo_ssize_t
348 xo_close_instance_d (void);
349
350 xo_ssize_t
351 xo_open_marker_h (xo_handle_t *xop, const char *name);
352
353 xo_ssize_t
354 xo_open_marker (const char *name);
355
356 xo_ssize_t
357 xo_close_marker_h (xo_handle_t *xop, const char *name);
358
359 xo_ssize_t
360 xo_close_marker (const char *name);
361
362 xo_ssize_t
363 xo_attr_h (xo_handle_t *xop, const char *name, const char *fmt, ...);
364
365 xo_ssize_t
366 xo_attr_hv (xo_handle_t *xop, const char *name, const char *fmt, va_list vap);
367
368 xo_ssize_t
369 xo_attr (const char *name, const char *fmt, ...);
370
371 void
372 xo_error_hv (xo_handle_t *xop, const char *fmt, va_list vap);
373
374 void
375 xo_error_h (xo_handle_t *xop, const char *fmt, ...);
376
377 void
378 xo_error (const char *fmt, ...);
379
380 xo_ssize_t
381 xo_flush_h (xo_handle_t *xop);
382
383 xo_ssize_t
384 xo_flush (void);
385
386 xo_ssize_t
387 xo_finish_h (xo_handle_t *xop);
388
389 xo_ssize_t
390 xo_finish (void);
391
392 void
393 xo_finish_atexit (void);
394
395 void
396 xo_set_leading_xpath (xo_handle_t *xop, const char *path);
397
398 void
399 xo_warn_hc (xo_handle_t *xop, int code, const char *fmt, ...) PRINTFLIKE(3, 4);
400
401 void
402 xo_warn_c (int code, const char *fmt, ...) PRINTFLIKE(2, 3);
403
404 void
405 xo_warn (const char *fmt, ...) PRINTFLIKE(1, 2);
406
407 void
408 xo_warnx (const char *fmt, ...) PRINTFLIKE(1, 2);
409
410 void
411 xo_err (int eval, const char *fmt, ...) NORETURN PRINTFLIKE(2, 3);
412
413 void
414 xo_errx (int eval, const char *fmt, ...) NORETURN PRINTFLIKE(2, 3);
415
416 void
417 xo_errc (int eval, int code, const char *fmt, ...) NORETURN PRINTFLIKE(3, 4);
418
419 void
420 xo_message_hcv (xo_handle_t *xop, int code, const char *fmt, va_list vap) PRINTFLIKE(3, 0);
421
422 void
423 xo_message_hc (xo_handle_t *xop, int code, const char *fmt, ...) PRINTFLIKE(3, 4);
424
425 void
426 xo_message_c (int code, const char *fmt, ...) PRINTFLIKE(2, 3);
427
428 void
429 xo_message_e (const char *fmt, ...) PRINTFLIKE(1, 2);
430
431 void
432 xo_message (const char *fmt, ...) PRINTFLIKE(1, 2);
433
434 void
435 xo_emit_warn_hcv (xo_handle_t *xop, int as_warning, int code,
436                   const char *fmt, va_list vap);
437
438 void
439 xo_emit_warn_hc (xo_handle_t *xop, int code, const char *fmt, ...);
440
441 void
442 xo_emit_warn_c (int code, const char *fmt, ...);
443
444 void
445 xo_emit_warn (const char *fmt, ...);
446
447 void
448 xo_emit_warnx (const char *fmt, ...);
449
450 void
451 xo_emit_err (int eval, const char *fmt, ...) NORETURN;
452
453 void
454 xo_emit_errx (int eval, const char *fmt, ...) NORETURN;
455
456 void
457 xo_emit_errc (int eval, int code, const char *fmt, ...) NORETURN;
458
459 PRINTFLIKE(4, 0)
460 static inline void
461 xo_emit_warn_hcvp (xo_handle_t *xop, int as_warning, int code,
462                   const char *fmt, va_list vap)
463 {
464     xo_emit_warn_hcv(xop, as_warning, code, fmt, vap);
465 }
466
467 PRINTFLIKE(3, 4)
468 static inline void
469 xo_emit_warn_hcp (xo_handle_t *xop, int code, const char *fmt, ...)
470 {
471     va_list vap;
472     va_start(vap, fmt);
473     xo_emit_warn_hcv(xop, 1, code, fmt, vap);
474     va_end(vap);
475 }
476
477 PRINTFLIKE(2, 3)
478 static inline void
479 xo_emit_warn_cp (int code, const char *fmt, ...)
480 {
481     va_list vap;
482     va_start(vap, fmt);
483     xo_emit_warn_hcv(NULL, 1, code, fmt, vap);
484     va_end(vap);
485 }
486
487 PRINTFLIKE(1, 2)
488 static inline void
489 xo_emit_warn_p (const char *fmt, ...)
490 {
491     int code = errno;
492     va_list vap;
493     va_start(vap, fmt);
494     xo_emit_warn_hcv(NULL, 1, code, fmt, vap);
495     va_end(vap);
496 }
497
498 PRINTFLIKE(1, 2)
499 static inline void
500 xo_emit_warnx_p (const char *fmt, ...)
501 {
502     va_list vap;
503     va_start(vap, fmt);
504     xo_emit_warn_hcv(NULL, 1, -1, fmt, vap);
505     va_end(vap);
506 }
507
508 NORETURN PRINTFLIKE(2, 3)
509 static inline void
510 xo_emit_err_p (int eval, const char *fmt, ...)
511 {
512     int code = errno;
513     va_list vap;
514     va_start(vap, fmt);
515     xo_emit_warn_hcv(NULL, 0, code, fmt, vap);
516     va_end(vap);
517
518     exit(eval);
519 }
520
521 PRINTFLIKE(2, 3)
522 static inline void
523 xo_emit_errx_p (int eval, const char *fmt, ...)
524 {
525     va_list vap;
526     va_start(vap, fmt);
527     xo_emit_warn_hcv(NULL, 0, -1, fmt, vap);
528     va_end(vap);
529     exit(eval);
530 }
531
532 PRINTFLIKE(3, 4)
533 static inline void
534 xo_emit_errc_p (int eval, int code, const char *fmt, ...)
535 {
536     va_list vap;
537     va_start(vap, fmt);
538     xo_emit_warn_hcv(NULL, 0, code, fmt, vap);
539     va_end(vap);
540     exit(eval);
541 }
542
543 void
544 xo_emit_err_v (int eval, int code, const char *fmt, va_list vap) NORETURN PRINTFLIKE(3, 0);
545
546 void
547 xo_no_setlocale (void);
548
549 /**
550  * @brief Lift libxo-specific arguments from a set of arguments
551  *
552  * libxo-enable programs typically use command line options to enable
553  * all the nifty-cool libxo features.  xo_parse_args() makes this simple
554  * by pre-processing the command line arguments given to main(), handling
555  * and removing the libxo-specific ones, meaning anything starting with
556  * "--libxo".  A full description of these arguments is in the base
557  * documentation.
558  * @param[in] argc Number of arguments (ala #main())
559  * @param[in] argc Array of argument strings (ala #main())
560  * @return New number of arguments, or -1 for failure.
561  */
562 int
563 xo_parse_args (int argc, char **argv);
564
565 /**
566  * This is the "magic" number returned by libxo-supporting commands
567  * when passed the equally magic "--libxo-check" option.  If you
568  * return this, we can (unsafely) assume that since you know the magic
569  * handshake, you'll happily handle future --libxo options and not do
570  * something violent like reboot the box or create another hole in the
571  * ozone layer.
572  */
573 #define XO_HAS_LIBXO    121
574
575 /**
576  * externs for libxo's version number strings
577  */
578 extern const char xo_version[];       /** Base version triple string */
579 extern const char xo_version_extra[]; /** Extra version magic content */
580
581 /**
582  * @brief Dump the internal stack of a libxo handle.
583  *
584  * This diagnostic function is something I will ask you to call from
585  * your program when you write to tell me libxo has gone bat-stink
586  * crazy and has discarded your list or container or content.  Output
587  * content will be what we lovingly call "developer entertainment".
588  * @param[in] xop A valid libxo handle, or NULL for the default handle
589  */
590 void
591 xo_dump_stack (xo_handle_t *xop);
592
593 /**
594  * @brief Recode the name of the program, suitable for error output.
595  *
596  * libxo will record the given name for use while generating error
597  * messages.  The contents are not copied, so the value must continue
598  * to point to a valid memory location.  This allows the caller to change
599  * the value, but requires the caller to manage the memory.  Typically
600  * this is called with argv[0] from main().
601  * @param[in] name The name of the current application program
602  */
603 void
604 xo_set_program (const char *name);
605
606 /**
607  * @brief Add a version string to the output, where possible.
608  *
609  * Adds a version number to the output, suitable for tracking
610  * changes in the content.  This is only important for the "encoding"
611  * format styles (XML and JSON) and allows a user of the data to
612  * discern which version of the data model is in use.
613  * @param[in] version The version number, encoded as a string
614  */
615 void
616 xo_set_version (const char *version);
617
618 /**
619  * #xo_set_version with a handle.
620  * @param[in] xop A valid libxo handle, or NULL for the default handle
621  * @param[in] version The version number, encoded as a string
622  */
623 void
624 xo_set_version_h (xo_handle_t *xop, const char *version);
625
626 void
627 xo_open_log (const char *ident, int logopt, int facility);
628
629 void
630 xo_close_log (void);
631
632 int
633 xo_set_logmask (int maskpri);
634
635 void
636 xo_set_unit_test_mode (int value);
637
638 void
639 xo_syslog (int priority, const char *name, const char *message, ...);
640
641 void
642 xo_vsyslog (int priority, const char *name, const char *message, va_list args);
643
644 typedef void (*xo_syslog_open_t)(void);
645 typedef void (*xo_syslog_send_t)(const char *full_msg,
646                                  const char *v0_hdr, const char *text_only);
647 typedef void (*xo_syslog_close_t)(void);
648
649 void
650 xo_set_syslog_handler (xo_syslog_open_t open_func, xo_syslog_send_t send_func,
651                        xo_syslog_close_t close_func);
652
653 void
654 xo_set_syslog_enterprise_id (unsigned short eid);
655
656 typedef void (*xo_simplify_field_func_t)(const char *, unsigned, int);
657
658 char *
659 xo_simplify_format (xo_handle_t *xop, const char *fmt, int with_numbers,
660                     xo_simplify_field_func_t field_cb);
661
662 xo_ssize_t
663 xo_emit_field_hv (xo_handle_t *xop, const char *rolmod, const char *contents,
664                   const char *fmt, const char *efmt,
665                   va_list vap);
666
667 xo_ssize_t
668 xo_emit_field_h (xo_handle_t *xop, const char *rolmod, const char *contents,
669                  const char *fmt, const char *efmt, ...);
670
671 xo_ssize_t
672 xo_emit_field (const char *rolmod, const char *contents,
673                const char *fmt, const char *efmt, ...);
674
675 void
676 xo_retain_clear_all (void);
677
678 void
679 xo_retain_clear (const char *fmt);
680
681 #endif /* INCLUDE_XO_H */