Fixed some more compile errors ...
[phpCairo.git] / individual_files / phpCairoPath.c
blobaeb00823d69b0e207fe0097c10cf834bd09dbb28
1 /* {{{ Class CairoPath */
3 static zend_class_entry * CairoPath_ce_ptr = NULL;
4 static zend_object_handlers CairoPath_handlers;
6 /*
7 typedef _path_object {
8 zend_object std;
9 cairo_path_t path;
10 } path_object;
12 /* {{{ Methods */
15 /* {{{ proto void construct()
17 PHP_METHOD(CairoPath, __construct)
19 zend_class_entry * _this_ce;
20 zval * _this_zval;
24 if (ZEND_NUM_ARGS()>0) {
25 WRONG_PARAM_COUNT;
29 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
32 /* }}} __construct */
36 /* {{{ proto string str()
38 PHP_METHOD(CairoPath, str)
40 zend_class_entry * _this_ce;
42 zval * _this_zval = NULL;
46 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPath_ce_ptr) == FAILURE) {
47 return;
50 _this_ce = Z_OBJCE_P(_this_zval);
53 php_error(E_WARNING, "str: not yet implemented"); RETURN_FALSE;
55 RETURN_STRINGL("", 0, 1);
57 /* }}} str */
60 static zend_function_entry CairoPath_methods[] = {
61 PHP_ME(CairoPath, __construct, NULL, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
62 PHP_ME(CairoPath, str, NULL, /**/ZEND_ACC_PUBLIC)
63 { NULL, NULL, NULL }
66 /* }}} Methods */
68 static void CairoPath_object_dtor(void *object)
70 path_object *path = (path_object *)object;
71 zend_hash_destroy(path->std.properties);
72 if((path->path)) {
73 cairo_path_destroy(path->path);
75 efree(object);
78 static zend_object_value CairoPath_object_new(zend_class_entry *ce)
80 zend_object_value retval;
81 path_object *path;
82 zval *temp;
84 path = emalloc(sizeof(path_object));
85 memcpy(path,0,sizeof(path_object));
87 path->std.ce = ce;
89 ALLOC_HASHTABLE(path->std.properties);
90 zend_hash_init(path->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
91 zend_hash_copy(path->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *));
92 retval.handle = zend_objects_store_put(path, NULL, (zend_objects_free_object_storage_t)CairoPath_object_dtor, NULL TSRMLS_CC);
93 retval.handlers = &CairoPath_handlers;
94 return retval;
98 static void class_init_CairoPath(void)
100 zend_class_entry ce;
102 INIT_CLASS_ENTRY(ce, "CairoPath", CairoPath_methods);
103 CairoPath_ce_ptr = zend_register_internal_class(&ce);
104 CairoPath_ce_ptr->create_object = CairoPath_object_new;
105 memcpy(&CairoPath_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
106 CairoPath_handlers.clone_obj = NULL;
110 /* }}} Class CairoPath */