1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2017 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 /* $Id$ */
20 
21 #ifndef PHP_INCOMPLETE_CLASS_H
22 #define PHP_INCOMPLETE_CLASS_H
23 
24 #include "ext/standard/basic_functions.h"
25 
26 #define PHP_IC_ENTRY \
27 	BG(incomplete_class)
28 
29 #define PHP_SET_CLASS_ATTRIBUTES(struc) \
30 	/* OBJECTS_FIXME: Fix for new object model */	\
31 	if (Z_OBJCE_P(struc) == BG(incomplete_class)) {	\
32 		class_name = php_lookup_class_name(struc); \
33 		if (!class_name) { \
34 			class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \
35 		} \
36 		incomplete_class = 1; \
37 	} else { \
38 		class_name = zend_string_copy(Z_OBJCE_P(struc)->name); \
39 	}
40 
41 #define PHP_CLEANUP_CLASS_ATTRIBUTES()	\
42 	zend_string_release(class_name)
43 
44 #define PHP_CLASS_ATTRIBUTES											\
45 	zend_string *class_name;											\
46 	zend_bool incomplete_class = 0
47 
48 #define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
49 #define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 PHPAPI zend_class_entry *php_create_incomplete_class(void);
56 PHPAPI zend_string *php_lookup_class_name(zval *object);
57 PHPAPI void  php_store_class_name(zval *object, const char *name, size_t len);
58 
59 #ifdef __cplusplus
60 };
61 #endif
62 
63 #endif
64