C-Pluff C API: Callback function types

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# Callback function types
[Typedefs]

## Detailed Description

Typedefs for client supplied callback functions.

## Typedefs
typedef void(*) | cp_plugin_listener_func_t (const char *plugin_id, cp_plugin_state_t old_state, cp_plugin_state_t new_state, void *user_data)
| A listener function called synchronously after a plugin state change.
typedef void(*) | cp_logger_func_t (cp_log_severity_t severity, const char *msg, const char *apid, void *user_data)
| A logger function called to log selected plug-in framework messages.
typedef void(*) | cp_fatal_error_func_t (const char *msg)
| A fatal error handler for handling unrecoverable errors.
typedef int(*) | cp_run_func_t (void *plugin_data)
| A run function registered by a plug-in to perform work.

## Typedef Documentation

typedef void(*) cp_plugin_listener_func_t(const char *plugin_id, cp_plugin_state_t old_state, cp_plugin_state_t new_state, void *user_data)

A listener function called synchronously after a plugin state change.

The function should return promptly. Library initialization, plug-in context management, plug-in management, listener registration (cp_register_plistener and cp_unregister_plistener) and dynamic symbol functions must not be called from within a plug-in listener invocation. Listener functions are registered using cp_register_plistener.

Parameters:

  | plugin_id | the plug-in identifier
  | old_state | the old plug-in state
  | new_state | the new plug-in state
  | user_data | the user data pointer supplied at listener registration

typedef void(*) cp_logger_func_t(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data)

A logger function called to log selected plug-in framework messages.

The messages may be localized. Plug-in framework API functions must not be called from within a logger function invocation. In a multi-threaded environment logger function invocations are serialized by the framework. Logger functions are registered using cp_register_logger.

Parameters:

  | severity | the severity of the message
  | msg | the message to be logged, possibly localized
  | apid | the identifier of the activating plug-in or NULL for the main program
  | user_data | the user data pointer given when the logger was registered

typedef void(*) cp_fatal_error_func_t(const char *msg)

A fatal error handler for handling unrecoverable errors.

If the error handler returns then the framework aborts the program. Plug-in framework API functions must not be called from within a fatal error handler invocation. The fatal error handler function is set using cp_set_fatal_error_handler.

Parameters:

  | msg | the possibly localized error message

typedef int(*) cp_run_func_t(void *plugin_data)

A run function registered by a plug-in to perform work.

The run function should perform a finite chunk of work and it should return a non-zero value if there is more work to be done. Run functions are registered using cp_run_function and the usage is discussed in more detail in the serial execution section.

Parameters:

  | plugin_data | the plug-in instance data pointer

Returns:
  non-zero if there is more work to be done or zero if finished

Generated on Fri Apr 6 15:40:55 2007 for C-Pluff C API by 1.5.1