2024-02-22 00:40:09 +00:00
|
|
|
#ifdef _COSMO_SOURCE
|
2022-03-16 20:33:13 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_
|
2023-06-06 10:30:37 +00:00
|
|
|
|
2023-08-19 13:41:06 +00:00
|
|
|
#define klog __klog
|
2023-06-06 10:30:37 +00:00
|
|
|
#define kprintf __kprintf
|
|
|
|
#define ksnprintf __ksnprintf
|
|
|
|
#define kvprintf __kvprintf
|
|
|
|
#define kvsnprintf __kvsnprintf
|
2023-08-19 13:41:06 +00:00
|
|
|
#define kloghandle __kloghandle
|
2023-06-06 10:30:37 +00:00
|
|
|
#define kisdangerous __kisdangerous
|
2023-10-25 21:32:20 +00:00
|
|
|
#define uprintf __uprintf
|
|
|
|
#define uvprintf __uvprintf
|
2023-06-06 10:30:37 +00:00
|
|
|
|
2022-03-16 20:33:13 +00:00
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
|
2023-10-25 21:32:20 +00:00
|
|
|
COSMOPOLITAN_C_START_
|
2023-06-06 10:30:37 +00:00
|
|
|
|
2024-01-09 09:26:03 +00:00
|
|
|
void kprintf(const char *, ...) libcesque;
|
|
|
|
size_t ksnprintf(char *, size_t, const char *, ...) libcesque;
|
|
|
|
void kvprintf(const char *, va_list) libcesque;
|
|
|
|
size_t kvsnprintf(char *, size_t, const char *, va_list) libcesque;
|
2023-08-19 13:41:06 +00:00
|
|
|
|
2024-01-09 09:26:03 +00:00
|
|
|
bool32 kisdangerous(const void *) libcesque;
|
2023-10-25 21:32:20 +00:00
|
|
|
|
2024-01-09 09:26:03 +00:00
|
|
|
void klog(const char *, size_t) libcesque;
|
|
|
|
void _klog_serial(const char *, size_t) libcesque;
|
|
|
|
long kloghandle(void) libcesque;
|
2022-03-16 20:33:13 +00:00
|
|
|
|
2024-01-09 09:26:03 +00:00
|
|
|
void uprintf(const char *, ...) libcesque;
|
|
|
|
void uvprintf(const char *, va_list) libcesque;
|
2023-10-25 21:32:20 +00:00
|
|
|
|
|
|
|
#ifndef TINY
|
2023-11-16 04:57:18 +00:00
|
|
|
#define KINFOF(FMT, ...) \
|
|
|
|
do { \
|
|
|
|
uprintf("\r\e[35m%s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
|
|
|
|
##__VA_ARGS__); \
|
|
|
|
} while (0)
|
|
|
|
#define KWARNF(FMT, ...) \
|
|
|
|
do { \
|
|
|
|
uprintf("\r\e[94;49mwarn: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
|
|
|
|
##__VA_ARGS__); \
|
|
|
|
} while (0)
|
2023-10-25 21:32:20 +00:00
|
|
|
#else
|
|
|
|
#define KINFOF(FMT, ...) ((void)0)
|
|
|
|
#define KWARNF(FMT, ...) ((void)0)
|
|
|
|
#endif
|
2023-11-16 04:57:18 +00:00
|
|
|
#define KDIEF(FMT, ...) \
|
|
|
|
do { \
|
|
|
|
kprintf("\r\e[30;101mfatal: %s:%d: " FMT "\e[0m\n", __FILE__, __LINE__, \
|
|
|
|
##__VA_ARGS__); \
|
|
|
|
for (;;) \
|
|
|
|
asm volatile("cli\n\thlt"); \
|
|
|
|
} while (0)
|
2023-10-25 21:32:20 +00:00
|
|
|
|
2022-03-16 20:33:13 +00:00
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_INTRIN_KPRINTF_H_ */
|
2024-02-22 00:40:09 +00:00
|
|
|
#endif /* _COSMO_SOURCE */
|