Back to index

php5  5.3.10
php_incomplete_class.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Author:  Sascha Schumann <sascha@schumann.cx>                        |
00016    +----------------------------------------------------------------------+
00017 */
00018 
00019 /* $Id: php_incomplete_class.h 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #ifndef PHP_INCOMPLETE_CLASS_H
00022 #define PHP_INCOMPLETE_CLASS_H
00023 
00024 #include "ext/standard/basic_functions.h"
00025 
00026 #define PHP_IC_ENTRY \
00027        BG(incomplete_class)
00028 
00029 #define PHP_SET_CLASS_ATTRIBUTES(struc) \
00030        /* OBJECTS_FIXME: Fix for new object model */    \
00031        if (Z_OBJ_HT_P(struc)->get_class_entry && \
00032             Z_OBJCE_P(struc) == BG(incomplete_class)) { \
00033               class_name = php_lookup_class_name(struc, &name_len); \
00034               if (!class_name) { \
00035                      name_len = sizeof(INCOMPLETE_CLASS) - 1; \
00036                      class_name = estrndup(INCOMPLETE_CLASS, name_len); \
00037               } \
00038               free_class_name = 1; \
00039               incomplete_class = 1; \
00040        } else { \
00041               free_class_name = !zend_get_object_classname(struc, &class_name, &name_len TSRMLS_CC);\
00042        }
00043 
00044 #define PHP_CLEANUP_CLASS_ATTRIBUTES()    \
00045        if (free_class_name) efree(class_name)
00046 
00047 #define PHP_CLASS_ATTRIBUTES                                                                             \
00048        char *class_name;                                                                                        \
00049        zend_uint name_len;                                                                                      \
00050        zend_bool free_class_name = 0;                                                                    \
00051        zend_bool incomplete_class = 0
00052 
00053 #define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
00054 #define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
00055 
00056 #ifdef __cplusplus
00057 extern "C" {
00058 #endif
00059 
00060 PHPAPI zend_class_entry *php_create_incomplete_class(TSRMLS_D);
00061 PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen);
00062 PHPAPI void  php_store_class_name(zval *object, const char *name, zend_uint len);
00063 
00064 #ifdef __cplusplus
00065 };
00066 #endif
00067 
00068 #endif