You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
1.9 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. // I/O through <iostream>
  2. #ifndef _CL_IO_H
  3. #define _CL_IO_H
  4. #include "cln/types.h"
  5. #include "cln/modules.h"
  6. // I/O through <iostream>
  7. #ifdef floor
  8. #undef floor
  9. #include <iostream>
  10. #define floor cln_floor
  11. #else
  12. #include <iostream>
  13. #endif
  14. namespace cln {
  15. // compatibility:
  16. typedef std::istream& cl_istream;
  17. typedef std::ostream& cl_ostream;
  18. extern std::ostream* cl_debugout_stream;
  19. #define cl_debugout (*cl_debugout_stream)
  20. // Elementary operations on std::ostream&
  21. inline void fprintchar (std::ostream& stream, char c)
  22. {
  23. stream.put(c);
  24. }
  25. inline void fprint (std::ostream& stream, const char * string)
  26. {
  27. stream << string;
  28. }
  29. extern void fprintdecimal (std::ostream& stream, unsigned long x);
  30. extern void fprintdecimal (std::ostream& stream, long x);
  31. inline void fprintdecimal (std::ostream& stream, unsigned int x)
  32. {
  33. fprintdecimal(stream,(unsigned long)x);
  34. }
  35. inline void fprintdecimal (std::ostream& stream, int x)
  36. {
  37. fprintdecimal(stream,(long)x);
  38. }
  39. extern void fprinthexadecimal (std::ostream& stream, unsigned long x);
  40. extern void fprinthexadecimal (std::ostream& stream, long x);
  41. inline void fprinthexadecimal (std::ostream& stream, unsigned int x)
  42. {
  43. fprinthexadecimal(stream,(unsigned long)x);
  44. }
  45. inline void fprinthexadecimal (std::ostream& stream, int x)
  46. {
  47. fprinthexadecimal(stream,(long)x);
  48. }
  49. struct cl_print_flags;
  50. struct cl_print_number_flags;
  51. struct cl_print_real_flags;
  52. struct cl_print_rational_flags;
  53. struct cl_print_float_flags;
  54. class cl_prin_globals_init_helper
  55. {
  56. static int count;
  57. public:
  58. cl_prin_globals_init_helper();
  59. ~cl_prin_globals_init_helper();
  60. };
  61. static cl_prin_globals_init_helper cl_prin_globals_init_helper_instance;
  62. // Define the customary << and >> operators.
  63. #define CL_DEFINE_PRINT_OPERATOR(_class_) \
  64. inline std::ostream& operator<< (std::ostream& stream, const _class_& x) \
  65. { \
  66. fprint(stream,x); \
  67. return stream; \
  68. }
  69. } // namespace cln
  70. #endif /* _CL_IO_H */