Changed the entire file structure to remove the .c includes from cairo.c
[phpCairo.git] / src / cairo / CairoException.c
blob9f873c0d2b7bb4c9c93b6a7cad58ba7e4180584b
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;
9 /* {{{ Methods */
11 static zend_function_entry CairoException_methods[] = {
12 { NULL, NULL, NULL }
15 /* }}} Methods */
17 void class_init_CairoException(void)
19 zend_class_entry ce;
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));
30 return;
33 switch(status) {
34 case CAIRO_STATUS_SUCCESS:
35 return 0;
36 case CAIRO_STATUS_NO_MEMORY:
37 zend_throw_exception(CairoException_ce_ptr,"No memory", NULL);
38 break;
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);
42 break;
43 case CAIRO_STATUS_INVALID_RESTORE:
44 zend_throw_expetion(CairoException_ce_ptr, "Invalid restore", NULL);
45 break;
46 case CAIRO_STATUS_INVALID_POP_GROUP:
47 zend_throw_exception(CairoException_ce_ptr, "Pop group error", NULL);
48 break;
49 } */