[1] | 1 | // Copyright (c) Athena Dev Teams - Licensed under GNU GPL |
---|
| 2 | // For more information, see LICENCE in the main folder |
---|
| 3 | |
---|
| 4 | #ifndef _SHOWMSG_H_ |
---|
| 5 | #define _SHOWMSG_H_ |
---|
| 6 | |
---|
| 7 | // for help with the console colors look here: |
---|
| 8 | // http://www.edoceo.com/liberum/?doc=printf-with-color |
---|
| 9 | // some code explanation (used here): |
---|
| 10 | // \033[2J : clear screen and go up/left (0, 0 position) |
---|
| 11 | // \033[K : clear line from actual position to end of the line |
---|
| 12 | // \033[0m : reset color parameter |
---|
| 13 | // \033[1m : use bold for font |
---|
| 14 | |
---|
| 15 | #define CL_RESET "\033[0m" |
---|
| 16 | #define CL_CLS "\033[2J" |
---|
| 17 | #define CL_CLL "\033[K" |
---|
| 18 | |
---|
| 19 | // font settings |
---|
| 20 | #define CL_BOLD "\033[1m" |
---|
| 21 | #define CL_NORM CL_RESET |
---|
| 22 | #define CL_NORMAL CL_RESET |
---|
| 23 | #define CL_NONE CL_RESET |
---|
| 24 | // foreground color and bold font (bright color on windows) |
---|
| 25 | #define CL_WHITE "\033[1;37m" |
---|
| 26 | #define CL_GRAY "\033[1;30m" |
---|
| 27 | #define CL_RED "\033[1;31m" |
---|
| 28 | #define CL_GREEN "\033[1;32m" |
---|
| 29 | #define CL_YELLOW "\033[1;33m" |
---|
| 30 | #define CL_BLUE "\033[1;34m" |
---|
| 31 | #define CL_MAGENTA "\033[1;35m" |
---|
| 32 | #define CL_CYAN "\033[1;36m" |
---|
| 33 | |
---|
| 34 | // background color |
---|
| 35 | #define CL_BG_BLACK "\033[40m" |
---|
| 36 | #define CL_BG_RED "\033[41m" |
---|
| 37 | #define CL_BG_GREEN "\033[42m" |
---|
| 38 | #define CL_BG_YELLOW "\033[43m" |
---|
| 39 | #define CL_BG_BLUE "\033[44m" |
---|
| 40 | #define CL_BG_MAGENTA "\033[45m" |
---|
| 41 | #define CL_BG_CYAN "\033[46m" |
---|
| 42 | #define CL_BG_WHITE "\033[47m" |
---|
| 43 | // foreground color and normal font (normal color on windows) |
---|
| 44 | #define CL_LT_BLACK "\033[0;30m" |
---|
| 45 | #define CL_LT_RED "\033[0;31m" |
---|
| 46 | #define CL_LT_GREEN "\033[0;32m" |
---|
| 47 | #define CL_LT_YELLOW "\033[0;33m" |
---|
| 48 | #define CL_LT_BLUE "\033[0;34m" |
---|
| 49 | #define CL_LT_MAGENTA "\033[0;35m" |
---|
| 50 | #define CL_LT_CYAN "\033[0;36m" |
---|
| 51 | #define CL_LT_WHITE "\033[0;37m" |
---|
| 52 | // foreground color and bold font (bright color on windows) |
---|
| 53 | #define CL_BT_BLACK "\033[1;30m" |
---|
| 54 | #define CL_BT_RED "\033[1;31m" |
---|
| 55 | #define CL_BT_GREEN "\033[1;32m" |
---|
| 56 | #define CL_BT_YELLOW "\033[1;33m" |
---|
| 57 | #define CL_BT_BLUE "\033[1;34m" |
---|
| 58 | #define CL_BT_MAGENTA "\033[1;35m" |
---|
| 59 | #define CL_BT_CYAN "\033[1;36m" |
---|
| 60 | #define CL_BT_WHITE "\033[1;37m" |
---|
| 61 | |
---|
| 62 | #define CL_WTBL "\033[37;44m" // white on blue |
---|
| 63 | #define CL_XXBL "\033[0;44m" // default on blue |
---|
| 64 | #define CL_PASS "\033[0;32;42m" // green on green |
---|
| 65 | |
---|
| 66 | #define CL_SPACE " " // space aquivalent of the print messages |
---|
| 67 | |
---|
| 68 | extern int stdout_with_ansisequence; //If the color ansi sequences are to be used. [flaviojs] |
---|
| 69 | extern int msg_silent; //Specifies how silent the console is. [Skotlex] |
---|
| 70 | extern char timestamp_format[20]; //For displaying Timestamps [Skotlex] |
---|
| 71 | |
---|
| 72 | enum msg_type { |
---|
| 73 | MSG_NONE, |
---|
| 74 | MSG_STATUS, |
---|
| 75 | MSG_SQL, |
---|
| 76 | MSG_INFORMATION, |
---|
| 77 | MSG_NOTICE, |
---|
| 78 | MSG_WARNING, |
---|
| 79 | MSG_DEBUG, |
---|
| 80 | MSG_ERROR, |
---|
| 81 | MSG_FATALERROR |
---|
| 82 | }; |
---|
| 83 | |
---|
| 84 | extern void ClearScreen(void); |
---|
| 85 | extern int ShowMessage(const char *, ...); |
---|
| 86 | extern int ShowStatus(const char *, ...); |
---|
| 87 | extern int ShowSQL(const char *, ...); |
---|
| 88 | extern int ShowInfo(const char *, ...); |
---|
| 89 | extern int ShowNotice(const char *, ...); |
---|
| 90 | extern int ShowWarning(const char *, ...); |
---|
| 91 | extern int ShowDebug(const char *, ...); |
---|
| 92 | extern int ShowError(const char *, ...); |
---|
| 93 | extern int ShowFatalError(const char *, ...); |
---|
| 94 | |
---|
| 95 | #endif /* _SHOWMSG_H_ */ |
---|