2 * UCW Library -- I/O Wrapper for Hexadecimal Escaped Debugging Output
4 * (c) 2015 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
13 #include <ucw/fastbuf.h>
15 #ifdef CONFIG_UCW_CLEAN_ABI
16 #define fb_wrap_hex_in ucw_fb_wrap_hex_in
17 #define fb_wrap_hex_out ucw_fb_wrap_hex_out
21 * When debugging a program, you might wonder what strange characters
22 * are there in the output, or you might want to spice up the input
23 * with Unicode snowmen to make the program freeze.
25 * In such situations, you can wrap your input or output stream in
26 * the hex wrapper, which converts between strange characters and their
27 * hexadecimal representation.
31 * Creates an output hex wrapper for the given fastbuf. Printable ASCII
32 * characters written to the wrapper are copied verbatim to @f.
33 * Control characters, whitespace and everything outside ASCII
34 * are transcribed hexadecimally as `<XY>`. A newline is appended
35 * at the end of the output.
37 struct fastbuf *fb_wrap_hex_out(struct fastbuf *f);
40 * Creates an input hex wrapper for the given fastbuf. It reads characters
41 * from @f and translates hexadecimal sequences `<XY>`. All other characters
42 * are copied verbatim.
44 struct fastbuf *fb_wrap_hex_in(struct fastbuf *f);