Macaulay2 Engine
Loading...
Searching...
No Matches
text-io.hpp File Reference

Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit. More...

#include "buffer.hpp"
#include "engine-includes.hpp"

Go to the source code of this file.

Macros

#define wrapping_prefix   " -- "

Functions

int i_text_io ()
void bignum_text_out (buffer &o, mpz_srcptr a)
void clear_emit_size ()
void emit_wrapped (const char *s)
void emit_wrapped (int prlevel, const char *s)
void emit (const char *s)
void emit_line (const char *s)

Detailed Description

Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.

Note
AI-generated documentation. Verify against the source before relying on it.

Provides the engine-wide text utilities every output path reaches for. bignum_text_out(buffer&, mpz_srcptr) renders an mpz_t integer with M2's display conventions (no thousands separator, leading minus for negatives, no leading plus). emit_wrapped(s) prints to stdout with continuation lines prefixed by the wrapping_prefix macro " -- " so long output stays visually unambiguous; the (prlevel, s) overload checks M2_gbTrace >= prlevel first to gate tracing output behind the global verbosity dial. emit(s) and emit_line(s) are the simpler variants for unconditional diagnostic messages; despite the in-source header comment "print onto stderr, or cerr", the implementation in text-io.cpp actually writes to stdout via fputs / putchar + fflush(stdout), so all three emit* functions share the same stream.

Pair with buffer.hpp for the underlying append-only text accumulator. The i_text_io() initialiser hooks up the column / wrap-width bookkeeping at startup, and clear_emit_size() resets the current column so the next emit_wrapped call starts wrapping from a known position.

See also
buffer.hpp

Definition in file text-io.hpp.