Changeset 2054 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 05/02/03 12:46:43 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MLog.cc
r2052 r2054 89 89 // check for TObjectWarning, TObject::Info, gErrorIgnoreLevel 90 90 91 const char MLog::kESC = '\033'; // (char)27 92 const char *const MLog::kEsc = "\033["; 93 const char *const MLog::kReset = "\033[0m"; 94 const char *const MLog::kRed = "\033[31m"; 95 const char *const MLog::kGreen = "\033[32m"; 96 #ifdef HAVE_DARKBACKGROUND 97 const char *const MLog::kYellow = "\033[33m\033[1m"; 98 #else 99 const char *const MLog::kYellow = "\033[33m"; 100 #endif 101 const char *const MLog::kUnderline = "\033[4m";; 102 const char *const MLog::kBlink = "\033[5m";; 103 const char *const MLog::kBright = "\033[1m";; 104 const char *const MLog::kDark = "\033[2m";; 105 91 106 // 92 107 // This is the definition of the global log facility … … 180 195 } 181 196 197 void MLog::Output(ostream &out, int len) 198 { 199 if (!TestBit(eNoColors)) 200 switch (fOutputLevel) 201 { 202 case 0: out << MLog::kReset; break; // all 203 case 1: out << MLog::kRed; break; // err 204 case 2: out << MLog::kYellow; break; // warn 205 case 3: out << MLog::kGreen; break; // inf 206 } 207 208 // Check for EOL 209 const Bool_t endline = fBase[len-1]=='\n'; 210 // output text to screen (without trailing '\0' or '\n') 211 out << TString(fBase, len-1); 212 // reset colors if working with colors 213 if (!TestBit(eNoColors)) 214 out << kReset; 215 // output EOL of check found EOL 216 if (endline) 217 out << '\n'; 218 out.flush(); 219 } 220 182 221 // -------------------------------------------------------------------------- 183 222 // … … 198 237 199 238 if (fDevice&eStdout) 200 cout.write(fBase, len);239 Output(cout, len); 201 240 202 241 if (fDevice&eStderr) 203 cerr.write(fBase, len);242 Output(cerr, len); 204 243 205 244 if (fDevice&eFile && fout) … … 289 328 290 329 if (fDevice&eStdout) 330 { 331 cout << kReset; 291 332 cout.flush(); 333 } 292 334 293 335 if (fDevice&eStderr) -
trunk/MagicSoft/Mars/mbase/MLog.h
r2052 r2054 23 23 { 24 24 public: 25 typedef enum _flags { eStdout = 0x1, eStderr = 0x2, eFile = 0x4, eGui = 0x8 } Flags_t; 25 typedef enum _flags { 26 eStdout = 0x001, 27 eStderr = 0x002, 28 eFile = 0x004, 29 eGui = 0x008, 30 eNoColors = 0x400 //BIT(15) 31 } Flags_t; 26 32 27 33 private: 34 static const char kESC; 35 static const char *const kEsc; 36 static const char *const kReset; 37 static const char *const kRed; 38 static const char *const kGreen; 39 static const char *const kYellow; 40 static const char *const kUnderline; 41 static const char *const kBlink; 42 static const char *const kBright; 43 static const char *const kDark; 44 28 45 char fBuffer; //! 29 46 char fBase[bsz+1]; //! Buffer to store the data in … … 46 63 TString **fGuiLines; //! Lines to pipe to gui 47 64 Int_t fNumLines; //! 48 // Bool_t fGuiLineFlushed; 49 TString fGuiLine; //! 65 TString fGuiLine; //! 50 66 51 67 #ifdef _REENTRANT … … 63 79 void ReallocateFile(const char *f); 64 80 void CheckFlag(Flags_t chk, int flag); 81 void Output(ostream &out, int len); 65 82 66 83 public: … … 143 160 void SetNullOutput(Bool_t n=kTRUE) { fIsNull = n; } 144 161 162 void SetNoColors(Bool_t flag=kTRUE) { flag ? SetBit(eNoColors) : ResetBit(eNoColors); } 163 145 164 ClassDef(MLog, 0) // This is what we call 'The logging system' 146 165 }; -
trunk/MagicSoft/Mars/mbase/MLogo.cc
r1337 r2054 32 32 // // 33 33 ////////////////////////////////////////////////////////////////////////////// 34 #ifdef HAVE_XPM 34 35 #include "MLogo.h" 35 36 … … 123 124 mag1, &logo, 0, &attr); 124 125 #else 125 #include "../marslogo _neu.xpm"126 #include "../marslogo.xpm" 126 127 int ret = XpmCreatePixmapFromData(fDisplay, fLogoWindow, 127 marslogo _neu_xpm, &logo, 0, &attr);128 marslogo, &logo, 0, &attr); 128 129 #endif 129 130 XpmFreeAttributes(&attr); … … 206 207 } 207 208 } 209 #endif -
trunk/MagicSoft/Mars/mbase/MLogo.h
r1337 r2054 1 1 #ifndef MARS_MLogo 2 2 #define MARS_MLogo 3 4 #ifdef HAVE_XPM 3 5 4 6 #ifndef __CINT__ … … 31 33 }; 32 34 33 #endif 34 35 #endif 35 #endif // __CINT__ 36 #endif // HAVE_XPM 37 #endif // MARS_MLogo -
trunk/MagicSoft/Mars/mbase/Makefile
r1715 r2054 50 50 MContinue.cc \ 51 51 MPrint.cc \ 52 MLogo.cc \ 52 53 MLogManip.cc 53 54
Note:
See TracChangeset
for help on using the changeset viewer.