diff options
Diffstat (limited to 'src/user/include/knob/format.h')
-rw-r--r-- | src/user/include/knob/format.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/user/include/knob/format.h b/src/user/include/knob/format.h index d55036c..fed31c7 100644 --- a/src/user/include/knob/format.h +++ b/src/user/include/knob/format.h @@ -1,12 +1,29 @@ #ifndef KNOB_FORMAT_H #define KNOB_FORMAT_H -#include <stdbool.h> +#include <knob/heap.h> + #include <stdint.h> +#include <stdarg.h> + +//allocates new memory +char *format_v(const char *fmt, va_list args); + +//allocates new memory +char *format(const char *fmt, ...); + +void syslogf_v(const char *fmt, va_list args); + +void syslogf(const char *fmt, ...); + +//reads a unsigned decimal terminated by either null or whitespace +//returns length of string plus length of whitespace +//returns 0 on failure +uint32_t try_swtou(const char *from, uint32_t *i_out); -bool try_sntoi(const char *s, uint32_t n, uint32_t *out); -void itosz(uint32_t i, char *out) __attribute__ ((access (write_only, 2))); -void itosz_h8(uint8_t i, char *out) __attribute__ ((access (write_only, 2))); -void itosz_h32(uint32_t i, char *out) __attribute__ ((access (write_only, 2))); +//reads a hexadecimal terminated by either null or whitespace +//returns length of string plus length of whitespace +//returns 0 on failure +uint32_t try_swtoh(const char *from, uint32_t *i_out); #endif
\ No newline at end of file |