Improve hex_dump().
[pintos-anon] / src / lib / stdio.h
1 #ifndef __LIB_STDIO_H
2 #define __LIB_STDIO_H
3
4 #include <debug.h>
5 #include <stdarg.h>
6 #include <stdbool.h>
7 #include <stddef.h>
8 #include <stdint.h>
9
10 /* Predefined file handles. */
11 #define STDIN_FILENO 0
12 #define STDOUT_FILENO 1
13
14 /* Standard functions. */
15 int printf (const char *, ...) PRINTF_FORMAT (1, 2);
16 int snprintf (char *, size_t, const char *, ...) PRINTF_FORMAT (3, 4);
17 int vprintf (const char *, va_list) PRINTF_FORMAT (1, 0);
18 int vsnprintf (char *, size_t, const char *, va_list) PRINTF_FORMAT (3, 0);
19 int putchar (int);
20 int puts (const char *);
21
22 /* Nonstandard functions. */
23 #ifdef KERNEL
24 void putbuf (const char *, size_t);
25 #endif
26 #ifdef USER
27 int hprintf (int, const char *, ...) PRINTF_FORMAT (2, 3);
28 int vhprintf (int, const char *, va_list) PRINTF_FORMAT (2, 0);
29 #endif
30 void hex_dump (uintptr_t ofs, const void *, size_t size, bool ascii);
31
32 /* Internal functions. */
33 void __vprintf (const char *format, va_list args,
34                 void (*output) (char, void *), void *aux);
35 void __printf (const char *format,
36                void (*output) (char, void *), void *aux, ...);
37
38 /* Try to be helpful. */
39 #define sprintf dont_use_sprintf_use_snprintf
40 #define vsprintf dont_use_vsprintf_use_vsnprintf
41
42 #endif /* lib/stdio.h */