REDRUM.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_REDRUM_H
  9. #define IGL_REDRUM_H
  10. // Q: These should probably be inside the igl namespace. What's the correct
  11. // way to do that?
  12. // A: I guess the right way is to not use a macro but a proper function with
  13. // streams as input and output.
  14. // ANSI color codes for formating iostream style output
  15. #ifdef IGL_REDRUM_NOOP
  16. // Bold Red, etc.
  17. #define NORUM(X) X
  18. #define REDRUM(X) X
  19. #define GREENRUM(X) X
  20. #define YELLOWRUM(X) X
  21. #define BLUERUM(X) X
  22. #define MAGENTARUM(X) X
  23. #define CYANRUM(X) X
  24. // Regular Red, etc.
  25. #define REDGIN(X) X
  26. #define GREENGIN(X) X
  27. #define YELLOWGIN(X) X
  28. #define BLUEGIN(X) X
  29. #define MAGENTAGIN(X) X
  30. #define CYANGIN(X) X
  31. #else
  32. // Bold Red, etc.
  33. #define NORUM(X) ""<<X<<""
  34. #define REDRUM(X) "\e[1m\e[31m"<<X<<"\e[m"
  35. #define GREENRUM(X) "\e[1m\e[32m"<<X<<"\e[m"
  36. #define YELLOWRUM(X) "\e[1m\e[33m"<<X<<"\e[m"
  37. #define BLUERUM(X) "\e[1m\e[34m"<<X<<"\e[m"
  38. #define MAGENTARUM(X) "\e[1m\e[35m"<<X<<"\e[m"
  39. #define CYANRUM(X) "\e[1m\e[36m"<<X<<"\e[m"
  40. // Regular Red, etc.
  41. #define REDGIN(X) "\e[31m"<<X<<"\e[m"
  42. #define GREENGIN(X) "\e[32m"<<X<<"\e[m"
  43. #define YELLOWGIN(X) "\e[33m"<<X<<"\e[m"
  44. #define BLUEGIN(X) "\e[34m"<<X<<"\e[m"
  45. #define MAGENTAGIN(X) "\e[35m"<<X<<"\e[m"
  46. #define CYANGIN(X) "\e[36m"<<X<<"\e[m"
  47. #endif
  48. #endif