ScummVM API documentation
Text console

Description

Output formatter, typically used for debugging.

Typedefs

typedef void(* Common::OutputFormatter) (char *dst, const char *src, size_t dstSize)
 
typedef bool(* Common::ErrorHandler) (const char *msg)
 

Functions

void Common::setErrorOutputFormatter (OutputFormatter f)
 
void Common::setErrorHandler (ErrorHandler handler)
 
void NORETURN_PRE error (MSVC_PRINTF const char *s,...) GCC_PRINTF(1
 
void warning (MSVC_PRINTF const char *s,...) GCC_PRINTF(1
 

Variables

void NORETURN_PRE NORETURN_POST
 

Typedef Documentation

◆ OutputFormatter

typedef void(* Common::OutputFormatter) (char *dst, const char *src, size_t dstSize)

An output formatter takes a source string and 'decorates' it with extra information, storing the result in a destination buffer.

A typical use is to (optionally) enhance the output given by the error() and debug() functions with extra information on the state of the active engine.

◆ ErrorHandler

typedef bool(* Common::ErrorHandler) (const char *msg)

A callback that is invoked by error() just before aborting.

A typical example would be a function that shows a debug console and displays the given message in it.

Function Documentation

◆ setErrorOutputFormatter()

void Common::setErrorOutputFormatter ( OutputFormatter  f)

Set the output formatter used by error().

◆ setErrorHandler()

void Common::setErrorHandler ( ErrorHandler  handler)

Set a callback that is invoked by error() after the error message has been printed, but before the application is terminated.

This can be used to e.g. show a debugger console.

◆ error()

void NORETURN_PRE error ( MSVC_PRINTF const char *  s,
  ... 
)

Print an error message to the text console and then terminate the process.

◆ warning()

void warning ( MSVC_PRINTF const char *  s,
  ... 
)

Print a warning message to the text console (stderr).

Automatically prepends the text "WARNING: " and appends an exclamation mark and a newline.