xo.h (287111) | xo.h (298083) |
---|---|
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 --- 80 unchanged lines hidden (view full) --- 89 90#define XOF_NO_CLOSE XOF_BIT(24) /** xo_finish won't close open elements */ 91#define XOF_COLOR_ALLOWED XOF_BIT(25) /** Allow color/effects to be enabled */ 92#define XOF_COLOR XOF_BIT(26) /** Enable color and effects */ 93#define XOF_NO_HUMANIZE XOF_BIT(27) /** Block the {h:} modifier */ 94 95#define XOF_LOG_GETTEXT XOF_BIT(28) /** Log (stderr) gettext lookup strings */ 96#define XOF_UTF8 XOF_BIT(29) /** Force text output to be UTF8 */ | 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 --- 80 unchanged lines hidden (view full) --- 89 90#define XOF_NO_CLOSE XOF_BIT(24) /** xo_finish won't close open elements */ 91#define XOF_COLOR_ALLOWED XOF_BIT(25) /** Allow color/effects to be enabled */ 92#define XOF_COLOR XOF_BIT(26) /** Enable color and effects */ 93#define XOF_NO_HUMANIZE XOF_BIT(27) /** Block the {h:} modifier */ 94 95#define XOF_LOG_GETTEXT XOF_BIT(28) /** Log (stderr) gettext lookup strings */ 96#define XOF_UTF8 XOF_BIT(29) /** Force text output to be UTF8 */ |
97#define XOF_RETAIN_ALL XOF_BIT(30) /** Force use of XOEF_RETAIN */ 98#define XOF_RETAIN_NONE XOF_BIT(31) /** Prevent use of XOEF_RETAIN */ |
|
97 | 99 |
100typedef unsigned xo_emit_flags_t; /* Flags to xo_emit() and friends */ 101#define XOEF_RETAIN (1<<0) /* Retain parsed formatting information */ 102 |
|
98/* 99 * The xo_info_t structure provides a mapping between names and 100 * additional data emitted via HTML. 101 */ 102typedef struct xo_info_s { 103 const char *xi_name; /* Name of the element */ 104 const char *xi_type; /* Type of field */ 105 const char *xi_help; /* Description of field */ --- 51 unchanged lines hidden (view full) --- 157xo_get_flags (xo_handle_t *xop); 158 159void 160xo_set_flags (xo_handle_t *xop, xo_xof_flags_t flags); 161 162void 163xo_clear_flags (xo_handle_t *xop, xo_xof_flags_t flags); 164 | 103/* 104 * The xo_info_t structure provides a mapping between names and 105 * additional data emitted via HTML. 106 */ 107typedef struct xo_info_s { 108 const char *xi_name; /* Name of the element */ 109 const char *xi_type; /* Type of field */ 110 const char *xi_help; /* Description of field */ --- 51 unchanged lines hidden (view full) --- 162xo_get_flags (xo_handle_t *xop); 163 164void 165xo_set_flags (xo_handle_t *xop, xo_xof_flags_t flags); 166 167void 168xo_clear_flags (xo_handle_t *xop, xo_xof_flags_t flags); 169 |
170int 171xo_set_file_h (xo_handle_t *xop, FILE *fp); 172 173int 174xo_set_file (FILE *fp); 175 |
|
165void 166xo_set_info (xo_handle_t *xop, xo_info_t *infop, int count); 167 168void 169xo_set_formatter (xo_handle_t *xop, xo_formatter_t func, xo_checkpointer_t); 170 171void 172xo_set_depth (xo_handle_t *xop, int depth); 173 174int 175xo_emit_hv (xo_handle_t *xop, const char *fmt, va_list vap); 176 177int 178xo_emit_h (xo_handle_t *xop, const char *fmt, ...); 179 180int 181xo_emit (const char *fmt, ...); 182 | 176void 177xo_set_info (xo_handle_t *xop, xo_info_t *infop, int count); 178 179void 180xo_set_formatter (xo_handle_t *xop, xo_formatter_t func, xo_checkpointer_t); 181 182void 183xo_set_depth (xo_handle_t *xop, int depth); 184 185int 186xo_emit_hv (xo_handle_t *xop, const char *fmt, va_list vap); 187 188int 189xo_emit_h (xo_handle_t *xop, const char *fmt, ...); 190 191int 192xo_emit (const char *fmt, ...); 193 |
194int 195xo_emit_hvf (xo_handle_t *xop, xo_emit_flags_t flags, 196 const char *fmt, va_list vap); 197 198int 199xo_emit_hf (xo_handle_t *xop, xo_emit_flags_t flags, const char *fmt, ...); 200 201int 202xo_emit_f (xo_emit_flags_t flags, const char *fmt, ...); 203 |
|
183PRINTFLIKE(2, 0) 184static inline int 185xo_emit_hvp (xo_handle_t *xop, const char *fmt, va_list vap) 186{ 187 return xo_emit_hv(xop, fmt, vap); 188} 189 190PRINTFLIKE(2, 3) --- 13 unchanged lines hidden (view full) --- 204{ 205 va_list vap; 206 va_start(vap, fmt); 207 int rc = xo_emit_hv(NULL, fmt, vap); 208 va_end(vap); 209 return rc; 210} 211 | 204PRINTFLIKE(2, 0) 205static inline int 206xo_emit_hvp (xo_handle_t *xop, const char *fmt, va_list vap) 207{ 208 return xo_emit_hv(xop, fmt, vap); 209} 210 211PRINTFLIKE(2, 3) --- 13 unchanged lines hidden (view full) --- 225{ 226 va_list vap; 227 va_start(vap, fmt); 228 int rc = xo_emit_hv(NULL, fmt, vap); 229 va_end(vap); 230 return rc; 231} 232 |
233PRINTFLIKE(3, 0) 234static inline int 235xo_emit_hvfp (xo_handle_t *xop, xo_emit_flags_t flags, 236 const char *fmt, va_list vap) 237{ 238 return xo_emit_hvf(xop, flags, fmt, vap); 239} 240 241PRINTFLIKE(3, 4) 242static inline int 243xo_emit_hfp (xo_handle_t *xop, xo_emit_flags_t flags, const char *fmt, ...) 244{ 245 va_list vap; 246 va_start(vap, fmt); 247 int rc = xo_emit_hvf(xop, flags, fmt, vap); 248 va_end(vap); 249 return rc; 250} 251 252PRINTFLIKE(2, 3) 253static inline int 254xo_emit_fp (xo_emit_flags_t flags, const char *fmt, ...) 255{ 256 va_list vap; 257 va_start(vap, fmt); 258 int rc = xo_emit_hvf(NULL, flags, fmt, vap); 259 va_end(vap); 260 return rc; 261} 262 |
|
212int 213xo_open_container_h (xo_handle_t *xop, const char *name); 214 215int 216xo_open_container (const char *name); 217 218int 219xo_open_container_hd (xo_handle_t *xop, const char *name); --- 368 unchanged lines hidden (view full) --- 588xo_set_syslog_enterprise_id (unsigned short eid); 589 590typedef void (*xo_simplify_field_func_t)(const char *, unsigned, int); 591 592char * 593xo_simplify_format (xo_handle_t *xop, const char *fmt, int with_numbers, 594 xo_simplify_field_func_t field_cb); 595 | 263int 264xo_open_container_h (xo_handle_t *xop, const char *name); 265 266int 267xo_open_container (const char *name); 268 269int 270xo_open_container_hd (xo_handle_t *xop, const char *name); --- 368 unchanged lines hidden (view full) --- 639xo_set_syslog_enterprise_id (unsigned short eid); 640 641typedef void (*xo_simplify_field_func_t)(const char *, unsigned, int); 642 643char * 644xo_simplify_format (xo_handle_t *xop, const char *fmt, int with_numbers, 645 xo_simplify_field_func_t field_cb); 646 |
647int 648xo_emit_field_hv (xo_handle_t *xop, const char *rolmod, const char *contents, 649 const char *fmt, const char *efmt, 650 va_list vap); 651 652int 653xo_emit_field_h (xo_handle_t *xop, const char *rolmod, const char *contents, 654 const char *fmt, const char *efmt, ...); 655 656int 657xo_emit_field (const char *rolmod, const char *contents, 658 const char *fmt, const char *efmt, ...); 659 660void 661xo_retain_clear_all (void); 662 663void 664xo_retain_clear (const char *fmt); 665 |
|
596#endif /* INCLUDE_XO_H */ | 666#endif /* INCLUDE_XO_H */ |