source: libcaca/trunk/caca-php/php_caca.c @ 3107

Last change on this file since 3107 was 3107, checked in by nico, 11 years ago
  • Add php bindings for functions: caca_draw_line & caca_draw_thin_line
  • Create a new sample file demo.php (php port of demo.c)
File size: 29.0 KB
Line 
1/*
2 *  php-caca      Php binding for Libcaca
3 *  Copyright (c) 2008 Vion Nicolas <nico@picapo.net>
4 *
5 *
6 *  This library is free software. It comes without any warranty, to
7 *  the extent permitted by applicable law. You can redistribute it
8 *  and/or modify it under the terms of the Do What The Fuck You Want
9 *  To Public License, Version 2, as published by Sam Hocevar. See
10 *  http://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12
13#ifdef HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include "php.h"
18#include "php_caca.h"
19
20static function_entry caca_functions[] = {
21        PHP_FE(caca_create_canvas, NULL)
22        PHP_FE(caca_manage_canvas, NULL)
23        PHP_FE(caca_unmanage_canvas, NULL)
24        PHP_FE(caca_set_canvas_size, NULL)
25        PHP_FE(caca_get_canvas_width, NULL)
26        PHP_FE(caca_get_canvas_height, NULL)
27        PHP_FE(caca_get_canvas_chars, NULL)
28        PHP_FE(caca_get_canvas_attrs, NULL)
29        PHP_FE(caca_rand, NULL)
30        PHP_FE(caca_get_version, NULL)
31        PHP_FE(caca_gotoxy, NULL)
32        PHP_FE(caca_get_cursor_x, NULL)
33        PHP_FE(caca_get_cursor_y, NULL)
34        PHP_FE(caca_put_char, NULL)
35        PHP_FE(caca_get_char, NULL)
36        PHP_FE(caca_put_str, NULL)
37        PHP_FE(caca_printf, NULL)
38        PHP_FE(caca_clear_canvas, NULL)
39        PHP_FE(caca_set_canvas_handle, NULL)
40        PHP_FE(caca_get_canvas_handle_x, NULL)
41        PHP_FE(caca_get_canvas_handle_y, NULL)
42        PHP_FE(caca_blit, NULL)
43        PHP_FE(caca_set_canvas_boundaries, NULL)
44        PHP_FE(caca_invert, NULL)
45        PHP_FE(caca_flip, NULL)
46        PHP_FE(caca_flop, NULL)
47        PHP_FE(caca_rotate_left, NULL)
48        PHP_FE(caca_rotate_right, NULL)
49        PHP_FE(caca_stretch_left, NULL)
50        PHP_FE(caca_stretch_right, NULL)
51        PHP_FE(caca_get_attr, NULL)
52        PHP_FE(caca_set_attr, NULL)
53        PHP_FE(caca_put_attr, NULL)
54        PHP_FE(caca_set_color_ansi, NULL)
55        PHP_FE(caca_set_color_argb, NULL)
56        PHP_FE(caca_attr_to_ansi, NULL)
57        PHP_FE(caca_attr_to_ansi_fg, NULL)
58        PHP_FE(caca_attr_to_ansi_bg, NULL)
59        PHP_FE(caca_draw_line, NULL)
60        PHP_FE(caca_draw_polyline, NULL)
61        PHP_FE(caca_draw_thin_line, NULL)
62        PHP_FE(caca_draw_thin_polyline, NULL)
63        PHP_FE(caca_draw_circle, NULL)
64        PHP_FE(caca_draw_ellipse, NULL)
65        PHP_FE(caca_draw_thin_ellipse, NULL)
66        PHP_FE(caca_fill_ellipse, NULL)
67        PHP_FE(caca_draw_box, NULL)
68        PHP_FE(caca_draw_thin_box, NULL)
69        PHP_FE(caca_fill_box, NULL)
70        PHP_FE(caca_draw_triangle, NULL)
71        PHP_FE(caca_draw_thin_triangle, NULL)
72        PHP_FE(caca_fill_triangle, NULL)
73        PHP_FE(caca_get_frame_count, NULL)
74        PHP_FE(caca_set_frame, NULL)
75        PHP_FE(caca_set_frame_name, NULL)
76        PHP_FE(caca_create_frame, NULL)
77        PHP_FE(caca_free_frame, NULL)
78        PHP_FE(caca_set_dither_palette, NULL)
79        PHP_FE(caca_set_dither_brightness, NULL)
80        PHP_FE(caca_get_dither_brightness, NULL)
81        PHP_FE(caca_set_dither_gamma, NULL)
82        PHP_FE(caca_get_dither_gamma, NULL)
83        PHP_FE(caca_set_dither_contrast, NULL)
84        PHP_FE(caca_get_dither_contrast, NULL)
85        PHP_FE(caca_set_dither_antialias, NULL)
86        PHP_FE(caca_get_dither_antialias_list, NULL)
87        PHP_FE(caca_get_dither_antialias, NULL)
88        PHP_FE(caca_set_dither_color, NULL)
89        PHP_FE(caca_get_dither_color_list, NULL)
90        PHP_FE(caca_get_dither_color, NULL)
91        PHP_FE(caca_set_dither_charset, NULL)
92        PHP_FE(caca_get_dither_charset_list, NULL)
93        PHP_FE(caca_get_dither_charset, NULL)
94        PHP_FE(caca_set_dither_algorithm, NULL)
95        PHP_FE(caca_get_dither_algorithm_list, NULL)
96        PHP_FE(caca_get_dither_algorithm, NULL)
97        PHP_FE(caca_dither_bitmap, NULL)
98        PHP_FE(caca_get_font_list, NULL)
99        PHP_FE(caca_get_font_width, NULL)
100        PHP_FE(caca_get_font_height, NULL)
101        PHP_FE(caca_render_canvas, NULL)
102        PHP_FE(caca_canvas_set_figfont, NULL)
103        PHP_FE(caca_put_figchar, NULL)
104        PHP_FE(caca_flush_figlet, NULL)
105        PHP_FE(caca_file_close, NULL)
106        PHP_FE(caca_file_tell, NULL)
107        PHP_FE(caca_file_read, NULL)
108        PHP_FE(caca_file_write, NULL)
109        PHP_FE(caca_file_gets, NULL)
110        PHP_FE(caca_file_eof, NULL)
111        PHP_FE(caca_import_memory, NULL)
112        PHP_FE(caca_import_file, NULL)
113        PHP_FE(caca_get_import_list, NULL)
114        PHP_FE(caca_get_export_list, NULL)
115        PHP_FE(caca_create_display, NULL)
116        PHP_FE(caca_create_display_with_driver, NULL)
117        PHP_FE(caca_get_display_driver_list, NULL)
118        PHP_FE(caca_get_display_driver, NULL)
119        PHP_FE(caca_set_display_driver, NULL)
120        PHP_FE(caca_get_canvas, NULL)
121        PHP_FE(caca_refresh_display, NULL)
122        PHP_FE(caca_set_display_time, NULL)
123        PHP_FE(caca_get_display_time, NULL)
124        PHP_FE(caca_get_display_width, NULL)
125        PHP_FE(caca_get_display_height, NULL)
126        PHP_FE(caca_set_display_title, NULL)
127        PHP_FE(caca_set_mouse, NULL)
128        PHP_FE(caca_set_cursor, NULL)
129        PHP_FE(caca_get_event, NULL)
130        PHP_FE(caca_get_mouse_x, NULL)
131        PHP_FE(caca_get_mouse_y, NULL)
132        PHP_FE(caca_get_event_type, NULL)
133        PHP_FE(caca_get_event_key_ch, NULL)
134        PHP_FE(caca_get_event_mouse_button, NULL)
135        PHP_FE(caca_get_event_mouse_x, NULL)
136        PHP_FE(caca_get_event_mouse_y, NULL)
137        PHP_FE(caca_get_event_resize_width, NULL)
138        PHP_FE(caca_get_event_resize_height, NULL)
139
140        {NULL, NULL, NULL}
141};
142
143zend_module_entry caca_module_entry = {
144#if ZEND_MODULE_API_NO >= 20010901
145        STANDARD_MODULE_HEADER,
146#endif
147        PHP_CACA_EXTNAME,
148        caca_functions,
149        PHP_MINIT(caca),
150        NULL,
151        NULL,
152        NULL,
153        PHP_MINFO(caca),
154#if ZEND_MODULE_API_NO >= 20010901
155        PHP_CACA_VERSION,
156#endif
157        STANDARD_MODULE_PROPERTIES
158};
159
160#ifdef COMPILE_DL_CACA
161ZEND_GET_MODULE(caca)
162#endif
163
164PHP_MINFO_FUNCTION(caca) {
165        php_info_print_table_start();
166        php_info_print_table_row(2, "Caca library version", caca_get_version());
167        php_info_print_table_end();
168}
169
170//--------CACA'S RESSOURCES DESTRUCTORS-----------//
171
172static void php_caca_canvas_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
173        caca_free_canvas(rsrc->ptr);
174}
175
176static void php_caca_dither_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
177        caca_free_dither(rsrc->ptr);
178}
179
180static void php_caca_font_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
181        caca_free_font(rsrc->ptr);
182}
183
184static void php_caca_file_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
185}
186
187static void php_caca_display_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
188        caca_free_display(rsrc->ptr);
189}
190
191static void php_caca_event_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
192}
193
194//--------INITIALIZATION---------//
195
196PHP_MINIT_FUNCTION(caca) {
197
198        le_caca_canvas = zend_register_list_destructors_ex(php_caca_canvas_dtor, NULL, PHP_CACA_CANVAS_RES_NAME, module_number);
199        le_caca_dither = zend_register_list_destructors_ex(php_caca_dither_dtor, NULL, PHP_CACA_DITHER_RES_NAME, module_number);
200        le_caca_font = zend_register_list_destructors_ex(php_caca_font_dtor, NULL, PHP_CACA_FONT_RES_NAME, module_number);
201        le_caca_file = zend_register_list_destructors_ex(php_caca_file_dtor, NULL, PHP_CACA_FILE_RES_NAME, module_number);
202        le_caca_display = zend_register_list_destructors_ex(php_caca_display_dtor, NULL, PHP_CACA_DISPLAY_RES_NAME, module_number);
203        le_caca_event = zend_register_list_destructors_ex(php_caca_event_dtor, NULL, PHP_CACA_EVENT_RES_NAME, module_number);
204       
205        REGISTER_LONG_CONSTANT("CACA_BLACK", CACA_BLACK, CONST_CS | CONST_PERSISTENT);
206        REGISTER_LONG_CONSTANT("CACA_BLUE", CACA_BLUE, CONST_CS | CONST_PERSISTENT);
207        REGISTER_LONG_CONSTANT("CACA_GREEN", CACA_GREEN, CONST_CS | CONST_PERSISTENT);
208        REGISTER_LONG_CONSTANT("CACA_CYAN", CACA_CYAN, CONST_CS | CONST_PERSISTENT);
209        REGISTER_LONG_CONSTANT("CACA_RED", CACA_RED, CONST_CS | CONST_PERSISTENT);
210        REGISTER_LONG_CONSTANT("CACA_MAGENTA", CACA_MAGENTA, CONST_CS | CONST_PERSISTENT);
211        REGISTER_LONG_CONSTANT("CACA_BROWN", CACA_BROWN, CONST_CS | CONST_PERSISTENT);
212        REGISTER_LONG_CONSTANT("CACA_LIGHTGRAY", CACA_LIGHTGRAY, CONST_CS | CONST_PERSISTENT);
213        REGISTER_LONG_CONSTANT("CACA_DARKGRAY", CACA_DARKGRAY, CONST_CS | CONST_PERSISTENT);
214        REGISTER_LONG_CONSTANT("CACA_LIGHTBLUE", CACA_LIGHTBLUE, CONST_CS | CONST_PERSISTENT);
215        REGISTER_LONG_CONSTANT("CACA_LIGHTGREEN", CACA_LIGHTGREEN, CONST_CS | CONST_PERSISTENT);
216        REGISTER_LONG_CONSTANT("CACA_LIGHTCYAN", CACA_LIGHTCYAN, CONST_CS | CONST_PERSISTENT);
217        REGISTER_LONG_CONSTANT("CACA_LIGHTRED", CACA_LIGHTRED, CONST_CS | CONST_PERSISTENT);
218        REGISTER_LONG_CONSTANT("CACA_LIGHTMAGENTA", CACA_LIGHTMAGENTA, CONST_CS | CONST_PERSISTENT);
219        REGISTER_LONG_CONSTANT("CACA_YELLOW", CACA_YELLOW, CONST_CS | CONST_PERSISTENT);
220        REGISTER_LONG_CONSTANT("CACA_WHITE", CACA_WHITE, CONST_CS | CONST_PERSISTENT);
221        REGISTER_LONG_CONSTANT("CACA_DEFAULT", CACA_DEFAULT, CONST_CS | CONST_PERSISTENT);
222        REGISTER_LONG_CONSTANT("CACA_TRANSPARENT", CACA_TRANSPARENT, CONST_CS | CONST_PERSISTENT);
223        REGISTER_LONG_CONSTANT("CACA_BOLD", CACA_BOLD, CONST_CS | CONST_PERSISTENT);
224        REGISTER_LONG_CONSTANT("CACA_ITALICS", CACA_ITALICS, CONST_CS | CONST_PERSISTENT);
225        REGISTER_LONG_CONSTANT("CACA_UNDERLINE", CACA_UNDERLINE, CONST_CS | CONST_PERSISTENT);
226        REGISTER_LONG_CONSTANT("CACA_BLINK", CACA_BLINK, CONST_CS | CONST_PERSISTENT);
227
228        REGISTER_LONG_CONSTANT("CACA_EVENT_NONE", CACA_EVENT_NONE, CONST_CS | CONST_PERSISTENT);
229        REGISTER_LONG_CONSTANT("CACA_EVENT_KEY_PRESS", CACA_EVENT_KEY_PRESS, CONST_CS | CONST_PERSISTENT);
230        REGISTER_LONG_CONSTANT("CACA_EVENT_KEY_RELEASE", CACA_EVENT_KEY_RELEASE, CONST_CS | CONST_PERSISTENT);
231        REGISTER_LONG_CONSTANT("CACA_EVENT_MOUSE_PRESS", CACA_EVENT_MOUSE_PRESS, CONST_CS | CONST_PERSISTENT);
232        REGISTER_LONG_CONSTANT("CACA_EVENT_MOUSE_RELEASE", CACA_EVENT_MOUSE_RELEASE, CONST_CS | CONST_PERSISTENT);
233        REGISTER_LONG_CONSTANT("CACA_EVENT_MOUSE_MOTION", CACA_EVENT_MOUSE_MOTION, CONST_CS | CONST_PERSISTENT);
234        REGISTER_LONG_CONSTANT("CACA_EVENT_RESIZE", CACA_EVENT_RESIZE, CONST_CS | CONST_PERSISTENT);
235        REGISTER_LONG_CONSTANT("CACA_EVENT_QUIT", CACA_EVENT_QUIT, CONST_CS | CONST_PERSISTENT);
236        REGISTER_LONG_CONSTANT("CACA_EVENT_ANY", CACA_EVENT_ANY, CONST_CS | CONST_PERSISTENT);
237
238        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_A", CACA_KEY_CTRL_A, CONST_CS | CONST_PERSISTENT);
239        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_B", CACA_KEY_CTRL_B, CONST_CS | CONST_PERSISTENT);
240        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_C", CACA_KEY_CTRL_C, CONST_CS | CONST_PERSISTENT);
241        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_D", CACA_KEY_CTRL_D, CONST_CS | CONST_PERSISTENT);
242        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_E", CACA_KEY_CTRL_E, CONST_CS | CONST_PERSISTENT);
243        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_F", CACA_KEY_CTRL_F, CONST_CS | CONST_PERSISTENT);
244        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_G", CACA_KEY_CTRL_G, CONST_CS | CONST_PERSISTENT);
245        REGISTER_LONG_CONSTANT("CACA_KEY_BACKSPACE", CACA_KEY_BACKSPACE, CONST_CS | CONST_PERSISTENT);
246        REGISTER_LONG_CONSTANT("CACA_KEY_TAB", CACA_KEY_TAB, CONST_CS | CONST_PERSISTENT);
247        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_J", CACA_KEY_CTRL_J, CONST_CS | CONST_PERSISTENT);
248        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_K", CACA_KEY_CTRL_K, CONST_CS | CONST_PERSISTENT);
249        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_L", CACA_KEY_CTRL_L, CONST_CS | CONST_PERSISTENT);
250        REGISTER_LONG_CONSTANT("CACA_KEY_RETURN", CACA_KEY_RETURN, CONST_CS | CONST_PERSISTENT);
251        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_N", CACA_KEY_CTRL_N, CONST_CS | CONST_PERSISTENT);
252        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_O", CACA_KEY_CTRL_O, CONST_CS | CONST_PERSISTENT);
253        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_P", CACA_KEY_CTRL_P, CONST_CS | CONST_PERSISTENT);
254        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_Q", CACA_KEY_CTRL_Q, CONST_CS | CONST_PERSISTENT);
255        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_R", CACA_KEY_CTRL_R, CONST_CS | CONST_PERSISTENT);
256        REGISTER_LONG_CONSTANT("CACA_KEY_PAUSE", CACA_KEY_PAUSE, CONST_CS | CONST_PERSISTENT);
257        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_T", CACA_KEY_CTRL_T, CONST_CS | CONST_PERSISTENT);
258        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_U", CACA_KEY_CTRL_U, CONST_CS | CONST_PERSISTENT);
259        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_V", CACA_KEY_CTRL_V, CONST_CS | CONST_PERSISTENT);
260        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_W", CACA_KEY_CTRL_W, CONST_CS | CONST_PERSISTENT);
261        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_X", CACA_KEY_CTRL_X, CONST_CS | CONST_PERSISTENT);
262        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_Y", CACA_KEY_CTRL_Y, CONST_CS | CONST_PERSISTENT);
263        REGISTER_LONG_CONSTANT("CACA_KEY_CTRL_Z", CACA_KEY_CTRL_Z, CONST_CS | CONST_PERSISTENT);
264        REGISTER_LONG_CONSTANT("CACA_KEY_ESCAPE", CACA_KEY_ESCAPE, CONST_CS | CONST_PERSISTENT);
265        REGISTER_LONG_CONSTANT("CACA_KEY_DELETE", CACA_KEY_DELETE, CONST_CS | CONST_PERSISTENT);
266        REGISTER_LONG_CONSTANT("CACA_KEY_UP", CACA_KEY_UP, CONST_CS | CONST_PERSISTENT);
267        REGISTER_LONG_CONSTANT("CACA_KEY_DOWN", CACA_KEY_DOWN, CONST_CS | CONST_PERSISTENT);
268        REGISTER_LONG_CONSTANT("CACA_KEY_LEFT", CACA_KEY_LEFT, CONST_CS | CONST_PERSISTENT);
269        REGISTER_LONG_CONSTANT("CACA_KEY_RIGHT", CACA_KEY_RIGHT, CONST_CS | CONST_PERSISTENT);
270        REGISTER_LONG_CONSTANT("CACA_KEY_INSERT", CACA_KEY_INSERT, CONST_CS | CONST_PERSISTENT);
271        REGISTER_LONG_CONSTANT("CACA_KEY_HOME", CACA_KEY_HOME, CONST_CS | CONST_PERSISTENT);
272        REGISTER_LONG_CONSTANT("CACA_KEY_END", CACA_KEY_END, CONST_CS | CONST_PERSISTENT);
273        REGISTER_LONG_CONSTANT("CACA_KEY_PAGEUP", CACA_KEY_PAGEUP, CONST_CS | CONST_PERSISTENT);
274        REGISTER_LONG_CONSTANT("CACA_KEY_PAGEDOWN", CACA_KEY_PAGEDOWN, CONST_CS | CONST_PERSISTENT);
275        REGISTER_LONG_CONSTANT("CACA_KEY_F1", CACA_KEY_F1, CONST_CS | CONST_PERSISTENT);
276        REGISTER_LONG_CONSTANT("CACA_KEY_F2", CACA_KEY_F2, CONST_CS | CONST_PERSISTENT);
277        REGISTER_LONG_CONSTANT("CACA_KEY_F3", CACA_KEY_F3, CONST_CS | CONST_PERSISTENT);
278        REGISTER_LONG_CONSTANT("CACA_KEY_F4", CACA_KEY_F4, CONST_CS | CONST_PERSISTENT);
279        REGISTER_LONG_CONSTANT("CACA_KEY_F5", CACA_KEY_F5, CONST_CS | CONST_PERSISTENT);
280        REGISTER_LONG_CONSTANT("CACA_KEY_F6", CACA_KEY_F6, CONST_CS | CONST_PERSISTENT);
281        REGISTER_LONG_CONSTANT("CACA_KEY_F7", CACA_KEY_F7, CONST_CS | CONST_PERSISTENT);
282        REGISTER_LONG_CONSTANT("CACA_KEY_F8", CACA_KEY_F8, CONST_CS | CONST_PERSISTENT);
283        REGISTER_LONG_CONSTANT("CACA_KEY_F9", CACA_KEY_F9, CONST_CS | CONST_PERSISTENT);
284        REGISTER_LONG_CONSTANT("CACA_KEY_F10", CACA_KEY_F10, CONST_CS | CONST_PERSISTENT);
285        REGISTER_LONG_CONSTANT("CACA_KEY_F11", CACA_KEY_F11, CONST_CS | CONST_PERSISTENT);
286        REGISTER_LONG_CONSTANT("CACA_KEY_F12", CACA_KEY_F12, CONST_CS | CONST_PERSISTENT);
287        REGISTER_LONG_CONSTANT("CACA_KEY_F13", CACA_KEY_F13, CONST_CS | CONST_PERSISTENT);
288        REGISTER_LONG_CONSTANT("CACA_KEY_F14", CACA_KEY_F14, CONST_CS | CONST_PERSISTENT);
289        REGISTER_LONG_CONSTANT("CACA_KEY_F15", CACA_KEY_F15, CONST_CS | CONST_PERSISTENT);
290
291        return SUCCESS;
292}
293
294//----------SOME USEFULL MACROS---------------//
295
296#define FETCH_CANVAS(canvas) \
297        zval *_zval; \
298        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &_zval) == FAILURE) { \
299                RETURN_FALSE; \
300        } \
301        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
302
303#define FETCH_DISPLAY(display) \
304        zval *_zval; \
305        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &_zval) == FAILURE) { \
306                RETURN_FALSE; \
307        } \
308        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
309
310#define FETCH_EVENT(event) \
311        zval *_zval; \
312        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &_zval) == FAILURE) { \
313                RETURN_FALSE; \
314        } \
315        ZEND_FETCH_RESOURCE(event, caca_event_t*, &_zval, -1, PHP_CACA_EVENT_RES_NAME, le_caca_event);
316
317#define RETURN_CHAR(c) \
318        char *str = emalloc(2); \
319        str[0] = c; \
320        str[1] = '\0'; \
321        RETURN_STRING(str, 0);
322
323
324//-------CACA'S FUNCTIONS----------------//
325
326PHP_FUNCTION(caca_create_canvas) {
327        long width, height = 0;
328        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &width, &height) == FAILURE) {
329                RETURN_FALSE;
330        }
331        caca_canvas_t *canvas = caca_create_canvas(width, height);
332        if (!canvas) {
333                RETURN_FALSE;
334        }
335        ZEND_REGISTER_RESOURCE(return_value, canvas, le_caca_canvas);
336}
337
338PHP_FUNCTION(caca_manage_canvas) {
339}
340
341PHP_FUNCTION(caca_unmanage_canvas) {
342}
343
344PHP_FUNCTION(caca_set_canvas_size) {
345        zval *_zval;
346        long width, height = 0;
347        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &width, &height) == FAILURE) {
348                RETURN_FALSE;
349        }
350        caca_canvas_t *canvas;
351        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
352        RETURN_BOOL(caca_set_canvas_size(canvas, width, height) == 0);
353}
354
355PHP_FUNCTION(caca_get_canvas_width) {
356        caca_canvas_t *canvas;
357        FETCH_CANVAS(canvas);
358        RETURN_LONG(caca_get_canvas_width(canvas));
359}
360
361PHP_FUNCTION(caca_get_canvas_height) {
362        caca_canvas_t *canvas;
363        FETCH_CANVAS(canvas);
364        RETURN_LONG(caca_get_canvas_height(canvas));
365}
366
367PHP_FUNCTION(caca_get_canvas_chars) {
368        caca_canvas_t *canvas;
369        FETCH_CANVAS(canvas);
370        RETURN_STRING(estrdup(caca_get_canvas_chars(canvas)), 0); //TODO: check that return \0 terminated string
371}
372
373PHP_FUNCTION(caca_get_canvas_attrs) {
374        caca_canvas_t *canvas;
375        FETCH_CANVAS(canvas);
376        RETURN_STRING(estrdup(caca_get_canvas_attrs(canvas)), 0); //TODO: check that return \0 terminated string
377}
378
379PHP_FUNCTION(caca_rand) {
380        long min, max = 0;
381        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &min, &max) == FAILURE) {
382                RETURN_FALSE;
383        }
384        RETURN_LONG(caca_rand(min, max));
385}
386
387PHP_FUNCTION(caca_get_version) {
388        RETURN_STRING(estrdup(caca_get_version()), 0);
389}
390
391PHP_FUNCTION(caca_gotoxy) {
392        zval *_zval;
393        long x, y = 0;
394        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &x, &y) == FAILURE) {
395                RETURN_FALSE;
396        }
397        caca_canvas_t *canvas;
398        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
399        RETURN_BOOL(caca_gotoxy(canvas, x, y) == 0);
400}
401
402PHP_FUNCTION(caca_get_cursor_x) {
403        caca_canvas_t *canvas;
404        FETCH_CANVAS(canvas);
405        RETURN_LONG(caca_get_cursor_x(canvas));
406}
407
408PHP_FUNCTION(caca_get_cursor_y) {
409        caca_canvas_t *canvas;
410        FETCH_CANVAS(canvas);
411        RETURN_LONG(caca_get_cursor_y(canvas));
412}
413
414PHP_FUNCTION(caca_put_char) {
415        zval *_zval;
416        long x, y, c = 0;
417        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &_zval, &x, &y, &c) == FAILURE) {
418                RETURN_FALSE;
419        }
420        caca_canvas_t *canvas;
421        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
422        RETURN_BOOL(caca_put_char(canvas, x, y, c) == 0);
423}
424
425PHP_FUNCTION(caca_get_char) {
426        zval *_zval;
427        long x, y = 0;
428        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &x, &y) == FAILURE) {
429                RETURN_FALSE;
430        }
431        caca_canvas_t *canvas;
432        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
433        RETURN_CHAR(caca_get_char(canvas, x, y));
434}
435
436PHP_FUNCTION(caca_put_str) {
437        zval *_zval;
438        char *str;
439        long x, y, str_len = 0;
440        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlls", &_zval, &x, &y, &str, &str_len) == FAILURE) {
441                RETURN_FALSE;
442        }
443        caca_canvas_t *canvas;
444        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
445        RETURN_BOOL(caca_put_str(canvas, x, y, str) == 0);
446}
447
448PHP_FUNCTION(caca_printf) {
449}
450
451PHP_FUNCTION(caca_clear_canvas) {
452        caca_canvas_t *canvas;
453        FETCH_CANVAS(canvas);
454        RETURN_LONG(caca_clear_canvas(canvas));
455}
456
457PHP_FUNCTION(caca_set_canvas_handle) {
458        zval *_zval;
459        long x, y = 0;
460        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &x, &y) == FAILURE) {
461                RETURN_FALSE;
462        }
463        caca_canvas_t *canvas;
464        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
465        RETURN_BOOL(caca_set_canvas_handle(canvas, x, y) == 0);
466}
467
468PHP_FUNCTION(caca_get_canvas_handle_x) {
469        caca_canvas_t *canvas;
470        FETCH_CANVAS(canvas);
471        RETURN_LONG(caca_get_canvas_handle_x(canvas));
472}
473
474PHP_FUNCTION(caca_get_canvas_handle_y) {
475        caca_canvas_t *canvas;
476        FETCH_CANVAS(canvas);
477        RETURN_LONG(caca_get_canvas_handle_y(canvas));
478}
479
480PHP_FUNCTION(caca_blit) {
481        zval *_zval1, *_zval2, *_zval3 = NULL;
482        long x, y = 0;
483        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllr|r", &_zval1, &x, &y, &_zval2, &_zval3) == FAILURE) {
484                RETURN_FALSE;
485        }
486        caca_canvas_t *dst, *src, *mask = NULL;
487        ZEND_FETCH_RESOURCE(dst, caca_canvas_t*, &_zval1, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
488        ZEND_FETCH_RESOURCE(src, caca_canvas_t*, &_zval2, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
489        if (_zval3) {
490                ZEND_FETCH_RESOURCE(mask, caca_canvas_t*, &_zval3, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
491        }
492        RETURN_BOOL(caca_blit(dst, x, y, src, NULL) == 0);
493}
494
495PHP_FUNCTION(caca_set_canvas_boundaries) {
496        zval *_zval;
497        long x, y, width, height = 0;
498        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &_zval, &x, &y, &width, &height) == FAILURE) {
499                RETURN_FALSE;
500        }
501        caca_canvas_t *canvas;
502        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
503        RETURN_BOOL(caca_set_canvas_boundaries(canvas, x, y, width, height) == 0);
504}
505
506PHP_FUNCTION(caca_invert) {
507        caca_canvas_t *canvas;
508        FETCH_CANVAS(canvas);
509        RETURN_BOOL(caca_invert(canvas) == 0);
510}
511
512PHP_FUNCTION(caca_flip) {
513        caca_canvas_t *canvas;
514        FETCH_CANVAS(canvas);
515        RETURN_BOOL(caca_flip(canvas) == 0);
516}
517
518PHP_FUNCTION(caca_flop) {
519        caca_canvas_t *canvas;
520        FETCH_CANVAS(canvas);
521        RETURN_BOOL(caca_flop(canvas) == 0);
522}
523
524PHP_FUNCTION(caca_rotate_180) {
525        caca_canvas_t *canvas;
526        FETCH_CANVAS(canvas);
527        RETURN_BOOL(caca_rotate_180(canvas) == 0);
528}
529
530PHP_FUNCTION(caca_rotate_left) {
531        caca_canvas_t *canvas;
532        FETCH_CANVAS(canvas);
533        RETURN_BOOL(caca_rotate_left(canvas) == 0);
534}
535
536PHP_FUNCTION(caca_rotate_right) {
537        caca_canvas_t *canvas;
538        FETCH_CANVAS(canvas);
539        RETURN_BOOL(caca_rotate_right(canvas) == 0);
540}
541
542PHP_FUNCTION(caca_stretch_left) {
543        caca_canvas_t *canvas;
544        FETCH_CANVAS(canvas);
545        RETURN_BOOL(caca_stretch_left(canvas) == 0);
546}
547
548PHP_FUNCTION(caca_stretch_right) {
549        caca_canvas_t *canvas;
550        FETCH_CANVAS(canvas);
551        RETURN_BOOL(caca_stretch_right(canvas) == 0);
552}
553
554PHP_FUNCTION(caca_get_attr) {
555}
556
557PHP_FUNCTION(caca_set_attr) {
558}
559
560PHP_FUNCTION(caca_put_attr) {
561}
562
563PHP_FUNCTION(caca_set_color_ansi) {
564        zval *_zval;
565        long foreground, background = 0;
566        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &foreground, &background) == FAILURE) {
567                RETURN_FALSE;
568        }
569        caca_canvas_t *canvas;
570        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
571        RETURN_BOOL(caca_set_color_ansi(canvas, foreground, background) == 0);
572}
573
574PHP_FUNCTION(caca_set_color_argb) {
575}
576
577PHP_FUNCTION(caca_attr_to_ansi) {
578}
579
580PHP_FUNCTION(caca_attr_to_ansi_fg) {
581}
582
583PHP_FUNCTION(caca_attr_to_ansi_bg) {
584}
585
586PHP_FUNCTION(caca_draw_line) {
587        zval *_zval;
588        char *str;
589        long str_len, xa, ya, xb, yb = 0;
590        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllls", &_zval, &xa, &ya, &xb, &yb, &str, &str_len) == FAILURE) {
591                RETURN_FALSE;
592        }
593        caca_canvas_t *canvas;
594        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
595        if (str_len != 1) {
596                RETURN_FALSE;
597        }
598        RETURN_BOOL(caca_draw_line(canvas, xa, ya, xb, yb, str[0]) == 0);
599}
600
601PHP_FUNCTION(caca_draw_polyline) {
602}
603
604PHP_FUNCTION(caca_draw_thin_line) {
605        zval *_zval;
606        long xa, ya, xb, yb = 0;
607        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &_zval, &xa, &ya, &xb, &yb) == FAILURE) {
608                RETURN_FALSE;
609        }
610        caca_canvas_t *canvas;
611        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
612        RETURN_BOOL(caca_draw_thin_line(canvas, xa, ya, xb, yb) == 0);
613}
614
615PHP_FUNCTION(caca_draw_thin_polyline) {
616}
617
618PHP_FUNCTION(caca_draw_circle) {
619}
620
621PHP_FUNCTION(caca_draw_ellipse) {
622}
623
624PHP_FUNCTION(caca_draw_thin_ellipse) {
625}
626
627PHP_FUNCTION(caca_fill_ellipse) {
628}
629
630PHP_FUNCTION(caca_draw_box) {
631}
632
633PHP_FUNCTION(caca_draw_thin_box) {
634}
635
636PHP_FUNCTION(caca_fill_box) {
637}
638
639PHP_FUNCTION(caca_draw_triangle) {
640}
641
642PHP_FUNCTION(caca_draw_thin_triangle) {
643}
644
645PHP_FUNCTION(caca_fill_triangle) {
646}
647
648PHP_FUNCTION(caca_get_frame_count) {
649}
650
651PHP_FUNCTION(caca_set_frame) {
652}
653
654PHP_FUNCTION(caca_set_frame_name) {
655}
656
657PHP_FUNCTION(caca_create_frame) {
658}
659
660PHP_FUNCTION(caca_free_frame) {
661}
662
663PHP_FUNCTION(caca_set_dither_palette) {
664}
665
666PHP_FUNCTION(caca_set_dither_brightness) {
667}
668
669PHP_FUNCTION(caca_get_dither_brightness) {
670}
671
672PHP_FUNCTION(caca_set_dither_gamma) {
673}
674
675PHP_FUNCTION(caca_get_dither_gamma) {
676}
677
678PHP_FUNCTION(caca_set_dither_contrast) {
679}
680
681PHP_FUNCTION(caca_get_dither_contrast) {
682}
683
684PHP_FUNCTION(caca_set_dither_antialias) {
685}
686
687PHP_FUNCTION(caca_get_dither_antialias_list) {
688}
689
690PHP_FUNCTION(caca_get_dither_antialias) {
691}
692
693PHP_FUNCTION(caca_set_dither_color) {
694}
695
696PHP_FUNCTION(caca_get_dither_color_list) {
697}
698
699PHP_FUNCTION(caca_get_dither_color) {
700}
701
702PHP_FUNCTION(caca_set_dither_charset) {
703}
704
705PHP_FUNCTION(caca_get_dither_charset_list) {
706}
707
708PHP_FUNCTION(caca_get_dither_charset) {
709}
710
711PHP_FUNCTION(caca_set_dither_algorithm) {
712}
713
714PHP_FUNCTION(caca_get_dither_algorithm_list) {
715}
716
717PHP_FUNCTION(caca_get_dither_algorithm) {
718}
719
720PHP_FUNCTION(caca_dither_bitmap) {
721}
722
723PHP_FUNCTION(caca_get_font_list) {
724}
725
726PHP_FUNCTION(caca_get_font_width) {
727}
728
729PHP_FUNCTION(caca_get_font_height) {
730}
731
732PHP_FUNCTION(caca_render_canvas) {
733}
734
735PHP_FUNCTION(caca_canvas_set_figfont) {
736}
737
738PHP_FUNCTION(caca_put_figchar) {
739}
740
741PHP_FUNCTION(caca_flush_figlet) {
742}
743
744PHP_FUNCTION(caca_file_close) {
745}
746
747PHP_FUNCTION(caca_file_tell) {
748}
749
750PHP_FUNCTION(caca_file_read) {
751}
752
753PHP_FUNCTION(caca_file_write) {
754}
755
756PHP_FUNCTION(caca_file_gets) {
757}
758
759PHP_FUNCTION(caca_file_eof) {
760}
761
762PHP_FUNCTION(caca_import_memory) {
763        zval *_zval;
764        char *src, *type;
765        long src_len, type_len = 0;
766        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &_zval, &src, &src_len, &type, &type_len) == FAILURE) {
767                RETURN_FALSE;
768        }
769        caca_canvas_t *canvas;
770        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
771
772        RETURN_LONG(caca_import_memory(canvas, src, src_len, type));
773}
774
775PHP_FUNCTION(caca_import_file) {
776}
777
778PHP_FUNCTION(caca_get_import_list) {
779}
780
781PHP_FUNCTION(caca_get_export_list) {
782}
783
784PHP_FUNCTION(caca_create_display) {
785        caca_canvas_t *canvas;
786        FETCH_CANVAS(canvas);
787
788        caca_display_t *display = caca_create_display(canvas);
789        ZEND_REGISTER_RESOURCE(return_value, display, le_caca_display);
790}
791
792PHP_FUNCTION(caca_create_display_with_driver) {
793        zval *_zval;
794        char *str;
795        long str_len = 0;
796        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &_zval, &str, &str_len) == FAILURE) {
797                RETURN_FALSE;
798        }
799        caca_canvas_t *canvas;
800        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
801
802        caca_display_t *display = caca_create_display_with_driver(canvas, str);
803        if (!display) {
804                RETURN_FALSE;
805        }
806        ZEND_REGISTER_RESOURCE(return_value, display, le_caca_display);
807}
808
809PHP_FUNCTION(caca_get_display_driver_list) {
810}
811
812PHP_FUNCTION(caca_get_display_driver) {
813}
814
815PHP_FUNCTION(caca_set_display_driver) {
816}
817
818PHP_FUNCTION(caca_get_canvas) {
819}
820
821PHP_FUNCTION(caca_refresh_display) {
822        caca_display_t *display;
823        FETCH_DISPLAY(display);
824        RETURN_BOOL(caca_refresh_display(display) == 0);
825}
826
827PHP_FUNCTION(caca_set_display_time) {
828        zval *_zval;
829        long value = 0;
830        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &_zval, &value) == FAILURE) {
831                RETURN_FALSE;
832        }
833        caca_display_t *display;
834        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
835        RETURN_BOOL(caca_set_display_time(display, value) == 0);
836}
837
838PHP_FUNCTION(caca_get_display_time) {
839        caca_display_t *display;
840        FETCH_DISPLAY(display);
841        RETURN_LONG(caca_get_display_time(display)); //TODO: check return value
842}
843
844PHP_FUNCTION(caca_get_display_width) {
845        caca_display_t *display;
846        FETCH_DISPLAY(display);
847        RETURN_LONG(caca_get_display_width(display));
848}
849
850PHP_FUNCTION(caca_get_display_height) {
851        caca_display_t *display;
852        FETCH_DISPLAY(display);
853        RETURN_LONG(caca_get_display_height(display));
854}
855
856PHP_FUNCTION(caca_set_display_title) {
857        zval *_zval;
858        char *str;
859        long str_len = 0;
860        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &_zval, &str, &str_len) == FAILURE) {
861                RETURN_FALSE;
862        }
863        caca_display_t *display;
864        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
865        RETURN_BOOL(caca_set_display(display, str) == 0);
866}
867
868PHP_FUNCTION(caca_set_mouse) {
869        zval *_zval;
870        long value = 0;
871        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &_zval, &value) == FAILURE) {
872                RETURN_FALSE;
873        }
874        caca_display_t *display;
875        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
876        RETURN_BOOL(caca_set_mouse(display, value) == 0);
877}
878
879PHP_FUNCTION(caca_set_cursor) {
880        zval *_zval;
881        long value = 0;
882        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &_zval, &value) == FAILURE) {
883                RETURN_FALSE;
884        }
885        caca_display_t *display;
886        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
887        RETURN_BOOL(caca_set_cursor(display, value) == 0);
888}
889
890PHP_FUNCTION(caca_get_event) {
891        zval *_zval1, *_zval2 = NULL;
892        long g, aa = 0;
893        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|rl", &_zval1, &g, &_zval2, &aa) == FAILURE) {
894                RETURN_FALSE;
895        }
896        caca_display_t *display;
897        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval1, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
898
899        caca_event_t *event = NULL;
900        if (_zval2) {
901                ZEND_FETCH_RESOURCE(event, caca_event_t*, &_zval2, -1, PHP_CACA_EVENT_RES_NAME, le_caca_event);
902        }
903        RETURN_BOOL(caca_get_event(display, g, event, aa) == 0);
904}
905
906PHP_FUNCTION(caca_get_mouse_x) {
907        caca_display_t *display;
908        FETCH_DISPLAY(display);
909        RETURN_LONG(caca_get_mouse_x(display));
910}
911
912PHP_FUNCTION(caca_get_mouse_y) {
913        caca_display_t *display;
914        FETCH_DISPLAY(display);
915        RETURN_LONG(caca_get_mouse_y(display));
916}
917
918PHP_FUNCTION(caca_get_event_type) {
919}
920
921PHP_FUNCTION(caca_get_event_key_ch) {
922}
923
924PHP_FUNCTION(caca_get_event_mouse_button) {
925        caca_event_t *event;
926        FETCH_EVENT(event);
927        RETURN_LONG(caca_get_event_mouse_button(event));
928}
929
930PHP_FUNCTION(caca_get_event_mouse_x) {
931        caca_event_t *event;
932        FETCH_EVENT(event);
933        RETURN_LONG(caca_get_event_mouse_x(event));
934}
935
936PHP_FUNCTION(caca_get_event_mouse_y) {
937        caca_event_t *event;
938        FETCH_EVENT(event);
939        RETURN_LONG(caca_get_event_mouse_y(event));
940}
941
942PHP_FUNCTION(caca_get_event_resize_width) {
943        caca_event_t *event;
944        FETCH_EVENT(event);
945        RETURN_LONG(caca_get_event_resize_width(event));
946}
947
948PHP_FUNCTION(caca_get_event_resize_height) {
949        caca_event_t *event;
950        FETCH_EVENT(event);
951        RETURN_LONG(caca_get_event_resize_height(event));
952}
953
Note: See TracBrowser for help on using the repository browser.