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.

61 lines
1.9 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. // Input functions.
  2. #ifndef _CL_INPUT_H
  3. #define _CL_INPUT_H
  4. #include "cln/types.h"
  5. #include "cln/floatformat.h"
  6. #include "cln/io.h"
  7. namespace cln {
  8. struct cl_read_float_flags {
  9. // The float format used when reading floats with exponent marker 'E'.
  10. float_format_t default_float_format;
  11. // The float format used when reading floats with exponent marker 'L'.
  12. float_format_t default_lfloat_format;
  13. // Flag whether floats specified with more digits than corresponding
  14. // to the exponent marker they contain, but without _nnn suffix, will
  15. // get a precision corresponding to their number of significant digits.
  16. bool mantissa_dependent_float_format;
  17. };
  18. // Specifies the possible results of a read operation.
  19. enum cl_read_syntax_t {
  20. syntax_integer = 1 << 0, // -> cl_I
  21. syntax_ratio = 1 << 1, // -> cl_RA
  22. syntax_rational = syntax_integer | syntax_ratio, // -> cl_RA
  23. syntax_sfloat = 1 << 2, // -> cl_SF
  24. syntax_ffloat = 1 << 3, // -> cl_FF
  25. syntax_dfloat = 1 << 4, // -> cl_DF
  26. syntax_lfloat = 1 << 5, // -> cl_LF
  27. syntax_float = syntax_sfloat | syntax_ffloat | syntax_dfloat | syntax_lfloat,
  28. // -> cl_F
  29. syntax_real = syntax_rational | syntax_float, // -> cl_R
  30. syntax_complex = 1 << 6, // -> cl_N
  31. syntax_number = syntax_real | syntax_complex, // -> cl_N
  32. syntax_maybe_bad = 1 << 7 // avoid errors
  33. };
  34. // Specifies the syntax to be applied to a read operation.
  35. enum cl_read_lsyntax_t {
  36. // Standard algebraic notation.
  37. lsyntax_standard = 0,
  38. // Extended algebraic notation: x+yi
  39. lsyntax_algebraic = 1 << 0,
  40. // Common Lisp notation: #b, #o, #x, #r, #c
  41. lsyntax_commonlisp = 1 << 1,
  42. // All of them.
  43. lsyntax_all = lsyntax_algebraic | lsyntax_commonlisp
  44. };
  45. struct cl_read_flags {
  46. cl_read_syntax_t syntax;
  47. cl_read_lsyntax_t lsyntax;
  48. unsigned int rational_base;
  49. cl_read_float_flags float_flags;
  50. };
  51. } // namespace cln
  52. #endif /* _CL_INPUT_H */