forked from zackxue/ipc
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmy_print.h
48 lines (41 loc) · 1.13 KB
/
my_print.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef MY_PRINT_H_
#define MY_PRINT_H_
#define FONT_COLOR_BLACK "30"
#define FONT_COLOR_RED "31"
#define FONT_COLOR_GREEN "32"
#define FONT_COLOR_YELLOW "33"
#define FONT_COLOR_BLUE "34"
#define FONT_COLOR_WHITE "37"
#define FONT_BKG_BLACK "40"
#define FONT_BKG_RED "41"
#define FONT_BKG_GREEN "42"
#define FONT_BKG_YELLOW "43"
#define FONT_BKG_BLUE "44"
#define FONT_BKG_WHITE "47"
#define CLOSE_ALL_ATTR "0m"
#define SET_HEIGHT "1m"
#define SET_UNDERLINE "4m"
#define SET_FLICKER "5m"
#define CLEAR_SCREEN "2J"
//#define MY_PRINT (1)
//#define PRINT_DEFAULT_ATTR "31"
#if MY_PRINT
#define MYPRINTF(fmt...) \
do{\
printf("\033["FONT_BKG_BLACK";"FONT_COLOR_WHITE"m");\
printf(fmt);\
printf("\033["CLOSE_ALL_ATTR"\r\n");\
}while(0);
#define MYDEBUG(fmt...) \
do{\
printf("\033["FONT_BKG_BLACK";"FONT_COLOR_YELLOW"m");\
printf("FILENAME:%s,AT LINE:%d,FUNCTION:%s\n", __FILE__, __LINE__, __FUNCTION__);\
printf("\033["FONT_BKG_BLACK";"FONT_COLOR_RED"m");\
printf(fmt);\
printf("\033["CLOSE_ALL_ATTR"\r\n");\
}while(0);
#else
#define MYPRINTF(fmt...)
#define MYDEBUG(fmt...)
#endif
#endif