source: trunk/IPs/systemC/processor/Morpheo/Common/include/Message.h @ 124

Last change on this file since 124 was 124, checked in by rosiere, 15 years ago

1) Add test and configuration
2) Fix Bug
3) Add log file in load store unit
4) Fix Bug in environment

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1#ifndef Morpheo_Message_h
2#define Morpheo_Message_h
3/*
4 * $Id: Message.h 124 2009-06-17 12:11:25Z rosiere $
5 *
6 * [ Description ]
7 *
8 * Routine of Test
9 */
10
11#include <stdio.h>
12#include <string.h>
13#include "Translation.h"
14
15namespace morpheo {
16
17  // Color
18  // 31 : rouge
19  // 32 : vert
20  // 33 : jaune
21  // 34 : bleu
22  // 35 : rose
23  // 36 : cyan
24  // 37 : blanc
25  // 38 : noir souligne
26  // 39 : noir
27
28#  define MSG_NONE          _("             ")
29#ifdef PRINT_COLOR
30#  define MSG_DEBUG         _("[1;34m[   DEBUG   ][0m")
31#  define MSG_ERROR         _("[1;31m[   ERROR   ][0m")
32#  define MSG_WARNING       _("[1;35m[  WARNING  ][0m")
33#  define MSG_INFORMATION   _("[1;32m[INFORMATION][0m")
34#  define MSG_BREAKPOINT    _("[1;38m[   BREAK   ][0m")
35#  define MSG_VHDL          _("[1;34m[   VHDL    ][0m")
36#else
37#  define MSG_DEBUG         _("[   DEBUG   ]")
38#  define MSG_ERROR         _("[   ERROR   ]")
39#  define MSG_WARNING       _("[  WARNING  ]")
40#  define MSG_INFORMATION   _("[INFORMATION]")
41#  define MSG_BREAKPOINT    _("[   BREAK   ]")
42#  define MSG_VHDL          _("[   VHDL    ]")
43#endif
44
45extern FILE * log_stream;
46
47FILE * log      (FILE * stream);
48void   log_init (bool        have_file,
49                 bool        with_date,
50                 bool        with_pid ,
51                 std::string directory,
52                 std::string file="");
53
54#define fmsg(stream,arg...)                     \
55  do                                            \
56    {                                           \
57      FILE * _stream = log(stream);             \
58      fprintf(_stream,arg);                     \
59      fflush(_stream);                          \
60    } while (0)
61
62#define fmsgDebug(stream,arg...)                \
63  do                                            \
64    {                                           \
65      fmsg(stream,"%s ",MSG_DEBUG);             \
66      fmsg(stream,arg);                         \
67    } while (0)
68
69#define fmsgError(stream,arg...)                \
70  do                                            \
71    {                                           \
72      fmsg(stream,"%s ",MSG_ERROR);             \
73      fmsg(stream,arg);                         \
74    } while (0)
75
76#define fmsgWarning(stream,arg...)              \
77  do                                            \
78    {                                           \
79      fmsg(stream,"%s ",MSG_WARNING);           \
80      fmsg(stream,arg);                         \
81    } while (0)
82
83#define fmsgInformation(stream,arg...)          \
84  do                                            \
85    {                                           \
86      fmsg(stream,"%s ",MSG_INFORMATION);       \
87      fmsg(stream,arg);                         \
88    } while (0)
89
90#define msg(arg...)             fmsg(stdout,arg)
91#define err(arg...)             fmsgError(stderr,arg)
92
93#define msgDebug(arg...)        fmsgDebug(stdout,arg)
94#define msgError(arg...)        fmsgError(stdout,arg)
95#define msgWarning(arg...)      fmsgWarning(stdout,arg)
96#define msgInformation(arg...)  fmsgInformation(stdout,arg)
97
98}; // end namespace morpheo
99#endif
Note: See TracBrowser for help on using the repository browser.