use parse result
This commit is contained in:
52
core.h
52
core.h
@@ -176,8 +176,10 @@ list<string> strSplit(Arena *arena, string splitStr, string inputStr);
|
||||
string strPrintfv(Arena *arena, const char *fmt, va_list args);
|
||||
string strPrintf(Arena *arena, const char *fmt, ...);
|
||||
|
||||
int8 parsePositiveInt(string str, size_t *lengthPointer);
|
||||
real32 parsePositiveReal32(Arena *arena, string str, size_t *lengthPointer);
|
||||
struct ParsePositiveIntResult { uint8 result; bool valid; };
|
||||
ParsePositiveIntResult parsePositiveInt(string str, size_t *lengthPointer);
|
||||
struct ParsePositiveReal32Result { real32 result; bool valid; };
|
||||
ParsePositiveReal32Result parsePositiveReal32(Arena *arena, string str, size_t *lengthPointer);
|
||||
|
||||
inline function bool isNumeric(char c);
|
||||
|
||||
@@ -206,6 +208,52 @@ enum LogTarget {
|
||||
LogTarget_count,
|
||||
};
|
||||
|
||||
#define ANSI_INSTRUCTION_FROM_ENUM(ansiCodeEnum) ANSI_INSTRUCTION(ansiCodeEnum)
|
||||
#define ANSI_INSTRUCTION(ansiCode) "\u001b[" #ansiCode "m"
|
||||
#define ANSI_INSTRUCTION_STR(ansiCodeStr) "\u001b[" ansiCodeStr "m"
|
||||
#define ANSI_RESET ANSI_INSTRUCTION(0)
|
||||
|
||||
#define ANSI_fg_black 30
|
||||
#define ANSI_fg_red 31
|
||||
#define ANSI_fg_green 32
|
||||
#define ANSI_fg_yellow 33
|
||||
#define ANSI_fg_blue 34
|
||||
#define ANSI_fg_magenta 35
|
||||
#define ANSI_fg_cyan 36
|
||||
#define ANSI_fg_white 37
|
||||
|
||||
#define ANSI_fg_bblack 90
|
||||
#define ANSI_fg_bred 91
|
||||
#define ANSI_fg_bgreen 92
|
||||
#define ANSI_fg_byellow 93
|
||||
#define ANSI_fg_bblue 94
|
||||
#define ANSI_fg_bmagenta 95
|
||||
#define ANSI_fg_bcyan 96
|
||||
#define ANSI_fg_bwhite 97
|
||||
|
||||
#define ANSI_bg_black 40
|
||||
#define ANSI_bg_red 41
|
||||
#define ANSI_bg_green 42
|
||||
#define ANSI_bg_yellow 43
|
||||
#define ANSI_bg_blue 44
|
||||
#define ANSI_bg_magenta 45
|
||||
#define ANSI_bg_cyan 46
|
||||
#define ANSI_bg_white 47
|
||||
|
||||
#define ANSI_bg_bblack 100
|
||||
#define ANSI_bg_bred 101
|
||||
#define ANSI_bg_bgreen 102
|
||||
#define ANSI_bg_byellow 103
|
||||
#define ANSI_bg_bblue 104
|
||||
#define ANSI_bg_bmagenta 105
|
||||
#define ANSI_bg_bcyan 106
|
||||
#define ANSI_bg_bwhite 107
|
||||
|
||||
#define COLOR_TEXT(text, foregroundcolor) ANSI_INSTRUCTION_FROM_ENUM(foregroundcolor) text ANSI_RESET
|
||||
#define COLOR_TEXT_BG(text, backgroundcolor) ANSI_INSTRUCTION_FROM_ENUM(backgroundcolor) text ANSI_RESET
|
||||
#define COLOR_TEXT_FG_BG(text, foregroundcolor, backgroundcolor) ANSI_INSTRUCTION_FROM_ENUM(foregroundcolor) ANSI_INSTRUCTION_FROM_ENUM(backgroundcolor) text ANSI_RESET
|
||||
#define COLOR_TEXT_RGB(text, red, green, blue) ANSI_INSTRUCTION_STR("38;2;" #red ";" #green ";" #blue) text ANSI_RESET
|
||||
|
||||
void log(list<int> l, LogTarget target = LogTarget_stdout);
|
||||
void log(list<string> l, LogTarget target = LogTarget_stdout);
|
||||
void log(const char *fmt, ...);
|
||||
|
||||
Reference in New Issue
Block a user