C-Munipack 1.2 / Application programming interface / API reference

Console related functions.

cmpack_console.h

Enumerations

CmpackOutputLevelVerbosity level.

Type definitions

CmpackCallbackTypeCallback procedure.
CmpackConsoleConsole context.

Functions

cmpack_con_initCreate a new console context that prints all output to stderr stream.
cmpack_con_init_cbCreate a new console context that uses a user-defined function to print messages.
cmpack_con_set_levelSet the debug level.

Description

C-Munipack functions use a console as an output device for output and debug messages. By default, all messages are thrown away. If you want to print them to standard error stream or process them in a user defined callback, make a console and attach it to an object using cmpack_*_set_console function.

CmpackCallbackType (data type)

Callback procedure.

Synopsis

typedef void CmpackCallbackType(const char *text, void *user_data)

Description

Prototype for custom callback procedures. The procedure receives the pointer to message string. It points to internal memory buffer, the callee must not free or modify it. The second parameter contains callback registration data.

CmpackConsole (data type)

Console context.

Synopsis

typedef struct _CmpackConsole CmpackConsole

Description

This private structure holds the console parameters

CmpackOutputLevel (enumeration)

Verbosity level.

Synopsis

enum CmpackOutputLevel
{
     CMPACK_LEVEL_QUIET,
     CMPACK_LEVEL_NORMAL,
     CMPACK_LEVEL_DEBUG
};

Enumerators

CMPACK_LEVEL_QUIETBe quiet, suppress all messages.
CMPACK_LEVEL_NORMALPrint messages, suppress debug output (default).
CMPACK_LEVEL_DEBUGBe verbose, print all messages including debug ones.

cmpack_con_init (function)

Create a new console context that prints all output to stderr stream.

Synopsis

CmpackConsole * cmpack_con_init (void)

Return value

pointer to context of zero if failed

cmpack_con_init_cb (function)

Create a new console context that uses a user-defined function to print messages.

Synopsis

CmpackConsole * cmpack_con_init_cb (CmpackCallbackType * cbproc, void * cbdata)

Return value

pointer to context of zero if failed

cmpack_con_set_level (function)

Set the debug level.

Synopsis

void cmpack_con_set_level (CmpackConsole * ctx, CmpackOutputLevel level)

Parameters

ctx[in] any context
level[in] verbosity level (see CMPACK_LEVEL_xxx constants)