7 #include <dynamicbox_errno.h>
12 int script_buffer_load(void *handle)
14 static int (*load)(void *handle) = NULL;
16 load = dlsym(RTLD_DEFAULT, "buffer_handler_load");
18 ErrPrint("broken ABI: %s\n", dlerror());
19 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
26 int script_buffer_unload(void *handle)
28 static int (*unload)(void *handle) = NULL;
31 unload = dlsym(RTLD_DEFAULT, "buffer_handler_unload");
33 ErrPrint("broken ABI: %s\n", dlerror());
34 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
38 return unload(handle);
41 int script_buffer_is_loaded(const void *handle)
43 static int (*is_loaded)(const void *handle) = NULL;
46 is_loaded = dlsym(RTLD_DEFAULT, "buffer_handler_is_loaded");
48 ErrPrint("broken ABI: %s\n", dlerror());
49 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
53 return is_loaded(handle);
56 int script_buffer_resize(void *handle, int w, int h)
58 static int (*resize)(void *handle, int w, int h) = NULL;
61 resize = dlsym(RTLD_DEFAULT, "buffer_handler_resize");
63 ErrPrint("broken ABI: %s\n", dlerror());
64 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
68 return resize(handle, w, h);
71 void script_buffer_update_size(void *handle, int w, int h)
73 static void (*update_size)(void *handle, int w, int h) = NULL;
76 update_size = dlsym(RTLD_DEFAULT, "buffer_handler_update_size");
78 ErrPrint("broken ABI: %s\n", dlerror());
83 return update_size(handle, w, h); /*! "void" function can be used with "return" statement */
86 const char *script_buffer_id(const void *handle)
88 static const char *(*buffer_id)(const void *handle) = NULL;
91 buffer_id = dlsym(RTLD_DEFAULT, "buffer_handler_id");
93 ErrPrint("broken ABI: %s\n", dlerror());
98 return buffer_id(handle);
101 enum buffer_type script_buffer_type(const void *handle)
103 static enum buffer_type (*buffer_type)(const void *handle) = NULL;
106 buffer_type = dlsym(RTLD_DEFAULT, "buffer_handler_type");
108 ErrPrint("broken ABI: %s\n", dlerror());
109 return BUFFER_TYPE_ERROR;
113 return buffer_type(handle);
116 int script_buffer_pixmap(const void *handle)
118 static int (*buffer_pixmap)(const void *handle) = NULL;
120 if (!buffer_pixmap) {
121 buffer_pixmap = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap");
122 if (!buffer_pixmap) {
123 ErrPrint("broken ABI: %s\n", dlerror());
124 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
128 return buffer_pixmap(handle);
131 void *script_buffer_pixmap_acquire_buffer(void *handle)
133 static void *(*pixmap_acquire_buffer)(void *handle) = NULL;
135 if (!pixmap_acquire_buffer) {
136 pixmap_acquire_buffer = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_acquire_buffer");
137 if (!pixmap_acquire_buffer) {
138 ErrPrint("broken ABI: %s\n", dlerror());
143 return pixmap_acquire_buffer(handle);
146 int script_buffer_pixmap_release_buffer(void *canvas)
148 static int (*pixmap_release_buffer)(void *canvas) = NULL;
150 if (!pixmap_release_buffer) {
151 pixmap_release_buffer = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_release_buffer");
152 if (!pixmap_release_buffer) {
153 ErrPrint("broekn ABI: %s\n", dlerror());
154 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
158 return pixmap_release_buffer(canvas);
161 void *script_buffer_pixmap_ref(void *handle)
163 static void *(*pixmap_ref)(void *handle) = NULL;
166 pixmap_ref = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_ref");
168 ErrPrint("broken ABI: %s\n", dlerror());
173 return pixmap_ref(handle);
176 int script_buffer_pixmap_unref(void *buffer_ptr)
178 static int (*pixmap_unref)(void *ptr) = NULL;
181 pixmap_unref = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_unref");
183 ErrPrint("broken ABI: %s\n", dlerror());
184 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
188 return pixmap_unref(buffer_ptr);
191 void *script_buffer_pixmap_find(int pixmap)
193 static void *(*pixmap_find)(int pixmap) = NULL;
196 pixmap_find = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_find");
198 ErrPrint("broken ABI: %s\n", dlerror());
203 return pixmap_find(pixmap);
206 void *script_buffer_pixmap_buffer(void *handle)
208 static void *(*pixmap_buffer)(void *handle) = NULL;
210 if (!pixmap_buffer) {
211 pixmap_buffer = dlsym(RTLD_DEFAULT, "buffer_handler_pixmap_buffer");
212 if (!pixmap_buffer) {
213 ErrPrint("broken ABI: %s\n", dlerror());
218 return pixmap_buffer(handle);
221 void *script_buffer_fb(void *handle)
223 static void *(*buffer_fb)(void *handle) = NULL;
226 buffer_fb = dlsym(RTLD_DEFAULT, "buffer_handler_fb");
228 ErrPrint("broken ABI: %s\n", dlerror());
233 return buffer_fb(handle);
236 int script_buffer_get_size(void *handle, int *w, int *h)
238 static int (*get_size)(void *handle, int *w, int *h) = NULL;
241 get_size = dlsym(RTLD_DEFAULT, "buffer_handler_get_size");
243 ErrPrint("broken ABI: %s\n", dlerror());
244 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
248 return get_size(handle, w, h);
251 void script_buffer_flush(void *handle)
253 static void (*buffer_flush)(void *handle) = NULL;
256 buffer_flush = dlsym(RTLD_DEFAULT, "buffer_handler_flush");
258 ErrPrint("broken ABI: %s\n", dlerror());
263 return buffer_flush(handle); /* "void" function can be used to return from this function ;) */
266 void *script_buffer_instance(void *handle)
268 static void *(*buffer_instance)(void *handle) = NULL;
270 if (!buffer_instance) {
271 buffer_instance = dlsym(RTLD_DEFAULT, "buffer_handler_instance");
272 if (!buffer_instance) {
273 ErrPrint("broken ABI: %s\n", dlerror());
278 return buffer_instance(handle);
281 void *script_buffer_raw_open(enum buffer_type type, void *resource)
283 static void *(*raw_open)(enum buffer_type type, void *resource) = NULL;
286 raw_open = dlsym(RTLD_DEFAULT, "buffer_handler_raw_open");
288 ErrPrint("broken ABI: %s\n", dlerror());
293 return raw_open(type, resource);
296 int script_buffer_raw_close(void *buffer)
298 static int (*raw_close)(void *buffer) = NULL;
301 raw_close = dlsym(RTLD_DEFAULT, "buffer_handler_raw_close");
303 ErrPrint("broken ABI: %s\n", dlerror());
304 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
308 return raw_close(buffer);
311 void *script_buffer_raw_data(void *buffer)
313 static void *(*raw_data)(void *buffer) = NULL;
316 raw_data = dlsym(RTLD_DEFAULT, "buffer_handler_raw_data");
318 ErrPrint("broken ABI: %s\n", dlerror());
323 return raw_data(buffer);
326 int script_buffer_raw_size(void *buffer)
328 static int (*raw_size)(void *buffer) = NULL;
331 raw_size = dlsym(RTLD_DEFAULT, "buffer_handler_raw_size");
333 ErrPrint("broken ABI: %s\n", dlerror());
334 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
338 return raw_size(buffer);
341 int script_buffer_lock(void *handle)
343 static int (*buffer_lock)(void *handle) = NULL;
346 buffer_lock = dlsym(RTLD_DEFAULT, "buffer_handler_lock");
348 ErrPrint("broken ABI: %s\n", dlerror());
349 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
353 return buffer_lock(handle);
356 int script_buffer_unlock(void *handle)
358 static int (*buffer_unlock)(void *handle) = NULL;
360 if (!buffer_unlock) {
361 buffer_unlock = dlsym(RTLD_DEFAULT, "buffer_handler_unlock");
362 if (!buffer_unlock) {
363 ErrPrint("broken ABI: %s\n", dlerror());
364 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
368 return buffer_unlock(handle);
371 int script_buffer_signal_emit(void *buffer_handle, const char *part, const char *signal, double x, double y, double ex, double ey)
373 static int (*signal_emit)(void *buffer_handle, const char *part, const char *signal, double x, double y, double ex, double ey) = NULL;
376 signal_emit = dlsym(RTLD_DEFAULT, "script_signal_emit");
378 ErrPrint("broken ABI: %s\n", dlerror());
379 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
383 return signal_emit(buffer_handle, part, signal, x, y, ex, ey);
386 int script_buffer_stride(void *handle)
388 static int (*buffer_stride)(void *handle) = NULL;
390 if (!buffer_stride) {
391 buffer_stride = dlsym(RTLD_DEFAULT, "buffer_handler_stride");
392 if (!buffer_stride) {
393 ErrPrint("broken ABI: %s\n", dlerror());
394 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
398 return buffer_stride(handle);
401 int script_buffer_auto_align(void)
403 static int (*buffer_auto_align)(void) = NULL;
405 if (!buffer_auto_align) {
406 buffer_auto_align = dlsym(RTLD_DEFAULT, "buffer_handler_auto_align");
407 if (!buffer_auto_align) {
408 ErrPrint("borken ABI: %s\n", dlerror());
409 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
413 return buffer_auto_align();
416 int script_buffer_pixels(void *handle)
418 static int (*buffer_pixels)(void *handle) = NULL;
420 if (!buffer_pixels) {
421 buffer_pixels = dlsym(RTLD_DEFAULT, "buffer_handler_pixels");
422 if (!buffer_pixels) {
423 ErrPrint("broken ABI: %s\n", dlerror());
424 return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
428 return buffer_pixels(handle);