edje: compile again on windows.
authorcedric <cedric>
Sat, 28 Jul 2012 15:53:15 +0000 (15:53 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 28 Jul 2012 15:53:15 +0000 (15:53 +0000)
Patch half Vincent, half myself.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@74537 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/edje_cc.h

index 8438827..4b78382 100644 (file)
@@ -17,19 +17,44 @@ extern Eina_Prefix *pfx;
 /* logging variables */
 extern int _edje_cc_log_dom ;
 #define EDJE_CC_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
+
+#ifdef _WIN32
+# define EDJE_ERR_COLOR FOREGROUND_RED | FOREGROUND_INTENSITY
+# define EDJE_INF_COLOR FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY
+# define EDJE_WRN_COLOR FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
+# define EDJE_LOG(str, color, ...) do {                                        \
+    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),           \
+                           color);                                     \
+    printf(str);                                                       \
+    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),           \
+                           FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); \
+    printf(": ");                                                      \
+    printf(__VA_ARGS__);                                               \
+    printf("\n");                                                      \
+  } while (0)
+#else
+# define EDJE_ERR_COLOR "\033[31m"
+# define EDJE_INF_COLOR "\033[35m"
+# define EDJE_WRN_COLOR "\033[33m"
+# define EDJE_LOG(str, color, ...) do {                                        \
+    printf("\033[31m");                                                        \
+    printf(__VA_ARGS__);                                               \
+    printf("\033[0m\n"); }                                             \
+  while (0)
+#endif
+
 #ifdef ERR
 # undef ERR
 #endif
-#define ERR(...) do{printf("\033[31m");printf(__VA_ARGS__);printf("\033[0m\n");} while (0)
+#define ERR(...) EDJE_LOG("ERR", EDJE_ERR_COLOR, __VA_ARGS__)
 #ifdef INF
 # undef INF
 #endif
-#define INF(...) do{printf("\033[35m");printf(__VA_ARGS__);printf("\033[0m\n");} while (0)
+#define INF(...) EDJE_LOG("INF", EDJE_INF_COLOR, __VA_ARGS__)
 #ifdef WRN
 # undef WRN
 #endif
-#define WRN(...)  do{printf("\033[33m");printf(__VA_ARGS__);printf("\033[0m\n");} while (0)
-
+#define WRN(...) EDJE_LOG("WRN", EDJE_WRN_COLOR, __VA_ARGS__)
 
 /* types */
 typedef struct _New_Object_Handler    New_Object_Handler;