1/*
2 +----------------------------------------------------------------------+
3 | PHP Version 5 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2015 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_OBJ_HT_P(struc)->get_class_entry && \
32 Z_OBJCE_P(struc) == BG(incomplete_class)) { \
33 class_name = php_lookup_class_name(struc, &name_len); \
34 if (!class_name) { \
35 name_len = sizeof(INCOMPLETE_CLASS) - 1; \
36 class_name = estrndup(INCOMPLETE_CLASS, name_len); \
37 } \
38 free_class_name = 1; \
39 incomplete_class = 1; \
40 } else { \
41 free_class_name = !zend_get_object_classname(struc, (const char **)&class_name, &name_len TSRMLS_CC);\
42 }
43
44#define PHP_CLEANUP_CLASS_ATTRIBUTES() \
45 if (free_class_name) efree(class_name)
46
47#define PHP_CLASS_ATTRIBUTES \
48 char *class_name; \
49 zend_uint name_len; \
50 zend_bool free_class_name = 0; \
51 zend_bool incomplete_class = 0
52
53#define INCOMPLETE_CLASS "__PHP_Incomplete_Class"
54#define MAGIC_MEMBER "__PHP_Incomplete_Class_Name"
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60PHPAPI zend_class_entry *php_create_incomplete_class(TSRMLS_D);
61PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen);
62PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len);
63
64#ifdef __cplusplus
65};
66#endif
67
68#endif
69