libexplain  1.4.D001
Functions
libexplain/output.c File Reference
#include <libexplain/ac/assert.h>
#include <libexplain/ac/errno.h>
#include <libexplain/ac/stdlib.h>
#include <libexplain/output.h>
#include <libexplain/output/stderr.h>

Go to the source code of this file.

Functions

explain_output_texplain_output_new (const explain_output_vtable_t *vtable)
void explain_output_method_destructor (explain_output_t *op)
void explain_output_method_message (explain_output_t *op, const char *text)
void _exit (int)
void explain_output_method_exit (explain_output_t *op, int status)

Function Documentation

void _exit ( int  )

The explain_output_method_destructor function is used to destroy an output instance, when its lifetime is over, think of it as a class specific free() function. It is called by explain_output_register when a new output instance is given.

It is safe for op to be NULL. It is safe for op->vtable->destructor to be NULL.

Parameters:
opPointer to the explain_output_t instance to be operated on.

Definition at line 48 of file output.c.

void explain_output_method_exit ( explain_output_t op,
int  status 
)

The explain_output_method_exit function is used to terminate execution. Different "classes" handle this differently.

Parameters:
opPointer to the explain_output_t instance to be operated on.
statusThe exist status requested.

POSIX and the C standard both say that it should not call 'exit', because the behavior is undefined if 'exit' is called more than once. So we call '_exit' instead of 'exit'.

Definition at line 80 of file output.c.

void explain_output_method_message ( explain_output_t op,
const char *  text 
)

The explain_output_method_message function is used to print text. Different output "classes" handle this differently.

Parameters:
opPointer to the explain_output_t instance to be "printed" on.
textThe text of the message to be printed. It has not been wrapped.

Definition at line 62 of file output.c.

The explain_output_new function may be used to create a new dynamically allocated instance of explain_output_t.

Parameters:
vtableThe struct containing the pointers to the methods of the derived class.
Returns:
NULL on error (i.e. malloc failed), or a pointer to a new dynamically allocated instance of the class.

Definition at line 29 of file output.c.