1 #ifndef __DM_MACROS_H__
2 #define __DM_MACROS_H__
140 #define __USE_COLORS__ true
142 #if __USE_COLORS__ == false
152 #define ACDarkGray ""
153 #define ACLightBlue ""
154 #define ACLightGreen ""
155 #define ACLightCyan ""
156 #define ACLightRed ""
157 #define ACLightPurple ""
163 #define ACUnderline ""
175 #elif __USE_COLORS__ == true
177 #define ACBlack "\033[0;30m"
178 #define ACBlue "\033[0;34m"
179 #define ACGreen "\033[0;32m"
180 #define ACCyan "\033[0;36m"
181 #define ACRed "\033[0;31m"
182 #define ACPurple "\033[0;35m"
183 #define ACBrown "\033[0;33m"
184 #define ACGray "\033[0;37m"
185 #define ACDarkGray "\033[1;30m"
186 #define ACLightBlue "\033[1;34m"
187 #define ACLightGreen "\033[1;32m"
188 #define ACLightCyan "\033[1;36m"
189 #define ACLightRed "\033[1;31m"
190 #define ACLightPurple "\033[1;35m"
191 #define ACYellow "\033[1;33m"
192 #define ACWhite "\033[1;37m"
194 #define ACPlain "\033[0m"
195 #define ACBold "\033[1m"
196 #define ACUnderline "\033[4m"
197 #define ACBlink "\033[5m"
198 #define ACReverse "\033[7m"
200 #define ACClear "\033[2J"
201 #define ACClearL "\033[2K"
205 #define ACSave "\033[s"
206 #define ACRecall "\033[u"
210 static std::string ACBlack_ = ACBlack;
211 static std::string ACBlue_ = ACBlue;
212 static std::string ACGreen_ = ACGreen;
213 static std::string ACCyan_ = ACCyan;
214 static std::string ACRed_ = ACRed;
215 static std::string ACPurple_ = ACPurple;
216 static std::string ACBrown_ = ACBrown;
217 static std::string ACGray_ = ACGray;
218 static std::string ACDarkGray_ = ACDarkGray;
219 static std::string ACLightBlue_ = ACLightBlue;
220 static std::string ACLightGreen_ = ACLightGreen;
221 static std::string ACLightCyan_ = ACLightCyan;
222 static std::string ACLightRed_ = ACLightRed;
223 static std::string ACLightPurple_ = ACLightPurple;
224 static std::string ACYellow_ = ACYellow;
225 static std::string ACWhite_ = ACWhite;
227 static std::string ACPlain_ = ACPlain;
228 static std::string ACBold_ = ACBold;
229 static std::string ACUnderline_ = ACUnderline;
230 static std::string ACBlink_ = ACBlink;
231 static std::string ACReverse_ = ACReverse;
233 static std::string ACClear_ = ACClear;
234 static std::string ACClearL_ = ACClearL;
236 static std::string ACCR_ = ACCR;
238 static std::string ACSave_ = ACSave;
239 static std::string ACRecall_ = ACRecall;
241 static std::string ACBBlack_ = ACBlack + ACBold_;
242 static std::string ACBBlue_ = ACBlue + ACBold_;
243 static std::string ACBGreen_ = ACGreen + ACBold_;
244 static std::string ACBCyan_ = ACCyan + ACBold_;
245 static std::string ACBRed_ = ACRed + ACBold_;
246 static std::string ACBPurple_ = ACPurple + ACBold_;
247 static std::string ACBBrown_ = ACBrown + ACBold_;
248 static std::string ACBGray_ = ACGray + ACBold_;
249 static std::string ACBDarkGray_ = ACDarkGray + ACBold_;
250 static std::string ACBLightBlue_ = ACLightBlue + ACBold_;
251 static std::string ACBLightGreen_ = ACLightGreen + ACBold_;
252 static std::string ACBLightCyan_ = ACLightCyan + ACBold_;
253 static std::string ACBLightRed_ = ACLightRed + ACBold_;
254 static std::string ACBLightPurple_ = ACLightPurple + ACBold_;
255 static std::string ACBYellow_ = ACYellow + ACBold_;
256 static std::string ACBWhite_ = ACWhite + ACBold_;
260 static int __span__ = 30;
261 static int __pthr__ = 0;
262 static bool __enablePrintouts__ =
true;
264 static bool __long__ =
true;
265 static bool __meth__ =
true;
266 static bool __file__ =
false;
267 static bool __date__ =
false;
268 static bool __time__ =
false;
269 static std::string __c_file__ = ACBCyan_;
270 static std::string __c_date__ = ACBLightCyan_;
271 static std::string __c_time__ = ACBLightBlue_;
272 static std::string __c_meth__ = ACBLightPurple_;
274 #define __PRE__(priority, iostream) \
276 if(DMM::__enablePrintouts__) \
278 std::stringstream msg_; \
279 std::stringstream ss; \
280 std::string toTrim; \
282 std::stringstream PFs_; \
283 std::string blanks = ""; \
289 msg_ << ACBCyan_ << __LINE__ << ACPlain << ACYellow << "\t] " << ACPlain; \
293 PF_ = __FUNCTION__; \
295 PF_ = __PRETTY_FUNCTION__; \
296 PFSize = PF_.size(); \
297 if(PFSize >= DMM::__span__) \
299 PFSize = DMM::__span__; \
301 for(int i = 0; i < PFSize; ++i) \
305 if(PFSize < DMM::__span__) \
307 for(int i = 0; i < DMM::__span__ + 3 - PFSize; ++i) \
312 if(PFSize < (int)PF_.size()) \
315 PFs_ << ACRed << "..."; \
319 PFs_ << ACPlain << ACPlain << ACPlain; \
321 msgS = PFs_.str().size() + 1; \
322 if(msgS <= DMM::__span__) \
323 msgS = DMM::__span__; \
324 blankSize = maxL - msgS; \
327 for(int i = 0; i < blankSize; ++i) \
332 msg_ << ACYellow << "[" << DMM::__c_meth__ << PFs_.str() << ACPlain << ACYellow << "] " << ACPlain; \
339 PFSize = PF_.size(); \
340 if(PFSize >= DMM::__span__) \
342 PFSize = DMM::__span__; \
344 for(int i = 0; i < PFSize; ++i) \
348 if(PFSize < DMM::__span__) \
350 for(int i = 0; i < DMM::__span__ + 3 - PFSize; ++i) \
355 if(PFSize < (int)PF_.size()) \
358 PFs_ << ACRed << "..."; \
362 PFs_ << ACPlain << ACPlain << ACPlain; \
364 msgS = PFs_.str().size() + 1; \
365 if(msgS <= DMM::__span__) \
366 msgS = DMM::__span__; \
367 blankSize = maxL - msgS; \
370 for(int i = 0; i < blankSize; ++i) \
375 msg_ << ACYellow << "[" << DMM::__c_file__ << PFs_.str() << ACPlain << ACYellow << "] " << ACPlain; \
380 msg_ << ACYellow << "[" << DMM::__c_date__ << __DATE__ << ACPlain << ACYellow << "] " << ACPlain; \
385 msg_ << ACYellow << "[" << DMM ::__c_time__ << __TIME__ << ACPlain << ACYellow << "] " << ACPlain; \
387 if(priority >= DMM::__pthr__) \
389 std::cout << msg_.str(); \
397 #define __PRE0__(iostream) __PRE__(0, iostream)
399 #endif // __DM_MACROS__