1 #ifndef __DM_MACROS_H__
2 #define __DM_MACROS_H__
142 #define __USE_COLORS__ true
144 #if __USE_COLORS__ == false
154 #define ACDarkGray ""
155 #define ACLightBlue ""
156 #define ACLightGreen ""
157 #define ACLightCyan ""
158 #define ACLightRed ""
159 #define ACLightPurple ""
165 #define ACUnderline ""
177 #elif __USE_COLORS__ == true
179 #define ACBlack "\033[0;30m"
180 #define ACBlue "\033[0;34m"
181 #define ACGreen "\033[0;32m"
182 #define ACCyan "\033[0;36m"
183 #define ACRed "\033[0;31m"
184 #define ACPurple "\033[0;35m"
185 #define ACBrown "\033[0;33m"
186 #define ACGray "\033[0;37m"
187 #define ACDarkGray "\033[1;30m"
188 #define ACLightBlue "\033[1;34m"
189 #define ACLightGreen "\033[1;32m"
190 #define ACLightCyan "\033[1;36m"
191 #define ACLightRed "\033[1;31m"
192 #define ACLightPurple "\033[1;35m"
193 #define ACYellow "\033[1;33m"
194 #define ACWhite "\033[1;37m"
196 #define ACPlain "\033[0m"
197 #define ACBold "\033[1m"
198 #define ACUnderline "\033[4m"
199 #define ACBlink "\033[5m"
200 #define ACReverse "\033[7m"
202 #define ACClear "\033[2J"
203 #define ACClearL "\033[2K"
207 #define ACSave "\033[s"
208 #define ACRecall "\033[u"
212 static std::string ACBlack_ = ACBlack;
213 static std::string ACBlue_ = ACBlue;
214 static std::string ACGreen_ = ACGreen;
215 static std::string ACCyan_ = ACCyan;
216 static std::string ACRed_ = ACRed;
217 static std::string ACPurple_ = ACPurple;
218 static std::string ACBrown_ = ACBrown;
219 static std::string ACGray_ = ACGray;
220 static std::string ACDarkGray_ = ACDarkGray;
221 static std::string ACLightBlue_ = ACLightBlue;
222 static std::string ACLightGreen_ = ACLightGreen;
223 static std::string ACLightCyan_ = ACLightCyan;
224 static std::string ACLightRed_ = ACLightRed;
225 static std::string ACLightPurple_ = ACLightPurple;
226 static std::string ACYellow_ = ACYellow;
227 static std::string ACWhite_ = ACWhite;
229 static std::string ACPlain_ = ACPlain;
230 static std::string ACBold_ = ACBold;
231 static std::string ACUnderline_ = ACUnderline;
232 static std::string ACBlink_ = ACBlink;
233 static std::string ACReverse_ = ACReverse;
235 static std::string ACClear_ = ACClear;
236 static std::string ACClearL_ = ACClearL;
238 static std::string ACCR_ = ACCR;
240 static std::string ACSave_ = ACSave;
241 static std::string ACRecall_ = ACRecall;
243 static std::string ACBBlack_ = ACBlack + ACBold_;
244 static std::string ACBBlue_ = ACBlue + ACBold_;
245 static std::string ACBGreen_ = ACGreen + ACBold_;
246 static std::string ACBCyan_ = ACCyan + ACBold_;
247 static std::string ACBRed_ = ACRed + ACBold_;
248 static std::string ACBPurple_ = ACPurple + ACBold_;
249 static std::string ACBBrown_ = ACBrown + ACBold_;
250 static std::string ACBGray_ = ACGray + ACBold_;
251 static std::string ACBDarkGray_ = ACDarkGray + ACBold_;
252 static std::string ACBLightBlue_ = ACLightBlue + ACBold_;
253 static std::string ACBLightGreen_ = ACLightGreen + ACBold_;
254 static std::string ACBLightCyan_ = ACLightCyan + ACBold_;
255 static std::string ACBLightRed_ = ACLightRed + ACBold_;
256 static std::string ACBLightPurple_ = ACLightPurple + ACBold_;
257 static std::string ACBYellow_ = ACYellow + ACBold_;
258 static std::string ACBWhite_ = ACWhite + ACBold_;
262 static int __span__ = 30;
263 static int __pthr__ = 0;
264 static bool __enablePrintouts__ =
true;
266 static bool __long__ =
true;
267 static bool __meth__ =
true;
268 static bool __file__ =
false;
269 static bool __date__ =
false;
270 static bool __time__ =
false;
271 static std::string __c_file__ = ACBCyan_;
272 static std::string __c_date__ = ACBLightCyan_;
273 static std::string __c_time__ = ACBLightBlue_;
274 static std::string __c_meth__ = ACBLightPurple_;
276 #define __PRE__(priority, iostream) \
278 if(DMM::__enablePrintouts__) \
280 std::stringstream msg_; \
281 std::stringstream ss; \
282 std::string toTrim; \
284 std::stringstream PFs_; \
285 std::string blanks = ""; \
291 msg_ << ACBCyan_ << __LINE__ << ACPlain << ACYellow << "\t] " << ACPlain; \
295 PF_ = __FUNCTION__; \
297 PF_ = __PRETTY_FUNCTION__; \
298 PFSize = PF_.size(); \
299 if(PFSize >= DMM::__span__) \
301 PFSize = DMM::__span__; \
303 for(int i = 0; i < PFSize; ++i) \
307 if(PFSize < DMM::__span__) \
309 for(int i = 0; i < DMM::__span__ + 3 - PFSize; ++i) \
314 if(PFSize < (int)PF_.size()) \
317 PFs_ << ACRed << "..."; \
321 PFs_ << ACPlain << ACPlain << ACPlain; \
323 msgS = PFs_.str().size() + 1; \
324 if(msgS <= DMM::__span__) \
325 msgS = DMM::__span__; \
326 blankSize = maxL - msgS; \
329 for(int i = 0; i < blankSize; ++i) \
334 msg_ << ACYellow << "[" << DMM::__c_meth__ << PFs_.str() << ACPlain \
335 << ACYellow << "] " << ACPlain; \
342 PFSize = PF_.size(); \
343 if(PFSize >= DMM::__span__) \
345 PFSize = DMM::__span__; \
347 for(int i = 0; i < PFSize; ++i) \
351 if(PFSize < DMM::__span__) \
353 for(int i = 0; i < DMM::__span__ + 3 - PFSize; ++i) \
358 if(PFSize < (int)PF_.size()) \
361 PFs_ << ACRed << "..."; \
365 PFs_ << ACPlain << ACPlain << ACPlain; \
367 msgS = PFs_.str().size() + 1; \
368 if(msgS <= DMM::__span__) \
369 msgS = DMM::__span__; \
370 blankSize = maxL - msgS; \
373 for(int i = 0; i < blankSize; ++i) \
378 msg_ << ACYellow << "[" << DMM::__c_file__ << PFs_.str() << ACPlain \
379 << ACYellow << "] " << ACPlain; \
384 msg_ << ACYellow << "[" << DMM::__c_date__ << __DATE__ << ACPlain \
385 << ACYellow << "] " << ACPlain; \
390 msg_ << ACYellow << "[" << DMM ::__c_time__ << __TIME__ << ACPlain \
391 << ACYellow << "] " << ACPlain; \
393 if(priority >= DMM::__pthr__) \
395 std::cout << msg_.str(); \
403 #define __PRE0__(iostream) __PRE__(0, iostream)
405 #endif // __DM_MACROS__