index
Modularized Programming
MODULE NAME: module
typedef struct _module_handle_s /* module handler struct */
{
/* status enum, element type */
status_e (*init)(element_t a, element_t b);
/* ... (ohter module interface provided as function pointer) */
status_e (*fin)(element_t c, element_t d);
/* private data whitch would be point to module_data while initialize */
void *priv_data;
}
public:
/* functions would be called directly by other modules, etc */
module_create() /* may only do some function pointer assigning */
module_delete() /* may only do some function pointer dis-assigning */
private:
/* private functions would be used by function pointer */
/* implement own logic by call internal private functions */
module_init()
/* ... (other module interface) */
module_fin()
/* internal private functions */
process1()
process2()
/* ... (other processes) */