1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) The PHP Group                                          |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Author:  Sascha Schumann <sascha@schumann.cx>                        |
16    +----------------------------------------------------------------------+
17 */
18 
19 #ifndef PHP_INCOMPLETE_CLASS_H
20 #define PHP_INCOMPLETE_CLASS_H
21 
22 #include "ext/standard/basic_functions.h"
23 
24 #define PHP_IC_ENTRY \
25 	BG(incomplete_class)
26 
27 #define PHP_SET_CLASS_ATTRIBUTES(struc) \
28 	/* OBJECTS_FIXME: Fix for new object model */	\
29 	if (Z_OBJCE_P(struc) == BG(incomplete_class)) {	\
30 		class_name = php_lookup_class_name(struc); \
31 		if (!class_name) { \
32 			class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \
33 		} \
34 		incomplete_class = 1; \
35 	} else { \
36 		class_name = zend_string_copy(Z_OBJCE_P(struc)->name); \
37 	}
38 
39 #define PHP_CLEANUP_CLASS_ATTRIBUTES()	\
40 	zend_string_release_ex(class_name, 0)
41 
42 #define PHP_CLASS_ATTRIBUTES											\
43 	zend_string *class_name;											\
44 	zend_bool incomplete_class ZEND_ATTRIBUTE_UNUSED = 0
45 
46 #define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
47 #define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 PHPAPI zend_class_entry *php_create_incomplete_class(void);
54 PHPAPI zend_string *php_lookup_class_name(zval *object);
55 PHPAPI void  php_store_class_name(zval *object, const char *name, size_t len);
56 
57 #ifdef __cplusplus
58 };
59 #endif
60 
61 #endif
62