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