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.

57 lines
1.8 KiB

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