CONTEXT

A couple of context functions to catch errors and display them. More...

Classes

struct  _pcp_ctx_t
 PCP context object. More...
 

Functions

PCPCTXptx_new ()
 Create a new PCP Context. More...
 
void ptx_clean (PCPCTX *ptx)
 Frees the memory allocated by the context. More...
 
void fatal (PCPCTX *ptx, const char *fmt,...)
 Set an error message. More...
 
void fatals_ifany (PCPCTX *ptx)
 Prints error messages to STDERR, if there are some. More...
 
void fatals_reset (PCPCTX *ptx)
 Reset the error variables. More...
 

Detailed Description

A couple of context functions to catch errors and display them.

The context also holds the key hashes.

Function Documentation

void fatal ( PCPCTX ptx,
const char *  fmt,
  ... 
)

Set an error message.

This function gets a printf() like error message, which it stores in the global PCP_ERR variable and sets PCP_ERRSET to 1.

Parameters
[in]ptxPCP Context object.
[in]fmtprintf() like format description.
[in]...format parameters, if any.
void fatals_ifany ( PCPCTX ptx)

Prints error messages to STDERR, if there are some.

FIXME: add something like this which returns the message.

Parameters
[in]ptxPCP Context object.
void fatals_reset ( PCPCTX ptx)

Reset the error variables.

This can be used to ignore previous errors. Use with care.

Parameters
[in]ptxPCP Context object.
void ptx_clean ( PCPCTX ptx)

Frees the memory allocated by the context.

Parameters
[in]ptxPCP Context object.
PCPCTX* ptx_new ( )

Create a new PCP Context.

Sets all context pointers to NULL.

Returns
the context object.