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.

70 lines
1.8 KiB

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