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