showmsg.h 2.9 KB

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