The "c" Package
These routines are meant to provide a general purpose callback management
framework. Library packages and applications may use this package to
implement their own callback mechanisms. This package removes the need for
external code to maintain and traverse callback lists.
Library: karma
Link With: -lkarma
Functions
Prototype Functions
Functions
KCallbackFunc
c_register_callback (KCallbackList *list, flag (*callback) (),
void *object,
void *client1_data, flag client1_indirect,
void *client2_data, flag client2_indirect,
flag quenchable)
This routine will register a function which should be called when
the callbacks for an object should be called. When the object is destroyed
a call should be made to c_destroy_list. The first callback registered
is the first one called. Multiple callback functions may be registered per
object.
Parameters:
- list :
A pointer to the callback list. This is changed. The initial value
must be NULL.
- callback :
The function to be called when the object callbacks are called.
The prototype function is C_PROTO_callback.
- object :
The object pointer passed to the callback. This may be NULL.
- client1_data :
The first client information pointer passed to the callback.
This may be NULL.
- client1_indirect :
If TRUE the callback is passed a pointer to the storage
containing client1_data, else client1_data is passed directly to
the callback.
- client2_data :
The second client information pointer passed to the callback
This may be NULL.
- client2_indirect :
If TRUE the callback is passed a pointer to the storage
containing client2_data, else client2_data is passed directly to
the callback.
- quenchable :
If TRUE then the routine is permitted to quench calls to the
following callbacks in the list.
Returns: A KCallbackFunc on success. On failure, the process aborts.
Multithreading Level: Unsafe
void
c_unregister_callback (KCallbackFunc callback)
Unregister a callback function.
Parameters:
- callback :
The callback function.
Returns: Nothing.
Multithreading Level: Unsafe
flag
c_call_callbacks (KCallbackList list, void *call_data)
Call all registered callbacks for an object.
Parameters:
- list :
The callback list.
- call_data :
The arbitrary call information pointer.
Returns: TRUE if one of the callbacks quenched the further delivery of
callbacks, else FALSE.
Multithreading Level: Unsafe
void
c_destroy_list (KCallbackList list)
This routine will unregister all callbacks in a callback list and
then destroys the list.
Parameters:
- list :
The callback list.
Returns: Nothing.
Multithreading Level: Unsafe
Prototype Functions
flag
C_PROTO_callback (void *object, void *client1_data, void *call_data,
void *client2_data)
This routine is called when object callbacks are called.
Parameters:
- object :
The object information pointer.
- client1_data :
The first client information pointer.
- call_data :
The call information pointer.
- client2_data :
The second client information pointer.
Returns: TRUE if further callbacks should not be called, else FALSE.
Multithreading Level: Unsafe
Contact: Richard Gooch
Web Development: Ariel Internet Services