#ifndef BLUELIB_PRINT_H_ #define BLUELIB_PRINT_H_ #include #include #define b_i(...) b_print(B_PRINT_I, __VA_ARGS__) #define b_warn(...) b_print(B_PRINT_WARN, __VA_ARGS__) #define b_err(...) b_print(B_PRINT_ERR, __VA_ARGS__) typedef enum b_paragraph_format_flags { B_PARAGRAPH_DONT_INDENT_FIRST_LINE = 0x01u, B_PARAGRAPH_HYPHENATE = 0x02u, B_PARAGRAPH_DOUBLE_LINE_BREAK = 0x04u, B_PARAGRAPH_MULTI_LINE_BREAK = 0x08u, } b_paragraph_format_flags; typedef struct b_paragraph_format { b_paragraph_format_flags p_flags; unsigned int p_left_margin; unsigned int p_right_margin; unsigned int p_line_length; } b_paragraph_format; typedef enum b_print_format { B_PRINT_NORMAL = 0, B_PRINT_I, B_PRINT_WARN, B_PRINT_ERR, } b_print_format; BLUE_API b_status b_term_get_dimensions(FILE *fp, unsigned int *w, unsigned int *h); BLUE_API b_status b_print(b_print_format format, const char *str, ...); BLUE_API b_status b_print_paragraph( const char *str, FILE *fp, b_paragraph_format *format); BLUE_API int b_fputs(const char *str, FILE *fp); BLUE_API int b_printf(const char *format, ...); BLUE_API int b_fprintf(FILE *fp, const char *format, ...); #endif