File: cl_output.h

package info (click to toggle)
cln 0.98-7.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 12,188 kB
  • ctags: 15,282
  • sloc: cpp: 71,545; ansic: 12,015; asm: 8,431; sh: 3,159; makefile: 886; lisp: 64
file content (85 lines) | stat: -rw-r--r-- 2,874 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Output functions.

#ifndef _CL_OUTPUT_H
#define _CL_OUTPUT_H

#include "cl_number.h"
#include "cl_floatformat.h"
#include "cl_io.h"
#include "cl_string.h"

struct cl_print_rational_flags {
	// Base in which rational numbers are to be printed.
	unsigned int rational_base;
	// Flag whether to print radix specifiers in Common Lisp syntax for
	// rational numbers (#nR or #b or #o or #x prefixes, trailing dot).
	cl_boolean rational_readably;
// Constructor.
	cl_print_rational_flags () :
		rational_base (10),
		rational_readably (cl_false) {}
};

struct cl_print_float_flags {
	// Flag whether to prefer type specific exponent markers over 'E'.
	cl_boolean float_readably;
	// If !float_readably, the format which earns the 'E' exponent marker.
	cl_float_format_t default_float_format;
// Constructor.
	cl_print_float_flags () :
		float_readably (cl_false),
		default_float_format (cl_float_format_ffloat) {}
};

struct cl_print_real_flags : cl_print_rational_flags, cl_print_float_flags {};

struct cl_print_complex_flags {
	// Flag whether to use the Common Lisp #C(realpart imagpart) syntax,
	cl_boolean complex_readably;
// Constructor.
	cl_print_complex_flags () :
		complex_readably (cl_false) {}
};

struct cl_print_number_flags : cl_print_real_flags, cl_print_complex_flags {};

enum cl_print_vector_syntax_t {
	vsyntax_algebraic,	// [a, b, c]
	vsyntax_pretty,		// [a b c]
	vsyntax_commonlisp	// #(a b c)
};

struct cl_print_vector_flags {
	cl_print_vector_syntax_t vector_syntax;
// Constructor.
	cl_print_vector_flags () :
		vector_syntax (vsyntax_pretty) {}
};

struct cl_print_univpoly_flags {
	cl_string univpoly_varname;
// Constructor.
	cl_print_univpoly_flags () :
		univpoly_varname ("x") {}
};

struct cl_print_flags : cl_print_number_flags, cl_print_vector_flags, cl_print_univpoly_flags {};

extern cl_print_flags cl_default_print_flags;

// Gibt eine Zahl aus.
// print_number(stream,flags,z);
// > z: Zahl
// > stream: Stream
// > flags: Ausgabe-Parameter
extern void print_number (cl_ostream stream, const cl_print_flags& flags, const cl_number& z);
extern void print_number (cl_ostream stream, const cl_print_number_flags& flags, const cl_number& z);
extern void print_real (cl_ostream stream, const cl_print_flags& flags, const cl_R& z);
extern void print_real (cl_ostream stream, const cl_print_number_flags& flags, const cl_R& z);
extern void print_real (cl_ostream stream, const cl_print_real_flags& flags, const cl_R& z);
extern void print_rational (cl_ostream stream, const cl_print_flags& flags, const cl_RA& z);
extern void print_rational (cl_ostream stream, const cl_print_number_flags& flags, const cl_RA& z);
extern void print_rational (cl_ostream stream, const cl_print_real_flags& flags, const cl_RA& z);
extern void print_rational (cl_ostream stream, const cl_print_rational_flags& flags, const cl_RA& z);

#endif /* _CL_OUTPUT_H */