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.

74 lines
1.9 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. // Output functions.
  2. #ifndef _CL_OUTPUT_H
  3. #define _CL_OUTPUT_H
  4. #include "cln/types.h"
  5. #include "cln/floatformat.h"
  6. #include "cln/io.h"
  7. #include "cln/string.h"
  8. namespace cln {
  9. struct cl_print_rational_flags {
  10. // Base in which rational numbers are to be printed.
  11. unsigned int rational_base;
  12. // Flag whether to print radix specifiers in Common Lisp syntax for
  13. // rational numbers (#nR or #b or #o or #x prefixes, trailing dot).
  14. cl_boolean rational_readably;
  15. // Constructor.
  16. cl_print_rational_flags () :
  17. rational_base (10),
  18. rational_readably (cl_false) {}
  19. };
  20. struct cl_print_float_flags {
  21. // Flag whether to prefer type specific exponent markers over 'E'.
  22. cl_boolean float_readably;
  23. // If !float_readably, the format which earns the 'E' exponent marker.
  24. float_format_t default_float_format;
  25. // Constructor.
  26. cl_print_float_flags () :
  27. float_readably (cl_false),
  28. default_float_format (float_format_ffloat) {}
  29. };
  30. struct cl_print_real_flags : cl_print_rational_flags, cl_print_float_flags {};
  31. struct cl_print_complex_flags {
  32. // Flag whether to use the Common Lisp #C(realpart imagpart) syntax,
  33. cl_boolean complex_readably;
  34. // Constructor.
  35. cl_print_complex_flags () :
  36. complex_readably (cl_false) {}
  37. };
  38. struct cl_print_number_flags : cl_print_real_flags, cl_print_complex_flags {};
  39. enum cl_print_vector_syntax_t {
  40. vsyntax_algebraic, // [a, b, c]
  41. vsyntax_pretty, // [a b c]
  42. vsyntax_commonlisp // #(a b c)
  43. };
  44. struct cl_print_vector_flags {
  45. cl_print_vector_syntax_t vector_syntax;
  46. // Constructor.
  47. cl_print_vector_flags () :
  48. vector_syntax (vsyntax_pretty) {}
  49. };
  50. struct cl_print_univpoly_flags {
  51. cl_string univpoly_varname;
  52. // Constructor.
  53. cl_print_univpoly_flags () :
  54. univpoly_varname ("x") {}
  55. };
  56. struct cl_print_flags : cl_print_number_flags, cl_print_vector_flags, cl_print_univpoly_flags {};
  57. extern cl_print_flags default_print_flags;
  58. } // namespace cln
  59. #endif /* _CL_OUTPUT_H */