src/msgprinter.c File Reference

#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "rdd.h"
#include "rdd_internals.h"
#include "msgprinter.h"

Include dependency graph for msgprinter.c:

Go to the source code of this file.

Data Structures

struct  _RDD_MSGPRINTER_POS

Typedefs

typedef struct _RDD_MSGPRINTER_POS RDD_MSGPRINTER_POS

Functions

static int mp_accept_message (RDD_MSGPRINTER *printer, rdd_message_t type)
static void mp_init (RDD_MSGPRINTER_POS *pos, RDD_MSGPRINTER *printer)
static void mp_printf (RDD_MSGPRINTER_POS *pos, const char *fmt,...)
static void mp_vprintf (RDD_MSGPRINTER_POS *pos, const char *fmt, va_list ap)
int rdd_mp_close (RDD_MSGPRINTER *printer, unsigned flags)
 Closes a printer instance.
uint32_t rdd_mp_get_mask (RDD_MSGPRINTER *printer)
 Retrieves a printer's current message mask.
void rdd_mp_message (RDD_MSGPRINTER *printer, rdd_message_t type, const char *fmt,...)
 Formats and prints a message.
int rdd_mp_open_printer (RDD_MSGPRINTER **printer, RDD_MSGPRINTER_OPS *ops, unsigned statesize)
 Allocates and partially initializes a new printer object.
void rdd_mp_print (RDD_MSGPRINTER *printer, rdd_message_t type, int errcode, const char *fmt,...)
 Formats and prints a message.
void rdd_mp_rddmsg (RDD_MSGPRINTER *printer, rdd_message_t type, int rdd_errno, const char *fmt,...)
 Formats and prints an RDD error message. The value of rdd_errno must be one of the values defined in rdd.h. This routine will append the error message that corresponds to rdd_errno to the user's message and print the resulting, concatenated message.
void rdd_mp_set_mask (RDD_MSGPRINTER *printer, uint32_t mask)
 Sets a printer's current message mask to value mask.
void rdd_mp_unixmsg (RDD_MSGPRINTER *printer, rdd_message_t type, int unix_errno, const char *fmt,...)
 Formats and prints a Unix error message. The value of unix_errno must be one of the values defined in <errno.h>. This routine will append the error message that corresponds to unix_errno to the user's message and print the resulting, concatenated message.
void rdd_mp_vmessage (RDD_MSGPRINTER *printer, rdd_message_t type, const char *fmt, va_list ap)
 Formats and prints a message for a varargs routine.
void rdd_mp_vrddmsg (RDD_MSGPRINTER *printer, rdd_message_t type, int rdd_errno, const char *fmt, va_list ap)
 Formats and prints an RDD error message. The value of rdd_errno must be one of the values defined in rdd.h. This routine will append the error message that corresponds to rdd_errno to the user's message and print the resulting, concatenated message.


Typedef Documentation


Function Documentation

static int mp_accept_message ( RDD_MSGPRINTER printer,
rdd_message_t  type 
) [static]

static void mp_init ( RDD_MSGPRINTER_POS pos,
RDD_MSGPRINTER printer 
) [static]

static void mp_printf ( RDD_MSGPRINTER_POS pos,
const char *  fmt,
  ... 
) [static]

Definition at line 176 of file msgprinter.c.

References mp_vprintf().

Here is the call graph for this function:

static void mp_vprintf ( RDD_MSGPRINTER_POS pos,
const char *  fmt,
va_list  ap 
) [static]

Definition at line 162 of file msgprinter.c.

References _RDD_MSGPRINTER_POS::buflen, and _RDD_MSGPRINTER_POS::msgbuf.

int rdd_mp_close ( RDD_MSGPRINTER printer,
unsigned  flags 
)

Closes a printer instance.

Definition at line 75 of file msgprinter.c.

References _RDD_MSGPRINTER_OPS::close, _RDD_MSGPRINTER::ops, RDD_OK, and _RDD_MSGPRINTER::state.

uint32_t rdd_mp_get_mask ( RDD_MSGPRINTER printer  ) 

Retrieves a printer's current message mask.

Definition at line 91 of file msgprinter.c.

References _RDD_MSGPRINTER::mask.

void rdd_mp_message ( RDD_MSGPRINTER printer,
rdd_message_t  type,
const char *  fmt,
  ... 
)

Formats and prints a message.

Definition at line 143 of file msgprinter.c.

References rdd_mp_vmessage().

Here is the call graph for this function:

int rdd_mp_open_printer ( RDD_MSGPRINTER **  printer,
RDD_MSGPRINTER_OPS ops,
unsigned  statesize 
)

Allocates and partially initializes a new printer object.

Parameters:
printer output value: a new printer object.
ops pointers to implementation-specific printer functions.
statesize size in bytes of implementation-specific state.
Returns:
Returns RDD_OK on success. Returns RDD_NOMEM when there is insufficient memory to allocate the writer object or its state buffer.
rdd_mp_open_printer() allocates a writer object and initializes its ops field to argument . The state field is set to point to a new buffer (allocated with malloc()) with size statesize. The state buffer is zeroed. The mask is set so that it allows all message types to be printed.

Definition at line 52 of file msgprinter.c.

References _RDD_MSGPRINTER::mask, _RDD_MSGPRINTER::ops, RDD_MSG_DEBUG, RDD_MSG_ERROR, RDD_MSG_INFO, RDD_MSG_WARN, RDD_NOMEM, RDD_OK, and _RDD_MSGPRINTER::state.

void rdd_mp_print ( RDD_MSGPRINTER printer,
rdd_message_t  type,
int  errcode,
const char *  fmt,
  ... 
)

Formats and prints a message.

Definition at line 115 of file msgprinter.c.

References mp_accept_message(), _RDD_MSGPRINTER::ops, _RDD_MSGPRINTER_OPS::print, and _RDD_MSGPRINTER::printbuf.

Here is the call graph for this function:

void rdd_mp_rddmsg ( RDD_MSGPRINTER printer,
rdd_message_t  type,
int  rdd_errno,
const char *  fmt,
  ... 
)

Formats and prints an RDD error message. The value of rdd_errno must be one of the values defined in rdd.h. This routine will append the error message that corresponds to rdd_errno to the user's message and print the resulting, concatenated message.

Definition at line 223 of file msgprinter.c.

References rdd_mp_vrddmsg().

Here is the call graph for this function:

void rdd_mp_set_mask ( RDD_MSGPRINTER printer,
uint32_t  mask 
)

Sets a printer's current message mask to value mask.

Definition at line 97 of file msgprinter.c.

References _RDD_MSGPRINTER::mask.

void rdd_mp_unixmsg ( RDD_MSGPRINTER printer,
rdd_message_t  type,
int  unix_errno,
const char *  fmt,
  ... 
)

Formats and prints a Unix error message. The value of unix_errno must be one of the values defined in <errno.h>. This routine will append the error message that corresponds to unix_errno to the user's message and print the resulting, concatenated message.

Definition at line 186 of file msgprinter.c.

References mp_accept_message(), mp_init(), mp_printf(), mp_vprintf(), _RDD_MSGPRINTER::ops, _RDD_MSGPRINTER_OPS::print, and _RDD_MSGPRINTER::printbuf.

Here is the call graph for this function:

void rdd_mp_vmessage ( RDD_MSGPRINTER printer,
rdd_message_t  type,
const char *  fmt,
va_list  ap 
)

Formats and prints a message for a varargs routine.

Definition at line 131 of file msgprinter.c.

References mp_accept_message(), _RDD_MSGPRINTER::ops, _RDD_MSGPRINTER_OPS::print, and _RDD_MSGPRINTER::printbuf.

Here is the call graph for this function:

void rdd_mp_vrddmsg ( RDD_MSGPRINTER printer,
rdd_message_t  type,
int  rdd_errno,
const char *  fmt,
va_list  ap 
)

Formats and prints an RDD error message. The value of rdd_errno must be one of the values defined in rdd.h. This routine will append the error message that corresponds to rdd_errno to the user's message and print the resulting, concatenated message.

Definition at line 204 of file msgprinter.c.

References mp_accept_message(), mp_init(), mp_printf(), mp_vprintf(), _RDD_MSGPRINTER::ops, _RDD_MSGPRINTER_OPS::print, _RDD_MSGPRINTER::printbuf, RDD_OK, and rdd_strerror().

Here is the call graph for this function:


Generated on Sun Feb 6 12:36:15 2011 for rdd by  doxygen 1.5.6