1 #include "php_cairo_api.h"
2 #include "CairoExceptionMacro.h"
3 #include "php_cairo_ce_ptr.h"
5 /* {{{ Class CairoException */
7 //static zend_class_entry * CairoException_ce_ptr = NULL;
11 static zend_function_entry CairoException_methods
[] = {
17 void class_init_CairoException(void)
21 INIT_CLASS_ENTRY(ce
, "CairoException", CairoException_methods
);
22 CairoException_ce_ptr
= zend_register_internal_class_ex(&ce
, zend_exception_get_default(), "Exception" TSRMLS_CC
);
25 /* }}} Class CairoException */
27 void phpCairoCheckStatus(cairo_status_t status
)
29 zend_throw_exception(CairoException_ce_ptr
, cairo_status_to_string(status
));
34 case CAIRO_STATUS_SUCCESS:
36 case CAIRO_STATUS_NO_MEMORY:
37 zend_throw_exception(CairoException_ce_ptr,"No memory", NULL);
39 case CAIRO_STATUS_READ_ERROR:
40 case CAIRO_STATUS_WRITE_ERROR:
41 zend_throw_exception(CairoException_ce_ptr, cairo_status_to_string(status), NULL);
43 case CAIRO_STATUS_INVALID_RESTORE:
44 zend_throw_expetion(CairoException_ce_ptr, "Invalid restore", NULL);
46 case CAIRO_STATUS_INVALID_POP_GROUP:
47 zend_throw_exception(CairoException_ce_ptr, "Pop group error", NULL);