Changeset 82 for trunk/IPs/systemC/processor/Morpheo/Common/include
- Timestamp:
- May 1, 2008, 6:48:45 PM (17 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Common/include
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h
r81 r82 2 2 #define DEBUG_H 3 3 4 /* 5 * $Id$ 6 * 7 * [ Description ] 8 * 9 * function to help the debugging : 10 * 11 * - debug_tab 12 * - log_printf 13 * - log_begin 14 * - log_end 15 * - breakpoint 16 * 17 * Debug's Level : 18 * - None : print elementary information 19 * - Info : print basic information 20 * - Trace : trace internal variable 21 * - Func : trace call and return function 22 * - All : print all information 23 */ 24 4 25 #include "Common/include/Message.h" 5 26 #include "Behavioural/include/Debug_component.h" 27 #include "Behavioural/include/Environment.h" 6 28 #include <stdio.h> 7 29 #include <string.h> … … 9 31 #include <sstream> 10 32 #include <string> 11 12 std::string debug_tab (void);13 void debug_function_begin (std::string component, std::string function);14 void debug_function_end (std::string component, std::string function);15 16 // Debug's Level :17 // * None : print elementary information18 // * Info : print basic information19 // * Trace : trace internal variable20 // * Func : trace call and return function21 // * All : print all information22 33 23 34 enum _debug_verbosity … … 30 41 }; 31 42 43 std::string debug_tab (void); 44 void debug_tab_inc (void); 45 void debug_tab_dec (void); 46 32 47 #ifdef DEBUG 33 48 # define log_printf(level, component, func, str... ) \ … … 39 54 ( DEBUG_ ## component == true )) ) \ 40 55 { \ 41 msg(_("%s"),debug_tab().c_str()); \ 56 if (DEBUG >= DEBUG_FUNC) \ 57 { \ 58 msg(_("%s"),debug_tab().c_str()); \ 59 } \ 42 60 if (DEBUG >= DEBUG_ALL ) \ 43 61 { \ … … 64 82 } \ 65 83 } while(0) 84 85 # define log_begin(component, func) \ 86 do \ 87 { \ 88 debug_tab_inc (); \ 89 log_printf(FUNC,component,func,"Begin"); \ 90 } while(0) 91 92 # define log_end(component, func) \ 93 do \ 94 { \ 95 log_printf(FUNC,component,func,"End"); \ 96 debug_tab_dec (); \ 97 } while(0) 98 66 99 #else 67 100 # define log_printf(level, component, func, str... ) \ 101 do \ 102 { \ 103 } while(0) 104 105 # define log_begin(component, func) \ 106 do \ 107 { \ 108 } while(0) 109 110 # define log_end(component, func) \ 68 111 do \ 69 112 { \ … … 77 120 msg(_("Breakpoint : file %s, line %d. Enter Any key to continue\n"),__FILE__,__LINE__); \ 78 121 msg(str); \ 79 msg(_("\n")); \80 122 getchar(); \ 81 123 } while(0) 82 124 125 #ifdef DEBUG_TEST 126 #define TEST_PTR(x) \ 127 do \ 128 { \ 129 if (x == NULL) \ 130 err(_("%s File %s, Line %d, this pointeur is null"),MSG_ERROR,__FILE__,__LINE__); \ 131 } \ 132 while (0) 133 #else 134 #define TEST_PTR(x) \ 135 do \ 136 { \ 137 } \ 138 while (0) 139 #endif 140 141 83 142 #endif // !DEBUG_H -
trunk/IPs/systemC/processor/Morpheo/Common/include/ErrorMorpheo.h
r81 r82 30 30 std::string file ) throw() 31 31 { 32 _msg = "<"+funcname+"> at line " + toString(line) + ", in file " + file + " : "+msg;32 _msg = toString("<%s> at line %d, in file %s : %s",funcname.c_str(),line,file.c_str(),msg.c_str()); 33 33 } 34 34 public : ~ErrorMorpheo (void) throw() {} -
trunk/IPs/systemC/processor/Morpheo/Common/include/Message.h
r81 r82 11 11 #include <stdio.h> 12 12 #include <string.h> 13 #include <libintl.h>13 #include "Translation.h" 14 14 15 15 namespace morpheo { 16 16 17 #ifdef NO_TRANSLATE 18 # define _(String) (String) 19 #else 20 # define _(String) gettext (String) 21 #endif 17 #define MSG_ERROR _("[ ERROR ]") 18 #define MSG_WARNING _("[ WARNING ]") 19 #define MSG_INFORMATION _("[INFORMATION]") 22 20 23 #define msg(arg...) fprintf(stdout,arg); 24 #define err(arg...) fprintf(stderr,arg); 21 #define msg(arg...) \ 22 do \ 23 { \ 24 fprintf(stdout,arg); \ 25 } while (0) 26 27 #define err(arg...) \ 28 do \ 29 { \ 30 fprintf(stderr,"%s ",MSG_ERROR); \ 31 fprintf(stderr,arg); \ 32 } while (0) 33 25 34 26 35 }; // end namespace morpheo -
trunk/IPs/systemC/processor/Morpheo/Common/include/ToString.h
r81 r82 16 16 #include <string> 17 17 #include <limits> 18 #include <stdio.h> 19 #include <stdlib.h> 20 #include <stdarg.h> 18 21 19 22 namespace morpheo { … … 99 102 return out.str(); 100 103 } 104 105 std::string toString (const char *fmt, ...); 101 106 102 107 }; // end namespace morpheo
Note: See TracChangeset
for help on using the changeset viewer.