Mercurial > MadButterfly
comparison include/mb_backend.h @ 1022:84006acab6af refine_backend_if
Use macros to hide the default backend
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 22 Nov 2010 15:20:11 +0800 |
parents | 1a3cc22ee1bd |
children | e9a134d75c99 |
comparison
equal
deleted
inserted
replaced
1021:4f4abce1b5df | 1022:84006acab6af |
---|---|
77 | 77 |
78 /* | 78 /* |
79 * Following two methods are used to integrate a backend to | 79 * Following two methods are used to integrate a backend to |
80 * event loop of main application. | 80 * event loop of main application. |
81 */ | 81 */ |
82 void (*reg_IO_factory)(mb_IO_factory_t *evman); | 82 void (*reg_IO_factory)(mb_IO_factory_t *io_man); |
83 void (*reg_timer_factory)(mb_timer_factory_t *evman); | 83 void (*reg_timer_factory)(mb_timer_factory_t *tm_man); |
84 } mb_backend_t; | 84 } mb_backend_t; |
85 | 85 |
86 extern mb_backend_t backend; | 86 #define mb_runtime_new(disp, w, h) \ |
87 mb_dfl_backend.new((disp), (w), (h)) | |
88 #define mb_runtime_new_with_win(disp, win) \ | |
89 mb_dfl_backend.new_with_win((disp), (win)) | |
90 #define mb_reg_IO_factory(io_man) \ | |
91 mb_dfl_backend.reg_IO_factory(io_man) | |
92 #define mb_reg_timer_factory(tm_man) \ | |
93 mb_dfl_backend.reg_timer_factory(tm_man) | |
94 | |
95 /* | |
96 * This is defined by backend implementations. For example, X_supp.c | |
97 * or dfb_supp.c should defined a backend. | |
98 */ | |
99 extern mb_backend_t mb_dfl_backend; | |
100 | |
101 #define mb_runtime_free(rt) \ | |
102 mb_dfl_backend.free(rt) | |
103 #define mb_runtime_free_with_win(rt) \ | |
104 mb_dfl_backend.free_with_win(rt) | |
105 #define mb_runtime_add_event(rt, fd, type, cb, arg) \ | |
106 mb_dfl_backend.add_event((rt), (fd), (type), (cb), (arg)) | |
107 #define mb_runtime_remove_event(hdl) \ | |
108 mb_dfl_backend.remove_event((rt), (hdl)) | |
109 #define mb_runtime_event_loop(rt) \ | |
110 mb_dfl_backend.event_loop(rt) | |
111 #define mb_runtime_flush(rt) \ | |
112 mb_dfl_backend.flush(rt) | |
113 #define mb_runtime_kbevents(rt) \ | |
114 mb_dfl_backend.kbevents(rt) | |
115 #define mb_runtime_rdman(rt) \ | |
116 mb_dfl_backend.rdman(rt) | |
117 #define mb_runtime_timer_man(rt) \ | |
118 mb_dfl_backend.timer_man(rt) | |
119 #define mb_runtime_ob_factory(rt) \ | |
120 mb_dfl_backend.ob_factory(rt) | |
121 #define mb_runtime_loader(rt) \ | |
122 mb_dfl_backend.loader(rt) | |
123 | |
87 | 124 |
88 /*! \brief Type of IO that registered with an IO manager. | 125 /*! \brief Type of IO that registered with an IO manager. |
89 */ | 126 */ |
90 enum _MB_IO_TYPE {MB_IO_DUMMY, MB_IO_R, MB_IO_W, MB_IO_RW}; | 127 enum _MB_IO_TYPE {MB_IO_DUMMY, MB_IO_R, MB_IO_W, MB_IO_RW}; |
91 | 128 |