Ignore:
Timestamp:
Oct 26, 2008, 1:40:00 AM (11 years ago)
Author:
nico
Message:
  • Add Php binding for caca's functions: caca_get_event, caca_set_display_time
  • Animate pink pig & add event managment in sample program "example1.php"
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca-php/php_caca.c

    r3104 r3105  
    806806
    807807PHP_FUNCTION(caca_set_display_time) {
     808        zval *_zval;
     809        long value = 0;
     810        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &_zval, &value) == FAILURE) {
     811                RETURN_FALSE;
     812        }
     813        caca_display_t *display;
     814        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
     815        RETURN_BOOL(caca_set_display_time(display, value) == 0);
    808816}
    809817
     
    861869
    862870PHP_FUNCTION(caca_get_event) {
     871        zval *_zval1, *_zval2 = NULL;
     872        long g, aa = 0;
     873        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|rl", &_zval1, &g, &_zval2, &aa) == FAILURE) {
     874                RETURN_FALSE;
     875        }
     876        caca_display_t *display;
     877        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval1, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
     878
     879        caca_event_t *event = NULL;
     880        if (_zval2) {
     881                ZEND_FETCH_RESOURCE(event, caca_event_t*, &_zval2, -1, PHP_CACA_EVENT_RES_NAME, le_caca_event);
     882        }
     883        RETURN_BOOL(caca_get_event(display, g, event, aa) == 0);
    863884}
    864885
Note: See TracChangeset for help on using the changeset viewer.