manpagez: man pages & more
info cln
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.3 Output functions

Including <cln/io.h> defines a number of simple output functions that write to std::ostream&:

void fprintchar (std::ostream& stream, char c)

Prints the character x literally on the stream.

void fprint (std::ostream& stream, const char * string)

Prints the string literally on the stream.

void fprintdecimal (std::ostream& stream, int x)
void fprintdecimal (std::ostream& stream, const cl_I& x)

Prints the integer x in decimal on the stream.

void fprintbinary (std::ostream& stream, const cl_I& x)

Prints the integer x in binary (base 2, without prefix) on the stream.

void fprintoctal (std::ostream& stream, const cl_I& x)

Prints the integer x in octal (base 8, without prefix) on the stream.

void fprinthexadecimal (std::ostream& stream, const cl_I& x)

Prints the integer x in hexadecimal (base 16, without prefix) on the stream.

Each of the classes cl_N, cl_R, cl_RA, cl_I, cl_F, cl_SF, cl_FF, cl_DF, cl_LF defines, in <cln/type_io.h>, the following output functions:

void fprint (std::ostream& stream, const type& x)
std::ostream& operator<< (std::ostream& stream, const type& x)

Prints the number x on the stream. The output may depend on the global printer settings in the variable default_print_flags. The ostream flags and settings (flags, width and locale) are ignored.

The most flexible output function, defined in <cln/type_io.h>, are the following:

void print_complex  (std::ostream& stream, const cl_print_flags& flags,
                     const cl_N& z);
void print_real     (std::ostream& stream, const cl_print_flags& flags,
                     const cl_R& z);
void print_float    (std::ostream& stream, const cl_print_flags& flags,
                     const cl_F& z);
void print_rational (std::ostream& stream, const cl_print_flags& flags,
                     const cl_RA& z);
void print_integer  (std::ostream& stream, const cl_print_flags& flags,
                     const cl_I& z);

Prints the number x on the stream. The flags are parameters which affect the output.

The structure type cl_print_flags contains the following fields:

unsigned int rational_base

The base in which rational numbers are printed. Default is 10.

bool rational_readably

If this flag is true, rational numbers are printed with radix specifiers in Common Lisp syntax (#nR or #b or #o or #x prefixes, trailing dot). Default is false.

bool float_readably

If this flag is true, type specific exponent markers have precedence over ’E’. Default is false.

float_format_t default_float_format

Floating point numbers of this format will be printed using the ’E’ exponent marker. Default is float_format_ffloat.

bool complex_readably

If this flag is true, complex numbers will be printed using the Common Lisp syntax #C(realpart imagpart). Default is false.

cl_string univpoly_varname

Univariate polynomials with no explicit indeterminate name will be printed using this variable name. Default is "x".

The global variable default_print_flags contains the default values, used by the function fprint.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on August 27, 2013 using texi2html 5.0.

© manpagez.com 2000-2017
Individual documents may contain additional copyright information.