/[ascend]/trunk/models/johnpye/fprops/color.h
ViewVC logotype

Contents of /trunk/models/johnpye/fprops/color.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2739 - (show annotations) (download) (as text)
Thu Dec 12 12:33:26 2013 UTC (6 years, 6 months ago) by jpye
File MIME type: text/x-chdr
File size: 2758 byte(s)
cp0 problem appears to be when cp0red==1 in cp0_prepare with IDEAL_CP0 data type.
1 /* ASCEND modelling environment
2 Copyright (C) 2012 John Pye
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *//* @file
17 Platform-independent console colour output.
18 */
19 #ifndef ASC_COLOR_H
20 #define ASC_COLOR_H
21
22 #include <stdio.h>
23
24 #ifdef __WIN32__
25 enum ConsoleColor{
26 ASC_FG_BLUE = 1
27 ,ASC_FG_GREEN = 2
28 ,ASC_FG_RED = 4
29 ,ASC_FG_BRIGHT = 8
30 ,ASC_BG_BLUE = 16
31 ,ASC_BG_GREEN = 32
32 ,ASC_BG_RED = 64
33 ,ASC_BG_BRIGHT = 128
34 };
35 #else
36 enum ConsoleColor{
37 ASC_FG_RED = 1
38 ,ASC_FG_GREEN = 2
39 ,ASC_FG_BLUE = 4
40 ,ASC_FG_BRIGHT = 8
41 ,ASC_BG_RED = 16
42 ,ASC_BG_GREEN = 32
43 ,ASC_BG_BLUE = 64
44 ,ASC_BG_BRIGHT = 128
45 };
46 #endif
47
48 #define ASC_FG_BLACK (0)
49 #define ASC_FG_DARKGREY (ASC_FG_BRIGHT)
50 #define ASC_FG_BROWN (ASC_FG_RED|ASC_FG_GREEN)
51 #define ASC_FG_MAGENTA (ASC_FG_RED|ASC_FG_BLUE)
52 #define ASC_FG_CYAN (ASC_FG_BLUE|ASC_FG_GREEN)
53 #define ASC_FG_YELLOW (ASC_FG_BROWN|ASC_FG_BRIGHT)
54 #define ASC_FG_BRIGHTCYAN (ASC_FG_CYAN|ASC_FG_BRIGHT)
55 #define ASC_FG_BRIGHTRED (ASC_FG_RED|ASC_FG_BRIGHT)
56 #define ASC_FG_BRIGHTGREEN (ASC_FG_GREEN|ASC_FG_BRIGHT)
57 #define ASC_FG_BRIGHTBLUE (ASC_FG_BLUE|ASC_FG_BRIGHT)
58 #define ASC_FG_PINK (ASC_FG_MAGENTA|ASC_FG_BRIGHT)
59 #define ASC_FG_GREY (ASC_FG_RED|ASC_FG_GREEN|ASC_FG_BLUE)
60 #define ASC_FG_WHITE (ASC_FG_GREY|ASC_FG_BRIGHT)
61
62 #define ASC_BG_YELLOW (ASC_BG_RED|ASC_BG_GREEN|ASC_BG_BRIGHT)
63 #define ASC_BG_WHITE (ASC_BG_RED|ASC_BG_GREEN|ASC_BG_BLUE|ASC_BG_BRIGHT)
64 #define ASC_BG_GREY (ASC_BG_RED|ASC_BG_GREEN|ASC_BG_BLUE)
65 #define ASC_BG_BLACK (0)
66 #define ASC_BG_DARKGREY (ASC_BG_BRIGHT)
67
68 int color_on(FILE *f, int colorcode);
69
70 int color_off(FILE *f);
71
72 #define FPROPS_MSG(FMT, ...) \
73 {color_on(stderr,ASC_FG_BROWN);\
74 fprintf(stderr,"%s:%d",__FILE__,__LINE__);\
75 color_on(stderr,ASC_FG_BRIGHTBLUE);\
76 fprintf(stderr,"(%s):",__func__);\
77 color_off(stderr);\
78 fprintf(stderr," " FMT "\n",##__VA_ARGS__);}
79
80 #define FPROPS_ERRMSG(STR,...) \
81 {color_on(stderr,ASC_FG_BRIGHTRED);\
82 fprintf(stderr,"ERROR:");\
83 color_on(stderr,ASC_FG_BRIGHTBLUE);\
84 fprintf(stderr,"%s:%d(%s):", __FILE__, __LINE__ ,__func__); \
85 color_off(stderr);\
86 fprintf(stderr," " STR "\n", ##__VA_ARGS__);}
87
88 #endif /* ASC_COLOR_H */

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22